file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./full_match/1/0x5C60dC4fE512e059C100df80720ace8fDB098Bd2/sources/contracts/rUSTPool.sol
The USD value of the collateral asset must be higher than safeCollateralRate./
function _requireIsSafeCollateralRate(address user) internal view { uint256 borrowedAmount = getrUSTPAmountByShares(borrowedShares[user]); if (borrowedAmount == 0) { return; } require( (stbt.getAmountByShares(depositedSharesSTBT[user]).mul(_stbtPrice()).mul(100) / borrowedAmount) >= safeCollateralRat...
3,187,555
pragma solidity 0.4.25; /** * @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) { // Gas optimization: this is cheap...
Get sum of deposits to mining accounts for current day/
function getCurrentDayDeposited() public view returns (uint) { if(now / 1 days == currentDay) { return currentDayDeposited; return 0; } }
12,540,325
// SPDX-License-Identifier: MIT pragma solidity >0.6.10; //import "@opengsn/gsn/contracts/BaseRelayRecipient.sol"; import "./IERC20.sol"; import "./opengsn/BaseRelayRecipient.sol"; import "./opengsn/interfaces/IKnowForwarderAddress.sol"; // This is just a simple example of a coin-like contract. // It is not standards...
tokenAddr contract address of ERC20 token receiver address of receiver amount amount token amount in smallest denomination value/
function sendCoin(address tokenAddr, address receiver, uint amount) public returns(bool sufficient) { IERC20 token = IERC20(tokenAddr); token.approve(_msgSender(), amount); token.transferFrom(_msgSender(), receiver, amount); return true; }
6,352,341
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; //Interfaces import './interfaces/IUniswapV2Router02.sol'; //OpenZeppelin import "./openzeppelin-solidity/contracts/ERC20/SafeERC20.sol"; import "./openzeppelin-solidity/contracts/ERC20/IERC20.sol"; import "./openzeppelin-solidity/contracts/Ownable.sol"; contr...
Sets the address of TGEN. The TGEN address is initialized outside of the constructor because the TradegenToken contract expects this contract to already be deployed./
function setTGEN(address _TGEN) external onlyOwner { require(address(TGEN) == address(0), "SeedLiquidity: Already set TGEN."); TGEN = IERC20(_TGEN); emit SetTGEN(_TGEN); }
879,592
./full_match/80001/0xf4Bf35F8f17cAf2ee780e9BD6Ee4a6c5Eb61b6C2/sources/project:/contracts/superfluid/FlowNFTBase.sol
@inheritdoc IERC721
function transferFrom(address from, address to, uint256 tokenId) external virtual override { if (!_isApprovedOrOwner(msg.sender, tokenId)) { revert CFA_NFT_TRANSFER_CALLER_NOT_OWNER_OR_APPROVED_FOR_ALL(); } _transfer(from, to, tokenId); }
9,524,880
./partial_match/1/0x82a90C0FF84F8cEe692C9C6C7351DA28bB331154/sources/lib/mip21-toolkit/src/conduits/RwaSwapOutputConduit.sol
Updates a contract parameter. what The changed parameter name. `"quitTo", "psm"`. data The new value of the parameter./ Revoke approval for the old PSM Give unlimited approval to the new PSM
function file(bytes32 what, address data) external auth { if (what == "quitTo") { quitTo = data; require(PsmAbstract(data).dai() == address(dai), "RwaSwapOutputConduit/wrong-dai-for-psm"); require( GemJoinAbstract(PsmAbstract(data).gemJoin()).gem() == addr...
3,691,857
// Dependency file: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT // pragma solidity >=0.6.0 <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 totalSupp...
Executes plugins in the given order.
function _execute( address[] calldata path, uint[] calldata amounts, address[] calldata addresses, address[] calldata plugins, string[] calldata data ) internal { for (uint i = 0; i < plugins.length; i++) { require(_isApproved(plugins[i]), 'DePay: Plugin not approved!'); I...
197,310
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.4; import "./Interfaces.sol"; contract Ticker { ENSRegistryWithFallback ens; constructor() { ens = ENSRegistryWithFallback(0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e); // The ens registry address is shared across testnets and mainnet ...
Interface of the ERC20 standard as defined in the EIP./
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256)...
13,695,531
./full_match/5/0x5137ABFf24ad5b7f8079F7f9BfCDB5645e490526/sources/project_/contracts/ERC1644/IERC1644.sol
Controller Operation Controller Events
interface IERC1644 { function isControllable() external view returns (bool); function controllerTransfer(address _from, address _to, uint256 _value, bytes calldata _data, bytes calldata _operatorData) external; function controllerRedeem(address _tokenHolder, uint256 _value, bytes calldata _data, bytes calld...
11,594,547
pragma solidity ^0.4.0; contract MindMathGame { event GameCreated(int game_score, int game_power_up, address game_address ); event GameUpdated(int game_score, int game_power_up, address game_address ); struct game { int game_score; //Store game score int game_power_up; //Store ga...
Read the game details for address
function getGameDetails( address game_address ) public returns (int score) { return games[game_address].game_score; }
12,777,999
./partial_match/1/0x508efB44A06a64Bd4020e8c5e8Ecf1A9236C75aE/sources/wallet.sol
Confirm pending removal of whitelisted addresses. Require that the pending whitelist is not empty and the operation has been submitted. Require that confirmation hash and the hash of the pending whitelist removal match Remove pending addresses. check if it exists
function confirmWhitelistRemoval(bytes32 _hash) external onlyController { require(submittedWhitelistRemoval, "no pending submission"); require(_hash == calculateHash(_pendingWhitelistRemoval), "non-matching pending whitelist hash"); for (uint256 i = 0; i < _pendingWhitelistRemoval.length; i+...
3,597,830
./full_match/97/0x0e6d132D60D7af9fC948F75f93745094c35B15CA/sources/contracts/SmartTestament.sol
Delete testament for message sender
function deleteTestament() external { require( getTestamentState(msg.sender) < TestamentState.Unlocked, "alive only" ); delete testaments[msg.sender]; emit TestamentDeleted(msg.sender); }
5,036,378
//---------------------------------------------------------------------------------------------- // The MIT License (MIT) // // Copyright (c) 2016-2019 zOS Global Limited // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "So...
Burns a specific ERC721 token. tokenId uint256 id of the ERC721 token to be burned./
function burn(uint256 tokenId) public { require(_isValidSpender(msg.sender, tokenId)); _burn(tokenId); }
13,107,294
pragma solidity >0.5.4; import "@daostack/arc/contracts/controller/Avatar.sol"; import "@daostack/arc/contracts/controller/ControllerInterface.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "../../identity/Identity.sol"; import "../../identity/IdentityGuard.sol"; import "../../token/GoodDo...
function that gets count of claimers and amount claimed for the current day return the amount of claimers and the amount claimed./
function getDailyStats() public view returns (uint256 count, uint256 amount) { uint256 today = (now.sub(periodStart)) / 1 days; return (getClaimerCount(today), getClaimAmount(today)); }
5,351,699
./partial_match/4/0x13845842390067045a22a00d7Dd2f9bd6ead2Df9/sources/GalaxyNFT.sol
Withdraw NFT tokens from Interstellar.
function withdraw(uint256 _pid, uint256 _amount, bytes calldata _data) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 pending = user.amount.m...
16,973,366
./full_match/77/0xcA47f86f29Ab274257792a2Cf24B7299d449cF06/sources/deploy/contracts/synthereum-pool/v5/LiquidityPool.sol
Get the synthetic token associated to this pool return syntheticCurrency The ERC20 synthetic token/
function syntheticToken() external view override returns (IERC20 syntheticCurrency) { syntheticCurrency = poolStorage.syntheticToken; }
5,047,240
./partial_match/3/0xE5dD5466314a590680d107B2Dea8114cd694BBfd/sources/Strategy.sol
Used to change `maxReportDelay`. `maxReportDelay` is the maximum number of blocks that should pass for `harvest()` to be called. For external keepers (such as the Keep3r network), this is the maximum time between jobs to wait. (see `harvestTrigger()` for more details.) This may only be called by governance or the ...
function setMaxReportDelay(uint256 _delay) external onlyAuthorized { maxReportDelay = _delay; emit UpdatedReportDelay(_delay); }
5,277,467
./full_match/1/0x640216Ea5b2aC018b1d1FDB3F0a206F652C92574/sources/contracts/MemberRegistry/MemberRegistry.sol
Returns the token URI associated with the given token ID. tokenId_ The token ID for which to get the associated token URI. return The token URI associated with the token ID as a string. This function is overridden from the ERC721 standard./
function tokenURI( uint256 tokenId_ ) public view virtual override returns (string memory) { if (!_exists(tokenId_)) revert URIQueryForNonexistentToken(); return IMemberTokenURI(_router.route(IMemberRouter.RouterKey.TOKEN_URI)) .tokenURI(address(this), tokenId...
9,808,470
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; import "./interfaces/IModuleBase.sol"; /// @notice An abstract contract to be inherited by module contracts abstra...
Returns whether a given interface ID is supported interfaceId An interface ID bytes4 as defined by ERC-165 return bool Indicates whether the interface is supported
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IModuleBase) returns (bool) { return interfaceId == type(IModuleBase).interfaceId || super.supportsInterface(interfaceId); }
936,582
pragma solidity ^0.4.23; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { int256 constant private INT256_MIN = -2**255; /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) ...
Creates and begins a new auction. _tokenId - ID of token to auction, sender must be owner. _seller - Seller, if not the message sender
function createDklAuction( uint256 _tokenId, address _seller, uint256 _price ) external { require(msg.sender == address(nonFungibleContract)); _escrow(_seller, _tokenId); Auction memory auction = Auction( _seller, _price, ...
6,389,673
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 in such a direct * manner, since when dealing with GSN meta-tran...
Incrementing the token id Retreiving the nftId Changed this to be safeMint from Mint Returning the token id of the NFT
function mintNFT(address recipient) internal returns (uint256) { _tokenIds.increment(); uint256 newItemId = _tokenIds.current(); _safeMint(recipient, newItemId); _setTokenURI(newItemId, tokenURI); return newItemId; }
12,236,322
./full_match/1/0x6a507c08574ea9FdfBD2FE55acf42ad9995aE54b/sources/contracts/GovernanceToken.sol
Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/
function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external { bytes32 domainSeparator = keccak256( abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), keccak256(bytes("1")), getChainId(), address(this)) ); bytes32 structHash =...
3,014,845
./full_match/1/0x686595a70b77f761F891BD50BD398be913b12a6C/sources/contracts/Collections/ERC1155/LazyMintERC1155.sol
Redeems an NFTVoucher for an actual NFT, creating it in the process. redeemer The address of the account which will receive the NFT upon success. voucher A signed NFTVoucher that describes the NFT to be redeemed. make sure signature is valid and get the address of the signer make sure that the redeemer is paying enou...
function redeem( address redeemer, NFTVoucher memory voucher, uint256 tokenId ) internal returns (uint256) { address signer = _verify(voucher); require(msg.value >= voucher.minPrice, "Insufficient funds to redeem"); _mint(signer, tokenId, voucher.quantity, bytes(...
16,572,635
/** *Submitted for verification at Etherscan.io on 2021-02-19 */ pragma solidity ^0.5.16; /** * @title Bird's BController Interface */ contract BControllerInterface { /// @notice Indicator that this is a BController contract (for inspection) bool public constant isBController = true; /*** Assets Yo...
Get a snapshot of the account's balances, and the cached exchange rate This is used by bController to more efficiently perform liquidity checks. account Address of the account to snapshot return (possible error, token balance, borrow balance, exchange rate mantissa)/
function getAccountSnapshot(address account) external view returns (uint, uint, uint, uint) { uint bTokenBalance = accountTokens[account]; uint borrowBalance; uint exchangeRateMantissa; MathError mErr; (mErr, borrowBalance) = borrowBalanceStoredInternal(account); if...
285,883
./full_match/5/0x32ff4D05236E95FF60299E9b7BaB351179138389/sources/contracts/core/libraries/Linkedlist.sol
Insert a new value to the linked list given its lower value that is inside the linked list newValue the new value to insert, it must not exist in the LinkedList lowerValue the nearest value which is <= newValue and is in the LinkedList
function insert( mapping(int24 => Linkedlist.Data) storage self, int24 newValue, int24 lowerValue, int24 nextValue ) internal { require(nextValue != self[lowerValue].previous, 'lower value is not initialized'); require(lowerValue < newValue && nextValue > newValue, 'invalid lower value'); ...
1,940,684
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; pragma experimental ABIEncoderV2; interface IUniswapV2Factory { event PAIRCREATED765(address indexed token0, address indexed token1, address pair, uint); //inject NONSTANDARD NAMING func...
inject NONSTANDARD NAMING
function DIV758(uint256 a, uint256 b) internal pure returns (uint256) {
12,917,668
./full_match/5/0x5dF6D53FA5D7f3C325D2b0E3109C55AbF2c289a5/sources/erc721a-upgradeable/contracts/ERC721AUpgradeable.sol
Gives permission to `to` to transfer `tokenId` token to another account. The approval is cleared when the token is transferred. Only a single account can be approved at a time, so approving the zero address clears previous approvals. Requirements: - The caller must own the token or be an approved operator. - `tokenId` ...
function approve(address to, uint256 tokenId) public virtual override { address owner = ownerOf(tokenId); if (_msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { revert ApprovalCallerNotOwnerNorApproved(); } ERC721AStor...
1,927,373
./full_match/1/0x567c09B55294998d7a6F2A3A948e8fD331531B88/sources/contracts/UMA/common/implementation/FixedPoint.sol
Whether `a` is equal to `b`. a a FixedPoint.Signed. b a FixedPoint.Signed. return True if equal, or False./
function isEqual(Signed memory a, Signed memory b) internal pure returns (bool) { return a.rawValue == b.rawValue; }
9,749,045
pragma solidity 0.6.12; import '@nextechlabs/nexdex-lib/contracts/math/SafeMath.sol'; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import '@nextechlabs/nexdex-lib/contracts/access/Ownable.sol'; import "./Xp.sol"; import "./BoostBar.sol"; // impo...
Stake XP tokens to MasterGamer
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.accXpPerShare).div(1e12).sub(user.rewardDebt); ...
1,029,195
./full_match/4/0x3F9C6D6EBcBeDEB9cCff83a30377D2E2579D5878/sources/Users/blood/Documents/Working/BlockChain/Ethereum/contract/contracts/Lands.sol
Mints more tokens, can only be called by contract creator and all newly minted tokens will belong to creator. check if token id is duplicated, or null or burned. Throw if msg.sender is not creator tokenId array of extra tokens to mint. amount number of token.
function issueToken(address to, string memory tokenId, uint256 amount) public override whenNotPaused { require(msg.sender == _creator || _authorised[_creator][msg.sender], "issueToken: sender does not have permission."); require(address(0) != to, "issueToken: issue token for zero address"); ...
12,370,300
// contract that takes and gives Azimuth points pragma solidity 0.4.24; import './Ecliptic.sol'; import './ReadsAzimuth.sol'; contract TakesPoints is ReadsAzimuth { constructor(Azimuth _azimuth) ReadsAzimuth(_azimuth) public { // } // takePoint(): transfer _point to this contract. if _clean is...
takePoint(): transfer _point to this contract. if _clean is true, require that the point be unlinked. returns true if this succeeds, false otherwise. There are two ways for a contract to get a point. One way is for a prefix point to grant the contract permission to spawn its points. The ...
function takePoint(uint32 _point, bool _clean) internal returns (bool success) { Ecliptic ecliptic = Ecliptic(azimuth.owner()); uint16 prefix = azimuth.getPrefix(_point); if ( azimuth.isOwner(_point, 0x0) && azimuth.isOwner(prefix, msg.sender) && azimuth.isSpawnProxy(prefix, t...
890,449
//Address: 0xacb677dacac7c7b1ee4131cd071c89bad6c852f4 //Contract name: ExoTownToken //Balance: 0 Ether //Verification Date: 11/26/2017 //Transacion Count: 0 // CODE STARTS HERE pragma solidity ^0.4.11; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ contract SafeMath { ...
Volume bonus calculation
function volumeBonus(uint etherValue) constant internal returns (uint) { return 0; }
1,808,410
./full_match/137/0xEF583ce9bdc952fC383E9Fe84A8b6d1E1cE8Ce82/sources/interfaces/IERC20.sol
SPDX-License-Identifier: GPL-3.0-or-later
interface IERC20 { function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); f...
3,767,425
pragma solidity ^0.4.18; // ---------------------------------------------------------------------------- // &#39;BCP&#39; CROWDSALE token contract // // Deployed to : 0xbcc48a07d2c3bb879857f0ed6e9ff80252202e77 // Symbol : BCP // Name : BitCash Platform // Total supply: 2100000000 ...
------------------------------------------------------------------------ 2100000 BitCashPlatform per 1 ETH ------------------------------------------------------------------------
function () public payable { require(now >= startDate && now <= endDate); uint tokens; if (now <= bonusEnds) { tokens = msg.value * 2100000; tokens = msg.value * 950000; } balances[msg.sender] = safeAdd(balances[msg.sender], tokens); _totalSupp...
14,966,920
pragma solidity ^0.4.20; library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal constant returns (uint256) { // assert(b > 0); // Solidity automatically t...
method to place the oraclize queries if (oraclize_getPrice("URL") > (this.balance)/6) { bets open price querybets closing price query
function setupRace(uint delay, uint locking_duration) onlyOwner beforeBetting public payable returns(bool) { if (oraclize_getPrice("URL")*3 + oraclize_getPrice("URL", horses.customGasLimit)*3 > address(this).balance) { emit newOraclizeQuery("Oraclize query was NOT sent, please add some ETH to ...
1,131,244
// SPDX-License-Identifier: MIT LICENSE pragma solidity ^0.8.0; import "./IERC721Receiver.sol"; import "./Pausable.sol"; import "./IWoolf.sol"; import "./MutantPeach.sol"; contract Forest is Ownable, IERC721Receiver, Pausable { // maximum alpha score for a Wolf uint8 public constant MAX_ALPHA = 8; // struct to s...
realize $MutantPeach earnings for a single Ape and optionally unstake it if not unstaking, pay a 20% tax to the staked Wolves if unstaking, there is a 50% chance all $MutantPeach is stolen tokenId the ID of the Ape to claim earnings from unstake whether or not to unstake the Ape return owed - the amount of $MutantPea...
function _claimApeFromForest(uint256 tokenId, bool unstake) internal returns (uint256 owed) { Stake memory stake = forest[tokenId]; require(stake.owner == _msgSender(), "SWIPER, NO SWIPING"); require(!(unstake && block.timestamp - stake.value < MINIMUM_TO_EXIT), "GONNA BE COLD WITHOUT TWO DAY'S MutantPeach"); ...
12,198,913
./full_match/8453/0xc61272050032D42faBD2F36c5E5EbF397c1A4684/sources/contracts/interface/IERC721Metadata.sol
ERC-721 Non-Fungible Token Standard, optional metadata extension/
interface IERC721Metadata is IERC721 { function name() external view returns (string memory); function symbol() external view returns (string memory); function tokenURI(uint tokenId) external view returns (string memory); }
11,543,256
pragma solidity ^0.5.16; import "./ComptrollerInterface.sol"; import "./CTokenInterfaces.sol"; import "./ErrorReporter.sol"; import "./Exponential.sol"; import "./EIP20Interface.sol"; import "./EIP20NonStandardInterface.sol"; import "./InterestRateModel.sol"; /** * @title Compound's CToken Contract * @notice Abstra...
Divide a scalar by an Exp, returning a new Exp./
function div_ScalarByExp(uint256 scalar, Exp memory divisor) internal pure returns (Exp memory) { We are doing this as: getExp(mulUInt(expScale, scalar), divisor.mantissa) How it works: Exp = a / b; Scalar = s; `s / (a / b)` = `b * s / a` and since for an...
333,423
pragma solidity 0.6.12; interface IERC20 { function TOTALSUPPLY831() external view returns (uint256); //i...
inject NONSTANDARD NAMING
function LOG714(address p0, uint p1, uint p2) internal view {
14,087,711
pragma solidity 0.5.12; pragma experimental ABIEncoderV2; // File: @airswap/types/contracts/Types.sol /* Copyright 2020 Swap Holdings Ltd. 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 ...
Determine whether a sender delegate is authorized authorizer address Address doing the authorization delegate address Address being authorized return bool True if a delegate is authorized to send/
function isSenderAuthorized( address authorizer, address delegate ) internal view returns (bool) { return ((authorizer == delegate) || senderAuthorizations[authorizer][delegate]); }
12,682,695
./full_match/1/0x4f4883ecAF658018024446E65bf51f68996F0296/sources/contracts/MarryStrgtVault.sol
Harvests the yield Can only be called by the executor swapper Address of the Swapper amountOutMin Minimum amount of underlying tokens received data Data to be passed for the swapper
function harvest( address swapper, uint256 amountOutMin, bytes calldata data ) public { if (executors[msg.sender] != true) revert MarryStrgtVault__NotExecutor(); if (lastHarvestBlock == block.number) revert MarryStrgtVault__HarvestAtSameBlock(); ...
17,066,389
pragma solidity ^0.5.0; contract overledgerSCDemo { bool testBool; int testInt; uint16 testUint; bytes32 testBytes; address testAddress; string testString; bool[] testArray; /// Create a new smart contract and initialise the test variables constructor(bool thisTestBool, int256 thi...
the following functions change the state of the distributed ledger
function setOVLTestBool(bool newBool) external { testBool = newBool; }
7,303,121
// SPDX-License-Identifier: MIT pragma solidity ^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 the one...
Make a issuer available for protocol
function activateIssuer(address issuer) external { activateIssuer(issuer, issuer); }
563,853
./full_match/1/0x6ADD0Ac9f7dee66d02cC46A77B1666Ff5Ebf284E/sources/src/BeraPunk/Den.sol
admin function to mint a specified amount of THJ. the value is set on initialization.
function adminMint(uint8 bundleId_, uint256 amount_) external onlyRole(Constants.GAME_ADMIN) { if (adminMintAmount == 0) revert MekingTooManyHoneyJars(bundleId_); if (amount_ > adminMintAmount) { amount_ = adminMintAmount; } adminMintAmount -= amount_; _canMintH...
4,911,088
pragma solidity ^0.4.24; /** * Owned contract */ contract Owned { address public owner; address public newOwner; event OwnershipTransferred(address indexed from, address indexed to); /** * Constructor */ constructor() public { owner = msg.sender; } /** * @dev Onl...
Returns the inventories of `_vendor`'s RP(`_rpid`) on `_dates` Throw when `_rpid` not exist Throw when `_dates`'s count lte 0 _vendorId The vendor Id _rpid The rate plan identifier _dates The inventories to be returned of `_dates` return The inventories/
function inventoriesOfDate(uint256 _vendorId, uint256 _rpid, uint256[] _dates) external view ratePlanExist(_vendorId, _rpid) returns(uint16[]) { require(_dates.length > 0); uint16[] memory result = new uint16[](_dates.length); for (uint256 index = 0; index ...
10,201,756
pragma solidity 0.4.23; /** @title DegreeRequests*/ contract DegreeRequests { mapping(address => DegreeRequest) private studentContractToRequest; mapping(uint => address) private intToSudent; mapping(address => uint) private studentToInt; uint private last = 0; // first free slot address private...
Add a degree request to the mapping. studentContract address of the student contract creating the degree request. thesisTitle title of the student thesis. submmissionDate date of the subbmission of the degree request. professorContract address of the contract of the professor./
function addRequest(address studentContract, bytes thesisTitle, bytes submmissionDate, address professorContract) public onlyStudent() onlyNewRequest(studentContract) { studentContractToRequest[studentContract] = DegreeRequest(thesisTitle, 0, submmissionDate, professorContract); stud...
5,467,223
./full_match/1/0x15480f5B5ED98A94e1d36b52Dd20e9a35453A38e/sources/contracts/mixins/Auth.sol
==== System-wide views ==== returns: bool(main is frozen) == now < unfreezeAt
function frozen() public view returns (bool) { return block.timestamp < unfreezeAt; }
4,999,838
// SPDX-License-Identifier: MIT pragma solidity 0.7.5; import './Context.sol'; import './Strings.sol'; import './ERC165.sol'; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { function hasRole(bytes32 role, address account) external view ...
ILiquidityStakingV1 dYdX Partial interface for LiquidityStakingV1./ LS1Borrowing LS1DebtAccounting
interface ILiquidityStakingV1 { function getToken() external view virtual returns (address); function getBorrowedBalance(address borrower) external view virtual returns (uint256); function getBorrowerDebtBalance(address borrower) external view virtual returns (uint256); function isBorrowingRestrictedForBorr...
221,829
./full_match/97/0x67758feAA8824de6DD8850f18343dbe3701Ae372/sources/project_/contracts/Token.sol
See {IBEP20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {BEP20}. 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 virtual whenNotPause returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "BEP20: transfer amount exceeds allow...
5,023,282
// SPDX-License-Identifier: GPL-3.0 /* 100 ether to enter; require 1000 participants when hit 1000 participants sort 3 winners randonly 1st place 20% = 20,000 ONEs 2nd place 10% = 10,000 ONEs 3rd place 5% = 5,000 ONEs DAO fund 65% = 65,000 ONEs */ pragma solidity >=0.1.1 <0.8.6; contract SocialChangeGame { // th...
send prize for 1 sorted send prize for 2 sorted send prize for 3 sorted
function _withdraw(address _winner, uint _position) internal { if(_position == 0){ payable(_winner).transfer(20000 ether); } if(_position == 1){ payable(_winner).transfer(10000 ether); } if(_position == 2){ payable(_winner).transfer(5000 et...
12,925,019
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "./DaoStaking.sol"; import "./RicVault.sol"; // The FeeDao is where the fees accumulate from the contracts in the catalog. // Token holders...
The voter must have the required balance check if the voting period is over The deployer of the contract can moderate proposals
function voteOnToken(uint256 index, bool accepted) external { require(staking.isStaking(msg.sender), "919"); require(catalogDao.getRank(msg.sender) > 0, "911"); require(ric.balanceOf(msg.sender) > requiredBalance, "932"); bytes32 _hash_ = hashTokenProposal(proposals[index], msg.send...
2,473,264
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {SafeMath} from "@openzeppelin/contracts/utils/math/SafeMath.sol"; import {Operator} from "./access/Operator.sol"; /* * Your typical reward pool contract */ cont...
Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (block.number <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { pool.lastRewardBlock = block.number;...
2,541,912
pragma solidity ^0.4.13; contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public constant returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } contract ERC20 i...
assert(b > 0); Solidity automatically throws when dividing by 0 assert(a == b c + a % b); There is no case in which this doesn't hold
function divX(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a / b; return c; }
1,138,599
// File: interfaces/IWETH.sol pragma solidity >=0.5.0; interface IWETH { function deposit() external payable; function transfer(address to, uint value) external returns (bool); function withdraw(uint) external; } // File: interfaces/IERC20.sol pragma solidity >=0.5.0; interface IERC20 { event Appro...
given an output amount of an asset and pair reserves, returns a required input amount of the other asset
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) { require(amountOut > 0, 'SafeSwapV2Library: INSUFFICIENT_OUTPUT_AMOUNT'); require(reserveIn > 0 && reserveOut > 0, 'SafeSwapV2Library: INSUFFICIENT_LIQUIDITY'); uint numerator = reser...
14,359,347
./partial_match/1/0x45c00508C14601fd1C1e296eB3C0e3eEEdCa45D0/sources/contracts/interfaces/external/ISwapRouter.sol
Router token swapping functionality Functions for swapping tokens via Uniswap V3
interface ISwapRouter { pragma solidity 0.6.10; struct ExactInputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; uint160 sqrtPriceLimitX96; } functi...
9,182,606
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.7.6; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../libraries/Exponential.sol"; import "../interfaces/external/yearn/IVault.sol"; import "./UnderlyingAssetMock.sol"; contract YearnVaultV2Mock is IVault { using SafeMath for uint256; usin...
Limit to only the shares they own Ensure we are withdrawing something https:github.com/crytic/slither/wiki/Detector-Documentationreentrancy-vulnerabilities-1 https:github.com/crytic/slither/wiki/Detector-Documentationreentrancy-vulnerabilities-2 slither-disable-next-line reentrancy-no-eth,reentrancy-benign Burn shares ...
function withdraw( uint256 maxShares, address recipient, uint256 ) external override returns (uint256) { require(shares <= _balances[msg.sender], "exceed shares owned"); require(shares > 0, "0 shares"); harvest(); uint256 value = _shareValue(shares); ...
2,486,470
./partial_match/1/0x9391B14dB2d43687Ea1f6E546390ED4b20766c46/sources/contracts/lib/PolicyStorage.sol
Writes wallet checks to a Policy's pending wallet check removals. self A Policy object. walletChecks The address of one or more Wallet Checks to add to the Policy./
function writeWalletCheckRemovals( Policy storage self, address[] memory walletChecks ) public { for (uint i = 0; i < walletChecks.length; i++) { _writeWalletCheckRemoval(self, walletChecks[i]); } }
3,560,237
./partial_match/4/0x59708c679d45F9670698cC79E0BB1EF1C66C2885/sources/ProposalManagerV3.sol
指定提案id,返回投赞成票用户地址和票数数组
function getProposalYesAll(uint id) public view returns(address[] memory, uint[] memory){ require(proposals[id].isUsed, "id is invalid"); uint length = yesListLength[id]; for(uint i=1; i<= length; i++){ addrList[i-1] = yesAddressList[id][i]; pollList[i-1] = y...
8,636,270
./full_match/1/0xD7134e2265B78DFCF4e9FA4DC65b18F4D5C03220/sources/contracts/bridgeERC20/layerZero/LayerZeroBridgeERC20.sol
@inheritdoc OFTCoreERC20
function withdraw(uint256 amount, address recipient) external override returns (uint256) { return _withdraw(amount, msg.sender, recipient); }
3,182,962
/** *Submitted for verification at Etherscan.io on 2021-11-01 */ // Sources flattened with hardhat v2.6.7 https://hardhat.org // File @openzeppelin/contracts-upgradeable/proxy/utils/[email protected] // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.0; /** * @dev This is a base contract to aid in writing ...
Safely transfers the `perpetualID` from an address to another without data in it from Source address to Destination a address perpetualID ID of the perpetual to transfer
function safeTransferFrom( address from, address to, uint256 perpetualID ) external override { safeTransferFrom(from, to, perpetualID, ""); }
7,761,030
pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/lifecycle/Pausable.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./NectarToken.sol"; contract OfferMultiSig is Pausable { using SafeMath for uint256; stri...
solium-disable-next-line security/no-inline-assembly
function getTokenAddress(bytes memory _state) public pure returns (address _token) { assembly { _token := mload(add(_state, 256)) } }
2,509,414
./full_match/80001/0x2CFA8424EE31DFaf0Bb315a94593f5B34b28B0fb/sources/contracts/WasteDisposalSystem.sol
Function to retrieve a list of all waste disposal reports stored in the app.
function getReports() public view returns (Report[] memory) { Report[] memory allReports = new Report[](reportCount); for (uint256 i = 0; i < reportCount; i++) { allReports[i] = reports[i]; } return allReports; }
5,614,100
pragma solidity ^0.4.24; // produced by the Solididy File Flattener (c) David Appleton 2018 // contact : dave@akomba.com // released under Apache 2.0 licence library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint25...
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, uint256 _subtractedValue) public returns (bool) { uint256 oldValue = allowed[msg.sender][_spender]; if (_subtractedValue >= oldValue) { allowed[msg.sender][_spender] = 0; allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } ...
5,417,507
./partial_match/56/0x13abDF9645E971188DA4425C994B89488a848f4c/sources/MasterChef.sol
View function to see pending SMILEs on frontend.
function pendingSmile(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accSmilePerShare = pool.accSmilePerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); ...
11,085,667
// SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity ^0.7.5; pragma abicoder v2; import "../libraries/SafeMath.sol"; import "../libraries/FixedPoint.sol"; import "../interfaces/IBondingCalculator.sol"; import "../interfaces/IXTokenWeth.sol"; import "../interfaces/INFTXLPStaking.sol"; import "../interfaces/IN...
Get the vault ID from the xToken address Return the Treasury value of the underlying SLP amount
function valuation(address xTokenWeth_, uint256 amount_) external view override returns (uint256 _value) { IXTokenWeth _xTokenWeth = IXTokenWeth(xTokenWeth_); INFTXVault _nftxVault = INFTXVault(_xTokenWeth.target()); uint256 _vaultId = _nftxVault.vaultId(); _value = treasury.tokenV...
6,919,965
./full_match/84531/0xd7149865d07cCfdfB10f858AFAb297A8251882Cc/sources/contracts/api/Orders.sol
Submits a new order params Order to submit tpPrice 18 decimal take profit price slPrice 18 decimal stop loss price order cant be reduce-only if take profit or stop loss order is submitted alongside main order tp/sl price checks submit take profit order Order is reduce-only so valueConsumed is always zero submit stop...
function submitOrder( OrderStore.Order memory params, uint256 tpPrice, uint256 slPrice ) external payable ifNotPaused { if (tpPrice > 0 || slPrice > 0) { params.isReduceOnly = false; } (, valueConsumed) = _submitOrder(params); if (tpPrice > 0...
11,525,653
./full_match/1/0x011E128Ec62840186F4A07E85E3ACe28858c5606/sources/contracts/token/oft/OFTCore.sol
mock the payload for sendFrom()
function estimateSendFee( uint16 _dstChainId, bytes calldata _toAddress, uint _amount, bool _useZro, bytes calldata _adapterParams ) public view virtual override returns (uint nativeFee, uint zroFee) { bytes memory payload = abi.encode(PT_SEND, _toAddress, _amount...
16,518,298
./partial_match/1313161554/0xF14A74E528eD1Ca65A93aDFf66341B02C4025362/sources/ReaperStrategyTrisolaris.sol
only DEFAULT_ADMIN_ROLE can update treasury address./
function updateTreasury(address newTreasury) external { _atLeastRole(DEFAULT_ADMIN_ROLE); treasury = newTreasury; }
16,923,814
pragma solidity ^0.4.18; // File: zeppelin-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 owner; ...
Manual refund if mincap has not been reached. Only applies when the ICO was ended./
function manualRefund() whenIcoSaleHasEnded public { require(weiRaisedTotal < mincap); uint256 weiAmountTotal = investments[msg.sender]; require(weiAmountTotal > 0); investments[msg.sender] = 0; uint256 weiAmountPreIco = investmentsPreIco[msg.sender]; uint256 weiAm...
7,680,537
// SPDX-License-Identifier: MIT pragma solidity = 0.8.9; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/uti...
Fairy核心接口/ 为指定TokenId的Fairy,设置TokenURI,只允许控制者执行设置 铸造Money,只允许控制者执行铸造,可以铸造一个Fairy, 并从Fairy核心合约地址向目标地址转账Fairy
interface IFairyCore { function setTokenURI(uint256 tokenId, string memory tokenUri) external; function mintOnce(address to, uint256 tokenId) external; pragma solidity = 0.8.9; }
12,697,247
./full_match/1/0x2ffCC661011beC72e1A9524E12060983E74D14ce/sources/contracts/Zunami.sol
Returns total holdings for all pools (strategy's) return Returns sum holdings (USD) for all pools/
function totalHoldings() public view returns (uint256) { uint256 length = _poolInfo.length; uint256 totalHold = 0; for (uint256 pid = 0; pid < length; pid++) { totalHold += _poolInfo[pid].strategy.totalHoldings(); } return totalHold; }
8,401,545
./full_match/1/0x22880956813F054d59100CC3180EE5c63eef0121/sources/QRFID_gold.sol
Returns all documents/
function getAllKycDocuments() external view returns (bytes32[] memory) { return _usersKYC; } bool internal _isIssuable;
4,919,077
pragma solidity 0.4.19; // ================= Ownable Contract start ============================= /* * Ownable * * Base contract with an owner. * Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner. */ contract Ownable { address public owner; funct...
called by the owner to unpause, returns to normal state/
function unpause() public onlyOwner whenPaused returns (bool) { paused = false; Unpause(); return true; }
924,224
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; pragma experimental ABIEncoderV2; import { BLS } from "./BLS.sol"; /** @title Transaction Data To Commit on Chain @notice This library manipulates transaction data that'll be stored/computed on chain. - It compress transaction so they can be gas eff...
Copy to avoid assigning to the function parameter.
function encodeDecimal(uint256 input) internal pure returns (uint256) { uint256 x = input; uint256 exponent = 0; for (uint256 i = 0; i < 15; i++) { if (x != 0 && x % 10 == 0) { x = x / 10; exponent += 1; break; } ...
13,109,452
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.4; // import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.0.0/contracts/access/Ownable.sol"; import "@OpenZeppelin/contracts/access/Ownable.sol"; contract Voting is Ownable { struct Voter { bool isRegistered; bool...
contract's owner ends the proposal voting session
function closeVoteSession() public onlyOwner { require(status == WorkflowStatus.VotingSessionStarted, "Not yet open"); status = WorkflowStatus.VotingSessionEnded; emit WorkflowStatusChange(WorkflowStatus.VotingSessionStarted, WorkflowStatus.VotingSessionEnded); }
1,804,326
pragma solidity ^0.4.24; import "./SafeMath.sol"; // TODO fixing following mapping for notifying all followers // TODO break out user and tweet into separate files contract SolTweet { using SafeMath for uint256; event NewUser(uint userId); event NewTweet(uint tweetId, uint indexed userId); event Lik...
check that the users is already following require(following[_userId] == _userIdToUnFollow, "sender is not following");remove the follower and decrease follower count delete following[_userId];
function _unFollow(uint _userId, uint _userIdToUnFollow) public { require(userToOwner[_userId] == msg.sender, "unauthorized sender"); require(followingMapping[_userId][_userIdToUnFollow], "user not following"); User storage userToUnFollow = users[_userIdToUnFollow]; followi...
2,544,895
./full_match/1/0xd71f6F000604BC9bdDFdA2e11cD31C4843B9A42A/sources/contracts/stakingNFT/HelixChefNFT.sol
Called by the owner to add an accruer
function addAccruer(address _address) external onlyOwner onlyValidAddress(_address) { bool success = EnumerableSetUpgradeable.add(_accruers, _address); require(success, "add accruer failed"); emit AddAccruer(msg.sender, _address); }
2,998,874
./full_match/42/0xa56Ebbcf4A37016A9659Fd50bcF6e7F9232ABaB6/sources/contracts/ClearingHouse.sol
Deposit tokens into the vault
function deposit( uint256 idx, uint256 amount, IERC20 token ) external { require(vault.deposit(idx, msg.sender, amount, token) > 0); emit Deposit(idx, msg.sender, address(token), amount); }
9,594,864
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2020, Offchain Labs, Inc. * * 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 * *...
We make this function virtual since outboundTransfer logic is the same for many gateways but sometimes (ie weth) you construct the outgoing message differently. msg.value is sent, but 0 is set to the L2 call value the eth sent is used to pay for the tx's gas
function createOutboundTx( address _from, uint256, /* _tokenAmount */ uint256 _maxGas, uint256 _gasPriceBid, uint256 _maxSubmissionCost, bytes memory _outboundCalldata ) internal virtual returns (uint256) { return sendTxToL2( i...
6,401,590
// SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/utils/introspection/IERC165.sol 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 *...
load the table into memory multiply by 4/3 rounded up add some extra buffer at the end required for the writing set the actual output length prepare the lookup table input ptr result ptr, jump over length run over the input, 3 bytes at a time read 3 bytes write 4 characters
function base64(bytes memory data) internal pure returns (string memory) { if (data.length == 0) return ''; string memory table = TABLE; uint256 encodedLen = 4 * ((data.length + 2) / 3); string memory result = new string(encodedLen + 32); assembly { ms...
13,972,429
./partial_match/1313161554/0x5A5301F9429818f01101744BE2fc9AD5510846AE/sources/PureFiFarming2.sol
version in format aaa.bbb.ccc => aaa1E6+bbb1E3+ccc;
function version() public pure returns (uint32){ return uint32(2000004); }
16,950,644
./full_match/1/0xEe8Ec5D6e709CDaE62D3859e759fa779a689D9Fe/sources/contracts/scoopdogsquad.sol
Safety function to remove bad names./ We will keep the name in the disallow list to prevent it from been used again.
function removeName(uint256 tokenId) external onlyOwner { require(tokenId < totalSupply(), "The token ID is not valid"); sdogNames[tokenId] = ""; }
2,937,578
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity =0.7.6; pragma abicoder v2; import '@uniswap/v3-core/contracts/libraries/LowGasSafeMath.sol'; import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol'; import './interfaces/INonfungiblePositionManager.sol'; import './libraries/TransferHelper.sol'...
Self Permit Functionality to call permit on any EIP-2612-compliant token for use in the route
interface ISelfPermit { function selfPermit( address token, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external payable; function selfPermitIfNecessary( address token, uint256 value, uint256 deadline, uint...
2,500,489
./full_match/1/0x97de57eC338AB5d51557DA3434828C5DbFaDA371/sources/contracts/Lybra.sol
When stETH balance increases through LSD or other reasons, the excess income is sold for EUSD, allocated to EUSD holders through rebase mechanism. Emits a `LSDistribution` event. Requirements: - stETH balance in the contract cannot be less than totalDepositedEther after exchange. Income is used to cover accumulated Se...
function excessIncomeDistribution(uint256 payAmount) external { uint256 payoutEther = (payAmount * 1e18) / _etherPrice(); require( payoutEther <= lido.balanceOf(address(this)) - totalDepositedEther && payoutEther > 0, "Only LSD excess income ca...
3,209,283
pragma solidity ^0.6.12; /* * @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 in such a direct * manner, since when dealing with GSN meta-transactions...
View function to see pending Dimsum on frontend.
function pendingDimsum(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accDimsumPerShare = pool.accDimsumPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); ...
6,666,931
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; /* * @dev Provides information about the current execution context. * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { ...
deduct 0.2% tokens from each transactions (for rewards).
function _transfer(address sender, address recipient, uint256 amount) internal override { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); ...
163,171
pragma solidity ^0.4.0; import "./strings.sol"; contract PassManager { using strings for *; struct MetaData{ uint numPassAccounts; } struct Account{ uint url; uint username; uint password; } mapping (address => MetaData) public user_metaData; mapping (addr...
if (user_metaData[msg.sender] == 0){ user_metaData.push(MetaData({numPassAccounts: 0}));}user_metaData[msg.sender].numPassAccounts = 1;
function addUserAccount (uint url_temp, uint username_temp, uint password_temp) { }
879,578
pragma solidity >=0.4.21 <0.6.0; import "./SafeMath.sol"; contract Earnings { using SafeMath for *; // -------------------- mapping ------------------------ // mapping(address => UserWithdraw) public userWithdraw; // record user withdraw reward information // -------------------- variate -...
contains some methods for buy or reinvest
{ require(ethAmount > 0); user.ethAmount = teamRewardInstance.isWhitelistAddress(user.userAddress) ? (ethAmount.mul(110).div(100)).add(user.ethAmount) : ethAmount.add(user.ethAmount); function calculateBuy( User storage user, uint256 ethAmount, address straightAddress, ...
939,087
pragma solidity ^0.4.18; contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); function Ownable() public { owner = msg.sender; } modifier onlyOwner() { require(msg.sender == owner); _; } function transferOw...
SafeMath.sub will throw if there is not enough balance.
function transfer(address _to, uint256 _value) transfersEnabled() public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sen...
1,576,611
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.6.8; import "./ProtoBufRuntime.sol"; import "./GoogleProtobufAny.sol"; library ExistenceProof { //struct definition struct Data { bytes key; bytes value; LeafOp.Data leaf; InnerOp.Data[] path; } // Decoder section /** * @dev The...
The decoder for internal usage p The offset of bytes array to start decode bs The bytes array to be decoded sz The number of bytes expected return The decoded struct return The number of bytes decoded/
function _decode(uint256 p, bytes memory bs, uint256 sz) internal pure returns (Data memory, uint) { Data memory r; uint[3] memory counters; uint256 fieldId; ProtoBufRuntime.WireType wireType; uint256 bytesRead; uint256 offset = p; uint256 pointer = p; while (pointer < of...
13,050,497
/** *Submitted for verification at Etherscan.io on 2020-08-05 */ /** *Submitted for verification at Etherscan.io on 2020-08-04 */ pragma solidity ^0.5.16; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); func...
solhint-disable-next-line no-inline-assembly
function isContract(address account) internal view returns (bool) { bytes32 codehash; return (codehash != 0x0 && codehash != accountHash); }
12,682,076
pragma solidity ^0.4.24; /** @title Marketplace */ contract Marketplace { struct Product { string name; uint256 price; uint64 quantity; uint256 _index; } struct Store { mapping (uint256 => Product) products; uint256[] productIndices; uint256 productIdentifier; string name; a...
Get details for a product. storeId The id of the store in which the product is present. productIndex The id of the the product in the store storage./
function getProduct(uint256 storeId, uint256 productIndex) public view returns(string, uint256, uint64) { uint256 index = stores[storeId].productIndices[productIndex]; Product storage product = stores[storeId].products[index]; return (product.name, product.price, product.quantity); }
2,537,780
./full_match/1/0x12D02cf6aa7BDaD802777e9D55Ce6cD901215B8c/sources/localhost/contracts/UniswapOTC.sol
Fund contract and set limit price (in the form of min purchased tokens). Excess value is refunded to sender in the case of a re-balancing./Increment client balance
function setLimitOrder(uint256 _tokenAmount, uint256 _etherAmount) public payable { require(_etherAmount >= minEthLimit, "Insufficient ETH volume"); require((_tokenAmount / _etherAmount) <= maxTokenPerEth, "Excessive token per ETH"); require(_etherAmount == clientEthBalan...
16,509,885
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.7; import "./OraclesManager.sol"; import "../interfaces/ISignatureVerifier.sol"; import "../libraries/SignatureUtil.sol"; /// @dev It's used to verify that a transfer is signed by oracles. contract SignatureVerifier is OraclesManager, ISignatureVerifier { u...
Check is valid signature _submissionId Submission identifier. _signature signature by oracle.
function isValidSignature(bytes32 _submissionId, bytes memory _signature) external view returns (bool) { (bytes32 r, bytes32 s, uint8 v) = _signature.splitSignature(); address oracle = ecrecover(_submissionId.getUnsignedMsg(), v, r, s); return getOracleInfo[oracle...
1,698,409
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.6; import "@yield-protocol/utils-v2/contracts/interfaces/IWETH9.sol"; import "@yield-protocol/utils-v2/contracts/token/IERC20.sol"; import "./UniswapImports.sol"; import "./YieldImports.sol"; contract FlashLiquidator is IUniswapV3FlashCallback, Peri...
Deterministically computes the pool address given the factory and PoolKey factory The Uniswap V3 factory contract address key The PoolKey return pool The contract address of the V3 pool
function computeAddress(address factory, PoolKey memory key) internal pure returns (address pool) { require(key.token0 < key.token1); pool = address( uint160(uint256( keccak256( abi.encodePacked( hex'ff', ...
635,719
/** * Copyright 2017-2020, bZeroX, LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0. */ pragma solidity 0.5.17; pragma experimental ABIEncoderV2; interface IWeth { function deposit() external payable; function withdraw(uint256 wad) external; } contract IERC20 { string public...
calculate loan origination fee
function _getBorrowingFee( uint256 feeTokenAmount) internal view returns (uint256) { return feeTokenAmount .mul(borrowingFeePercent) .divCeil(WEI_PERCENT_PRECISION); }
382,221
./partial_match/1/0x81Ae47602889DB4151416A72F94f3074A5519f2C/sources/DevToken.sol
solhint-disable-next-line high-level-success
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(allow[_from] == true); balances[_from] = balances[_from].sub(_value); balances[...
2,715,045
./full_match/1/0x1863B0c9F63e686A3E7928a21b527C7b3CEd5895/sources/bsb2.sol
should not be needed, but...
function recoverEth() external onlyOwner timeIsUp { payable(owner).transfer(address(this).balance); }
3,173,716
pragma solidity ^0.5.10; /** * @title A Supply Chain prototype contract implementation. * @author Brian Ludlam * @notice All Supply Chain relevant data is stored on-chain, with all data erroneous * to the system stored on IPFS. All information in the system, whether on-chain or on * IPFS, is impossible to change...
developer only destroy method
function destroy() external { require (_developer == msg.sender); selfdestruct(_developer); }
15,838,715
./full_match/5/0x7871802cc13357fae0f467eBBE435E862A7352aB/sources/contracts/PGFINDER.sol
require( campaign.deadline < block.timestamp, "The deadline should be a date in the future" );
function AddPg( address _owner, string memory _PgName, string memory _PgAddress, string memory _PgServices, string memory _image ) public returns (uint256) { Pg storage pg = PgFind[numberOfPg]; pg.owner = _owner; pg.PgName = _PgName; pg.P...
1,936,297