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/4/0x48163e951DfF2877439B4e61480399275dD10C3B/sources/contracts/CimCity.sol
See {IERC165-supportsInterface}./
function _beforeTokenTransfer( address from, address to, uint256 tokenId } } function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(inte...
685,311
./full_match/43113/0xAcC4fC9A4ebA3675B2A0cF1638f62314F8347850/sources/contracts/protocol/libraries/logic/ValidationLogic.sol
Validates an viToken transfer from The user from which the viTokens are being transferred reservesData The state of all the reserves userConfig The state of the user for the specific reserve reserves The addresses of all the active reserves oracle The price oracle/
function validateTransfer( address from, mapping(address => DataTypes.ReserveData) storage reservesData, DataTypes.UserConfigurationMap storage userConfig, mapping(uint256 => address) storage reserves, uint256 reservesCount, address oracle ) internal view { (, , , , uint256 healthFactor)...
13,181,147
// SPDX-License-Identifier: MIT // Copyright © 2022 gparap pragma solidity >=0.7.0 <0.9.0; /** * @title Lotto Contract * @dev Accepts ether from multiple users and picks a lucky one at random to win the lottery */ contract Lotto { uint256 pool; mapping(address => uint256) public gambles; uint256 gamble...
add ether to the lottery poolminimum amount of ether requiredadd person address & amount to listsadd ether to pool
function gambleAmount() public payable { require(msg.value > 1 ether); gamblers.push(payable(msg.sender)); gambles[msg.sender] += msg.value; gamblesCount += 1; pool += msg.value; }
12,884,262
pragma solidity ^0.4.18; /* * v1.0 * Created by MyEtheroll.com, feb 2018 * Feel free to copy and share :) * Donations: 0x7e3dc9f40e7ff9db80c3c7a1847cb95f861b3aef */ contract Billboard { uint public cost = 100000000000000; // 0.0001 eth uint16 public messageSpanStep = 1 minutes; address owner; by...
Save message to the blockchain and add event./
function _saveMessage (uint _validFrom, uint _validTo, address _sender, string _message) private { bytes32 id = _createId(Message(_validFrom, _validTo, _sender, _message, head)); messages[id] = Message(_validFrom, _validTo, _sender, _message, head); length = length+1; head = id; ...
10,132,135
/** *Submitted for verification at Etherscan.io on 2021-04-11 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.2; /******************************************************* * Interfaces * *******************************************************/ interface IV2Vault { ...
Fetch TVL for adapter/
function assetsTvl() external view returns (uint256) { uint256 tvl; address[] memory assetAddresses = assetsAddresses(); uint256 numberOfAssets = assetAddresses.length; for (uint256 assetIdx = 0; assetIdx < numberOfAssets; assetIdx++) { address assetAddress = assetAddress...
7,746,561
pragma solidity ^0.5.0; /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error. * * Subtraction and addition only here. */ library SafeMath { /** * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend). ...
METHOD: Core logic of `transfer` interface method in ERC20 token standard. It can only be called by the `bicaProxy` contract. _sender The address initiating the approval in proxy. return success or not./
function transferWithSender(address _sender, address _to, uint256 _value) public onlyProxy returns (bool success){ require(_to != address(0)); bool senderFrozen = bicaLedger.getFrozenByAddress(_sender); require(!senderFrozen, "sender is frozen"); bool toFrozen = bicaLedger.getFrozen...
2,479,132
// Bloom.sol -- Coupons that Grow in Value // MIT License // Copyright (c) 2020 Rob Secord <robsecord.eth> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including...
Creates the Membership Token Type/
function createMembershipType(string calldata _uri) external onlyOwner returns (uint256) { require(membershipTypeId == 0, "Bloom: MEMBERSHIP_TOKEN_EXISTS"); return membershipTypeId; }
6,433,005
./partial_match/3/0x6639BCc9832531B4B2D8148b7dA7cED5D0C07883/sources/Oracle.sol
uint256 priceCumulative2 = pair2.price0CumulativeLast(); (uint112 reserve3, uint112 reserve4, uint32 blockTimestampLast2) = pair2.getReserves();
function initializeOracle() private { IUniswapV2Pair pair = _pair; IUniswapV2Pair pair2 = _pair2; uint256 priceCumulative = _index == 0 ? pair.price0CumulativeLast() : pair.price1CumulativeLast(); uint256 priceCumulative2 = _index == 0 ? pair2.pric...
5,071,425
pragma solidity 0.7.1; pragma experimental ABIEncoderV2; contract CoreUniLotterySettings { // Percentage calculations. // As Solidity doesn't have floats, we have to use integers for // percentage arithmetics. // We set 1 percent to be equal to 1,000,000 - thus, we // simulate 6 decimal poin...
At first, check if lottery max lifetime is exceeded. If so, start ending procedures right block.timestamp. Finish probability is met! Commence lottery end - start Ending Stage.
function checkForEnding( bool holderCountChanged ) internal { if( (block.timestamp - startDate) > cfg.maxLifetime ) { startEndingStage(); return; } uint prec = 10000; uint mod...
7,578,603
// SPDX-License-Identifier: MIT pragma solidity =0.8.4; import {SafeMath} from "@openzeppelin/contracts/utils/math/SafeMath.sol"; import {DSMath} from "../vendor/DSMath.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {VaultLifecycle} from "./VaultLifecycle.sol"; im...
Returns true if `account` is a contract. [IMPORTANT] ==== It is unsafe to assume that an address for which this function returns false is an externally-owned account (EOA) and not a contract. Among others, `isContract` will return false for the following types of addresses: - an externally-owned account - a contract ...
function getPayout(address _otoken, uint256 _amount) external view returns (uint256); function operate(ActionArgs[] calldata _actions) external; function getAccountVaultCounter(address owner) external view returns (uint256); function oracle() external v...
5,850,315
pragma solidity ^0.4.23; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { int256 constant private INT256_MIN = -2**255; /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) ...
Checks that a given pony is able to breed. Requires that the current cooldown is finished (for sires) and also checks that there is no pending pregnancy. In addition to checking the cooldownEndBlock, we also need to check to see if the pony has a pending birth; there can be some period of time between the end of the ...
function _isReadyToMate(Pony _pon) internal view returns (bool) { return (_pon.matingWithId == 0) && (_pon.cooldownEndBlock <= uint64(block.number)); }
6,389,599
pragma solidity ^0.4.24; import "./ownership/Ownable.sol"; import "./cryptography/ECDSA.sol"; // import "./interfaces/IERC20.sol"; /** * @title Micro payments contract for m2m payments based on one-to-many state channel architecture * @notice Only contract owner can add or remove trusted contract addresses */ contrac...
Function called by the sender, receiver or a delegate, with all the needed signatures to close the channel and settle immediately _receiver Server side of transfer _openBlockNumber The block number at which a channel between the sender and receiver was created. _balance Partial or total amount owed by the sender to ...
function cooperativeClose( address _receiver, uint256 _openBlockNumber, uint192 _balance, bytes _balanceMsgSig, bytes _closingSig) external { address sender = extractBalanceProofSignature( _receiver, _openBlockNumber, _balance, ...
997,104
/** *Submitted for verification at Etherscan.io on 2020-08-28 */ // SPDX-License-Identifier: MIT pragma solidity 0.6.10; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because prog...
Updates the Withdrawal Publisher address, the only address other than the owner that can publish / remove withdrawal Merkle tree roots. _newWithdrawalPublisher The address of the new Withdrawal Publisher Error invalid sender./
function setWithdrawalPublisher(address _newWithdrawalPublisher) external { require(msg.sender == owner(), "Invalid sender"); withdrawalPublisher = _newWithdrawalPublisher; emit WithdrawalPublisherUpdate(oldValue, withdrawalPublisher); }
5,380,247
./full_match/1/0xEee483929798c0E7a41859743AFffA3CC738EC44/sources/browser/IChiToken.sol
Warning!!! will revert if token.balanceOf(msg.sender) < value Warning!!! will revert if token.balanceOf(msg.sender) < value
interface IChiToken { function balanceOf(address owner) external view returns (uint256 balance); function mint(uint256 value) external; function free(uint256 value) external returns (uint256); function freeFrom(address from, uint256 value) external returns (uint256); }
3,065,661
pragma solidity ^0.4.18; /** * @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; ...
Set total supply /
function setTotalSupply(uint256 _totalSupply) onlyOwner public { totalSupply = _totalSupply * 10 ** uint256(decimals); balanceOf[owner] = totalSupply; Transfer(0, this, totalSupply); Transfer(this, owner, totalSupply); }
12,727,845
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts-upgradeable/token/ERC721/presets/ERC721PresetMinterPauserAutoIdUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@ope...
Changes the baseUri of the tokens - overridable/
function setBaseUri(string memory _baseUri) public virtual { require( hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "Sender must have admin role to change base uri" ); baseTokenURI = _baseUri; }
11,738,853
./full_match/8453/0x18159f21D6A2F72Dc97FC1d2ddEbCEcfa614142C/sources/contracts/AuditRefactor_RocketDrop.sol
Withdraw without caring about rewards. EMERGENCY ONLY.
function emergencyWithdraw(uint256 _pid) external { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; uint256 staked = user.amount; pool.tokensStaked -= staked; poolExtras[_pid].totalStakers--; user.amount = 0; user...
11,554,024
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.6.12; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "./FeeOwner.sol"; import "./Fee1155.sol"; /** @title A basic smart contract for tracking the ownership of SuperFarm Items. @author Ti...
Get Total Claim Amount index - Claim Index/
function totalAmount(uint256 index) external view returns (uint256) { return claims[index].totalAmount; }
1,272,374
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; // From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol // Subject to the MIT license. /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity w...
Implemented by jobs to show that a keeper performed work credit the asset being awarded to the keeper keeper address of the keeper that performed the work amount the reward that should be allocated/
function receipt(address credit, address keeper, uint amount) external { require(jobs[msg.sender], "receipt: !job"); credits[msg.sender][credit] = credits[msg.sender][credit].sub(amount, "workReceipt: insuffient funds"); lastJob[keeper] = now; IERC20(credit).safeTransfer(keeper, amou...
494,242
/** *Submitted for verification at Etherscan.io on 2021-07-08 */ // Sources flattened with hardhat v2.4.0 https://hardhat.org // File contracts/external/polygon/lib/RLPReader.sol // Copied mostly from Polygon demo FxTunnel repo: https://github.com/jdkanani/fx-portal. // There are two modifications such that this co...
Publishes price for a requested query. Will only emit an event if the request has never been resolved./
function _publishPrice( bytes32 identifier, uint256 time, bytes memory ancillaryData, int256 price ) internal { bytes32 priceRequestId = _encodePriceRequest(identifier, time, ancillaryData); Price storage lookup = prices[priceRequestId]; if (lookup.state =...
2,026,072
/** *Submitted for verification at Etherscan.io on 2022-03-02 */ // 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, t...
Draw the final number, calculate reward in ARCHIENEKO per group, and make lottery claimable _lotteryId: lottery id _autoInjection: reinjects funds into next lottery (vs. withdrawing all) Callable by operator/ Calculate the finalNumber based on the randomResult generated by ChainLink's fallback Initialize a number to...
function drawFinalNumberAndMakeLotteryClaimable(uint256 _lotteryId, bool _autoInjection) external override onlyOperator nonReentrant { require(_lotteries[_lotteryId].status == Status.Close, "Lottery not close"); require(_lotteryId == randomGenerator.viewLatestLott...
133,115
/** *Submitted for verification at Etherscan.io on 2021-04-08 */ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.7.5; abstract contract ReentrancyGuard { uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor () { _...
------------------------------------------------------------------------ Get the number of tokens staked by a staker _staker the address of the staker ------------------------------------------------------------------------
function yourStakedFEG(address staker) public view returns(uint256 stakedFEG){ require(staker != address(0), "ERC20: sending to the zero address"); return stakers[staker].stakedTokens; }
2,129,368
./full_match/43114/0xc9070B3EFE0aacC5AfB4B31C5DbDCA7C6B4bAAA9/sources/contracts/YieldWolf.sol
updates the swap path for a given pair can only be called by the owner _strategy address of the strategy _extraEarnTokens list of extra earn tokens for farms rewarding more than one token/ tokens sanity check
function setStrategyExtraEarnTokens(IYieldWolfStrategy _strategy, address[] calldata _extraEarnTokens) external onlyOwner { require(_extraEarnTokens.length <= 5, 'setStrategyExtraEarnTokens: CAP_EXCEEDED'); for (uint256 i; i < _extraEarnTokens.length; i++) { IERC20(_...
4,507,358
./full_match/1/0x5B7B8b487D05F77977b7ABEec5F922925B9b2aFa/sources/contracts/AlphaProVaultFactory.sol
Change the protocol fee charged on pool fees earned from Uniswap, expressed as multiple of 1e-6. Fee is hard capped at 20%./
function setProtocolFee(uint24 _protocolFee) external onlyGovernance { require(_protocolFee <= 20e4, "protocolFee must be <= 200000"); protocolFee = _protocolFee; emit UpdateProtocolFee(_protocolFee); }
16,419,041
./partial_match/1313161554/0xF942C7bf8721732e936AD3e5F9e7cAe6183637D8/sources/_contracts/pegged-bridge/tokens/MintSwapCanonicalToken.sol
msg.sender has bridge token and wants to get canonical token. _bridgeToken The intermediary token address for a particular bridge. _amount The amount./ move bridge token from msg.sender to canonical token _amount
function swapBridgeForCanonical(address _bridgeToken, uint256 _amount) external returns (uint256) { Supply storage supply = swapSupplies[_bridgeToken]; require(supply.cap > 0, "invalid bridge token"); require(supply.total + _amount <= supply.cap, "exceed swap cap"); supply.total += ...
16,934,889
./full_match/5/0x59C9CEE1B88D80ad04630400175E02d1B170ccC2/sources/contracts/ERC721SignOnly.sol
Mints tokens to receiver on claim. Any state changes related to `claim` must be applied here by overriding this function. Override this function to add logic for state updation. When overriding, apply any state changes before `_safeMint`./
function _transferTokensOnClaim( address _receiver, uint256 _quantity ) internal virtual returns (uint256 startTokenId) { startTokenId = _currentIndex; _safeMint(_receiver, _quantity); }
1,886,262
./partial_match/8453/0xBCEb0Ee20ED1489DbEa44dB08A1E95004ca2753a/sources/UniswapV2Router02.sol
LIBRARY FUNCTIONS
function quote( uint256 amountA, uint256 reserveA, uint256 reserveB ) public virtual override pure returns (uint256 amountB) { return UniswapV2Library.quote(amountA, reserveA, reserveB); }
16,768,175
pragma solidity ^0.5.2; import "./ERC20Capped.sol"; import "./ERC20Burnable.sol"; import "./ERC20Detailed.sol"; import "./ERC20Pausable.sol"; contract Eraswap is ERC20Detailed,ERC20Burnable,ERC20Capped,ERC20Pausable { event NRTManagerAdded(address NRTManager); constructor() public ERC20D...
this function is used to withdraw the principle amount of multiple stakings which have their tenure completed _stakingIds - input which stakings to withdraw , 'cannot withdraw before staking ends'
function withdrawExpiredStakings(uint256[] memory _stakingIds) public { for(uint256 i = 0; i < _stakingIds.length; i++) { require(now >= stakings[msg.sender][_stakingIds[i]].timestamp .add(stakingPlans[ stakings[msg.sender][_stakingIds[i]].stakingPlanId ].months.mul(earthSeco...
12,590,600
pragma solidity^0.6.0; /* * Team Equitable Builds Inc presents.. * ====================================* * _____ ___ _______ ______ * * | _ | || | __| __| * * | | | | __| |__ * * |__|__|_____|____|_____| * * * * =============...
Retrieve the hold three dividend balance of any single address./
function EholdthreedividendsOf(address _customerAddress) view public returns(uint256) { uint256 _dividendPershare; if(holdthreeSharehold_[_customerAddress] == 0){ return 0; _dividendPershare = (holdthreefeeBalanceLedger_ / holdthreefeeTotalHolds_);...
6,506,317
pragma solidity ^0.5.16; pragma experimental ABIEncoderV2; library PlasmaData { struct Account { address owner; uint pubKeyX; uint pubKeyY; } struct Request { uint accumulatedHash; uint timestamp; } struct Withdrawal { uint accountId; ...
This is the prime number that is used for the alt_bn128 elliptic curve, see EIP-196.
function SNARK_SCALAR_FIELD() internal pure returns (uint) { return 21888242871839275222246405745257275088548364400416034343698204186575808495617; }
5,386,010
./partial_match/5/0x9567b62F459A4147647D68462b8551903AF08B5B/sources/MISOMarket.sol
Creates a new MISOMarket using _templateId Initializes auction with the parameters passed _templateId Id of the auction template to create _data - Data to be sent to template on Init/
function createMarket( uint256 _templateId, address _token, uint256 _tokenSupply, bytes calldata _data ) external returns (address newMarket) { newMarket = deployMarket(_templateId); if (_tokenSupply > 0) { require(IERC20(_token).transferFrom(msg.sende...
16,865,994
pragma solidity 0.4.25; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; address public newOwner; event OwnershipTransferred...
Add address to limitedWallets Can be called only by manager/
function addLimitedWalletAddress(address _wallet) public onlyManager { limitedWallets[_wallet] = true; }
911,374
./partial_match/42/0xf6B81d1CFDb8D122176c0F26db87932aB9085358/sources/ExchangeRates.sol
Retrieve the rates and isAnyStale for a list of currencies/
function ratesAndStaleForCurrencies(bytes32[] currencyKeys) external view returns (uint[], bool) { uint[] memory _localRates = new uint[](currencyKeys.length); bool anyRateStale = false; uint period = rateStalePeriod; for (uint i = 0; i < currencyKeys.length; i++) { Rate...
8,851,144
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./interfaces/I...
Distribute(mint) loan fund tokens. Executable by contract owner only. Contract owner only. Cant withdraw more than _loan_fund. _receiverAddress - Address which recieves tokens _amount - Amount be minted
function distributeLoanFund(uint256 _amount, address _receiverAddress) external onlyOwner { require(_loan_fund >= _amount, "Cant distribute more than cap"); _loan_fund -= _amount; _transfer(address(this), _receiverAddress, _amount); }
5,433,319
./full_match/4/0x085A9e8CF1eCFD0aE4C4Cfb73207C37DA813f6Dd/sources/step.sol
tokenCounter = tokenCounter + 1;
function createmytoken(address myaddress, string memory tokenURI) public onlyOwner returns (uint256,string memory) { _tokenIds.increment(); uint256 newItemId = _tokenIds.current(); _setTokenURI(newItemId, tokenURI); return (newItemId,tokenURI); }
734,801
./full_match/5/0xAc3Dd8335CdbEc382Cae46fD31ba063EAC72B416/sources/contracts/MyContract.sol
Collects and distributes the primary sale value of NFTs being claimed.
function collectPriceOnClaim( address senderAddress, uint256 _tokenId, address _primarySaleRecipient, uint256 _quantityToClaim, address _currency, uint256 _pricePerToken ) internal override { if (_pricePerToken == 0) { return; } ...
1,869,426
pragma solidity 0.4.20; contract Betting { /* Constructor function, where owner and outcomes are set */ function Betting(uint[] _outcomes) public payable { owner = msg.sender; outcomeLength = 0; for (uint i = 0; i < _outcomes.length; i++) { outcomes[i] = _outcomes[i]; ...
Allow anyone to check if they won any bets /
function checkWinnings() public view returns(uint) { return winnings[msg.sender]; }
5,501,912
// File: lib/ReentrancyGuard.sol // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.6.12; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sur...
Increase debt (increase coinage) mortgageToken mortgage asset address pToken ptoken address amount amount of debt Get the price Calculate the stability fee The stability fee is transferred to the insurance pool Eliminate negative accounts
function increaseCoinage(address mortgageToken, address pToken, uint256 amount) public payable whenActive nonReentrant { require(mortgageAllow[pToken][mortgageToken], "Log:MortgagePool:!mortgageAllow"); require(amount > 0, "Log:MortgagePool:...
14,660,457
/* ____ __ __ __ _ / __/__ __ ___ / /_ / / ___ / /_ (_)__ __ _\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ / /___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\ /___/ * Synthetix: HakkaRewards5.sol * * Docs: https://docs.synthetix.io/ * * * MIT License * =========== * * Copyright (c) 2020 S...
incase of airdrop token
function inCaseTokenGetsStuckPartial(IERC20 _TokenAddress, uint256 _amount) onlyOwner public { require(_TokenAddress != hakka && _TokenAddress != TFT); _TokenAddress.safeTransfer(msg.sender, _amount); }
7,811,975
pragma solidity ^0.4.21; import "./versioning/ImplementationProvider.sol"; import "./versioning/ImplementationDirectory.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; /** * @title AppDirectory * @dev Implementation directory with a standard library as a fallback provider. * If the implementa...
Emitted when the standard library is changed. newStdlib Address of the new standard library./ Provider for standard library implementations./ Constructor function. _stdlib Provider for standard library implementations./
function AppDirectory(ImplementationProvider _stdlib) public { stdlib = _stdlib; }
13,041,401
pragma solidity 0.5.3; /** * @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 private _owner; event OwnershipTransferred(address index...
/ INTERNAL - WRITE //
function updateStatementCountByBuildingPermit(string memory buildingPermitId) internal { uint oldCount = statementCountByBuildingPermitHash[keccak256(abi.encodePacked(buildingPermitId))]; buildingPermitIds.push(buildingPermitId); } uint newCount = oldCount + 1; assert(newCount > oldCount); ...
6,408,950
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error...
Transfers guardianship to a new address Check tx comes from current guardian Store new address awaiting confirmation
function setGuardian(address _newAddress) external override { require(msg.sender == guardian, "Is not guardian account"); newGuardian = _newAddress; }
12,825,639
// SPDX-License-Identifier: MIT pragma solidity >=0.8.9 <0.9.0; /* _______ _ _ __ __ |__ __| (_) | \ \ / / | |_ __ _| |__ ___ \ V / | | '__| | '_ \ / _ \ > < | | | | | |_) | __// . \ __|_|_|_ |_|_.__/ \___/_/_\_\ ...
SETTERS FOR MAXMINTAMOUNT
function setMaxMintAmount(uint16 _newMaxMintAmount) public onlyOwner { maxMintAmount = _newMaxMintAmount; }
13,618,123
./partial_match/1/0xc3461F79e6260c463ef6C3CcCEfB6CaEAb5140c4/sources/src/Unitas.sol
Checks the reserve ratio is sufficient when `reserveRatioThreshold` is greater than zero/
function _checkReserveRatio(uint232 reserveRatioThreshold) internal view { if (reserveRatioThreshold == 0) { return; (uint256 reserves, uint256 collaterals) = _getTotalReservesAndCollaterals(); uint256 allReserves = reserves + collaterals; uint256 liabilities ...
15,595,872
./full_match/11155111/0x0475C9B2D168167aA161EC2a617712Bf7045300f/sources/MultiCheck.sol
Send eth to MW and DW./
function sendETHToFee(uint256 amount) private { _marketingWallet.transfer(amount.mul(_marketingShare).div(100)); _devWallet.transfer(amount.mul(_devShare).div(100)); }
3,793,351
pragma solidity 0.5.0; import 'openzeppelin-solidity/contracts/math/SafeMath.sol'; contract Transaction { using SafeMath for uint256; // value of the transaction uint256 public transaction_value; // Counter party is the party which is on the receiving end of this transaction address payable publ...
fallback payable function
function() external payable {}
13,115,521
// Sources flattened with hardhat v2.8.4 https://hardhat.org // File @openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol@v4.3.0 // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be depl...
uint256 gasFeeAccumulated = gasFeeAccumulatedByToken[tokenAddress];
function withdrawErc20GasFee(address tokenAddress) external onlyExecutor whenNotPaused nonReentrant { require(tokenAddress != NATIVE, "Can't withdraw native token fee"); uint256 _gasFeeAccumulated = gasFeeAccumulated[tokenAddress][_msgSender()]; require(_gasFeeAccumulated != 0, "Gas Fee earn...
12,902,931
./full_match/80001/0x1FF3D840773c045cC0932b410cd1D61dB953Bbbf/sources/project_/contracts/Demo.sol
Adds a doctor with the provided details to the contract _name The name of the doctor _addr The address of the doctor _specialty The specialty of the doctor _registrationNumber The registration number of the doctor _hospitalAffiliation The hospital affiliation of the doctor _contactInfo The contact information of ...
function addDoctor( string memory _name, address _addr, string memory _specialty, string memory _registrationNumber, string memory _hospitalAffiliation, string memory _contactInfo ) public { doctors[msg.sender] = Doctor({ name: _name, doctorAddress: _addr, specialty: ...
5,624,213
pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; import "./ICheckedTransfers.sol"; import "../checks/TransferChecker.sol"; contract CheckedTransfers is ERC20, TransferChecker, ICheckedTransfers { using SafeMath for uint256; // Note: be sure to override the ERC-20 here, ...
Transfer token to a specified address. Checked by transfer checker. _to The address to transfer from. _to The address to transfer to. _value The amount to be transferred. _data Extra data to use when checking transfer permissions./
function transferFromWithData(address _from, address _to, uint256 _value, bytes calldata _data) external { byte status = _canTransfer(msg.sender, _to, _value, _data); require(status == hex"11"); bool regStatus = _canForceTransfer(msg.sender); if (regStatus) { _transfer(_...
12,969,891
pragma solidity 0.5.4; import "./ERC721Full.sol"; contract PatronageCollectibles is ERC721Full { event Minted(uint indexed tokenId, address from); event Deposited(uint indexed tokenId, uint value, address from); event PriceUpdated(uint indexed tokenId, uint newPrice, address from); event Collected(uint index...
Collect taxes Forbid collection of collectibles with zero balances Represent amount of taxes paid as a time As each tax payment corresponds to tax time interval
function collect(uint tokenId) public { uint owed = taxOwed(tokenId); address payable beneficiary = address(uint160(creatorOf(tokenId))); uint paid = taxes[tokenId]; taxes[tokenId] = 0; paidThru[tokenId] += (now - paidThru[tokenId]) * paid / owed; emit Collected(tokenId, paid, msg.sende...
7,290,481
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; import "./Bibscoin.sol"; import "./Dai.sol"; /** @title Bibs Staking. *...
Calculate the Reward of Bibscoin token. The function uses the current DAI/ETH rate and calculates the period over which DAIs are stacked./
function calculateReward() internal view returns (uint256) { if (stakingBalance[msg.sender] == 0) { return 0; } uint256 daiEthPrice = uint256(getDaiEthPrice()); uint256 stakingPeriod = (block.timestamp - timestamp[msg.sender]) / (1 seconds); return (((stakingBalan...
5,441,525
// SPDX-License-Identifier: MIT pragma solidity ^0.8.6; import "./SafeMath8.sol"; import "./ERC721.sol"; interface erc20 { function transfer(address recipient, uint amount) external returns (bool); function balanceOf(address) external view returns (uint); function transferFrom(address sender, address recip...
return oracle.assetToAsset(reward, amount, buyWith, 3600);
function price(uint amount) public view returns(uint) { return result; }
965,012
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 withdrawing a given underlying asset balance from the corresponding cToken. Note that the requested balance may not be currently available on Compound, which will cause the withdrawal to fail. asset uint256 The asset's ID, either Dai (0), USDC (1), or ETH (2). balance uint256 The amount of the a...
function _withdrawFromCompound( AssetType asset, uint256 balance ) internal returns (bool success) { address cToken; if (asset == AssetType.DAI) { cToken = address(_CDAI); if (asset == AssetType.USDC) { cToken = address(_CUSDC); cToken = address(_CETH); } } ...
12,781,728
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.10; import {ReentrancyGuard} from "@rari-capital/solmate/src/utils/ReentrancyGuard.sol"; import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import {ERC721TransferHelper} from "../../../../transferHelpers/ERC721TransferHelper.sol"; import {...
,-. `-' /|\ | ,--------------------------. ,--------------------. ,-------------------. / \ |ReserveAuctionFindersErc20| |ERC721TransferHelper| |ERC20TransferHelper| Caller `------------+-------------' `----...
function createBid( address _tokenContract, uint256 _tokenId, uint256 _amount, address _finder ) external payable nonReentrant { Auction storage auction = auctionForNFT[_tokenContract][_tokenId]; address seller = auction.seller; require(seller != address...
14,552,462
./partial_match/1/0x1955D86f5b369Be4581Fb2D346B403d362883aC7/sources/EmployeeIDBadges.sol
expire a token. Initiate s.PendingExpiry if account does not possess minimal stake. Transfers the NFT to EXPIRED account. _tokenId the token to expire/
function expire(uint256 _tokenId) external returns (State) { Badge storage c = badges[_tokenId]; State s = c.state; require(c.transferAt < block.number - uint256(GRACE_PERIOD), address o = c.owner; uint256 bal = balanceOf(o); (uint256 deposit,) = stogie.farmers(o); ...
3,590,580
./full_match/42/0x4807eEa77e376a6a471aCA5279E831D9A0eC5d72/sources/D/Projects/tesla/contracts/Core/MockUSDC.sol
Rescue ERC20 tokens locked up in this contract. tokenContract ERC20 token contract address to Recipient address amount Amount to withdraw/
function rescueERC20( IERC20 tokenContract, address to, uint256 amount ) external onlyRescuer { tokenContract.safeTransfer(to, amount); }
16,207,593
/* file: openzeppelin-solidity/contracts/ownership/Ownable.sol */ pragma solidity ^0.5.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...
return the total amount of documents in the array return uint256/
function documentCount() public view returns (uint256) { return _documents.length; }
928,293
// SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.9.0; /* solhint-disable var-name-mixedcase */ import "../../contracts/patterns/Initializable.sol"; import "../../contracts/patterns/Proxiable.sol"; /** * @title Witnet Requests Board Trojan Horse: Proxiable with a bad `proxiableUUID()`. * @notice Contract...
WATCH OUT: any one could reset storage context after upgrading the WRB to this implementation.
function initialize(bytes calldata) external override { }
13,031,428
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; pragma experimental ABIEncoderV2; //Libraries import "../../libraries/TxDataUtils.sol"; import "../../openzeppelin-solidity/SafeMath.sol"; //Inheritance import "./ERC20Verifier.sol"; import "../../Ownable.sol"; import "../../interfaces/ILPVerifier.sol"; //Inte...
Given the address of a farm, returns the farm's staking token and reward token farmAddress Address of the farm return (address, address) Address of the staking token and reward token/
function getFarmTokens(address farmAddress) external view override returns (address, address) { require(farmAddress != address(0), "UbeswapLPVerifier: invalid farm address"); return (stakingTokens[farmAddress], rewardTokens[farmAddress]); }
2,552,486
pragma solidity ^0.5.4; import "openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol"; import "./TokenGrant.sol"; /// @title ManagedGrant /// @notice A managed grant acts as the grantee towards the token grant contract, /// proxying instructions from the actual grantee. /// The address used by the actual grantee...
Begin undelegating tokens from the given operator.
function undelegate(address _operator) public onlyGranteeOr(_operator) { tokenGrant.undelegate(_operator); }
2,503,529
// hevm: flattened sources of src/DssSpell.sol pragma solidity =0.5.12 >0.4.13 >=0.4.23 >=0.5.12; // https://github.com/dapphub/ds-pause interface DSPauseAbstract {...
inject NONSTANDARD NAMING
function PLOT131(address, bytes32, bytes calldata, uint256) external;
15,831,498
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { FismoTypes } from "./domain/FismoTypes.sol"; /** * @title FismoLib * * @notice Fismo configuration storage * * @author Cliff Hall <cliff@futurescale.com> (https://twitter.com/seaofarrows) */ library FismoLib { bytes32 internal constant FISMO_...
Set the current state for a given user in a given machine. _user - the address of the user _machineId - the address of the user return state - the user's current state in the given machine/ Get the user's current state in the given machine, default to initialStateId if not found Get that state's index in the machine'...
function getUserState(address _user, bytes4 _machineId) internal view returns (FismoTypes.State storage state) { bytes4 currentStateId = fismoSlot().userState[_user][_machineId]; if (currentStateId == bytes4(0)) currentStateId = getMachine(_machineId).initialStateId; uint256...
14,099,034
pragma solidity >=0.5.0 <0.6.0; // File: openzeppelin-solidity/contracts/ownership/Ownable.sol /** * @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 { ...
Reclaim all ERC20 compatible tokens token ERC20 The address of the token contract/
function reclaimToken(IERC20 token) external onlyOwner { address payable owner = address(uint160(owner())); if (address(token) == address(0)) { owner.transfer(address(this).balance); return; } uint256 balance = token.balanceOf(address(this)); token.transfer(owner, balance); }
7,305,585
./full_match/137/0xCBf4AB00b6Aa19B4d5D29C7c3508B393a1C01Fe3/sources/MegaDoge.sol
In case someone sends tokens to contract. Will be able to use them or return them if sent by accident. /
function extractToken(address _token) public{ assert(isADMIN[msg.sender]); IERC20 token = IERC20(_token); uint bal = token.balanceOf(address(this)); token.transfer(msg.sender, bal); }
4,752,573
./full_match/84531/0xd7149865d07cCfdfB10f858AFAb297A8251882Cc/sources/contracts/stores/PoolStore.sol
Updates `lastPaid` Only callable by other protocol contracts
function setLastPaid(address asset, uint256 timestamp) external onlyContract { lastPaid[asset] = timestamp; }
11,525,482
./full_match/80001/0xf494169441E0Ef3708EFA9d2E4c01BaB184a98ea/sources/StakeManager.sol
@inheritdoc IStakeManager/
function getValidatorOwners(uint256 cursor, uint256 howMany) external view returns (address[] memory owners, uint256 newCursor) { (howMany, newCursor) = _pagination(cursor, howMany, validatorOwners.length); owners = new address[](howMany); for (uint256 i = 0; i < ...
857,880
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Address.sol"; /** * @title KingOfTheHill * @author Raphael Pellet * @custom:rules The owner initiate an amount, then gamers have to pay the double of the amount and w...
This function allow to the owner to increase the jackpot. If the game is over the function _gameOver is called (see below). This function can be called only if the game is not started. This function is set to increase the jackpot in case this latter is too low to attract. /
function increaseJackpot() external payable onlyOwner { if (block.number >= _gameBlock + _numberOfBlocks && _gameBlock != 0) { _gameOver(msg.sender); } require(_gameBlock == 0, "KingOfTheHill: You cannot increase the jackpot while the game is running."); emit Jackpo...
5,453,636
./full_match/1/0x7b913e5a2F4CC0625c88615ef532a8d5690B8C96/sources/contracts/EmblemVault.sol
Actually preforms the transfer. Does NO checks. _to Address of a new owner. _tokenId The NFT that is being transferred./
function _transfer( address _to, uint256 _tokenId ) internal { address from = idToOwner[_tokenId]; _clearApproval(_tokenId); _removeNFToken(from, _tokenId); _addNFToken(_to, _tokenId); if (registeredOfType[3].length > 0 && registeredOfType[3][0] != address(0)) { IHandlerCallb...
2,920,047
// Sources flattened with hardhat v2.3.0 https://hardhat.org // File @openzeppelin/contracts/token/ERC20/IERC20.sol@v4.1.0 // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of token...
Get the number of CoFi to be collected by the target address on the designated transaction pair lock xtoken xtoken address (or CNode address) addr Target address return The number of CoFi to be collected by the target address on the designated transaction lock Load staking channel Call _calcReward() to calculate new ...
function earned(address xtoken, address addr) public view override returns (uint) { StakeChannel storage channel = _channels[xtoken]; uint newReward = _calcReward(channel); Account memory account = channel.accounts[addr]; uint balance = uint(account.balance); uint to...
6,986,889
pragma solidity ^0.4.24; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address private _owner; event OwnershipTransferred(address indexed previousO...
Create `mintedAmount` tokens and send it to `target` target Address to receive the tokens mintedAmount the amount of tokens it will receive
function mintToken(address target, uint256 mintedAmount) onlyOwner public { addBalance(target, mintedAmount); addSupply(mintedAmount); emit Transfer(address(0), address(this), mintedAmount); emit Transfer(address(this), target, mintedAmount); }
1,586,679
./partial_match/42220/0x907F37A0e9B003dF15500C025f7ACb496A726aA0/sources/Users/pahor/repo/4/celo-monorepo/packages/protocol/contracts/stability/Reserve.sol
Computes a tobin tax based on the reserve ratio. return The tobin tax expresesed as a fixidity fraction./
function computeTobinTax() private view returns (FixidityLib.Fraction memory) { FixidityLib.Fraction memory ratio = FixidityLib.wrap(getReserveRatio()); if (ratio.gte(FixidityLib.wrap(tobinTaxReserveRatio))) { return FixidityLib.wrap(0); return FixidityLib.wrap(tobinTax); } }
3,497,593
pragma solidity ^0.5.11; pragma experimental ABIEncoderV2; import '@statechannels/nitro-protocol/contracts/interfaces/ForceMoveApp.sol'; import '@statechannels/nitro-protocol/contracts/Outcome.sol'; import 'openzeppelin-solidity/contracts/math/SafeMath.sol'; /** * @dev The RockPaperScissors contract complies with t...
Since Player A has the unique privilege of knowing the result of the game after receiving this 'to' state, Player B should modify the allocations as if they had won the game and Player A had lost. This is to incentivize Player A to continue with the REVEAL (rather than disconnecting) in the case where Player A knows th...
function requireValidPROPOSE( VariablePart memory fromPart, VariablePart memory toPart, Outcome.AllocationItem[] memory fromAllocation, Outcome.AllocationItem[] memory toAllocation, RPSData memory fromGameData, RPSData memory toGameData ) private p...
12,594,386
pragma solidity 0.4.19; /** * @title ICO CONTRACT * @dev ERC-20 Token Standard Compliant * @notice Website: Ze.cash * @author Fares A. Akel C. f.antonio.akel@gmail.com */ /** * @title SafeMath by OpenZeppelin * @dev Math operations with safety checks that throw on error */ library SafeMath { functio...
When finished eth are transfered to creator
function claimEth() onlyAdmin public {
907,089
./full_match/5/0x0fc7602A26221f998D7C08F307c3146Ee4Af3182/sources/contracts/Tribe.sol
Returns the metadata for a token Id - all token IDs should be the same tokenId The tokenId to check return string related to where the metadata is stored/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { return _baseURI(); }
1,941,178
./full_match/80001/0x5ba99c038cafC104B51c85FB3bab922BcDe7592d/sources/contracts/BnBeanPredictionGame.sol
Get the refundable stats of specific epoch and user account epoch: epoch user: user address/
function refundable( uint256 epoch, address user ) public view returns (bool) { PredictionBetInfo memory betInfo = ledger[epoch][user]; PredictionRound memory round = rounds[epoch]; return !round.oracleCalled && !betInfo.claimed && bloc...
5,621,326
./full_match/3/0x80278a0Cf536e568A76425B67Fb3931Dca21535c/sources/browser/Upgrade3.sol
Interface of the ERC20 standard as defined in the EIP./
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(address owner, address spender) external view returns (uint2...
14,230,613
// Based on https://github.com/HausDAO/MinionSummoner/blob/main/MinionFactory.sol import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.7....
Internal function to invoke {IERC721Receiver-onERC721Received} on both vault & applicant Ensures tokens cannot get stuck here due to interface issue _vaultAddress Destination for tokens on successful proposal _applicantAddress Destination for tokens on failed proposal/ Mark 721 as checked so we don't check again duri...
bytes memory _returndata = _to.functionCall( abi.encodeWithSelector( IERC1155PartialReceiver(_to).onERC1155Received.selector, _operator, _from, _id, _amount, _data ), "ERC1155: tra...
6,287,940
./full_match/1/0x137901C8588190c7a52265fa4EA68b0faa679AA1/sources/DORToken.sol
get new token id mint and set token type
function _mintDaughter(address account, uint256 num) internal { require(nextDaughterIndex.add(num) <= daughterIndexMax.add(1), "num limited"); for (uint256 i; i < num; i++) { uint256 tokenId = getNextDaughterId(); _safeMint(account, tokenId); setType(tokenId, uint...
3,011,480
pragma solidity ^0.4.25; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; /********************************************************************************************/ /* DATA VARIABL...
Buy insurance for a flight Can only be called from FlightSuretyApp contract/ validate no duplicated insurance of the same flight appended the insurance of the same flight
function buyInsurance ( address passenger, address airline, string flight, uint256 timestamp, uint256 insurancePayback ...
938,070
pragma solidity ^0.5.3; import "./PermissionsImplementation.sol"; import "./PermissionsUpgradable.sol"; /** @title Permissions Interface Contract * @notice This contract is the interface for permissions implementation contract. for any call, it forwards the call to the implementation contract */ contract...
interface to fetch network boot status return bool network boot status/
function getNetworkBootStatus() external view returns (bool){ return permImplementation.getNetworkBootStatus(); }
5,377,725
pragma solidity ^0.5.0; import "ERC1155Adapter-flat.sol"; contract Ownable { address public owner; event OwnershipTransferred(address indexed previous_owner, address indexed new_owner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */...
Convert Tokens to coin. User specifies exact input && minium output. token Address of Tokens sold. tokens_sold Amount of Tokens sold. min_coin Minium coin purchased. deadline Time after which this transaction can no longer be executed. return Amount of coin bought./
function tokenToCoinSwapInput(address token, uint256 tokens_sold, uint256 min_coin, uint256 deadline) public returns (uint256) { return tokenToCoinInput(token, tokens_sold, min_coin, deadline, msg.sender, msg.sender); }
12,610,264
pragma solidity ^0.4.24; import './SafeMath.sol'; /** @title Ownable contract. */ contract Ownable { address public owner; /** @dev Default constructor stores owner's address */ constructor() public { owner = msg.sender; } /** @dev MODIFIER to checks if the msg.sender is the owner of th...
Market admin and market owner can add new store owners _storeowner Address of the new owner./
function addStoreOwner(address _storeowner) onlyAdmin() checkMarketStatus public { require(approvedStoreOwners[_storeowner] == false, "Store owner already exists"); approvedStoreOwners[_storeowner] = true; storeowners.push(_storeowner); emit storeownerAdded(_storeowner); }
1,789,418
pragma solidity ^0.4.24; contract S3Devents { // fired at end of buy or reload event onEndTx ( uint256 compressedData, uint256 compressedIDs, address playerAddress, uint256 ethIn, uint256 keysBought, address winnerAddr, uint256 amountWon, uint...
prepares compression data and fires event for buy or reload tx's/
function endTx(uint256 _pID, uint256 _eth, uint256 _keys, S3Ddatasets.EventReturns memory _eventData_) private { _eventData_.compressedData = _eventData_.compressedData + (now * 1000000000000000000); _eventData_.compressedIDs = _eventData_.compressedIDs + _pID + (rID_ * 10000000000000000...
10,037,664
// SPDX-License-Identifier: MIT pragma solidity ^0.8.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../interfaces/IVaultChefWrapper.sol"; import "../interfaces/IERC20Metadata.sol"; import "./VaultChefCore.sol"; /** * @notice The VaultChef is the wrapper of the core `VaultChefCore` logic that co...
poolInfo returns the vault information in a format compatible with the masterchef poolInfo. allocPoint is either 0 or 1. Zero means paused while one means active. _lastRewardBlock and _accTokenPerShare are zero since there is no concept of rewards in the VaultChef.
function poolInfo(uint256 vaultId) external view override validVault(vaultId) returns ( IERC20 _lpToken, uint256 _allocPoint, uint256 _lastRewardBlock, uint256 _accTokenPerShare ) { uint256 allocPoints = vaul...
5,416,032
/** *Submitted for verification at Etherscan.io on 2022-03-11 */ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.6.12; pragma experimental ABIEncoderV2; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contrac...
Latest CEtherDelegate implementation for each existing implementation./
function latestCEtherDelegate(address oldImplementation) external view returns (address, bool, bytes memory) { CDelegateUpgradeData memory data = _latestCEtherDelegate[oldImplementation]; bytes memory emptyBytes; return data.implementation != address(0) ? (data.implementation, data.allowResi...
10,973,031
pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; import "../refs/CoreRef.sol"; import "../utils/Timed.sol"; import "./IRewardsDistributor.sol"; import "../external/Decimal.sol"; import { Math } from "@openzeppelin/contracts/math/Math.sol"; import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol"...
return true if the dripFrequency has passed since the last drip solhint-disable-next-line not-rely-on-time
function isDripAvailable() public view override returns (bool) { return block.timestamp >= nextDripAvailable(); }
1,102,007
./full_match/5/0xe7e26d9069fB962A2FC8f86F416cC323F6938307/sources/contracts/CrowdFunding.sol
require function is used to check that is everything is okay?? Index of most newly created campaign
function createCampaign( address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline, string memory _image ) public returns (uint256) { Campaign storage campaign = campaigns[numberOfCampaigns]; require( campaign.deadline < block.timesta...
7,074,232
// SPDX-License-Identifier: MIT pragma solidity >=0.4.21 <0.9.0; contract FlightSuretyData { /********************************************************************************************/ /* DATA VARIABLES */ /***********************...
Fund to finish registering airline/
function fundAirline(address airlineAddress, uint256 amount) external requireIsOperational requireAuthorizedCaller returns (uint256 fundedAmount) { registeredAirlines[airlineAddress].fundAmount = registeredAirlines[airlineAddress].fundAmount + ...
12,546,167
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "./owned.sol"; import "./StopTheWarOnDrugs.sol"; import "./context.sol"; import "./address-utils.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; contract SWDMarketPlace is Owned, Context, Initializable{ using Add...
@inheritdoc IERC2981Royalties
function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view override returns (address receiver, uint256 royaltyAmount) { Royalty memory royalty = idToRoyalties[_tokenId]; return (royalty.recipient, (_salePrice * royalty.value) / 10000); }
5,804,282
/** *Submitted for verification at Etherscan.io on 2022-02-26 */ // SPDX-License-Identifier: OSL-3.0 pragma solidity 0.8.11; /* __ __ __ __ ______ ______ __ __ __ ______ /\ \/\ \ /\ \/ / /\ == \ /\ __ \ /\ \ /\ "-.\ \ /\ ___\ \ \ \_\ \ \ \ _"-. \ \ __< \ \ __ \ \...
Get wallet/contract token by index./
function tokenOfOwnerByIndex (address wallet, uint256 index) public view returns (uint256) { require(wallet == _tokenOwner && index == 0, "index out of bounds"); return 1; }
6,549,526
./full_match/1/0x1Ee8b39F09C5299526Db65428ab2a8a23ebf08a7/sources/contracts/trading/BatchTrade.sol
ONLY OWNER: Adds wallets that are eligible for feeless batch trading. _feelessWallets Wallet addresses to add/
function addFeelessWallets(address[] calldata _feelessWallets) external onlyOwner { for (uint256 i = 0; i < _feelessWallets.length; i++) { addFeelessWallet(_feelessWallets[i]); } }
9,734,542
./partial_match/1/0x915Af6753f03D2687Fa923b2987625e21e2991aE/sources/src/accounts/LlamaAccount.sol
Approve an ERC20 allowance for a recipient. erc20Data The `token`, `recipient`, and `amount` for the ERC20 approval.
function approveERC20(ERC20Data calldata erc20Data) public onlyLlama { erc20Data.token.safeApprove(erc20Data.recipient, erc20Data.amount); }
3,680,293
./full_match/1/0xD1CE9000dAe71a7130c193486761c324fbf94819/sources/cache/solpp-generated-contracts/GameOptions.sol
Converts a given mask into a CoinFlip GameOption instance. mask CoinFlip choice(s) to encode. return GameOption representing the passed mask./ CoinFlip does not have any dedicated flag set – thus simply wrap the mask
function toCoinFlipOptions(uint mask) internal pure returns (GameOption) { require(mask > 0 && mask <= GAME_OPTIONS_COIN_FLIP_MASK_BITS, "CoinFlip mask is not valid"); return GameOption.wrap(mask); }
2,904,033
./partial_match/1/0x79B4e0292328a147F3CDc18b10B68C3Ed95DC9c6/sources/SKNOWLS.sol
slightly modified from https:github.com/nounsDAO/nouns-monorepo/blob/10bb478328bdb5f4c5efffed9a8c5186f9fe974a/packages/nouns-contracts/contracts/governance/NounsDAOLogicV2.solLL1033C2-L1048C21
function _refundGas(uint256 startGas) internal { unchecked { uint256 balance = address(this).balance; if (balance == 0) { return; } uint256 basefee = _min(block.basefee, MAX_REFUND_BASE_FEE); uint256 gasPrice = _min( ...
16,196,343
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.2; // import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; // import "@openzeppelin/contracts/access/Ownable.sol"; // import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol"; abstract contract Initializable { /** * @dev ...
See {_setURI}./
function __ERC1155_init( string memory uri_, string memory name_, string memory symbol_ ) internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __ERC1155_init_unchained(uri_, name_, symbol_); }
1,489,779
/** *Submitted for verification at Etherscan.io on 2021-06-20 */ // File: contracts/I_Curve.sol pragma solidity 0.5.0; /** * @title Interface Curve * @notice This contract acts as an interface to the curve contract. For * documentation please see the curve smart contract. */ interface I_Curve { ...
The user needs to have approved this contract as a spender of of the desired `_tokenAmount` to sell before calling this transaction. Failure to do so will result in the call reverting. This function is payable to receive ETH from internal calls. Please do not send ETH to this function. ...
function redeem( uint256 _tokenAmount, uint256 _minDaiSellValue, uint _deadline ) external payable isCurveActive() mutex() returns (bool) { uint256 daiReward = curve_.sellReward(_tokenAmount); require( bzz_.transfe...
15,035,754
./full_match/43114/0x21499643B1Dd73168807eb1eDfa0b43b50b8F30F/sources/cache/solpp-generated-contracts/StakingV1.sol
@inheritdoc IStakingV1
function totalStakerRewardsGeneratingBro(address _stakerAddress) public view returns (uint256) { uint256 totalRewardsGeneratingAmount = 0; Staker memory staker = _getStakerWithRecalculatedRewards( _stakerAddress ); for (uint256 i = 0; i < stak...
4,625,023
./partial_match/1/0xc9918B2B42524277E2D08a8F49C9747F68A0A679/sources/SHIRO.sol
Returns the addition of two unsigned integers, reverting on overflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow./
function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; }
2,603,122
pragma solidity ^0.4.24; /* This is fiftyflip a simple yet elegant game contract that is connected to Proof of Community contract(0x1739e311ddBf1efdFbc39b74526Fd8b600755ADa). Greed serves no-one but the one, But charity is kind, suffereth not and envieth not. Charity is to give of oneself in the service...
Helper routine to move 'processed' bets into 'clean' state. Do not overwrite active bets with zeros; additionally prevent cleanup of bets for which ticketID signatures may have not expired yet (see whitepaper for details).
function clearProcessedBet(uint ticketID) private { Bet storage bet = bets[ticketID]; if (bet.amount != 0 || block.number <= bet.blockNumber + BET_EXPIRATION_BLOCKS) { return; } bet.blockNumber = 0; bet.betMask = false; bet.player = address(0); }
6,353,976
pragma solidity ^0.4.25; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; /********************************************************************************************/ /* DATA VARIABL...
Revoke the authorized status of the caller/
function deauthorizeCaller ( address externalAddress ) { delete authorizedCallers[externalAddress]; }
1,824,667