file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@unification-com/xfund-router/contracts/lib/ConsumerBase.sol"; import "./interfa...
Returns the integer division of two unsigned integers, reverting on division by zero. The result is rounded towards zero. Counterpart to Solidity's `/` operator. Note: this function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remaining gas...
function saveDiv(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; }
1,496,177
pragma solidity >=0.4.4; import 'truffle/Assert.sol'; import '../contracts/Common.sol'; import '../contracts/ICO.sol'; import '../contracts/FirstSale.sol'; contract Person { ICO ico; function Person(address _ico) { ico = ICO(_ico); } function deposit() payable { ico.deposit.value(msg...
two people deposit max so each should get half backone tries to do it twice via reentrance
function testThrowReentrantAttack () { uint weis = 1000; con.startSampleSale(); ico.setFakeTime(4 days); p1.deposit.value(weis)(); Attacker a2 = new Attacker(ico); a2.deposit.value(weis)(); ico.addDays(20); a2.claim(); p1.claim(); ...
15,807,575
./full_match/80001/0xB3CB2E91eDD65692eee7429E294bDE816855D20A/sources/contracts/ERC721BaseOptimized.sol
See {ERC721-setApprovalForAll}.
function setApprovalForAll( address operator, bool approved ) public virtual override(ERC721A) onlyAllowedOperatorApproval(operator) { super.setApprovalForAll(operator, approved); }
5,667,262
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is dis...
Convert a 16-bit value to full FixedPoint/
function uncompress16(uint256 value) internal pure returns (uint256) { return value.mulUp(FixedPoint.ONE).divUp(type(uint16).max); }
949,626
pragma solidity 0.5.17; 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 spend...
solium-disable-next-line security/no-low-level-calls
function safeERC20Call(address tokenAddress, bytes memory callData) internal { (bool success, bytes memory returndata) = address(tokenAddress).call( callData ); require(success, string(returndata)); if (returndata.length > 0) { require(a...
7,493,826
./full_match/1/0x341956C0c653d3348f86d6278f10dD52071312EE/sources/browser/CETO.sol
Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address./
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { return true; }
8,410,970
// SPDX-License-Identifier: MIT /** * @authors: [@hbarcelos] * @reviewers: [@ferittuncer*, @fnanni-0, @nix1g] * @auditors: [] * @bounties: [] * @deployments: [] */ pragma solidity ^0.7.2; import "@kleros/erc-792/contracts/IArbitrator.sol"; import "@kleros/erc-792/contracts/IArbitrable.sol"; import "@klero...
Changes the terms of service for Realitio. _termsOfService URI to the new Terms of Service file./
function changeTermsOfService(string calldata _termsOfService) external onlyGovernor { termsOfService = _termsOfService; }
2,472,519
// SPDX-License-Identifier: MIT pragma solidity 0.6.2; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/payment/PullPayment.sol"; import "./ConsortiumAlliance.sol"; /** * @title FlightInsuranceHandler * @dev Provides sp...
Requests flight information to Oracles./
function requestFlightStatus(bytes32 flightKey) external onlyOperational { uint8 index = _getRandomIndex(msg.sender); bytes32 responseKey = _getResponseKey(index, flightKey); oracleResponses[responseKey] = ResponseInfo({ requester: msg.sender, isOpen: true })...
13,086,773
./full_match/4/0x71BBe2d203dc57e6B1877CD336b74ccb3384a097/sources/contracts/Koiboi.sol
this is overriding an empty function in ERC721.sol It is also internal. Use tokenURI for the public external
function _baseURI() internal view virtual override returns (string memory) { return _current_baseURI; }
765,694
pragma solidity ^0.5.9; import "./DelightBuildingManagerInterface.sol"; import "./DelightManager.sol"; import "./DelightArmyManager.sol"; import "./DelightItemManager.sol"; import "./Util/SafeMath.sol"; contract DelightBuildingManager is DelightBuildingManagerInterface, DelightManager { using SafeMath for uint; /...
νŠΉμ • μœ„μΉ˜μ˜ 건물의 버프 데미지λ₯Ό λ°˜ν™˜ν•©λ‹ˆλ‹€. 탑인 경우 버프 λ°λ―Έμ§€λŠ” 20
function getBuildingBuffDamage(uint col, uint row) view external returns (uint) { uint buildingId = positionToBuildingId[col][row]; if (buildingId != 0) { if (buildings[buildingId].kind == BUILDING_TOWER) { return 20; } } return 0; }
1,027,473
pragma solidity 0.5.17; 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) extern...
Withdraw partial funds, normally used with a vault withdrawal
function withdraw(uint256 _amount) external { require(msg.sender == controller, "!controller"); address _vault = IController(controller).vaults(address(want)); uint256 _balance = IERC20(want).balanceOf(address(this)); if (_balance < _amount) { _amount = _withdrawSome(_am...
5,377,435
pragma solidity ^0.8.1; // SPDX-License-Identifier: GPL-3.0-only // importing latest version, rather than a commit-specific version, while I'm developing in parallel. // a particular commit should be set once this get concretized. import "https://github.com/swaldman/open-first-price-auction/blob/main/src/main/solidit...
see https:eattheblocks.com/how-to-manipulate-strings-in-solidity/
function concat( string memory a, string memory b ) internal pure returns(string memory) { return string(abi.encodePacked(a, b)); }
12,853,166
./partial_match/1/0xae248D0dCC7503126744b510D9B6703F1CaC8870/sources/DoubleEndedQueue.sol
Return the item at a position in the queue given by `index`, with the first item at 0 and last item at `length(deque) - 1`. Reverts with `OutOfBounds` if the index is out of bounds./ int256(deque._begin) is a safe upcast
function at(Bytes32Deque storage deque, uint256 index) internal view returns (bytes32 value) { int128 idx = SafeCast.toInt128(int256(deque._begin) + SafeCast.toInt256(index)); if (idx >= deque._end) revert OutOfBounds(); return deque._data[idx]; }
3,723,193
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity 0.6.12; import "./interfaces/IBancorFormula.sol"; import "../utility/SafeMath.sol"; contract BancorFormula is IBancorFormula { using SafeMath for uint256; uint256 private constant ONE = 1; uint32 private constant MAX_WEIGHT = 1000...
deprecated, backward compatibility/
function calculateCrossConnectorReturn(uint256 _sourceReserveBalance, uint32 _sourceReserveWeight, uint256 _targetReserveBalance, uint32 _targetReserveWeight, ...
1,786,851
pragma solidity ^0.4.11; import "./Token/Token.sol"; import "./lib/ECVerify.sol"; /// @title Raiden MicroTransfer Channels Contract. contract RaidenMicroTransferChannels { /* * Data structures */ address public owner; address public token_address; uint8 public challenge_period; string...
Function for getting information about a channel. _sender The address that sends tokens. _receiver The address that receives tokens. _open_block_number The block number at which a channel between the sender and receiver was created. return Channel information (unique_identifier, deposit, settle_block_number, closing...
function getChannelInfo( address _sender, address _receiver, uint32 _open_block_number) external constant returns (bytes32, uint192, uint32, uint192) { bytes32 key = getKey(_sender, _receiver, _open_block_number); require(channels[key].open_block_n...
12,973,262
// SPDX-FileCopyrightText: 2021 ShardLabs // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.7; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/I...
Returns the address of the nft contract Returns the validator accumulated rewards on stake manager. SPDX-FileCopyrightText: 2021 ShardLabs SPDX-License-Identifier: GPL-3.0 PoLidoNFT interface. 2021 ShardLabs
interface IPoLidoNFT is IERC721Upgradeable { function mint(address _to) external returns (uint256); function burn(uint256 _tokenId) external; function isApprovedOrOwner(address _spender, uint256 _tokenId) external view returns (bool); function setStMATIC(address _stMATIC) exte...
11,789,401
./partial_match/4/0x1116b09D790D897704346cd72a05aAA384802192/sources/home/robert/Github/smartys-develop/truffle-blokko/contracts/BlokkoOrder.sol
Scenario green: cancelled within delivery time Scenario red: cancelled outside delivery time
function cancelOrder(bytes memory userData) public { uint256 _selectedOrderID = bytesToUint(userData); uint256 _deliveryEnd = uint64(block.timestamp); uint256 _totalAmount = orders[_selectedOrderID].transportAmount.add(orders[_selectedOrderID].orderAmount); require(msg.sender == ord...
8,629,199
./full_match/1/0x6C5c2c8776Ecc5943760C68a200eC7e3650eFC2F/sources/contracts/paymaster/TokenPaymaster.sol
Sets the token whitelist mode for the specified token. token The address of the token to set the whitelist mode for mode Boolean value to set the token whitelist mode to whitelist (true) or blacklist (false)/
function setTokenWhitelistMode(address token, bool mode) public payable { _setTokenWhitelistMode(token, msg.sender, mode); emit SetTokenWhitelistMode(token, msg.sender, mode); }
16,537,833
./partial_match/1/0x7D464cc85C960De8D3A909Cdc1a0A163412C0348/sources/CatnipV2.sol
Set the mining difficulty for catnipV2 mining. _amount New difficulty amount./
function setMiningDifficulty(uint256 _amount) public _onlyOwner delegatedOnly { miningDifficulty = _amount; }
2,838,587
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "./helpers.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract InstaVaultResolver is Helpers { struct VaultInfo { address token; uint8 decimals; uint256 tokenMinLimit; address atoken; a...
TODO: dont take flashloan if not needed
function rebalanceTwoData(address vaultAddr_) public view returns ( address flashTkn_, uint256 flashAmt_, uint256 route_, uint256 saveAmt_, uint256 tokenSupplyAmt_ ) { VaultInterface vault_ = VaultInterface(vault...
6,170,048
pragma solidity ^0.4.13; contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public constant returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } contract ERC20 is ERC20Ba...
Release a part of the frozen token(totalSupply - releasedSupply) every 26 weeks. return An uint256 representing the amount./
function release() public whenNotPaused returns(uint256 _releaseAmount) { require(nextReleaseTime <= now); uint256 releaseAmount = 0; uint256 remainderAmount = totalSupply.sub(releasedSupply); if (remainderAmount > 0) { releaseAmount = standardDecimals.mul(nextReleaseAmount); if (releaseA...
13,550,924
// SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity 0.7.5; import "../libraries/Address.sol"; import "../libraries/SafeMath.sol"; import "../libraries/SafeERC20.sol"; import "../interfaces/IERC20.sol"; import "../interfaces/ITreasury.sol"; import "../types/Ownable.sol"; interface IMasterChef { function...
add new PID and corresponding liquidity pool _pool address _pid uint/
function addPool(address _pool, uint256 _pid) external onlyOwner { require(_pool != address(0)); require(pools[_pid] == address(0)); pids.push(_pid); pools[_pid] = _pool; }
14,026,014
./partial_match/1/0x926C777c091a5A070dC24ac94fF498b5a556f92A/sources/contracts/periphery/SmardexRouter.sol
@inheritdoc ISmardexRouter refund dust eth, if any
function addLiquidityETH( AddLiquidityETHParams calldata _params, address _to, uint256 _deadline ) external payable virtual override ensure(_deadline) returns (uint256 amountToken_, uint256 amountETH_, uint256 liquidity_) { AddL...
4,280,003
./partial_match/1/0x3B3812BB9f6151bEb6fa10783F1ae848a77a0d46/sources/CollateralErc20.sol
scale up before entering the system.
function deposit( address borrower, uint id, uint amount ) external { require(amount <= IERC20(underlyingContract).allowance(msg.sender, address(this)), "Allowance not high enough"); IERC20(underlyingContract).transferFrom(msg.sender, address(this), amount); uin...
2,762,253
pragma solidity ^0.4.18; /** * Ponzi Trust Token Smart Contracts * Code is published on https://github.com/PonziTrust/Token * Ponzi Trust https://ponzitrust.com/ */ import "./SafeMath.sol"; // see: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md contract ERC20 { function name() public view returns (str...
Set state of contract working. newState String representation of new state./ if newState not valid string
function setState(string newState) external onlyOwner() checkAccess() { if (keccak256(newState) == keccak256(PRE_SALE_STR)) { m_state = State.PreSale; if (m_firstEntranceToSaleStateUNIX == 0) m_firstEntranceToSaleStateUNIX = now; m_state = State.Sale; m_st...
957,273
pragma solidity 0.4.24; contract SmartContractTest { function multiplyWithSeven (uint256 a) public pure returns(uint) { return a * 7; } // uint, int: synonyms for uint256, int256 respectively (not to be used for computing the function selector). function multiplyWithSevenUsingAlias (uint a) pu...
uint, int: synonyms for uint256, int256 respectively (not to be used for computing the function selector).
function multiplyWithSevenUsingAlias (uint a) public pure returns(uint) { return a * 7; }
993,583
pragma solidity ^0.5.0; import "./GameToken.sol"; import "./DrawToken.sol"; contract Tetris{ address payable public owner; bool isFinished = false; address cel; uint private max=5;//이 인원이 꽉차면 roleVoting이 λŒμ•„κ°„λ‹€. mapping(address=>bool) blockUser; mapping(address=>uint) userCounts; //각 μœ μ €μ˜...
λˆ„μ μ μˆ˜λ₯Ό μ΄μš©ν•΄μ„œ 이더λ₯Ό λ°›λŠ” μŠ€λ§ˆνŠΈμ»¨νŠΈλž™.ν•˜μš°μŠ€ μ΄λ”μ—μ„œ μ‚¬μš©μžν•œν…Œ κ°„λ‹€. λ°°ν¬μžκ°€ λ³΄λ‚΄λŠ”κ±΄ γ„΄γ„΄
function getEther(uint money)external{ require(lockMoney > money,"we don't have enough ether"); lockMoney -= money; GameToken(tokenAddress[0]).Token(msg.sender, money); }
12,647,671
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contrac...
Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements: - `to` cannot be the zero address./
function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); }
456,099
/* ___ _ ___ _ | .\ ___ _ _ <_> ___ | __><_>._ _ ___ ._ _ ___ ___ | _// ._>| '_>| ||___|| _> | || ' |<_> || ' |/ | '/ ._> |_| \___.|_| |_| |_| |_||_|_|<___||_|_|\_|_.\___. * PeriFinance: EtherCollateral.sol * * Latest source (may be newer): h...
Acccount that created the loan Amount (in collateral token ) that they deposited Amount (in pynths) that they issued to borrow When the loan was created ID for the loan When the loan was paidback (closed)
function aggregators(bytes32 currencyKey) external view returns (address); function aggregatorWarningFlags() external view returns (address); function anyRateIsInvalid(bytes32[] calldata currencyKeys) external view returns (bool); function canFreezeRate(bytes32 currencyKey) external view returns (boo...
11,952,780
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../interfaces/IBearable.sol"; import "../tokens/TwoBitBears.sol"; /// @title Bearable base contract for accessing a deployed TwoBitBears ERC721 /// @dev You may inherit or deploy separately contract Bearable is IBearable { /// @dev Stores the address t...
@inheritdoc IBearable Throws if the token ID is not valid. Requirements already handled by the .details() call
function bearMood(uint256 tokenId) public view override returns (BearMoodType) { IBearDetail.Detail memory details = _twoBitBears.details(tokenId); return BearMoodType(details.moodIndex); }
13,007,017
pragma solidity ^0.5.16; // Inheritance import "./Owned.sol"; import "./SelfDestructible.sol"; import "./MixinResolver.sol"; import "./MixinSystemSettings.sol"; import "./interfaces/IExchangeRates.sol"; // Libraries import "./SafeDecimalMath.sol"; // Internal references // AggregatorInterface from Chainlink represen...
0 < lowerLimit < entryPoint => 0 < entryPoint then we are adding a new inverse pricing, so add this When indicating to freeze, we need to know the rate to freeze it at - either upper or lower this is useful in situations where ExchangeRates is updated and there are existing inverted rates already frozen in the current ...
function setInversePricing( bytes32 currencyKey, uint entryPoint, uint upperLimit, uint lowerLimit, bool freezeAtUpperLimit, bool freezeAtLowerLimit ) external onlyOwner { require(lowerLimit > 0, "lowerLimit must be above 0"); require(upperLimit > ...
12,682,452
./full_match/1/0xA1E4ff1Fd20c49C958D0d6d9EA93adB220D2b675/sources/contracts/GracyStaking.sol
Methods for time ranges
function addTimeRange( uint256 _amount, uint256 _startTimestampDay, uint256 _endTimestampDay ) external onlyOwner { uint256 length = pool.timeRanges.length; if (length > 0) { if (_startTimestampDay != pool.timeRanges[length-1].endTimestampDay) revert Sta...
2,922,040
/** *Submitted for verification at Etherscan.io on 2021-09-04 */ // File: @openzeppelin/contracts/utils/introspection/IERC165.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementer...
Mints a token to an address with a tokenURI. _to address of the future owner of the token/
function mintTo(address _to, uint256 _numItemsAllocated, bool isRandom, uint256 data) public virtual onlyOwner { uint256 newTokenId = _getNextTokenId(); for (uint256 i = 0; i < _numItemsAllocated; i++) { _mint(_to, newTokenId + i); } _incrementTokenId(_numItemsAllocated);...
7,895,250
./full_match/42/0x452d3623e3D87fEfB2534b516e0B259BA4993181/sources/PreachersCompFiLqdt.sol
Aave/ _asset is an address of an asset that we want to borrow using a flash loan, for example, ETH or DAI.
function flashloan( address _asset, uint256 _amount, bytes memory _params) public onlyOwner() { ILendingPool lendingPool = ILendingPool( kLendingPool ); lendingPool.flashLoan(address(this), _asset, _amount, _params); }
9,584,815
./full_match/80001/0xaC707F19F58D156FB70667BBa9FcDF2519a2fA78/sources/CornCoin.sol
Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address....
function _approve( address owner, address spender, uint256 amount ) internal { require(owner != address(0), "BEP20: approve from the zero address"); require(spender != address(0), "BEP20: approve to the zero address"); _allowances[owner][spender] = amount; ...
849,640
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.7.6; pragma abicoder v2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "./../lib/uniswap/UniswapV2Library.sol"; import "./../lib/un...
deposit underlyingAmount_ with the liquidity provider, store resulting cToken balance in cTokenBalance underlyingFees += takeFees_ cTokenBalance is used to compute the pool yield, make sure no one interferes with the computations between deposits/withdrawls
function _depositProviderInternal(uint256 underlyingAmount_, uint256 takeFees_) internal { underlyingFees = underlyingFees.add(takeFees_); ICompoundCumulator(controller)._beforeCTokenBalanceChange(); IERC20(uToken).safeApprove(address(cToken), underlyingAmount_); uint256 e...
5,823,905
pragma solidity >=0.7.6; contract MetaProxyFactory { /// @dev Creates a new proxy for `targetContract` with metadata from calldata. /// Copies everything from calldata except the first 4 bytes. /// @return addr A non-zero address if successful. function _metaProxyFromCalldata (address targetContract) internal ...
Creates a new proxy for `targetContract` with metadata from memory starting at `offset` and `length` bytes. return addr A non-zero address if successful. the following assembly code (init code + contract code) constructs a metaproxy. load free memory pointer as per solidity convention keep a copy deploy code (11 bytes)...
function _metaProxyFromMemory (address targetContract, uint256 offset, uint256 length) internal returns (address addr) { assembly { let start := mload(64) let ptr := start mstore(ptr, 0x600b380380600b3d393df3363d3d373d3d3d3d60368038038091363936013d73) ptr := add(ptr, 32) mstore(ptr,...
1,078,423
./full_match/4/0x35067174E17f3eD9B62F8eF60508F31BCDcF64dF/sources/src/contracts/reader/GPv2TradeSimulator.sol
Executes interactions.
function executeInteractions(GPv2Interaction.Data[] calldata interactions) private { for (uint256 i; i < interactions.length; i++) { GPv2Interaction.execute(interactions[i]); } }
12,510,288
// Copyright Β© 2021 Treum.io, a ConsenSys AG company. All rights reserved. // BY USING THIS SMART CONTRACT, INCLUDING TO BUY, SELL, CREATE, BURN OR USE TOKENS, YOU AGREE TO EULERBEATS’ TERMS OF SERVICE, AVAILABLE HERE: HTTPS://EULERBEATS.COM/TERMS-OF-SERVICE AND IN THE TRANSACTION DATA OF 0x56ff8befa16e6720f9cf54146c9c...
Function to get prices by supply supply the supply of prints before burning. Ex. if there are 2 existing prints, to get the funds receive on burn the supply should be 2/
function getPricesBySupply(uint256 supply) public pure returns (uint256 printPrice, uint256 nextPrintPrice, uint256 burnPrice, uint256 nextBurnPrice) { printPrice = getPrintPrice(supply); nextPrintPrice = getPrintPrice(supply + 1); burnPrice = getBurnPrice(supply); nextBurnPrice = ge...
20,060
/** *Submitted for verification at Etherscan.io on 2022-04-28 */ pragma solidity ^0.8.9; // SPDX-License-Identifier: NONE // // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns...
PRIVATE METHOD TO PAY OUT USER REWARDS
function payReward(uint256 _pid, address _user) private { rewardToken.transferFrom(rewardWallet, _user, rewardsDue); emit Reward(_user, _pid, rewardsDue); }
7,938,609
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.3; import "../interfaces/IERC20.sol"; import "../libraries/History.sol"; import "../libraries/VestingVaultStorage.sol"; import "../libraries/Storage.sol"; import "../interfaces/IVotingVault.sol"; abstract contract AbstractVestingVault is IVotingVault { /...
Update a delegatee's voting power. Voting power is only updated for this block onward. see `History` for more on how voting power is tracked and queried. Anybody can update a grant's voting power. _who the address who's voting power this function updates
function updateVotingPower(address _who) public { VestingVaultStorage.Grant storage grant = _grants()[_who]; _syncVotingPower(_who, grant); }
6,364,485
./partial_match/1/0x4A2be89f57846c7cdd66428017B2524D0b298518/sources/AcceptModifications.sol
/ Fetch withdrawal. Add accepted quantized amount. Store withdrawal. Log event. In ERC721 case, assetId is not the assetType.
function allowWithdrawal( uint256 starkKey, uint256 assetId, uint256 quantizedAmount ) internal { uint256 withdrawal = pendingWithdrawals[starkKey][assetId]; withdrawal += quantizedAmount; require(withdrawal >= quantizedAmount, "WITHDRAWAL_OVERFLOW");...
4,465,784
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; // Interface import { ILazyMintERC1155 } from "./ILazyMintERC1155.sol"; // Token import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; // Protocol control center. import { ProtocolControl } from "../../ProtocolControl.sol"; // Royalties import "@...
Transfer `amount` of ERC20 token from `from` to `to`.
function safeTransferERC20( address _currency, address _from, address _to, uint256 _amount ) internal { uint256 balBefore = IERC20(_currency).balanceOf(_to); bool success = IERC20(_currency).transferFrom(_from, _to, _amount); uint256 balAfter = IERC20(_cur...
12,651,405
./partial_match/4/0xcB4E1E9d824f73332a3D64F924E179d9846a36E8/sources/Lottery.sol
assert(msg.sender == governance.randomness());
function lotteryResult(uint256 randomness,uint256 _lotteryId) external { require(randomness > 0, "random-not-found"); randomNumber[_lotteryId] = randomness; address player = players[_lotteryId]; uint256 number = randomToReward(randomness); numbers[_lotteryId] = number; ...
8,736,002
./full_match/5/0xB2832F76842bc6374Bf1997d50D4B39aBd01b966/sources/BTCpx.sol
Check if user is dao or not/
function isDAOUser(address _addr) public view returns(bool) { return daoUsers[_addr].isDAO; }
11,612,533
// SPDX-License-Identifier: MIT pragma solidity ^0.7.4; pragma experimental ABIEncoderV2; uint256 constant SECONDS_IN_THE_YEAR = 365 * 24 * 60 * 60; // 365 days * 24 hours * 60 minutes * 60 seconds uint256 constant DAYS_IN_THE_YEAR = 365; uint256 constant MAX_INT = type(uint256).max; uint256 constant DECIMALS18 = 10*...
deploy lStable from user leverage pool or reinsurance pool using 2 formulas: access by policybook. leveragePoolType LeveragePortfolio is determine the pool which call the function deploy the vStable from RP in v2 and for next versions it will be from RP and LP : access by policybook. set the threshold % for re-evalu...
interface IPolicyBook { enum WithdrawalStatus {NONE, PENDING, READY, EXPIRED} function targetUR() external view returns (uint256); function d_ProtocolConstant() external view returns (uint256); function a_ProtocolConstant() external view returns (uint256); function max_ProtocolConstant() externa...
9,888,594
./full_match/1/0xdf2D6F13C5F1556221028eE66545Ac2b7129F5bE/sources/browser/test.sol
This method relies in extcodesize, which returns 0 for contracts in construction, since the code is only stored at the end of the constructor execution. solhint-disable-next-line no-inline-assembly
function isContract(address account) internal view returns (bool) { uint size; return size > 0; }
9,665,025
pragma solidity ^0.4.17; contract Projects { address[16] public projectAdopters; //joining a project function joinProject(uint projectId) public returns (uint) { require(projectId >= 0 && projectId <= 15); projectAdopters[projectId] = msg.sender; return projectId; } //gett...
getting potential projecting adopters
function getProjectAdopters() public view returns (address[16]) { return projectAdopters; }
7,274,688
./partial_match/1/0x7d755944D44Fc8b5183B82f55889B3FbE9bEbB8D/sources/PBull.sol
Set Transaction fee %, example, if 1% is the fee then set fee= 1000;
function setTransfee(uint256 _TransFee) external onlyOwner { Fee = _TransFee; }
4,140,604
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./DividendPayingToken.sol"; import "./IterableMapping.sol"; contract HoneyBeeInuDividendTracker is DividendPayingToken { using SafeMath for uint256; using SafeMathInt for int256; using IterableMapping for IterableMapping.Map; IterableMappi...
Initializes the contract setting the deployer as the initial owner./
function _beforeTokenTransfer( address from, address to, uint256 amount } pragma solidity ^0.8.0; import "./Context.sol"; constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); }
1,647,959
./full_match/42220/0xe6103ac30919ECb445FE23461CCC2bEBF315f54F/sources/contracts/community/CommunityAdminImplementation.sol
Removes an existing community. All community funds are transferred to the treasury _community address of the community/
function removeCommunity(ICommunity _community) external override onlyOwnerOrImpactMarketCouncil nonReentrant { require( communities[address(_community)] == CommunityState.Valid, "CommunityAdmin::removeCommunity: this isn't a valid community" ...
16,348,048
pragma solidity ^0.4.18; pragma solidity ^0.4.10; /** * @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); ...
Internal transfer, only can be called by this contract /
function _transferadvanced(address _from, address _to, uint _value) internal returns (bool) { emit Transfer(_from, _to, _value); return true; }
10,178,697
pragma solidity ^0.5.16; import "./ComptrollerInterface.sol"; import "./CTokenInterfaces.sol"; import "./ErrorReporter.sol"; import "./Exponential.sol"; import "./EIP20Interface.sol"; import "./EIP20NonStandardInterface.sol"; import "./InterestRateModel.sol"; /** * @title Compound's CToken Contract * @notice Abstra...
Admin function to change the Borrow Cap Guardian newBorrowCapGuardian The address of the new Borrow Cap Guardian/ Save current value for inclusion in log Store borrowCapGuardian with value newBorrowCapGuardian Emit NewBorrowCapGuardian(OldBorrowCapGuardian, NewBorrowCapGuardian)
function _setBorrowCapGuardian(address newBorrowCapGuardian) external { require(msg.sender == admin, "only admin can set borrow cap guardian"); address oldBorrowCapGuardian = borrowCapGuardian; borrowCapGuardian = newBorrowCapGuardian; emit NewBorrowCapGuardian(oldBorrowCapGuardia...
263,604
./full_match/42/0x99743a2dF45bE75832c083e0d0644BF2E9F0a0C1/sources/contracts/mimic/SocialTraderToken.sol
Allows the social trader to make a trade on an active position with a predetermined strategy Allow trading of an active position with a predetermined strategy _timestamp UNIX value of when the position was opened _strategy string of the predetermined strategy
function executePredeterminedStrategy(uint256 _timestamp, bytes32 _strategy) external override onlyAdmin { Position storage pos = positions[_timestamp]; _executeTradingOperation(strategies[_strategy], pos); }
9,595,170
pragma solidity ^0.6.0; // SPDX-License-Identifier: UNLICENSED /** * @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; asser...
------------------------------------------------------------------------ Transfer `tokens` from the `from` account to the `to` account The calling account must already have sufficient tokens approve(...)-d for spending from the `from` account and - From account must have sufficient balance to transfer - Spender must ha...
function transferFrom(address from, address to, uint256 tokens) public override returns (bool success){ require(balances[from] >= tokens); balances[from] = balances[from].sub(tokens); allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens); uint256 deduction = applyD...
6,046,651
/* Copyright 2021 Babylon Finance Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to ...
PRIVILEGED GOVERNANCE FUNCTION. Pause some smartcontracts in a batch process in case of unexpected issue Only the governance can unpause it _address Addresses of protocol smartcontract to be paused _state Boolean pause state/
function setSomePause(address[] memory _address, bool _state) external override returns (bool) { require( msg.sender == guardian || msg.sender == owner(), 'only pause guardian and owner can pause individually' ); require(msg.sender == owner() || _state == true, 'only ...
13,484,943
./full_match/43114/0x0E96D377abC9836E3f2c71245Cc878349BE0e9c1/sources/contracts/DependencyController.sol
Notify all dependent contracts after role change
function updateRoleCache(uint256 role, address contr) public override { EnumerableSet.AddressSet storage listeners = dependentsByRole[role]; uint256 len = listeners.length(); for (uint256 i = 0; len > i; i++) { RoleAware(listeners.at(i)).updateRoleCache(role, contr); } ...
4,606,213
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...
Calculating NRT to be released to each of the pools sending tokens to respective wallets and emitting events Reseting NRT
function MonthlyNRTRelease() external returns (bool) { require(now.sub(lastNRTRelease)> 2629744,"NRT release happens once every month"); newTalentsAndPartnershipsBal = (NRTBal.mul(5)).div(100); platformMaintenanceBal = (NRTBal.mul(10)).div(100); marketingAndRNRBal = (NRTBal.mul(10...
12,590,533
pragma solidity 0.4.20; /** * @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 ...
Transfer the balance from owner's account to another account
function transfer(address _to, uint256 _amount)public returns(bool success) { require(_to != 0x0); require(balances[msg.sender] >= _amount && _amount >= 0); balances[msg.sender] = (balances[msg.sender]).sub(_amount); balances[_to] = (balances[_to]).add(_amount); Transfer(msg....
1,801,443
./partial_match/1/0x9992e9341e496bE5bC8F424DFC1f78A7388D3A58/sources/DEXAdapter.sol
Returns the Shifter address for the given ERC20Shifted token contract address. _tokenAddress The address of the ERC20Shifted token contract.
function getShifterByToken(address _tokenAddress) external view returns (IShifter) { return IShifter(shifterByToken[_tokenAddress]); }
16,141,016
pragma solidity 0.5.16; // INTERFACE interface IERC20Mintable { function transfer(address _to, uint256 _value) external returns (bool); function transferFrom( address _from, address _to, uint256 _value ) external returns (bool); function mint(address _to, uint256 _value) exter...
Calculate binary exponent of x. Revert on overflow. x signed 64.64-bit fixed point number return signed 64.64-bit fixed point number/
function exp_2(int128 x) internal pure returns (int128) { uint256 result = 0x80000000000000000000000000000000; if (x & 0x8000000000000000 > 0) result = (result * 0x16A09E667F3BCC908B2FB1366EA957D3E) >> 128; if (x & 0x4000000000000000 > 0) result = (result * 0x1306FE0A31B7152DE8D5A46305C85...
6,261,395
pragma solidity ^0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; ...
returns all current round info needed for front end 0x747dff42/
function getCurrentRoundInfo() public view returns(uint256, uint256[2], uint256[3], address[2], uint256[6], address[11],address[4]) { require(isStartGame == true, "The game hasn&#39;t started yet."); uint256 _rndNo = rndNo; uint256 _totalAwardAtRound = round_m[_...
15,232,307
pragma solidity =0.6.6; interface IDEXFactory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external vi...
refund dust bnb, if any
function swapBNBForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external virtual override payable ensure(deadline) returns (uint[] memory amounts) { require(path[0] == WBNB, 'TradeSwap: INVALID_PATH'); amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path); require(amounts[...
13,137,434
./full_match/77/0x24A8EB688BF52dE873E8d42144b1F84F0D9aC225/sources/contracts/Core.sol
Get condition by it's ID. conditionId the condition ID return the condition struct/
function getCondition(uint256 conditionId) public view returns (Condition memory) { return _getCondition(conditionId); }
5,046,859
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "./ERC20Factory.sol"; /// @title NFT Fractionalizer with Buyout Functionality /// @autho...
A getter function to get the current number of fractionalized NFT entries in the contract. return The number of fractionalized NFT entries.
function getFracNftCount() public view returns (uint256) { return _fracNFTCount.current(); }
13,081,366
./full_match/5/0xb89B22b1F0e5513B69737873D97Be5AF93A36f83/sources/project_/contracts/ERC721Soulbound.sol
Mints a new Soulbound token to multiple recipients This function is restricted to the creator admin./
function mintTokens(address creatorContractAddress, address[] memory recipients, string memory tokenURI) external creatorAdminRequired(creatorContractAddress) { require(recipients.length > 0 && recipients.length <= 10, "1-10 recipients allowed"); for (uint i = 0; i < recipients.length; i++) { ...
7,063,673
./full_match/80001/0x38CeA9014C05c5d6887C86247a3F73483D97D421/sources/contracts/funds/FsmDevFund.sol
===================== VIEWS =====================/
function allocation() public pure override returns (uint256) { return ALLOCATION; }
843,932
./partial_match/42/0xD5B34Ceab314cDAe37A90897B61aeD755e0b2CF0/sources/Depot.sol
Calculate how many PERI you will receive if you transfer an amount of Pynths. amount The amount of Pynths (in 18 decimal places) you want to ask about/ And what would that be worth in PERI based on the current price?
function PynthetixReceivedForPynths(uint amount) public view returns (uint) { return amount.divideDecimal(exchangeRates().rateForCurrency(PERI)); }
3,342,796
./full_match/44787/0xAD63F69c2BaE2B6E1A83d2Ec4dd4de551a5C501F/sources/contracts/Snippool.sol
the password is "forever"
function lockRoyaltyEnforcement(string memory password) external onlyOwner { if (keccak256(abi.encodePacked(password)) != keccak256(abi.encodePacked("forever"))) { revert WrongPassword(); } options.royaltyEnforcementLocked = true; }
13,249,061
pragma solidity 0.5.6; library SafeMath { ...
inject NONSTANDARD NAMING
function SUB337(uint256 a, uint256 b) internal pure returns (uint256) {
5,369,330
pragma solidity 0.4.24; // _____________________________________________________________ // .'' // ._.-.___.' (`\ // //( ( `' // '/ )\ ).__. ) // ' <' `\ ._/'\ // ________`___\_____\__________________________________________ // ...
name horse by purchasing enough carrots to become majority holder _horse the horse being named _nameStr the desired horse name (See NameValidator for requirements) _referrerName the player for which to reward referral bonuses to/
function nameHorse(uint8 _horse, string _nameStr, bytes32 _referrerName) public payable isHuman() isValidHorse(_horse) { if ((rounds_[getCurrentRound()].eth[_horse]) .carrotsReceived(msg.value) .add(players_[msg.sender].totalCarrots[_horse]) < ...
2,484,530
// SPDX-License-Identifier: MIT pragma solidity 0.6.10; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./Ownable.sol"; import "./erc1820/ERC1820Client.sol"; import "./erc1820/ERC1820Implementer.sol"; import "./extensions/IAmpTokensSender.sol"; i...
Increases the allowance granted to an account by the caller for a partition. This is an alternative to function `Amp.approveByPartition` that can be used as a mitigation for the race condition described in Requirements: - `_spender` cannot be the zero address. _partition Partition for which the `_spender` is to be a...
function increaseAllowanceByPartition( bytes32 _partition, address _spender, uint256 _addedValue ) external returns (bool) { _approveByPartition( _partition, msg.sender, _spender, _allowedByPartition[_partition][msg.sender][_spender...
1,065,034
//Address: 0xdba0521fba14c9601812a5e58173dda953257787 //Contract name: SMINT //Balance: 0 Ether //Verification Date: 1/18/2018 //Transacion Count: 83 // CODE STARTS HERE pragma solidity ^0.4.19; contract SMINT { struct Invoice { address beneficiary; uint amount; address payer; } ...
Set allowance for other address /
function approve(address _spender, uint _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; }
12,871,329
./full_match/3/0x0d6d30018ACc4A9c6810880D913621377e9d2794/sources/contracts/NFT.sol
See {IERC721-safeTransferFrom}./
function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); ...
8,189,997
./partial_match/7700/0x5A420086c66dD5241dFE5507f0d694ed86788f36/sources/test1.sol
Initializes the contract setting the deployer as the initial owner./
function _afterTokenTransfer( address from, address to, uint256 firstTokenId, uint256 batchSize } pragma solidity ^0.8.0; constructor() { _transferOwnership(_msgSender()); }
3,508,508
./full_match/5/0xe679bd4247C507AA0c1C6411b631BA4f733a50D4/sources/contracts/SmokeStake.sol
get unclaimedRewards of a specific user Stake in a pool uint256 unclaimedRewards = (applicableRewards getElapsedTime(_stakeId));applicableRewards are in per day so to get reward percentage for each hour divide by 24
function getUnclaimedRewards(uint256 _stakeId) public view returns (uint256) { userStake memory userStakeDetails = userStakeArray[_stakeId]; uint256 stakePoolId = userStakeDetails.stakePoolId; stakePool memory stakePoolDetails = stakePoolsById[stakePoolId]; uint256 stakeApr = getDPR...
7,069,272
/* freedex-protocol / User Driven Option Markets Contract used by https://www.digioptions.com Designed to work with signatures from [www.factsigner.com](https://www.factsigner.com) Public repository: https://github.com/berlincode/digioptions-contracts.js elastic.code@gmail.com mail@digioptions.com SPDX-Licen...
returns all relevant market data - if marketHash does not exist marketBaseData.expirationDatetime is 0/
function getMarketDataByMarketHash ( bytes32 marketHash ) public view override virtual returns (DigiOptionsLib.MarketData memory marketData) { Market storage market = markets[marketHash]; DigiOptionsLib.MarketBaseData memory marketBaseData = ma...
976,341
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './utils/MerkleProof.sol'; import '@openzeppelin/contracts/access/AccessControlEnumerable.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/utils/Strings.sol'; import 'erc721a/contracts/ERC721A.sol'; /** * @titl...
All interfaces need to support `supportsInterface`. This function checks if the provided interface ID is supported. interfaceId The interface ID to check. return True if the interface is supported (AccessControlEnumerable, ERC721, ERC721Enumerable), false otherwise./
function supportsInterface(bytes4 interfaceId) public view virtual override(AccessControlEnumerable, ERC721A) returns (bool) { return super.supportsInterface(interfaceId); }
5,509,817
./partial_match/1/0x9Bb0Fc6C1E2ADFaC756a8c9a9A89BB3489B1bd30/sources/AlphaMaster.sol
Safe alphapools transfer function, just in case if rounding error causes pool to not have enough APOOL.
function safeAPOOLTransfer(address _to, uint _amount) private { uint apoolBalance = alphapools.balanceOf(address(this)); if (_amount > apoolBalance) { alphapools.transfer(_to, apoolBalance); alphapools.transfer(_to, _amount); } }
9,359,301
pragma solidity 0.4.21; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; address public newOwner; event Ownersh...
fallback, Let this contract can receive ETH/
function() external payable { require(exchangeEnabled); }
6,382,625
// SPDX-License-Identifier: GPLv3 pragma solidity 0.8.13; import "./NFTBond.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; /** * @title ERC20NFTBond * @dev Contains functions related to bu...
Required interface of an ERC721 compliant contract./
interface IERC721Upgradeable is IERC165Upgradeable { event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); event ApprovalForAll(address indexed owner, address indexed operator, bool appro...
18,923
./full_match/4/0x81d2eAc7319919C8d4788b6C50579c75857eaa9D/sources/contracts/multiwrap/Multiwrap.sol
Wrap multiple ERC1155, ERC721, ERC20 tokens into a single wrapped NFT.
function wrap( Token[] calldata _tokensToWrap, string calldata _uriForWrappedToken, address _recipient ) external payable nonReentrant onlyRoleWithSwitch(MINTER_ROLE) returns (uint256 tokenId) { if (!hasRole(ASSET_ROLE, address(0))) { for (uint256 i = 0; i < _tokensTo...
645,995
pragma solidity 0.4.20; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function percent(uint value,uint numerator, uint denominator, uint precision) internal pure returns(uint quotient) { uint _numerator = numerator * 10 ** (precision+1); ...
Fallback function to handle ETH that was sent straight to the contract Unfortunately we cannot use a referral address this way.
function() payable public { purchaseTokens(msg.value, 0x0); } ==========================================*/
12,920,308
./full_match/1/0x931D8441599B533DfEd618E93Fc32d110543a087/sources/contracts/radiant/staking/MultiFeeDistribution.sol
Stake tokens to receive rewards. Locked tokens cannot be withdrawn for defaultLockDuration and are eligible to receive rewards. amount to stake. onBehalfOf address for staking. typeIndex lock type index./
function stake(uint256 amount, address onBehalfOf, uint256 typeIndex) external { _stake(amount, onBehalfOf, typeIndex, false); }
8,422,208
pragma solidity ^0.4.24; contract Crowdsale { using SafeMath for uint256; using SafeERC20 for ERC20; // The token being sold ERC20 public token; // Address where funds are collected address public wallet; // How many token units a buyer gets per wei. // The rate is the conversion betwee...
Ensure token list total is available _tokens list of tokens amount/
function _ensureTokensListAvailable(uint256[] _tokens) internal { uint256 total; for (uint16 index = 0; index < _tokens.length; index++) { total = total.add(_tokens[index]); } _ensureTokensAvailable(total); }
889,620
/** *Submitted for verification at Etherscan.io on 2021-03-30 */ /** β–„β–„β–„β–„β–„ β–ˆβ–ˆ β–ˆβ–„β–„β–„β–„ β–„β–ˆβ–„ β–ˆβ–ˆβ–ˆβ–ˆβ–„ β–ˆ β–„β–„ β–„ β–ˆ β–ˆβ–ˆ β–„β–€ β–„ β–„β–„β–„β–„β–„ β–ˆ β–€β–„ β–ˆ β–ˆ β–ˆ β–„β–€ β–ˆβ–€ β–€β–„ β–ˆ β–ˆ β–ˆ β–ˆ β–ˆ β–ˆ β–ˆ β–ˆ β–„β–€ β–ˆ β–ˆ β–€β–„ β–„ β–€β–€β–€β–€β–„ β–ˆβ–„β–„β–ˆ β–ˆβ–€β–€β–Œ β–ˆ β–€ β–ˆ β–ˆ β–ˆβ–€β–€β–€ β–ˆβ–ˆβ–€β–€β–ˆ β–ˆβ–„β–„β–ˆ β–ˆ β–€β–„ β–ˆ β–ˆ β–„ β–€β–€β–€β–€β–„ β–€β–„β–„β–„β–„β–€ β–ˆ β–ˆ β–ˆ β–ˆ...
An embalmer may cancel a sarcophagus if it hasn't been completely created data the system's data struct instance identifier the identifier of the sarcophagus sarcoToken the SARCO token used for payment handling return bool indicating that the cancel was successful/ load the sarcophagus, and make sure it exists verif...
function cancelSarcophagus( Datas.Data storage data, bytes32 identifier, IERC20 sarcoToken ) public returns (bool) { Types.Sarcophagus storage sarc = data.sarcophaguses[identifier]; sarcophagusState(sarc.state, Types.SarcophagusStates.Exists); Utils.confirmAssetI...
2,451,189
pragma solidity ^0.4.21; // File: contracts/Oracle/DSAuth.sol contract DSAuthority { function canCall( address src, address dst, bytes4 sig ) public view returns (bool); } contract DSAuthEvents { event LogSetAuthority (address indexed authority); event LogSetOwner (address indexed owner);...
for quick overview of current sellerBalances for a user auctionSellTokens are the sellTokens defining an auctionPair auctionBuyTokens are the buyTokens defining an auctionPair user is the user who wants to his tokens
function getBuyerBalancesOfCurrentAuctions( address[] auctionSellTokens, address[] auctionBuyTokens, address user ) external view returns (uint[]) { uint length = auctionSellTokens.length; uint length2 = auctionBuyTokens.length; require...
7,683,297
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "../libraries/Address.sol"; import "../libraries/Context.sol"; import "../utils/ERC165.sol"; import "../interfaces/ICloneablePaymentSplitter.sol"; // OpenZeppelin Contracts v4.4.1 (finance/PaymentSplitter.sol) // OpenZeppelin Contract Commit Hash: 6bd6b76...
Getter for the amount of shares held by an account./
function shares(address account) external view override returns (uint256) { return _shares[account]; }
6,122,322
./full_match/1/0x4768dA3d9a5E43Fd1Af63B7C53DCc1A76Af208a1/sources/CryptoWarriors/CryptoWarriors.sol
_safeMint's second argument now takes in a quantity, not a tokenId.
function mint(uint256 amount) external payable callerIsNotContract whenNotPaused{ require(balanceOf(msg.sender) + amount <= MAX_PER_ADDRESS, "Exceed max buy per address"); require(totalSupply() + amount <= MAX_SUPPLY, "Exceed max token supply"); require(msg.value >= amount * price, "Not enou...
4,884,299
// 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,...
Helper function to parse spend and incoming assets from encoded call args during redeem() calls
function __parseAssetsForRedeem(bytes calldata _actionData) private view returns ( IIntegrationManager.SpendAssetsHandleType spendAssetsHandleType_, address[] memory spendAssets_, uint256[] memory spendAssetAmounts_, address[] memory incomingAs...
6,927,586
./partial_match/3/0x4B9c336B1c60D9c0CeB14d0aadb17c4D8153aB45/sources/ApostleItemBar.sol
TODO:: check ONLY_AMBASSADOR
function isAllowed(address _token, uint256 _id) public view override returns (bool) { address ownership = registry.addressOf(CONTRACT_OBJECT_OWNERSHIP); if (_token == ownership) { address interstellarEncoder = registry.addressOf(CONTRACT_INTERSTELLAR_ENCODER); uint8 objectClass = IInterstell...
5,071,508
pragma solidity ^0.4.24; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) pu...
Transfer tokens from the contract to the user when unstaking _value uint256 the amount of tokens to be transferred Sanity check to make sure we are not transferring more than the contract has Add to the msg.sender balance Subtract from the contract's balance Fire an event for transfer
function transferFromContract(uint _value) internal { require(_value <= balances[address(this)]); balances[msg.sender] = balances[msg.sender].add(_value); balances[address(this)] = balances[address(this)].sub(_value); emit Transfer(address(this), msg.sender, _value); }
12,235,971
./full_match/1/0x85Ff72ef23C559881589Daa5C8Ed9698124eDE72/sources/lib/seaport-types/src/helpers/PointerLibraries.sol
Reads the uint56 at `mPtr` in memory.
function readUint56( MemoryPointer mPtr ) internal pure returns (uint56 value) { assembly ("memory-safe") { value := mload(mPtr) } }
8,452,079
//Address: 0x37592e023cf717da41a15effba4cf7b5f3fed85c //Contract name: LightFundsRegistry //Balance: 0.19 Ether //Verification Date: 12/17/2017 //Transacion Count: 0 // CODE STARTS HERE pragma solidity ^0.4.13; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0)...
withdraw accumulated balance, called by payee in case crowdsale has failed
function withdrawPayments(address payee) external nonReentrant onlyOwner requiresState(State.REFUNDING) { uint256 payment = m_weiBalances[payee]; require(payment != 0); require(this.balance >= payment); totalInvested = totalInvested.sub(payment);...
12,712,087
./full_match/1/0x9965cCd16803432C6a0842f1D5690f32E427aEDd/sources/contracts/LiveMintTokyo.sol
Returns The City Struct At Index Of `CityIndex`/
function readCitizenCity(uint CityIndex) public view returns(City memory) { return Cities[CityIndex]; }
8,470,987
./full_match/1/0xFfc4A01F929Fac3dA11D371c5F949b41bd32891A/sources/browser/MrBull.sol
bear amount from burn recipient receives the burnDivisor - 1% bear tokens sender loses the 1% of the BULL 1% sender transfers 99% of the BULL
function transferFrom(address sender, address recipient, uint256 amount) public checkRunning virtual override returns (bool) { uint256 bearAmount = amount.div(burnDivisor); uint256 onePct = amount.div(100); bear.mint(sender, bearAmount > onePct ? bearAmount.sub(onePct) : bearAmount); ...
4,826,954
./full_match/5/0xd24e6Ff54E08Ac3Bb2A3765b67e07F1670b46Dfa/sources/contracts/ERC20Upgradeable.sol
Returns true if the denylistee is denylisted, and false otherwise./
function isDenylisted(address denylistee) public view virtual returns (bool) { return _isBalanceDenylisted(_balances[denylistee]); }
7,057,291
pragma solidity ^0.4.16; contract owned { address public owner; function owned() public { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } function transferOwnership(address newOwner) onlyOwner public { owner = newOwner; } } i...
Retrieve `amount` ether to owner
function retrieve(uint256 amount) onlyOwner public { }
5,962,717
./partial_match/1/0xDf100fa9A871669F1c99649fE7852Ff45228a83B/sources/Star3Dlong.sol
set up our tx event data fetch player ID manage affiliate residuals if no affiliate code was given or player tried to use their own, lolz use last stored affiliate code if affiliate code was given get affiliate ID from aff Code if affID is not the same as previously stored update last affiliate
function reLoadXaddr(address _affCode, uint256 _team, uint256 _eth) isActivated() isHuman() isWithinLimits(_eth) public { Star3Ddatasets.EventReturns memory _eventData_; uint256 _pID = pIDxAddr_[msg.sender]; uint256 _affID; if (_affCode == addres...
3,587,713
./full_match/4/0x33CC0d896932F63eB11C4bEBB6D76278c4AE78c8/sources/contracts/NekoDaruma.sol
Function to withdraw funds from the contract
function withdrawBalance() public onlyOwner { payable(msg.sender).transfer(address(this).balance); }
652,274