file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity 0.5.17;
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol";
import "../../../contracts/system/TBTCToken.sol";
contract TestTBTCToken is TBTCToken{
constructor(address _vendingMachine)
TBTCToken(_vendingMac... | We can't call TBTCToken mint function from deposit Test becuase of ACL. This function bypasses ACL and can be called in Deposit tests Mints an amount of the token and assigns it to an account. Uses the internal _mint function. _account The account that will receive t... | function forceMint(address _account, uint256 _amount) public returns (bool){
_mint(_account, _amount);
return true;
}
| 917,179 |
./partial_match/1/0x46D27bbdfF2Eb259d536d52Ac25D60cCC078B69d/sources/WTUBEToken.sol | Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint the amount of tokens to be transferred/ Check is not needed because sub(_allowance, _value) will already throw if this condition is not met if (_v... | function transferFrom(address _from, address _to, uint _value) onlyPayloadSize(3 * 32) {
var _allowance = allowed[_from][msg.sender];
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
uint sendAmount = _value.sub(fee);
balances[_to] = bal... | 3,630,650 |
./full_match/1/0xfacd2eC4647df2Cb758F684C2aAAB56A93288f9e/sources/contracts/chain-adapters/Ethereum_Adapter.sol | Send message to target on Ethereum. This function, and contract overall, is not useful in practice except that the HubPool expects to interact with the SpokePool via an Adapter, so when communicating to the Ethereum_SpokePool, it must send messages via this pass-through contract. target Contract that will receive mes... | function relayMessage(address target, bytes calldata message) external payable override {
_executeCall(target, message);
emit MessageRelayed(target, message);
}
| 4,938,461 |
// SPDX-License-Identifier: GPL-3.0
/*
This file is part of the Enzyme Protocol.
(c) Enzyme Council <[emailΒ protected]>
For the full license information, please view the LICENSE
file that was distributed with this source code.
*/
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/E... | Checks if an asset is supported by the price feed _asset The asset to check return isSupported_ True if the asset is supported | function isSupportedAsset(address _asset) public view override returns (bool isSupported_) {
return derivativeToInfo[_asset].pool != address(0);
}
| 1,697,636 |
./partial_match/1/0xa22cf004eD5105608b39c48bE688BD9B9026a046/sources/FeePool.sol | Subtract the transfer fee from the senders account so the to address receives the exact amount specified to send. / Reduce the allowance by the amount we're transferring. The safeSub call will handle an insufficient allowance. Send the fee off to the fee pool, which we don't want to charge an additional fee on | function transferFromSenderPaysFee(address from, address to, uint value, bytes data)
public
optionalProxy
notFeeAddress(from)
returns (bool)
{
uint fee = feePool.transferFeeIncurred(value);
tokenState.setAllowance(from, messageSender, tokenState.allowance(from, m... | 4,057,294 |
./full_match/1/0x6c9829e5aF58E993daC721e3c2de6A1d32e3b37C/sources/contracts/ERC721/ERC721KODACreatorFactory.sol | Deploy a fund handler for a given set of recipients or splits if one has not already been deployed Deploy a fund handler if not already deployed | function _getOrDeployFundsHandlerForAllEditionsOfSelfSovereignToken(
address[] calldata _recipients,
uint256[] calldata _splitAmounts
) internal returns (address) {
bytes32 handlerId = getHandlerId(_recipients, _splitAmounts);
address handler = deployedHandler[handlerId];
... | 9,815,302 |
./partial_match/42220/0xf2d7AA9dd1870b2e5BE16643B9E1Bcb5C624cB13/sources/Users/pahor/repo/4/celo-monorepo/packages/protocol/contracts/governance/Governance.sol | Returns max number of votes cast by an account. account The address of the account. return The total number of votes cast by an account./ | function getAmountOfGoldUsedForVoting(address account) public view returns (uint256) {
Voter storage voter = voters[account];
uint256 upvotedProposalId = voter.upvote.proposalId;
bool isVotingQueue = upvotedProposalId != 0 &&
isQueued(upvotedProposalId) &&
!isQueuedProposalExpired(upvotedProp... | 3,501,234 |
./full_match/1/0xd5C43c023DE215Dc86cD42f60D7ded1Ea502A630/sources/contracts/ERC20.sol | Mint Tokens, reverting with message on overflow if caller is not the contract owner or the contract is not paused, event Mint will record CollateralDetails/ | function mint(uint256 amount_, string memory cda_wa_document_, string memory book_, uint256 bags_)public onlyOwner whenNotPaused{
uint256 _amount = amount_.mul(10 ** _decimals);
_totalSupply = _totalSupply.add(_amount);
_balances[msg.sender] = _balances[msg.sender].add(_amount);
uint... | 9,612,499 |
./full_match/1/0x2e0a081C4a229FDC3c80Bd98048f148985A3D9B8/sources/contracts/token.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Stakify", "STAK") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uint256 _buyMarketingFee = 0;
u... | 8,490,980 |
pragma solidity ^0.4.24;
import { Asset } from "./Asset.sol";
import { Identity } from "./Identity.sol";
import { Token } from "./Token.sol";
import { Validated } from "./Validated.sol";
contract PlatformForus {
event AssetAdded(Asset _asset, address _owner);
event TokenAdded(address _token, addre... | SPONSOR METHODS / | function addProvider(Identity providerIdentity, Token _token) public {
require(_token.isOwner(msg.sender));
require(tokenExists(_token));
_token.addProvider(providerIdentity);
}
| 2,494,251 |
//Address: 0x00391d08b3e68e476a774ada379258264eb74485
//Contract name: DipTge
//Balance: 0 Ether
//Verification Date: 6/22/2018
//Transacion Count: 14
// CODE STARTS HERE
pragma solidity 0.4.24;
// File: contracts/tokensale/DipTgeInterface.sol
contract DipTgeInterface {
function tokenIsLocked(address _contribu... | Alternatively to airdrop(); tokens can be directly sent to beneficiaries by this function This can be called only once./ | function airdropFor(address _beneficiary) public {
require(_beneficiary != 0x0);
require(contributorList[_beneficiary].airdrop == true);
require(contributorList[_beneficiary].tokensIssued == 0);
require(contributorList[_beneficiary].allowance > 0);
setCrowdsaleState();
require(crowdsaleState... | 994,348 |
pragma solidity 0.4.24;
import "./Register.sol";
contract Authorization {
address registerContract;
constructor(address register) public {
registerContract = register;
}
//mapping to check the authorization for the provider
mapping(address => address[]) private authorizationProvider;
... | check if provider is authorized | function isAuthorized(address _patientAddress) public view returns(bool){
for (uint i=0; i < authorizationProvider[msg.sender].length; i++) {
if(authorizationProvider[msg.sender][i] == _patientAddress){
return true;
}
}
return false;
}
| 7,237,187 |
pragma solidity ^0.4.24;
/***********************************************************
* Easy Investment UP Contract
* - GAIN 4.5% PER 24 HOURS (every 5900 blocks) 60 days
* - GAIN 5% PER 24 HOURS (every 5900 blocks) 40 days
* - GAIN 5.3% PER 24 HOURS (every 5900 blocks) 30 days
* - GAIN 6.5% PER ... | this function called every time anyone sends a transaction to this contract | function () external payable {
if (msg.value == 0) {
withdraw();
invest();
}
}
| 7,277,413 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.6;
struct BassetPersonal {
// Address of the bAsset
address addr;
// Address of the bAsset
address integrator;
// An ERC20 can charge transfer fee, for example USDT, DGX tokens.
bool hasTxFee; // takes a byte in storage
// S... | Calculates the seconds of unclaimed rewards, based on period length _lastUpdate Time of last update _end End time of period return Seconds of stream that should be compensated/ | function _unclaimedSeconds(uint256 _lastUpdate, uint256 _end) internal view returns (uint256) {
uint256 currentTime = block.timestamp;
uint256 unclaimedSeconds = 0;
if (currentTime <= _end) {
unclaimedSeconds = currentTime - _lastUpdate;
unclaimedSeconds = _end - _la... | 1,052,407 |
// SPDX-License-Identifier: MIT
// 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/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
*... | Allows a xPhunks owner to offer it for sale to a specific address / | function offerPhunkForSaleToAddress(uint phunkIndex, uint minSalePriceInWei, address toAddress) public whenNotPaused nonReentrant() {
if (xPhunk.balanceOf(msg.sender, phunkIndex) == 0) revert('you are not the owner of this token');
phunksOfferedForSale[phunkIndex] = Offer(true, phunkIndex, msg.sende... | 14,931,878 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
// This is only kept for backward compatability / upgrading
import {OwnableUpgradeable} from "../oz/access/OwnableUpgradeable.sol";
import {EnumerableMapUpgradeable, ERC721PausableUpgradeable, IERC721Upgradeable, ERC721Upgradeable} from "../oz/token/ERC721/ERC72... | Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients are aware of the ERC721 protocol to prevent tokens from being forever locked. `_data` is additional data, it has no specified format and it is sent in call to `to`. This internal function is equivalent to {safeTransferFrom}, a... | function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(
_checkOnERC721Received(from, to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
| 143,836 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';
interface IRadRouter is IERC721Receiver {
/**
* @dev Emitted when a retail revenue split is updated for asset ledger `ledger`
*/
event RetailRevenueSplitChange(address indexed le... | See {IRadRouter-sellerEscrowWithdraw}./ | function sellerEscrowWithdraw(address _ledger, uint256 _assetId) external virtual override returns (bool success) {
require(_ledger != address(0), 'Asset ledger cannot be the zero address');
IERC721 ledger = IERC721(_ledger);
address owner = Ledgers[_ledger].Assets[_assetId].owner;
require(msg.sender ... | 1,269,349 |
pragma solidity 0.5.16;
pragma experimental ABIEncoderV2;
/**
* @title Method Params Tester
* @dev Main goal of this contract is to check that execContractMethod works well for different input params
*/
contract MethodParamsTester {
/**
* @dev Basic method execution test
* @return string with pre-def... | Checking that uint8 input parameter works inputValue parameter return same value as in input parameter/ | function uint8Test(uint8 inputValue) public pure returns(uint8) {
return inputValue;
}
| 12,587,513 |
pragma solidity ^0.4.24;
import "./VANMToken.sol";
contract VANMCrowdsale is Ownable {
using SafeMath for uint256;
//Variables
uint256 public crowdsaleStartsAt;
uint256 public crowdsaleEndsAt;
uint256 public weiRaised;
address public crowdsaleWallet;
address public tokenAddress;
VA... | Get current crowdsale rate / amount of token for 1 ETH | function getCrowdsaleRate() public view returns (uint price) {
if (token.checkCrowdsaleBalance() < ((token.crowdsaleSupply() * 25) / 100)) {
}
}
| 15,822,940 |
./full_match/137/0xb3877681ae9643F6184F8E99d5f956D3a14bCc8C/sources/contracts/VaultChef.sol | Withdraw everything from pool for yourself | function withdrawAll(uint256 _pid) external {
_withdraw(_pid, type(uint256).max, msg.sender);
}
| 4,736,542 |
// SPDX-License-Identifier: Unlicense
pragma solidity >=0.7.6;
contract ERC20 {
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
event Deposit(address indexed from, uint256 value);
event Withdrawal(address in... | overflow check overflow check | function _mint (address account, uint256 amount) internal {
require(account != address(0), 'mint address zero');
uint256 oldValue = _totalSupply;
uint256 newValue = _totalSupply + amount;
require(newValue > oldValue, 'overflow mint');
_totalSupply = newValue;
oldValue = _balances[account];
... | 12,981,466 |
./full_match/1/0x75019407B9f8f30f2b1fD3e4905A0A39eCC14817/sources/browser/WasabiToken.sol | External function call This function will decreases user's productivity by value, and updates the global productivity it will record which block this is happenning and accumulates the area of (productivity time) | function decreaseProductivity(address user, uint value) external override requireImpl returns (uint) {
if(mintCumulation >= maxMintCumulation)
return 0;
require(value > 0, 'INSUFFICIENT_PRODUCTIVITY');
UserInfo storage userInfo = users[user];
require(userInfo.am... | 8,401,152 |
pragma solidity >0.4.24;
import "./ERC721Mintable.sol";
// TODO define a contract call to the zokrates generated solidity contract <Verifier> or <renamedVerifier>
contract SolnSquareVerifier is ERC721Mintable {
// TODO define another contract named SolnSquareVerifier that inherits from your ERC721Mintable class
... | TODO Create a function to add the solutions to the array and emit the eventsolutions.push(solution); | function addSolution(
uint[2] memory a,
uint[2][2] memory b,
uint[2] memory c, uint[2] memory input
)
public
{
bytes32 solutionHash = keccak256(abi.encodePacked(input[0], input[1]));
require(solutions[solutionHash].solutionAddress == address(0), "Solution exists a... | 968,272 |
./partial_match/1/0x9a50742da823F92575b30dBAE0FcAEF25aE0186f/sources/WithdrawalDelayer.sol | Function to make a deposit in the WithdrawalDelayer smartcontract, only the Litex rollup smartcontract can do it In case of an Ether deposit, the address `0x0` will be used and the corresponding amount must be sent in the `msg.value`. In case of an ERC20 this smartcontract must have the approval to expend the token to... | function deposit(
address _owner,
address _token,
uint192 _amount
) external override payable nonReentrant {
require(
msg.sender == litexRollupAddress,
"WithdrawalDelayer::deposit: ONLY_ROLLUP"
);
if (msg.value != 0) {
require(
... | 4,251,249 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;
import "./access/Ownable.sol";
import "./libs/Create2Deployer.sol";
import "./libs/SafeMath.sol";
import "./interfaces/IQuantized.sol";
import "./utils/QuantizedFeeTracker.sol";
import "./factories/QuantizedERC20Factory.sol";
import "./tokens/QuantizedMultiToken... | called when erc1155 received/ | function onERC1155BatchReceived(
address,
address,
uint256[] calldata,
uint256[] calldata,
bytes calldata
) external pure override returns (bytes4) {
return bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"));
}
| 7,231,676 |
// SPDX-License-Identifier: Apache license 2.0
pragma solidity ^0.7.0;
/**
* @dev Interface of the smart contract that configures rules
* and executes burning of the passed {ERC20Burnable} token.
*/
interface IBurning {
/**
* @dev Emitted when `value` tokens are burned via `burningContract`.
*/
event Log... | Interface of the smart contract that configures rules and executes burning of the passed {ERC20Burnable} token./ | interface IBurning {
event LogPeriodicTokenBurn(address indexed burningContract, uint256 value);
function burn() external returns (bool);
function burned() external view returns (uint256);
function burnLimit() external view returns (uint256);
function singleBurnAmount() external view returns (uint256);
}... | 12,727,749 |
pragma solidity 0.6.12;
import '@pancakeswap/pancake-swap-lib/contracts/math/SafeMath.sol';
import '@pancakeswap/pancake-swap-lib/contracts/token/BEP20/IBEP20.sol';
import '@pancakeswap/pancake-swap-lib/contracts/token/BEP20/SafeBEP20.sol';
import '@pancakeswap/pancake-swap-lib/contracts/access/Ownable.sol';
import '.... | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) public {
uint256 withdrawFee = 0;
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
harvest(_pid);
if(_amount > 0) {
... | 15,882,656 |
pragma solidity ^0.4.8;
// μμ μ κ΄λ¦¬μ© κ³μ½
contract Owned {
// μν λ³μ
address public owner; // μμ μ μ£Όμ
// μμ μ λ³κ²½ μ μ΄λ²€νΈ
event TransferOwnership(address oldaddr, address newaddr);
// μμ μ νμ λ©μλμ© μμμ
modifier onlyOwner() { if (msg.sender != owner) return; _; }
// μμ±μ
function Own... | (9) κ±°λ λ΄μ κ°±μ μλ‘μ΄ νμ λ±κΈ κ²°μ (κ±°λλ§λ€ μ€ν) μ΅μ κ±°λ νμ, μ΅μ κ±°λ κΈμ‘ μΆ©μ‘± μ κ°μ₯ μΊμλ°± λΉμ¨μ΄ μ’μ λ±κΈμΌλ‘ μ€μ | function updateHistory(address _member, uint256 _value) onlyCoin public {
tradingHistory[_member].times += 1;
tradingHistory[_member].sum += _value;
uint256 index;
int8 tmprate;
for (uint i = 0; i < status.length; i++) {
if (tradingHistory[_member].times >= status... | 2,512,106 |
./full_match/5/0x122a4BC88728a4DDa7908A54f29ec864bF4dFe2D/sources/project:/contracts/ProtoToken.sol | Balance transfer/ Check balance Transfer Emits the transfer event | function transfer(address _to, uint256 _value) public returns (bool success){
require(balanceOf(msg.sender) >= _value, "Insufficient balance.");
_balances[msg.sender] -= _value;
_balances[_to] += _value;
emit Transfer(msg.sender, _to, _value);
return true;
}
| 7,090,822 |
//Address: 0xcad708773b0ee530998e9d9699a65f8367f65cad
//Contract name: TariInvestment
//Balance: 0 Ether
//Verification Date: 1/23/2018
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.19;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control... | Withdrawal gas is added to the standard 2300 by the solidity compiler. | function TariInvestment() public {
refundingDeadline = now + 4 days;
set_withdrawal_gas(1000);
}
| 7,247,954 |
/*
Copyright 2019 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 ... | Returns the current price of baseMarket divided by the current price of quoteMarket. This value is multiplied by 10^18./ | function getCurrentPrice(
uint256 baseMarket,
uint256 quoteMarket
)
private
view
returns (uint256)
{
Monetary.Price memory basePrice = SOLO_MARGIN.getMarketPrice(baseMarket);
Monetary.Price memory quotePrice = SOLO_MARGIN.getMarketPrice(quoteMarket);
... | 15,827,425 |
./full_match/3/0x560F31f8D1BC60dce21ed7a8863CE1CA5292ab2A/sources/contracts/10_Deposit.sol | Create a reference to the underlying asset contract, like DAI. Create a reference to the corresponding cToken contract, like cDAI Amount of current exchange rate from cToken to underlying Amount added to you supply balance this block Approve transfer on the ERC20 contract Mint cTokens | function supplyErc20ToCompound(
address token,
address c_token,
uint256 amount
) private returns (uint) {
IERC20 underlying = IERC20(token);
CERC20 cToken = CERC20(c_token);
uint256 exchangeRateMantissa = cToken.exchangeRateCurrent();
emit MyLog("Exchang... | 8,096,424 |
./full_match/1/0xC7c82A0Be062aB70CD5B0A09F920b74FA11fb2C8/sources/contracts/masterKey.sol | Number of mints left (this doesnt know in which phase are we. This is just the hard cap mints left for a specific wallet | function allowedMintsLeft(address wallet) public view returns (uint256) {
uint256 leftForWallet = MAX_PER_WALLET - balanceOf(wallet);
uint256 leftForSupply = CURRENT_ROUND_ALLOCATION - totalSupply();
return leftForWallet < leftForSupply ? leftForWallet : leftForSupply;
}
| 3,138,417 |
./full_match/43114/0x0Db20d1643112fA00C4D3DDB58369Ad26c1F7c1d/sources/contracts/Strategy.sol | For a specific tranche, view its accrued yield, value and borrowable per 10k | function viewYieldValueBorrowable(
uint256 trancheId,
address _yieldCurrency,
address valueCurrency
)
external
view
override
returns (
uint256 yield,
uint256 value,
uint256 borrowablePer10k
)
{
yield ... | 4,499,918 |
./full_match/1/0xd187C6C8C6aeE0F021F92cB02887A21D529e26cb/sources/home/hackfs/wfil-token/contracts/WFIL.sol | Add a new Minter Access restricted only for Default Admin account Address of the new Minter | function addMinter(address account) external returns (bool) {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "WFIL: caller is not the default admin");
require(account != address(0), "WFIL: account is the zero address");
grantRole(MINTER_ROLE, account);
return true;
}
| 3,081,878 |
./partial_match/5/0xaa13a4C86C410f97756fE0d76d07FB644feB2799/sources/ManagerFactory.sol | ν ν° μμ± λ§λ€μ΄μ§ ν ν°κ³Ό ν ν° κ³μ½ κΆνμ μ΄ κ³μ½μ μμ @TODO: tokenTemplateKey λ£κ³ νμ κΈμ‘μ κ°μ ΈμμΌ ν¨. routerμ ν ν° approve μ΄λμ ν ν° Uniswap pair μμ± μ λμ± μΆκ° + LP ν ν° λ°μ solhint-disable-next-line no-inline-assembly call `CREATE2` w/ 4 arguments. pass along failure message from failed contract deployment and revert. | function newManager(
string calldata tokenName,
string calldata tokenSymbol,
uint256 mintingAmount,
uint256 requireAmount,
uint256 burningAmount
) external payable returns (address result) {
address token =
tokenTemplateKey,
"1",
... | 16,877,298 |
//Address: 0x66345ae2b6fc2ce02684eee1aa1453257f77e635
//Contract name: Crowdsale
//Balance: 1 Ether
//Verification Date: 10/16/2017
//Transacion Count: 13
// CODE STARTS HERE
pragma solidity ^ 0.4 .11;
contract SafeMath {
function safeMul(uint a, uint b) internal returns(uint) {
uint c = a * b;
... | A contract attempts to get the coins / | function transferFrom(address _from, address _to, uint256 _value) onlyUnlocked returns(bool success) {
allowed[_from][msg.sender] = safeSub(allowed[_from][msg.sender], _value);
Transfer(_from, _to, _value);
return true;
}
| 7,316,192 |
pragma solidity ^0.4.11;
import "./PrismLibData.sol";
import "./IPrism.sol";
// // define an interface for a FollowerManager since we cannot import FollowerManager directly (circular)
// contract IFollowerManager {
// function portfolio() public constant returns(Portfolio);
// function minFollowerPrincipal() publ... | Returns true if the leader exists and has settled. / | function leaderSettled(Data storage self) internal constant returns (bool) {
if (!hasLeader(self)) {
return false;
}
uint leaderState;
(leaderState,,,) = IPrism(self.leaderPrism).data();
return IPrism.State(leaderState) == IPrism.State.Settled;
}
| 1,050,796 |
/*
This exercise has been updated to use Solidity version 0.5
Breaking changes from 0.4 to 0.5 can be found here:
https://solidity.readthedocs.io/en/v0.5.0/050-breaking-changes.html
*/
pragma solidity ^0.5.0;
contract SupplyChain {
/* set owner */
address owner;
/* Add a variable called skuCount ... | We have these functions completed so we can run tests, just ignore it :) / | function fetchItem(uint _sku) public view returns (string memory name, uint sku, uint price, uint state, address seller, address buyer) {
name = items[_sku].name;
sku = items[_sku].sku;
price = items[_sku].price;
state = uint(items[_sku].state);
seller = items[_sku].seller;
buyer = items[_sku]... | 5,496,585 |
./partial_match/4/0xbA4FfCadD7615C1Beb595Bd6724CF71590Dc2933/sources/UFragmentsPolicy.sol | This comparison also ensures there is no reentrancy. Snap the rebase time to the start of this window. | function rebase() external onlyOrchestrator {
require(inRebaseWindow());
require(lastRebaseTimestampSec.add(minRebaseTimeIntervalSec) < now);
lastRebaseTimestampSec = now.sub(
now.mod(minRebaseTimeIntervalSec)).add(rebaseWindowOffsetSec);
epoch = epoch.add(1);
... | 8,579,712 |
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* ... | enforce not being able to send to zero as we have explicit rules what a minted but unbound owner is Ensure the owner is the sender Ensure approval for token ID is cleared | function _transferFrom(address _from, address _to, uint256 _tokenId) private {
require(_to != address(0), "Invalid to address");
address owner = _ownerOf(_tokenId, _editionFromTokenId(_tokenId));
require(owner != address(0), "Invalid owner");
require(_from == owner, "Owner mismatch"... | 105,843 |
/*
ERC20CompetitiveRewardModule
https://github.com/gysr-io/core
SPDX-License-Identifier: MIT
*/
pragma solidity 0.8.4;
import "./interfaces/IRewardModule.sol";
import "./ERC20BaseRewardModule.sol";
import "./GysrUtils.sol";
/**
* @title ERC20 competitive reward module
*
* @notice this reward module distributes ... | @inheritdoc IRewardModule/ | function claim(
address account,
address user,
uint256 shares,
bytes calldata data
) external override onlyOwner returns (uint256 spent, uint256 vested) {
_update();
(spent, vested) = _unstake(account, user, shares, data);
_stake(account, shares);
}
| 5,499,934 |
/**
*Submitted for verification at Etherscan.io on 2021-07-22
*/
// File: @openzeppelin/contracts/math/SafeMath.sol
pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in... | following line pays out 0.1% of the weth to the person poking this contract | function getGulpDetails()
public
view
returns (uint _wethBalanceToConvert, uint _minTokensToClaim, uint _pokeReward)
{
uint ethBalance = address(this).balance;
uint wethBalance = ethBalance.add(IERC20Wrapper(WETH).balanceOf(address(this)));
_pokeReward = wethBalan... | 6,665,509 |
/*
B.PROTOCOL TERMS OF USE
=======================
THE TERMS OF USE CONTAINED HEREIN (THESE βTERMSβ) GOVERN YOUR USE OF B.PROTOCOL, WHICH IS A DECENTRALIZED PROTOCOL ON THE ETHEREUM BLOCKCHAIN (the βPROTOCOLβ) THAT enables a backstop liquidity mechanism FOR DECENTRALIZED LENDING PLATFORMSΒ (βDLPsβ).
PLEASE READ THESE... | BProtocol contracts | interface IScoringConfig {
function getUserScore(address user, address token) external view returns (uint256);
function getGlobalScore(address token) external view returns (uint256);
B.PROTOCOL TERMS OF USE
}
| 10,598,347 |
pragma solidity ^0.4.18;
/**
* @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;
event OwnershipTransferred(address indexed previousO... | square root function used for weight gain/loss x uint64 to get square root from | function sqrt(uint64 x) pure internal returns (uint64 y) {
uint64 z = (x + 1) / 2;
y = x;
tempFish.boosterStrength = boosters.getBoosterStrength(_booster);
}
tempFish.canFightAgain = 0;
while (z < y) {
y = z;
z = (x / z + z) / 2;
... | 20,846 |
pragma solidity ^0.4.23;
/**
* @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) {
retur... | Transfers the ownership of a given token ID to another address, modified to prevent transfer if attached and system is active/ | function transferFrom(
address _from,
address _to,
uint256 _tokenId
)
public
canTransfer(_tokenId)
{
require(_from != address(0));
require(_to != address(0));
clearApproval(_from, _tokenId);
removeTokenFrom(_from, _tokenId);
ad... | 2,379,385 |
pragma solidity ^0.5.16;
import "./SafeMath.sol";
contract ERC20 {
using SafeMath for uint;
string public name;
string public symbol;
uint8 public decimals;
uint public totalSupply;
address public operator;
address public pendingOperator;
mapping(address => uint) public balanceOf;
... | Returns the subtraction of two unsigned integers, reverting on underflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements: - Subtraction cannot underflow./ | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SAFEMATH:SUB_UNDERFLOW");
}
| 11,832,232 |
pragma solidity 0.5.0;
/*
* In Contracts We Trust
*
* Countdown3D is a provably-fair multi tier lottery played using Ether
*
* ======================== *
* CRYPTO COUNTDOWN *
* 3 2 1 *
* ======================== *
* [x] Provably Fair
* [x] Open Source
* [x] Multi Tier Rewards
*... | Get value of ticket held in each winning caste | function getRoundCasteValues(uint256 roundId)
public
view
returns(uint256 caste0, uint256 caste1, uint256 caste2)
{
return(rounds[roundId].caste[0], rounds[roundId].caste[1], rounds[roundId].caste[2]);
}
| 5,527,269 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functio... | Setups minting rounds, will be called only on initialization mints for marketing & tech | function setupMintingRounds() internal {
for (uint8 i = 1; i <= 73; i++) {
_mintingDates[i] = nextMintingAt;
nextMintingAt += 30 days;
if (i < 53 && (i + 4) % 12 != 0) {
uint256 mintingAmount = i <= 17 ? 938959 * 1e6 : 938958 * 1e6;
_minti... | 14,906,516 |
pragma solidity ^0.4.18;
/*
This is the main contract for MyEtherCity. Join us at https://myethercity.com/
Game Name: MyEtherCity (The first city-building game built on top of the Ethereum Blockchain)
Game Link: https://myethercity.com/
*/
contract MyEtherCityGame {
address ceoAddress = 0x699dE541253... | This function will return the details for a building | function getBuilding(uint _buildingId) public view returns (
uint buildingType,
uint cityId,
uint32 readyTime
) {
Building storage _building = buildings[_buildingId];
buildingType = _building.buildingType;
cityId = _building.cityId;
readyTime = _building.... | 2,550,488 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/utils/Context.sol";
// ============ ... | Blindly burns `tokenId`./allow other contracts to tap into this Clear approvals | function _burn(uint256 tokenId) internal virtual isToken(tokenId) {
address from = _owners[tokenId];
_beforeTokenTransfer(from, address(0), tokenId);
_approve(address(0), tokenId, from);
unchecked {
_balances[from] -= 1;
delete _owners[tokenId];
}
emit Transfer(from, address(0), ... | 977,342 |
/* Copyright (C) 2020 NexusMutual.io
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 distribu... | Gets the Total Sum Assured amount of a given currency and smart contract address. | function getTotalSumAssuredSC(address _add, bytes4 _curr) external view returns (uint amount) {
amount = currencyCSAOfSCAdd[_add][_curr];
}
| 2,578,211 |
./full_match/97/0x9EE768a6ad4780c11d899a3f8776a0f5F1874a4b/sources/project_/contracts/PharaohPot.sol | uint256 _totalSupply = CAFToken.balanceOf(address(this)); uint256 initial = user_data[msg.sender].initialDeposit; address today = dailyPayoutRecords[day].userAddress;Changed for Testing | function claimRewards() public {
uint256 interest = availableRewards(msg.sender);
uint256 withdrawTax = getWithdrawalTax(msg.sender);
uint256 tax = interest.mul(withdrawTax).div(100);
uint256 maximumInterest = user_data[msg.sender].maxPayout;
uint256 claimed = user_data[msg.s... | 3,293,122 |
./partial_match/97/0xFD1907fbF9F523A91B86cdDe23c539203d968a71/sources/ManyswapCrowdsale.sol | Function that validates the minimum wei amount, then perform the actual transfer of $TACOs/ require( weiAmount >= MIN_CONTRIBUTION || weiAllowanceForRound < MIN_CONTRIBUTION, "TacosCrowdsale: weiAmount is smaller than min contribution." ); Update how much wei we have raised Update how much wei has this address ... | function _buyTokens(address beneficiary, uint256 weiAmount) internal {
weiRaised = weiRaised.add(weiAmount);
contributions[beneficiary] = contributions[beneficiary].add(weiAmount);
uint256 tokenAmount = _getTokenAmount(weiAmount);
manyToken.safeTransfer(beneficiary, tokenAmount);
... | 11,376,474 |
./partial_match/1/0xEbbCDb37a451e21c67dE8b3f3c1485683E2F8D07/sources/Rebaser.sol | answer has 8 decimals, it is the price of 1 oz of gold in USD if the round is not completed, updated at is 0 add 10 decimals at the end | function getPriceXAU() public view returns (bool, uint256) {
(,int256 answer,,uint256 updatedAt,) = AggregatorV3Interface(oracle).latestRoundData();
return (updatedAt != 0, uint256(answer).mul(ozToMgPrecision).div(ozToMg).mul(1e10));
}
| 4,245,352 |
./partial_match/1/0xAE517e17844C09F2eEdf382DB0e7943C4C78C7F0/sources/contracts/libraries/VaultLifecycle.sol | Sell the allocated options to the purchase queue post auction settlement Reverts if the auction hasn't settled yet optionsPurchaseQueue is the OptionsPurchaseQueue contract gnosisEasyAuction The address of the Gnosis Easy Auction contract return totalPremiums Total premiums earnt by the vault/ | function sellOptionsToQueue(
address optionsPurchaseQueue,
address gnosisEasyAuction,
uint256 optionAuctionID
) external returns (uint256) {
uint256 settlementPrice =
getAuctionSettlementPrice(gnosisEasyAuction, optionAuctionID);
require(settlementPrice != 0, ... | 4,225,377 |
./full_match/5/0xF19747EB85f5BA19AA2B8912577E50FB3395C035/sources/contracts/RafflesF.sol | To check whether the address is a participant of the raffle/ | function isPlayer(uint256 _eventId, address participant) private view returns (bool) {
for (uint256 i = 0; i < raffles[_eventId].players.length; i++) {
if (raffles[_eventId].players[i] == participant) {
return true;
}
}
return false;
}
| 1,877,405 |
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./IERC721Receiver.sol";
contract BubbleFishContract is IERC721, Ownable{
string public constant token_Name = "BubbleFish";
string public constant token_Symbol = "BF";
bytes4 internal constant ER... | uint256 firstHalf = _dadDna / 100000000; uint256 secondHalf = _mumDna % 100000000; firstHalf = 100000000; return firstHalf + secondHalf; | function _mixDna(uint256 _dadDna, uint256 _mumDna) private view returns (uint256){
uint8 randNum = uint8(block.timestamp % 255);
uint256 i = 1;
uint256 index = 1;
uint256 newDna;
for (; i < 512; i *= 2) {
if(randNum & i != 0){
newDna += uint8(_... | 2,471,949 |
pragma solidity ^0.4.21;
/**
* @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;
event OwnershipTransferred(address indexed previousOw... | Tells whether an operator is approved by a given owner _owner owner address which you want to query the approval of _operator operator address which you want to query the approval of return bool whether the given operator is approved by the given owner/ | function isApprovedForAll(address _owner, address _operator) public view returns (bool) {
return operatorApprovals[_owner][_operator];
}
| 473,698 |
./partial_match/1/0xb5c75e1AdDD0097117496496A046186d15bDdA8B/sources/TokenVault.sol | This function is prototyped in Recoverable contract | function tokensToBeReturned(ERC20Basic token) public returns (uint) {
return getBalance().minus(tokensAllocatedTotal);
}
| 15,897,482 |
./full_match/3/0x03b0258e8A3d9C0a7574bD55b06815998345ec1B/sources/contracts/DiamondHoldTestETH.sol | Calculates the token balance for a given `wallet`/ | function getTokenBalanceFromReflection(address wallet) internal view returns (uint256) {
uint256 currentRate = _getRate(getWalletTier(wallet));
return _reflectBalances[wallet].div(currentRate);
}
| 8,267,712 |
pragma solidity ^0.5.17;
library SafeMath {
function ADD171(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
... | inject NONSTANDARD NAMING | function GETREFERERINTREE743(address _token, uint _level, address _user) internal view returns(address) { | 15,849,274 |
./partial_match/1/0x848c8b8b1490E9799Dbe4fe227545f33C0456E08/sources/src/interfaces/ISavingsVaultViews.sol | Fixed rate product vault helper view functions interface Describes helper view functions | interface ISavingsVaultViews {
function BP() external view returns (uint16);
function getAPY(ISavingsVaultViewer _savingsVault) external view returns (uint);
function getMaxDepositedAmount(address _savingsVault) external view returns (uint maxDepositedAmount);
function scaleAmount(
address _s... | 16,158,726 |
// File: @openzeppelin/contracts/security/ReentrancyGuard.sol
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* availab... | Function to spend user balance. Can be called by other authorised contracts. To be used for internal purchases of other NFTs, etc./ | function spendToopi(address user, uint256 amount) external onlyAuthorised nonReentrant {
require(getUserBalance(user) >= amount, "Insufficient balance");
uint256 tax = spendTaxCollectionStopped ? 0 : (amount * spendTaxAmount) / 100;
spentAmount[user] += amount;
activeTaxCollectedAmount += t... | 1,512,442 |
pragma solidity >0.5.4;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/lifecycle/Pausable.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "@daostack/arc/contracts/controller/Avatar.sol";
import "../../contracts/dao/schemes/FeelessScheme.... | Withdraws the sender staked DAI./ updates balance before transfer to prevent re-entryredeeming in compound may result in a tiny fraction of precission errorso if we redeem 100 DAI we might get something like 99.9999999999 | function withdrawStake() public {
Staker storage staker = stakers[msg.sender];
require(staker.stakedDAI > 0, "No DAI staked");
require(cDai.redeemUnderlying(staker.stakedDAI) == 0, "Failed to redeem cDai");
uint256 daiWithdraw = staker.stakedDAI;
staker.stakedDAI = 0;
... | 1,078,862 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "../PrizeSplit.sol";
import "../PeriodicPrizeStrategy.sol";
contract MultipleWinners is PeriodicPrizeStrategy, PrizeSplit {
// Maximum number number of winners per award distribution period
uint256 internal __number... | Sets maximum number of winners. Sets maximum number of winners per award distribution period. count Number of winners./ | function setNumberOfWinners(uint256 count) external onlyOwner {
_setNumberOfWinners(count);
}
| 12,844,816 |
./partial_match/1/0x93A20D8EbA6997ABB53aE94bd01727C8e74c8734/sources/TokenCore.sol | assignProxyOperators _role operator role. May be a role not defined yet. _operators addresses/ | function assignProxyOperators(
address _proxy, bytes32 _role, address[] memory _operators)
public onlySysOp returns (bool)
{
for (uint256 i=0; i < _operators.length; i++) {
operators[_operators[i]].proxyRoles[_proxy] = _role;
emit ProxyOperatorAssigned(_proxy, _role, _operators[i]);
}
... | 3,566,170 |
./partial_match/97/0xb9248980a3aCebDC1E79CD43855053f81e81a423/sources/AnimalFactory.sol | function to accept a mate offer by offering one of your own animals and paying ethers ofcourse/the requester is actually the owner of the animal which he or she is offering for matinga user cannot mate two of his own animalsthe animal id given was actually advertised for mating the price requested for mating the owner ... | function mateAnimal(uint parent1Id, uint parent2Id, string animalName,string animalDesc) public payable
{
require (!isContractPaused);
require(!isMatingPaused);
require(msg.sender != 0x0);
require (token.ownerOf(parent2Id) == msg.sender);
require(token.ownerO... | 11,482,006 |
./full_match/5/0x5137ABFf24ad5b7f8079F7f9BfCDB5645e490526/sources/project_/contracts/ERC1594/ERC1594.sol | Operator address is null, _partition = defaultPartition | function transferWithData(address _to, uint256 _value, bytes calldata _data) external {
_transferByPartition(msg.sender, _to, defaultPartition, _value, _data, address(0), "");
emit Transfer(msg.sender, _to, _value);
}
| 11,594,557 |
pragma solidity ^0.4.18;
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Ba... | Mints remaining tokens and finishes minting when sale is successful No further tokens will be minted ever/ uint remainingPercentage = bountyTokensPercent.add(teamTokensPercent).add(reservedTokensPercent); uint tokensGenerated = token.totalSupply(); send remaining tokens to reserved wallet | function endSale() public whenNotPaused saleIsFinished onlyOwner {
uint foundersTokens = totalTokenSupply.mul(teamTokensPercent).div(percentRate);
uint reservedTokens = totalTokenSupply.mul(reservedTokensPercent).div(percentRate);
uint bountyTokens = totalTokenSupply.mul(bountyTokensPercent).div(perc... | 5,930,175 |
./partial_match/1/0xA87C531e9482752C95f3745D98c61d26724F7293/sources/PEPE.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("PEPE", "PEPE") {
router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(address(this), router.WETH());
_isExcludedMaxTransactionAmount[address(router)] = true;
_isExcludedMaxTra... | 9,392,888 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma abicoder v2;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeCast.sol";
import "../interfaces/IOracleMaster.sol";
import "../interfaces/ILido.sol";
import "../interfaces/IAuthManager.sol";
import "..... | Initialize ledger contract. _stashAccount - stash account id _controllerAccount - controller account id _vKSM - vKSM contract address _controller - xcmTransactor(relaychain calls relayer) contract address _minNominatorBalance - minimal allowed nominator balance _lido - LIDO address _minimumBalance - minimal allo... | function initialize(
bytes32 _stashAccount,
bytes32 _controllerAccount,
address _vKSM,
address _controller,
uint128 _minNominatorBalance,
address _lido,
uint128 _minimumBalance,
uint256 _maxUnlockingChunks
) external {
require(_vKSM != addr... | 916,460 |
./full_match/137/0xaf87f836dC020fc01F9311955b6BaDBeD16CAda5/sources/contracts/IceTokenAndMasterchef.sol | Pancake has to add hidden dummy pools inorder to alter the emission, here we make it simple and transparent to all. | function updateEmissionRate(uint256 _icePerBlock) external onlyOwner {
require(_icePerBlock <= MAX_EMISSION_RATE, "To much");
massUpdatePools();
emit EmissionRateUpdated(msg.sender, icePerBlock, _icePerBlock);
icePerBlock = _icePerBlock;
}
| 4,665,033 |
./partial_match/1/0x716744A30CD4bf6e4cfCCf7598f724BE5172d0B9/sources/wallet.sol | Update available top up limit based on the daily reset. Advance the current day by how many days have passed. Set the available limit to the current top up limit. | function _updateTopUpAvailable() private {
if (now > _topUpLimitDay.add(24 hours)) {
uint extraDays = now.sub(_topUpLimitDay).div(24 hours);
_topUpLimitDay = _topUpLimitDay.add(extraDays.mul(24 hours));
_topUpAvailable = topUpLimit;
}
}
| 4,295,207 |
... | inject NONSTANDARD NAMING | function DELEGATE502(address delegatee) public { | 938,109 |
// 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";
... | Public function to enable or disable the flash mint functionality enabled A boolean flag that enables tokens to be flash minted | function setFlashMintEnabled(bool enabled) external onlyMinter {
_setFlashMintEnabled(enabled);
}
| 9,906,265 |
./full_match/3/0xf6b62Ef67fc2A7d122e08cbde38BDE08Ad5aAE50/sources/releasable__1__mod.sol | Calculates the exact amount of coins that should be released for one release cycle. If the next release will be after the halving date, it also calculates a new {_releaseAmount} for future releases. Emits a {Halving} event if halving happens, containing the old release amount {oldReleaseAmount}, and new release amount ... | function _calculateReleaseAmount() internal returns (uint256)
{
if(block.timestamp < _nextReleaseDate || balanceOf(address(this)) == 0)
return 0;
uint256 amount = _releaseAmount > balanceOf(address(this)) ? balanceOf(address(this)) : _releaseAmount;
_nextReleaseDate += _wee... | 8,148,349 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/cryp... | Returns whether `tokenId` exists. Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. Tokens start existing when they are minted (`_mint`),/ | function _exists(uint256 tokenId) internal view returns (bool) {
return tokenId < _currentIndex && !_ownerships[tokenId].burned;
}
| 10,378,704 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.6;
import {BeaconStorage} from "../lib/upgradable/BeaconStorage.sol";
import {Governable} from "../lib/Governable.sol";
import {IBeacon} from "../lib/upgradable/interface/IBeacon.sol";
import {DistributionStorage} from "./DistributionStorage.sol";
import... | Renounce ownership by setting owner to zero address./ | function renounceOwnership() external onlyOwner {
owner = address(0);
emit OwnershipTransferred(owner, address(0));
}
| 164,496 |
// Sources flattened with hardhat v2.8.0 https://hardhat.org
// File contracts/PriceOracle.sol
pragma solidity ^0.8.4;
abstract contract PriceOracle {
/// @notice Indicator that this is a PriceOracle contract (for inspection)
bool public constant isPriceOracle = true;
/**
* @notice Get the price of a token
... | This is used by anyone to increase a router's available liquidity for a given asset. amount The amount of liquidity to add for the router assetId The address (or `address(0)` if native asset) of the asset you're adding liquidity for router The router you are adding liquidity on behalf of/ | function addLiquidityFor(
uint256 amount,
address assetId,
address router
) external payable override nonReentrant {
_addLiquidityForRouter(amount, assetId, router);
}
| 15,843,571 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (finance/VestingWallet.sol)
pragma solidity ^0.8.0;
import '../token/ERC20/utils/SafeERC20.sol';
import '../utils/Address.sol';
import '../utils/Context.sol';
import '../utils/math/Math.sol';
/**
* @title VestingWallet
* @dev This contract handles the... | Getter for the start timestamp./ | function start() public view virtual returns (uint256) {
return _start;
}
| 5,789,349 |
./full_match/42161/0x272Ca69FBb0b7A7345944E0c5FD838B2166696Aa/sources/AutocompoundStrategy.sol | ADMIN functions/ | function setVault(address _newVault) public onlyOwner {
vault = _newVault;
emit VaultUpdated(msg.sender, vault);
}
| 16,306,769 |
pragma solidity ^0.4.0;
contract Command {
struct Light {
bool state;
}
string[] public history;
Light[] public bulbs;
/* The Command interface */
function Execute(string command) {
history.push(command);
}
/* The Invoker class */
function Switch(bytes32 command) {
i... | The Invoker class / | function Switch(bytes32 command) {
if(command == "on") {
Execute("on");
Execute("off");
}
}
| 1,797,237 |
pragma solidity ^0.4.24;
/**
* SmartEth.co
* ERC20 Token and ICO smart contracts development, smart contracts audit, ICO websites.
* contact@smarteth.co
*/
/**
* @title SafeMath
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
... | called by the owner to start the crowdsale/ | function start() public onlyOwner {
openingTime = now;
closingTime = now + duration;
}
| 1,102,712 |
./full_match/1/0xCb6A39883Ae55F2b63CfdcA7b4e7928dAEe65c11/sources/browser/Ownable.sol | Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner./ | function transferOwnership(address newOwner) public virtual onlyOwner {
_setOwner(newOwner);
}
| 3,177,045 |
./full_match/1/0x911a768fF40e6477736AA009EF0055563982bE3a/sources/src/ExternalRefinancing.sol | Reads the bytes4 at `rdPtr` in returndata. | function readBytes4(
ReturndataPointer rdPtr
) internal pure returns (bytes4 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
| 3,218,393 |
./full_match/3/0xe8DB741883fB5ea7eFcBD7e95bAE68497317F1FB/sources/contracts/ROM.sol | sets maps token to its price _tokenId uint256 token ID (token number) _price unit256 token price Requirements: `tokenId` must exist `price` must be more than 0 `owner` must the msg.owner Notes: price greater than zero is available for sale, if price is equal to zero, this art automatically hidden in the market/ | function setTokenPrice(uint256 _tokenId, uint256 _price) public {
require(_exists(_tokenId), "Nonexistent token");
require(ownerOf(_tokenId) == _msgSender());
_tokenPrices[_tokenId] = _price;
}
| 14,194,665 |
./full_match/80001/0x9C017055Ee8ab4506AAdA58197808b085106A0E7/sources/contracts/Gigble.sol | Function for freelancers to accept a project and release escrowed budget | function acceptProject(uint256 _projectId) external {
Project storage project = projects[_projectId];
require(project.freelancer == address(0), "Project already accepted");
require(
msg.sender == project.client,
"Client cannot accept the project"
);
pr... | 5,585,810 |
pragma solidity 0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint a, uint b) internal pure returns(uint) {
if (a == 0) {
ret... | For checking approval of transfer for address _to | function _approved(address _to, uint _tokenId) private view returns(bool) {
return covfefeIndexToApproved[_tokenId] == _to;
}
| 5,488,679 |
// File: openzeppelin-solidity-2.3.0/contracts/ownership/Ownable.sol
pragma solidity ^0.5.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance... | Return the amount of ETH to receive if we are to liquidate the given position. id The position ID to perform health check. 1. Get the position's LP balance and LP total supply. 2. Get the pool's total supply of WETH and farming token. 3. Convert the position's LP tokens to the underlying assets. 4. Convert all farming... | function health(uint256 id) external view returns (uint256) {
uint256 lpBalance = shareToBalance(shares[id]);
(uint256 r0, uint256 r1,) = lpToken.getReserves();
(uint256 totalWETH, uint256 totalfToken) = lpToken.token0() == weth ? (r0, r1) : (r1, r0);
uint256 userWETH = lpBalance.mul... | 2,328,956 |
// Copyright (c) 2017 Aler Denisov
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, di... | Method to validate received storage _storage Instance of uint storage of counter return True if storage is valid, false\revert overwise | function validateStorage(address _storage) public view returns (bool) {
return UIntStorage(_storage).isUIntStorage();
}
| 13,130,540 |
./full_match/42/0xDBB2ff9ec8bB422B26402D3Ebd20A09b42fE2f85/sources/contracts/MMR.sol | peaks may be merged require(numOfPeaks(width) == peaks.length, "Received invalid number of peaks"); | function peakBagging(uint256 width, bytes32[] memory peaks) view public returns (bytes32) {
bytes32 mergeHash = peaks[0];
for(uint i = peaks.length-1; i >= 1; i = i - 1) {
bytes32 r;
if(i == peaks.length-1) {
r = peaks[i];
r = mergeHash;
... | 16,250,727 |
/**
*Submitted for verification at Etherscan.io on 2022-04-18
*/
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/*... | Mints new tokens. Can only be executed every `minimumMintInterval`, by the owner, and cannot exceed `mintCap / 10000` fraction of the current total supply. dest The address to mint the new tokens to. amount The quantity of tokens to mint./ | function mint(address dest, uint256 amount) external onlyOwner {
require(amount <= (totalSupply() * mintCap) / 10000, "MLV: Mint exceeds maximum amount");
require(block.timestamp >= nextMint, "MLV: Cannot mint yet");
nextMint = block.timestamp + minimumMintInterval;
_mint(dest, amou... | 2,211,763 |
./full_match/43114/0x4e13f37db9c8BDe41B34Ef1528C71E332AcBAf56/sources/Exchange.sol | Updates the treasury address used to recover lost funds. This is a privileged function. _newTreasury The new treasury address./ | function setTreasury(address _newTreasury) external onlyOwner
delayed(this.setTreasury.selector, keccak256(abi.encode(_newTreasury)))
{
require(_newTreasury != address(0), "invalid address");
address _oldTreasury = treasury;
treasury = _newTreasury;
emit ChangeTreasury(_oldTreasury, _newTreasury);
}
even... | 4,549,920 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.6.8;
contract ArborVote {
/// State
uint8 public argumentsCount = 0;
constructor (string memory _text) public {
arguments[0] = Argument({ // Argument 0 is the proposal itself
supporting: true, // makes no sense for the proposal - just s... | Vote against argument `id` with vote strength `voteStrength` id ID of the argument to vote against/ | function voteAgainst(uint8 id, uint8 voteStrength) public {
require(voters[msg.sender].joined == true, "Voter must join first");
uint8 cost = quadraticCost(voteStrength);
payForVote(msg.sender, cost);
arguments[id].votes -= voteStrength;
emit Voted(msg.sender, id, voteStrengt... | 12,647,568 |
/*
* source https://github.com/blockbitsio/
* @name Proposals Contract
* @package BlockBitsIO
* @author Micky Socaci <micky@nowlive.ro>
Contains the Proposals Contract code deployed and linked to the Application Entity
*/
pragma solidity ^0.4.17;
import "./../ApplicationAsset.sol";
imp... | get voting power get proposal for state make sure voting power is greater than 0 make sure proposal.state allows receiving votes make sure proposal.time_end has not passed. | function RegisterVote(uint256 _proposalId, bool _myVote) public {
address Voter = msg.sender;
uint256 VoterPower = getVotingPower(_proposalId, Voter);
ProposalRecord storage proposal = ProposalsById[_proposalId];
if(VoterPower > 0 && proposal.state == getRecordState("ACCEPTING_VO... | 12,915,562 |
./full_match/80001/0x33D42d341B95be5be4F887fAA4b181E10ce32f47/sources/contracts/pools/BaseCarbonTonne.sol | Emergency function to disable contract's core functionality wraps _pause(), only Admin | function pause() public virtual onlyWithRole(PAUSER_ROLE) {
_pause();
}
| 5,587,356 |
// SPDX-License-Identifier: GPL-3.0
/// @title The Nouns DAO auction house
/*********************************
* βββββββββββββββββββββββββββββ *
* βββββββββββββββββββββββββββββ *
* βββββββββββββββββββββββββββββ *
* βββββββββββββββββββββββββββββ *
* βββββββββββββββββββββββββββββ *
* βββββββββββββββββββββββββββββ ... | Set the auction minimum bid increment percentage. Only callable by the owner./ | function setMinBidIncrementPercentage(uint8 _minBidIncrementPercentage) external override onlyOwner {
minBidIncrementPercentage = _minBidIncrementPercentage;
emit AuctionMinBidIncrementPercentageUpdated(_minBidIncrementPercentage);
}
| 1,189,772 |
// SPDX-License-Identifier: Apache-2.0
/*
Modifications Copyright 2022 Element.Market
Copyright 2021 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.or... | Taker must match the order taker, if one is specified. Check that the order is valid and has not expired, been cancelled, or been filled. Check the signature. | function _validateSellOrder(
LibNFTOrder.NFTSellOrder memory sellOrder,
LibSignature.Signature memory signature,
LibNFTOrder.OrderInfo memory orderInfo,
address taker
) internal view {
require(sellOrder.taker == address(0) || sellOrder.taker == taker, "_validateOrder/ONLY... | 1,499,190 |
/**************************************************************************
* ____ _
* / ___| | | __ _ _ _ ___ _ __
* | | _____ | | / _` || | | | / _ \| '__|
* | |___|_____|| |___| (_| || |_| || __/| |
* ... | removeOperator _address operator address/ | function removeOperator(address _address) public onlyOwner {
require(operators_[_address], "OP02");
operators_[_address] = false;
emit OperatorRemoved(_address);
}
| 6,414,739 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.