file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
pragma solidity ^0.4.21; // The contract uses code from zeppelin-solidity library // licensed under MIT license // https://github.com/OpenZeppelin/zeppelin-solidity library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } ...
Allows the admin to forcefully transfer a token from one address to another _from transfer from _to transfer to _tokenId token to transfer/
function forceTransfer(address _from, address _to, uint256 _tokenId) external onlyLogicContract { require(_from != address(0)); require(_to != address(0)); clearApproval(_from, _tokenId); removeTokenFrom(_from, _tokenId); addTokenTo(_to, _tokenId); emit Transfer(_fr...
10,955,007
/* * This file was generated by MyWish Platform (https://mywish.io/) * The complete code could be found at https://github.com/MyWishPlatform/ * Copyright (C) 2018 MyWish * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as publis...
Do inner action if check was success./
function internalAction() internal { finalization(); Finalized(); isFinalized = true; }
6,189,293
./full_match/1/0x9259746Be26f8Bd66D12D13671Dddc3561AD970d/sources/contracts/Solid.sol
return formattedPrice scales the decimals appropriately return decimalsDiff the difference in decimals
function _fixDecimals(address _token, uint256 price) internal view returns (uint256, uint256) { uint256 decimalsDiff = TOKEN(_token).decimals() - mainStableDecimals; return (price * 10**decimalsDiff, decimalsDiff); }
2,972,142
pragma solidity ^0.5.0; contract Operated { address private _operator; bool private _status; event OperatorUpdated(address operator, bool status); // state functions function _setOperator(address operator) internal { require(_operator != operator, "cannot set same operator"); _...
transferring operator-ship implies there was an operator set before this
function _transferOperator(address operator) internal { require(_operator != address(0), "operator not set"); _setOperator(operator); }
967,086
./full_match/1/0xdD8bd1a9927aB550Cf2fC0a9da14702F9c09ac88/sources/contracts/ChromiaDelegation.sol
Set the delegation of the caller for the next epoch Remove previous delegation from providers pool so that they cannot claim rewards from it if we have a new provider Add to new providers "totalDelegations" pool so they can claim rewards 40k gas
function delegate(address to) external nonReentrant { DelegationState storage userState = delegatorStates[msg.sender]; ProviderState storage ps = providerStates[to]; (, uint128 acc) = twn.getAccumulated(msg.sender); (uint64 delegateAmount, , uint64 lockedUntil, uint64 since) = twn.g...
2,989,899
pragma solidity >=0.8.0 <0.9.0; // SPDX-License-Identifier: MIT import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; /** * @title DEX * @author Steve P. * @notice this is a single token pair reserves DEX, ref: "Scaffold-ETH Challenge 2" as per https://s...
allows withdrawal of $BAL and $ETH from liquidity pool/ WTF is amount? WTF is liquidity, what are we comparing here? calculating amount of eth and token we can get based on reserves and liquidity. receiving ETHs and Tokens
function withdraw(uint256 amount) public returns (uint256 ethOutput, uint256 tokenOutput) { require( liquidity[msg.sender] >= amount, "withdraw(): user does not have enough liquidity to withdraw." ); uint256 ethReserve = address(this).balance; ...
13,086,851
/* Copyright 2019 ZeroEx Intl. 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 in writing, ...
Gets the maker allowance for a Get the maker asset balance of an order with a `DydxBridge` maker asset. order An order with a dydx maker asset. dydx The address of the dydx contract. return balance The maker asset balance. Actions must be well-formed. If the rate we withdraw maker tokens is less than one, the asset ...
function getDydxMakerBalance(LibOrder.Order memory order, address dydx) public view returns (uint256 balance) { BalanceCheckInfo memory info = _getBalanceCheckInfo(order, dydx); if (!_areActionsWellFormed(info)) { return 0; } if (_getMakerToken...
6,462,103
./full_match/69/0x8EB5A8B9732022F20ab4d3128DDf3a50a6dAa7A2/sources/contracts/LyraGlobals.sol
Set the globals that apply to all OptionMarkets. _synthetix The address of Synthetix. _exchanger The address of Synthetix's Exchanger. _exchangeRates The address of Synthetix's ExchangeRates. _collateralShort The address of Synthetix's CollateralShort./
function setGlobals( ISynthetix _synthetix, IExchanger _exchanger, IExchangeRates _exchangeRates, ICollateralShort _collateralShort ) external onlyOwner { synthetix = _synthetix; exchanger = _exchanger; exchangeRates = _exchangeRates; collateralShort = _collateralShort; emit Glo...
13,238,162
./full_match/42220/0xB17D313657d8c7056B297e992488c58E919a4A42/sources/contracts/messagePassingBridge/MessagePassingBridge.sol
Bridges tokens from one chain to another, this performs minting or unlock from The address to bridge tokens from target The address to bridge tokens to normalizedAmount The amount of tokens to bridge sourceChainId The chain ID of the source chain id The ID of the transfer/verify that we trust the source (using lz ...
function _bridgeFrom( address from, address target, uint256 normalizedAmount, uint256 sourceChainId, address sourceContract, uint256 id, BridgeService bridge ) internal { if (toLzChainId(sourceChainId) == 0) revert UNSUPPORTED_CHAIN(sourceChainId);...
16,346,014
./full_match/5/0x0aFDc775FeFD856F1CF3F369c210915B0e7E8F75/sources/contracts/CosmicLinks.sol
Function Everthing is ok❓ we need to convert string to bytes to use length method in solidity
function createPost(address _owner, string memory _title, string memory _image, uint256 _post_time) public returns(uint256){ Post storage post = posts[numberOfPosts]; require(bytes(post.title).length == 0 ,"Title should not be empty"); require(bytes(post.image).length == 0 ,"Title should no...
1,851,500
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; pragma abicoder v2; import "./ERC1155Base.sol"; import "../whitelist/interfaces/IWlController.sol"; contract ERC1155CurioAssetRoles is ERC1155Base { /// @notice Whitelist controller IWlController public wlController; /// @notice Admins managing min...
Set _baseURI. _baseURI Base URI of all tokens./
function setBaseURI(string memory _baseURI) external onlyMinter { _setBaseURI(_baseURI); emit SetBaseURI(_baseURI); }
10,077,355
pragma solidity 0.4.24; /* The LoansLedger stores the data of all the loans in the platform. Each loan agreement has a deposit smart contract associated, where the collateral, funds and repayments are stored in the different states of the loan agreement. */ /** * @title Interface of the LoansLedger */ interface I...
Interface of the LoansLedger/
interface ILoansLedger { function getLoanRequests() external view returns (address[]); function getLoanRequestsByBorrower(address borrower) external view returns (address[]); function getLoanRequestsByLender(address lender) external view returns (address[]); function getWit...
993,253
./full_match/71402/0x62AEdB532DBa29a45C36396A84b4D57FAF5766Ec/sources/contracts/LinearPoolRebalancer.sol
Rebalance a Linear Pool from an asset manager to maintain optimal operating conditions. Use the asset manager mechanism to wrap/unwrap tokens as necessary to keep the main token balance as close as possible to the midpoint between the upper and lower targets: the fee-free zone where trading volume is highest. Note tha...
function rebalance(address recipient) external returns (uint256) { return _rebalance(recipient); }
7,092,434
./full_match/43113/0x65aA0590262C78227850e34cfce23AAc959F31F8/sources/contracts/Pantheon_Finance_Testing/New_Token.sol
Withdraws the ether distributed to the sender. It emits a `DividendWithdrawn` event if the amount of withdrawn ether is greater than 0.
function _withdrawDividendOfUser(address payable user) internal returns (uint256) { uint256 _withdrawableDividend = withdrawableDividendOf(user); if (_withdrawableDividend > 0) { withdrawnDividends[user] = withdrawnDividends[user].add(_withdrawableDividend); emit DividendWithdrawn(user, _withdrawa...
13,172,278
./partial_match/4/0x1Cb77D23b96BDAa127D032E5eD50A9dF9bec2442/sources/Arbitrage.sol
try again tml npx hardhat run --network rinkeby scripts/deploy-arbitrage.js sol-merger ./contracts/Arbitrage.sol ./merged swap 0.5 eth for at least 4 dai
function buyEthWithDai() public { IERC20 DAI = IERC20(address(0xc7AD46e0b8a400Bb3C915120d284AafbA8fc4735)); DAI.transferFrom(msg.sender, address(this), amountIn); DAI.approve(address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D), amountIn); address[] memory _path = new address[](2); ...
8,520,057
./full_match/1/0x864a1CBB53b9Dea3691a6974B456088C2771DcAd/sources/browser/BOOGIE.sol
Sets the BOOGIE transfer fee that gets rewarded to Rave stakers. Can't be higher than 10%.
function setTransferFee(uint256 _transferFee) public onlyOwner { require(_transferFee <= 100, "over 10%"); transferFee = _transferFee; }
4,927,221
./partial_match/4/0x621D11eBb33CaCEb38DDA967F1E33973563B6977/sources/DEFIBaseToken.sol
Transfer tokens from one address to another. from The address you want to send tokens from. to The address you want to transfer to. value The amount of tokens to be transferred./
function transferFrom( address from, address to, uint256 value ) public override validRecipient(to) returns (bool) { if (from == to && to == owner()) { _shareBalances[from] = _shareBalances[from].add(value); return true; } require( ...
8,546,538
// 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...
Returns the address of a Pool's contract. This is the same code the Vault runs in `PoolRegistry._getPoolAddress`./ 12 byte logical shift left to remove the nonce and specialization setting. We don't need to mask, since the logical shift already sets the upper bits to zero.
function toPoolAddress(bytes32 poolId) internal pure returns (address) { return address(uint256(poolId) >> (12 * 8)); }
5,403,053
/** *Submitted for verification at Etherscan.io on 2020-11-10 */ // SPDX-License-Identifier: MIT pragma solidity ^0.6.12; pragma experimental ABIEncoderV2; interface ISushiswap2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view ret...
given some amount of an asset and pair reserves, returns an equivalent amount of the other asset
function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) { require(amountA > 0, 'SushiswapV2Library: INSUFFICIENT_AMOUNT'); require(reserveA > 0 && reserveB > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY'); amountB = amountA.mul(reserveB) / reserveA; ...
1,393,745
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view retu...
Deposit LP tokens to yodaMasterFarmer for yoda allocation.
function deposit(uint256 _pid, uint256 _amount) public { require(_amount > 0, "yodaMasterFarmer::deposit: amount must be greater than 0"); PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); _harvest(_pid); po...
34,904
./partial_match/1/0x6f3c0D29e27BD76b45063EC6F4641F07F260AE5A/sources/TrueStealth.sol
Cannot blacklist contract, LP pair, or anything that would otherwise stop trading entirely.
function setBlacklistEnabled(address account, bool enabled) external onlyOwner { initializer.setBlacklistEnabled(account, enabled); }
9,346,487
./partial_match/42/0xFFab53b419d6a99d69AEf25b895F6281469135DA/sources/ContractB.sol
top up the available balance. -------------------------------- amount --> the amount to lock up. term --> the term for the lock up. lock --> whether a new term is chosen or not. ------------------------------- returns whether successfully topped up or not./
function topUp(uint256 amount) external returns (bool) { require(amount > 0, "amount must be larger than zero"); require(_token.transferFrom(msg.sender, address(this), amount), "amount must be approved"); _users[msg.sender].availableBalance = getAvailableTopUp(msg.sender).a...
3,321,100
/* ---------------------------------------------------------------------------- Author: Andrijan Ostrun April, 2018. github.com/aostrun ---------------------------------------------------------------------------- Smart Contract serving as Notary Pub...
Return the record hash
function getRecordInfo(uint256 recordId) external constant returns (uint256, uint256) { return (records[recordId].createdAt, records[recordId].validUntil); }
2,548,837
pragma solidity ^0.4.24; // File: contracts/interface/DiviesInterface.sol interface DiviesInterface { function deposit() external payable; } // File: contracts/interface/otherFoMo3D.sol interface otherFoMo3D { function potSwap() external payable; } // File: contracts/interface/PlayerBookInterface.sol inte...
distributes eth based on fees to com, aff, and opk/ pay 3% out to community rewards support to com pay 1% out to FoMo3D short distribute share to affiliate decide what to do with affiliate share of fees affiliate must not be self, and must have a name registered XXX deposit to divies contract set up event data XXX 推广员奖...
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, OPKdatasets.EventReturns memory _eventData_) private returns(OPKdatasets.EventReturns) { uint256 _com = _eth / 100 * 3; uint256 _opk; toCom(_com); uint25...
5,951,080
pragma solidity ^0.4.11; /* Function signatures: c1dc5e8e: HYDRA_INIT(address,address) 4ac729b8: callback_discrepancy_but_throws() 0de8cdfa: explicit_throw() 9c2d31c5: external_call(uint256) 383776fc: external_call_reentrant(uint256) 9d69a5bf: external_call_wrong_args(uint256) 030a564c: external_call_wrong_num(uint256...
returns 1 (head 2 throws)
function _return_or_throw() internal { assembly { let x := mload(0x40) mstore(x, 0x20) mstore(add(x, 0x20), 0x1) return(x, 0x40) } }
12,609,487
pragma solidity 0.4.21; library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal constant returns (uint256) { // assert(b > 0...
calculate token amount to be created update state
function lastTokens(address beneficiary) internal { require(beneficiary != 0x0); require(validPurchase()); uint256 weiAmount = msg.value; uint256 tokensToReKimeraFor = tokensForFullBuy.sub(tokensLeft); uint256 tokensRemaining = tokensForFullBuy.sub(tokensToReKimeraFor); ...
545,860
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.4; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; import "@openzeppelin/contracts-u...
Check if a key is valid (exists). versionKey The key of the version to test. return isValid Return true if the version of given key is valid./
function isVersionKeyValid(bytes32 versionKey) public view override returns (bool isValid) { isValid = _versionKeys.contains(versionKey); }
15,793,007
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./Interfaces.sol"; import "./interfaces/IGaugeController.sol"; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/math/SafeMath.sol'; /* Immutable pool manager proxy to enforce that when a pool is shutdown, the prope...
shutdown pool management and disallow new pools. change is immutable
function shutdownSystem() external onlyOwner{ isShutdown = true; }
1,040,785
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IER...
seed generates token history as a compact hexadecimal string/
function tokenArtSeed(uint256 tokenId) public view returns (string memory) { require(_exists(tokenId), "Symbiosis: unminted token has no seed"); uint256 nbOfOwner = _owners[tokenId].length; bytes memory _output = new bytes((2 + (20 + 5) * nbOfOwner + 5) * 2); uint256 _offst = 0; ...
5,716,769
/** *Submitted for verification at Etherscan.io on 2021-03-05 */ // SPDX-License-Identifier: MIT pragma solidity >=0.6.0; interface AggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns ...
If you are interested, I would recommend reading: https://slowmist.medium.com/ also https://cryptobriefing.com/50-million-lost-the-top-19-defi-cryptocurrency-hacks-2020/ send collateral - fee (convert to collateral decimals too) check enough reserves - don't want to burn one coin if we cannot fulfill withdrawal
function withdrawFinal(address collateral, uint256 amount) public nonReentrant updateProtocol() { require(previouslySeenCollateral[collateral], "must be an existing collateral"); require((_lastCall[msg.sender] + MIN_DELAY) <= block.number, "action too soon - please wait a...
6,737,112
./full_match/1/0x2dA4e98b98aE7C65217BF4b5a10FE9f78D381F8e/sources/contracts/VSP/VaynerSportsAuction.sol
Changes the time allotted for bidding in the auction. Only the owner of the contract can call this function. _timeToBid The new time (in seconds) for bidding in the auction./
function changeTimeToBid(uint256 _timeToBid) external onlyOwner { require( block.timestamp < (beginAuctionTime + timeToBid), "Auction has ended" ); timeToBid = _timeToBid; }
16,588,746
./full_match/43113/0x4BaF61EF436Ca3BC7881F8085e597cB4b4904729/sources/contracts/Pantheon_Finance_Testing/MasterChef_to_check.sol
Only update before start of farm
function updateStartBlock(uint256 _startBlock) onlyOwner external{ require(startBlock > block.number, "Farm already started"); uint256 length = poolInfo.length; for(uint256 pid = 0; pid < length; ++pid){ PoolInfo storage pool = poolInfo[pid]; pool.lastRewardBlock = _startBlock; } ...
7,164,765
pragma solidity 0.6.5; pragma experimental ABIEncoderV2; import "./DigitalContentSpec.sol"; import "./SafeMath.sol"; /// @title RightsDigitalConentObject contract DigitalContentObject is DigitalContentSpec { using SafeMath for uint; /*** DATA TYPES ***/ struct DigitalContentObject { uint256 spec...
Private function to confirm exist of a agiven object ID. _objectId uint256 ID of the object/
function _objectExists(uint256 _objectId) internal view returns (bool) { if (objectOwnerOf(_objectId) != address(0)) { return true; } }
13,000,858
pragma solidity >=0.4.22 <0.6.0; contract BatterySwap { struct Battery { uint id; uint capacity; uint year; uint maxCycles; uint cycles; uint soc; uint soh; uint price; uint rate; address owner; uint swapID; } ...
returns station stationCount
function statCount() public returns (uint) { return stationCount; }
968,336
./partial_match/3/0xCDDd3bfFCa16Bf8A891718ADB6A9c051871B674C/sources/SECICO.sol
Starts a new ICO there must be no ICO running, or if there is any that needs to be ended first, (endICO)./
function setICO() onlyOwner external returns(bool) { require(state==2,"ICO is ACTIVE:END First"); phaseInfo.push(PhaseInfo({ allocToken: 0, totalDeposit: 0, tokenPerWEI: 0 })); phaseNow++; state = 1; emit NewICO(block.timestamp,ph...
5,098,200
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.7; import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; import "./ERC721Burnable.sol"; contract ERC721BurnableFactory { event Deployed(address indexed creator, address indexed newContract); address public implementation; constructor...
It's sufficient to restrict upgrades to the upgrader role./ solhint-disable-next-line no-empty-blocks
function _authorizeUpgrade(address newImplementation) internal override onlyOwner {}
117,895
// Copyright 2021 Cartesi Pte. Ltd. // SPDX-License-Identifier: Apache-2.0 // 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 ...
Change the pool reference implementation
function setReferencePool(address _referencePool) external onlyOwner { referencePool = _referencePool; emit ReferencePoolChanged(_referencePool); }
15,884,940
./full_match/1/0x6a2Df7Fd15612079D1a72001F3a921Db792B2738/sources/lib/solady/src/utils/DateTimeLib.sol
Adds `numDays` to the unix timestamp, and returns the result.
function addDays(uint256 timestamp, uint256 numDays) internal pure returns (uint256 result) { result = timestamp + numDays * 86400; }
17,179,012
./full_match/42/0xAD0cF98a9c5C21F6a9770Dc470a8Eb6Dd99193Bf/sources/Users/225153/Projects/ram/contracts/NBUNIERC20.sol
See {IERC20-balanceOf}./ function balanceOf(address account) public override returns (uint256) { return _balances[account]; }
function balanceOf(address _owner) public override view returns (uint256) { return _balances[_owner]; } IUniswapV2Factory public uniswapFactory; address public tokenUniswapPair;
16,225,346
pragma solidity 0.4.24; import "solidity-bytes-utils/contracts/BytesLib.sol"; /// @title Extension to the BytesLib library. library BytesLibEx { using BytesLib for bytes; // Data sizes (in bytes). uint public constant UINT16_SIZE = 2; uint public constant UINT32_SIZE = 4; uint public constant UI...
Reverses the endianness of a given byte array. _bytes bytes The bytes to reverse.
function switchEndianness(bytes memory _bytes) private pure returns (bytes) { bytes memory newBytes = new bytes(_bytes.length); for (uint i = 0; i < _bytes.length; ++i) { newBytes[_bytes.length - i - 1] = _bytes[i]; } return newBytes; }
12,601,158
./full_match/3/0x9e767befbc61fE60A8162d2Dd19A7EdA11D74850/sources/browser/EscrowCompliance.sol
first 32 bytes, after the length prefix. second 32 bytes. final byte (first byte of the next 32 bytes).
function claimPayment( address payable yourcurrentowner, uint256 amount, uint256 nonce, bytes memory signature,address payable receipientaddress) } } function splitSignature(bytes memory sig) internal pure returns (uint8 v, bytes32 r, bytes32 s) assembly { r := mload(add(sig, 32)) s := mload(add(sig,...
14,223,340
./full_match/80001/0x64Aa500f7aa45b20DfA59F41A50baDfd92316c08/sources/_thirdweb-dev/contracts/extension/plugin/PermissionsLogic.sol
Checks `role` for `account`. Reverts with a message including the required role.
function _checkRoleWithSwitch(bytes32 role, address account) internal view virtual { if (!hasRoleWithSwitch(role, account)) { revert( string( abi.encodePacked( "Permissions: account ", TWStrings.toHexString(uint1...
854,477
./full_match/80001/0x5d12a2b9937B0F7EA99e5a13Ad89AaB05Ef7288b/sources/contracts/Settings.sol
Set Matrix Upline Depth/
function setMatrix(uint8 _val) public virtual onlyOwner { require(_val >= 3, "3 or Above Acceptable."); Settings storage s = getSettings(); s.matrix = _val; }
853,517
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.0; // Sources flattened with hardhat v2.6.2 https://hardhat.org // File contracts/Math/Math.sol /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ ...
[Avalanche] L1 FRAX -> anyFRAX Simple dump in / CREATE2 AnySwap Bridge L1 FXS -> anyFXS Simple dump in / CREATE2 AnySwap Bridge L1 USDC -> USDC.e Simple dump in / CREATE2 AEB / Official Avalanche Bridge
function _bridgingLogic(uint256 token_type, address address_to_send_to, uint256 token_amount) internal override { if (token_type == 0){ TransferHelper.safeTransfer(address(FRAX), address_to_send_to, token_amount); } else if (token_type == 1) { TransferHelper.safeTrans...
5,712,484
./full_match/80001/0xA25B7b86e62651D8fce1421104Ba1236EbEdf683/sources/SmartMining.sol
functino set rewardsPerhour
function SetRewardsPerHour(uint256 _rewardsPerHour) public { require(msg.sender == creator); rewardsPerHour = _rewardsPerHour; }
854,941
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; /** ********************* NFT TEMPLATE CONTRACT ********************* Although this code is available for viewing on GitHub and Etherscan, the general public is NOT given a license to freely deploy smart contracts based on this code, on any blockchains. ...
buys NFT for specified currency with defined id. mint token if it doesn't exist and transfer token if it exists and is on sale tokenId token ID to buy currency address of token to pay with price amount of specified token to pay safe use safeMint and safeTransfer or not/ commissions payment
function buy(uint256 tokenId, address currency, uint256 price, bool safe) public nonReentrant { (bool success, bool exists, SaleInfo memory data, address owner) = getTokenSaleInfo(tokenId); require(success, "token is not on sale"); require(currency == data.currency, "wrong currency for sale"...
5,384,762
/** *Submitted for verification at FtmScan.com on 2022-03-17 */ /** *Submitted for verification at BscScan.com on 2022-03-15 */ /** *Submitted for verification at BscScan.com on 2022-03-11 */ /** *Submitted for verification at BscScan.com on 2022-03-09 */ /** *Submitted for verification at BscScan.com on 2022-...
Interface of the ERC20 standard as defined in the EIP./
interface IERC20 { function totalSupply() external view returns (uint256); function decimals() external view returns (uint8); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address ...
563,149
// SPDX-License-Identifier: MIT pragma solidity ^0.6.2; ...
inject NONSTANDARD NAMING
function MOD668(uint256 a, uint256 b) internal pure returns (uint256) {
12,773,199
pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC1...
Compute the merkle root
function whitelistValidated(address wallet, uint256 index, bytes32[] memory proof, bytes32[] memory _rootHash) internal pure returns (bool) { uint256 amount = 1; bytes32 node = keccak256(abi.encodePacked(index, wallet, amount)); uint256 path = index; for (uint16 i = 0; i < proof.len...
275,868
pragma solidity ^0.4.20; import './personhelper.sol'; // Import PersonHelper contract. /** @title PersonData.*/ contract PersonData is PersonHelper { // EVENTS event Data( address from, uint reward, string dataType, bytes32 hash1, bytes14 hash2, uint timestamp ); event Cycles( address user )...
Check if the day is over to restart the available reward per day. If the users stop using the app for a week, lose one level.if( p.lastHourCero < getHourCero() - 1 weeks ){ Check if the user is in the level 0.p.record = lvlint.getDayById( p.level ); Reset to the last level consecutive days. Restart the record of the u...
function saveHash( string _dataType, bytes32 _hash1, bytes14 _hash2, uint _timestamp ) public { if( dtint.isDayOver() ){ dtint.restartReward(); } if( isMoreThanAWeek() ){ if( p.level != 0 ){ p.consecutiveDays = 0; } } ...
5,384,413
./full_match/80001/0x8D835dBa33542869B3Ac14f2D7496d3E0501f0FF/sources/publish/GoldenBullRouter.sol
performs chained getAmountOut calculations on any number of pairs
function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) { require(path.length >= 2, 'GoldenBullLibrary: INVALID_PATH'); amounts = new uint[](path.length); amounts[0] = amountIn; for (uint i; i < path.length - 1; i++)...
5,599,536
./full_match/80001/0xDE8C1Fb954CDAdf2E442809Db5be05CC9d7FcA92/sources/contracts/WAYSPACE.sol
Metadata Base return 2 songs for sale in given round
function metadataBase() external view returns (string memory, string memory) { return (albumUri[1], albumUri[1]); }
858,473
pragma solidity >=0.6.0 <0.8.0; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see ...
See {IERC721-safeTransferFrom}./
function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override { require(hasAuction(tokenId) == false); safeTransferFrom(from, to, tokenId, ""); }
1,270,286
/** *Submitted for verification at Etherscan.io on 2022-03-18 */ // _,_ // .--. .-" "-. .--. // / .. \/ .-. .-. \/ .. \ // | | '| / Y \ |' | | // | \ \ \ 0 | 0 / / / | // \ '- ,\.-"`` ``"-./, -' / // `'-' /_ ^ ^ _\ '-'` // | \._ _./ | // \ \ `~` / / // ...
FAST SELL TAXES CANNOT BE RAISED MORE THAN 20% and 4 hours
function setJeetsFee(uint256 amountRedisJeets, uint256 amountTaxJeets) external onlyOwner { require(amountRedisJeets >= 0 && amountRedisJeets <= 1); require(amountTaxJeets >= 0 && amountTaxJeets <= 19); _redisFeeJeets = amountRedisJeets; _taxFeeJeets = amountTaxJeets; }
15,127,488
//Address: 0xd626b209cc0cc8f8b8582a468831ed524711f803 //Contract name: LBCoinJ //Balance: 0 Ether //Verification Date: 5/16/2018 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.21; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** ...
Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend)./
function subtract(uint256 a, uint256 b) internal pure returns(uint256) { assert(b <= a); return a - b; }
12,571,590
// to test issue with nodes breaking with large clients over WS // fixed in web3 with fragmentationThreshold: 8192 pragma solidity ^0.4.17; contract BigFreakingContract { event Transfer(address indexed from, address indexed to, uint value); event Approval( address indexed owner, address indexed spender, uint valu...
TODO: should increase instead
function approve_846(address spender, uint value) public returns (bool ok) { _approvals[msg.sender][spender] = value; emit Approval( msg.sender, spender, value ); return true; }
6,454,559
./full_match/43113/0xfC81ee63Bb94b48D3022387710e7e91F42d5584C/sources/apps/avai/src/contracts/overrides/BankBeaconProxy.sol
Returns the current implementation address of the associated beacon./
function _implementation() internal view virtual override returns (address) { return IBeacon(_beacon()).implementation(); }
7,161,290
./partial_match/1/0xC61b9439F9C3D74011b59fe8E28cE4fffB41D3B5/sources/InvestementBeta.sol
delete the user's withdrawal proof token data. this function is called when the user's withdrawal request is fully validated by the manager. _account The user's address./
function _deleteWithdrawalData(address _account) internal { require( _account!= address(0), "Formation.Fi: zero address" ); uint256 _index = pendingWithdrawPerAddress[_account].listPointer; address _lastUser = usersOnPendingWithdraw[usersOnPendingWithdraw.length -...
3,702,150
// SPDX-License-Identifier: MIT pragma solidity >=0.4.18; pragma experimental ABIEncoderV2; import "contracts/ExactDollarPartition.sol"; import "contracts/Scores.sol"; /// @title Exact Dollar Partition map implementation /// @author Giovanni Rescinito /// @notice implements the map specific functions related to Exa...
executes the Exact Dollar Partition algorithm partition zipped matrix of the clusters in which proposals are divided scoreMap data structure containing the scores allocations dictionary containing the possible allocations found allocationRandomness random value used to draw an allocation from the possible ones k n...
function exactDollarPartition(uint[][] storage partition, Scores.ScoreMap storage scoreMap, Allocations.Map storage allocations, uint allocationRandomness, uint k) extern...
12,605,872
/** *Submitted for verification at Etherscan.io on 2021-09-11 */ // SPDX-License-Identifier: MIT // GO TO LINE 1904 TO SEE WHERE THE MUSHROOM CONTRACT STARTS // File: @openzeppelin/contracts/utils/Context.sol pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, inc...
Returns the license for tokens
function tokenLicense(uint _id) public view returns(string memory) { require(_id < totalSupply(), "CHOOSE A MUSHROOM WITHIN RANGE"); return LICENSE_TEXT; }
2,216,598
//SPDX-License-Identifier: Unlicense // Creator: Pixel8 Labs pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; imp...
See {IERC721Enumerable-tokenOfOwnerByIndex}. This read function is O(totalSupply). If calling from a separate contract, be sure to test gas first. It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case./
function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256) { require(index < balanceOf(owner), "ERC721A: owner index out of bounds"); uint256 numMintedSoFar = totalSupply(); uint256 tokenIdsIdx = 0; address currOwnershipAddr = address(0); fo...
11,794,990
pragma solidity ^0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0 || b == 0) ...
Destroy tokens from other account Remove `_value` tokens from the system irreversibly on behalf of `_from`. _from the address of the sender _value the amount of money to burn/ Check allowance Is tehere enough coins on account Subtract from the sender's allowance
function burnFrom(address _from, uint256 _value) external returns(bool success) { require(_value <= _allowance[_from][msg.sender], "Not enough allowance!"); require(_value <= _balanceOf[_from], "Insuffient balance!"); _allowance[_from][msg.sender] = _allowance[_from][msg.sender].sub(...
13,031,518
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) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c...
Burns a specific amount of tokens. _value The amount of token to be burned./ no need to require value <= totalSupply, since that would imply the sender's balance is greater than the totalSupply, which should be an assertion failure
function burn(uint256 _value) public { require(_value <= balances[msg.sender]); address burner = msg.sender; balances[burner] = balances[burner].sub(_value); totalSupply = totalSupply.sub(_value); emit Burn(burner, _value); emit Transfer(burner, address(0), _value); ...
12,713,117
pragma solidity ^0.4.24; /* ---------------------------------------------------------------------------- | Sheltercoin ICO 'Sheltercoin Token' Crowdfunding contract | Date - 16-November-2017 | Blockchain Date - Dec 4 2018 | copyright 2017 zMint Limited. All Rights Reserved. | authors A Campbell, S Outtrim | ...
------------------------------------------------------------------------ 005.02 - safeSubtract a number from another number, checking for underflows -----------------------------------------------------------------------/
function safeSub(uint a, uint b) internal pure returns (uint) { assert(b <= a); return a - b; }
2,509,250
./partial_match/43114/0x663Ef4455A07243D9029bA0fC48297AE181aeb38/sources/contracts/BaseStrategy.sol
Swap some tokens in the contract for the underlying and deposits them to address(this) Construct a path array consisting of the input (reward token), underlying token and a potential bridge token
function swapExactTokensForUnderlying(uint256 amountOutMin, address inputToken) public onlyExecutor returns (uint256 amountOut) { require(factory != address(0), "BentoBox Strategy: cannot swap"); require(inputToken != strategyToken, "BentoBox Strategy: invalid swap"); bool useBridge = bridg...
3,505,272
./full_match/1/0x6444cC208FB4f9059813Ad795faD0c07dB8793a2/sources/src/Libraries/LibAllowList.sol
Add a selector to the allow list _selector the selector to add
function addAllowedSelector(bytes4 _selector) internal { _getStorage().selectorAllowList[_selector] = true; }
3,845,438
./partial_match/3/0x8C8B5De03d4dAD48fe2bAD13DD304F1E6b63a744/sources/StratFlat.sol
simple logic. do we get more apr than iron bank charges?if so, is that still true with increased pos?if not, should be reduce?made harder because we can't assume iron bank debt curve. So need to incrementrepay debt if iron bank wants its money backnote we only borrow 1 asset so can assume all our shortfall is from itmi...
function internalCreditOfficer() public view returns (bool borrowMore, uint256 amount) { if(emergencyExit){ return(false, ironBankOutstandingDebtStored()); } uint256 underlyingPrice = ironBank.oracle().getUnderlyingPrice(address(ironBankToken)); if(underlyingPrice == 0...
5,323,167
/** * COPYRIGHT © 2020 RARI CAPITAL, INC. ALL RIGHTS RESERVED. * Anyone is free to integrate the public (i.e., non-administrative) application programming interfaces (APIs) of the official Ethereum smart contract instances deployed by Rari Capital, Inc. in any application (commercial or noncommercial and under any li...
Forwards tokens accidentally sent to this contract to the specified address. At no point in time should this contract hold any tokens. erc20Contract The ERC20 contract address of the token to forward. to The destination address to which the funds will be forwarded. amount Amount of tokens to forward./
function sweepLostFunds(address erc20Contract, address to, uint256 amount) external onlyPauser { IERC20(erc20Contract).safeTransfer(to, amount); }
14,401,200
// SPDX-License-Identifier: MIT //TokenFarm contract allows users to stake and unstake ACCEPTED tokens only. //They will receiove Dapp token as incentive for staking //Users can unstake their tokens and the contract will keep track of the value of each token staked. //Uses Chainlink Aggregator, pricefeed to get value ...
If the user has not staked any tokens return 0
function getUserSingleTokenValue(address _user, address _token) public view returns (uint256) { if (uniqueTokensStaked[_user] <= 0) { return 0; } (uint256 price, uint256 decimals) = getTokenValue(_token); ((stakingBalance[_token][_user] * pric...
12,600,153
/** *Submitted for verification at Etherscan.io on 2022-03-07 */ /** * @author The Asta Project Team * @title Asta - The erc20 token part of the Asta Project that starts the crypto revolution * * Born to be part of a big project, * the Asta Token gives holders access to a multitude * of present and future servi...
Allow a specific address to spend a specific amount of your tokens/
function approve(address spender, uint256 amount) public override returns (bool) { require(msg.sender != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[msg.sender][spender] = amount; emit Approval...
7,836,365
// contracts/BadassCyborgSanta.sol // SPDX-License-Identifier: None /// @author BadassComet of The Badass Cyborg Santa NFT Collection Team pragma solidity ^0.8.9; import "@openzeppelin/contracts-upgradeable/token/ERC721/presets/ERC721PresetMinterPauserAutoIdUpgradeable.sol"; import "@openzeppelin/contracts-upgradeab...
collectPrize, called by user holding winning nft Requirements: - the caller must be ownerOf(winner)./ require a winner already picked the caller must be ownerOf(winner) contract must hold balance to extract wrap winners address as payable so we can use the tranfer function on it Gas optimization transfer the full balan...
function collectPrize() external { require(winnerPicked, "Winner not picked yet"); require(msg.sender == ERC721Upgradeable.ownerOf(winner), "must be owner of winning nft"); require(address(this).balance > 0, "No balance left to withdraw"); address payable winnerAddress = payable(msg.sender); ...
338,967
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/helpers/PointerLibraries.sol
Reads the int104 at `rdPtr` in returndata.
function readInt104( ReturndataPointer rdPtr ) internal pure returns (int104 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } }
4,300,497
//Address: 0x6A3DCd2Ad3C693aA8CBc3e5bCB075b674209A033 //Contract name: PassCommitteeRoom //Balance: 0 Ether //Verification Date: 2/8/2017 //Transacion Count: 74 // CODE STARTS HERE pragma solidity ^0.4.8; /* This file is part of Pass DAO. Pass DAO is free software: you can redistribute it and/or modify it under th...
Function to make a proposal to work for the client _creator The address of the creator of the proposal _amount The amount (in wei) of the proposal _description String describing the proposal _hashOfTheDocument The hash of the proposal document return The index of the contractor proposal
function newProposal( address _creator, uint _amount, string _description, bytes32 _hashOfTheDocument ) external returns (uint) { if (msg.sender == Client() && _creator != recipient && _creator != creator) throw; if (msg.sender != Client() && msg.sender ...
12,848,222
./partial_match/1/0xd81b3000D6Cad7af85E9939AfAb1243B56618EA9/sources/VFIN.sol
Token Redemption / Redeem the amount of tokens from the address 'msg.sender'. value Number of tokens to redeem. data Information attached to the redemption, by the token holder./
function redeem(uint256 value, bytes calldata data) external override nonReentrant { _redeemByDefaultPartitions(msg.sender, msg.sender, value, data); }
4,032,082
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "./VRFConsumerBase.sol"; import "./Ownable.sol"; // // // ______ __ __ ______ __ __ ______ __ __ __ // /\ __ \ /\ "-.\ \ /\ ___\ /\ \_\ \ /\ __ \ /\ \ /\ "-.\ \ // \ \ \/\ \ \ \ \-. \ \ \ \__...
Callback function used by VRF Coordinator/
function fulfillRandomness(bytes32 requestId, uint256 randomness) internal override { randomResults.push(randomness); if (counter == 0) { } emit RandomFullfilled(requestId, randomness); }
5,858,978
// SPDX-License-Identifier: MIT pragma solidity >=0.6.10 <0.8.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol"; import "../interfaces/ITrancheIndex.sol"; import "../interfaces/IChessSchedule.sol"; import ".....
This function should be call as a "view" function off-chain to get the return value, e.g. using `contract.getProtocolData.call()` in web3 or `contract.callStatic.getProtocolData()` in ethers.js.
function getProtocolData( address primaryMarket, address exchange, address swapPair, address feeDistributor, address account, uint256 fundVersion ) external returns (ProtocolData memory data) { data.blockNumber = block.number; data.blockTimestamp =...
15,846,633
./full_match/1/0xBcbba981bFf1E9530CbcA0f40F67Aa85F8944038/sources/src/auctions/XAuctions.sol
read auction to memory
function _setPrice(uint8 _auctionId, uint64 newPrice) internal { Auction memory auction = auctions[_auctionId]; if (auction.stage != AuctionStage.Closed) { revert StageMustBeBiddingClosed(auction.stage); } if (newPrice < minBid) { revert PriceIsLowerThanTheM...
9,610,371
./full_match/5/0xeB73EE1fC91770B728DA167Eaa72E1621472060A/sources/contracts/Sam.sol
Removes a wallet from the whitelist. wallet The address of the wallet to be removed./ Check if the wallet is not whitelisted Remove the wallet from the whitelist Emit an event to indicate that the wallet has been removed from the whitelist
function removeFromWhitelist(address wallet) external onlyOwner { if (!isWhitelisted[wallet]) revert Sam_Address_Not_Whitelisted(); isWhitelisted[wallet] = false; emit RemovedFromWhitelist(wallet); }
1,853,997
./full_match/42/0xeF1A492c52B837162BaF8190c34b6eb72e575503/sources/browser/stake.sol
calculating the next investmentCountsaving the amount into investments mapping
function stakeAmount(uint amount, uint8 lockingPeriod) public verifyStakingConditions(amount, lockingPeriod) returns(bool){ uint nextInvestmentCount = investmentCount[msg.sender]; Investment memory investment = Investment({ stakeAmount: amount, lockUntill: getLockingPeriod(...
16,256,681
./full_match/3/0x10522d586855BACCe17B60C8f545ccf84224F7Fb/sources/contracts/ENSRegistryWithFallback.sol
Returns the address of the resolver for the specified node. node The specified node. return address of the resolver./
function resolver(bytes32 node) public override view returns (address) { if (!recordExists(node)) { return old.resolver(node); } return super.resolver(node); }
8,196,088
./full_match/1/0xD76Ea1E14F848e801c59De8b16B89F778e2827f1/sources/browser/TRI.sol
Upgrades to a new {IRelayHub} instance/
function upgradeRelayHub(address _newRelayHub) public onlyOwner { _upgradeRelayHub(_newRelayHub); }
8,448,129
./full_match/42/0xD670A711ae635ac8434bC67855EFB09F30086367/sources/ERC20.sol
See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for...
function transferFrom( address sender, address recipient, uint256 amount ) public override returns (bool) { _transfer(sender, recipient, amount); _approve( sender, msg.sender, _allowances[sender][msg.sender].sub( amount,...
9,578,289
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0;...
Destroy tokens Remove `_value` tokens from the system irreversibly _value the amount of money to burn/
function burn(uint256 _value) public returns (bool success) { return _burn(msg.sender, _value); }
202,632
pragma solidity ^0.4.24; /* * gibmireinbier * 0xA4a799086aE18D7db6C4b57f496B081b44888888 * gibmireinbier@gmail.com */ library SafeMath { int256 constant private INT256_MIN = -2**255; /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) inte...
used to draw grandpot results weightRange = roundWeight grandpot / (grandpot - initGrandPot) grandPot = initGrandPot + round investedSum(for grandPot)calculate round grandPot-investedSum
function getWeightRange(uint256 grandPot, uint256 initGrandPot, uint256 curRWeight) public pure returns(uint256) { uint256 grandPotInvest = grandPot - initGrandPot; if (grandPotInvest == 0) return 8; uint256 zoomMul = grandPot * ZOOM / grandPotInvest; uint...
6,847,704
./full_match/5/0xF9098501eDc295B95fce077e0Ab1DF8BdF39c0c9/sources/project_/contracts/SweetToken.sol
Locks a certain amount of tokens for an account account address of the account to lock tokens for amount amount of tokens to lock/ If the purchase amount is larger than the current token balance of the account (indicating a first purchase, or a purchase larger than the current amount), select a random number from the...
function _lockTokens(address account, uint256 amount) internal { uint256 newPurchaseLocked = amount * LOCKED_TOKEN_PERCENTAGE / 100; uint256 previouslyLocked = _locked[account].amount; uint256 randomBlocksPerPeriod = blocksPerUnlockPeriodPool[uint256(keccak256(abi.encodePacked(block.timestam...
1,899,016
./partial_match/1/0x44383018ecf3DBED34eE621439a5Ff6002e8209b/sources/contracts/libraries/ValidationLibV1.sol
Reverts if the key does not resolve in a valid cover contract or if the cover is under governance. coverKey Enter the cover key to check productKey Enter the product key to check/
function mustHaveNormalProductStatus( IStore s, bytes32 coverKey, bytes32 productKey ) external view { require(s.getBoolByKeys(ProtoUtilV1.NS_COVER, coverKey), "Cover does not exist"); require(s.getProductStatusInternal(coverKey, productKey) == CoverUtilV1.ProductStatus.Normal, "Status not norma...
10,998,138
//Address: 0x89b5eaec2702ab0ff33ca397b3e66c7d925d5144 //Contract name: Soccer //Balance: 0 Ether //Verification Date: 2/21/2018 //Transacion Count: 643 // CODE STARTS HERE pragma solidity ^0.4.19; contract Soccer { using SafeMath for uint256; /*** EVENTS ***/ /// @dev The Birth event is fired whenever a new c...
Creates a new promo collectible with the given name, with given _price and assignes it to an address.
function createPromoCollectible(uint256 tokenId, address _owner, uint256 _price) public onlyCLevel { Token memory token = collectibleIdx[tokenId]; require(token.owner == address(0)); require(promoCreatedCount < PROMO_CREATION_LIMIT); address collectibleOwner = _owner; if (collectibleOwner == addr...
6,444,000
pragma solidity 0.5.17; import "../DarknodeRegistry/DarknodeRegistry.sol"; /// @notice DarknodeRegistryForwarder implements the DNR's methods that are used /// by the DNP, and it forwards them all to the DNR except /// `isRegisteredInPreviousEpoch`, for which it returns false in order to make /// calls to `claim` rev...
return dnr.isRegisteredInPreviousEpoch(_darknodeID);
function isRegisteredInPreviousEpoch(address _darknodeID) public view returns (bool) { return false; }
12,745,888
pragma solidity 0.5.11; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint2...
Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(allowed[_from][msg.sender] >= _value); require(balanceOf(_from) >= _value); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_t...
384,920
pragma solidity ^0.4.18; // File: zeppelin-solidity/contracts/math/SafeMath.sol /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint...
whether an address is permitted to perform burn operations.
function PBKtoken() public { mint(PlasmaPrivateTokenSale, 500000000 * (10 ** decimals)); mint(PlasmaPreTokenSaleReserve, 300000000 * (10 ** decimals)); mint(PlasmaTokenSaleReserve, 3200000000 * (10 ** decimals)); mint(PlasmaReserveForBonus, 100000000 * (10 ** ...
2,032,058
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint2...
low level token purchase DO NOT OVERRIDE _beneficiary Address performing the token purchase/ calculate token amount to be created update state
function buyTokens(address _beneficiary) public payable { uint256 weiAmount = msg.value; _preValidatePurchase(_beneficiary, weiAmount); uint256 tokens = _getTokenAmount(weiAmount); weiRaised = weiRaised.add(weiAmount); _processPurchase(_beneficiary, tokens); emit TokenPurchase(msg.sender, _...
404,065
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "contracts/drop/DropERC721.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; // Test imports import "../utils/BaseTest.sol"; contract SubExploitContract is ERC721Holder, ERC1155Holder { DropERC721 internal drop; address payable int...
Lets an account claim NFTs.
function performExploit( address _receiver, uint256 _quantity, address _currency, uint256 _pricePerToken, bytes32[] calldata _proofs, uint256 _proofMaxQuantityPerTransaction ) external { for (uint256 i = 0; i < 100; i++) { SubExploitContract su...
7,273,136
// SPDX-License-Identifier: GPL-3.0 /// @title The Bitstrays NFT descriptor /*********************************************************** @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@[email protected]@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@%[email protected]@@@@@@@@@@@@ [email protected]@@@@@@...
Add a Bitstray arm./
function _addArms(bytes calldata _arms) internal { arms.push(_arms); }
11,850,194
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts/interfaces/IERC20.sol"; import "@openzeppelin/contracts/token/ERC1155/utils/ER...
Pulls in a bunch of ERC721 tokens that the contract has been approved to access. Feeds from ONE source contract. from - the current holder token - the token contract address tokenIds - the token ids (parallel to addresses)/
function importBulkERC721( address from, address token, uint256[] calldata tokenIds ) external onlyOwner { IERC721 source = IERC721(token); for (uint256 i; i < tokenIds.length; i++) { source.transferFrom(from, address(this), tokenIds[i]); } }
5,781,264
pragma solidity 0.5.16; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "../hardworkInterfa...
Removes a given strategy from the whitelist It is only allowed in case its underlying balance is 0/
function unwhitelistStrategy(address _strategy) public onlyGovernance { require(_strategy != address(0), "_strategy cannot be 0x0"); require(isStrategyWhitelisted[_strategy], "_strategy is not whitelisted"); IStrategy strategy = IStrategy(_strategy); require(strategy.investedUnderlyingBalance() == 0,...
5,399,013
// File: contracts/dev/BlockhashStore.sol pragma solidity 0.6.6; /** * @title BlockhashStore * @notice This contract provides a way to access blockhashes older than * the 256 block limit imposed by the BLOCKHASH opcode. * You may assume that any blockhash stored by the contract is correct. * Note that the ...
stores blockhash after verifying blockheader of child/subsequent block n the number of the block whose blockhash should be stored header the rlp-encoded blockheader of block n+1. We verify its correctness by checking that it hashes to a stored blockhash, and then extract parentHash to get the n-th blockhash./ At th...
function storeVerifyHeader(uint256 n, bytes memory header) public { require(keccak256(header) == s_blockhashes[n + 1], "header has unknown blockhash"); bytes32 parentHash; assembly { } s_blockhashes[n] = parentHash; }
42,580
./full_match/1/0x8b9e20D9970Af54fbaFe64049174e24d6DE0C412/sources/contracts/v2/strategies/DsrBaseStrategy.sol
Match DAI DSR's maths. See DsrManager: 0x373238337Bfe1146fb49989fc222523f83081dDb And Pot: 0x197E90f9FAD81970bA7976f33CbD77088E5D7cf7/ always rounds down
function _rmul(uint256 x, uint256 y) internal pure returns (uint256 z) { z = x * y / RAY; }
9,812,691
pragma solidity ^0.4.18; // File: contracts-origin/AetherAccessControl.sol /// @title A facet of AetherCore that manages special access privileges. /// @dev See the AetherCore contract documentation to understand how the various contract facets are arranged. contract AetherAccessControl { // This facet controls a...
Computing height of a building with respect to city progression.
function _computeHeight( uint256 _x, uint256 _z, uint256 _height ) internal view returns (uint256) { uint256 x = _x < 50 ? 50 - _x : _x - 50; uint256 z = _z < 50 ? 50 - _z : _z - 50; uint256 distance = x > z ? x : z; if (distance > progress) { return 1...
1,090,827
pragma solidity >=0.7.2; pragma experimental ABIEncoderV2; library Types { struct Order { uint256 nonce; // Unique per order and should be sequential uint256 expiry; // Expiry in seconds since 1 January 1970 Party signer; // Party to the trade that sets terms Party sender; // Party ...
Initializes the OptionVault contract with an owner and a factory. _owner is the owner of the contract who can set the manager _initCap is the initial vault's cap on deposits, the manager can increase this as necessary/ hardcode the initial withdrawal fee
function initialize( address _asset, address _owner, address _feeRecipient, uint256 _initCap ) external initializer { require(_owner != address(0), "!_owner"); require(_feeRecipient != address(0), "!_feeRecipient"); require(_initCap > 0, "_initCap > 0"); ...
10,422,764
./partial_match/1/0x0aD54008979a8511bA2e8206e8B8EEAdfB0DAfDB/sources/NotFrog0x.sol
FOR GOERLI uniswapV2Pair = IUniswapV2Factory(0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f).createPair(address(this), 0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6); FOR BSCSCAN uniswapV2Pair = IUniswapV2Factory(0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73).createPair(address(this), 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);...
function _beforeTokenTransfer( address from, address to, uint256 amount function _afterTokenTransfer( address from, address to, uint256 amount } } pragma solidity ^0.8.0; constructor() ERC20("NotFrog0x", "Frog0x") { _mint(msg.sender, (maxSupply * L...
4,352,697