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.0;
import "../interfaces/IStrategy.sol";
import "../interfaces/IVault.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin... | Traverses the harvest log backwards _n items, and returns the average APR calculated across all the included log entries. APR is multiplied by PERCENT_DIVISOR to retain precision./ | function averageAPRAcrossLastNHarvests(int256 _n)
external
view
returns (int256)
{
require(harvestLog.length >= 2, "need at least 2 log entries");
int256 runningAPRSum;
int256 numLogsProcessed;
for (
uint256 i = harvestLog.length - 1;
... | 1,799,807 |
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2020 Gemini Trust Company LLC. All Rights Reserved
pragma solidity ^0.7.0;
import "./ERC20Impl.sol";
import "./LockRequestable.sol";
/** @title A contact to govern hybrid control over increases to the token supply.
*
* @notice A contract that acts as a cus... | Sets the balance of `_owner` to `_newBalance`. Intended for use by token implementation functions that update balances. The only authorized caller is the active implementation. _owner The account that will hold a new balance. _newBalance The balance to set./ | function setBalance(
address _owner,
uint256 _newBalance
)
external
onlyImpl
{
balances[_owner] = _newBalance;
}
| 11,984,176 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/access/AccessControl.sol';
import '@openzeppelin/contracts/token/ERC721/ERC721.sol';
import '@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol';
import '@openzeppelin/contracts/utils/cryptography/ECDSA.sol';
import '@open... | If a credential is registered, then mint a token of your choosing for the subject of the credential | function registerCredential(
address account,
uint256 tokenId,
bytes calldata credential
) public {
bytes32 credentialHash = _hash(account, tokenId);
require(_verify(credentialHash, credential), 'Invalid signature');
registered[account] = true;
_safeMint(account, tokenId);
}
| 12,683,951 |
./partial_match/4/0x41c401c0FC654AAe2732C20837105F820052d578/sources/TokenCollateralLoans.sol | Make a payment to a loan amount The amount of tokens to pay back to the loan loanID The ID of the loan the payment is for/ calculate the actual amount to repay if the loan is now fully paid, close it and return collateral | function repay(uint256 amount, uint256 loanID)
external
loanActive(loanID)
isInitialized()
whenNotPaused()
whenLendingPoolNotPaused(address(lendingPool))
nonReentrant()
{
require(amount > 0, "AMOUNT_VALUE_REQUIRED");
uint256 toPay = amount;
... | 8,601,334 |
./partial_match/1/0x272b492c3676c84e6b0D9f156268E5606d4c07FC/sources/contracts/sale/ReferralIDO.sol | Store the first and last block numbers to simplify data collection later | function internalBuyTokens(uint256 value) private {
UserState memory userState = getUserState(_msgSender());
require(userState.totalAlloc > 0, 'ZAL');
require(value > 0, 'ZV');
if (contributed[_msgSender()] == 0) saleState.participants += 1;
saleState.raised += value;
... | 4,118,024 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Addres... | Receives new deposits from user | function deposit(address, uint256 _wantAmt) public onlyOwner whenNotPaused strategyRunning returns (uint256) {
IERC20(wantAddress).safeTransferFrom(address(msg.sender), address(this), _wantAmt);
uint256 sharesAdded = _wantAmt;
if (wantLockedTotal > 0) {
sharesAdded = _wantAmt * s... | 13,068,885 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.8.0;
contract Election {
struct Candidate {
uint id;
string name;
uint voteCount;
}
mapping(uint => Candidate) public Candidates;
mapping (address => bool) public voters;
uint public candidateCount;
constructor() public{
addCand... | require that they haven't voted before require a valid candidate record that voter has voted update candidate vote Count | function vote(uint _candidateId) public{
require(!voters[msg.sender]);
require(_candidateId > 0 && _candidateId <= candidateCount);
voters[msg.sender] = true;
Candidates[_candidateId].voteCount ++;
}
| 12,615,848 |
/**
*Submitted for verification at Etherscan.io on 2021-02-26
*/
// Sources flattened with hardhat v2.0.8 https://hardhat.org
// File @openzeppelin/contracts/math/[email protected]
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations wit... | A method to allow a stakeholder to check his rewards. _stakeholder The stakeholder to check rewards for./ | function rewardOf(address _stakeholder) public view returns (uint256) {
uint256 rewardAmount = 0;
for (uint256 j = 0; j < stakes[_stakeholder].length; j += 1) {
uint256 amount = stakes[_stakeholder][j].amount;
uint256 rate = stakes[_stakeholder][j].rewardRate;
uin... | 1,987,922 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
/**
* Simple example of how to use the payload when using call.value
*
**/
contract Payloadtest {
bytes32 public functionHash; //it is public so you can easily check the value
bytes4 public function4bytes; //it is public so you can easily check ... | it is public so you can easily check the value | bytes4 public function4bytes; | 1,771,774 |
/*
Copyright 2021 Index Cooperative
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 i... | Compares the amount of token received for an exact amount of another token across both exchanges, and returns the max amount. _amountIn The amount of input token _tokenA The address of tokenA _tokenB The address of tokenB return The max amount of tokens that can be received across both e... | function _getMaxTokenForExactToken(uint256 _amountIn, address _tokenA, address _tokenB) internal view returns (uint256, Exchange, address) {
if (_tokenA == _tokenB) {
return (_amountIn, Exchange.None, ETH_ADDRESS);
}
uint256 uniTokenOut = 0;
uint256 sushiTokenOut = 0;
... | 12,652,107 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.4;
// import "hardhat/console.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "... | Unlocked 16.66% every 6 months starting from TGE console.log("Current TimeStamp %s %s", _currentTimeStamp ,_currentTimeStamp <= sixMonths); console.log(_currentTimeStamp > sixMonths && _currentTimeStamp < oneYear); console.log(_currentTimeStamp > eighteenMonths && _currentTimeStamp < twentyFourMonths); | function _getCommunityRewardsPercentage(uint256 _currentTimeStamp)
private
view
returns (uint256 _availablePercentage)
{
uint256 sixMonths = _initialTimestamp + _oneMonth * 6;
uint256 oneYear = _initialTimestamp + 365 days;
uint256 eighteenMonths = _initialTimesta... | 419,959 |
./partial_match/1/0x357ADa6E0da1BB40668BDDd3E3aF64F472Cbd9ff/sources/StakingPool.sol | Returns the number of values in the set. O(1)./ | function length(AddressSet storage set) internal view returns(uint256) {
return _length(set._inner);
}
| 4,460,223 |
./partial_match/42220/0x7C98cc3Ad12058E8E37160Fb72f8ff557d742a54/sources/home/eruiz/Projects/celo/celo-monorepo/packages/protocol/contracts/identity/Escrow.sol | Revokes tokens for a sender who is redeeming a payment after it has expired. paymentId The ID for the EscrowedPayment struct that contains all relevant information. Throws if 'token' or 'value' is 0. Throws if msg.sender is not the sender of payment. Throws if redeem time hasn't been reached yet./ solhint-disable-n... | function revoke(address paymentId) external nonReentrant returns (bool) {
EscrowedPayment memory payment = escrowedPayments[paymentId];
require(payment.sender == msg.sender, "Only sender of payment can attempt to revoke payment.");
require(
now >= (payment.timestamp.add(payment.expirySeconds)),
... | 3,500,541 |
/**
*Submitted for verification at Etherscan.io on 2020-09-02
*/
/**
* Copyright 2017-2020, bZeroX, LLC <https://bzx.network/>. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
interface IWeth {
function deposit() external pa... | returns newPrincipal withdrawAmount already sent to the borrower, so we aren't sending it to the protocol | function _borrowOrTrade(
bytes32 loanId,
uint256 withdrawAmount,
uint256 leverageAmount,
address collateralTokenAddress,
address[4] memory sentAddresses,
uint256[5] memory sentAmounts,
bytes memory loanDataBytes)
internal
returns (uint256, uint... | 2,510,410 |
./full_match/1/0x519AE2616E0D87dBC05c2C00757894F883cDD5d6/sources/browser/BalavaDefiPool.sol | Get amount of user balance in pool | function balance(address _user, uint256 _pool) public view returns(uint256) {
for (uint256 i=0; i<users[_pool].length; i++) {
if (users[_pool][i].addr == _user) {
return (users[_pool][i].balance);
}
}
return 0;
}
| 5,010,833 |
pragma solidity ^0.5.11;
import "../Manager.sol";
interface IBridgeMinterToken {
function transfer(address _to, uint256 _amount) external;
function mint(address _to, uint256 _amount) external;
function transferOwnership(address _owner) external;
function balanceOf(address _addr) external view retur... | Send contract's ETH to L1Migrator. Only callable by L1Migrator return Amount of ETH sent/ call() should be safe from re-entrancy here because the L1Migrator and l1MigratorAddr are trusted | function withdrawETHToL1Migrator() external onlyL1Migrator returns (uint256) {
uint256 balance = address(this).balance;
(bool ok, ) = l1MigratorAddr.call.value(address(this).balance)("");
require(ok, "BridgeMinter#withdrawETHToL1Migrator: FAIL_CALL");
return balance;
}
| 13,039,191 |
./partial_match/1/0xdb3D91Dcb27547d82A09556D1028beEdB04A5902/sources/src/Libraries/ObjectLib.sol | Return the bin number and index within that bin where ID is _tokenId Object type return (Bin number, ID's index within that bin)/ | function getTokenBinIndex(uint256 _tokenId) internal pure returns (uint256 bin, uint256 index) {
bin = _tokenId * TYPES_BITS_SIZE / 256;
index = _tokenId % TYPES_PER_UINT256;
return (bin, index);
}
| 9,405,561 |
./full_match/77/0x3Db753B1E2b48A5fefaE23F2434C1FBEDbE0769e/sources/project_/contracts/Offer.sol | Cashouts tokens for a specified user/ cashout is automatic, and done ONLY by the token wait till the offer is successful to allow transfer nothing to be paid make sure there's something to be paid | function cashoutTokens(address _investor)
external
virtual
override
returns (bool)
{
require(_msgSender() == address(baseToken), "Call only from token");
if (!bSuccess) {
return false;
}
if (payment.totalAmount == 0) {
retur... | 5,046,392 |
pragma solidity =0.5.16;
interface IUniSlurmFactory {
event PAIRCREATED643(address indexed token0, address indexed token1, address pair, uint); //inject NONSTANDARD NAMING
function FEETO571() external view returns (address); //inject NONSTANDA... | inject NONSTANDARD NAMING | function NAME160() external view returns (string memory); | 13,090,497 |
./full_match/11155111/0xB925899Df589e10c71F540eA92F5fC7b98552AAb/sources/src/tokens/SafeERC4626Upgradeable.sol | Unchained constructor for the SafeERC4626Upgradeable contract, without parents contracts init _asset which will be stored in this Vault/ | function __SafeERC4626Upgradeable_init_unchained(IERC20Upgradeable _asset)
internal
onlyInitializing
{
__ERC4626_init_unchained(_asset);
}
| 3,820,455 |
// File: @openzeppelin/contracts-ethereum-package/contracts/utils/EnumerableSet.sol
pragma solidity ^0.6.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked... | Unpauses all token transfers. See {ERC20Pausable} and {Pausable-_unpause}. Requirements: - the caller must have the `PAUSER_ROLE`./ | function unpause() public {
require(hasRole(PAUSER_ROLE, _msgSender()), "Token: must have pauser role to unpause");
_unpause();
}
| 7,991,489 |
pragma solidity 0.5.16;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../modules/Griefing.sol";
import "../modules/EventMetadata.sol";
import "../modules/Operated.sol";
import "../modules/Template.sol";
/// @title SimpleGriefing
/// @author Stephane Gosselin (@thegostep) for Numerai Inc
/// @dev Securit... | Called by the operator to renounce control Access Control: operator State Machine: anytime restrict access renounce operator | function renounceOperator() public {
require(Operated.isOperator(msg.sender), "only operator");
Operated._renounceOperator();
}
| 1,062,255 |
./partial_match/1/0xFCE1c68E7414605fF1f97D197D6Ba05a6d232311/sources/cache/solpp-generated-contracts/Escrow.sol | We settle matured assets before withdraw in case there are matured cash receiver or liquidity token assets We're checking this after the withdraw has been done on currency balances. We skip this check for batch withdraws when we check once after everything is completed. | function _withdraw(
address from,
address to,
address token,
uint128 amount,
bool checkFC
) internal returns (bool) {
uint16 currencyId = addressToCurrencyId[token];
bool didWithdraw = false;
require(token != address(0), "19");
if (checkFC... | 16,064,552 |
/**
*Submitted for verification at Etherscan.io on 2020-08-26
*/
pragma solidity ^0.5.4;
contract Account {
// The implementation of the proxy
address public implementation;
// Logic manager
address public manager;
// The enabled static calls
mapping (bytes4 => address) public enabled;... | Submit a new logic. Called only by owner. _logic The new logic contract address. _value True: enable a new logic; False: disable an old logic./ | function submitUpdate(address _logic, bool _value) external onlyOwner {
pending storage p = pendingLogics[_logic];
p.value = _value;
p.dueTime = now + pt.curPendingTime;
emit UpdateLogicSubmitted(_logic, _value);
}
| 6,384,923 |
pragma solidity ^0.8.0;
// SPDX-License-Identifier: MIT
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title OxyFarmsNFT
* @dev The NFTrees token contract for the fir... | preMint is an external function that allows the minting process to happen during pre sale. _quantity number of NFTrees we want to mint./ | function preMint(uint _quantity) external payable {
require(hasPreSaleStarted, "OxyFarmsNFT::preMint: Presale hasn't started.");
require(!preSaleOver, "OxyFarmsNFT::preMint: Presale is over, no more allowances.");
require(_quantity > 0, "OxyFarmsNFT::preMint: Quantity cannot be zero.");
... | 254,234 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "./ERC1155Fuse.sol";
import "./Controllable.sol";
import "./INameWrapper.sol";
import "./IMetadataService.sol";
import "../registry/ENS.sol";
import "../ethregistrar/BaseRegistrar.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
impo... | burn and unwrap old token of old owner | function _mint(
bytes32 node,
address wrappedOwner,
uint96 _fuses
) internal override {
address oldWrappedOwner = ownerOf(uint256(node));
if (oldWrappedOwner != address(0)) {
_burn(uint256(node));
emit NameUnwrapped(node, address(0));
}
... | 12,942,272 |
./full_match/1/0x0000000001E835A5D0D176e05499850B636F6B15/sources/contracts/BartrrBase.sol | _token address of the token whose price is being queried | function _getLatestPrice(address _token) internal view returns (int256) {
address aggregator = oracles[_token];
(,int256 answer,,uint256 updatedAt,) = AggregatorV2V3Interface(aggregator).latestRoundData();
require(updatedAt > 0, "Round not complete");
return answer;
}
| 3,850,034 |
./full_match/80001/0x558662Bbc148f09878742415ad688080f38C88c4/sources/contracts/Collectable.sol | pay creators the view fee/ | function _payCreator(uint256 _tokenId) private {
address owner = ownerOf(_tokenId);
require(msg.sender != owner, "You cant pay yourself");
require(_exists(_tokenId), "Video is yet to be created");
uint256 amount = tokenData[_tokenId].price;
}
| 5,614,884 |
// RUN: --target substrate --emit cfg
contract C {
function foo() public returns (int, int) { return (1, 2); }
// BEGIN-CHECK: C::function::bar
function bar() public {
// NOT-CHECK: abidecode
this.foo();
function () external returns (int, int) fPtr = this.... | NOT-CHECK: abidecode NOT-CHECK: abidecode | function bar() public {
this.foo();
function () external returns (int, int) fPtr = this.foo;
fPtr();
}
| 14,040,163 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./creatSprite.sol";
contract pixelSprite is creatSprite {
string constant BALANCE_IS_ZERO = "005001";
string constant SPRITE_STATUS_IS_NOT_FREE = "005002";
string constant END_PRICE_SMALL_THAN_START_PRICE = "005003";
string constant YOU_ARE_NOT_OW... | Returns the address of the current owner./ | function getManageOwner() public view returns (address) {
return Manageowner;
}
| 607,416 |
./full_match/1/0xD1CE9000dAe71a7130c193486761c324fbf94819/sources/cache/solpp-generated-contracts/TinyStrings.sol | Checks whether TinyString contains the same characters as TinyString5. self an instance of TinyString to check. other an instance of TinyString5 to check. return true if the strings are the same./ | function equals(TinyString self, TinyString5 other) internal pure returns (bool) {
return TinyString.unwrap(self) == TinyString5.unwrap(other);
}
| 2,904,162 |
pragma solidity ^0.4.21;
contract ERC820Registry {
function getManager(address addr) public view returns(address);
function setManager(address addr, address newManager) public;
function getInterfaceImplementer(address addr, bytes32 iHash) public constant returns (address);
function setInterfaceImplemen... | Send `_amount` of tokens on behalf of the address `from` to the address `to`. _from The address holding the tokens being sent _to The address of the recipient _amount The number of tokens to be sent _userData Data generated by the user to be sent to the recipient _operatorData Data generated by the operator to be ... | function operatorSend(address _from, address _to, uint256 _amount, bytes _userData, bytes _operatorData) public {
require(isOperatorFor(msg.sender, _from));
doSend(msg.sender, _from, _to, _amount, _userData, _operatorData, true);
}
| 2,445,223 |
./full_match/80001/0x8D2C372317524a8Af5313883434411fd3DAE55d9/sources/contracts/lib/Executor.sol | Internal function to transfer a single ERC721 token from a given originator to a given recipient. Sufficient approvals must be set, either on the respective conduit or on this contract itself. token The ERC721 token to transfer. from The originator of the transfer. to The recipient of... | function _transferERC721(
address token,
address from,
address to,
uint256 identifier,
uint256 amount,
bytes32 conduitKey,
bytes memory accumulator
) internal {
_triggerIfArmedAndNotAccumulatable(accumulator, conduitKey);
if (conduitKey ==... | 878,160 |
./full_match/1/0x41De0a913e8A10E0415B70810FEbCaF8a86Ea9BE/sources/contracts/Bueno1155Drop.sol | See {IERC1155-safeBatchTransferFrom}./ | function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) public virtual override onlyAllowedOperator(from) {
super.safeBatchTransferFrom(from, to, ids, amounts, data);
}
| 3,109,871 |
pragma solidity ^0.4.24;
import "./VotingUtils.sol";
import "./interfaces/IConsensus.sol";
/**
* @title Contract handling vote to change implementations network contracts
* @author LiorRabin
*/
contract Voting is VotingUtils {
/**
* @dev Function to be called on contract initialization
*/
function initialize(... | Function to be called on contract initialization/ | function initialize() external onlyOwner {
require(!isInitialized());
setInitialized(true);
}
| 12,671,346 |
pragma solidity >=0.7.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
contract Cyberchads is ERC721, Ownable, AccessControl {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");... | Gets current Chad price based on current supply./ | function getChadPrice() public view returns (uint256) {
require(saleActive == true, "Sale has not started yet so you can't get a price yet.");
require(tokensMinted < MAX_CHAD_SUPPLY, "Sale has already ended, no more Chads left to sell.");
if (tokensMinted >= 5448) {
}
}
| 13,778,421 |
./partial_match/56/0xABB22eaF61172044e884AFD94461ec5815D18BF1/sources/PriceBettingT1S2.sol | amount: 0 invalid, 1 ~ 99 reserved for errCode -99~-1 & 1 ~ 100profitRatio... use errCode -99 ~ -1 | function enterBetCheck(
uint256 amount,
uint256 period,
uint256 bettingOutcome,
uint256 fundingSource
)
public view
returns (
bool[] memory bools,
uint256[] memory uints,
uint256[] memory uintInputs,
bool boolOut
... | 11,109,894 |
./full_match/4/0xD2De0Af95CF2f9c72546B59db94dE4462017E054/sources/contracts/GameToken.sol | Mints a batch of token of many different types, to many different users emits an ItemMinted event for every token minted _uris of the tokens in string comma separated organized sequencially an array list _receivers address of the receivers in an array list/ | function batchMint(string[] memory _uris, address[] memory _receivers) external onlyMinter {
require(_uris.length == _receivers.length, "GameToken::batchMint: invalid parameters length (they should be all same)");
require(_uris.length <= MAX_BATCH_MINTING, "GameToken::batchMint: Quantity cannot be b... | 12,423,443 |
./full_match/1/0x33A8d92B2BE84755441C2b6e39715c4b8938242c/sources/contracts/libraries/Fixed.sol | Multiply two fixes, rounding up to FIX_MAX and down to 0 a First param to multiply b Second param to multiply untestable: a will never = 0 here because of the check in _price() untestable: a = FIX_MAX iff b = 0 return FIX_MAX instead of throwing overflow errors. p and mul are Fix values, so have 18 decimals... | function safeMul(
uint192 a,
uint192 b,
RoundingMode rounding
) internal pure returns (uint192) {
if (a == 0 || b == 0) return 0;
if (a == FIX_MAX || b == FIX_MAX) return FIX_MAX;
unchecked {
if (rawDelta / b != a) return FIX_MAX;
uint256 ... | 3,864,940 |
./partial_match/1/0x35a082a34F2c82571c979202230B36eA88BDD2DC/sources/ThePool.sol | 0 percent goes back to the dev fund | function getReward() public updateReward(msg.sender) {
require(ejected==false,"Rewards have expired.");
uint256 reward = earned(msg.sender);
if (reward > 0) {
rewards[msg.sender] = 0;
rewardToken.safeTransfer(msg.sender, reward);
emit RewardPaid(msg.sender... | 3,987,193 |
/**
*Submitted for verification at Etherscan.io on 2021-11-29
*/
pragma solidity 0.5.12;
/**
* @author XchangeON.
*/
/**
* @title IERC223Token
* @dev ERC223 Contract Interface
*/
contract IERC223Token {
function transfer(address _to, uint256 _value) public returns (bool);
function balanceOf(address who)publ... | Do common multisig verification for both eth sends and erc20token transfers toAddress the destination address to send an outgoing transaction operationHash see Data Formats signature see Data Formats expireTime the number of seconds since 1970 for which this transaction is valid nounce the unique nounce obtainable... | function verifyMultiSig(address toAddress, bytes32 operationHash, bytes memory signature, uint expireTime, uint nounce) private returns (address) {
address otherSigner = recoverAddressFromSignature(operationHash, signature);
if (safeMode && !validateSigner(toAddress)) {
revert("safemode... | 15,002,267 |
pragma solidity ^0.4.18;
/// @title ERC20 interface
contract ERC20 {
function balanceOf(address guy) public view returns (uint);
function transfer(address dst, uint wad) public returns (bool);
}
/// @title Manages access privileges.
contract AccessControl {
event accessGranted(address user... | Called by any "C-level" role to pause the contract. Used only when a bug or exploit is detected and we need to limit damage. | function pause() public canAccess(1) whenNotPaused {
paused = true;
}
| 922,970 |
./full_match/1/0x23bE14b17f481a04D7A42AA18fFc4D9D502E70e3/sources/browser/ValueIOU/ValueIOU.sol | Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. This method is included for ERC20 compatibility. increaseAllowance and decreaseAllowance should be used instead. Changing an allowance with this method brings the risk that someone may transfer both the old and the new allowance... | function approve(address spender, uint256 value) external override returns (bool) {
_allowedFragments[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
| 3,007,747 |
./full_match/5/0x8F53f533531a40BdaA832254e282ed1b21D83F71/sources/src/bridge/FastBridgeReceiverOnEthereum.sol | Submit a claim about the `_batchMerkleRoot` for the last completed epoch from the Fast Bridge and submit a deposit. The `_batchMerkleRoot` should match the one on the sending side otherwise the sender will lose his deposit. _epoch The epoch in which the batch to claim. _batchMerkleRoot The batch merkle root claimed ... | function claim(uint256 _epoch, bytes32 _batchMerkleRoot) external payable override {
require(msg.value >= deposit, "Insufficient claim deposit.");
require(_batchMerkleRoot != bytes32(0), "Invalid claim.");
uint256 epochNow = block.timestamp / epochPeriod;
require(_epoch == epochNow ... | 1,938,771 |
./full_match/1/0xcb7A9a86fcd4CaCeFE998781B426A849b809Df2A/sources/contracts/ClaimGift.sol | Sets reword smart contract address Only contract can update reward contract address _giftTransferCallerWallet Gacha reword contract address | function setGiftTransferCallerWallet(address _giftTransferCallerWallet) external onlyOwner {
giftTransferCallerWallet = _giftTransferCallerWallet;
}
| 3,040,875 |
pragma solidity >0.5.4;
import "../../contracts/dao/schemes/UBI.sol";
import "./FirstClaimPool.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
/* @title Dynamic amount-per-day UBI scheme allowing claim once a day
*/
contract UBIScheme is AbstractUBI {
using SafeMath for uint256;
// Result ... | sets the ubi calculation cycle length _newLength the new length in days/ | function setCycleLength(uint256 _newLength) public onlyAvatar {
require(_newLength>0, "cycle must be at least 1 day long");
cycleLength = _newLength;
}
| 13,119,325 |
./full_match/1/0x5F6Fc5398D963FA3C2F8872C9749f889a7b7EBCf/sources/PupeV2.sol | wakeup someones Pupe before their sleep ends | function wake(address _ownerAddress) external {
require(
block.timestamp < abandonTime(msg.sender),
"address is abandoned"
);
uint256 pepeAmount = costWake(_ownerAddress);
require(pepeAddress.balanceOf(msg.sender) >= pepeAmount, "insufficient pepe");
... | 9,621,014 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "@openzeppelin/contracts/utils/math/Math.sol";
import "./interfaces/IOverlayV1Factory.sol";
import "./interfaces/IOverlayV1Market.sol";
import "./interfaces/IOverlayV1Token.sol";
import "./interfaces/feeds/IOverlayV1Feed.sol";
import "./libraries/FixedPo... | sanity check on data fetched from oracle in case of manipulation rough check that log price bounded by +/- priceDriftUpperLimit dt when comparing priceMacro(now) vs priceMacro(now - macroWindow) upper and lower limits are e(+/- priceDriftUpperLimit dt) compare current price over macro window vs price over macro win... | function dataIsValid(Oracle.Data memory data) public view returns (bool) {
uint256 _dpUpperLimit = dpUpperLimit;
uint256 _dpLowerLimit = ONE.divDown(_dpUpperLimit);
uint256 priceNow = data.priceOverMacroWindow;
uint256 priceLast = data.priceOneMacroWindowAgo;
if (priceLast =... | 14,060,234 |
./full_match/1/0x0d584F2e6de87A1588a2033B136f17c8cAB78568/sources/contracts/ElevateCreatorGenerative.sol | core metadata baseURI used for tokens metadata | function baseURI() public view returns (string memory) {
return _baseTokenURI;
}
| 8,320,582 |
pragma solidity ^0.5.0;
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
contract SafeMath {
function safeAdd(uint a, uint b) public pure returns (uint c) {
c = a + b;
... | give an account access to this role/ | function add(Role storage role, address account) internal {
require(account != address(0), "");
require(!has(role, account), "");
role.bearer[account] = true;
}
| 13,139,686 |
./partial_match/4/0xEC0EEE8d19aA33f8cDa7163b29c9AA24F08DD258/sources/ExchangeCore.sol | Execute a STATICCALL (introduced with Ethereum Metropolis, non-state-modifying external call) target Contract to call calldata Calldata (appended to extradata) extradata Base data for STATICCALL (probably function selector and argument encoding) return The result of the call (success or failure)/ | function staticCall(address target, bytes memory calldata, bytes memory extradata)
internal
view
returns (bool result)
{
bytes memory combined = new bytes(calldata.length + extradata.length);
uint index;
assembly {
index := add(combined, 0x20)
... | 8,530,012 |
pragma solidity >=0.4.22 <0.6.0;
pragma experimental ABIEncoderV2;
contract VotingRoom {
struct Voter
{
address payable voterAddr;
// roomsEntred contains id's of rooms
uint[] roomsEntred;
// voted or not
// solidity will assigin voted to false as default .. perfec... | add voter this we can use to support multible rooms for each voter somehow. Make instance of voter to push it to votersArray | function
add_voter(uint roomId )
public {
uint[] memory roomsEntred;
Voter memory voter = Voter(msg.sender,roomsEntred , false) ;
votersArray.push(voter);
roomsArray[roomId].VotersEntred.push( msg.sender);
roomsArray[roomId].VotersCount++;
}
| 1,039,284 |
./full_match/1/0x7506248eC2A111121912B972fadF8405989f8afb/sources/contracts/Create2Deployer.sol | Add accounts which can execute transactions accounts The accounts to add | function addExecutors(address[] memory accounts) public onlyOwner {
for (uint256 i = 0; i < accounts.length; i++) {
_grantRole(PROXY_EXECUTOR, accounts[i]);
}
}
| 17,087,484 |
./full_match/1/0x1b86B82a6cbfb585DE746984026eB993aB4E9013/sources/contracts/exchange/Uniswap/v3/UniswapV3ExchangeAdapter.sol | Return calldata for Uniswap V3 SwapRouter _sourceToken Address of source token to be sold _destinationToken Address of destination token to buy _destinationAddress Address that assets should be transferred to _sourceQuantity Amount of source token to sell _minDestinationQu... | function getTradeCalldata(
address _sourceToken,
address _destinationToken,
address _destinationAddress,
uint256 _sourceQuantity,
uint256 _minDestinationQuantity,
bytes calldata _data
)
external
view
returns (
address,
... | 2,960,285 |
pragma solidity 0.6.8;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./Pairing.sol";
contract IdenaWorldState is Ownable {
using SafeMath for uint256;
using Pairing for *;
struct IdState {
uint256... | End the initialization operation After initialization, the contract's state of identities should be consistent with the idena blockchain state at `_height`. `root` is the relay-state root in idena blockchain./ | function finishInit(uint256 root) public onlyOwner {
require(!_initialized, "initialization can only be performed once.");
_initialized = true;
_root = root;
emit StateChanged(_height, _identities.length, root);
}
| 941,982 |
pragma solidity 0.5.0;
//import "https://github.com/OpenZeppelin/openzeppelin-contracts/tree/docs-org/contracts/token/ERC721/ERC721.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/docs-org/contracts/token/ERC721/ERC721Full.sol";
//import "https://github.com/OpenZeppelin/openzeppelin-contract... | msg.sender maxBidder olmalı | function withdrawBid(uint256 _tokenId) public {
uint256 withdrawnValue = nfts[_tokenId - 1].maxBid;
users[nfts[_tokenId - 1].maxBidder].userBalance += nfts[_tokenId - 1]
emit nftTransaction(
_tokenId,
"Bid Withdrawn",
msg.sender,
address(0x0),... | 12,894,631 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.4;
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {SafeERC20} from "./libs/SafeERC20.sol";
import {
ReentrancyGuardUpgradeable
} from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import {... | / Update funding values Compute interest to funders Distribute interest to funders | function _payInterestToFunders(
uint64 fundingID,
uint256 currentMoneyMarketIncomeIndex
) internal virtual returns (uint256 interestAmount) {
Funding storage f = _getFunding(fundingID);
{
uint256 recordedMoneyMarketIncomeIndex =
f.recordedMoneyMarketIn... | 6,479,298 |
//Address: 0xe736091fc36f1ad476f5e4e03e4425940822d3ba
//Contract name: SingularDTVFund
//Balance: 3.630685972653289973 Ether
//Verification Date: 10/5/2016
//Transacion Count: 294
// CODE STARTS HERE
/// Implements ERC 20 Token standard: https://github.com/ethereum/EIPs/issues/20
/// @title Abstract token contract ... | Setup function sets external contracts' addresses. singularDTVTokenAddress Token address. | function setup(address singularDTVCrowdfundingAddress, address singularDTVTokenAddress)
external
noEther
onlyOwner
returns (bool)
{
if (address(singularDTVCrowdfunding) == 0 && address(singularDTVToken) == 0) {
singularDTVCrowdfunding = SingularDTVCrowdfunding... | 970,898 |
./full_match/80001/0xeb70EaC1371Ef898AC2781D7168c0d5A11da10cf/sources/contracts/trove-factory.sol | redeem desired StableCoin amount for desired collateral tokens _stableAmount the desired amount of StableCoin to pay for redemption _maxRate is max fee (in % with 1e18 precision) allowed to pay _lastTroveCurrentICR ICR of the last trove to be redeemed, if matches then the hint is working and it redeems _lastTroveNe... | function redeemStableCoinForCollateral(
address _collateralToken,
uint256 _stableAmount,
uint256 _maxRate,
uint256 _lastTroveCurrentICR,
address _lastTroveNewPositionHint
) public {
IMintableToken stableCoin_cached = stableCoin;
require(ITrove(firstTrove(_collateralToken)).collateralizat... | 9,539,860 |
//pragma solidity ^0.4.25;
pragma solidity >=0.4.21 <0.6.0;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* ... | Initial funding for the insurance. Unless there are too many delayed flights resulting in insurance payouts, the contract should be self-sustaining/Only voted and non active airline can participate in funding | function fund( uint256 value) external payable
checkValidFundingState()
{
require(value >= 10 ether,"Insufficent Fund");
airlines[tx.origin].isActive = true;
activeAirlines.push(tx.origin);
}
| 5,390,679 |
./partial_match/1/0x02c7d121E7f176ef5dDC1459E1ec05468FbC4FF2/sources/MultiSigWalletWithTimelock.sol | Allows an owner to confirm a transaction. transactionId Transaction ID./ | function confirmTransaction(uint256 transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
emit Confirmation(msg.sender, transactionId);
if ... | 4,339,689 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.7;
import "../strategy-convex-farm-base.sol";
import "../../interfaces/steth.sol";
import "../../interfaces/weth.sol";
contract StrategyConvexSteCRV is StrategyConvexFarmBase {
address public stEth = 0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84;
address publi... | How much CVX to keep to restake? | function harvest() public override onlyBenevolent {
IBaseRewardPool(getCrvRewardContract()).getReward(address(this), true);
uint256 _cvx = IERC20(cvx).balanceOf(address(this));
if (_cvx > 0) {
uint256 _keepCVX = _cvx.mul(keepCVX).div(keepCVXMax);
if (_keepCVX > 0) {
... | 12,598,804 |
/**
*Submitted for verification at Etherscan.io on 2022-01-06
*/
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
... | Function to mint. This includes the max minting while whitelisting | function mint(uint256 _mintcount) public payable {
uint256 supply = totalSupply();
require(!pause);
require(_mintcount > 0, "Mint atleast 1 NFT");
require(
_mintcount <= maximum_mint,
"Maximum mint count per session exceeded"
);
require(supply ... | 2,409,656 |
pragma solidity ^0.5.11;
import "../Manager.sol";
import "./IMinter.sol";
import "./ILivepeerToken.sol";
import "../rounds/IRoundsManager.sol";
import "../bonding/IBondingManager.sol";
import "../libraries/MathUtilsV2.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
/**
* @title Minter
* @dev Mana... | Create reward based on a fractional portion of the mintable tokens for the current round _fracNum Numerator of fraction (active transcoder's stake) _fracDenom Denominator of fraction (total active stake)/ Compute and mint fraction of mintable tokens to include in reward Update amount of minted tokens for round Minted... | function createReward(uint256 _fracNum, uint256 _fracDenom)
external
onlyBondingManager
whenSystemNotPaused
returns (uint256)
{
uint256 mintAmount = MathUtils.percOf(currentMintableTokens, _fracNum, _fracDenom);
currentMintedTokens = currentMintedTokens.add(mintAm... | 1,836,916 |
./partial_match/97/0x9276443Bbbe9CDb09BCd08da35703cA1C6E92596/sources/Database.sol | Equivalent of `show tables;` in SQL return _tables Array of strings. Empty rows must be ignored. Even indices are tables' identifiers. Odd indices are tables' names./ | function showTables() external view returns(bytes32[] memory _tables) {
bytes32[] memory result = new bytes32[](tables.length * 2);
for (uint i = 0; i < tables.length; i++) {
if (!knownTables[tables[i].index]) {
continue;
}
result[i * 2] = bytes3... | 11,386,334 |
./partial_match/3/0xef709b6E24794a7c7a18de3A6991105E61a2E82a/sources/SexCoin.sol | See {ERC20-_mint}. Requirements: - the caller must have the {MinterRole}./ | function mint(address account, uint256 amount) public onlyMinter returns (bool) {
_mint(account, amount);
return true;
}
| 5,166,300 |
pragma solidity ^0.5.0;
import "./Authors.sol";
/// @title Decentralized Research Publishing Platform , Paper's Smart contract
/// @author Farhan Hameed Khan (farhankhan@blockchainsfalcon.com | farhanhbk@hotmail.com)
/// @dev The main purpose of this contract is to store a paper information along its history and v... | getAllPapersIds - This function returns all the stored paper ids regardless their status return uint[] paperids the array of latest paper ids./ | function getAllPapersIds() public view returns(uint[] memory ids)
{
uint index = 0;
ids = new uint[](totalPapers+1);
for(uint loop=0; loop<totalPapers;loop++)
{
ids[index] = loop;
index++;
}
return ids;
}
| 13,027,330 |
/**
*Submitted for verification at Etherscan.io on 2021-10-14
*/
// .*@@#- .*@@#:
// .*@@%- .*@@#:
// .::::::::::::.. :::::::::::::::: : ... | The last person to purchase might overpay, but this prevents them from getting sniped. If this happens, we'll refund the ETH for the unavailable tokens./ | function purchase(uint256 numberOfTokens, uint256[] calldata factions) external payable {
require(isActive, 'Inactive');
require(block.timestamp > startTimes[2], 'Not started');
require(totalPublicSupply < DEUSX_PUBLIC, 'Exceeds supply');
require(numberOfTokens <= PURCHASE_LIMIT, 'Exceeds limit');
... | 15,383,427 |
pragma solidity ^0.4.23;
// File: contracts/TrueCoinReceiver.sol
contract TrueCoinReceiver {
function tokenFallback( address from, uint256 value ) external;
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https... | transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ | function transfer(address _to, uint256 _value) public returns (bool) {
_transferAllArgs(msg.sender, _to, _value);
return true;
}
| 994,454 |
./partial_match/1/0x492Fbb3056D2aAC8e4BFE6C41F0f12f9Fa6FCe79/sources/contracts/AvoRegistry.sol | @inheritdoc IAvoFeeCollector percentage of `gasUsed_` fee amount mode | function calcFee(uint256 gasUsed_) public view returns (uint256 feeAmount_, address payable feeCollector_) {
FeeConfig memory feeConfig_ = feeConfig;
if (feeConfig_.fee > 0) {
if (feeConfig_.mode == 0) {
if (gasUsed_ == 0) {
revert AvoRegistry__Invali... | 3,582,047 |
//Address: 0x0abd16e326ace84e23b0b32398e5604efe83571f
//Contract name: DeBuNeToken
//Balance: 0 Ether
//Verification Date: 12/10/2017
//Transacion Count: 4
// CODE STARTS HERE
pragma solidity ^0.4.17;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
... | transfer ownership of the token to the owner of the presale contract assign the rest of the 100M tokens to the reserve | function finishSale() public onlyOwner {
require(hasEnded());
uint unassigned;
if(maxTokens > tokenRaised) {
unassigned = maxTokens.sub(tokenRaised);
token.mint(HardwareWallet,unassigned);
}
token.finishMinting();
token.transferOwnership(owner);
SaleClosed();
}
| 7,239,893 |
//Address: 0xd68cb2a1f51171c295cac3a7d27c15068922de8a
//Contract name: EverFountainBeanSale
//Balance: 0 Ether
//Verification Date: 12/11/2017
//Transacion Count: 82
// CODE STARTS HERE
pragma solidity ^0.4.11;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMa... | only consumeonly sale token | function trade(uint256 amount, uint256 consume, string order) payable whenNotPaused returns(bool){
require(bytes(order).length > 0);
uint256 balance;
if (msg.value == 0) {
require(consume > 0);
require(amount == 0);
balance = token.balanceOf(msg.sender);
require(balance >= consume)... | 14,106,622 |
./full_match/1/0xb867dF3efF1B234CA08B7D0d85Fb51Fd25C2c2d0/sources/contracts/v2/strategies/RamosStrategy.sol | A hook where strategies can optionally update approvals when the trv is updated/ | function _updateTrvApprovals(address oldTrv, address newTrv) internal override {
_setMaxAllowance(quoteToken, oldTrv, newTrv);
_setMaxAllowance(templeToken, oldTrv, newTrv);
}
| 3,120,037 |
./full_match/137/0xA28D16f5bc2f6132fdF9939a1Aa324d88eD33a56/sources/contracts/Relayer.sol | returns true if relayer processing rebalce request for the given pool (pool Id) | function hasCalledPool(bytes32 poolId) external view override returns (bool) {
return _calledPool == poolId;
}
| 4,778,857 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.16;
contract Vaccine {
// ---GOVERNMENT CONTROL---
// Government
address government;
// Set the contract creator as government
constructor() public {
government = msg.sender;
}
// Returrn the governments... | ---CITIZEN METHODS--- Citizen register themselves for vaccination | function registerCitizen(string memory name) public {
}
| 12,990,052 |
pragma solidity ^0.6.2;
/**
* @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 l... | remove owner from list of owners removedOwner address of removed administrator return true when operation is successful/ | function removeOwner(address removedOwner) public onlyOwner returns(bool) {
require(msg.sender != removedOwner, "Denied deleting of yourself");
owner[removedOwner] = 0;
return true;
}
| 84,090 |
pragma solidity >=0.4.21;
/// @title Contract that contains main application data (storage)
/// @dev Kyama-Project
// OpenZeppelin's SafeMath library
import "../../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract Base {
using SafeMath for uint256;
// Total capital within the main Ky... | Get account total transfer | function accountTotalTransfer(address _accountAddress) external view isApproved returns(uint256) {
uint256 totalTransfer = accounts[accountIndexes[_accountAddress]].totalTransfer;
if(totalTransfer > 0) {
return totalTransfer;
return uint256(0);
}
}
| 6,488,322 |
./partial_match/1/0xe904e50514C5EF0f4C15C9BA44D358eD38f5a024/sources/Governance.sol | Check and mark flag if the proposal collects minimum vote amount within the pre vote period and the proposal will be accepted if the approval vote is larger than denial vote after the end of the main vote period./ | function lockinProposal(bytes32 proposeId) external override {
require(
_proposeStatus[proposeId].currentApprovalVoteSum +
_proposeStatus[proposeId].currentDenialVoteSum >=
_proposeStatus[proposeId].appliedMinimumVote,
"insufficient amount for lockin"
... | 4,039,296 |
pragma solidity 0.5.1;
// Pr000xy - a public utility ERC20 for creating & claiming transparent proxies
// with gas-efficient addresses. Tokens are minted when specific salts or nonces
// are submitted that result in the creation of new proxies with more zero bytes
// than usual. They are then burned when transferring ... | Internal function to ensure that an offer has not expired. expiration uint256 The expiration (using epoch time) in question./ ensure that the expiration is 0 (not set) or ahead of the current time. | function _requireOfferNotExpired(uint256 expiration) internal view {
require(
"Offer has expired and is no longer valid."
);
}
| 1,770,643 |
//! 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... | Expand the list of validators. | function addValidator(address _validator) public {
validators.push(_validator);
indices[_validator] = validators.length - 1;
}
| 12,680,937 |
/**
*
* Official token MemeBits
*
*
* $Memes
*
*
* Trading on Jokeswap
*
*/
pragma solidity 0.6.12;
//
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they ... | Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as... | function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "MemeBits::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
ret... | 10,402,013 |
pragma solidity ^0.5.6;
interface ILinkdropERC20 {
function verifyLinkdropSignerSignature
(
uint _weiAmount,
address _tokenAddress,
uint _tokenAmount,
uint _expiration,
address _linkId,
bytes calldata _signature
)
external view returns (bool);
funct... | Indicates whether a link is claimed or not _linkdropMaster Address of lindkrop master _campaignId Campaign id _linkId Address corresponding to link key return True if claimed/ | function isClaimedLink(address payable _linkdropMaster, uint _campaignId, address _linkId) public view returns (bool) {
if (!isDeployed(_linkdropMaster, _campaignId)) {
return false;
}
else {
address payable proxy = address(uint160(deployed[salt(_linkdropMaster, _cam... | 900,353 |
/*
Copyright 2021 Pulsar 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 agree... | Calculates the signed funding amount that has accumulated over a period of time. timeDelta Number of seconds over which to calculate the accumulated funding amount. return True if the funding rate is positive, and false otherwise. return The funding amount as a unitless rate, represented as a f... | function getFunding(
uint256 timeDelta
)
public
view
returns (bool, uint256)
{
PPTypes.Index memory fundingRate = _FUNDING_RATE_;
uint256 fundingAmount = uint256(fundingRate.value).mul(timeDelta);
return (fundingRate.isPositive, fundingAmount);
}
| 12,867,194 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
// Openzeppelin
import "./openzeppelin-solidity/contracts/SafeMath.sol";
import "./openzeppelin-solidity/contracts/Ownable.sol";
import "./openzeppelin-solidity/contracts/ERC20/SafeERC20.sol";
import "./openzeppelin-solidity/contracts/ERC1155/IERC1155.sol";
impo... | Removes the marketplace listing at the given index. _index Index of the marketplace listing./ | function removeListing(uint256 _index) external override indexInRange(_index) onlySeller(_index) {
MarketplaceListing memory listing = marketplaceListings[_index];
_removeTokensFromListing(listing.botTokenAddress, listing.positionID, msg.sender, _index, listing.numberOfTokens);
emit Remove... | 5,394,637 |
// 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... | Check if relay is banned. Ban is global. If the relay is banned it means it lost relay power in all rounds, past and future. candidate Address to check | function isBanned(
address candidate
) override public view returns(bool) {
return blacklist[candidate];
}
| 540,956 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/cont... | Moves tokens `amount` from `sender` to `recipient`. Note: We do not rebase in the transfer as the rebase hook might cause error. For example, if the rebase hook includes a call to sync() to Uniswap v2 pair, it will trigger reentrancy protection on Uniswap v2 pair./ | function _transfer(address _sender, address _recipient, uint256 _amount) internal virtual override {
require(_sender != _recipient, "recipient cannot be sender");
uint256 _shareToTransfer = _amount.mul(WAD).div(index);
uint256 _oldSenderShare = userShare[_sender];
uint256 _newSender... | 14,901,119 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';
import './interfaces/IBuyBackAndBurn.sol';
import './interfaces/IMultiSignatureOracle.sol';
import './utils/MyPausableUpgradeable.sol';
import './token/MintableERC721.sol';
import 'hardhat/console.... | Counts all deposits Assigns a unique deposit ID to each deposit which helps to prevent double releases A mapping from deposit IDs to boolean if a deposit has been released or not depositChainId => depositNumber => true (released) A mapping for a collection if a NFT for a tokenId deposit has been minted or not tokenAddr... | function initialize(address _buyBackAndBurn, address _multiSignatureOracle) external initializer {
__MyPausableUpgradeable_init();
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
buyBackAndBurn = IBuyBackAndBurn(_buyBackAndBurn);
multiSignatureOracle = IMultiSignatureOracle(_multiSignatureOracle);
... | 1,512,057 |
pragma solidity 0.4.26;
import "./ETOTimedStateMachine.sol";
import "./ETOTerms.sol";
import "./ETOTermsConstraints.sol";
import "../Universe.sol";
import "../Company/IEquityToken.sol";
import "../ICBM/LockedAccount.sol";
import "../AccessControl/AccessControlled.sol";
import "../Agreement.sol";
import "../Math.sol";
... | compute EUR eurEquivalent via oracle if etherrequire if rate older than 4 hours | function convertToEurEquiv(uint256 amountEth)
private
constant
returns (uint256)
{
(uint256 rate, uint256 rateTimestamp) = CURRENCY_RATES.getExchangeRate(ETHER_TOKEN, EURO_TOKEN);
require(block.timestamp - rateTimestamp < TOKEN_RATE_EXPIRES_AFTER, "NF_ETO_INVALID_ETH_RATE... | 15,838,104 |
pragma solidity ^0.4.0;//version 0.4 or higher
contract BookContract{
//participating entities with Ethereum addresses
address publisher;
address author; //book author
string public bookDescription;//description of book
enum contractState { NotReady,Created, VerifiedandWaitingforCustomer,CustomerDe... | publisher verifies downlaod | function verifyDownload(address customerAddress , bool result) OnlyPublisher{
require(customers[customerAddress] == customerState.DoneVerification);
numberOfCustomers += 1;
{
DownloadSuccess(msg.sender, "Hash verified, and download is successful by the customer ") ;
cus... | 5,511,632 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "../contracts/interfaces/IAbyssLockup.sol";
/**
* Abyss Finance's Abyss... | Withdraws the full amount of `token` requested from this smart contract by the caller's account. Requirement: - Required Abyss amount is available on the account. - There is pending active withdrawal request for `token` by the caller's account. - Required amount of time has already passed since withrawal request execut... | function withdraw(address token) external nonReentrant isAllowed(msg.sender, token) returns (bool) {
require(address(token) != address(0), "AbyssSafe: variable cannot be 0");
require(
_rates[msg.sender] == 0 ||
token == address(tokenContract) ||
tokenContract.bala... | 5,392,673 |
./partial_match/1/0x7e55ccB0bCe9A9094aE5cf75EF71b3275B45658A/sources/Tettoken.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/ | function transferFrom(address _from, address _to, uint256 _value) public onlyPayloadSize(3 * 32) whenNotPaused returns (bool success) {
require (!(_to == 0x0));
var _allowance = allowed[_from][msg.sender];
if (_allowance < maxtet) {
allowed[_from][msg.sender] = _allowance.sub(_... | 3,553,624 |
pragma solidity 0.4.21;
import '../contracts/misc/SafeMath.sol';
import '../contracts/misc/Ownable.sol';
interface Dgvc {
function balanceOf(address _owner) external constant returns (uint256 balance);
}
interface Reputation {
function getGroupRate (uint _rep) external returns (uint8);
function calculateR... | create curator with 0 reputation, 0 rewarding and 1 reputation group | function createCurator() public {
require(!curators[msg.sender].exist);
uint256 dgvcBalance = dgvcToken.balanceOf(msg.sender);
require(dgvcBalance >= 5*1e4);
if (dgvcBalance >= 5*1e4 && dgvcBalance < 1000*1e4 ) {
curators[msg.sender] = CuratorInstance(true, 0, 0, 1, 30, ... | 919,873 |
./full_match/1/0x84fE05f541cee93d0B02e03cD4319c29BA0030A2/sources/src/rollup/Node.sol | Update the child confirmed deadline deadline The new deadline to set/ | function newChildConfirmDeadline(Node storage self, uint64 deadline) internal {
self.noChildConfirmedBeforeBlock = deadline;
}
| 3,877,348 |
./partial_match/1/0x332679057B9E8b541993d658069543f7AdFDab93/sources/FeelrToken.sol | trading disable till launchif any account belongs to isExcludedFromFee account then remove the fee | function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "$Feelr: transfer from the zero address");
require(to != address(0), "$Feelr: transfer to the zero address");
require(amount > 0, "$Feelr: Amount must be greater than zero");
if (!isEx... | 3,552,550 |
./full_match/80001/0xb3194460B5548628E9f58424525E2a823D5c18Ac/sources/contracts/interfaces/IDiamondLoupe.sol | A loupe is a small magnifying glass used to look at diamonds. These functions look at diamonds | interface IDiamondLoupe {
pragma solidity 0.8.19;
struct Facet {
address facetAddress;
bytes4[] functionSelectors;
}
}
| 9,516,669 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "./utils/access/Ownable.sol";
import "./utils/math/SafeMath.sol";
import "./utils/Address.sol";
import "./utils/security/Pausable.sol";
import "./ERC721/ERC721.sol";
import "./ERC20/IERC20.sol";
import "./IMarketplace.sol";
import "./FeeManager.... | Executes the sale for a published NFT and checks for the asset fingerprint _nftAddress - Address of the NFT registry _assetId - ID of the published NFT _priceInWei - Order price/ Get the current valid order for the asset or fail market fee to cut Send market fees to owner Calculate sale share Transfer share amount f... | function safeExecuteOrder(
address _nftAddress,
uint256 _assetId,
uint256 _priceInWei
)
public whenNotPaused
{
Order memory order = _getValidOrder(
_nftAddress,
_assetId
);
require(order.price == _priceInWei, "Marketplace: inva... | 1,057,074 |
./full_match/4/0x23fAcd05C010AbAdF678c158EA26759661Fa3242/sources/browser/hook.sol | pass _parentId = 0 if you want the contract to search free slot for you, else passing non zero _parent id will be considered as desired parent, and will save little gas | function regUser(uint256 _networkId,uint256 _referrerId,uint256 _parentId, uint256 amount) public payable returns(bool)
{
require(tx.origin != address(0), "invalid sender" );
require(!pausenetwork[_networkId] && goToPublic[_networkId], "not ready or paused by admin");
require(_networkId ... | 655,168 |
pragma solidity ^0.5.16;
import "./ComptrollerInterface.sol";
import "./CTokenInterfaces.sol";
import "./ErrorReporter.sol";
import "./Exponential.sol";
import "./EIP20Interface.sol";
import "./EIP20NonStandardInterface.sol";
import "./InterestRateModel.sol";
/**
* @title Compound's CToken Contract
* @notice Abstra... | Validates seize and reverts on rejection. May emit logs. cTokenCollateral Asset which was used as collateral and will be seized cTokenBorrowed Asset which was borrowed by the borrower liquidator The address repaying the borrow and seizing the collateral borrower The address of the borrower seizeTokens The number o... | function seizeVerify(
address cTokenCollateral,
address cTokenBorrowed,
address liquidator,
address borrower,
uint256 seizeTokens
) external {
cTokenCollateral;
cTokenBorrowed;
liquidator;
borrower;
seizeTokens;
if (false) ... | 6,224,070 |
pragma solidity ^0.4.23;
/******* USING Registry **************************
Gives the inherting contract access to:
.addressOf(bytes32): returns current address mapped to the name.
[modifier] .fromOwner(): requires the sender is owner.
*************************************************/
// Returned by .getReg... | IMPLEMENTS: Bankrollable.getProfits() Ensures contract always has at least bankroll + totalCredits. | function getCollateral() public view returns (uint _amount) {
return vars.totalCredits;
}
| 2,445,978 |
./partial_match/1/0xA506873E1458c4CcA3a6ED57f3876F23599E0743/sources/contracts/NFTStaking.sol | Emergency function: In case any ETH get stuck in the contract unintentionally Only owner can retrieve the asset balance to a recipient address | function rescueETH(address recipient) onlyOwner external {
uint256 balance = address(this).balance;
if(balance>0)
payable(recipient).transfer(balance);
}
| 4,197,327 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.