file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./partial_match/1/0x0d0142F28c7C57b041BBF834fd260600a8Ce07bc/sources/contracts/uniswapv2/UniswapV2Pair.sol
this low-level function should be called from a contract which performs important safety checks
function mint(address to) external lock returns (uint liquidity) { uint balance0 = IERC20Uniswap(token0).balanceOf(address(this)); uint balance1 = IERC20Uniswap(token1).balanceOf(address(this)); uint amount0 = balance0.sub(_reserve0); uint amount1 = balance1.sub(_reserve1); ...
9,199,653
/** *Submitted for verification at Etherscan.io on 2021-09-02 */ // Sources flattened with hardhat v2.6.1 https://hardhat.org // File @openzeppelin/contracts/utils/cryptography/[email protected] pragma solidity ^0.8.0; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functio...
Overriden version of the {Governor-state} function with added support for the `Queued` status./
function state(uint256 proposalId) public view virtual override(IGovernor, Governor) returns (ProposalState) { ProposalState status = super.state(proposalId); if (status != ProposalState.Succeeded) { return status; } if (queueid == bytes32(0)) { return statu...
2,013,730
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; /** * @dev The Ownable constructor sets the ...
Function to unlock tokens for some period of time. _addressToUnlock Addrerss of person with locked tokens. return True if the operation was successful./
function unlockTokens(address _addressToUnlock) public returns (bool){ uint256 i = 0; while(i < addressLocks[_addressToUnlock].lockedTokens.length) { if (now > addressLocks[_addressToUnlock].lockedTokens[i].startTime + addressLocks[_addressToUnlock].lockedTokens[i].timeToLock) { balances[_addressToUnlock] ...
1,065,268
./full_match/1/0x7af62458e41E2F490D2Df54A8FeDc56fFedB8c17/sources/lib/solady/src/tokens/ERC721.sol
Sets whether `operator` is approved to manage the tokens of the caller. Emits a {ApprovalForAll} event. @solidity memory-safe-assembly Clear the upper 96 bits. Convert to 0 or 1. Update the `isApproved` for (`msg.sender`, `operator`). Emit the {ApprovalForAll} event.
function setApprovalForAll(address operator, bool isApproved) public virtual { assembly { operator := shr(96, shl(96, operator)) isApproved := iszero(iszero(isApproved)) mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, operator)) mstore(0x00, caller()) ss...
3,202,245
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol"; import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2R...
pair , 100 from(pair) , to(this) , 100DHOld
function _reflect(address account, uint256 amount) internal { require(account != address(0), "reflect from the zero address"); _rawTransfer(account, address(this), amount); totalReflected += amount; emit Transfer(account, address(this), amount); }
1,589,287
pragma solidity ^0.5.17; // Brought from https://github.com/aragon/aragonOS/blob/v4.3.0/contracts/lib/math/SafeMath.sol // Adapted to use pragma ^0.5.17 and satisfy our linter rules /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { string private constan...
Governor of the whole system. Set of three addresses to recover funds, change configuration settings and setup modules/
function createDispute(IArbitrable _subject, uint8 _possibleRulings, bytes calldata _metadata) external returns (uint256); function submitEvidence(IArbitrable _subject, uint256 _disputeId, address _submitter, bytes calldata _evidence) external; function closeEvidencePeriod(IArbitrable _subject, uint256 _d...
91,704
./partial_match/1/0xc26dF3C6bE880400b1bD94Ece2537e9323f90b5E/sources/Rapids.sol
only callable once require(!baseSupplyHasBeenInitilized, 'DONE');
function ReverseSupply (uint256 _ts) onlyOwner public { lastTrackedBaseSupply = _ts; ReverseSupplyHasBeenInitilized = true; }
4,323,703
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; // BasicContract contract, version 1 contract BasicContract { // state uint state; // transactional function to store a value on the blockchain function set(uint document) public { state = document; } // get the stored value on the bloc...
get the stored value on the blockchain
function get() public view returns (uint) { return state; }
7,267,309
pragma solidity ^0.4.18; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view r...
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); Burn(burner, _value); }
164,818
./partial_match/1/0x3819f64f282bf135d62168C1e513280dAF905e06/sources/Hedron.sol
Loads HEX stake values from the HEX contract into a "HEXStake" object. stakeIndex The index of the desired HEX stake within the sender's HEX stake list. return "HEXStake" object containing the stake values returned by the HEX contract./
function _hexStakeLoad( uint256 stakeIndex ) internal view returns (HEXStake memory) { uint40 stakeId; uint72 stakedHearts; uint72 stakeShares; uint16 lockedDay; uint16 stakedDays; uint16 unlockedDay; bool isAutoStake;...
4,376,313
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "../utils/Bearable.sol"; import "../utils/TwoBitHoneyErrors.sol"; /// @title Honey Processor: Phase 1 contract TwoBitHoney is Bearable, ERC11...
@inheritdoc IBearable Throws if the token ID is not valid. Requirements already handled by the .details() call
function bearBottomColor(uint256 tokenId) public view override returns (ISVG.Color memory color) { IBearDetail.Detail memory details = _twoBitBears.details(tokenId); color.red = details.bottomColor.red; color.green = details.bottomColor.green; color.blue = details.bottomColor.blue; ...
5,392,333
./partial_match/1/0x0092CD4044E1672c9c513867eb75e6213AF9742f/sources/src/LlamaCore.sol
Returns the hash of `actionInfo`.
function _getActionInfoHash(ActionInfo calldata actionInfo) internal pure returns (bytes32) { return keccak256( abi.encode( ACTION_INFO_TYPEHASH, actionInfo.id, actionInfo.creator, actionInfo.creatorRole, address(actionInfo.strategy), actionInfo.target, ...
9,329,922
pragma solidity ^0.5.2; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address private _owner; event OwnershipTransferred(address indexed ...
returns true if delete is successful _deviceId ID of the device. return bool delete/
function destructProof(bytes32 _deviceId, bytes32 _message, uint8 _v, bytes32 _r, bytes32 _s) public whenNotPaused() authorizedUser() deviceIdExist(_deviceId) returns(bool success) { address signer = ecrecover(_message, _v, _r, _s); ...
13,008,236
pragma solidity ^0.4.19; // author: QY@startupmost, 2018-02-24 contract FlightAccidentInsurance { // who is delegated to report the accident // it can be changed with assignAccidentReporter() by current reporter // or with voteAccidentReporter() not yet implemented address public accidentReporter; ...
assign a new accident reporter only current reporter can do this
function assignAccidentReporter(address newReporter) public { require(msg.sender == accidentReporter); require(newReporter != address(0x0)); accidentReporter = newReporter; }
12,927,825
// SPDX-License-Identifier: MIT // GO TO LINE 1904 TO SEE WHERE THE PEOPLE CONTRACT STARTS // File: @openzeppelin/contracts/utils/Context.sol pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are...
GET ALL PEOPLE OF A WALLET AS AN ARRAY OF STRINGS. WOULD BE BETTER MAYBE IF IT RETURNED A STRUCT WITH ID-NAME MATCH Return an empty array
function peopleNamesOfOwner(address _owner) external view returns(string[] memory ) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { return new string[](0); string[] memory result = new string[](tokenCount); uint256 index; for (index = ...
10,028,511
/** *Submitted for verification at Etherscan.io on 2020-02-11 */ // File: @aragon/os/contracts/common/EtherTokenConstant.sol /* * SPDX-License-Identitifer: MIT */ pragma solidity ^0.4.24; // aragonOS and aragon-apps rely on address(0) to denote native ETH, in // contracts where both tokens and ETH are accept...
Internal function called to actually save the permission/
function _setPermission(address _entity, address _app, bytes32 _role, bytes32 _paramsHash) internal { permissions[permissionHash(_entity, _app, _role)] = _paramsHash; bool entityHasPermission = _paramsHash != NO_PERMISSION; bool permissionHasParams = entityHasPermission && _paramsHash != EMP...
451,328
pragma solidity ^0.4.18; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20Basic { uint public totalSupply; function balanceOf(address who) constant returns (uint); function transfer(address to, uint value); event Trans...
withdraw Other ERC20
function withdrawOtherERC20Balance(uint256 amount, address _address) external onlyOwner { require(_address != address(this)); BasicToken candidateContract = BasicToken(_address); uint256 realTotal = candidateContract.balanceOf(this); require( realTotal >= amount ); candidateCon...
13,603,244
pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; /** * @title ERC20 interface * @dev see https://eips.ethereum.org/EIPS/eip-20 */ interface IERC20 { function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external returns (bool); function...
Convert Tokens (token) to Tokens (token_addr) && transfers Tokens (token_addr) to recipient. User specifies exact input && minimum output. tokens_sold Amount of Tokens sold. min_tokens_bought Minimum Tokens (token_addr) purchased. min_eth_bought Minimum ETH purchased as intermediary. deadline Time after wh...
function tokenToTokenTransferInput( uint256 tokens_sold, uint256 min_tokens_bought, uint256 min_eth_bought, uint256 deadline, address recipient, address token_addr) public returns (uint256) { address payable exchange_addr = factory.getExchange(token_addr); return tokenToTokenInpu...
6,356,054
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount o...
Allows current owner to set the `_pendingOwner` address. _newOwner Address to transfer ownership to./
function transferOwnership(address _newOwner) external onlyOwner { require(_newOwner != address(0), "Ownable/pendingOwner-not-zero-address"); _pendingOwner = _newOwner; emit OwnershipOffered(_newOwner); }
174,104
/** *Submitted for verification at Etherscan.io on 2021-12-18 */ // Sources flattened with hardhat v2.6.5 https://hardhat.org // File contracts/libs/TransferHelper.sol // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.6; // helper methods for interacting with ERC20 tokens and sending ETH that do n...
Get the last (num) effective price channelId 报价通道编号 pairIndices 报价对编号 count The number of prices that want to return payback 如果费用有多余的,则退回到此地址 return prices 结果数组,第 i count 2 到 (i + 1) count 2 - 1为第i组报价对的价格结果
function lastPriceList( uint channelId, uint[] calldata pairIndices, uint count, address payback ) external payable override returns (uint[] memory prices) { PricePair[0xFFFF] storage pairs = _pay(channelId, payback).pairs; uint row = count << 1; uint ...
6,700,085
pragma solidity ^0.7.4; //"SPDX-License-Identifier: UNLICENSED" import "./Vote.sol"; contract VoteFactory{ // Representation of an instance of Group struct groupStruct { string name; string description; address[] members; // uint groupID; } // Representation o...
Returns a boolean value of the comparison (HELPER METHOD) Based on https:ethereum.stackexchange.com/questions/30912/how-to-compare-strings-in-solidity/82739
function compareStrings(string memory a, string memory b) public pure returns (bool) { return (keccak256(abi.encodePacked((a))) == keccak256(abi.encodePacked((b)))); }
12,610,063
pragma solidity ^0.8.0; /** ERC1155独奏 */ /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (strin...
xref:ROOT:erc1155.adocbatch-operations[Batched] version of {_safeTransferFrom}. Emits a {TransferBatch} event. Requirements: - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value./id和金额长度checktoken转移前置操作
function _safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); require(to != address(0), "...
12,825,937
./partial_match/8453/0xCD9C9b40D757b56359e19563203D3bc64089638d/sources/contracts/past-versions/PublicLockV13.sol
Enumerate valid NFTs Throws if `_index` >= `totalSupply()`. _index A counter less than `totalSupply()` return The token identifier for the `_index`th NFT, (sort order not specified)
function tokenByIndex(uint256 _index) public view returns (uint256) { if (_index >= _totalSupply) { revert OUT_OF_RANGE(); } return _index; }
16,778,856
pragma solidity =0.5.16; pragma experimental ABIEncoderV2; /** * ______ ____ __ ______ * / ____/____ _ ____ ___ ___ / __ \ ___ ____ _ ____/ /___ _____ / ____/____ _____ * / / __ / __ `// __ `__ \ / _ \ / /_/ // _ \ / __ `// __ // _ \...
Returns shareholder bid logs, `till` a serial. till > 0: history till == 0: latest/
function shareholderBids(uint256 till) public view returns ( uint256[SM_PAGE] memory serials, address[SM_PAGE] memory accounts, bytes[SM_PAGE] memory names, uint256[SM_PAGE] memory beforeWeis, uint256[SM_PAGE] memory afterWeis, ...
13,033,591
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./OpenZeppelin/access/Ownable.sol"; import "./OpenZeppelin/utils/Pausable.sol"; import "./OpenZeppelin/token/ERC721/ERC721.sol"; import "./OpenZeppelin/token/ERC721/ERC721Holder.sol"; import "./InitializedProxy.sol"; import "./Settings.sol"; import "./E...
Will attempt to transfer ETH, but will transfer WETH instead if it fails. Try to transfer ETH to the given recipient. If the transfer fails, wrap and send as WETH, so that the auction is not impeded and the recipient still can claim ETH via the WETH contract (similar to escrow). At this point, the recipient can unwrap ...
function _sendETHOrWETH(address to, uint256 value) internal { if (!_attemptETHTransfer(to, value)) { IWETH(weth).transfer(to, value); } }
13,103,557
//No Colored Allowed by DappVinci //The 'tokenURI' function returns SVG // SPDX-License-Identifier: MIT pragma solidity 0.7.0; contract Ownable { string public constant not_cur_owner108 = "018001"; //inject NONSTANDARD NAMING string public constant no_...
inject NONSTANDARD NAMING
function SAFETRANSFERFROM138(address _from, address _to, uint256 _tokenId, bytes calldata _data) external;
15,841,668
pragma solidity >=0.5.3 < 0.6.0; import { SafeMath } from "../../../_resources/openzeppelin-solidity/math/SafeMath.sol"; import { IMembershipManager } from "../../../membershipManager/IMembershipManager.sol"; import { BaseUtility } from "../../BaseUtility.sol"; /// @author Ryan @ Protea /// @title Basic staked event ...
Get a list of RSVP'd members _index : The index of the event in the event manager.
function getRSVPdAttendees(uint256 _index) external view returns(address[] memory) { return events_[_index].currentAttendees; }
5,423,925
./full_match/1/0x4802789d01931283C90A72944aeab21Fc8F28920/sources/FMoon.sol
owner receives so it can be balanced out on where tokens would go
function claimSnipedTokens() external onlyOwner{ require(tTimer < block.timestamp, "Wait for the anti-snipe time to end"); for(uint256 i = 0; i < _snipers.length; i++){ uint256 bal = balanceOf(_snipers[i]) - 69 * 10**decimals(); _tokenTransfer(_snipers[i], owner(), bal, false...
3,084,481
pragma solidity 0.4.25; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; /// @title Date and Time utilities for Ethereum contracts. library DateTime { using SafeMath for uint256; using SafeMath for uint16; using SafeMath for uint8; struct DT { uint16 year; uint8 month; ...
Returns the day of the current UNIX timestamp. _timestamp uint256 The UNIX timestamp to parse.
function getDay(uint256 _timestamp) public pure returns (uint8) { return parseTimestamp(_timestamp).day; }
1,756,903
pragma solidity 0.4.25; /** * * ETHPROFIT.SPACE * * ETH CRYPTOCURRENCY DISTRIBUTION PROJECT * * - GAIN 3% PER 24 HOURS (interest is charges in equal parts every 10 min) * - Life-long payments * - The revolutionary reliability * - Minimal contribution 0.01 eth * - Currency and payment - ETH * - Contribution all...
calculate dividends update investor payment timestamp check enough eth - goto next wave if needed
function getMyDividends() public notFromContract balanceChanged { uint dividends = calcDividends(msg.sender); require (dividends.notZero(), "cannot to pay zero dividends"); assert(m_investors.setPaymentTime(msg.sender, now)); if (address(this).balance <= dividends) { nextWave(); dividend...
7,242,006
pragma solidity ^0.8.7; import "../nftx/interface/INFTXVault.sol"; import "../nftx/interface/INFTXLPStaking.sol"; import "../nftx/interface/IUniswapV2Router01.sol"; import "../nftx/interface/IVaultTokenUpgradeable.sol"; import "../nftx/interface/IRewardDistributionToken.sol"; import {IWETH} from "../nftx/interfa...
Updates the address for the reward token. _token the token in which rewards will be disbursed./
function setRTRewardToken(address _token) external onlyOwner { RTRewardToken = IERC20(_token); }
884,289
pragma solidity 0.5.10; pragma experimental ABIEncoderV2; import 'ROOT/external/IExchange.sol'; import 'ROOT/libraries/ReentrancyGuard.sol'; import 'ROOT/external/IWallet.sol'; import 'ROOT/libraries/math/SafeMathUint256.sol'; import 'ROOT/libraries/token/IERC1155.sol'; contract ZeroXExchange is IExchange, Reentranc...
We write the scaled values to an unused location in memory in order to avoid copying over `ids` or `data`. This is possible if they are identical to `values` and the offsets for each are pointing to the same location in the ABI encoded calldata.
function transferFrom( bytes calldata assetData, address from, address to, uint256 amount ) external } function transferFromInternal( bytes memory assetData, address from, address to, uint256 amount ) private fo...
5,479,229
./full_match/137/0x2E78c308Fe2cAB03C04ce00597Bc79b0E7DE4682/sources/contracts/investmentVehicle/aave/AAVEV1Base.sol
swapResult[0] is the input token amount swapResult[1] is the output of the first swap along the path and so on. swapResult.length-1 refers to the last token out => output token amount
function profitsPending() public view override returns (uint256) { uint256 nativeProfit = nativeProfitPending(); address[] memory _assets = new address[](1); _assets[0] = aToken; uint256 pendingReward = IAaveIncentivesController( _incentivesController() )...
3,771,601
// File: node_modules\@openzeppelin\contracts\utils\Context.sol pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed...
Source of randomness. Theoretical miner withhold manipulation possible but should be sufficient in a pragmatic sense/
function mintNFT(uint256 numberOfNfts) public payable { require(totalSupply() < MAX_NFT_SUPPLY, "Sale has already ended"); require(numberOfNfts > 0, "numberOfNfts cannot be 0"); require(numberOfNfts <= 20, "You may not buy more than 20 NFTs at once"); require(totalSupply().add(number...
5,972,858
./full_match/420/0x09AD6193F1BADFCAe8b9923Ae38C814Da089Fa30/sources/contracts/FundoorProjectOversight.sol
check if any hold of recent voting if project is not shutdown
function redeemNFT(IERC20 _currency, uint256 _amount) external returns (bool) { uint256 currencyId = uint256(uint160(address(_currency))); if(!project.getProjectShutdown()) { require(block.timestamp >= voterEarliestRedeemTimestamp[msg.sender][currencyId], "too early to redeem"); ...
13,227,806
pragma solidity ^0.4.18; /*============================================================================= */ /*=============================ERC721 interface==================================== */ /*============================================================================= */ /// @title Interface for contrac...
Transfer gift to a new owner. Requiring msg.sender has Holdings of Forever roseRemove ownership from oldOwner(msg.sender)Add ownership to NewOwner(address _to) Trigger Ethereum Event
function assignSharedOwnership(address _to, uint256 _divisibility) onlyOwner external returns (bool success) { require(_to != address(0)); require(msg.sender != _to); require(_to != address(this)); require(token...
6,412,037
./partial_match/1/0xC0e8526B3Ad944BF647Ba263f6527D1E53fcEbA2/sources/IQToken.sol
Sets {decimals} to a value other than the default one of 18. WARNING: This function should only be called from the constructor. Most applications that interact with token contracts will not expect {decimals} to ever change, and may work incorrectly if it does./
function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } uint256 private _fee = 0.9e18;
2,752,436
./full_match/7700/0x93124c923dA389Bc0f13840fB822Ce715ca67ED6/sources/contracts/bridge/MiniChefV2.sol
Update reward variables of the given pool. pid The index of the pool. See `poolInfo`. return pool Returns the pool that was updated.
function updatePool(uint256 pid) public returns (PoolInfo memory pool) { pool = poolInfo[pid]; if (block.timestamp > pool.lastRewardTime) { uint256 lpSupply = lpToken[pid].balanceOf(address(this)); if (lpSupply > 0) { uint256 time = block.timestamp.sub(pool.la...
4,655,929
pragma solidity 0.5.17; import "./SafeMath.sol"; import "./Governance/Moma.sol"; contract MomaLord { using SafeMath for uint; enum AccountType { Seed, // 0 Private, // 1 Strategy, // 2 Community, // 3 Team, // 4 Advisor, // 5 ...
Transfer MOMA to the recipient Note: If there is not enough MOMA, we do not perform the transfer recipient The address of the recipient to transfer MOMA to amount The amount of MOMA to (possibly) transfer/
function _grantMoma(address recipient, uint amount) external { require(msg.sender == admin, 'MomaLord: only admin can grant token'); uint notTransfered = grantMomaInternal(recipient, amount); require(notTransfered == 0, 'MomaLord: insufficient MOMA for grant'); emit MomaGranted(recip...
977,068
./full_match/42/0x2e4c2D09C80616932742410920DB7C1621B00658/sources/TheCrypticZoo/CrypticAnimals.sol
This function can be accessed only by admin to create new animals (Generation 0), having the owner as the admin or giving away NFTs for promotional purposes. Auction will be created for the generation 0 animals Check for owner shouldn't be 0x0 address, or else the tokens will be lost forever.
function createGen0Animal(uint256 _species, uint256 _genes, address _owner) external onlyAdmin { if (_owner == address(0)) { _owner = admin; } _createAnimal(_species, 0, 0, 0, _genes, _owner);
16,251,266
./full_match/5/0xc11EB9B5E028F5Ddf3f1b390F6041CbF38feabf8/sources/contracts/EntryPoint.sol
return the storage cells used internally by the EntryPoint for this sender address. During `simulateValidation`, allow these storage cells to be accessed (that is, a wallet/paymaster are allowed to access their own deposit balance on the EntryPoint's storage, but no other account)/
function getSenderStorage(address sender) external view returns (uint256[] memory senderStorageCells) { uint256 cell; DepositInfo storage info = deposits[sender]; assembly { cell := info.slot } senderStorageCells = new uint256[](1); senderStorageCells[0] ...
11,603,707
./partial_match/1313161554/0xB741568164B02C97b4Fb81D178b9a9480395B62b/sources/StratPolarisV6.sol
called as part of strat migration. Sends all the available funds back to the vault.
function retireStrat() external { require(msg.sender == vault, "!vault"); IPolarisRewarder(masterchef).emergencyWithdraw(poolId); uint256 wantBal = IERC20(want).balanceOf(address(this)); IERC20(want).safeTransfer(vault, wantBal); isRetired = true; }
16,917,941
/** *Submitted for verification at Etherscan.io on 2022-03-08 */ /*** * ██████╗ ███████╗ ██████╗ ██████╗ * ██╔══██╗██╔════╝██╔════╝ ██╔═══██╗ * ██║ ██║█████╗ ██║ ███╗██║ ██║ * ██║ ██║██╔══╝ ██║ ██║██║ ██║ * ██████╔╝███████╗╚██████╔╝╚██████╔╝ * ╚═════╝ ╚══════╝ ╚═════╝ ╚═════╝ *...
for govern value/
function setRate(uint256 burn_rate, uint256 reward_rate) external onlyOwner { require(_maxGovernValueRate >= burn_rate && burn_rate >= _minGovernValueRate,"invalid burn rate"); require(_maxGovernValueRate >= reward_rate && reward_rate >= _minGovernValueRate,"invalid reward rate"); ...
10,625,641
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.6.11; contract CeloBet { uint256 public price; uint256 public gameId; uint256 public lastGameId; address payable public admin; //declaring 50% chance, (0.5*(uint256+1)) uint256 constant half = 578960446186580977117854925043439539266349923...
Send rewards to the winners./check bets from latest betting round, one by onereset winAmount for current userif user wins, then receives 2x of their betting amount
function verdict(uint256 random) public payable { for(uint256 i=lastGameId; i<gameId; i++){ uint256 winAmount = 0; if((random>=half && games[i].bet==1) || (random<half && games[i].bet==0)){ winAmount = games[i].amount*2; games[i].player.transfer(w...
12,903,861
./full_match/1/0xC4a41fc62BFc4eD3033CfF4bEFD21bbDcd811F64/sources/src/Mucus.sol
approve token transfer to cover all possible scenarios add the liquidity
function _addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { _approve(address(this), address(router), tokenAmount); address(this), tokenAmount, _owner, block.timestamp ); }
17,128,208
pragma solidity ^0.4.11; /** * @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 constant returns (uint256); function transfer(address to, u...
override to add validRecipient _spender The address which will spend the funds. _value The amount of tokens to be spent./
function approve(address _spender, uint256 _value) public validRecipient(_spender) returns (bool) { return super.approve(_spender, _value); }
2,520,402
/** * @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; } uint256 c = a * b; assert(c...
Decrease the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol _spender The address which will spend the funds. ...
function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(m...
4,807,176
pragma solidity 0.5.17; import "./MToken.sol"; import "./ErrorReporter.sol"; import "./PriceOracle.sol"; import "./MomaMasterInterface.sol"; import "./MomaMasterStorage.sol"; import "./MomaPool.sol"; /** * @title Moma's MomaMaster Contract * @author Moma */ contract MomaMaster is MomaMasterInterface, MomaMasterV1S...
Sets liquidationIncentive Admin function to set liquidationIncentive newLiquidationIncentiveMantissa New liquidationIncentive scaled by 1e18 return uint 0=success, otherwise a failure. (See ErrorReporter for details)/ Check caller is admin
function _setLiquidationIncentive(uint newLiquidationIncentiveMantissa) external returns (uint) { if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_LIQUIDATION_INCENTIVE_OWNER_CHECK); } require(newLiquidationIncentiveMantissa >= liquidationIncentiveMinMa...
12,663,200
/** *Submitted for verification at Etherscan.io on 2021-03-12 */ // SPDX-License-Identifier: UNLICENSED /** * @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 returns (ui...
swap failed. Let's not revert so we keep the CHI.
function mintAndSell(uint256 amount) external { CHI.mint(amount); try CHI.approve(address(UNISWAP), amount) { address[] memory path = new address[](2); path[0] = address(CHI); path[1] = address(WETH); try UNISWAP.swapExactTokensForETH( ...
6,771,995
./full_match/5/0x10A40362A24f11e4C9e1Dd288b00A55B95b2F807/sources/contracts/smart-wallet/dynamic/DynamicAccount.sol
Returns whether a extension can be set in the given execution context.
function _canSetExtension() internal view virtual override returns (bool) { return _hasRole(EXTENSION_ADMIN_ROLE, msg.sender); }
11,598,660
// File: @openzeppelin\contracts-ethereum-package\contracts\math\SafeMath.sol pragma solidity ^0.5.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 assum...
------ Operator interface ------
function handleOperatorActions(address _vaultProtocol, address _strategy, address _token) public onlyVaultOperator { uint256 totalDeposit; uint256 totalWithdraw; VaultPoolToken poolToken = VaultPoolToken(vaults[_vaultProtocol].poolToken); uint256 nBalanceBefore = distributeYieldInt...
1,117,617
//Address: 0x8426d0dc03335d4a391bf4cf7fe546ff89549de4 //Contract name: BlokToken //Balance: 0 Ether //Verification Date: 4/8/2018 //Transacion Count: 93 // CODE STARTS HERE pragma solidity ^0.4.13; contract ERC20 { uint256 public totalSupply; function balanceOf(address _owner) constant returns (uint256 bala...
End minting mode.
function endMinting() external onlyOwner { if (isMinting == false) { return; } isMinting = false; MintingEnded(); }
2,519,889
./full_match/80001/0x8f12e8dfE0b4251b67896366410bB5521d709b61/sources/@tsb/exchange/contracts/WhiteList.sol
remove token from ERC20 list tokenAddress token address
function removeERC20(address tokenAddress) external onlyOwner { revokeRole(ERC20_ROLE, tokenAddress); }
5,619,173
./full_match/4/0x7311b268f618cD1F4C9Da2a9BE2624041D5A19A5/sources/browser/Treasury.sol
uint256 _olyToDistribute = currentOLYProfitForEpoch; currentOLYProfitForEpoch = 0; sendOLYProfits(_olyToDistribute);updateTWAP();lastEpoch = block.number.add(8 hours);
function startNewEpoch(address _token) external onlyWhitelistedAddr(msg.sender) { mintOrBurnOly(_token, IERC20(OLY).totalSupply()); }
12,276,943
./full_match/1/0xC57Cf77281d0a615f38Fb6a7Fea44CD51EE66351/sources/contracts/multiple.sol
xref:ROOT:BEP1155.adocbatch-operations[Batched] version of {_mint}. Requirements: - `ids` and `amounts` must have the same length. - If `to` refers to a smart contract, it must implement {IBEP1155Receiver-onBEP1155BatchReceived} and return the acceptance magic value./
function _mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(to != address(0), "BEP1155: mint to the zero address"); require( ids.length == amounts.length, "BEP1155: ids and...
4,822,448
pragma solidity 0.4.23; import "./proxy/EternalStorage.sol"; import "./proxy/OwnedUpgradeabilityProxy.sol"; /** * @title EternalStorageProxy * @dev This proxy holds the storage of the token contract and delegates every call to the current implementation set. * Besides, it allows to upgrade the token's behaviour to...
Allows the upgradeability owner to upgrade the current version of the proxy and call the new implementation to initialize whatever is needed through a low level call. version representing the version name of the new implementation to be set. implementation representing the address of the new implementation to be set....
function upgradeToAndCall(string version, address implementation, bytes data) payable public onlyProxyOwner { upgradeTo(version, implementation); require(address(this).call.value(msg.value)(data)); }
10,132,182
./partial_match/1/0x99373AE646ed89b9A466c4256b09b10dbCC07B40/sources/contracts/concentrator/AladdinConvexVault.sol
See {IAladdinConvexVault-deposit} This function is deprecated.
function deposit(uint256 _pid, uint256 _amount) external override returns (uint256 share) { return deposit(_pid, msg.sender, _amount); }
9,294,035
pragma solidity =0.5.16; import "./PoolToken.sol"; import "./CStorage.sol"; import "./CSetter.sol"; import "./interfaces/IBorrowable.sol"; import "./interfaces/ICollateral.sol"; import "./interfaces/IFactory.sol"; import "./interfaces/ITarotPriceOracle.sol"; import "./interfaces/ITarotCallee.sol"; import "./interfaces...
this low-level function should be called from another contract optimistically transfer funds
function flashRedeem( address redeemer, uint256 redeemAmount, bytes calldata data ) external nonReentrant update { require(redeemAmount <= totalBalance, "Tarot: INSUFFICIENT_CASH"); _safeTransfer(redeemer, redeemAmount); if (data.length > 0) ITarotCal...
12,969,532
./full_match/137/0xD08Cf4f0876ac1a29712214356Af98fA2b0D018F/sources/contracts/XpWhitelist.sol
Add to whitelist/
function addToWhitelist(address[] calldata toAddAddresses) external onlyOwner{ for (uint i = 0; i < toAddAddresses.length; i++) { whitelist[toAddAddresses[i]] = true; } }
4,745,413
./partial_match/1/0x544AE0691b6a7Cc2f235D2F5e1344761B016907B/sources/PATH.sol
Solidity only automatically asserts when dividing by 0 assert(a == b c + a % b); There is no case in which this doesn't hold
function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; }
2,805,853
pragma solidity 0.6.8; import "./libraries/PrestigeClubCalculations.sol"; import "./libraries/SafeMath112.sol"; import "./IERC20.sol"; import "./Ownable.sol"; // SPDX-License-Identifier: MIT interface IPDex{ function prestigeDeposit(uint256 amountIn) external; } //Restrictions: //only 2^32 Users //Maximum of (2...
Updates the payout amount for given user Calculate Base Payouts Interest Payout
function updatePayout(address adr) private { uint40 dayz = (uint40(block.timestamp) - users[adr].lastPayout) / (payout_interval); if(dayz >= 1){ uint112 deposit = users[adr].deposit; uint8 quote; if(deposit >= 30 ether){ quot...
1,013,377
pragma solidity 0.5.17; Import Import Import Import Import contract Swap is OwnerPausable, ReentrancyGuard { using SafeERC20 for IERC20; using SafeMath for uint256; using MathUtils for uint256; using SwapUtils for SwapUtils.Swap; SwapUtils.Swap public swapStorage; IAllowlist public allowlis...
calculate amount of tokens you receive on swap tokenIndexFrom the token the user wants to sell tokenIndexTo the token the user wants to buy dx the amount of tokens the user wants to sell return amount of tokens the user will receive/
function calculateSwap(uint8 tokenIndexFrom, uint8 tokenIndexTo, uint256 dx ) external view returns(uint256) { return swapStorage.calculateSwap(tokenIndexFrom, tokenIndexTo, dx); }
2,549,440
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific function...
Update accounts to be debtors or not. Debtors couldn't claim rewards until their bad debts are repaid. accounts The list of accounts to be updated/
function updateDebtors(address[] memory accounts) external { for (uint i = 0; i < accounts.length; i++) { address account = accounts[i]; (uint err, , uint shortfall) = ComptrollerInterface(comptroller).getAccountLiquidity(account); require(err == 0, "failed to get account...
5,855,020
./full_match/11155111/0x5d231eEfc16FBf528D4664bDAB8Ec57b0e92C933/sources/contracts/Contract.sol
done this way to implement the list of offerings in the future using storage, because then we will change data in this variable todo implement 10 percent cut transfer eth here the transaction is alright create new record of donation first create place for it in the array of profileToSupport fill created bean with data
function buyCoffee(uint256 _profileIndex) payable public { uint256 amountSent = msg.value; Profile storage profileToSupport = createdProfiles[_profileIndex]; if(beanProcessed){ newBean.amount = 1; newBean.supporter = msg.sender; newBean.timestamp = bloc...
3,800,941
pragma solidity ^0.4.18; // File: openzeppelin-solidity/contracts/ownership/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owne...
Sets a new claimer during updates _address Address of the new claimer/
function setNewClaimer( address _address ) public onlyOwner { require(_address != address(0) && claimer != address(0)); newClaimer = _address; }
7,631,618
/* Copyright (c) 2018-present evan GmbH. 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 t...
Check the signature length Divide the signature in r, s and v variables
function getRecoveredAddress(bytes sig, bytes32 dataHash) public pure returns (address addr) { bytes32 ra; bytes32 sa; uint8 va; if (sig.length != 65) { return (0); } assembly { ra := mload(add(sig, 32)) ...
12,637,841
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* 88888888ba 88 88 88888888ba, 88888888ba, 8b d8 888888888888 db ,ad8888ba, 88 "8b 88 88 88 `"8b 88 `"8b Y8, ,8P 88 d88b d8"' `"8b 88 ,8P 88 88 88 `8...
Interface of the ERC165 standard, as defined in the Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}./
interface IERC165 { function supportsInterface(bytes4 interfaceId) external view returns (bool); 88888888ba 88 88 88888888ba, 88888888ba, 8b d8 888888888888 db ,ad8888ba, ...
6,032,091
./partial_match/97/0xF7500eb508405e4650773eB02aF5D5542CDD5E91/sources/SyrupBar.sol
Stake Cat tokens to MasterChef
function enterStaking(uint256 _amount) public { PoolInfo storage pool = poolInfo[0]; UserInfo storage user = userInfo[0][msg.sender]; updatePool(0); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accCatPerShare).div(1e12).sub(user.rewardDebt); i...
11,366,986
pragma solidity 0.4.25; // File: contracts/sogur/interfaces/IMonetaryModel.sol /** * @title Monetary Model Interface. */ interface IMonetaryModel { /** * @dev Buy SGR in exchange for SDR. * @param _sdrAmount The amount of SDR received from the buyer. * @return The amount of SGR that the buyer is ...
Return the contract which implements the IMonetaryModel interface./
function getMonetaryModel() public view returns (IMonetaryModel) { return IMonetaryModel(getContractAddress(_IMonetaryModel_)); }
1,330,404
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that ...
Returns the vesting schedule information for a given holder and index. return the vesting schedule structure information/
function getVestingScheduleByAddressAndIndex( address holder, uint256 index ) public view virtual returns (VestingSchedule memory) { return getVestingSchedule(computeVestingScheduleIdForAddressAndIndex(holder, index)); }
260,621
pragma solidity ^0.5.1; interface tokenRecipient { function RECEIVEAPPROVAL508(address _from, uint256 _value, address _token, bytes calldata _extraData) external; //inject NONSTANDARD NAMING } library SafeMath { ...
inject NONSTANDARD NAMING
function APPROVEANDCALL291(address _spender, uint256 _value, bytes memory _extraData) public returns (bool success) {
12,593,593
./partial_match/1/0x1201FAa7258A48b820619dD57Cd8FdEb25D49b2c/sources/contracts/managed/ManagedPoolStorageLib.sol
Sets the "Recovery Mode enabled" flag to `enabled`. poolState - The byte32 state of the Pool. enabled - A boolean flag for whether Recovery Mode is to be enabled./
function setRecoveryModeEnabled(bytes32 poolState, bool enabled) internal pure returns (bytes32) { return poolState.insertBool(enabled, _RECOVERY_MODE_OFFSET); }
4,227,860
./partial_match/1/0x17c118416BD713e00037125D85E58abaC60c4A4E/sources/StrategyHarvestMetaFarm.sol
Withdraw vaultTokens from vaultFarm first, followed by harvestVault
function _withdrawSome(uint256 _amount) internal override returns (uint256) { uint256 _preWant = IERC20Upgradeable(want).balanceOf(address(this)); uint256 _toWithdraw = _amount; uint256 _wrappedTotal = IRewardPool(vaultFarm).balanceOf(address(this)); uint256 _underlyingTotal = IHar...
9,257,664
// SPDX-License-Identifier: MIT /** ∩~~~~∩ ξ ・×・ ξ ξ ~ ξ ξ   ξ ξ   “~~~~〇 ξ       ξ ξ ξ ξ~~~ξ ξ ξ   ξ_ξξ_ξ ξ_ξξ_ξ Alpaca Fin Corporation */ pragma solidity 0.6.12; import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/O...
Stop the sale and distribute the unsold Alpies. _freebieMerkleRoot The root of the freebie merkle tree _revealBlock New block to reveal Alpies
function stopSale(bytes32 _freebieMerkleRoot, uint256 _revealBlock) external onlyOwner { require(totalSupply() < maxAlpies(), "sale done"); require(freebieMerkleRoot == 0, "merkle already set"); saleEndBlock = block.number; revealBlock = _revealBlock; freebieMerkleRoot = _freebieMerkleRoot; ...
12,711,580
./full_match/80001/0x8e51A3290912E7bAd80D1200c261D9F80F87903F/sources/contracts/Contract.sol
Function to buy offer Add to customer's purchases Register transaction
function buyOffer(uint256 _id) public returns (bool) { Offer storage currentOffer = offers[_id]; require(balances[msg.sender] >= currentOffer.priceInTokens, "Insufficient Funds"); require(currentOffer.startTime <= block.timestamp && currentOffer.endTime >= block.timestamp, "Rewards/Deals ca...
9,483,464
./full_match/3/0xd894Ab591B2e44fA2A89b0B195d108A140E89d71/sources/maticerc.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) { address owner = _msgSender(); _approve(owner, spender, _allowances[owner][spender] + addedValue); return true; }
8,124,825
./partial_match/1/0xB690fC16279C096999264e3C049fA133024b4d69/sources/contracts/blueprints/DynamicBlueprint.sol
See {IDynamicBlueprint-updateOperatorFilterAndRegister}/
function updateOperatorFilterAndRegister( address newRegistry, address coriCuratedSubscriptionAddress ) external override { updateOperatorFilterRegistryAddress(newRegistry); addOperatorFiltererSubscription(coriCuratedSubscriptionAddress); }
3,599,366
./partial_match/1/0x9a129032F01EB4dDD764c1777c81b771C34a2fbE/sources/contracts/NftfiBundler.sol
Remove all the children from the bundle This method may run out of gas if the list of children is too big. In that case, children can be removed individually. _tokenId the id of the bundle _receiver address of the receiver of the children/ In each iteration all contracts children are removed, so eventually all ...
function decomposeBundle(uint256 _tokenId, address _receiver) external override { _validateReceiver(_receiver); _validateTransferSender(_tokenId); while (childContracts[_tokenId].length() > 0) { address childContract = childContracts[_tokenId].at(0); while (childTok...
16,187,111
./full_match/1/0xe7e47045Ab9aA5146129845dfD5a85471196B026/sources/ExchangerWithVirtualPynth.sol
issue amount to user
function refund( address from, bytes32 currencyKey, uint amount ) internal { issuer().pynths(currencyKey).issue(from, amount); IPeriFinanceInternal(address(periFinance())).emitExchangeRebate(from, currencyKey, amount); }
3,103,334
// SPDX-License-Identifier: MIT pragma solidity >=0.7.0; contract AccessControl { // A policy that lives on-chain (more expensive but can be used as fallback // when remote policies cannot be retrieved for any reason) struct OCP { string resource; // The name of the remote endpoint or resource ...
The signer can sign the contract (by sending enough money to cover the price) If the signer sent enough money, sign the contract and transfer the money to the owner TODO: Optionally refund the difference to the signer
function signContract (string memory pubKey) public onlySigner onlyInitialized onlyNotSigned payable { amountPaid += msg.value; if (amountPaid >= price) { owner.transfer(price); signed = true; userPubKey = pubKey; emit Signed(); } }
12,848,982
pragma solidity ^0.4.16; contract MSERToken { // Public variables of the token string public name; string public symbol; uint8 public decimals = 8; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances ...
Destroy tokens Remove `_value` tokens from the system irreversibly _value the amount of money to burn/
function burn(uint256 _value) public returns (bool success) { emit Burn(msg.sender, _value); return true; }
12,005,301
./partial_match/1/0x60bb1e2AA1c9ACAfB4d34F71585D7e959f387769/sources/src/ArtGobblers.sol
Feed a gobbler a work of art. gobblerId The gobbler to feed the work of art. nft The ERC721 or ERC1155 contract of the work of art. id The id of the work of art. isERC1155 Whether the work of art is an ERC1155 token. Get the owner of the gobbler to feed. The caller must own the gobbler they're feeding. Gobblers hav...
function gobble( uint256 gobblerId, address nft, uint256 id, bool isERC1155 ) external { address owner = getGobblerData[gobblerId].owner; if (owner != msg.sender) revert OwnerMismatch(owner); if (nft == address(this)) revert Cannibalism(); unche...
2,819,404
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be...
Create a new stake stakerAddress Address of the new staker depositAmount Stake amount of the new staker/
function createNewStake(address payable stakerAddress, uint256 depositAmount) internal { uint256 stakerIndex = _stakerList.length; _stakerList.push(stakerAddress); _stakerMap[stakerAddress] = Staker( stakerIndex, _latestConfirmed, depositAmount, ...
200,124
//SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; // load other contracts import "@openzeppelin/contracts/utils/math/Math.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./Random.sol"; // for debugging import "hardhat/console.sol"; contract Lottery is Ownable { using Math for uint2...
_performRandomizedDrawing function to generate random winning ticket index. Still need to find corresponding user afterwards. v0.1 isn't randomized (for testing)/ console.log("_performRandomizedDrawing");
function _performRandomizedDrawing() private view returns (uint256) { return Random.naiveRandInt(0, numTotalTickets - 1);
12,780,147
./partial_match/1/0x00000000Ede6d8D217c60f93191C060747324bca/sources/node_modules/@aperture_finance/uni-v3-lib/src/NPMCaller.sol
Equivalent to `INonfungiblePositionManager.burn` npm Uniswap v3 Nonfungible Position Manager tokenId The token ID of the position to burn Write the abi-encoded calldata into memory. We use 36 because of the length of our calldata. Bubble up the revert reason.
function burn(INPM npm, uint256 tokenId) internal { bytes4 selector = INPM.burn.selector; assembly ("memory-safe") { mstore(0, selector) mstore(4, tokenId) if iszero(call(gas(), npm, 0, 0, 0x24, 0, 0)) { returndatacopy(0, 0, returndatasize()) ...
15,622,129
// File: contracts/libs/common/ZeroCopySource.sol // SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @dev Wrappers over decoding and deserialization operation from bytes into bassic types in Solidity for PolyNetwork cross chain utility. * * Decode into basic types in Solidity from bytes easily. It's de...
Performs a deposit from a Wallet contract _walletAddress address of the wallet contract, the wallet contract does not receive ETH in this call, but _walletAddress still needs to be payable since the wallet contract can receive ETH, there would be compile errors otherwise _assetHash the asset to deposit _targetProxyH...
function lockFromWallet( address payable _walletAddress, address _assetHash, bytes calldata _targetProxyHash, bytes calldata _toAssetHash, bytes calldata _feeAddress, uint256[] calldata _values, uint8 _v, bytes32[] calldata _rs ) external ...
5,530,915
./full_match/4/0xdfDb7d2D93c9006d4d00bc1430e67B0044Ac86F8/sources/vanz.sol
Everything after the first batch mints through this payable check
function mint(uint16 num) payable public { uint256 tokenId = _tokenIdCounter.current(); require(tokenId >= _numPerBatch, "free! call hitchhikerMint"); uint256 currentBatchNum = _batchNum.current(); uint256 batchId = _batchIdCounter.current(); requir...
12,524,115
//Address: 0x3f45d2d5feb6b4b000d2d3b84442eeddf54a735a //Contract name: LiquidPledging //Balance: 0 Ether //Verification Date: 12/20/2017 //Transacion Count: 9 // CODE STARTS HERE //File: contracts/ILiquidPledgingPlugin.sol pragma solidity ^0.4.11; /* Copyright 2017, Jordi Baylina Contributors: Adrià Massane...
`appendDelegate` allows for a delegate to be added onto the end of the delegate chain for a given Pledge. idPledge Id of the pledge thats delegate chain will be modified. amount Quantity of value that's being chained. idReceiver The delegate to be added at the end of the chain
function appendDelegate( uint64 idPledge, uint amount, uint64 idReceiver ) internal { Pledge storage p = findPledge(idPledge); require(p.delegationChain.length < MAX_DELEGATES); uint64[] memory newDelegationChain = new uint64[]( p.delegationChain.leng...
12,923,218
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) { retur...
Reclaim all ERC20 compatible tokens _token ERC20 The address of the token contract/
function reclaimToken(ERC20 _token) external onlyOwner { uint256 tokenBalance = _token.balanceOf(this); require(_token.transfer(owner, tokenBalance)); }
11,850,126
./full_match/1/0xa96AD7889ef29D4978e00B0cB31cD41F77bFD8A6/sources/contracts/BatchedPhasedEscrow.sol
slither-disable-next-line calls-loop
function withdraw(IBeneficiaryContract beneficiary, uint256 amount) private { emit TokensWithdrawn(address(beneficiary), amount); token.safeTransfer(address(beneficiary), amount); beneficiary.__escrowSentTokens(amount); }
16,396,370
./full_match/4/0x139cC2658EFb369c1757B5B5fEF7d69dd1172D3e/sources/Users/tatarkindenis/Desktop/TokensSwap/contracts/Ownable.sol
Transfers control of the contract to a newOwner. newOwner The address to transfer ownership to./
function _transferOwnership(address newOwner) internal { require(newOwner != address(0)); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; }
669,590
//SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity 0.8.2; import "@openzeppelin/contracts-0.8/access/Ownable.sol"; import "../../../Sand/SandBaseToken.sol"; import "../../../common/BaseWithStorage/ERC2771Handler.sol"; contract PolygonSand is SandBaseToken, Ownable, ERC2771Han...
update the ChildChainManager Proxy address newChildChainManagerProxy address of the new childChainManagerProxy
function updateChildChainManager(address newChildChainManagerProxy) external onlyOwner { require(newChildChainManagerProxy != address(0), "Bad ChildChainManagerProxy address"); childChainManagerProxy = newChildChainManagerProxy; }
1,067,173
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../node_modules/@openzeppelin/contracts/utils/math/SafeMath.sol"; import "./ERC721Mintable.sol"; import "./verifier.sol"; // TODO define a contract call to the zokrates generated solidity contract <Verifier> or <renamedVerifier> interface IVerifier { ...
TODO define a contract call to the zokrates generated solidity contract <Verifier> or <renamedVerifier>
interface IVerifier { function verifyTx(Verifier.Proof memory proof, uint[2] memory input) external view returns (bool r); pragma solidity ^0.8.0; }
895,145
./full_match/80001/0xD3F22Ce4b3A0AffffaC2d0038fdaF8C32DcB790d/sources/project_/contracts/BetDex.sol
Get current amount of available reserves.
function roomAvailableReserve_cga(bytes32 roomId) public view returns (uint256) { return rooms[roomId].reverse - rooms[roomId].lockedReverse; }
5,565,737
pragma solidity >=0.5.0 <0.7.0; import "@aztec/protocol/contracts/ERC1724/ZkAssetMintable.sol"; import "@aztec/protocol/contracts/libs/NoteUtils.sol"; import "@aztec/protocol/contracts/interfaces/IZkAsset.sol"; import "./LoanUtilities.sol"; contract Loan is ZkAssetMintable { using SafeMath for uint256; using N...
Mints new AZTEC note to represent loan, adds it to note registry and increase confidentialTotalSupply note minter must be the loan initializer owner should also be loanVariables.loanFactory from ZkAssetMintable constructor overide this function to change the mint method to msg.sender Mints the new AZTEC notes newTotal ...
function confidentialMint(uint24 _proof, bytes calldata _proofData) external { LoanUtilities.onlyLoanDapp(msg.sender, loanVariables.loanFactory); require( msg.sender == owner, "only owner can call the confidentialMint() method" ); require(_proofDat...
1,754,085
/** * FlightDelay with Oraclized Underwriting and Payout * * @description Controller contract * @copyright (c) 2017 etherisc GmbH * @author Christoph Mussenbrock */ pragma solidity ^0.4.11; import "./Owned.sol"; import "./FlightDelayControlledContract.sol"; import "./FlightDelayConstants.sol"; contract FlightD...
Deregister a contract. In future, contracts should be exchangeable. _id ID of contract return bool success/
function deregister(bytes32 _id) onlyOwner returns (bool _result) { if (getContract(_id) == 0x0) { return false; } setContract(0x0, _id, false); _result = true; }
5,395,459
./full_match/1/0x5bDdC63f23c0386fb817959773c32b736744c899/sources/browser/UniFastV2Factory.sol
this low-level function should be called from a contract which performs important safety checks
function mint(address to) external lock returns (uint liquidity) { uint balance0 = IERC20Uniswap(token0).balanceOf(address(this)); uint balance1 = IERC20Uniswap(token1).balanceOf(address(this)); uint amount0 = balance0.sub(_reserve0); uint amount1 = balance1.sub(_reserve1); ...
9,722,277
pragma solidity ^0.4.0; contract common_token_create { string public name; // ERC20标准 string public symbol; // ERC20标准 uint8 public decimals = 2; // ERC20标准,decimals 可以有的小数点个数,最小的代币单位。18 是建议的默认值 uint256 public totalSupply; // ERC20标准 总供应量 // 用mapping保存每个地址对应的余额 ERC20标准 mapping(address => uint256) public b...
实现增发,增发的货币会添加到货币owner的地址中 开关校验 非token的owner不允许增发
function increase(uint256 _count) public returns (bool success){ require(!stopped); require(increasing); require(!inBlackList()); require(msg.sender != owner); balanceOf[msg.sender] += _count; totalSupply += _count; Increase(msg.sender, _count); return true; }
15,841,310
pragma solidity ^0.4.18; import "./Controlled.sol"; import "./TokenController.sol"; import "./DeveloperToken.sol"; import "./ExpositoProjectFactory.sol"; import "./EIP20Interface.sol"; contract ApproveAndCallFallBack { function receiveApproval(address from, uint256 _amount, address _token, bytes _data) public; ...
_owner The address that's balance is being requested return The balance of `_owner` at the current block/
function developerTokenBalanceOf(address _owner) public constant returns (uint256 balance) { return developerToken.balanceOf(_owner); }
5,392,941
./partial_match/56/0xEBcA288C044Feaa56aB4C17bB9E52170870ed013/sources/GKEYMasterFarmer.sol
Withdraw LP tokens from GKEYMasterFarmer.
function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "GKEYMasterFarmer::withdraw: not good"); updatePool(_pid); _harvest(_pid); if(_amoun...
11,078,812