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/44787/0xBDDA3887dd89CAeac73c5AfbcD7af0793F55B715/sources/contracts/StarFarm.sol
require (_pid != 0, 'withdraw STAR by unstaking');if (_pid == 0) require(userNFTs[_msgSender()].length == 0, "nft user");
function testdeposit(uint256 _pid, uint256 _amount) public returns(uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_msgSender()]; updatePool(_pid); (uint256 _selfGain, uint256 _parentGain) = starNode.nodeGain(); uint256 _useramount =...
13,279,631
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; contract ProjectRegister{ mapping (address => bool) public whitelist; mapping(bytes32 => election) public projectsRegistered; uint public whitelistedCount; uint public threshold; address public admin; struct Voter { uint wei...
console.log("Approve count: %s, Reject count: %s", projectsRegistered[fileHash].approved, projectsRegistered[fileHash].rejected);
function evaluatePendingProjectStatus(bytes32 fileHash) private{ if (projectsRegistered[fileHash].approved > projectsRegistered[fileHash].rejected) { projectsRegistered[fileHash].decision = true; } projectsRegistered[fileHash].finalized = true; emit ProjectEvaluation(fi...
5,461,891
./partial_match/4/0xd2074450711Ab029d57D16bae1158534B01aa935/sources/Fortuna.sol
uint previousBalances = balanceOf[_from] + balanceOf[_to]; cback assert(balanceOf[_from] + balanceOf[_to] == previousBalances); cback
function _cleantransfer(address _from, address _to, uint _value) internal { require(_to != address(0x0)); require(balanceOf[_from] >= _value); require(balanceOf[_to] + _value >= balanceOf[_to]); balanceOf[_from] -= _value; balanceOf[_to] += _value; emit Transfer(_from...
8,506,835
./partial_match/4/0xA916bB3Dd5F48561bB4A25eaA5e072a6ce1B6d45/sources/SmolMuseum.sol
Returns the applicable booster of a user, for a pool, from a staked NFT set./
function getBoosterForUser(address _addr, uint256 _pid) public view returns (uint256) { return userPoolBoosts[_addr][_pid].div(1e5); }
8,641,720
./partial_match/137/0x66768ad00746aC4d68ded9f64886d55d5243f5Ec/sources/REBALANCE.sol
Medium _tTaxTierMediumFee
function setTaxTierMediumFee(uint256 tTaxAmount) external onlyOwner() { require(tTaxAmount > 0, "Tax medium amount must be greater than 0"); _tTaxTierMediumFee = tTaxAmount; }
3,514,295
// SPDX-License-Identifier: MIT pragma solidity >=0.5.17 <0.9.0; import "@unlock-protocol/contracts/dist/PublicLock/IPublicLockV10.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/utils/Base64.sol"; import "hardhat/console.sol"; import "./Layer.sol"; import { BokkyPooBahsDateTi...
see https:github.com/unlock-protocol/unlock/blob/master/smart-contracts/contracts/interfaces/hooks/IHook.sol uint timeOfDay = 0; string memory kind = ""; (, , , uint hour, , ) = BokkyPooBahsDateTimeLibrary.timestampToDateTime(block.timestamp); if (hour <= 8) { timeOfDay = 0; 0 => night } else if (hour <= 17) { ...
function tokenURI( ) external view returns (string memory) { string memory image = "QmYkkshevBxHg7XwdP1pw6A4T82xzD8G2RpLDFo6KDy3zm"; string memory json = string( ); return string( abi.encodePacked( "data:application/json;b...
572,692
./partial_match/4/0xb822796865033B466770CE88B9C1E2f1B1ed56f0/sources/J2TS.sol
Prevent overflow when multiplying INT256_MIN with -1 https:github.com/RequestNetwork/requestNetwork/issues/43
function mul(int256 a, int256 b) internal pure returns (int256) { require(!(a == - 2 ** 255 && b == - 1) && !(b == - 2 ** 255 && a == - 1)); int256 c = a * b; require((b == 0) || (c / b == a)); return c; }
8,687,845
./partial_match/1/0x8a3B9BF2ee8016F9B6B59FEDaA1639E276c04e42/sources/Staker.sol
Cap token price at 1 eth, can't be called if makeUnchangeable() was called
function capPrice(bool input) public{ require(!unchangeable(), "makeUnchangeable() function was already called"); priceCapped = input; }
16,028,500
./partial_match/1/0xCEaC66ab21240FeD157391b2A792be37FbF5c6B9/sources/BuccaneerLOCK.sol
One way deposit function
function depositToLOCK(uint256 amountToDeposit) public onlyOwner returns (bool) { require (doubleLOCK == msg.sender); buccInstance = BuccV2(v2Address); numberofBUCC += amountToDeposit; return buccInstance.transferFrom(doubleLOCK, address(this), amountToDeposit); }
4,477,949
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IE...
Hook that is called before any token transfer. This includes minting and burning. Calling conditions: - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be transferred to `to`. - When `from` is zero, `tokenId` will be minted for `to`. - When `to` is zero, ``from``'s `tokenId` will be burned. - `from` c...
function _beforeTokenTransfer(ERC721Storage storage s, address from, address to, uint256 tokenId) internal { if(address(s._beforeTokenTransferHookInterface) != address(0)) { (bool success, ) = address(s._beforeTokenTransferHookInterface).delegatecall( abi.encodeWithSelector(s._be...
6,935,804
pragma solidity 0.4.25; // * Samurai Quest - Levelling game that pay ether. Version 1. // // * Developer - Studio California // "You can check out any time you like, but you can never leave" // // * Uses Linked List to store player level // // * Refer to https://samurai-quest.hostedwiki...
Insert node `_new` beside existing node `_node` in direction `_direction`. self stored linked list from contract _node existing node _new new node to insert _direction direction to insert node in
function insert(LinkedList storage self, uint256 _node, uint256 _new, bool _direction) internal returns (bool) { if (!nodeExists(self, _new) && nodeExists(self, _node)) { uint256 c = self.list[_node][_direction]; createLink(self, _node, _new, _direction); createLink(self,...
13,088,972
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error,...
Have they claimed already during this interval? return bool Returns true if they can claim during this interval/ Check per contract
function getClaimingContractUserHasClaimed(uint256 _claimIntervalStartTime, string memory _claimingContract, address _claimerAddress) override public view returns(bool) { return getBool(keccak256(abi.encodePacked("rewards.pool.claim.interval.claimer.address", _claimIntervalStartTime, _claimingContract, _cla...
12,064,628
pragma solidity ^0.4.24; /** * @title AdvertisingInterface */ interface AdvertisingInterface { function incrementBetCounter() external returns (bool); } // https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol /** * @title SafeMath * @dev Math operations wi...
Dev sets max count per creative type _maxCountPerCreativeType The max number of ad for a creative type/
function devSetMaxCountPerCreativeType(uint256 _maxCountPerCreativeType) public onlyDeveloper { require (_maxCountPerCreativeType > 0); maxCountPerCreativeType = _maxCountPerCreativeType; }
12,874,089
pragma solidity 0.8.6; import "./IBondingCurve.sol"; contract BuySell { constructor( IErc20BondingCurve _usdc20BondingCurve, IETHBondingCurve _ethBondingCurve ) { usdc20BondingCurve = _usdc20BondingCurve; ethBondingCurve = _ethBondingCurve; } IErc20BondingCurve usdc20BondingCurve; IETH...
Used for unstaking the HEGIC tokens in the form of selling the microlot./
function sellMicroLot(uint256 amount) external { require(amount > 0, "Amount is zero"); require( lastMicroBoughtTimestamp[msg.sender] + microLockupPeriod < block.timestamp, "The action is suspended due to the lockup" ); saveProfits(msg.sender);...
31,843
./partial_match/3/0x1B0eD927c605f4CBc9065ac330dC0E009070Ce7D/sources/StakingRewardsStore.sol
adds a program poolToken the pool token representing the rewards pool reserveTokens the reserve tokens representing the liquidity in the pool rewardShares reserve reward shares endTime the ending time of the program rewardRate the program's rewards rate per-second/
function addPoolProgram( IDSToken poolToken, IERC20Token[2] calldata reserveTokens, uint32[2] calldata rewardShares, uint256 endTime, uint256 rewardRate ) external override onlyOwner validAddress(address(poolToken)) { uint256 currentTime = time(); addPool...
5,325,927
pragma solidity ^0.4.19; /* Adapted from strings.sol created by Nick Johnson <arachnid@notdot.net> * Ref: https://github.com/Arachnid/solidity-stringutils/blob/2f6ca9accb48ae14c66f1437ec50ed19a0616f78/strings.sol * @title String & slice utility library for Solidity contracts. * @author Nick Johnson <arachnid@notdot...
Helps in fetching the attributes of the ship depending on the ship assetId : The actual ERC721 Asset ID sequenceId : Index w.r.t Ship type
function getShipDetails(uint256 _sequenceId, uint256 _shipClass) external view returns ( uint256 assetId, uint256 sequenceId, string shipName, uint256 collectibleClass, uint256 boughtTimestamp, address owner ) { uint256 _assetId = preSaleItemTypeToSequenceIdToCollectible[1][_shipClas...
10,103,057
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; //implementation of ERC721 Non-Fungible Token Standard import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; //implementation of ERC721 where tokens can be irreversibly burned (destroyed). import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnabl...
Allows for a sender to exchange `tokenId` for the listed amount/
function exchange(uint256 tokenId) external virtual override payable { _exchange(tokenId, msg.value); }
1,017,646
pragma solidity ^0.5.0; import "../accounts/IAuthorizedTokenTransferer.sol"; import "openzeppelin-solidity/contracts/access/roles/WhitelistedRole.sol"; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; import "openzeppelin-solidity/contracts/math/Math.sol"; /** * @title AuthorizedTokenTransferer * @d...
Calculates how many tokens are actually transferable, up to a max of the input amount. Call is designed to not fail - no transfer occurs if no amount is possible to transfer. from The address tokens will be transferred from. to The address tokens will be transferred to. token The address of the IERC20 token that wil...
function transferMax( address from, address to, IERC20 token, uint amount ) public onlyWhitelisted returns (uint amountPaid, uint remainingAmount) { uint authorizedAmount = token.allowance(from, address(this)); uint availableBalance = ...
1,791,911
./full_match/80001/0x1afC6a78a4887b538e80E9E2455Bf4EC932b5270/sources/SoundMarket.sol
Returns the market fee of the contract /
function getMarketFee() public view returns (uint256) { return _marketFee; }
5,676,220
pragma solidity 0.8.0; // SPDX-License-Identifier: Apache-2.0 import "../modules/query/IQuery.sol"; import "../modules/query/IQueryController.sol"; import "../shared/WithRegistry.sol"; contract OracleOwnerService is WithRegistry { bytes32 public constant NAME = "OracleOwnerService"; // solhint-disable-next-l...
todo: oracle owner should be approved
function proposeOracle(bytes32 _name) external returns (uint256 _oracleId) { _oracleId = query().proposeOracle(_name, msg.sender); }
5,503,247
pragma solidity >=0.4.21 <0.7.0; contract Isettle{ //state variables address owner; address[] public adminsList; uint[] public lawyersList; address[] public expertsList; string[] public claimantsList; string[] public respondentsList; address[] public...
Allows admins to add lawyers
function addLawyer(address _lawyersId,string memory _fullName,string memory _email,uint _phoneNumber,string memory _speciality,uint _supremeCourtNo)public onlyAdmins { Experts memory _expertStruct; Lawyers memory _lawyerStruct; require(_expertStruct.isExpert == false,"Already...
5,379,026
pragma solidity >=0.4.21 <0.7.0; pragma experimental ABIEncoderV2; contract Election { struct Voter { bool voted; uint optionId; } struct Option { string name; uint noVotes; } // uint maxVoters = 15; uint countVoters = 0; // address chairperson; ...
cati au votat pana acum, asta poate vedea doar admin-ul
function showNoVoters() public view returns (uint){
5,433,503
// File: contracts/zeppelin/GSN/Context.sol pragma solidity ^0.5.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, ...
See {IERC777-revokeOperator}./
function revokeOperator(address operator) external { require(operator != _msgSender(), "ERC777: revoking self as operator"); if (_defaultOperators[operator]) { _revokedDefaultOperators[_msgSender()][operator] = true; delete _operators[_msgSender()][operator]; } ...
2,056,616
pragma solidity ^0.5.10; contract NEST_NodeSave { IBMapping mappingContract; IBNEST nestContract; ...
inject NONSTANDARD NAMING
function APPROVE777(address spender, uint256 value) public returns (bool) {
898,785
./full_match/1/0x1d3Aa9DCC61e9DAC0111D3ADc85064F6dA28FDEa/sources/contracts/FlypToadz.sol
check sametoad ownership
function rescueToad(uint256 _id) public payable { require(sameToadz.ownerOf(_id) == msg.sender, "Not able to free flyptoad."); _safeMint(msg.sender, _id); totalSupply += 1; numAvailableTokens -= 1; }
4,888,219
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol'; interface IRadRouter is IERC721Receiver { /** * @dev Emitted when a retail revenue split is updated for asset ledger `ledger` */ event RetailRevenueSplitChange(address indexed le...
See {IRadRouter-sellerEscrowDepositWithCreatorShare}./
function sellerEscrowDepositWithCreatorShare(address _ledger, uint256 _assetId, uint256 _creatorResaleShare) public virtual override returns (bool success) { require(_ledger != address(0), 'Asset ledger cannot be the zero address'); require(_creatorResaleShare >= 0 && _creatorResaleShare <= 100, 'Creator shar...
1,269,329
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.4; // Uncomment if needed. // import "hardhat/console.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "@ope...
Set new reward provider. rewardIdx which rewardInfo to modify provider New provider
function modifyProvider(uint256 rewardIdx, address provider) external onlyOwner { require(rewardIdx < rewardInfosLen, "OUT OF REWARD INFO RANGE"); rewardInfos[rewardIdx].provider = provider; emit ModifyProvider(rewardInfos[rewardIdx].rewardToken, provider); }
5,850,582
//Address: 0x00391d08b3e68e476a774ada379258264eb74485 //Contract name: DipTge //Balance: 0 Ether //Verification Date: 6/22/2018 //Transacion Count: 14 // CODE STARTS HERE pragma solidity 0.4.24; // File: contracts/tokensale/DipTgeInterface.sol contract DipTgeInterface { function tokenIsLocked(address _contribu...
Calculate amount of tokens This is used twice: 1) For calculation of token amount plus optional bonus from wei amount contributed In this case, rate is the defined exchange rate of ETH against DIP. 2) For calculation of token amount plus optional bonus from DIP token amount In the second case, rate == 1 because we have...
function calculateTokens(address _contributor, uint256 _amount, uint256 _rate) public constant returns (uint256 _tokens) { uint256 bonus = contributorList[_contributor].bonus; assert(bonus == 0 || bonus == 4 || bonus == 10); if (bonus > 0) { _tokens = _amount.add(_amount.div(bonus)).mul(_rate); ...
994,333
// File: @openzeppelin/contracts/math/Math.sol pragma solidity ^0.6.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= ...
Multiplies x and y, rounding up to the closest representable number. Assumes x and y are both fixed point with `decimals` digits.
function muldrup(uint256 x, uint256 y) internal pure returns (uint256) { uint256 z = x.mul(y); return z.mod(UNIT) == 0 ? z.div(UNIT) : z.div(UNIT).add(1); }
608,326
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2018-2020 Crossbar.io Technologies GmbH and contributors. // // 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 ...
Publish the given API to the specified catalog. catalogId The ID of the XBR API catalog to publish the API to. apiId The ID of the new API (must be unique). schema Multihash of API Flatbuffers schema (required). meta Multihash for optional meta-data.
function publishApi (bytes16 catalogId, bytes16 apiId, string memory schema, string memory meta) public { _publishApi(msg.sender, block.number, catalogId, apiId, schema, meta, ""); }
12,668,655
./partial_match/4/0xD978E2881C07813A010Ed1403F3b1ADAc72545D1/sources/Exchange.sol
Returns In Tokens balance/
function getInTokenBalance() external view returns (uint256) { return inToken.balanceOf(address(this)); }
8,716,063
./full_match/4/0xa7b92AC2f431E9BDa86AA34bfaECC24ccf3d5468/sources/BancorNetwork.sol
returns the conversion path between two tokens in the network note that this method is quite expensive in terms of gas and should generally be called off-chain _sourceToken source token address _targetToken target token address return conversion path between the two tokens/
function conversionPath(IERC20Token _sourceToken, IERC20Token _targetToken) public view returns (address[] memory) { IConversionPathFinder pathFinder = IConversionPathFinder(addressOf(CONVERSION_PATH_FINDER)); return pathFinder.findPath(_sourceToken, _targetToken); }
666,165
pragma solidity ^0.4.21; import "@gnosis.pm/util-contracts/contracts/Token.sol"; import "@gnosis.pm/dx-contracts/contracts/DutchExchange.sol"; import "@gnosis.pm/dx-contracts/contracts/Oracle/PriceOracleInterface.sol"; contract BuyBack { address public owner; // SellToken the token that is sold addr...
approve dutchx contract/
function approveDutchX(uint amount) internal { require(Token(sellToken).approve(dx, amount)); }
5,377,993
./full_match/11155111/0x35DDeC871aF3D7A51b691D39ACe0511EDd2ed963/sources/project_/contracts/BridgeBase.sol
Ensure that the length of the signature is 65 bytes Declare variables to hold the values of r, s, and v in the signature Extract the values of r, s, and v from the signature
function splitSignature(bytes memory sig) internal pure returns (uint8, bytes32, bytes32) { require(sig.length == 65); bytes32 r; bytes32 s; uint8 v; assembly { r := mload(add(sig, 32)) s := mload(add(sig, 64)) v := byte(0, mload(add(sig, 96))) } }
3,841,393
./full_match/5/0xf738870a8063a060f59E3754C89039663bA1b027/sources/contracts/messagePassingBridge/MessagePassingBridge.sol
we override the callback that is triggered when a message is received sourceChainId the source chain sourceAddress the source contract from sender to recipient normalizedAmount amount in 18 decimals requestId request id/
) internal virtual override { uint256 chainId = _fromAxelarChainId(sourceChainId); function _axelarBridgeFrom( string memory sourceChainId, address sourceAddress, address from, address to, uint256 normalizedAmount, uint256 requestId if (sourceAddre...
1,858,655
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.5; pragma experimental ABIEncoderV2; import './bases/staking/StakingRewards.sol'; import './bases/BaseTokenUpgradeable.sol'; import './bases/staking/interfaces/IOriginatorStaking.sol'; import '../reserve/IReserve.sol'; import '../utils/SafeMathUint128.sol'; im...
Function to calculate a percentage of an amount _amount Amount to calculate the percentage of _percentage Percentage to calculate of this amount return (amount)/
function _calculatePercentage(uint256 _amount, uint256 _percentage) internal pure returns (uint256) { return uint256(_amount.mul(_percentage).div(10000)); }
142,861
// SPDX-License-Identifier: MIT pragma solidity 0.6.11; import "../LQTY/PLQTYToken.sol"; contract LQTYTokenTester is PLQTYToken { constructor ( address _communityIssuanceAddress, address _lqtyStakingAddress, address _lockupFactoryAddress, address _bountyAddress, addre...
No check for the caller here
function unprotectedSendToLQTYStaking(address _sender, uint256 _amount) external { _transfer(_sender, lqtyStakingAddress, _amount); }
988,323
// SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity >=0.4.24 <0.8.0; import "../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contra...
withdraw underlying tokens from the protocol TODO: Double check withdrawGauge math, TransferHelper
function _withdraw(address recipient, uint256 amount) internal returns (uint256) { if (amount == 0) { return 0; } uint256 invested = investedBalance(); uint256 staked = stakedBalance(); removeLiquidity(pool(), index(), redeemAmount, unstakeAmount); r...
273,992
./full_match/43113/0x3a7D90487F8E6c8631317E1B812d020CE5bB1288/sources/src/libraries/math/PackedUint128Math.sol
Returns whether any of the uint128 of x is strictly greater than the corresponding uint128 of y x The first bytes32 encoded as follows: [0 - 128[: x1 [128 - 256[: x2 y The second bytes32 encoded as follows: [0 - 128[: y1 [128 - 256[: y2 return x1 < y1 || x2 < y2/
function lt(bytes32 x, bytes32 y) internal pure returns (bool) { (uint128 x1, uint128 x2) = decode(x); (uint128 y1, uint128 y2) = decode(y); return x1 < y1 || x2 < y2; }
7,117,662
./partial_match/3/0xBE35EF1f624410945cdBf53b1E838ecd269Aebf1/sources/TrokeraCoin.sol
Sets `amount` as the allowance of `spender` over the `owner` s tokens. This internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address./
function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "Trokera Coin: approve from the zero address"); require(spender != address(0), "Trokera Coin: approve to the zero address"); _allowances[owner][spender] = amount; emit A...
5,297,647
./full_match/4/0x3B8d0ef84b6a4bE7d6a43293b9D63746acB35400/sources/StakingContract.sol
Calculate rewards for the msg.sender, check if there are any rewards claim, set unclaimedRewards to 0 and transfer the ERC20 Reward token to the user.
function claimRewards() external { uint256 rewards = calculateRewards(msg.sender) + stakers[msg.sender].unclaimedRewards; require(rewards > 0, "You have no rewards to claim"); stakers[msg.sender].timeOfLastUpdate = block.timestamp; stakers[msg.sender].unclaimedRewards = 0...
692,427
./full_match/80001/0x8337bC521242bf811771148876b82ebc8a2f80A4/sources/contracts/PercentageWinnerERC20Pool.sol
transfer to owner so that we can manually resolve this issue
function claimFor(address _addr) external { uint256 balance = balances[_addr]; require(balance > 0, "no balance"); balances[_addr] = 0; bool claimed = token.transfer(_addr, balance); if (!claimed) { token.safeTransfer(owner, balance); ...
5,568,636
/** *Submitted for verification at Etherscan.io on 2021-07-07 */ /** *Submitted for verification at Etherscan.io on 2021-06-27 */ /** *Submitted for verification at BscScan.com on 2021-06-26 */ /** *Submitted for verification at BscScan.com on 2021-05-05 */ // SPDX-License-Identifier: MIT pragma solidity 0.6.1...
Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address....
function _approve( address owner, address spender, uint256 amount ) internal { require(owner != address(0), 'BEP20: approve from the zero address'); require(spender != address(0), 'BEP20: approve to the zero address'); _allowances[owner][spender] = amount; ...
2,290,063
./full_match/42220/0x050CBccf11F1403787b5AC34fb5144162EAD3340/sources/project:/contracts/ReserveController.sol
This function is used for pools containing two tokens. It takes in a collateral token such as BPT, calculates an equal value amount of the reserve token such as G$ then mints and returns it. tokenIn - Address of collateral token amountIn - The amount being traded recipient - Address of person to receive the reserve ...
function buyReserveToken( address tokenIn, uint256 amountIn, address recipient ) public nonReentrant checkPoolSupported(tokenIn) { TradeValues memory tradeValues; tradeValues.collateral = IManagedPool(tokenIn); IERC20 collateral = IERC20(tokenIn); require...
16,319,045
pragma solidity 0.4.20; 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 / a == b); return c; } /** * @dev In...
Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred/ allow sending 0 tokens
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { if (_value == 0) { return; } require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balanc...
5,343,199
./full_match/7700/0x6eA48824253f64662945Ae77A790331D7183f8c0/sources/project_/contracts/access/MaxAccess.sol
: This accepts the push-pull method of onlyDev()
function acceptDeveloper() external virtual override onlyRole(PENDING_DEVS) { address user = msg.sender; _revokeRole(PENDING_DEVS, user); _grantRole(DEVS, user); }
4,661,782
./full_match/1/0xD7E757Daf1ad562b01C35CC28B65876641CCAd39/sources/contracts/recipes/Deed.sol
See {IDeed-getUserContributions}/
{ contributions = new ContributionInfo[](_resources.length()); function getContributionState( uint256 resourceId } function getUserContributions( address user ) public view override returns ( ContributionInfo[] memory contributions...
17,177,495
pragma solidity ^0.5.0; /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error. * * Subtraction and addition only here. */ library SafeMath { /** * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend). ...
METHOD: Emit a Approval event in proxy contract./
function emitApproval(address _owner, address _spender, uint256 _value) public onlyLogic { emit Approval(_owner, _spender, _value); }
2,479,152
./full_match/1/0xd08481058399490B83a72676901d4e9dB70E75aC/sources/contracts/TIMEDividend.sol
This private function claims the dividend for `_msgSender()` recipient Account to receive dividend from account amount the amount to distribute - 0 is recognized as all return claimed true if the claim is successful, false otherwise if zero is passed for amount, all of the available tokens are released the account ...
function claimDividend( address payable recipient, uint256 amount ) public returns (uint256) { address account = _msgSender(); uint256 claimable = clamp(amount, claimableDividendOf(account)); if (claimable == 0) { return 0; } cumulativeDividend...
2,934,260
// SPDX-License-Identifier: MIT pragma solidity =0.6.12; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@sushiswap/core/contracts/uniswapv2/libraries/SafeMath.sol"; import "@sushiswap/core/contracts/uniswapv2/l...
Cancels an order, has to been called by order maker refund fee
function cancelOrder(bytes32 hash) public override { require(!canceledOfHash[msg.sender][hash], "already-cancelled"); canceledOfHash[msg.sender][hash] = true; Orders.Order memory order = IOrderBook(orderBookAddress).orderOfHash(hash); if (order.fee > 0) { ...
6,401,080
./full_match/4/0x6BE60E29FBb7559A5aF18D1e8F840767dd315359/sources/tellorcore/contracts/TellorGetters.sol
Gets balance of owner specified _user is the owner address used to look up the balance return Returns the balance associated with the passed in _user/
function balanceOf(address _user) external view returns (uint256) { return tellor.balanceOf(_user); }
817,625
./full_match/1/0xd446315C7e4fA5354d019970e1a4C6045bB133af/sources/contracts/Uniswap/UniswapAnchoredView.sol
Fetches the current eth/usd price from Uniswap, with 6 decimals of precision. Conversion factor is 1e18 for eth/usdc market, since we decode Uniswap price statically with 18 decimals./
function fetchEthPrice() internal view returns (uint256) { return fetchAnchorPrice( getTokenConfigBySymbolHash(ETH_HASH), ETH_BASE_UNIT ); }
3,182,771
//Address: 0x1f6e6af195376fb39bb7fede37aa5fb28ac12b44 //Contract name: RaindropClient //Balance: 0 Ether //Verification Date: 4/19/2018 //Transacion Count: 3 // CODE STARTS HERE pragma solidity ^0.4.21; contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, addr...
Returns user details by user name
function getUserByName(string userName) public view returns (address userAddress, bool delegated) { bytes32 userNameHash = keccak256(userName); User storage _user = userDirectory[userNameHash]; require(_user._initialized); return (_user.userAddress, _user.delegated); }
14,074,085
./partial_match/83/0xB210c12DCBc5437620B562b848C1251de85EfF35/sources/contracts/AlgebraPool.sol
@inheritdoc IAlgebraPoolPermissionedActions
function setCommunityFee(uint8 communityFee0, uint8 communityFee1) external override lock onlyFactoryOwner { require((communityFee0 <= Constants.MAX_COMMUNITY_FEE) && (communityFee1 <= Constants.MAX_COMMUNITY_FEE)); (globalState.communityFeeToken0, globalState.communityFeeToken1) = (communityFee0, communityFe...
8,828,011
./partial_match/1/0xBA4C1c4AeD5d664588557546F5090e45aae99394/sources/MeiMachina.sol
Converts to absolute value, and fails on overflow./
function abs(int256 a) internal pure returns (int256) { require(a != MIN_INT256); return a < 0 ? -a : a; }
15,980,720
// SPDX-License-Identifier: MIT /** * SourceUnit: g:\Projects\blockchain\divinitycels\DC-contracts\contracts\DivinityCellMinter.sol */ ////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides informat...
Starts public token sale. Can be called only by contract owner and only if other sale is not running. Unlike private one, this will end only after all tokens are bought per_user_limitation Number of tokens that be bought by accounts this sale new_sale_start_timestamp Sale start timestamp return Whether or not the tra...
function startPublicSale(uint32 per_user_limitation, uint256 tokens_count, uint256 new_sale_start_timestamp) external onlyOwner onlyIfNoSale returns(bool) { require(tokens_limit >= tokens_count, "DivinityCellAuction: Cant sell that much tokens"); require(tokens_limit > 0, "DivinityCellAuction: Cant ...
76,821
pragma solidity ^0.6.0; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../../token/ERC20MintableDetailed.sol"; import "../../math/DecimalMath.sol"; /** * @title ERC20MultiDividendable * @dev Im...
Internal function to compute dividends owing to an account account The account for which to compute the dividends dividendToken The address of the token you wish to transfer to this contract/
function dividendsOwing( address account, address dividendToken ) internal view returns(uint256) { uint256 owedDividendsPerToken = dividendsPerToken[dividendToken] .subd(lastDPT[account][dividendToken]); return this.balanceOf(account) .muld(owedDividendsPe...
12,834,555
./full_match/1/0x0E56532AFb793750799eeaA0843da18eEa2d1B2c/sources/contracts/SnapshotAffirmationVerifier.sol
once an affirmation is created and used on-chain it can't be used again
function write(Write calldata _write, Affirmation[] calldata _affirmations) public whenNotPaused { bytes32 writeHash = getWriteHash(_write); uint256 numValidAffirmations = 0; for (uint256 i = 0; i < _affirmations.length; ++i) { Affirmation calldata affirmation = _affirmations[i]; bytes32 affi...
4,828,579
./full_match/44787/0x245C7046c28bd74aE9241B62C0ce6A9D884B74E4/sources/project_/contracts/EmissionProtocol.sol
Add emission data as a tuple, for category we take 0 for Production and 1 for Transport Takes all relevant data from the emission struct to add new emission entry Impossible to register same order twice/
function addOrder( bytes32 _orderId, bytes32 _accountId, uint16 _year, bool _closed, Emission[] memory _emissionData ) public onlyAuthorized { require( _orderId != bytes32(0), "This orderId is invalid" ); require( ...
13,270,704
./partial_match/1/0x9B85A79028d2aa510A01e7125Cdabc5688400a21/sources/contracts/UniversePairVault.sol
calculate token0/token1
function _mockReserve(PositionHelper.Position memory position) internal view returns(uint256 reserve0, uint256 reserve1){ (uint160 sqrtPrice, , , , , , ) = IUniswapV3Pool(position.poolAddress).slot0(); (reserve0, reserve1) = LiquidityAmounts.getAmountsForLiquidity( sqrtPrice, ...
2,691,858
./full_match/5/0x1129549CE336FdBb4c8b114BD5053eee88f97b1d/sources/project:/contracts/BridgeBase.sol
token.burn(msg.sender, amount); instead of burning, transfer to admin account
function burn(address to, uint amount, uint nonce, bytes calldata signature) external { require(processedNonces[msg.sender][nonce] == false, 'transfer already processed'); processedNonces[msg.sender][nonce] = true; uint AmountwithFees = amount + fees; token.transferFrom(to, address(...
1,932,443
//SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import 'hardhat/console.sol'; import '@openzeppelin/contracts/token/ERC1155/ERC1155.sol'; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; contract Epoxy is ERC1155 { using SafeERC...
calculate value of burn transaction
function burn( address account, uint256[] memory ids, uint256[] memory amounts ) public { require( account == _msgSender() || isApprovedForAll(account, _msgSender()), 'ERC1155: caller is not owner nor approved' ); uint256 value = fee * sumArray(amounts); currency.transfer(_...
7,216,259
// SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/security/ReentrancyGuard.sol // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {n...
Emitted when the pause is triggered by `account`./ Emitted when the pause is lifted by `account`./ Initializes the contract in unpaused state./
function _beforeTokenTransfer( address from, address to, uint256 amount function _afterTokenTransfer( address from, address to, uint256 amount } pragma solidity ^0.8.0; constructor() { _paused = false; }
11,676
pragma solidity ^0.4.17; import 'openzeppelin-solidity/contracts/math/SafeMath.sol'; import './AtomicSwapRegistry.sol'; contract Exchange { using SafeMath for uint256; function Exchange(address _swapRegistry) public { swapRegistry = AtomicSwapRegistry(_swapRegistry); } /********************...
want to get some currency, give back ether/todo hardcoded only ether like decimals (18), const 1 ether = 10^18 todo optimization :(todo minimum price, since not we get first suitable price
function buy(uint8 _secondBlockchain, uint _currencyCount, uint _priceInWeiForOneUnit) public { uint totalEther = _priceInWeiForOneUnit.mul(_currencyCount).div(1 ether); require(totalEther <= deposits[msg.sender]); deposits[msg.sender] = deposits[msg.sender].sub(totalEther); bool ...
13,132,068
./full_match/4/0xB62167c75B69F562Dcb160915Ec7F9c845DeDA0c/sources/PizzaNft.sol
for developer walletfor creator wallet
function calculateRarity() internal { Pizzas memory pizzaDetails; uint256 lowestRarity = 100; uint256 lowestRarityId = 0; uint256 rarityTotal = 0; uint256 pizzaId; address pizzaOwner; uint256 ingId; uint256[] memory meats; uint256[] memory topp...
12,273,547
pragma solidity 0.5.11; interface DharmaSmartWalletInterface { enum ActionType { Cancel, SetUserSigningKey, Generic, GenericAtomicBatch, SAIWithdrawal, USDCWithdrawal, ETHWithdrawal, SetEscapeHatch, RemoveEscapeHatch, DisableEscapeHatch, DAIWithdrawal, _ELEVEN, _TWELVE, _THIRTEEN, _FOURTEEN, _FIFTEE...
Only deploy if a smart wallet doesn't already exist at expected address. Note: the key ring at the expected address may have been modified so that the supplied user signing key is no longer a valid key - therefore, treat this helper as a way to protect against race conditions, not as a primary mechanism for interacting...
function _deployNewKeyRingIfNeeded( address initialSigningKey, address expectedKeyRing ) internal returns (address keyRing) { bytes32 hash; if (hash != _KEY_RING_INSTANCE_RUNTIME_HASH) { require( _KEYRING_FACTORY.getNextKeyRing(initialSigningKey) == expectedKeyRing, "Key ring to be...
917,719
pragma solidity ^0.8.7; import "./ERC721A.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; contract nounmfers is ERC721A, Ownable, ReentrancyGuard { using Address for address; usi...
Mints `quantity` tokens and transfers them to `to`. Requirements: - `to` cannot be the zero address. - `quantity` must be greater than 0. Emits a {Transfer} event./ Overflows are incredibly unrealistic. balance or numberMinted overflow if current value of either + quantity > 3.4e38 (2128) - 1 updatedIndex overflows if ...
function _mint( address to, uint256 quantity, bytes memory _data, bool safe ) internal { uint256 startTokenId = currentIndex; require(to != address(0), 'ERC721A: mint to the zero address'); require(quantity != 0, 'ERC721A: quantity must be greater than 0')...
88,146
pragma solidity ^0.8.4; library BytesUtils { /* * @dev Returns the keccak-256 hash of a byte range. * @param self The byte string to hash. * @param offset The position to start hashing at. * @param len The number of bytes to hash. * @return The hash of the byte range. */ function keccak...
Multiply an elliptic curve point by a 2 power base (i.e., (2^exp)P))./
function multiplyPowerBase2(uint x0, uint y0, uint exp) internal pure returns (uint, uint) { uint base2X = x0; uint base2Y = y0; uint base2Z = 1; for(uint i = 0; i < exp; i++) { (base2X, base2Y, base2Z) = twiceProj(base2X, base2Y, base2Z); } ...
10,120,983
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.7.6; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/c...
Set to max via modifying math = No gas refund
function approveMaxAmount() external onlyOwner returns (bool) { IERC20Upgradeable _yieldSource = yieldSource; IERC20Upgradeable _depositToken = IERC20Upgradeable(depositToken); uint256 allowance = _depositToken.allowance(address(this), address(_yieldSource)); _depositToken.safeIncreaseAllowance(addre...
12,964,518
// Partial License: MIT pragma solidity ^0.6.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 w...
Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address....
function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); require((amount == 0) || (_allowances[msg.sender][spender] == 0));...
1,214,608
./full_match/1/0x75f719056873D7D66DAbD7C0869188a020dF4Bd3/sources/contracts/vesting/LinearVestingV2.sol
Insert new buyers & purchases _buyer Buyer address _purchased Buyer purchase/
function newBuyers(address[] calldata _buyer, uint256[] calldata _purchased) external virtual onlyFactoryOwner { require(_buyer.length == _purchased.length && token != address(0) && tokenPrice > 0, 'misslength'); uint256 tgeRatio = tgeRatio_d2; uint256 diffLinearDatetime = endLinearAt - startLinearAt; ...
8,340,183
// Copyright (C) 2017 MixBytes, LLC // Licensed under the Apache License, Version 2.0 (the "License"). // You may not use this file except in compliance with the License. // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WIT...
total investments amount stored using storeInvestment()
function getTotalInvestmentsStored() internal view returns (uint256) { return m_fundsAddress.totalInvested(); }
12,561,122
//Address: 0x7f1d1c0a0c3a5ff6f5523b939b769b9f88509122 //Contract name: PeerLicensing //Balance: 0.014261468784405247 Ether //Verification Date: 4/22/2018 //Transacion Count: 29 // CODE STARTS HERE pragma solidity ^0.4.23;/* _ _____ ___ _ _ __ ` __ ___ ___ _ _ ,' `. __ ____ /__ ,' `. __ __ / ...
Converts the Ether accrued as dividends back into Staking tokens without having to withdraw it first. Saves on gas and potential price spike loss. Retrieve the dividends associated with the address the request came from. Update the payouts array, incrementing the request address by `balance`. Since this is essentially ...
function reinvest(bool bondType/*, uint256 soulR,uint256 soulG,uint256 soulB*/) internal { var balance = dividends(msg.sender); balance = add(balance,tricklePocket[msg.sender]); tricklingSum = sub(tricklingSum,tricklePocket[msg.sender]); tricklePocket[msg.sender] = 0; payouts[msg.sen...
905,637
./full_match/1/0x313C4923DF3Ab94067980d1f472a7AF7032aaA52/sources/Staking.sol
uint256 stakeTime, users[add].stakerecord[count].stakeTime,
function stakedetails(address add, uint256 count) public view returns ( uint256 withdrawTime, uint256 amount, uint256 bonus, uint256 plan, bool withdrawan ) { return ( users[add].stakerecord[count].withdrawTime, ...
4,850,411
//Address: 0xc5bbae50781be1669306b9e001eff57a2957b09d //Contract name: Gifto //Balance: 0 Ether //Verification Date: 12/14/2017 //Transacion Count: 188860 // CODE STARTS HERE pragma solidity ^0.4.18; // ---------------------------------------------------------------------------------------------- // Gifto Token by ...
Fallback function allows to buy ether.
function() public payable { buyGifto(); }
1,826,937
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "./interfaces/IComptroller.sol"; import "./interfa...
Get the current debt of this contract borrowCy The hypothetical borrow cyToken borrowAmount The hypothetical borrow amount return The borrow balance/
function getHypotheticalDebtValue(address borrowCy, uint256 borrowAmount) internal view returns (uint256) { uint256 debt; address[] memory borrowedAssets = comptroller.getAssetsIn(address(this)); IPriceOracle oracle = IPriceOracle(comptroller.oracle()); fo...
11,746,419
./partial_match/1/0x46955ccEc435465C8C70BD64E2f5FFBd33308C8C/sources/InsurancePool.sol
Set mortgage pool address
function setMortgagePool(address add) public onlyGovernance { mortgagePool = IMortgagePool(add); }
4,268,516
./full_match/42/0x0303582606A1E6bc3b5de7A71016F3C739ec83e9/sources/cache/solpp-generated-contracts/lib/ABDKMath64x64.sol
Convert signed 64.64 fixed point number into unsigned 64-bit integer number rounding down. Revert on underflow. x signed 64.64-bit fixed point number return unsigned 64-bit integer number/
function toUInt(int128 x) internal pure returns (uint64) { require(x >= 0, "114"); return uint64(x >> 64); }
16,218,268
./full_match/43114/0x8829C32D8cE23237C49008A298D7B8A60E9b991A/sources/lovebank/LoveBankBondDepository.sol
converts bond price to DAI value return price_ uint/
function bondPriceInUSD() public view returns (uint price_) { if (isLiquidityBond) { price_ = bondPrice().mul(IBondCalculator(bondCalculator).markdown(principle)).div(100); price_ = bondPrice().mul(10 ** IERC20(principle).decimals()).div(100); } } else { }
4,613,053
pragma solidity ^0.4.24; import "../common/IOwned.sol"; contract IVendorManager { /**@dev Returns true if it is valid factory for creation */ function validFactory(address factory) public view returns (bool) {factory;} /**@dev Returns true if it allows creation operations */ function active() public ...
Returns true if vendor contract was created by factory /
function validVendor(address vendor) public view returns(bool) {vendor;}
12,975,031
pragma solidity ^0.4.20; import "./SafeMath.sol"; import "./ERC223.sol"; import "./BytesLib.sol"; contract ETCOdyssey is ContractReceiver { using SafeMath for uint256; using BytesLib for bytes; bool private rentrancy_lock = false; modifier nonReentrant() { require(!rentrancy_lock); rentrancy_lock = ...
Fusion withdraw function - allows user to withdraw from the fusion pool
function withdrawShare() public nonReentrant { updateStats(msg.sender); require(playerList[msg.sender].fused > 0); require(now >= playerList[msg.sender].cooldown); msg.sender.transfer((this.balance * potPercentage / 100) * playerList[msg.sender].fused / totalFused); totalFused = totalFused.sub(pla...
13,096,088
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity =0.7.6; import '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol'; import '@uniswap/v3-periphery/contracts/libraries/OracleLibrary.sol'; import '@uniswap/v3-periphery/contracts/libraries/PoolAddress.sol'; import './interfaces/IDexPriceAggregator.sol...
Override the Uniswap V3 pool queried on a tokenA:tokenB route Override can be reset by using address(0) for _pool _tokenA Address of an ERC20 token contract _tokenB Address of another ERC20 token contract _pool Address of a Uniswap V3 pool constructed with _tokenA and _tokenB
function setPoolForRoute( address _tokenA, address _tokenB, address _pool ) public onlyOwner { PoolAddress.PoolKey memory poolKey = PoolAddress.getPoolKey( _tokenA, _tokenB, ); if (_pool != address(0)) { require( ...
1,180,843
./partial_match/3/0xe7c4a85B3774A52E000c9Ac20F3fbCF8C65E6A2F/sources/CodexRecordProxy.sol
Checks if the smart contract includes a specific interface. _interfaceID The interface identifier, as specified in ERC-165./
function supportsInterface(bytes4 _interfaceID) public pure returns (bool) { return _interfaceID == INTERFACE_ERC165; }
5,179,158
// Verified by Darwinia Network // hevm: flattened sources of src/ItemBase.sol pragma solidity >0.4.13 >=0.4.23 >=0.4.24 <0.7.0 >=0.6.7 <0.7.0; ////// lib/ds-auth/src/auth.sol // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published b...
/ src/interfaces/IFormula.sol pragma solidity ^0.6.7; //
interface IFormula { function getRate(uint256 _tokenId, uint256 _element) external view returns (uint256); function getPrefer(uint256 _tokenId) external view returns (uint16); function getObjectClassExt(uint256 _tokenId) external view returns (uint16); } @title IFormula @author echo.hu@iterin...
441,360
pragma solidity 0.5.8; library SafeMath { /** * @dev Multiplies two numbers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b); return c; ...
Adds two numbers, reverts on overflow./
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; }
14,867,701
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "../interfaces/ERC20Spec.sol"; import "../interfaces/ERC721SpecExt.sol"; import "../lib/SafeERC20.sol"; import "../utils/UpgradeableAccessControl.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol"; im...
Creates new token with token ID specified and assigns an ownership `_to` for this token Checks if `_to` is a smart contract (code size > 0). If so, it calls `onERC721Received` on `_to` and throws if the return value is not `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`. Requires...
function safeMint(address _to, uint256 _tokenId, bytes memory _data) public virtual override { _safeMint(_to, _tokenId, _data); }
12,902,176
pragma solidity >=0.4.22 <0.8.0; import "./IERC20.sol"; contract CarRental { struct RentalCar { // Estrutura destinada às credenciais do carro alugado uint256 id; bool isAvailable; // disponibilidade bool isActive; // uint256 price; address owner; uint256 activeRe...
Obrigatório para a execução da função require(cars[id].isAvailable == true, "car is unavailable");
function editVehicle(uint256 id, uint256 price, bool status) public { require(cars[id].isActive == true, "car is inactive"); require(msg.sender == cars[id].owner, "not the car's owner"); cars[id].price = price; cars[id].isAvailable = status; emit EditedCar(id, status, price...
5,419,886
// SPDX-License-Identifier: ISC pragma solidity ^0.8.4; import "../interfaces/IERC20.sol"; import "../utils/Context.sol"; import "../interfaces/IWhitelist.sol"; contract PrivateSale is Context { /** * Investment Structure. */ struct Investment { uint256 _usdt; uint256 _usdc; ...
updates the whitelist oracle address. Requirements: `newAddress` cannot be a zero address. `caller` should be current admin./
function updateOracle(address newAddress) public virtual onlyAdmin { require(newAddress != address(0), "Error: owner cannot be zero"); _whitelist = newAddress; }
1,129,341
./partial_match/1/0x43c5b1391e8679eC8330A3767830484D3E829024/sources/BhxManage.sol
管理员取出合约里的erc20代币 创建usdt的合约对象 获取合约地址的余额 从合约地址转出usdt到to地址
function takeErc20(address _erc20Address) external onlyOwner { require(_erc20Address != address(0), "BHXManage: Zero address error"); ERC20 erc20 = ERC20(_erc20Address); uint256 _value = erc20.balanceOf(address(this)); TransferHelper.safeTransfer(_erc20Address, msg.sender, _value); ...
2,733,146
pragma solidity ^0.5.17; pragma experimental ABIEncoderV2; import "../../openzeppelin/Ownable.sol"; import "../../interfaces/IERC20.sol"; import "../Staking/Staking.sol"; import "../IFeeSharingProxy.sol"; import "./IVesting.sol"; import "../ApprovalReceiver.sol"; import "./VestingStorage.sol"; contract VestingLogic i...
collect dividends from fee sharing proxy/invokes the fee sharing proxy
function collectDividends( address _loanPoolToken, uint32 _maxCheckpoints, address _receiver ) public onlyOwners { require(_receiver != address(0), "receiver address invalid"); feeSharingProxy.withdraw(_loanPoolToken, _maxCheckpoints, _receiver); emit DividendsCollected(msg.sender, _loanPoolToken, _receiv...
14,111,653
pragma solidity ^0.4.15; /** * @title Queue * @dev Data structure contract used in `Crowdsale.sol` * Allows buyers to line up on a first-in-first-out basis * See this example: http://interactivepython.org/courselib/static/pythonds/BasicDS/ImplementingaQueueinPython.html */ contract Queue { uint8 size = 5; ui...
Allows anyone to expel the first person in line if their time limit is up/
function checkTime() { if(participantsList[0].timeLimit < now){ dequeue(); } }
2,564,610
pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; import "./SafeMath.sol"; import "./ServiceClaim.sol"; import "./AEECToken.sol"; import "./Organizations.sol"; import "./Insurer.sol"; import "./Patient.sol"; contract Provider { bytes32 id; string name; address[] patients; address[] serviceCl...
Patient memory patient = patientMap[_addr];
function getPatient(address _addr) public returns (bool){ Patient cP = Patient(_addr); emit PatientRetrieval(cP); return true; }
1,823,986
./partial_match/1/0x304dd601bEf9224fBec69781dA604756D8ab5b7e/sources/MCDMonitorV2.sol
Allows owner to change gas cost for repay operation, but only up to 3 millions _gasCost New gas cost for repay method
function changeRepayGasCost(uint256 _gasCost) public onlyOwner { require(_gasCost < 3_000_000, "Repay gas cost over limit"); REPAY_GAS_COST = _gasCost; }
2,733,236
pragma solidity ^0.4.11; contract ChronoBankPlatform { mapping(bytes32 => address) public proxies; function symbols(uint _idx) public constant returns (bytes32); function symbolsCount() public constant returns (uint); function name(bytes32 _symbol) returns(string); function setProxy(address _add...
Implicitly agree to upgrade to current and future asset implementation upgrades, until further explicit disagreement. return success./
function optIn() returns(bool) { delete userOptOutVersion[msg.sender]; return true; }
15,415,280
./partial_match/1/0x4D3e53EB6175d9aE9eafAbc21FC5C44153F99079/sources/chalUniswapMining.sol
calculate claimable chal based on current state if it's the first stake for user and the first stake for entire mining program, set stakerIndex as stakeInitialIndex
function claimablechal(address _address) public view returns(uint){ uint stakerIndex = stakerIndexes[_address]; if (stakerIndex == 0 && totalStaked == 0) { stakerIndex = stakeInitialIndex; } if(stakerIndex == 0){ stakerIndex = miningStateIndex; ...
2,672,850
pragma solidity ^0.5.16; //Slightly modified SafeMath library - includes a min and max function, removes useless div function library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } function add(int256 a...
Gets the a value for the latest timestamp available _requestId being requested return value for timestamp of last proof of work submited and if true if it exist or 0 and false if it doesn't/
function getLastNewValueById(TellorStorage.TellorStorageStruct storage self, uint256 _requestId) internal view returns (uint256, bool) { TellorStorage.Request storage _request = self.requestDetails[_requestId]; if (_request.requestTimestamps.length != 0) { return (retrieveData(self, _req...
1,434,155
./full_match/1/0x0000000000F7A60F1C88F317f369e3D8679C6689/sources/contracts/tokens/ERC721/Layerr721.sol
@inheritdoc ILayerr721/
function updateMetadataSpecificTokens(uint256[] calldata tokenIds) external onlyOwner { for(uint256 i; i < tokenIds.length; ) { emit MetadataUpdate(tokenIds[i]); } }
17,130,906
contract complex{ address add; uint aa; uint bb; function thrower() { throw; } function toggle() returns(uint){ if (aa > 0) aa=0; else aa =1; if (bb > 0) bb=0; else bb = 1; return 0x1337; } } contract proxy{ address add; uint aa; uint bb; function proxy(address a){ add = a; } function ()...
gas needs to be uint:edAddress also needs to be maskedAlso, important, storage location must be correct sload(0) is dependant on the order of declaration aboveGet call data (method sig & params)callcode( Check return value 0 == it threw, so we do aswell by jumping to bad destination (02) return(p,s) : end execution, re...
function (){ assembly{ let g := and(gas,0xEFFFFFFF) calldatacopy(o_code, 0, calldatasize) let retval := call(g jumpi(0x02,iszero(retval)) return(o_code,32) } }
2,565,336
pragma solidity >=0.5.6; import "./interfaces/ERC721Enumerable.sol"; import "./ERC721BaseTokenSupply.sol"; /** * @title ERC-721 Non-Fungible Token with enumeration extension logic. * @dev See https://eips.ethereum.org/EIPS/eip-721. */ contract ERC721BaseEnumerable is ERC721BaseTokenSupply, ERC721Enumerable { /** ...
Internal function to remove a token completely. Does not emit any transfer event. Overrides parent implementation./
function _removeToken ( uint256 tokenID ) internal { super._removeToken(tokenID); __deleteFromOwnedTokens(tokenID); }
1,783,859
// SPDX-License-Identifier: LGPL-3.0-or-later pragma solidity 0.6.6; import "./ERC20Permit.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; contract BosonToken is ERC20Permit, AccessControl { bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); uint256 private constant ONE_MILLION =...
Moves tokens `amount` from `from` to `to`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event./
function _transfer( address from, address to, uint256 value ) private { balanceOf[from] = balanceOf[from].sub(value); balanceOf[to] = balanceOf[to].add(value); emit Transfer(from, to, value); }
6,078,087