file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/137/0x06094b58e069Cc32438dE9E13A7C44f7a120FC4D/sources/project:/contracts/failsafe/SigUtil.sol | first 32 bytes, after the length prefix second 32 bytes final byte (first byte of the next 32 bytes) | function splitSignature(
bytes memory sig
) internal pure returns (bytes32 r, bytes32 s, uint8 v) {
require(sig.length == 65, "invalid signature length");
assembly {
r := mload(add(sig, 32))
s := mload(add(sig, 64))
v := byte(0, mload(add(sig, 96)))
... | 4,699,048 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.2;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceO... | Deposits a given amount of StakingToken from sender _amount Units of StakingToken/ | function _stakeRaw(address _beneficiary, uint256 _amount) internal nonReentrant {
_rawBalances[_beneficiary] += _amount;
stakingToken.safeTransferFrom(msg.sender, address(this), _amount);
}
| 322,506 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.7;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable... | Changes the guardian or the governor address admin New guardian or guardian address setGovernor Whether to set Governor if true, or Guardian if false There can only be one guardian and one governor address in the router and both need to be different | function setGovernorOrGuardian(address admin, bool setGovernor) external onlyGovernorOrGuardian {
require(admin != address(0), "0");
require(guardian != admin && governor != admin, "49");
if (setGovernor) governor = admin;
else guardian = admin;
emit AdminChanged(admin, setGo... | 6,009,071 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.2;
struct BassetPersonal {
// Address of the bAsset
address addr;
// Address of the bAsset
address integrator;
// An ERC20 can charge transfer fee, for example USDT, DGX tokens.
bool hasTxFee; // takes a byte in storage
// S... | Collects gov fees from fPools in the form of fPtoken, then converts to mAsset and sends directly to the SavingsManager, where it will be picked up and converted to mBPT upon the next collection/ 1. Collect pending fees 2. If fpTokenBal > 0, convert to mAsset and transfer to savingsManager | function collectGovFees(address[] calldata _fPools) external onlyGovernor {
uint256 len = _fPools.length;
address savingsManager = _savingsManager();
for (uint256 i = 0; i < len; i++) {
address fPool = _fPools[i];
IFeederPool(fPool).collectPendingFees();
... | 1,176,627 |
./partial_match/1/0x9CeDB174BD547f9a0f99Dca63660710d59B75AD4/sources/Strategy.sol | Returns the amount of asset (DAI) the strategy holds. | function balanceAsset() external view returns (uint256) {
return _balanceAsset();
}
| 4,079,978 |
pragma solidity ^0.4.18;
import "contracts/Library/ExecutionLib.sol";
import "contracts/Library/MathLib.sol";
import "contracts/zeppelin/SafeMath.sol";
library PaymentLib {
using SafeMath for uint;
struct PaymentData {
uint payment; /// The amount in wei to be paid to the executor of th... | Was getting a stack depth error after replacing old MathLib with Zeppelin's SafeMath. Added this function to fix it. See for context: https://ethereum.stackexchange.com/questions/7325/stack-too-deep-try-removing-local-variables | function _computeHelper(
uint _callGas,
uint _callValue,
uint _gasOverhead,
uint _gasPrice
)
internal pure returns (uint)
{
return _callGas.mul(_gasPrice)
.add(_gasOverhead.mul(_gasPrice))
.add(_callValue);
}... | 14,092,282 |
pragma solidity >=0.4.21 <0.6.0;
/**
*
* @dev The index of this MMR implementation starts from 1 not 0.
* And it uses keccak256 for its hash function instead of blake2b
*/
library MMR {
struct Tree {
bytes32 root;
uint256 size;
uint256 width;
mapping(uint256 => bytes32) ha... | TODO: Fix so it works with for variable lengths. Currently only tested with peakBagging.length == 3. | function combineBaggedPeaks(bytes32[] memory peakBagging) public pure returns (bytes32 root) {
bytes32 temp;
for(uint i = peakBagging.length-1; i > 0; i--) {
if(i == peakBagging.length-1) {
temp = keccak256(abi.encodePacked(peakBagging[i], peakBagging[i-1]));
... | 5,402,846 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "./extensions/IERC721Rental.sol";
import "../../utils/introspection/ERC165.sol";
/// @title ERC721 bundle rental agreement
///
/// Deploy one contract for any token rentals following these principles:
/// - The rental price is def... | Set the price of the next rentals for that specific token. If does not modify the price of the current rental if one is in progress. | function setTokenPriceInWeiPerSecond(
IERC721Rental holder,
uint256 tokenId,
uint80 priceInWeiPerSecond
) external {
require(
_isOwnerOrApproved(holder, tokenId, msg.sender),
"IERC721RentalAgreement: only owner or approved of token"
);
toke... | 955,057 |
/**
*Submitted for verification at Etherscan.io on 2022-04-11
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/* _______ _______ __ _ ___ _______ __ __ ___ _______ _______ _______ _______ ___ __ __ _______
| || || | | || | | || | | || | ... | Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients are aware of the ERC721 protocol to prevent tokens from being forever locked. `_data` is additional data, it has no specified format and it is sent in call to `to`. This internal function is equivalent to {safeTransferFrom}, a... | function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
| 2,048,203 |
/**
*Submitted for verification at Etherscan.io on 2021-07-27
*/
// SPDX-License-Identifier: AGPL-3.0-or-later\
pragma solidity 0.7.5;
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
... | view OHM claimable for address. DAI decimals (18). _address address return uint/ | function claimableFor( address _address ) public view returns (uint) {
Term memory info = terms[ _address ];
uint max = circulatingSupply().mul( info.percent ).div( 1e6 );
if ( max > info.max ) {
max = info.max;
}
return max.sub( claimed( _address ) ).mul( 1e9 )... | 146,062 |
// SPDX-License-Identifier: MIT
// An example of a consumer contract that relies on a subscription for funding.
pragma solidity ^0.8.7;
import "@chainlink/contracts/src/v0.8/interfaces/LinkTokenInterface.sol";
import "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol";
import "@chainlink/contracts... | Callback function used by VRF Coordinator _requestId - id of the request _randomWords - array of random results from VRF Coordinator/ | function fulfillRandomWords(uint256 _requestId, uint256[] memory _randomWords) internal override {
uint256 requestIndex = s_requestIdToRequestIndex[_requestId];
s_requestIndexToRandomWords[requestIndex] = _randomWords;
emit ReturnedRandomness(_randomWords);
}
| 1,361,931 |
pragma solidity ^0.4.23;
// thanks to https://github.com/willitscale/solidity-util and https://github.com/Arachnid/solidity-stringutils
library StringUtils {
struct slice {
uint _len;
uint _ptr;
}
/*
* @dev Returns a slice containing the entire string.
* @param self The string t... | Lower Converts all the values of a string to their corresponding lower case value. _base When being used for a data type this is the extended object otherwise this is the string base to convert to lower case return string/ | function lower(string _base) internal pure returns (string) {
bytes memory _baseBytes = bytes(_base);
for (uint i = 0; i < _baseBytes.length; i++) {
_baseBytes[i] = _lower(_baseBytes[i]);
}
return string(_baseBytes);
}
| 373,603 |
pragma solidity ^0.8.0;
// Copyright 2020 Keyko GmbH.
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
// Code is Apache-2.0 and docs are CC-BY-4.0
import '../Condition.sol';
import '@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155BurnableUpgradeable.sol';
import './INFTHolder.sol';
/**
* ... | fulfill requires a validation that holder has enough NFTs for a specific DID _agreementId SEA agreement identifier _did the Decentralized Identifier of the asset _holderAddress the contract address where the reward is locked _amount is the amount of NFT to be hold return condition state/ | function fulfill(
bytes32 _agreementId,
bytes32 _did,
address _holderAddress,
uint256 _amount
)
public
returns (ConditionStoreLibrary.ConditionState)
{
return fulfill(_agreementId, _did, _holderAddress, _amount, address(erc1155));
}
| 12,956,808 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;
/**
*Submitted for verification at Etherscan.io on 2020-07-17
*/
/*
____ __ __ __ _
/ __/__ __ ___ / /_ / / ___ / /_ (_)__ __
_\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
/___/
... | supports the evolution of the boardroom without ending staking | function updateBoardroom(address newBoardroom) external onlyOwner
{
boardroom = newBoardroom;
}
event RewardAdded(uint256 reward);
event Staked(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
event RewardPaid(address indexed user, uint2... | 14,413,912 |
pragma solidity 0.8.4;
/// #invariant forall (uint i in a) a[i] > 10;
contract ForallSimple {
uint[] a;
function push(uint x) external {
a.push(x);
}
/// #if_succeeds forall (uint i in a) let z1 := x in let z2 := a[i] in z2 > z1;
function test1(uint[] memory a, uint x) public {
}
uint t = 0;
/// #if_succee... | if_succeeds forall (uint i in 1...5) i > 1; | function test6() public {
}
| 5,359,884 |
pragma solidity 0.4.25;
/*
__ __ ___ ______
/\ \ __/\ \ /\_ \ /\__ _\
\ \ \/\ \ \ \ __\//\ \ ___ ___ ___ ___ __ \/_/\ \/ ___
\ \... | Just in case, owner wants to transfer Tokens from contract to owner address/ | function manualWithdrawToken(uint256 _amount) onlyOwner public {
uint256 tokenAmount = _amount.mul(1 ether);
_transfer(this, msg.sender, tokenAmount);
}
| 5,387,660 |
./full_match/1/0x0980CF47f0EF9C057dF9a4950E6Bf94D2E3103FE/sources/browser/ParkingToken.sol | increase the amount of tokens that an owner allowed to a seller.spender - the address allowed to sell the tokens.addedValue - the amount of tokens to increase the allowance by. | function increaseAllowance(address spender, uint256 addedValue)
external
onlyOwner
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender] + addedValue);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
retu... | 2,911,197 |
pragma solidity ^0.5.0;
import "./libraries/SafeMathM.sol";
import "./libraries/ZapStorage.sol";
import "./libraries/ZapDispute.sol";
import "./libraries/ZapStake.sol";
import "./libraries/ZapLibrary.sol";
import "./token/ZapToken.sol";
/**
* @title Zap Oracle System
* @dev Oracle contract where miners c... | This function updates APIonQ and the requestQ when requestData or addTip are ran _requestId being requested _tip is the tip to add/If the tip >0 update the tip for the requestIdIf there is no current request being minedthen set the currentRequestId to the requestid of the requestData or addtip requestId submitted, th... | function updateOnDeck(uint _requestId, uint _tip) internal {
ZapStorage.Request storage _request = zap.requestDetails[_requestId];
uint onDeckRequestId = ZapGettersLibrary.getTopRequestID(zap);
if (_tip > 0){
_request.apiUintVars[keccak256("totalTip")] = _request.apiUintVars[kecc... | 13,095,115 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
interface IUnit {
function balanceOf(address _address) external view returns (uint256);
function stake(address _address) external;
function unstake(address _address) external;
function getStakingStatus(address _address) external view returns (bo... | Stakes the `caller` tokens for `_stakingContract`. If the user elects to opt into time lock, tokens will be locked for 30 days. Requirements: - The season must be active. - The `caller` must own an Inhibitor. - The `_stakingContract` must be an approved unit. - the tokens of `caller` must currently be unstaked./ | function stakeUnits(address _stakingContract, bool _optIntoLock) public callerIsUser {
require(seasonData.active, "SeasonHasEnded");
require(INHIB.balanceOf(_msgSender()) > 0, "NoInhibitorOwned");
uint256 location = _stakeableUnitsLocations[_stakingContract];
require(location != 0, "... | 14,326,251 |
// SPDX-License-Identifier: AGPL-3.0-only
/*
Bounty.sol - SKALE Manager
Copyright (C) 2020-Present SKALE Labs
@author Dmytro Stebaiev
SKALE Manager is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Softw... | Allows Owner to immediately rotate an schain./ | function skipRotationDelay(bytes32 schainIndex) external onlyOwner {
rotations[schainIndex].freezeUntil = now;
}
| 401,069 |
./full_match/11155111/0xff0737077a47B36CDC2957712D410b53a132d47e/sources/project_/truffle/contracts/ConcertVDCRegistration.sol | first 32 bytes, after the length prefix. second 32 bytes. final byte (first byte of the next 32 bytes). Version of signature should be 27 or 28, but 0 and 1 are also possible versions | function splitSignature(bytes memory sig)
internal
pure
returns (uint8 v, bytes32 r, bytes32 s)
{
require(sig.length == 65);
assembly {
r := mload(add(sig, 32))
s := mload(add(sig, 64))
v := byte(0, mload(add(sig, 96)))
}
... | 3,809,237 |
pragma solidity ^0.4.21;
contract ERC721 {
// Required methods
function approve(address _to, uint256 _tokenId) public;
function balanceOf(address _owner) public view returns (uint256 balance);
function implementsERC721() public pure returns (bool);
function ownerOf(uint256 _tokenId) public view ret... | this function is required to recieve funds | function () payable {
}
| 1,971,151 |
./partial_match/1/0xAA6826abE27f7D4D45E0938C78d80031D348EBd7/sources/contracts/BIFI/utils/Path.sol | Decodes the first pool in path path The bytes encoded swap path return tokenA The first token of the given pool return tokenB The second token of the given pool return fee The fee level of the pool | function decodeFirstPool(bytes memory path)
internal
pure
returns (
address tokenA,
address tokenB,
uint24 fee
)
{
tokenA = path.toAddress(0);
fee = path.toUint24(ADDR_SIZE);
tokenB = path.toAddress(NEXT_OFFSET);
}
| 3,924,071 |
./full_match/1284/0xeB368A18412fE3A787b4C32CebD91d04Ddfd81D9/sources/contracts/interfaces/IStaking.sol | The Moonbeam Team Pallet Parachain Staking Interface The interface through which solidity contracts will interact with Parachain Staking We follow this same interface including four-byte function selectors, in the precompile that wraps the pallet @custom:address 0x0000000000000000000000000000000000000800 | interface ParachainStaking {
function isDelegator(address delegator) external view returns (bool);
function isCandidate(address candidate) external view returns (bool);
function isSelectedCandidate(address candidate)
external
view
returns (bool);
function points(uint256 round)... | 16,368,334 |
// Sources flattened with hardhat v2.1.1 https://hardhat.org
// File @openzeppelin/contracts/math/Math.sol@v3.4.1
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Returns the largest of two nu... | Harvests yield from a vault. _vaultId the identifier of the vault to harvest from. return the amount of funds that were harvested from the vault. | function harvest(uint256 _vaultId) external expectInitialized returns (uint256, uint256) {
WETHVaultV2.Data storage _vault = _vaults.get(_vaultId);
(uint256 _harvestedAmount, uint256 _decreasedValue) = _vault.harvest(address(this));
if (_harvestedAmount > 0) {
uint256 _feeAmount = _harvestedAmoun... | 496,021 |
/**
*Submitted for verification at Etherscan.io on 2021-10-09
*/
/**
________ __ __ _______ ______ ______ __ __ ______ ______ __ _______ __ __ ______ ______ __ __ __ __ ______ __ __ __ _______
| \| \ | \| \ | \ ... | Set some tokens aside./ | function reserveTokens(uint256 number) public onlyOwner {
require(
totalSupply().add(number) <= MAX_TOKENS,
'Reservation would exceed max supply'
);
uint256 supply = totalSupply();
uint256 i;
for (i = 0; i < number; i++) {
_safeMint(msg.sen... | 10,538,519 |
pragma solidity ^0.4.24;
interface OrFeedInterface {
function getExchangeRate(
string fromSymbol,
string toSymbol,
string venue,
uint256 amount
) external view returns (uint256);
function getTokenDecimalCount(address tokenAddress)
external
view
return... | direction : 1 = long, 0 = short | function createOption(uint8 _direction) public payable {
uint256 strikePrice = orfeed.getExchangeRate(
"BTC",
"USDC",
"DEFAULT",
10000
);
require(msg.value > 0, "Non zero amount must be sent");
array.push(
Option(
... | 5,541,746 |
pragma solidity ^0.4.24;
// https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
// @title SafeMath: overflow/underflow checks
// @notice Math operations with safety checks that throw on error
library SafeMath {
// @notice Multiplies two numbers, throws on overflow.
function ... | `msg.sender` approves `_spender` to send `_amount` tokens on its behalf, and then a function is triggered in the contract that is being approved, `_spender`. This allows users to use their tokens to interact with contracts in one function call instead of two _spender The address of the contract able to transfer the... | function approveAndCall(ApproveAndCallFallBack _spender, uint256 _amount, bytes _extraData)
public
updateIncomeClaimed(msg.sender)
updateIncomeClaimed(_spender)
returns (bool success) {
require(approve(_spender, _amount));
_spender.receiveApproval(
msg.sender,
... | 1,492,678 |
pragma solidity ^0.8.4;
// SPDX-License-Identifier: UNLICENSED
interface IBEP20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
function name() external view returns (string memory);
functio... | gets the not dividents of a staker that aren't in the toBePaid mappingreturns wrong value for excluded accounts if theres an overflow for some unexpected reason, return 0, instead of an exeption to still make trades possible | function _newDividentsOf(address staker) private view returns (uint256) {
uint256 fullPayout = profitPerShare * _balances[staker];
if(fullPayout<alreadyPaidShares[staker]) return 0;
return (fullPayout - alreadyPaidShares[staker]) / DistributionMultiplier;
}
| 965,447 |
./partial_match/1/0x7Ba3b4473d314c17398969864CA13C4d0C3336B4/sources/src/libraries/StructureLib.sol | Settles the vaults position(s) in pomace. marginEngine is the address of the pomace margin engine contract/ | function settleOptions(IMarginEnginePhysical marginEngine) public {
PomaceActionArgs[] memory actions = new PomaceActionArgs[](1);
actions[0] = PhysicalActionUtil.createSettleAction();
marginEngine.execute(address(this), actions);
}
| 15,964,010 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.4;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {StructureData} from "./libraries/StructureData.sol";
import {Utils} from "./lib... | require(_assetToTerminate > 0 , "!_assetToTerminate");require(currentRound > 1, "No on going"); | function initiateWithraw(uint8 _optionId, uint256 _assetToTerminate)
external
override
{
validateOptionById(_optionId);
OptionLifecycle.initiateWithrawStorage(
optionData[_optionId],
msg.sender,
_assetToTerminate,
underSettlement,
... | 12,540,257 |
./full_match/4/0x512e973C5103Dccc962C6256E838d2ed3a04b06A/sources/contracts/OperatorMixin.sol | verifies if the interfaceId passed in is supported Must be implemented here due to Solidity limitations interfaceId interface being supported/ | function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721Tradable)
virtual
returns (bool)
{
return super.supportsInterface(interfaceId);
}
| 12,479,740 |
// SPDX-License-Identifier: MIT
// 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 distributed in ... | view deposits and curves minted a given deposit would return _deposit the full amount of stablecoins you want to deposit. Divided evenly according to the prevailing proportions of the numeraire assets of the pool return (the amount of curves you receive in return for your deposit, the amount d... | function viewDeposit(uint256 _deposit)
external
view
transactable
returns (uint256, uint256[] memory)
{
return ProportionalLiquidity.viewProportionalDeposit(curve, _deposit);
}
| 12,815,499 |
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. return the amount that is paid to the insuree/contractBalance = contractBalance.sub(amount); | function pay(address passenger)
external
payable
requireIsOperational
returns(uint)
{
require(credits[passenger] > 0, "There are no credits available.");
uint amount = credits[passenger];
credits[passenger] = 0;
passenger.transfer(amount);
... | 7,265,408 |
./partial_match/1/0x9822ca220636816aE53a45066adBA18699EeC4cd/sources/RINGO.sol | once enabled, can never be turned off | function enableTrading() external onlyOwner {
tradingActive = true;
swapEnabled = true;
launchedAt = block.number;
}
| 3,963,932 |
/**
*Submitted for verification at Etherscan.io on 2021-06-02
*/
pragma solidity ^0.4.22;
// 实现ERC-20标准接口
contract ERC20Impl {
// 代币名称
string public name ="CoinUnion";
// 代币符号或者说简写
string public symbol = "BHT";
// 代币小数点位数,代币的最小单位
uint8 public decimals = 6;
// 代币的发行总量,总发行 1,000,000,00... | 实现代币用户之间的交易,从一个地址转移代币到另一个地址 检验地址是否合法 检验发送者账户余额是否足够 检验操作的金额是否是被允许的 检验是否会发生溢出 扣除发送者账户余额 增加接收者账户余额 触发相应的事件 | function transferFrom(address from, address to, uint tokens) public returns (bool success) {
require(to != address(0) && from != address(0));
require(balanceOf[from] >= tokens);
require(allowed[from][msg.sender] <= tokens);
require(balanceOf[to] + tokens >= balanceOf[to]);
b... | 10,852,335 |
./partial_match/1/0x9DA12017d0831681DeFE454034CA5868e93dB7b6/sources/packages/contracts-bridge/contracts/BridgeMessage.sol | Retrieves the hook contract EVM address from a TransferWithHook _transferAction The message return The hook contract address/ | function evmHook(bytes29 _transferAction)
internal
pure
typeAssert(_transferAction, Types.TransferToHook)
returns (address)
{
return _transferAction.indexAddress(13);
}
| 2,645,406 |
./full_match/5/0xF19747EB85f5BA19AA2B8912577E50FB3395C035/sources/contracts/RafflesF.sol | Anyone can buy raffle ticket if the raffle is running/ Increment the count of entries for the participant Increment count of the total entries for the raffle | function manualEnter(uint256 _eventId, address participant, uint256 numberOfTickets) public onlyAdmin{
raffles[_eventId].entryCounts[participant] += numberOfTickets;
raffles[_eventId].totalEntries += numberOfTickets;
if (!isPlayer(_eventId, participant)) {
}
for (u... | 1,877,410 |
./full_match/1/0x7AfB064906525cdD7CcA187f6683C07Ffa998b39/sources/contracts/dependencies/openzeppelin/AccessControl.sol | Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}./ | function getRoleAdmin(bytes32 role) public virtual override view returns (bytes32) {
return _roles[role].adminRole;
}
| 8,379,896 |
./partial_match/1/0xDDD00b02aa6cC23c9B39F39Cd10DCCa8Fa86323c/sources/contracts/libraries/Address.sol | Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but also transferring `value` wei to `target`. Requirements: - the calling contract must have an ETH balance of at least `value`. - the called Solidity function must be `payable`. _Available since v3.1._/ | function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return
functionCallWithValue(target, data, value, 'Address: low-level call with value failed');
}
| 4,194,989 |
./full_match/5/0xc40a0656f0EF78bD8eA319C2d2f58587F190e686/sources/contracts/MintBees.sol | setBeekeeper: Function to add or remove a beekeeper role. Only the owner of the contract can perform this action. This will grant or revoke the beekeeper role for the specified address. _admin address - The address of the beekeeper to add or remove./We dont add lock here because we want to be able to ch... | function setBeekeeper(address _admin) public onlyOwner {
beekeeper = _admin;
}
| 11,599,660 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.3;
import './libs/SafeERC20.sol';
import './libs/Ownable.sol';
import './libs/SafeMath.sol';
/**
* @title TokenVesting
* @dev A token holder contract that can release its token balance gradually like a
* typical vesting scheme, with a cliff and vesting pe... | return the amount of the token vested./ | function getVestedAmount(IERC20 token) external view returns (uint256) {
return _vestedAmount(token);
}
| 5,463,663 |
// File: openzeppelin-eth/contracts/math/SafeMath.sol
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uin... | Approve the passed address to spend the specified amount of value 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 returns (bool) {
info.users[msg.sender].allowance[spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
| 1,509,413 |
// SPDX-License-Identifier: CC-BY-4.0
pragma solidity >=0.4.22 <0.9.0;
// Import the library 'Roles'
import "./Roles.sol";
// Define a contract 'SupplierRole' to manage this role - add, remove, check
contract SupplierRole {
using Roles for Roles.Role;
// Define 2 events, one for Adding, and other for... | Define a function 'addSupplier' that adds this role | function addSupplier(address account) public onlySupplier {
_addSupplier(account);
}
| 5,377,123 |
/*
* This code has not been reviewed.
* Do not use or deploy this code before reviewing it personally first.
*/
pragma solidity ^0.5.0;
import "../tokens/ERC1400HoldableToken.sol";
import "./certificateControllers/CertificateControllerNonce.sol";
/**
* @title ERC1400HoldableCertificateNonceToken
* @dev Holdable ... | ERC1400 functions to control with certificate / | function transferWithData(address to, uint256 value, bytes calldata data)
external
isValidCertificate(data)
{
_transferByDefaultPartitions(msg.sender, msg.sender, to, value, data);
}
| 2,483,833 |
/**
*Submitted for verification at Etherscan.io on 2021-08-11
*/
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.6;
// Part: IBetaOracle
interface IBetaOracle {
/// @dev Returns the given asset price in ETH (wei), multiplied by 2**112.
/// @param token The token to query for asset price
function g... | Returns the price of the given asset in terms of ETH (wei), multiplied by 2112. token The token to get asset price of. | function getAssetETHPrice(address token) public override returns (uint) {
if (token == weth) {
return (1 << 112);
}
address ext = exts[token];
if (ext != address(0)) {
return IExternalOracle(ext).getETHPx(token);
}
return updatePriceFromPair(token);
}
| 10,548,843 |
./partial_match/3/0x2365D741AD2f233242e439FdD438585BBd1EdA1A/sources/TestToken.sol | Tranfer tokens from sender to this contract sedoToken.transferFrom(msg.sender, SedoX, SedoAmmount2);ERC20(Sedo).transferFrom(msg.sender, SedoX, SedoAmmount2); Calculate sedox to transfer by the swapRatio;uint256 fee = SedoAmmount2 / 100; Transfer amount minus fees to sender | function Swap(uint SedoAmount) public{
uint SedoAmmount2 = SedoAmount * 10**uint(decimals);
ERC20 sedoToken = ERC20(Sedo);
ERC20 sedoXToken = ERC20(SedoX);
sedoToken.approve(msg.sender,SedoAmmount2);
uint SedoxAmmount = SedoAmmount2.div(defaultSwapRatio);
sedoXTo... | 5,058,916 |
./partial_match/5/0x272fC6E98998cAF63D23CFb08970F9D091BAAEBf/sources/ERC865Token.sol | require(signatures[_signature] == false); | function recoverSigner(
bytes _signature,
address _to,
uint256 _value,
uint256 _fee,
uint256 _nonce
)
public
view
returns (address)
{
require(_to != address(0));
bytes32 hashedTx = transferPreSignedHashing(address(this), _to, _value, _fee, ... | 16,850,004 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @author: manifold.xyz
import "../../openzeppelin-upgradeable/token/ERC1155/ERC1155Upgradeable.sol";
import "../libraries-solidity/access/AdminControlUpgradeable.sol";
import "./core/ERC1155CreatorCore.sol";
/**
* @dev ERC1155Creator implementation
*/
co... | {See ICreatorCore-getFeeBps}./ | function getFeeBps(uint256 tokenId)
external
view
virtual
override
returns (uint256[] memory)
{
return _getRoyaltyBPS(tokenId);
}
| 11,819,394 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
impo... | See {IERC20-totalSupply}./ | function totalSupply() external view returns (uint256) {
return _totalSupply[0];
}
| 5,400,375 |
./full_match/3/0x4029A9E539b3338623f1cA0BB56bf6cf1d3FC910/sources/contracts/NokuCustomERC20AdvancedLite_flat.sol | getter to determine if address is in whitelist/ | function whitelist(address _operator) public view returns (bool) {
return hasRole(WHITELISTED_ROLE, _operator);
}
| 8,101,272 |
/*
* Origin Protocol
* https://originprotocol.com
*
* Released under the MIT license
* https://github.com/OriginProtocol/origin-dollar
*
* Copyright 2020 Origin Protocol, Inc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files ... | 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 = _allowances[msg.sender][_spender];
if (_subtractedValue >= oldValue) {
_allowances[msg.sender][_spender] = 0;
_allowances[msg.sender][_spender... | 210,749 |
pragma solidity ^0.4.24;
library NameFilter {
/**
* @dev filters name strings
* -converts uppercase to lower case.
* -makes sure it does not start/end with a space
* -makes sure it does not contain multiple spaces in a row
* -cannot be only numbers
* -cannot start with 0x
* -rest... | distributes eth based on fees to gen and pot/ calculate gen share distribute 10% to pot distribute gen share (thats what updateMasks() does) and adjust balances for dust. add eth to pot set up event data | function distributeInternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _team, uint256 _keys, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _gen = (_eth.mul(fees_[_team].gen)) / 100;
uint256 _potAmount = _eth / 10;
... | 5,799,402 |
pragma solidity ^0.5.3;
contract ContractExtender {
//target details - what, who and when to extend
address public creator;
string public targetRecipientPTMKey;
address public contractToExtend;
//list of wallet addresses that can cast votes
address[] public walletAddressesToVote;
uint256 ... | close the contract to further modifications | function finish() public notFinished() onlyCreator() {
setFinished();
}
| 14,027,988 |
pragma solidity ^ 0.4.24;
import "./ERC20.sol";
import "./Util.sol";
import "./ERC20Token.sol";
import "./Ownable.sol";
import "./Vault.sol";
contract CrowdsaleToken is
ERC20Ex, StandardToken, Recoverable
{
using FreezeBalanceOp for FreezeBalanceOp.t;
using CrowdsaleTokenHelper for CrowdsaleTokenHelper.t;
... | solium-disable-next-line indentation | function info()
external
view
returns(string name, string symbol)
{
return tokenInfo.info();
}
| 12,615,354 |
pragma solidity ^0.4.18;
interface ISecurityToken {
/**
* @dev `selectTemplate` Select a proposed template for the issuance
* @param _templateIndex Array index of the delegates proposed template
* @return bool success
*/
function selectTemplate(uint8 _templateIndex) public returns (bool suc... | Use to validate the poly contribution If issuer sets the capping over the offering contract then raised amount should always less than or equal to the maximum amount set (maxPoly) _polyContributed Amount of POLY contributor want to invest return bool/ | function validPurchase(uint256 _polyContributed) internal view returns(bool) {
bool reachedCap = maxPoly > 0 && polyRaised.add(_polyContributed) <= maxPoly;
return (reachedCap);
}
| 12,796,806 |
./full_match/4/0xBe1145d6f48578c4192b95a6f2120C840f9CDA7B/sources/BLOOMERSGARDEN.sol | See {IERC721Metadata-tokenURI}./ | function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(_exists(tokenId), "Nonexistent token");
return
string(abi.encodePacked(baseURI, "/", tokenId.toString(), ".json"));
}
| 12,424,557 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
function sub(uint256 a, uint256 b) internal pure r... | 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 uint256 the amount of tokens to be transferred/ | function transferFrom(address from, address to, uint256 value) public returns (bool) {
require(value <= _balances[from]);
require(value <= _allowed[from][msg.sender]);
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
_allowed[f... | 10,568,822 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
pragma experimental ABIEncoderV2;
import "./interfaces/IStakingRewards.sol";
/// @author Alchemy Team
/// @title AlchemyRouter
/// @notice The AlchemyRouter which distributes the alchemy fees
contract AlchemyRouter {
// event for distribution
event Fee... | distributes the fees if the balance is 0.1 or higher sends 50% to the treasury sends 50% to the staking rewards contract calls notifyRewardAmount on the staking contract/ | function distribute() internal {
uint256 amount = address(this).balance;
if (amount > threshold) {
treasury.transfer(amount / 2);
payable(address(stakingRewards)).transfer(amount / 2);
stakingRewards.notifyRewardAmount(amount / 2);
emit FeeDistributi... | 9,943,946 |
pragma solidity ^0.4.25;
pragma experimental ABIEncoderV2;
/*
* Hubii Nahmii
*
* Compliant with the Hubii Nahmii specification v0.12.
*
* Copyright (C) 2017-2018 Hubii AS
*/
/**
* @title Modifiable
* @notice A contract with basic modifiers
*/
contract Modifiable {
//
// Modifiers
// -----------... | Get the max null settlement nonce to be accepted in settlements return the max driip nonce | function getMaxNullNonce()
public
view
returns (uint256)
{
return maxNullNonce;
}
| 948,857 |
pragma solidity ^0.5.0;
contract Estate {
uint256 public count = 0;
struct House {
address payable owner;
uint256 price;
string desc;
string location;
string imgUrl;
}
House[100] public houses;
mapping(address => uint256) pendingWithdrawals;
// add ho... | Remember to zero the pending refund before sending to prevent re-entrancy attacks | function withdraw() public {
uint256 amount = pendingWithdrawals[msg.sender];
pendingWithdrawals[msg.sender] = 0;
msg.sender.transfer(amount);
}
| 5,376,883 |
pragma solidity 0.4.25;
import "./TRC20Interface.sol";
import "./PermissionGroups.sol";
/**
* @title Contracts that should be able to recover tokens or tomos
*/
contract Withdrawable is PermissionGroups {
event TokenWithdraw(TRC20 token, uint amount, address sendTo);
/**
* @dev Withdraw all TRC20 c... | Withdraw Tomos/ | function withdrawTomo(uint amount, address sendTo) external onlyAdmin {
sendTo.transfer(amount);
emit TomoWithdraw(amount, sendTo);
}
| 880,064 |
./full_match/97/0xDb9E0E9EF664bb7e434dA618A1A2332E64dbFBAB/sources/project:/contracts/Gladiator.sol | 返回下注方向,下注金额,推广收益率uint userT=userType[msg.sender];uint userA=userAmount[msg.sender];uint userR=userReferrer[msg.sender]; | function getUserItems(address addr) public view returns (address,uint,uint,uint) {
userItem memory handle = userInfo[addr];
return (addr,handle.Type,handle.amount,handle.referrer);
}
| 3,267,520 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "./AuthorizationUtilsV0.sol";
import "./TemplateUtilsV0.sol";
import "./WithdrawalUtilsV0.sol";
import "./interfaces/IAirnodeRrpV0.sol";
/// @title Contract that implements the Airnode request–... | A convenience method to retrieve multiple templates with a single call Does not revert if the templates being indexed do not exist templateIds Request template IDs return airnodes Array of Airnode addresses return endpointIds Array of endpoint IDs return parameters Array of request parameters | function getTemplates(bytes32[] calldata templateIds)
external
view
override
returns (
address[] memory airnodes,
bytes32[] memory endpointIds,
bytes[] memory parameters
)
{
airnodes = new address[](templateIds.length);
... | 11,959,979 |
pragma solidity ^0.4.4;
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256 balance);
function transfer(address to, uint256 value) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint256 value);... | Установить можитель | function setBonus(uint _bonus) public onlyOwner {
currentStageMultiplier = _bonus;
}
| 5,351,943 |
pragma solidity 0.5.4;
//import {Ownable} from "./ownable.sol";
import "./accessible.sol";
import "./access_indexor.sol";
import "./user_space.sol";
/* -- Revision history --
Editable20190222140100ML: First versioned released
Editable20190315141800ML: Migrated to 0.4.24
Editable20190515103600ML: Modified rights restr... | overridden in BaseContent to return library | function parentAddress() public view returns (address) {
return contentSpace;
}
| 5,401,434 |
./partial_match/80001/0x495029c478BC182555bBeBe48A614F39e572BA0D/sources/HomeToken.sol | no need to require value <= totalSupply, since that would imply the sender's balance is greater than the totalSupply, which should be an assertion failure | function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
| 8,802,403 |
./full_match/43113/0xC4d44ffdbD678AF2C8d1CCE809c6b9c1C698eFC6/sources/contracts/Insurance.sol | adds a record of subscription. | function addEntry(bytes32 person,uint car,bytes32 subscriptionCompany) public { | 13,153,772 |
pragma solidity 0.5.11;
// WARNING - `executeActionWithAtomicBatchCalls` has a `bytes[]` argument that
// requires ABIEncoderV2, and the alternatives are pretty convoluted. Consider
// losing that function and ABIEncoderV2 for the V1 smart wallet implementation.
pragma experimental ABIEncoderV2;
import "@openzeppelin/... | Internal function for depositing a given ERC20 asset and balance on the corresponding cToken. No value is returned, as no additional steps need to be conditionally performed after the deposit. asset uint256 The ID of the asset, either Dai (0) or USDC (1). balance uint256 The amount of the asset to deposit. Note that ... | function _depositOnCompound(AssetType asset, uint256 balance) internal {
address cToken = asset == AssetType.DAI ? address(_CDAI) : address(_CUSDC);
(bool ok, bytes memory data) = cToken.call(abi.encodeWithSelector(
_CDAI.mint.selector, balance
));
_checkCompoundInteractionAndLogAnyErrors(
... | 12,781,727 |
contract NewsContract
{
struct Journalist
{
string Name;
string Address;
bool headline;
bool image;
bool video;
bool article;
uint Amount;
}
struct NewsDetails
{
//details regarding Image, Video, Article would store the hash of the link to the a... | Determine the price of the News based on the content requested For each content we increase the price of the request | function getPricePerRequest(bool _article, bool _image, bool _video) view public returns (uint){
uint cost = newsDetails.Price * 1;
if (_article == true) cost += 1;
if (_image == true) cost += 1;
if (_video == true) cost += 1;
return cost;
}
| 12,904,713 |
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma experimental ABIEncoderV2;
import "../ActionBase.sol";
import "../../core/Subscriptions.sol";
import "../../DS/DSMath.sol";
import "../../interfaces/IFLParamGetter.sol";
import "../../interfaces/ILendingPool.sol";
import "../../interfaces/aaveV2/ILendingP... | @inheritdoc ActionBase if we want to get on chain info about FL params | function executeAction(
bytes[] memory _callData,
bytes[] memory,
uint8[] memory,
bytes32[] memory
) public override payable returns (bytes32) {
FLAaveV2Data memory flData = parseInputs(_callData);
if (flData.flParamGetterAddr != address(0)) {
(flData... | 5,376,430 |
pragma solidity ^0.6.7;
pragma experimental ABIEncoderV2;
import "../strategy-base.sol";
import "../../interfaces/saddle-farm.sol";
import "../../interfaces/curve.sol";
contract StrategySaddleD4 is StrategyBase {
address private staking = 0x0639076265e9f88542C91DCdEda65127974A5CA5;
address private saddle_d4lp... | Internal functions | function _swapUniswap(
address _from,
address _to,
uint256 _amount
) internal {
require(_to != address(0));
address[] memory path;
if (_from == weth || _to == weth) {
path = new address[](2);
path[0] = _from;
path[1] = _to;
... | 115,757 |
/**
*Submitted for verification at Etherscan.io on 2021-09-12
*/
/**
*Submitted for verification at Etherscan.io on 2021-01-27
*/
pragma solidity ^0.5.0;
/**
* @title ERC165
* @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
*/
interface IERC165 {
/**
* @notice Query if a contract imp... | increments the value of _currentTokenID/ | function _incrementListId() private {
_currentListID++;
}
| 10,054,508 |
pragma solidity ^0.6.0;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
... | send assets to burn address | function _burn(IERC20 _token, uint256 _amount) private {
uint256 cotAmount = (_token == COT)
? _amount
: convertTokenToCOT(address(_token), _amount);
if(cotAmount > 0)
COT.transfer(deadAddress, cotAmount);
}
| 1,207,353 |
// File: @openzeppelin/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
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... | Not ensuring state changed in this block as it would needlessly increase gas | function approve(address spender, uint256 amount) public virtual override returns (bool) {
return super.approve(spender, amount);
}
| 12,133,055 |
./partial_match/100/0xc2Ca5f5305169C90843e018BC534F6edf5F2e77f/sources/ChainlinkPriceFeed.sol | 3 different timestamps, `previous`, `current`, `target` `base` = now - _interval `current` = current round timestamp from aggregator `previous` = previous round timestamp form aggregator now >= previous > current > = < base while loop i = 0 --+------+-----+-----+-----+-----+-----+ base current... | function getTwapPrice(bytes32 _priceFeedKey, uint256 _interval) external view override returns (uint256) {
AggregatorV3Interface aggregator = priceFeedMap[_priceFeedKey];
requireNonEmptyAddress(address(aggregator));
require(_interval != 0, "interval can't be 0");
uint8 decimal = pr... | 16,646,150 |
./full_match/44787/0x36894871A4542f94eA0dF2C71e47fb4Ea5A06359/sources/feature-v2/Feature.sol | Appeal an appealable ruling. Transfer the funds to the arbitrator. Note that no checks are required as the checks are done by the arbitrator. _claimID The index of the claim./ | function appeal(uint256 _claimID) public payable {
Claim storage claim = claims[_claimID];
Transaction storage transaction = transactions[claim.transactionID];
}
| 13,242,856 |
pragma solidity ^0.5.0;
import "./ERC20.sol";
import "./SafeMath.sol";
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/Firs... | Burns a specific amount of tokens. _value The amount of token to be burned./ no need to require value <= totalSupply, since that would imply the sender's balance is greater than the totalSupply, which should be an assertion failure | function burn(uint256 _value) public returns (bool burnSuccess) {
require(_value > 0);
require(_value <= balances[msg.sender]);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
return true;
}
... | 12,559,770 |
/**
*Submitted for verification at Etherscan.io on 2021-08-18
*/
/**
*
* ____ ____ _ _
*| _ \ ___ _ __ __ _ _ _ / ___| |_ _| |__
*| |_) / _ \ '_ \ / _` | | | | | | | | | | | '_ \
*| __/ __/ | | | (_| | |_| | | |___| | |_| | |_) |
*|_| \___|_| |_|\__, |\__,_| \____... | Need to make gas fee customizable to future-proof against Ethereum network upgrades. | function updateGasForProcessing(uint256 newValue) public onlyOwner {
require(newValue != gasForProcessing, "PUDGY: Cannot update gasForProcessing to same value");
emit GasForProcessingUpdated(newValue, gasForProcessing);
gasForProcessing = newValue;
}
| 2,098,746 |
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.11;
import {ClonesWithImmutableArgs} from "./clones/ClonesWithImmutableArgs.sol";
import {ERC20} from "./tokens/ERC20.sol";
import {ERC721} from "./tokens/ERC721.sol";
import {xERC20} from "./xERC20.sol";
import {ERC20StakingPool} from "./ERC20StakingPool.sol... | Creates an ERC20StakingPool contract Uses a modified minimal proxy contract that stores immutable parameters in code and passes them in through calldata. See ClonesWithImmutableArgs. rewardToken The token being rewarded to stakers stakeToken The token being staked in the pool DURATION The length of each reward peri... | function createERC20StakingPool(
ERC20 rewardToken,
ERC20 stakeToken,
uint64 DURATION
) external returns (ERC20StakingPool stakingPool) {
bytes memory data = abi.encodePacked(rewardToken, stakeToken, DURATION);
stakingPool = ERC20StakingPool(
address(erc20Sta... | 6,348,838 |
pragma solidity 0.6.8;
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
... | burn the left over. | function burn() public {
require(msg.sender == owner && Token.balanceOf(address(this)) > 0);
Token.transfer(address(0), Token.balanceOf(address(this)));
}
| 1,631,277 |
// File: @openzeppelin/contracts/utils/Counters.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Counters.sol)
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g.... | // Babyccino Minting options // Cosmic Coffee holder Minting of Babyccinos limit of 5 | function mintHolder(uint256 amountOfCinos) external payable whenHolderClaimStarted {
require(_holderEligible[msg.sender], "You are not eligible for the Cosmic Coffee holder minting");
require(totalSupply() < MAX_CINOS, "All tokens have been minted");
require(amountOfCinos <= MAX_PER_MINT, "C... | 10,299,272 |
//Address: 0x22b925def28A50EA5f1C13A2f056dDF2486D2Bc5
//Contract name: HandelionCrowdsale
//Balance: 0 Ether
//Verification Date: 12/8/2017
//Transacion Count: 196
// CODE STARTS HERE
pragma solidity ^0.4.15;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath... | Burns a specific amount of tokens. _value The amount of token to be burned./ | function burn(uint256 _value) public {
burnTokensInternal(msg.sender, _value);
}
| 5,478,405 |
// SPDX-License-Identifier: UNLICENSED
// Cauldron
// ( ( (
// )\ ) ( )\ )\ ) (
// (((_) ( /( ))\ ((_)(()/( )( ( (
// )\___ )(_)) /((_) _ ((_))(()\ )\ )\ )
// ((/ __|((_)_ (_))( | | _| | ((_) ((_) _(_/(
// | (__ / _` || || || |/ _` | | '_|/ _ \| ' \))
// \___... | Swaps to a flexible amount, from an exact input amount Pool token order is FRAX, DAI, USDC, USDT | function swap(
address recipient,
uint256 shareToMin,
uint256 shareFrom
) public returns (uint256 extraShare, uint256 shareReturned) {
(uint256 amountFrom, ) = bentoBox.withdraw(MIM, address(this), address(this), 0, shareFrom);
uint256 amountUSDT = MIM3POOL.exchange_unde... | 6,036,674 |
pragma solidity ^0.4.19;
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOw... | Transfer the item to the buyer | function endAuction() public onlyOwner {
require(auctionExpired());
require(!ended);
ended = true;
emit AuctionEnded(highestBidder, highestBidderCC, highestBid);
if (!highestBidIsCC) {
_transfer(highestBidder, tokenId);
paymentAddress.transfer(address(... | 14,094,562 |
./full_match/4/0xF4701742ED9De96B19a186979faF9a51BbF37B6D/sources/browser/SmartFundETHFactory.sol | Calculates the fund managers cut, depending on the funds profit and success fee return fundManagerRemainingCut The fund managers cut that they have left to withdraw return fundValue The funds current value return fundManagerTotalCut The fund managers total cut of the profits until now/ The to... | function calculateFundManagerCut() public view returns (
) {
fundValue = calculateFundValue();
int256 curtotalWeiDeposited = int256(totalWeiDeposited) - int256(totalWeiWithdrawn.add(fundManagerCashedOut));
if (int256(fundValue) <= curtotalWeiDeposited) {
fundManagerTotalCut = 0;
fundManager... | 715,299 |
./full_match/80001/0x879dE89795bb4650aafE43F3fd5fbA9D3DcE1695/sources/contracts/ExContract.sol | ERC20 token'ları transfer eden fonksiyon | function transferERC20Tokens(
address recipient,
uint256 amount
) external onlyOwner {
tokenContract.transfer(recipient, 10 * 10 ** 18);
}
| 9,498,691 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "./ERC1967Proxy.sol";
/**
* @dev This contract implements a proxy that is upgradeable by an admin.
*
* To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector
* clashing], which can potentially b... | Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}./ | function upgradeToAndCall(address newImplementation, bytes calldata data)
external
payable
virtual
ifAdmin
{
_upgradeToAndCall(newImplementation, data, false);
}
| 5,900,377 |
./full_match/80001/0xF32CB51e46b6cCC0a2D28Aa487222e84a7dF00b6/sources/project_/contracts/PGCore.sol | Called by owner to align idol revenue basis points _basisPoint specifies the basis point/ | function setIdolPercentage(uint256 _basisPoint) external onlyOwner {
BASIS_POINT = _basisPoint;
}
| 837,091 |
pragma solidity ^0.4.22;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed p... | Return SHPC price in cents./ | function getCoinUSDRate() public view returns (uint) {
return currencyContract.getCoinUSDRate();
}
| 15,856,471 |
./partial_match/1/0xE8387E8222f733142038fb362aF3ad12F1170D16/sources/CoinTokens.sol | Returns the amount of ERC-20 that is being circulated as ERC-1155 denominated tokens. Iterates the denominations array and sums value denominated into each. return value represents the value of all issued ERC-1155 tokens./ | function valueInCirculation()
public
view
returns (uint256)
{
uint256 value;
for (uint256 i = 0; i < denominations.length; i++) {
value += totalSupply(denominations[i]) * denominations[i];
}
return value;
}
| 2,738,694 |
// SPDX-License-Identifier: BUSDL-1.1
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IAssetAllocation} from "contracts/common/Imports.sol";
import {CurveLusdConstants} from "./Constants.sol";
import {
MetaPoolDepositorZap
} f... | the amount of future funding available to oracles/ | function availableFunds() external view returns (uint128) {
return recordedFunds.available;
}
| 53,181 |
/**
* The edgeless casino contract v2 holds the players's funds and provides state channel functionality.
* The casino has at no time control over the players's funds.
* State channels can be updated and closed from both parties: the player and the casino.
* author: Julia Altenried
**/
pragma solidity ^0.... | If the user wants/needs to withdraw his funds himself, he needs to request the withdrawal first. This method sets the earliest possible withdrawal date to &39;waitingTime from now (default 90m, but up to 24h). Reason: The user should not be able to withdraw his funds, while the the last game methods have not yet been m... | function requestWithdrawal() public {
withdrawAfter[msg.sender] = now + waitingTime;
}
| 2,416,649 |
// Copyright (C) 2018 Alon Bukai 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, version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without ... | Call to multiple contracts using a byte32 array which includes the contract address and the amount. Addresses and amounts are stored in a packed bytes32 array. Address is stored in the 20 most significant bytes. The address is retrieved by bitshifting 96 bits to the right Amount is stored in the 12 least significa... | function multiCallTightlyPacked(bytes32[] calldata _addressesAndAmounts)
external
payable
returns (bool)
{
uint256 sentAmount = 0;
for (uint256 i = 0; i < _addressesAndAmounts.length; i++) {
address to = address(bytes20(_addressesAndAmounts[i]));
u... | 1,580,184 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
import "../node_modules/@openzeppelin/contracts/utils/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/ | function fund(address airline, uint256 amount)
public
payable
requireIsOperational
requireRegistered(airline)
{
airlines[airline].funds += amount;
}
| 2,512,778 |
./full_match/5/0x28fbe43b52544a3947309768e11E4c1AebFDbD92/sources/src/token/ERC1155/extensions/lockable/IERC1155LockableExtension.sol | Extension of {ERC1155} that allows other facets from the diamond to lock the tokens./ | interface IERC1155LockableExtension {
function lockByFacet(
address account,
uint256 id,
uint256 amount
) external;
function lockByFacet(
address[] memory accounts,
uint256[] memory ids,
uint256[] memory amounts
) external;
function unlockByFacet(
... | 1,894,987 |
./partial_match/1/0xE3C67a3be126b6f41D66EAbB89F1e346Cd099195/sources/MiltonUsdt.sol | Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account does... | interface IERC20PermitUpgradeable {
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
function nonces(address owner) external view returns (uint256);
function DOMAIN_SEPARA... | 2,612,429 |
//Address: 0x365ec7b439abcc8a3a2c4289f0868a4adcd996e9
//Contract name: EtherRacingCore
//Balance: 3.0636 Ether
//Verification Date: 1/3/2018
//Transacion Count: 3273
// CODE STARTS HERE
pragma solidity ^0.4.0;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization ... | Set the new contract address | function setUpgradeAddress(address _address) external onlyMaster {
UpgradeInterface c = UpgradeInterface(_address);
require(c.isUpgradeInterface());
upgradeInterface = c;
}
| 2,508,408 |
./full_match/5/0x17EA9E4a2AB738DbB8B28e18EABA41d56Ed8769F/sources/src/router/TWRouterImplementation.sol | Sets the admin address. | function setAdmin(address _admin) external {
require(msg.sender == admin, "RouterUpgradeable: Only admin can set a new admin");
admin = _admin;
}
| 11,621,899 |
./full_match/137/0xeb0c08Ad44af89BcBB5Ed6dD28caD452311B8516/sources/contracts/protocol/core/actions/MixinActions.sol | PUBLIC METHODS/ INTERNAL METHODS/ PRIVATE METHODS/ Allocates tokens to recipient. Fee tokens are locked too. Each new mint on same recipient sets new activation on all owned tokens. recipient Address of the recipient. mintedAmount Value of issued tokens. return recipientAmount Number of new tokens issued to recipie... | function decimals() public view virtual override returns (uint8);
function _getFeeCollector() internal view virtual returns (address);
function _getMinPeriod() internal view virtual returns (uint48);
function _getSpread() internal view virtual returns (uint16);
function _getUnitaryValue() intern... | 3,766,525 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.