file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/1/0x8281f2bECfF37326Eb6cBE33527434611558B031/sources/DepegProduct.sol | block policy creation when protected stable coin is triggered or depegged calculate premium for specified bundle ensure policy holder has sufficient balance and allowance remember for which policy holder this application is in case the protected wallet is different from policy holder: also remember for which wallet add... | function _applyForPolicyWithBundle(
address policyHolder,
address wallet,
uint256 protectedBalance,
uint256 duration,
uint256 bundleId
)
internal
returns(bytes32 processId)
{
require(_state == DepegState.Active, "ERROR:DP-010:PRODUCT_NOT_ACTI... | 4,153,891 |
./full_match/11155111/0x66F0E06b6F33B4307DDfe0ADaa5f545C4A834A13/sources/contracts/Contract.sol | Function to get all product details | function getAllProducts() public view returns (Product[] memory) {
return products;
}
| 3,823,302 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/// @title NFPS Stakin... | Setup farm with token and reward rate | function setUpFarm(address stakingTokenAddress, uint256 startingRewardRate)
public
onlyOwner
{
_stakingToken = IERC20(stakingTokenAddress);
_rewardRate = startingRewardRate;
}
| 1,344,268 |
pragma solidity 0.6.0;
import "./Lib/Address.sol";
import "./Lib/SafeMath.sol";
import "./Lib/AddressPayable.sol";
import "./Lib/SafeERC20.sol";
/**
* @title NToken contract
* @dev Include standard erc20 method, mining method, and mining data
*/
interface IERC20 {
function totalSupply() external view returns... | Check whether the price-checking functions can be called | function checkUseNestPrice(address target) public view returns (bool) {
if (!_blocklist[target] && _addressEffect[target] < now && _addressEffect[target] != 0) {
return true;
return false;
}
} else {
}
| 12,580,183 |
/**
*Submitted for verification at Etherscan.io on 2021-07-20
*/
// File @openzeppelin/contracts/utils/introspection/[email protected]
// 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].
*
* Implem... | Return the hash of the given tokenURI tokenURI string for which to calculate the hash return bytes32 hash value/ | function hashed(string memory tokenURI) internal pure returns (bytes32) {
return keccak256(abi.encodePacked(tokenURI));
}
| 2,178,270 |
pragma solidity >=0.4.0 <0.6.0;
import "./Formula.sol";
import "./SnowflakeResolver.sol";
import "./zeppelin/math/SafeMath.sol";
import "./interfaces/HydroInterface.sol";
import "./interfaces/SnowflakeInterface.sol";
import "./interfaces/IdentityRegistryInterface.sol";
/**
* @title Snowflake Glacier
* @notice Creat... | Set the Accrual Schedule debtID the id of the debt _accruals the Schedule enum/ | function setAccruals(uint debtID, uint8 _accruals) public {
SnowflakeInterface snowflake = SnowflakeInterface(snowflakeAddress);
IdentityRegistryInterface identityRegistry = IdentityRegistryInterface(snowflake.identityRegistryAddress());
uint256 ein = identityRegistry.getEIN(msg.sender);
... | 5,429,850 |
/**
*Submitted for verification at Etherscan.io on 2022-03-31
*/
pragma solidity ^0.8.10;
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
/**
* @dev Provides information about the current execution context, including the... | See {IERC165-supportsInterface}./ | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
function _afterTokenTransfer(
address from,
address to,
uint256 tokenId
}
}
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bo... | 7,970,845 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import {PercentageMath} from '../protocol/libraries/math/PercentageMath.sol';
import {SafeMath} from '../dependencies/openzeppelin/contracts/SafeMath.sol';
import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.... | Only fall back when the sender is not the admin./ | function _willFallback() internal override(BaseAdminUpgradeabilityProxy, Proxy) {
BaseAdminUpgradeabilityProxy._willFallback();
}
| 68,793 |
// SPDX-License-Identifier: MIT
// version: 0.1
pragma solidity ^0.8.9;
library SM2Curve {
event Log(string, uint);
uint constant SM2_P = 0xfffffffeffffffffffffffffffffffffffffffff00000000ffffffffffffffff;
uint constant SM2_A = 0xfffffffeffffffffffffffffffffffffffffffff00000000fffffffffffffffc;
uint constant SM... | bytes memory sig = genSig(0x7eaae95db44c417c1d3f0e24f911a029beae982e8f617bfefc69ca39e9866fd6, 0x2dc9efce73d232a549b2fdd1870eb4df7e62a8196cf2862749337627a3d4dfd7, 2); bytes32 hash = genHash(0x4b751e629a4a3bd8fc8f32efae9b0addefd687a85827d10a5cae2447ef0419a2); address res = sm2verify(hash, sig); emit Log("res", res); | function testSign() public returns (bool) {
return true;
}
| 6,428,206 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.10;
import "../libraries/SafeERC20.sol";
import "../interfaces/IERC20.sol";
import "../interfaces/ITreasury.sol";
import "../types/ExodusAccessControlled.sol";
interface IStaking {
function stake(uint256 _amount, address _recipient) external ret... | Unstakes either BTRFLY or LOBI from treasury _redacted Bool if unstakiung to redacted or lobi _amount Amount of token that will be withdrawn from treasury and unstaked retrieve amount of staked token from treasury approve staked token to be spent by staking contract unstake token send token back to treasury | function unstake(bool _redacted, uint256 _amount) external onlyGuardian {
(address staking, address token, address stakedToken) = _redactedOrLobi(_redacted);
treasury.manage(stakedToken, _amount);
IERC20(stakedToken).approve(staking, _amount);
IStaking(staking).unstake(_amount, fa... | 12,690,197 |
pragma solidity 0.5.17;
import "./BondedECDSAKeep.sol";
import "./KeepBonding.sol";
import "./api/IBondedECDSAKeepFactory.sol";
import "./CloneFactory.sol";
import "@keep-network/sortition-pools/contracts/api/IStaking.sol";
import "@keep-network/sortition-pools/contracts/api/IBonding.sol";
import "@keep-network/sorti... | Sets a new group selection seed value. The function is expected to be called in a callback by the random beacon. _relayEntry Beacon output. | function __beaconCallback(uint256 _relayEntry) external onlyRandomBeacon {
groupSelectionSeed = _relayEntry;
}
| 5,457,003 |
pragma solidity ^0.4.24;
contract Control {
address public owner;
bool public pause;
event PAUSED();
event STARTED();
modifier onlyOwner {
require(msg.sender == owner);
_;
}
modifier whenPaused {
require(pause);
_;
}
modifier whenNotPaused {
... | transfer holds from => to (only holds, no bouns) this will withdrawal the holder bonus of these holds and the to&39;s fullfilled will go up, since total bonus unchanged, but holds goes more/ | function transferHolds(address from, address to, uint256 amount) internal {
require(holds[from] >= amount);
require(holds[to] + amount > holds[to]);
uint256 fromBonus = (watermark - fullfilled[from]) * amount;
uint256 toBonus = (watermark - fullfilled[to]) * holds[to];
... | 2,332,812 |
pragma solidity ^0.5.0;
// Copyright 2018 OpenST 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 required by applica... | Get storage root for the OriginCore contract. The existence of storage root is proved with merkle proof. _accountRlp rlp encoded data of account. _accountBranchRlp RLP encoded path from root node to leaf node to prove account in merkle tree. _encodedPath Encoded path to search account node... | function getStorageRoot(
bytes memory _accountRlp,
bytes memory _accountBranchRlp,
bytes storage _encodedPath,
bytes32 _stateRoot
)
internal
pure
returns (bytes32 storageRoot_)
{
RLP.RLPItem memory accountItem = RLP.toRLPItem(_accountRlp);
... | 5,379,466 |
pragma solidity ^0.4.18;
/* ==================================================================== */
/* Copyright (c) 2018 The Priate Conquest Project. All rights reserved.
/*
/* https://www.pirateconquest.com One of the world's slg games of blockchain
/*
/* authors rainy@livestar.com/Jonny.Fu@livestar.com
/... | Creates a new Captain with the given name. | function CreateCaptainToken(address _owner,uint256 _price, uint32 _captainId, uint32 _color,uint32 _atk,uint32 _defense,uint32 _atk_min,uint32 _atk_max) public onlyAccess {
_createCaptainToken(_owner,_price,_captainId,_color,_atk,_defense,_atk_min,_atk_max);
}
| 1,032,234 |
/**
*Submitted for verification at Etherscan.io on 2020-07-09
*/
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.6.2 <0.7.0;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error.
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on... | 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 whenNotPaused override returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
| 1,964,661 |
./partial_match/5/0x7106619Bb2c60ab9d4DAF5FC4941d46cba6Aa4Ed/sources/OOF.sol | Return the log in base 10, following the selected rounding direction, of a positive value. Returns 0 if given 0./ | function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
}
}
| 16,847,142 |
pragma solidity ^0.5.0;
import "@openzeppelin/contracts/ownership/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./aave/interfaces/IAToken.sol";
import "./aave/interfaces/ILendingPool.sol";
import "./aave/interfaces/ILendingPoolAddressesProvider.sol";
contract HybridBank is Ownable {
... | reads the Hybrid bank clients count return clientCount | function getClientCount()
public view
onlyOwner
returns (uint256) {
return clientCount;
}
| 12,579,606 |
pragma solidity ^0.6.6;
... | inject NONSTANDARD NAMING | function ADD811(uint256 a, uint256 b) internal pure returns (uint256) { | 12,990,995 |
pragma solidity ^0.5.17;
pragma experimental ABIEncoderV2;
import "./Checkpoints.sol";
import "../../openzeppelin/Address.sol";
/**
* @title Weighted Staking contract.
* @notice Computation of power and votes used by FeeSharingProxy and
* GovernorAlpha and Staking contracts w/ mainly 3 public functions:
* + get... | Return flag whether message sender is a registered vesting contract./ | function _isVestingContract() internal view returns (bool) {
bytes32 codeHash = _getCodeHash(msg.sender);
return vestingCodeHashes[codeHash];
}
| 1,020,164 |
pragma solidity ^0.5.16;
/**
Copyright 2020 Compound Labs, Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the follow... | Transfer `amount` tokens from `src` to `dst` src The address of the source account dst The address of the destination account amount The number of tokens to transfer return Whether or not the transfer succeeded/ | function transferFrom(address src, address dst, uint256 amount) external nonReentrant returns (bool) {
transferTokens(msg.sender, src, dst, amount);
return true;
}
| 163,790 |
pragma solidity ^0.4.8;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
functi... | Designates an address as an unauthorized actor for a specific role _actor the address whose authorized status is changing _role the role the authorized status pertains to/ | function removeAuthorizedActor(address _actor, Role _role) onlyOwner public {
toggleAuthorizedActor(_actor, _role, false);
}
| 13,007,705 |
./full_match/1/0xed0941e5dC9141A2b029C65862044A4Cac9e56E9/sources/src/zaps/WethZap.sol | user has to approve zap using vault share tokens | function safeRedeemETH(uint256 _shares, uint256 _minAssets) external whenNotPaused returns (uint256 assets) {
assets = vault.safeRedeem(_shares, address(this), msg.sender, _minAssets);
WETH9.withdraw(assets);
SafeTransferLib.safeTransferETH(msg.sender, assets);
emit Withdraw(msg.send... | 3,219,516 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
//Import openzepplin-contracts ERC20 library from github
import "./node_modules/openzeppelin-contracts/token/ERC20/ERC20.sol";
//Contract token raj2Coin
contract Token is ERC20 ("Menon Administration", "MENON2") {
address internal admin; // Address of the A... | Function to transfer tokens to another address | function transfer(address payable _from, address _to, uint _value) public onlyTreasurer returns (bool success) {
require(_value > 0);
if (balanceOf(_from) >= _value) {
_transfer(_from, _to, _value);
return true;
}
}
| 1,834,317 |
./full_match/1/0x8DCD98dAcb82313dd1A0A9B4D30B2373184d4591/sources/browser/StableFund_flat.sol | Transfer tokens from one address to another. from The address you want to send tokens from. to The address you want to transfer to. value The amount of tokens to be transferred./ | function transferFrom(
address from,
address to,
uint256 value
) public validRecipient(to) returns (bool) {
_allowedFragments[from][msg.sender] = _allowedFragments[from][msg
.sender]
.sub(value);
uint256 gonValue = value.mul(_gonsPerFragment);
... | 4,829,245 |
./partial_match/1/0x5B17f168829968D9fb5F049b45b14b7601AFf85B/sources/ions/ERC721_Remote_Store.sol | See {IERC721-isApprovedForAll}./ return _ristore.tokenOperatorApproval(owner, operator); | function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _estore.boolStorage(keccak256(abi.encodePacked("tokenOperatorApproval", owner, operator)));
}
| 11,032,353 |
./full_match/3/0x0074FB56Aa4581D67Bb4f56AE17b5D6DcAb13BFc/sources/contracts/Nimble.sol | Triggers stopped state. Requirements: - The contract must not be paused./ | function _unpause(uint transferId) internal whenPaused(transferId) {
_blocked[_transferPending[transferId].tokenId] = false;
emit Unpaused(_msgSender(), _transferPending[transferId].tokenId);
}
| 14,155,177 |
./full_match/80001/0x6bbb4C1Ea6a89ACD659D326Be55140964F8cd085/sources/contracts/player-management/PDTOracle.sol | Changes Oracle variables. Admin role only. chainlinkToken_ Address of Chainlink Token. oracle_ Address of Oracle. jobId_ Bytes32 representing Job ID. oraclePayment_ Amount of LINK to be paid per request./ | function setupOracle(
address chainlinkToken_,
address oracle_,
bytes32 jobId_,
uint256 oraclePayment_
) public onlyRole(DEFAULT_ADMIN_ROLE) {
chainlinkToken = chainlinkToken_;
oracle = oracle_;
jobId = jobId_;
oraclePayment = oraclePayment_;
... | 5,609,401 |
./full_match/4/0x3A01deA73fbcf964c6E878b4A9184770BB3820F4/sources/contracts/coic.sol | ROYALTY FUNCTIONS/ | function getRoyalties(uint256) external view override returns (address payable[] memory recipients, uint256[] memory bps) {
if (_royaltyRecipient != address(0x0)) {
recipients = new address payable[](1);
recipients[0] = _royaltyRecipient;
bps = new uint256[](1);
... | 816,776 |
// Copyright (C) 2020 Zerion Inc. <https://zerion.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 ... | return Amount of FNX/USDC/FNX locked on the protocol by the given account. Implementation of ProtocolAdapter interface function./ | function getBalance(address token, address account) external view override returns (uint256) {
if (token == FNX ) {
return FinNexusCollecteralPool(COLLATERAL_POOL_FNX).getUserInputCollateral(account,token);
}
if( token == USDC) {
return FinNexusCollecteralPo... | 6,096,237 |
pragma solidity ^0.4.18;
/**************************
* SATURN ICO smart contract *
**************************/
/**
* @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, uint2... | cannot pay more than the contract has itself ugly block of code that handles variable referral commisions end referral updates | function processReferral(address referrer, uint256 tokenAmount, uint256 etherAmount) private returns (bool success) {
Ref memory ref = referrals[referrer];
uint256 referralAmount = tokenAmount.div(ref.rewardDiv);
ref.amount = ref.amount.add(referralAmount);
ref.etherAmount = ref.etherAmount.add(etherA... | 5,755,686 |
pragma solidity ^0.5.16;
interface IERC20 {
function TOTALSUPPLY529() external view returns (uint); //inject NONSTANDARD NAMING
function BALANCEOF13(address account) external vi... | inject NONSTANDARD NAMING | function ADDMINTER132(address _minter) public { | 1,780,103 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import { Bridge_Initializer } from "./CommonTest.t.sol";
import { StandardBridge } from "../universal/StandardBridge.sol";
import { L2StandardBridge } from "../L2/L2StandardBridge.sol";
import { CrossDomainMessenger } from "../universal/CrossDomainMessenger.sol";
... | receive - can accept ETH | function test_receive() external {
assertEq(address(op).balance, 0);
vm.expectEmit(true, true, true, true);
emit ETHBridgeInitiated(alice, alice, 100, hex"");
vm.expectCall(
address(L1Messenger),
abi.encodeWithSelector(
CrossDomainMessenger.s... | 6,440,397 |
./full_match/100/0x048DC80e3A072914dA7c8bB77C97309a69E3B206/sources/contracts/FreeBetV2.sol | Maintainer: withdraw unlocked token reserves amount Amount to withdraw/ | function withdrawReserve(uint128 amount) external onlyMaintainer {
_checkInsufficient(amount);
TransferHelper.safeTransfer(token, msg.sender, amount);
}
| 14,270,834 |
pragma solidity 0.5.10;
import "./base/BanReasons.sol";
import "./interfaces/IBlockRewardAuRa.sol";
import "./interfaces/IGovernance.sol";
import "./interfaces/IRandomAuRa.sol";
import "./interfaces/IStakingAuRa.sol";
import "./interfaces/IValidatorSetAuRa.sol";
import "./upgradeability/UpgradeabilityAdmin.sol";
impor... | Returns a boolean flag indicating if the `initialize` function has been called. | function isInitialized() public view returns(bool) {
return blockRewardContract != address(0);
}
| 2,495,670 |
./partial_match/1/0x01a2311eF0fF80704bF4AE30F92567bC13E80B23/sources/project:/contracts/MDelegator.sol | Tells the address of the current mDelegatorUserImplementation return implementation The address of the current mDelegatorUserImplementation/ | function mDelegatorUserImplementation() public view returns (address implementation) {
bytes32 position = mDelegatorUserImplementationPosition;
assembly {
implementation := sload(position)
}
}
| 9,136,782 |
pragma solidity ^0.5.0;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256... | injected LOCKED ETHER | function () payable external { | 5,456,985 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/**
* @author Atlas Corporation
* @title Bad Token Faucet
*/
contract BadFaucet... | claim BAD tokens for BAYC, MAYC, and Bad Banana holders maximum of 10 NFTs can be used per claim transaction _baycTokens array of BAYC token numbers owned by sender _maycTokens array of MAYC token numbers owned by sender _badBananaTokens array of Bad Banana token numbers owner by sender/ | function claimBad(
uint256[] calldata _baycTokens,
uint256[] calldata _maycTokens,
uint256[] calldata _badBananaTokens
)
external
{
uint256 totalTokensSubmitted = _baycTokens.length.add(_maycTokens.length).add(_badBananaTokens.length);
require(totalTokensSub... | 10,054,518 |
./full_match/43114/0x97E1fA30CE93Ee2FBb4f2F4c2008F5091758F36C/sources/Masterchef/Masterchef.sol | Deposit LP tokens to MasterChef for OPUS allocation. | function deposit(uint256 _pid, uint256 _amount, address _referrer) public {
require (_pid != 0, 'deposit OPUS by staking');
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (refferralEnabled && _amount > 0 && a... | 4,594,241 |
pragma solidity ^0.5.17;
/**
* @title Multisignature wallet - Allows multiple parties to agree on
* transactions before execution.
*
* @author Stefan George - <stefan.george@consensys.net>
* */
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint256 indexed transaction... | Get the number of confirmations of a transaction. transactionId Transaction ID. return Number of confirmations. / | function getConfirmationCount(uint256 transactionId) public view returns (uint256 count) {
for (uint256 i = 0; i < owners.length; i++) if (confirmations[transactionId][owners[i]]) count += 1;
}
| 14,958,206 |
./full_match/5/0x18a674cfa613bebadB8f9227F654E055a925f49a/sources/contracts/Contract.sol | Search for the EHR in the allEHRs array If the EHR is found, delete it from allEHRs and EHRs mapping Delete from allEHRs array | function deleteEHR(address _owner, address _receiver) public {
uint256 indexToDelete = 0;
bool found = false;
for (uint256 i = 0; i < allEHRs.length; i++) {
if (allEHRs[i].owner == _owner && allEHRs[i].receiver == _receiver) {
indexToDelete = i;
... | 1,953,986 |
./full_match/1/0x1a5C169Fbcbfb00B2c20c6746681aA774d8A613A/sources/contracts/TermPool.sol | Returns the amount of pending reward of the account _termId Id of the term _account Address of the account | function rewardOf(
uint256 _termId,
address _account
) public view existingTerm(_termId) returns (uint256) {
Term storage term = terms[_termId];
uint256 balance = IERC20MetadataUpgradeable(term.tpToken).balanceOf(_account);
if (balance > 0) {
return
(balance * _annualRate(term.rewa... | 2,935,181 |
pragma solidity 0.4.25;
/**
* @title SafeCompare
*/
library SafeCompare {
function stringCompare(string str1, string str2) internal pure returns(bool) {
return keccak256(abi.encodePacked(str1)) == keccak256(abi.encodePacked(str2));
}
}
library SafeMath {
/**
* @dev Multiplies two... | _processRefund, Executed when a Refund has been validated and is ready to be executed. Not necessarily emits/sends tokens. _pledgeId pledge contract index number. _targetAddress transfer target address. _returnSum return token sum./ | function _processRefund(uint256 _returnSum, address _targetAddress, uint256 _pledgeId) internal {
escrows[_pledgeId].pledgeSum = escrows[_pledgeId].pledgeSum.sub(_returnSum);
}
| 6,378,342 |
// File @openzeppelin/contracts/utils/Context.sol@v4.2.0
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they shoul... | Make tokens & edition Created gated sale | function mintBatchEditionGatedOnly(
uint16 _editionSize,
uint256 _merkleIndex,
bytes32[] calldata _merkleProof,
address _deployedRoyaltiesHandler,
string calldata _uri
) canMintAgain(_msgSender()) external {
require(accessControls.isVerifiedArtist(_merkleIndex, _m... | 5,998,721 |
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(ad... | Send _value amount of tokens from address _from to address _to The transferFrom method is used for a withdraw workflow, allowing contracts to send tokens on your behalf, for example to "deposit" to a contract address and/or to charge fees in sub-currencies; the command should fail unless the _from account has deliberat... | function transferFrom(address _from,address _to, uint256 _value) public returns (bool success) {
if (_to != address(0) && isFrozenAccount(_from) == false && balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0 && balances[_to].add(_value) > balances[_to]) {
balances[_f... | 252,490 |
// SPDX-License-Identifier: MIT
/*
Coded with ♥ by
██████╗░███████╗███████╗██╗ ░██╗░░░░░░░██╗░█████╗░███╗░░██╗██████╗░███████╗██████╗░██╗░░░░░░█████╗░███╗░░██╗██████╗░
██╔══██╗██╔════╝██╔════╝██║ ░██║░░██╗░░██║██╔══██╗████╗░██║██╔══██╗██╔════╝██╔══██╗██║░░░░░██╔══██╗████╗░██║██╔══██╗
██║░░██║█████╗░░█████╗░░██║ ░... | @inheritdoc IVestingWallet | function addBenefits(
address _token,
address[] calldata __beneficiaries,
uint256[] calldata _amounts,
uint256 _startDate,
uint256 _duration
) external override onlyGovernance {
uint256 _length = __beneficiaries.length;
if (_length != _amounts.length) revert WrongLengthAmounts();
ui... | 13,862,285 |
pragma solidity ^0.4.11;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the or... | Allows the anyone to read the current rate. _symbol the symbol to be retrieved./ | function getRate(string _symbol) public constant returns(uint) {
return rates[sha3(_symbol)];
}
| 2,086,603 |
// 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... | Check whether a fee is registered _fee The address of the fee to check return isRegisteredFee_ True if the fee is registered | function isRegisteredFee(address _fee) public view returns (bool isRegisteredFee_) {
return registeredFees.contains(_fee);
}
| 1,697,282 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "./utils/BaseTest.sol";
import "./utils/mocks/MockERC721B.sol";
contract TestERC721B is BaseTest {
MockERC721B internal erc721b;
function setUp() public virtual {
erc721b = new MockERC721B();
vm.label(address(erc721b), "ERC721B");... | mint id 1,2 to bob bob approves alice to transfer id 2 fail to transfer id 1 as not approved for it transfer id 2 using alice from bob to alice check approval has been removed check token transferred correctly | function test_approvals() public {
erc721b.mint(bob, 2);
vm.prank(bob);
erc721b.approve(alice, 2);
assertEq(erc721b.getApproved(1), address(0));
assertEq(erc721b.getApproved(2), alice);
vm.startPrank(alice);
vm.expectRevert(ERC721.NotAuthorized.selector);
... | 6,478,635 |
/**
*Submitted for verification at Etherscan.io on 2021-08-02
*/
// Sources flattened with hardhat v2.1.1 https://hardhat.org
// File @openzeppelin/contracts/utils/introspection/[email protected]
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in th... | Add a new contract that can mint tokens for users minter that has access to mint new tokens for a specific user/ | function addTokenMinter(address minter) external onlyOwner {
require(stakeMinter == address(0), "Can't assign a new token minter");
require(
minter.supportsInterface(type(INFTPokeStakeController).interfaceId),
"Token doesn't implement INFTPokeStakeController"
);
... | 6,557,182 |
pragma solidity ^0.4.24;
contract FlyToTheMoonEvents {
// buy keys during first stage
event onFirStage
(
address indexed player,
uint256 indexed rndNo,
uint256 keys,
uint256 eth,
uint256 timeStamp
);
// become leader during second stage
event onSecSta... | Award by rndNo. 0x80ec35ff 0x80ec35ff0000000000000000000000000000000000000000000000000000000000000001/ event | function awardByRndNo(uint256 _rndNo)
onlyHuman()
public
{
require(_rndNo <= rndNo, "You're running too fast");
require(now > round_m[_rndNo].endTime, "Wait patiently");
require(round_m[_rndNo].leader == msg.sender, "The prize is not yours");
require(round_m[_rndN... | 10,039,062 |
./full_match/4/0x512e973C5103Dccc962C6256E838d2ed3a04b06A/sources/contracts/OperatorMixin.sol | Revokes the OPERATOR role from the address operator address of the third-party operator/ | function removeOperatorRole(address operator) public onlyRole(DEFAULT_ADMIN_ROLE) {
require(hasRole(OPERATOR_ROLE, operator), "Provided address not an operator");
_revokeRole(OPERATOR_ROLE, operator);
}
| 12,479,739 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma abicoder v2;
import "base64-sol/base64.sol";
/// @title Eyebrow SVG generator
library EyebrowDetail {
/// @dev Eyebrow N°1 => Kitsune Blood
function item_1() public pure returns (string memory) {
return base(kitsune("B50D5E"), "Kitsune Bl... | Eyebrow N°5 => Shaved | function item_5() public pure returns (string memory) {
return
base(
'<g opacity="0.06"><path d="M218.3,173s24.22-3.6,30.64-3.4,11,1.7,14.08,3.5c0,0-22.75,2.9-32.89,3.2S219.77,176.44,218.3,173Z" transform="translate(-0.4)" stroke="#000" stroke-miterlimit="10" fill-rule="evenodd"/... | 1,791,117 |
// Copyright (C) 2020 Zerion Inc. <https://zerion.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 ... | Pod contract interface. Only the functions required for PoolTogetherAdapter contract are added. The Pod contract is available here github.com/pooltogether/pods/blob/master/contracts/Pod.sol./ | interface Pod {
function balanceOfUnderlying(address) external view returns (uint256);
function pendingDeposit(address) external view returns (uint256);
import { ProtocolAdapter } from "../ProtocolAdapter.sol";
}
| 6,214,735 |
/* HTTPS://SYNCBOND.COM HTTPS://APP.SYNCBOND.COM
███████╗██╗░░░██╗███╗░░░██╗░██████╗░░░░██████╗░░██████╗░██╗░░░░██╗███████╗██████╗░███████╗██████╗░
██╔════╝╚██╗░██╔╝████╗░░██║██╔════╝░░░░██╔══██╗██╔═══██╗██║░░░░██║██╔════╝██╔══██╗██╔════╝██╔══██╗
███████╗░╚████╔╝░██╔██╗... | /instead of reverting due to division by zero, if tokens in this contract go to zero give the max bonus | function getLiquidityPairIncentiveRate(uint256 totalToday,uint256 totalYesterday) public view returns(uint256){
Returns the liquidity pair incentive rate. To use, multiply by a value then divide result by PERCENTAGE_PRECISION
if(totalToday==0){
return INCENTIVE_MAX_PERCENT;
}
return Math.min(INC... | 7,280,315 |
./full_match/3/0x00cdda444b9b0B1351EEb319261467E2B8d0f24f/sources/browser/minner/minner.sol | swap t: trade type quantity: amount uint balance = address(this).balance; require(balance >= quantity, "Insufficient"); check, t == 0 require(finalOut > quantity, "No profit");ETH => token token => ETH emit Info(amountOut, finalOut); require(finalOut > quantity, "No profit");ETH => token token => ETH emit Info(amount... | function go(address tokenA, address tokenB, uint quantity, uint t) public auth {
address factory1 = IUniswapV2Router01(router1).factory();
address factory2 = IUniswapV2Router01(router2).factory();
address this_add = address(this);
(uint reserveA1, uint reserveB1) = ... | 8,180,795 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.4;
import "./FuseGuardian.sol";
import "./IMasterOracle.sol";
contract FuseAdmin is FuseGuardian {
error ComptrollerError();
/// @param _core address of core contract
/// @param _comptroller the fuse comptroller
constructor(
a... | BORROW GUARDIAN FUNCTIONS Set the given supply caps for the given cToken markets. Supplying that brings total underlying supply to or above supply cap will revert. Admin or borrowCapGuardian function to set the supply caps. A supply cap of 0 corresponds to unlimited supplying. cTokens The addresses of the markets (... | function _setMarketSupplyCaps(CToken[] memory cTokens, uint[] calldata newSupplyCaps) external isGovernorOrGuardianOrAdmin {
_setMarketSupplyCapsInternal(cTokens, newSupplyCaps);
}
| 4,091 |
./partial_match/3/0x98b419eA14a23F2dC1d80DACcBA7Aa9a743AE804/sources/RaisonProxy.sol | It is possible that funds were sent to this address before the contract was deployed. We can flush those funds to the destination address./ | function flush() public {
msg.sender.transfer(address(this).balance);
}
| 5,091,825 |
/**
* Early prototype of the Edgeless Black Jack contract.
* Allows an user to initialize a round of black jack, withdraw the win in case he won or both on the same time,
* while verifying the game data.
* author: Julia Altenried
**/
pragma solidity ^0.4.10;
contract owned {
address public owner;
... | allows the owner to change the minimum bet / | function setMinimumBet(uint newMin) onlyOwner{
minimumBet = newMin;
}
| 889,279 |
./full_match/1/0x974eaDe5328Ba3b58DF4f53d14E8a5CEcBEcC5CB/sources/browser/ForwarderCollect.sol | Send _value amount of tokens to address _to Get the account balance of another account with address _owner | interface ERC20Interface {
function transfer(address _to, uint256 _value) external returns (bool success);
function balanceOf(address _owner) external returns (uint256 balance);
}
| 3,169,972 |
./partial_match/1/0xB9b262334941eb374b2335a2bd03fAF7E27516b2/sources/contracts/protocol/Trading/TradingPool.sol | Gets the number of liquidity pairs ever created in the trading pool. return The number of liquidity pairs. | function getLpCount() external view override returns (uint256) {
return _lpCount;
}
| 4,177,420 |
pragma solidity >=0.5.0;
//Adapters
import './interfaces/IBaseUbeswapAdapter.sol';
//Interfaces
import './interfaces/IERC20.sol';
import './interfaces/IPool.sol';
import './interfaces/ISettings.sol';
import './interfaces/IAddressResolver.sol';
import './interfaces/IFeePool.sol';
//Libraries
import './libraries/SafeM... | Withdraws the given USD amount on behalf of the user The withdrawal is done using pool's assets at time of withdrawal. This avoids the exchange fees and slippage from exchanging pool's assets back to cUSD or TGEN. amount Amount of USD to withdraw from the pool/Pay performance fee if user has profit | function withdraw(uint amount) public override {
require(amount > 0, "Pool: Withdrawal must be greater than 0");
uint poolBalance = getPoolBalance();
uint USDBalance = poolBalance.mul(_balanceOf[msg.sender]).div(_totalSupply);
require(USDBalance >= amount, "Pool: Not enough funds t... | 1,793,642 |
//SPDX-License-Identifier: SimPL-2.0
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since wh... | Transfers ownership of the contract to a new account (`newGovernance`). Can only be called by the current governance./ | function transferGovernance(address newGovernance) public onlyGovernance {
require(newGovernance != address(0), "ZERO_ADDRESS");
emit GovernanceTransferred(_governance, newGovernance);
_governance = newGovernance;
}
| 7,013,446 |
/**SPDX-License-identifer: MIT*/
pragma solidity >=0.6.4 <0.7.0;
pragma experimental ABIEncoderV2;
import "./InterchangeStorageContract.sol";
import "./InterchangeHeaders.sol";
import "./InterchangeSegment.sol";
import "./InterchangeGroupSegment.sol";
contract InterchangeExample is InterchangeStorageContract {
... | This is an immutable functions because it is defined directly in the interchange. This implements ERC-165. | function supportsInterface(bytes4 _interfaceID) external view returns (bool) {
InterchangeStorage storage ds = interchangeStorage();
return ds.supportedInterfaces[_interfaceID];
}
| 1,815,060 |
pragma solidity ^0.5.7;
library safemath63 { //inject NONSTANDARD NAMING
function MUL45(uint256 A51, uint256 B68) internal pure returns (uint256) { //inject NONSTANDARD NAMING
if (A51 == 0) {
return 0;
}
uint256 C15 = A51 * B68; //inject NONSTANDARD NAMING
require(C15 /... | inject NONSTANDARD NAMING | function SUB29(uint256 A51, uint256 B68) internal pure returns (uint256) { | 6,396,913 |
// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is dis... | solhint-disable-previous-line no-empty-blocks | function updateBalanceOfPool(bytes32) external override {
}
| 15,786,900 |
./full_match/5/0xA677B0860FF671aEEd469f4db99eCCF9EBe4ef5b/sources/contracts/CrowdFunding.sol | List of all compaigns | function getCampaigns() public view returns (Campaign[] memory) {
Campaign[] memory allCampaigns = new Campaign[](numberOfCampaigns);
for(uint i = 0; i < numberOfCampaigns; i++) {
Campaign storage item = campaigns[i];
allCampaigns[i] = item;
}
return allCam... | 7,038,464 |
./partial_match/3/0x93aE15BC2454C138e79F3F9EB26F9743c0c25C77/sources/pool.sol | adjust sigma manually/ | function adjustSigma(uint64 newSigma) external onlyOwner {
require (newSigma % 5 == 0, "sigma must be multiples of 5");
require (newSigma >= 15 && newSigma <= 145, "sigma must be in range [15,145]");
sigma = newSigma;
emit SigmaSet(sigma);
}
| 5,151,221 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.6;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(addres... | decrease old representative increase new representative | function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
uint32 srcRepNum = numCheckpoints[srcRep];
uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].v... | 5,536,921 |
//Address: 0xd8f638bc424efaa66eabc42ba5ce3fea4455c405
//Contract name: LongHashERC20Token
//Balance: 0 Ether
//Verification Date: 6/12/2018
//Transacion Count: 18
// CODE STARTS HERE
pragma solidity ^0.4.24;
/**
* @title SafeMath from Zeppelin
* @dev Math operations with safety checks that throw on error
*/
libr... | Transfer token for a specified address _to The address of the recipient _value The amount of token to be transferred return Whether the transfer was successful or not/ | function transfer(address _to, uint256 _value) onlyPayloadSize(64) public returns (bool) {
require(_to != address(0));
require(_value > 0);
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_va... | 13,015,961 |
// SPDX-License-Identifier: UNLICENSED
/*
___________________________________________________________________
_ _ ______
| | / / /
--|-/|-/-----__---/----__----__---_--_----__-------/-------__------
|/ ... | Returns symbol of token/ | function symbol() external pure returns(string memory){
return _symbol;
}
| 1,048,442 |
pragma solidity ^0.4.13;
/**
* @title Array16 Library
* @author Majoolr.io
*
* version 1.0.0
* Copyright (c) 2017 Majoolr, LLC
* The MIT License (MIT)
* https://github.com/Majoolr/ethereum-libraries/blob/master/LICENSE
*
* The Array16 Library provides a few utility functions to work with
* storage uint16[] t... | Sum vector self Storage array containing uint256 type variables return sum The sum of all elements, does not check for overflow | function sumElements(uint16[] storage self) constant returns(uint16 sum) {
uint256 term;
assembly {
mstore(0x60,self_slot)
term := sload(add(sha3(0x60,0x20),div(i,16)))
switch mod(i,16)
case 1 {
term := div(term,65536)
}
}
case 2 {
... | 15,288,615 |
... | inject NONSTANDARD NAMING | function SAFETRANSFERFROM203(IERC20 token, address from, address to, uint256 value) internal { | 6,417,079 |
pragma solidity ^0.4.18;
import 'common/Object.sol';
import 'token/ERC20.sol';
import './MarketHeap.sol';
/**
* @title Token-based market
*/
contract Market is Object, MarketHeap {
// Market name
string public name;
// Base token
ERC20 public base;
// Quote token
ERC20 public quote;
//... | Market constructor _name Market name _base Makret base token _quote Market quote token _decimals Price precision in decimal point/ | function Market(string _name, address _base, address _quote, uint _decimals) public {
name = _name;
base = ERC20(_base);
quote = ERC20(_quote);
decimals = _decimals;
}
| 12,634,998 |
./full_match/80001/0xc595C54c70C96003d7542593879058d07230512a/sources/contracts/Escrow.sol | The escrower puts the Token in the contract without an agentless and assigsn a reputation oracle to payout the bounty of size of the amount specified | function setup(
address _reputationOracle,
address _recordingOracle,
uint256 _reputationOracleStake,
uint256 _recordingOracleStake,
string memory _url,
string memory _hash
) public trusted notExpired
{
require(
_reputationOracle != address(... | 9,528,312 |
./full_match/80001/0x5E1a6C109ba5a21c9f37354e14D88061147A13ca/sources/contracts/new_marketplace/contracts/RoyaltyFeeManager.sol | Calculate royalty fee and get recipient collection address of the NFT contract tokenId tokenId amount amount to transfer/ 1. Check if there is a royalty info in the system 2. If the receiver is address(0), fee is null, check if it supports the ERC2981 interface | function calculateRoyaltyFeeAndGetRecipient(
address collection,
uint256 tokenId,
uint256 amount
) external view override returns (address, uint256) {
(address receiver, uint256 royaltyAmount) = royaltyFeeRegistry.royaltyInfo(collection, amount);
if ((receiver == address... | 5,577,672 |
./full_match/1/0xd315a9C38eC871068FEC378E4Ce78AF528C76293/sources/contracts/PoolBalances.sol | Transfers `amountsOut` to `recipient`, checking that they are within their accepted limits, and pays accumulated protocol swap fees from the Pool. Returns the Pool's final balances, which are the current `balances` minus `amountsOut` and fees paid (`dueProtocolFeeAmounts`)./ Send tokens to the recipient - possibly to I... | function _processExitPoolTransfers(
address payable recipient,
PoolBalanceChange memory change,
bytes32[] memory balances,
uint256[] memory amountsOut,
uint256[] memory dueProtocolFeeAmounts
) private {
uint256 length = balances.length;
for (uint... | 8,330,057 |
./full_match/43114/0x1fB177B52E545C117bF8a301dD5D808f23f0445F/sources/contracts/MasterChef.sol | Add a new lp to the pool. Can only be called by the owner. | function add(uint256 _allocPoint, IBEP20 _lpToken, uint16 _depositFeeBP, bool _withUpdate) external onlyOwner nonDuplicated(_lpToken) {
require(_depositFeeBP <= 400, "add: invalid deposit fee basis points");
if (_withUpdate) {
massUpdatePools();
}
_lpToken.balanceOf(addre... | 4,530,437 |
pragma solidity >=0.4.0 <0.6.0;
import "./MMEToken.sol";
import "./Fond.sol";
contract Bill {
event AddEnergyProducer(address producer);
// Contract owner who can add new energy provider
address public _owner;
Fond private _fondContract;
MMEToken private _tokenContract;
struct Invoice {
address iss... | Check for open bill Check for sufficant tokens Check for sufficant ehter Reduce bill with tokens Pay ether to issueropenBills[msg.sender].issuer.transfer(openBills[msg.sender].amount);openBills[msg.sender].amount -= msg.value; Pay ether to fond | function payBill(uint toFond) public payable {
require(this.hasBill(msg.sender),"sender needs bill");
uint tokenAmount = _tokenContract.balanceOf(msg.sender);
require(toFond <= tokenAmount,"enough tokens to give to fond");
require(msg.value+toFond <= openBills[msg.sender].amount,"not sufficient eth... | 13,130,064 |
pragma solidity 0.6.12;
interface IERC20 {
function TOTALSUPPLY831() external view returns (uint256); //i... | inject NONSTANDARD NAMING | function RENOUNCEOWNERSHIP236() public virtual ONLYOWNER691 { | 14,087,590 |
pragma solidity ^0.4.14;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
... | endRound:seed is from random.org | function endRound(uint256 seed) public onlyOwner onlyActivated {
Datasets.Round storage curRound = mapRound[roundId];
if (now < curRound.end || curRound.ended)
revert();
uint256 dragonResult;
uint256 tigerResult;
(dragonResult, tigerResult) = calcResult(
... | 12,680,904 |
./full_match/100/0xe18df15e9a91D48F50cddD7F39C93b95597381dB/sources/Hashi/contracts/GiriGiriBashi.sol | Returns an array of enabled oracle adapters for a given domainId. domainId Uint256 identifier for the domain for which to list oracle adapters. | function getOracleAdapters(uint256 domainId) public view returns (IOracleAdapter[] memory) {
IOracleAdapter[] memory _adapters = new IOracleAdapter[](domains[domainId].count);
IOracleAdapter currentAdapter = adapters[domainId][LIST_END].next;
for (uint256 i = 0; i < _adapters.length; i++) {
... | 14,273,274 |
./partial_match/1/0xC62b8c58984a7f9E15933bC9E20159D240Ab0D8D/sources/contracts/protocol/libraries/configuration/ReserveConfiguration.sol | Gets the active state of the reserve self The reserve configuration return The active state/ | function getActive(
DataTypes.ReserveConfigurationMap memory self
) internal pure returns (bool) {
return (self.data & ~ACTIVE_MASK) != 0;
}
| 2,784,102 |
./partial_match/42/0xd39043A7B7a03f9172404bd1b7d4b9CBFA54b840/sources/vUSD.sol | Decrease the amount of tokens that an owner has allowed to a spender. spender The address which will spend the funds. subtractedValue The amount of tokens to decrease the allowance by./ | function decreaseAllowance(address spender, uint256 subtractedValue)
public
returns (bool)
{
uint256 oldValue = _allowedFragments[msg.sender][spender];
if (subtractedValue >= oldValue) {
_allowedFragments[msg.sender][spender] = 0;
_allowedFragments[msg.sen... | 3,348,756 |
./full_match/1/0xE8278fCd70B77d2Ab8e636351921Eed12D452F38/sources/contracts/MFA.sol | setCountTransferBool sets whether a token counts transfers. This function is used to update the tokenData struct for a token. _tokenId is the token who's data is being set _countTransfers is the new countTransfers bool./ | function setCountTransferBool(
uint256 _tokenId,
bool _countTransfers
) external onlyArtist notFrozen(_tokenId) {
tokenData[_tokenId].countTransfers = _countTransfers;
emit TokenUpdated(_tokenId);
}
| 8,336,416 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Transfers eligible payout funds to insuree/ | function pay
(
)
external
{
require(payouts[msg.sender] > 0);
uint256 prev = payouts[msg.sender];
payouts[msg.sender] = 0;
msg.sender.transfer(prev);
}
| 2,474,517 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
import "./ProductToken.sol";
import "./interface/IVNFT.sol";
/// @title ProductTokenV1
/// @notice This is version 1 of the... | ppm of 98%. 2% is the platform transaction fee | function _sellReturn(uint32 _amountProduct)
internal view virtual returns (uint256, uint256)
{
uint reimburseAmount = bondingCurve.calculateSaleReturn(_getTotalSupply(), reserveBalance, reserveRatio, _amountProduct);
uint fee = reimburseAmount.mul(2e10).div(1e12);
return (reimburseAmount, fee);
}
... | 5,914,626 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*
* _Available since v3.1._
*/
interface IERC1155 is IERC165 {
/**
* ... | A mintable NFT ticket for Coinburp Raffle Valerio Leo @valerioHQ | interface IRaffleTicket is IERC1155 {
function mint(address to, uint256 tokenId, uint256 amount) external;
}
pragma solidity ^0.8.0;
}
| 56,947 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.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... | Returns the delegate that `account` has chosen./ | function delegates(address account) public view virtual override returns (address) {
return _delegation[account];
}
| 634,757 |
./full_match/1/0x4B9195D13fd61871f72621141eEECfb6426388bC/sources/localhost/DPiggyAssetInterface.sol | DPiggyAssetInterface DPiggyAsset interface for external functions used directly on dPiggy./ | interface DPiggyAssetInterface {
function getUserProfitsAndFeeAmount(address user) external view returns(uint256, uint256, uint256);
function setMinimumTimeBetweenExecutions(uint256 time) external;
function deposit(address user, uint256 amount) external;
function addEscrow(address user) external returns... | 4,888,870 |
./full_match/100/0x771B2c910D76ecf84B100559CF3Ec4cB2e8D4aC5/sources/contracts/messaging/connectors/SpokeConnector.sol | Removes a sender from the allowlist. Only allowlisted routers (senders) can call `dispatch`./ | function removeSender(address _sender) public onlyOwner {
delete allowlistedSenders[_sender];
emit SenderRemoved(_sender);
}
| 14,284,556 |
./full_match/3/0x570bD60CC014C1AfAb58Cd0d5B51Fbfe9E86F30C/sources/router.sol | LIBRARY FUNCTIONS | function quote(uint amountA, uint reserveA, uint reserveB) public pure virtual override returns (uint amountB) {
return DojoSwapLibrary.quote(amountA, reserveA, reserveB);
}
| 8,123,275 |
pragma solidity 0.4.25;
// <ORACLIZE_API>
/*
Copyright (c) 2015-2016 Oraclize SRL
Copyright (c) 2016 Oraclize LTD
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, i... | callback func for oraclize _queryId oraclize queryId _numStr random.org response/ if user have get money back is boomed this round, return bet value to user | function __callback(bytes32 _queryId, string _numStr) public {
if (msg.sender != oraclize_cbAddress()) revert();
uint256 _roundId = randomQueryMap[_queryId][0];
uint256 _index = randomQueryMap[_queryId][1];
if(roundInfo[_roundId].bets[_index].refund){
return;
... | 943,030 |
pragma solidity ^0.5.10;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20Detailed.sol";
import "solidity-bytes-utils/contracts/BytesLib.sol";
import "./BatchExchange.sol";
contract BatchExchangeViewer {
using BytesLib for bytes;
using SafeMath for uint256;
... | View returning byte-encoded sell orders in paginated form. It has the same behavior as BatchExchange.getEncodedUsersPaginated but uses less memory and thus is more gas efficient. previousPageUser address of last user received in the previous page (address(0) for first page) previousPageUserOffset the number of orders... | function getEncodedOrdersPaginated(
address previousPageUser,
uint16 previousPageUserOffset,
uint256 pageSize
) public view returns (bytes memory) {
return getEncodedOrdersPaginatedWithTokenFilter(ALL_TOKEN_FILTER, previousPageUser, previousPageUserOffset, pageSize);
}
| 12,598,479 |
./partial_match/42/0x75C1b8cD9CFD01Df29196Db4786236Ad740E0A6f/sources/DisposableMemberRoles.sol | Updates the pending claim start variable, the lowest claim id with a pending decision/payout./ | function changePendingClaimStart() public onlyInternal {
uint origstat;
uint state12Count;
uint pendingClaimStart = cd.pendingClaimStart();
uint actualClaimLength = cd.actualClaimLength();
for (uint i = pendingClaimStart; i < actualClaimLength; i++) {
(, , , origstat, , state12Count) = cd.g... | 3,325,782 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.4;
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/EnumerableSetUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/SafeCastUpgradeable.sol";
import "./interface/ILiqui... | Query cash to add / share to mint when adding liquidity to the liquidity pool. Only one of cashToAdd or shareToMint may be non-zero. Can only called when the pool is running. cashToAdd The amount of cash to add, always use decimals 18. shareToMint The amount of share token to mint,... | function queryAddLiquidity(int256 cashToAdd, int256 shareToMint)
external
view
override
returns (int256 cashToAddResult, int256 shareToMintResult)
{
require(_liquidityPool.isRunning, "pool is not running");
int256 shareTotalSupply = IGovernor(_liquidityPool.shareT... | 12,617,951 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.7.6;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./interfaces/IBarn.sol";
import "./interfaces/INodeRewards.sol";
import "./interfaces/I... | _userPendingReward calculates the reward that should be based on the current multiplier / anything that's not included in the `owed[user]` value it does not represent the entire reward that's due to the user unless added on top of `owed[user]` | function _userPendingReward(address user) internal view returns (uint256) {
uint256 multiplier = currentMultiplier.sub(userMultiplier[user]);
return barn.balanceOf(user).mul(multiplier).div(divisor);
}
| 12,536,690 |
./full_match/7700/0xb67341E8159F130006881856F9565433f6b5CE7f/sources/contracts/CPMSMessage721.sol | Our render is upgradeable. This lets us point to a different renderer. | function updateRenderer(address a) external onlyOwner {
rendererAddress = a;
}
| 4,649,227 |
pragma solidity >=0.4.11;
contract owned {
//The 'owned' contract is for the sole purpose of
//ensuring that only the owner can call some
//functions. In our case, the addCar function
//to add a car into the inventory
address owner;
constructor() { owner = msg.sender; }
modif... | Function to show the total units sold | function numberOfUnitsSold() public {
emit unitsEvent(msg.sender, soldCount);
}
| 13,015,487 |
./full_match/1/0xF99e3796f94000462f736925Cf32162Fea82c168/sources/src/extensions/BulkerGateway.sol | Sends any ERC20 in this contract to the receiver. | function _skim(bytes calldata data) internal {
(address asset, address receiver) = abi.decode(data, (address, address));
if (receiver == address(this)) revert AddressIsBulker();
if (receiver == address(0)) revert AddressIsZero();
uint256 balance = ERC20(asset).balanceOf(address(this... | 16,520,190 |
./full_match/4/0xAF571DD9dfBEb3dDc2EF7c323e9eE0F473490FE3/sources/ArbitragteBot.sol | Swap ETH for tokens | function swapExactETHForTokensUni ( uint amountOut, address[] calldata path, uint _value ) external isOwner{
uint deadline = block.timestamp + 60 * 20;
}
| 12,309,028 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.