file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
//Address: 0xc2dc0c3054dB1740a9153B5D54911dB728672EAa //Contract name: ZminePrivateSale //Balance: 0 Ether //Verification Date: 4/2/2018 //Transacion Count: 192 // CODE STARTS HERE pragma solidity 0.4.21; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { ...
Override to extend the way in which ether is converted to tokens. _weiAmount Value in wei to be converted into tokens return Number of tokens that can be purchased with the specified _weiAmount/
function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) { return rate.getTokenAmount(_weiAmount); }
2,529,116
./full_match/1/0x537eE18Ca78C42E1e7fB87FECFE9FC811c3d3575/sources/contracts/lib/PercentMath.sol
Compute percentage of a value with the percentage represented by a fraction over PERC_DIVISOR _amount Amount to take the percentage of _fracNum Numerator of fraction representing the percentage with PCT_DIVISOR as the denominator/
function pctOf(uint256 _amount, uint16 _fracNum) internal pure returns (uint256) { return (_amount * _fracNum) / PCT_DIVISOR; }
16,543,986
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; import "contracts/protocol/tokens/MinterPauserClaimableERC20.sol"; import "contracts/interfaces/apwine/IFutureVault.sol"; /** * @title APWine interest bearing token * @notice Interest bearing token for the futures liquidity provided * @dev the value of ...
Destroys `amount` tokens from `account`, deducting from the caller's allowance. See {ERC20-_burn} and {ERC20-allowance}. Requirements: - the caller must have allowance for ``accounts``'s tokens of at least `amount`./
function burnFrom(address account, uint256 amount) public override { if (msg.sender != address(futureVault)) { super.burnFrom(account, amount); _burn(account, amount); } }
14,092,902
// SPDX-License-Identifier: MIT // 1st part of the transition applier due to contract size restrictions pragma solidity 0.8.6; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; /* Internal Imports */ import {DataTypes as dt} from "./libraries/DataTypes.sol"; import {Transitions as tn} from "./libraries...
Apply a SettlementTransition. _transition The disputed transition. _accountInfo The involved account from the previous transition. _strategyInfo The involved strategy from the previous transition. _globalInfo The involved global info from the previous transition. return new account, strategy info, and global info a...
function applySettlementTransition( dt.SettlementTransition memory _transition, dt.AccountInfo memory _accountInfo, dt.StrategyInfo memory _strategyInfo, dt.GlobalInfo memory _globalInfo ) external pure returns ( dt.AccountInfo memory, ...
12,995,997
pragma solidity ^0.4.4; import "./token/Token.sol"; contract KDOTicket is Token(0, "KDO Coin", 0, "KDO") { struct Ticket { uint256 balance; string tType; uint createdAt; uint expireAt; address contractor; bool hasReviewed; } struct Contractor { uin...
Returns the commission for the contractor
function commissionForContractor(address _address) public view returns (uint8 c) { return commissionForReviewAverageOf(reviewAverageOfContractor(_address)); }
14,111,601
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "./interfaces/IKernel.sol"; import "./Bridge.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; contract Governance is Bridge { using SafeMath for uint256; enum ProposalState { WarmUp, ...
check if user has another running vote
function propose( address[] memory targets, uint256[] memory values, string[] memory signatures, bytes[] memory calldatas, string memory description, string memory title ) public returns (uint256) { if (!isActive) { require(kernel.entrS...
14,458,939
pragma solidity 0.5.17; import "./MToken.sol"; import "./MomaPool.sol"; // unused currently import "./Governance/Moma.sol"; import "./MomaFactoryInterface.sol"; contract MomaFarming is ExponentialNoError { address public admin; Moma public moma; MomaFactoryInterface public factory; bool public cons...
Distribute MOMA accrued by a supplier To avoid revert: no over/underflow pool The pool in which the supplier is interacting mToken The market in which the supplier is interacting supplier The address of the supplier to distribute MOMA to/
function distributeSupplierMomaInternal(address pool, MToken mToken, address supplier) internal { MarketState storage state = marketStates[pool][address(mToken)]; if (state.supplyIndex > state.supplierIndex[supplier]) { (uint _supplierAccrued, uint _supplierDelta) = newSupplierMomaIntern...
12,691,508
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; /** * @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 contract can't have a constructor, it's common to move constructor logic to an * external initializer fun...
Returns the comission for the deposit for the chosen cluster. _cluster Address of the cluster _ethValue Eth equivalent to calculate fee from. return Equivalent of the fee in ETH.
function getDepositComission(address _cluster, uint256 _ethValue) external view override returns (uint256) { return (_ethValue * depositComission[_cluster]) / SHARES_DECIMALS; }
10,368,898
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...
Gets the amount of tokens for pre-ICO investor. _investorPreIco the pre-ICO investor address./
function getPreIcoInvestment(address _investorPreIco) constant public returns (uint256) { return investmentsPreIco[_investorPreIco]; }
6,567,640
./partial_match/42/0xb67e3087b617C68F81b6A85a086C3F6833a7334B/sources/astronaut7/acap-pw/42/0xb67e3087b617C68F81b6A85a086C3F6833a7334B/Agreement.sol
Build proxy for current caller (msg.sender address)/
function _buildProxy() internal { proxyAddress = ProxyRegistryLike(proxyRegistryAddr).build(); }
9,085,751
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.0; import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import { SafeERC20, IERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; impor...
Function called by whitelisted services to handle payments, e.g. PokeMe" _token Token to be used for payment by users _amount Amount to be deducted _user Address of user whose balance will be deducted
function useFunds( address _token, uint256 _amount, address _user ) external onlyWhitelistedServices { if (maxFee != 0) require(maxFee >= _amount, "TaskTreasury: useFunds: Overchared"); userTokenBalance[_user][_token] = userTokenBalance[_user][_token] - _amount; ...
2,486,612
// SPDX-License-Identifier: GL2PS License pragma solidity 0.7.4; pragma experimental ABIEncoderV2; /* * The above statement is mandatory * as it enables support for two levels * of dynamic arrays . */ /* * 1) TODO charge taxes on every transaction and keep * them on a public map. Also display them on a * s...
Fetch the ProductFetch the ownerMake sure the product has valid idRequire that there is enough Ether in the transactionRequire that the product has not been purchased alreadyRequire that the buyer is not the _sellerTransfer ownership to the buyerMark as purchasedProductCharge taxPay the seller by sending them Ethertrig...
function purchaseProduct(uint _id) public payable { ProductWithBids storage _product = internalProducts[_id]; address payable _seller = _product.owner; require(_product.id > 0 && _product.id <= productCount); require(msg.value >= _product.price, "Not enough Ether"); require(!...
5,518,443
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity >=0.8.0; import "../interfaces/IBentoBoxMinimal.sol"; import "../interfaces/IMasterDeployer.sol"; import "../interfaces/IPool.sol"; import "../interfaces/ITridentCallee.sol"; import "./TridentERC20.sol"; /// @notice Trident exchange pool template...
Swaps one token for another. The router must support swap callbacks and ensure there isn't too much slippage. Check Trident router has sent `amountIn` for skim into pool. This is safe from under/overflow - only logged amounts handled.
function flashSwap(bytes calldata data) public override lock returns (uint256 amountOut) { (address tokenIn, address tokenOut, address recipient, bool unwrapBento, uint256 amountIn, bytes memory context) = abi.decode( data, (address, address, address, bool, uint256, bytes) );...
901,601
./full_match/11155111/0x43319Bb60Fc536185DDf243d6beda9D4f2D4c68b/sources/contracts/CarRental.sol
Creating a function to add drivers (e.g. when registering an account) Checking if driver is already registered. Creating a new driver with input data of function caller.
function addDriver(string calldata firstname, string calldata lastname) public{ require(listOfDrivers[msg.sender].driverAddress == address(0x0), "Driver with this address has already been added"); require(bytes(firstname).length > 0, "Firstname or lastname cannot be empty"); Driver ...
3,799,937
pragma solidity ^0.4.11; /** * @title Owned contract with safe ownership pass. * * Note: all the non constant functions return false instead of throwing in case if state change * didn&#39;t happen yet. */ contract Owned { /** * Contract owner address */ address public contractOwner; /** ...
Assigns ERC20 token for exchange. Can be set only once, and only by contract owner. _asset ERC20 token address. return success./
function init(Asset _asset, DelayedPayments _delayedPayments) onlyContractOwner returns (uint errorCode) { if (address(asset) != 0x0 || address(delayedPayments) != 0x0) { return _error(ERROR_EXCHANGE_INVALID_INVOCATION); } asset = _asset; delayedPayments = _delayedPaymen...
7,657,834
/** *Submitted for verification at Etherscan.io on 2021-10-31 */ // SPDX-License-Identifier: MIT // Bitcoin NFT - Innovative Digital Asset // File: @openzeppelin/contracts/utils/introspection/IERC165.sol pragma solidity ^0.8.0; /** */ interface IERC165 { /** */ function supportsInterface(bytes4 inter...
/ To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and then delete the last slot (swap and pop). This also deletes the contents at the last position of the array
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; uint256 lastTokenId = _allTokens[lastTokenIndex]; delete _allTokensIndex[tokenId]; _al...
14,982,026
./partial_match/4/0xC2c08CeE7B15869B4AC336BE0925540b0ae75bc9/sources/MultiCollateralSynth.sol
Set the address of the TokenState contract. This can be used to "pause" transfer functionality, by pointing the tokenState at 0x000.. as balances would be unreachable./
function setTokenState(TokenState _tokenState) external optionalProxy_onlyOwner { tokenState = _tokenState; emitTokenStateUpdated(address(_tokenState)); }
8,589,712
//SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.4; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; /// @title Cr...
Inspired by OraclizeAPI's implementation - MIT license https:github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
function toString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } ...
15,613
pragma solidity 0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is ch...
Gets the balance of the specified address. _who The address to query the the balance of. return An uint256 representing the amount owned by the passed address./
function balanceOf(address _who) public view returns (uint256 balance) { return balances[_who]; }
12,231,581
./full_match/1/0x219440bB5e7aF80f41b51AA6BAbE0aB002875168/sources/browser/newtoken.sol
require(_numberOfTokens<30000e18,"you are exceeding your limit"); require(_numberOfTokens>0); uint256 p=tokenToEthereum(_numberOfTokens); require(_value==p,"you are not entering right price"); if(users[upline].totalTokenBought>=REFERRAL_LIMITS[i]){ }
function buyTokens(uint256 _numberOfTokens,address payable _refferer) public payable returns(bool success){ require(!lockBuying,"Buying is Locked by Admin"); if (refusers[msg.sender].referrer == address(0)) { if ((_refferer == msg.sender) && msg.sender != owner) { _refferer = owner; } ...
3,111,904
pragma solidity ^0.4.18; import './ApisTokenNoImport.sol'; contract MultiSigApis { event WithdrawalSubmission(uint indexed withdrawalId, address destination, uint256 aApis); event WithdrawalConfirmation(address indexed owner, uint indexed withdrawalId); event WithdrawalRevocation(address indexed own...
Allows an owner to submit and confirm a withdrawal/
function registerWithdrawal(address _destination, uint256 _aapis) public notNull(_destination) ownerExists(msg.sender) returns (uint withdrawalId) { withdrawalId = withdrawalCount; withdrawals[withdrawalId] = Withdrawal({ destination : _destinatio...
14,113,617
./partial_match/1/0xE3cc697219a23cdc24df5A3b7f35497B8f3f153A/sources/KATMTokenChanger.sol
Pause the token changer making the contract revert the transaction instead of converting/
function pause() public { paused = true; }
9,264,697
pragma solidity ^0.4.21; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns(uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); ...
In case the ownership needs to be transferred
function transferOwnership(address newOwner)public onlySuperAdmin { require(newOwner != 0x0); owner = newOwner; }
2,393,203
// SPDX-License-Identifier: GPL-3.0-only pragma solidity 0.8.6; import "./libraries/Margin.sol"; import "./libraries/ReplicationMath.sol"; import "./libraries/Reserve.sol"; import "./libraries/SafeCast.sol"; import "./libraries/Transfers.sol"; import "./libraries/Units.sol"; import "./interfaces/callback/IPrimitiveCr...
Primitive Liquidity Callback Primitive
interface IPrimitiveLiquidityCallback { function allocateCallback( uint256 delRisky, uint256 delStable, bytes calldata data ) external; } pragma solidity >=0.5.0; }
14,610,590
./full_match/80001/0x31674930dDb4e3A1d06BF93B10d09bEb67171028/sources/contracts/upgradeable/tokens/Vehicles/VehiclesV3.sol
Fix the logic of v2's mintExoSkeleton method: - set ogExoskeletonImageUrl if og solhint-disable-next-line ordering
function mintExoSkeleton( address _receiver, bool _og ) public virtual override onlyRole(MINTER_ROLE) whenNotPaused returns (uint256) { VehicleMetadataGenerator.MetadataProps memory _props = VehicleMetadataGenerator.MetadataProps( ); string memory _image = DEFAULT_EXO_SK...
9,521,689
./partial_match/1/0x54fda1fB380287a5e5F54903948AF23c580c79fd/sources/FLICE.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("Flide Lice", "FLICE") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_...
15,481,334
pragma solidity ^0.4.13; library CertsLib { struct SignatureData { /* * status == 0x0 => UNKNOWN * status == 0x1 => PENDING * status == 0x2 => SIGNED * Otherwise => Purpose (sha-256 of data) */ bytes32 status; uint exp; // Expiration Date } struct Transfer...
Transfers a certificate owner. The owner can be a peer or an entity (never both), so only one of newOwner or newEntity must be different than 0. If the specified certificateId belongs to an entity, the msg.sender must be a valid signer for the entity. Otherwise the msg.sender must be the current owner. self {object} -...
function requestCertificateTransferToEntity(Data storage self, EntityLib.Data storage ed, uint certificateId, uint newEntityId) entityExists(ed, newEntityId) canTransferCertificate(self, ed, certificateId) public { self.transferRequests[certificateId] = TransferData({ newOwner: 0, newEntityId: newEnti...
1,068,197
pragma solidity ^0.4.24; import "./register.sol"; import "./data/identity.sol"; import "./type/user_op.sol"; /// @title User operate /// @author ["Cryptape Technologies <contact@cryptape.com>"] contract UserOp is UserOpType { Register register; /// Constructor constructor() public { register = R...
Call proxy process function
function process(address _to, uint _decision) public { Identity id = getId(); id.process(_to, _decision, msg.sender); emit Processed(_to, _decision, msg.sender); }
1,002,404
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity ^0.8.6; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./ExitBase.sol"; import "../CirculatingSupply/CirculatingSupplyERC721.sol"; contract ExitERC721 is Ex...
Change the designated token address variable _token Address of new designated token Can only be modified by owner
function setCollection(address _collection) public onlyOwner { collection = ERC721Enumerable(_collection); }
14,611,284
./full_match/42/0xc1fe8dD660e10844dAC9407F08CcA9D7A687CfaD/sources/PromFans/PRBMathUD60x18.sol
Calculates the binary exponent of x using the binary fraction method. See https://ethereum.stackexchange.com/q/79903/24693. Requirements: - x must be 128e18 or less. - The result must fit within MAX_UD60x18. x The exponent as an unsigned 60.18-decimal fixed-point number. return result The result as an unsigned 60.18-...
function exp2(PRBMath.UD60x18 memory x) internal pure returns (PRBMath.UD60x18 memory result) { require(x.value < 128e18); unchecked { uint256 x128x128 = (x.value << 128) / SCALE; } }
9,579,091
./full_match/137/0x23b20FAa238C4b5ac4fd3E919ffE80409b349aA8/sources/CumLootNFT.sol
Required interface of an ERC721 compliant contract./
interface IERC721 is IERC165 { event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); event ApprovalForAll(address indexed owner, address indexed operator, bool approved); function...
4,768,575
/*! zam.sol | (c) 2018 Develop by BelovITLab LLC (smartcontract.ru), author @stupidlovejoy | License: MIT */ pragma solidity 0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function m...
no need to require value <= totalSupply, since that would imply the sender's balance is greater than the totalSupply, which should be an assertion failure
function _burn(address _who, uint256 _value) internal { require(_value <= balances[_who]); balances[_who] = balances[_who].sub(_value); totalSupply_ = totalSupply_.sub(_value); emit Burn(_who, _value); emit Transfer(_who, address(0), _value); }
1,156,027
pragma solidity ^0.4.0; // This allows stakeholders to approve an IPFS hash, and can return the // weighted sum of ether that approved it. Used for rank & anti-phishing. contract HashRank { // Who approved this hash mapping (uint256 => address[]) approved; // Entries bytes[] entryHashes; bytes[] entryNam...
Returns the hash of an entry
function entryDesc(uint256 index) public constant returns (bytes) { return entryDescs[index]; }
14,052,503
./full_match/1/0x06B3fcc9E79d724a08012f0B9F71bd03B415d334/sources/contracts/NeverFearTruth.sol
Assigns a new minter to the contract. Only the owner can call this function. It is intended to use the NFTSale contract as the minter role. Allows to set the minter role to the zero address as a mechanism to pause the minting and/or disable the current minter address. newMinter The address of the new minter./
function setMinter(address newMinter) external onlyOwner { minter = newMinter; emit MinterRoleGranted(newMinter); }
17,089,331
./partial_match/80001/0xd228399010C9F9f04eDE070FE154B607844F541a/sources/project_/contracts/MentaportStamps.sol
Internal mint nft with unique tokenURI/
function _mintNFT(address _receiver, string memory _tokenURI) internal { uint256 newItemId = _supply.current(); _safeMint(_receiver, newItemId); _setTokenURI(newItemId, _tokenURI); _supply.increment(); }
8,802,703
./full_match/1/0x38449a6b7bb76638452273925c9a2BA818bD130d/sources/lib/pt-v5-chainlink-vrf-v2-direct/lib/chainlink/contracts/src/v0.8/vrf/VRFV2Wrapper.sol
solhint-disable-next-line not-rely-on-time
function getFeedData() private view returns (int256) { bool staleFallback = s_stalenessSeconds > 0; uint256 timestamp; int256 weiPerUnitLink; (, weiPerUnitLink, , timestamp, ) = LINK_ETH_FEED.latestRoundData(); if (staleFallback && s_stalenessSeconds < block.timestamp - timestamp) { weiPerUn...
8,300,026
./full_match/1/0xf7E49a9D1dfeD8E533e3C6d2A5977e6d240e07f5/sources/contracts/QuestFactory.sol
Create an erc20 quest and start it at the same time. The function will transfer the reward amount to the quest contract rewardTokenAddress_ The contract address of the reward token endTime_ The end time of the quest startTime_ The start time of the quest totalParticipants_ The total amount of participants (accounts...
function createQuestAndQueue( address rewardTokenAddress_, uint256 endTime_, uint256 startTime_, uint256 totalParticipants_, uint256 rewardAmount_, string memory questId_, string memory actionSpec_, uint256 discountTokenId_ ) external checkQuest(qu...
4,968,730
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.6; import {Address} from '@openzeppelin/contracts/utils/Address.sol'; import {OwnableUpgradeable} from '@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol'; import {AddressUpgradeable} from '@openzeppelin/contracts-upgradeable/utils/AddressUpgr...
PRIVILEGED GOVERNANCE FUNCTION. Allows governance to remove a Garden _garden Address of the Garden contract to remove/
function removeGarden(address _garden) external override onlyOwner { require(isGarden[_garden], 'Garden does not exist'); require(IGarden(_garden).getStrategies().length == 0, 'Garden has active strategies!'); gardens = gardens.remove(_garden); delete isGarden[_garden]; emit...
421,258
/** *Submitted for verification at Etherscan.io on 2020-07-09 */ /** *Submitted for verification at Etherscan.io on 2020-07-09 */ pragma solidity 0.5.7; /* Copyright (C) 2017 NexusMutual.io This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public Lic...
reduce lock duration for a specified reason and time _of The address whose tokens are locked _reason The reason to lock tokens _time Lock reduction time in seconds/
function reduceLock(address _of, bytes32 _reason, uint256 _time) public onlyInternal { _reduceLock(_of, _reason, _time); }
5,376,672
// File: @openzeppelin\upgrades\contracts\Initializable.sol pragma solidity >=0.4.24 <0.7.0; /** * @title Initializable * * @dev Helper contract to support initializer functions. To use it, replace * the constructor with a function that has the `initializer` modifier. * WARNING: Unlike constructors, initializer...
_staker address the staker who has received the rewards return uint256 the total amount of KittieFightToken that have been claimed by this _staker return uint256 the total amount of SuperDaoToken that have been claimed by this _staker/
function getTotalRewardsClaimedByStaker(address _staker) external view returns (uint256[2] memory) { return rewardsClaimed[_staker]; }
616,933
./full_match/1/0xb05F478d93C7063194f37535aD148242B8d1F1B8/sources/contracts/priceProviders/chainlinkV3/ChainlinkV3PriceProvider.sol
Sets the fallback provider for an asset. Can only be called by the manager. _asset Asset for which to set the fallback provider _fallbackProvider Provider to set
function setFallbackPriceProvider(address _asset, IPriceProvider _fallbackProvider) external virtual onlyManager onlyAssetSupported(_asset) { if (!_setFallbackPriceProvider(_asset, _fallbackProvider)) { revert FallbackProviderDidNotChange(); } }
3,047,818
./full_match/5/0x2fe0680016F5A53f1a1E139086BF3A4393b9DAFE/sources/KlerosDemoCourt/KlerosDemoCourt.sol
Changes the `pinakion` storage variable. _pinakion The new value for the `pinakion` storage variable./
function changePinakion(Pinakion _pinakion) external onlyByGovernor { pinakion = _pinakion; }
7,071,960
/* ----------------------------------------------------------------- FILE INFORMATION ----------------------------------------------------------------- file: Synthetix.sol version: 2.0 author: Kevin Brown Gavin Conway date: 2018-09-14 ----------------------------------------------------...
Total amount of synths issued by the system, priced in currencyKey currencyKey The currency to value the synths in/ What's the total issued value of that synth in the destination currency? Note: We're not using our effectiveValue function because we don't want to go get the rate for the destination currency and ...
function totalIssuedSynths(bytes32 currencyKey) public view rateNotStale(currencyKey) returns (uint) { uint total = 0; uint currencyRate = exchangeRates.rateForCurrency(currencyKey); require(!exchangeRates.anyRateIsStale(availableCurrencyKeys()), "Rates a...
5,451,656
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URISto...
Initializer for the ERC721 contract/
function initialize() public initializer { __ERC721_init("FarbeArt", "FBA"); _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); _setupRole(MINTER_ROLE, msg.sender); }
60,698
pragma solidity ^0.8.0; import '../interface/IERC20.sol'; //import '../TransferHelper.sol'; contract valut { address public owner; string public name; string public intro; string public logo; uint public time ; uint public index; uint public index1; uint public index2; ...
require(msg.sender==owner);require(msg.sender !=to);
function approves(address to,uint rate)public{ index2=index2+1; manageinfo memory info=manageinfo({ owner:to, proportion:rate, pause:true, termination:true }); list3.push(info); }
6,399,922
./full_match/1/0xe3a0701b5c8E7c256BEB5f9173620dAD00F46E2C/sources/inari.sol
Interface for ETH wrapper contract (v9).
interface IWETH { function deposit() external payable; function withdraw(uint wad) external; }
8,292,660
pragma solidity ^0.4.18; contract PromiseBox { // this struct represents each Word struct Word { string text; // uint timestamp; uint bet; address owner; bool resolved; bool verdict; } // this mapping stores names wrt addresses mapping (address => st...
Save your word to the blockchain
function addWord(string text) public payable { require(msg.value >= min_bet, "Bet should be more than 0.001 eth"); require(utfStringLength(text) > 0, "Text cannot be empty"); words[getID()] = Word({ text: text, bet: msg.value, owner: msg.sender, ...
12,561,691
// Board.sol // SPDX-License-Identifier: MIT pragma solidity 0.8.10; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol"; /// @dev for tests only contract BoardGameStrategistTest { /// @dev structure used to store pawn's attribute struct PawnInfo { ...
check if a land can be bought (PROP tokens available) edition board edition land cell number return true or false/
function isPurchasable(uint16 edition, uint8 land) external view returns (bool) { return boards[edition].isPurchasable[land]; }
5,526,140
pragma solidity >=0.5.0 <0.6.0; contract Proxiable { // Code position in storage is keccak256("PROXIABLE") = "0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7" event Upgraded(address indexed implementation); function updateCodeAddress(address newAddress) internal { require( ...
Mark transaction as paid _escrowId Escrow to mark as paid/
function pay(uint _escrowId) external { address sender = getSender(); escrow.pay_relayed(sender, _escrowId); }
2,496,006
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism h...
deposit sender's token update initial balance get source token get target token from token wallet
function deposit( address sourceToken, address beneficiary, uint256 sourceTokenAmount ) public onlyValidAddress(beneficiary) { require(isRegistered(sourceToken), "unregistered-source-token"); require(sourceTokenAmount > 0, "invalid-amount"); require(msg.sender ==...
6,900,978
pragma solidity ^0.5.16; library SafeMath { 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; } function div(uint256 a, uint256 b) internal pure returns (uint256) { ...
propose a new proxy to be added
function proposeProxy(address _proxy) external onlyOwner { pendingProxy = _proxy; mature = now.add(7 days); emit ProposeProxy(_proxy, mature); }
1,771,527
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./interfaces/IMarketplaceNFT.sol"; import "./WispToken.sol"; import "./TreasureNFT.sol"; struct Sale { uint256 tokenId; uint256 price; } library IterableMapping { // Iterable mapping from address to uint; struct Map { address[] keys; m...
@inheritdoc IMarketplaceNFT
function saleOfOwnerByIndex(address owner, uint256 index) external view override onlyExistingSales(owner) onlyValidIndex(owner, index) returns (uint256 tokenId, uint256 price) { tokenId = sales.get(owner)[index].tokenId; price = sales.get(owner)[index].price; }
6,393,315
./partial_match/1/0xE9e77b4C7640cDcaEDf57b9307F362dFE42705cc/sources/BWIN.sol
Function to get the locked balances of all active players
function getLockedBalances() public view returns (address[] memory, uint256[] memory) { uint256[] memory balances = new uint256[](activePlayers.length); for (uint i = 0; i < activePlayers.length; i++) { balances[i] = _lockedBalance[activePlayers[i]]; } return (activePlaye...
4,362,245
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.4.22 <0.6.0; interface ENS { event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner); event Transfer(bytes32 indexed node, address owner); event NewResolver(bytes32 indexed node, address resolver); event NewTTL(bytes32 indexed node, uin...
solium-disable-next-line security/no-inline-assembly
function createProxyGroupWallet(bytes32 _domainHash, address masterCopy, bytes memory data) public payable returns (ProxyGroupWallet proxy) { uint256 c = commitments[_domainHash]; require(address(uint160(c & k_aMask))==msg.sender, "- only by initiator."); require(masterCopy != k_add00, ...
571,778
/* Copyright 2020 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
Casts a bytes32 value into bytes memory string Pesimestic update to free memory pointer
function bytes_to_big_num(bytes32 data) internal pure returns(bytes memory ptr) { assembly { ptr := mload(0x40) mstore(ptr, 0x20) mstore(add(ptr, 0x20), data) mstore(0x40, add(mload(0x40), 0x40)) } }
12,980,124
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; // Creator: Chiru Labs // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-16...
check if an address has any Dougs that are claim eligible check if the token is claimable for a free Doug if it is claimable return true if not, keep going to see if any are claimable. leave the loop if any tokens are claimable
function checkForFreeDougs(address _address) public view returns (bool) { HotDougs _hotDougs = HotDougs(dougContractAddress); uint256 tokenBalance = _hotDougs.balanceOf(_address); bool claimableDougs; if (tokenBalance < 1) { claimableDougs = false; uint256[]...
1,132,790
/** * Because the use of ABIEncoderV2 , the pragma should be locked above 0.5.10 , * as there is a known bug in array storage: * https://blog.ethereum.org/2019/06/25/solidity-storage-array-bugs/ */ pragma solidity >=0.5.10 <0.6.0; import {Ownable} from "./Ownable.sol"; import {SafeMath} from "./installed-contracts...
Get interest payable of the account/ no interest accumulated yet or even negative interest rate!?
function getInterestPayableOf(aAccount storage account) internal view returns (uint256) { uint256 rGross = account.sInternalAmount .mul(ias.exchangeRateStored()) if (rGross > (account.lDebt + account.rInterest)) { return rGross - account.lDebt - account.rInterest; ...
6,352,130
./full_match/1/0xaa282C8aB681fbD501A2B8fA0Ea558cbF5785F73/sources/contracts/AvocadoMultisig/AvocadoMultisigVariables.sol
reads signers from storage with SSTORE2 signers not set yet -> only owner is signer currently.
function _getSigners() internal view returns (address[] memory signers_) { address pointer_ = _signersPointer; if (pointer_ == address(0)) { signers_ = new address[](1); signers_[0] = IAvocado(address(this))._owner(); return signers_; } return abi...
3,129,108
// SPDX-License-Identifier: MIT /* solhint-disable var-name-mixedcase */ pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "./interfaces/ILight.sol"; /** * @t...
Checks Order Expiry, Nonce, Signature nonce uint256 Unique and should be sequential expiry uint256 Expiry in seconds since 1 January 1970 signerWallet address Wallet of the signer signerToken address ERC20 token transferred from the signer signerAmount uint256 Amount transferred from the signer senderToken addres...
function _checkValidOrder( uint256 nonce, uint256 expiry, address signerWallet, address signerToken, uint256 signerAmount, address senderToken, uint256 senderAmount, uint8 v, bytes32 r, bytes32 s ) internal { require(DOMAIN_CHAIN_ID == getChainId(), "CHAIN_ID_CHANGED"); ...
996,830
/** *Submitted for verification at Etherscan.io on 2021-11-08 */ // Sources flattened with hardhat v2.6.7 https://hardhat.org // File contracts/helpers/ReentrancyGuard.sol pragma solidity ^0.8.0; /** * @title Helps contracts guard against reentrancy attacks. * @author Remco Bloemen <[email protected]π.com>, Eena...
change the state of first session once first auction is complete _state bool representative of whether or not we're currently in the first session
function setFirst(bool _state) external { require(msg.sender == admin); firstSession = _state; }
10,792,604
// SPDX-License-Identifier: GPL-3.0-or-later Or MIT /** *Submitted for verification at BscScan.com on 2021-05-28 */ pragma solidity ^0.6.0; library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, 'SafeMath: addition overflow'); ...
function to return the amount of unsold tokens return totalTokensToSell.sub(totalSold);
function unsoldTokens() public view returns (uint256) { return SATOSHI.balanceOf(address(this)); }
6,429,570
pragma solidity ^0.5.11; import '../node_modules/@openzeppelin/contracts/payment/escrow/Escrow.sol'; import './PPCToken.sol'; contract TaskList { uint public task_count = 0; enum State { created, accepted, completed, reviewed } uint8[] ratings = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; // enum Difficulty { standard, a...
tasks[_id] = _task;
function toggleStarted(uint8 _id) public { Task storage _task = tasks[_id]; _task.state = State.accepted; emit TaskState(_id, _task.state); }
14,125,446
./full_match/5/0x6657d1F065b01187A55F2A70Bf04fD5c92a51F60/sources/src/zkbob/ZkBobPool.sol
Cancels expired forced exit that was not executed on time. Required for forced exit re-submission. _nullifier transfer nullifier to be used for withdrawal. _operator operator address set during commitForcedExit. _to withdrawn funds receiver. _amount total account balance to withdraw. _exitStart exit window start t...
function cancelForcedExit( uint256 _nullifier, address _operator, address _to, uint256 _amount, uint256 _exitStart, uint256 _exitEnd ) external { require(nullifiers[_nullifier] == 0, "ZkBobPool: doublespend detected"); require( ...
7,060,835
pragma solidity ^0.4.17; import 'zeppelin-solidity/contracts/math/SafeMath.sol'; import 'zeppelin-solidity/contracts/ownership/Ownable.sol'; import 'zeppelin-solidity/contracts/lifecycle/Pausable.sol'; /** * @title CGToken * @dev ERC20 token for CampGenie. * This contract is one of the following: * - Ownable: t...
Destroy tokens from other account Remove `_value` tokens from the system irreversibly on behalf of `_from`. _from the address of the sender _value the amount of money to burn/
function burnFrom(address _from, uint256 _value) whenNotPaused public returns (bool success) { require(_value > 0); require(balanceOf[_from] >= _value); require(_value <= allowance[_from][msg.sender]); balanceOf[_from] = balanceOf[_from].sub(_value); allowance[_from][msg.send...
2,504,736
./full_match/1/0x6c9829e5aF58E993daC721e3c2de6A1d32e3b37C/sources/contracts/ERC721/interfaces/IERC721KODACreator.sol
KnownOrigin Labs - https://knownorigin.io/
interface IERC721KODACreator { error AlreadySet(); error EditionDisabled(); error EditionSizeTooLarge(); error EditionSizeTooSmall(); error EmptyString(); error InvalidOwner(); error IsOpenEdition(); error OwnerRevoked(); error PrimarySaleMade(); error ZeroAddress(); event E...
9,815,370
./partial_match/1/0x37a1b0f137dC121D9f4Ef88077643504A6c86716/sources/GorvernorAlpha.sol
Admin function for setting the voting period newVotingPeriod new voting period, in blocks/
function _setVotingPeriod(uint newVotingPeriod) external { require(msg.sender == admin, "AUSCMGovernor::_setVotingPeriod: admin only"); require(newVotingPeriod >= MIN_VOTING_PERIOD && newVotingPeriod <= MAX_VOTING_PERIOD, "AUSCMGovernor::_setVotingPeriod: invalid voting period"); uint oldVot...
16,190,242
/** *Submitted for verification at Etherscan.io on 2021-08-05 */ // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // Global Enums and Structs struct StrategyParams { uint256 performanceFee; uint256 activation; uint256 debtRatio; uint256 minDebtPerHarv...
net off profit and lossprofit + _debtOutstanding must be <= wantbalance. Prioritise profit first
function prepareReturn(uint256 _debtOutstanding) internal override returns ( uint256 _profit, uint256 _loss, uint256 _debtPayment ) { uint256 wantBal = wantBalance(); uint256 stethBal = stethBalance(); uint256 totalAsset...
7,789,643
./partial_match/1/0x0000000006bC8D9e5e9d436217B88De704a9F307/sources/src/Curta.sol
@inheritdoc ICurta Revert if the Authorship Token doesn't belong to sender. Revert if the puzzle has already been used. Mark token as used. Add puzzle.
function addPuzzle(IPuzzle _puzzle, uint256 _tokenId) external { if (msg.sender != authorshipToken.ownerOf(_tokenId)) revert Unauthorized(); if (hasUsedAuthorshipToken[_tokenId]) revert AuthorshipTokenAlreadyUsed(_tokenId); hasUsedAuthorshipToken[_tokenId] = true; unchecked { ...
4,251,691
pragma solidity 0.6.6; interface UniswapPairContract { function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); } interface xETHTokenInterface { //Public functions function maxScalingFactor() external view returns (uint256); ...
Public functionsrebase permissioned
interface xETHTokenInterface { function maxScalingFactor() external view returns (uint256); function xETHScalingFactor() external view returns (uint256); function setTxFee(uint16 fee) external ; function setSellFee(uint16 fee) external ; function rebase(uint256 epoch, uint256 indexDelta, bool po...
2,338,977
./partial_match/41/0xf3e28C44dFb78CA02957eB7f87c3e01c0c62f0b1/sources/contracts/OldtimersRentBuy.sol
Only user who rent a vehicle can give a review score
function giveReviewScore(uint256 _vehicleID, uint256 score) public { require(existsUser(_vehicleID, msg.sender) == true, "Only users who rent a vehicle can give a score"); require(score <= 10, "Users can give a score between 0 and 10"); require(userVoted(_vehicleID, msg.sender) == false, "Us...
3,504,039
./full_match/43114/0xFB288999e57DA77de3832D425816F87856DC40B9/sources/_ohfinance/oh-contracts/contracts/manager/OhManager.sol
Sets the protocol buyback percentage (Profit Share) _buybackFee The new buyback fee Only Governance; base 1000, 1% = 10
function setBuybackFee(uint256 _buybackFee) external onlyGovernance { require(_buybackFee > MIN_BUYBACK_FEE, "Registry: Invalid Buyback"); require(_buybackFee < MAX_BUYBACK_FEE, "Registry: Buyback Too High"); buybackFee = _buybackFee; }
4,594,949
pragma solidity ^0.5.10; import "../node_modules/openzeppelin-solidity/contracts/token/ERC721/IERC721.sol"; import "../node_modules/openzeppelin-solidity/contracts/token/ERC721/IERC721Receiver.sol"; import "../node_modules/openzeppelin-solidity/contracts/introspection/ERC165.sol"; import "../node_modules/openzeppelin-...
Private function to clear current approval of a given token ID Reverts if the given address is not indeed the owner of the token/
function _clearApproval(address owner, uint256 profileId) private { require(profileToOwner[profileId] == owner); require(_exists(profileId)); if (profileApprovals[profileId] != address(0)) { profileApprovals[profileId] = address(0); } }
1,823,380
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.4.22 <0.9.0; import "remix_tests.sol"; // this import is automatically injected by Remix. import "remix_accounts.sol"; import "../contracts/MPLiquidityManager.sol"; contract testMPLiquidityManager is MPLiquidityManager { constructor() public MPLiquidityManag...
'beforeAll' runs before all other tests More special functions are: 'beforeEach', 'beforeAll', 'afterEach' & 'afterAll' Here should instantiate tested contract
function beforeAll() public { Assert.equal(uint256(1), uint256(1), "1 should be equal to 1"); }
13,072,937
./partial_match/97/0xE1477bb1c9a304A936451F1fCACB1e1b7EEBfb29/sources/USDPriceFeed.sol
returns the trivial USDT/USDT rate return always returns the trivial rate of 1/
function latestAnswer() external view returns (uint256) { return USDT_RATE; }
11,485,630
./full_match/5/0x3999032F30A9be2Fd2732B4cFe3e61ADe9531509/sources/project:/contracts/CengliP2PEscrow.sol
Accepts a new order or updates an existing one Only callable by the contract owner return uint256 The newly generated Order ID
function acceptOrder( address buyer, address partner, address token, uint256 amount ) external onlyOwner returns (uint256) { uint256 newOrderId = orderIdCounter++; IERC20 erc20Token = IERC20(token); require( erc20Token.transferFrom(partner, ad...
1,875,238
//SPDX-License-Identifier: MIT License pragma solidity ^0.8.0; import "hardhat/console.sol"; import "./DaoProposalAuditor.sol"; contract Dao is DaoProposalAuditor { /** Error Codes */ string public constant INCORRECT_FEE_AMOUNT = "50001"; string public constant NO_TOKEN_TO_RECLAIM = "50002"; string public co...
Mint DAO Token/
function joinDAO() external payable { require(msg.value == membershipFee, INCORRECT_FEE_AMOUNT); uint256 id = totalSupply() + 1; _beforeTokenTransfer(address(0), msg.sender, id); _mint(msg.sender, id); }
13,027,088
/********************************** /* Author: Nick Mudge, <nick@perfectabstractions.com>, https://medium.com/@mudgen. /**********************************/ pragma solidity ^0.4.24; import "./ERC721.sol"; import "./ERC721Receiver.sol"; import "./SafeMath.sol"; interface ERC998ERC721BottomUp { event TransferToPare...
clear approval remove and transfer token
function transferAsChild(address _fromContract, uint256 _fromTokenId, address _toContract, uint256 _toTokenId, uint256 _tokenId, bytes _data) external { address tokenOwner = tokenIdToTokenOwner[_tokenId].tokenOwner; require(tokenOwner == _fromContract); require(_toContract != address(0)); ...
7,239,763
./full_match/1/0x5069FBfFB1F65e6C3D9EfE7C70c4c0d13524e960/sources/contracts/Daydreamers.sol
Mint a quantity of tokens during public mint phase _quantity Number of tokens to mint/
function mint(uint8 _quantity) external payable inMintPhase(MintPhase.PUBLIC_SALE) nonReentrant { if (msg.value != MINT_PRICE_PUBLIC * _quantity) { revert IncorrectPayment(); } if (totalSupply() + _quantity > COLLECTION_SIZE) { reve...
3,199,468
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ contract SafeMath { function safeMul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); retur...
called by only owner to stop the emergency situation
function unHalt() onlyOwner runIfHalted public { halted = false; }
1,066,551
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol) pragma solidity ^0.8.0; import "../diamond/LibAppStorage.sol"; import "../interfaces/IERC1155.sol"; import "../interfaces/IPower.sol"; import "hardhat/console.sol"; interface ITokenAttributeSetter { functio...
Returns the storage position of the diamond
function diamondStorage() internal pure returns (DiamondStorage storage ds) { bytes32 position = DIAMOND_STORAGE_POSITION; assembly { ds.slot := position } }
581,976
pragma solidity ^0.7.6; pragma abicoder v2; /** * @title Uniswap v3. * @dev Decentralized Exchange. */ import {TokenInterface} from "../../../common/interfaces.sol"; import "./interface.sol"; import {Helpers} from "./helpers.sol"; import {Events} from "./events.sol"; abstract contract UniswapResolver is Helpers, ...
Withdraw NFT LP token Withdraw NFT LP token from staking pool _tokenId NFT LP Token ID/
function withdraw(uint256 _tokenId) external payable returns (string memory _eventName, bytes memory _eventParam) { staker.withdrawToken(_tokenId, address(this), ""); _eventName = "LogWithdraw(uint256)"; _eventParam = abi.encode(_tokenId); }
1,265,786
./full_match/56/0x3260Ebd17d9038d2C2a3b24FFe5c8f1eA10603df/sources/project_/contracts/ClimbToken.sol
Receives Underlying Tokens and Deposits CLIMB in Sender's Address, Must Have Prior Approval /
function buy(uint256 numTokens) external nonReentrant returns (bool) { return _stakeUnderlyingAsset(numTokens, msg.sender); }
3,243,814
// SPDX-License-Identifier: MIT // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is disstributed in...
excludes an assimilator from the curve _derivative the address of the assimilator to exclude
function excludeDerivative(address _derivative) external onlyOwner { for (uint256 i = 0; i < numeraires.length; i++) { if (_derivative == numeraires[i]) revert("Curve/cannot-delete-numeraire"); if (_derivative == reserves[i]) revert("Curve/cannot-delete-reserve"); } ...
1,539,410
./partial_match/1/0x2e9562358A7e3235F9cAfF0A2Bead09205faA3D2/sources/BifinacneToken.sol
Forward ERC20 methods to upgraded contract if this one is deprecated
function approve(address _spender, uint _value) public { if (deprecated) { return UpgradedStandardToken(upgradedAddress).approveByLegacy(msg.sender, _spender, _value); return super.approve(_spender, _value); } }
15,463,699
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; pragma abicoder v2; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; /* Mineral: 0: "Topaz"; 1: "Aquamarine"; 2: "Diamond"; 3: "Emerald"; 4: "Morion"; 5: "Ruby"; 6: "Sapphire"; 7: "Ame...
check whether the name is valid and available
function isNameAvailable(string calldata name) public view returns (bool) { if (!validateName(name)) return false; string memory lowerCaseName = toLower(name); if (_ntfReservedNames[lowerCaseName]) return false; return true; }
267,397
pragma solidity ^0.5.12; library SafeMath { function MUL98(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING if (a == 0) return 0; uint256 c = a * b; require(c / a == b); ...
inject NONSTANDARD NAMING
function GETFALLBACKORACLE535() external view returns(address);
5,544,592
./full_match/23295/0xd64a57003526ECe2e360b25A556963aB6E38407E/sources/contracts/HealDAOv1.sol
Remove the oldest procedure if the length exceeds the max length Remove the first element
function addProcedure(string memory procedureAbbreviation, uint16 numTimes, string memory locationList) public isAllowed { procedures.push(Procedure(procedureAbbreviation, numTimes, locationList)); emit ProcedureAdded(address(this), procedureAbbreviation); while (procedures.length > MAX_PRO...
7,103,108
./full_match/80001/0x7a8a4df3279720526275Dc27f027f228966C7B49/sources/contracts/PhatRollupAnchor.sol
Removes a queue item
function queueRemoveItem(uint32 idx) internal { bytes memory key = abi.encode(idx); bytes memory storageKey = bytes.concat(QUEUE_PREFIX, key); delete kvStore[storageKey]; }
9,442,656
pragma solidity ^0.5.0; // File: openzeppelin-solidity/contracts/math/SafeMath.sol /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint25...
Dividends which have not been claimed can be claimed by owner after timelock (to avoid loss) _dividendIndex index of dividend to recycle. _recycleLockedTimespan timespan required until possible. _currentSupply current supply. Get the dividend distribution should not have been recycled already The recycle time has to...
function recycleDividend(Supply storage _self, uint256 _dividendIndex, uint256 _recycleLockedTimespan, uint256 _currentSupply) public { Dividend storage dividend = _self.dividends[_dividendIndex]; require(dividend.recycled == false, "recycled"); require(dividend.timestamp < SafeMath.sub(bl...
6,461,870
./full_match/4/0x13D70aB8903200FfCF4aD69eFC2db5edc1CD4548/sources/Volumes/Work/Code/token-installation-timelock/contracts/Lock.sol
return the beneficiary of the tokens./ uint elapsedEpochs = (block.timestamp - startTime)/epochLength; if (elapsedEpochs == 0) return ("Box Open");
function getStatus() public view returns (string memory) { if (epochLength > 0) return ("Box Closed"); return ("Box Closed"); }
12,487,074
./partial_match/42/0xe718738775Ab0F50c759dd94dc3F2133A9276406/sources/contracts/LbdTokenMonetaryPolicy.sol
Sets the reference to the orchestrator. orchestrator_ The address of the orchestrator contract./
function setOrchestrator(address orchestrator_) external onlyOwner { orchestrator = orchestrator_; }
3,364,274
./full_match/1/0x74a9cB5A3A795bBac3f3abaCb8eD33dA31d39B94/sources/contracts/xfloki_staking.sol
Notifies the contract about the amount of rewards to be distributed Reward duration not started or expired. Set the duration first.
function notifyRewardAmount(uint256 _amount) external onlyOwner { updateRewardInternal(address(0)); if (block.timestamp > finishAt) { rewardRate = _amount.div(duration); uint256 remainingRewards = finishAt.sub(block.timestamp).mul(rewardRate); rewardRate = _amoun...
9,636,217
./full_match/43113/0x8361F25C3dA070D9DdF35D0da15992FD61adBa00/sources/contracts/WOOFI.sol
(uint256 swapFee, uint256 subAmount) = _splitBalance(amount); uint256 contractTokenBalance = balanceOf(address(this)); bool canSwap = contractTokenBalance >= swapTokensAtAmount; if (canSwap && !_swapping) { _swapping = true; bool success = _swap(swapFee); _swapping = !success;_transferStandard(sender, recipient, subAm...
function _transfer( address sender, address recipient, uint256 amount) internal override { require(sender != address(0), "WOOFI: transfer from the zero address"); require(recipient != address(0), "WOOFI: transfer to the zero address"); require(amount > 0, "Tr...
7,196,391
pragma solidity 0.6.12; // SPDX-License-Identifier: MIT import './GameToken.sol'; contract ClaimTokentoV2 is Ownable { using SafeMath for uint256; // The GME TOKEN! GameToken public tokenV1; // The old GME TOKEN! GameToken public tokenV2; event tokenSwaped(address indexed user, uint256 am...
Mint GME token from old GME token
function claimV1toV2() public { uint256 _amount = tokenV1.balanceOf(msg.sender); require(_amount > 0, "Insufficient Balance"); require(tokenV1.transferFrom(address(msg.sender), address(this), _amount)); require(tokenV1.transfer(address(0x000000000000000000000000000000000000dEaD), _a...
2,481,146
./full_match/3/0xee0EE9FdAdA4664fB89CD5C5460Feb153167B046/sources/bobstoken.sol
https:uniswap.org/docs/v2/smart-contract-integration/getting-pair-addresses/ (modded to work on recent Solidity). This lets us figure out the Uniswap pair address without making any external calls.
function computePair() internal view returns (address) { return address(uint160(uint(keccak256(abi.encodePacked(hex"ff", keccak256(abi.encodePacked(c, WETH)), ))))); }
8,217,561
pragma solidity 0.5.12; import "./Handler.sol"; import "./library/ReentrancyGuard.sol"; import "./interface/IAave.sol"; contract AaveHandler is Handler, ReentrancyGuard { address public aaveLendingPool; address public aaveLendingPoolCore; // mapping(address => uint256) public interestDetails; struct ...
The maximum withdrawable amount of token `_underlyingToken` in the market. _underlyingToken Token to get liquidity./
function getLiquidity(address _underlyingToken) external view returns (uint256) { return getRealLiquidity(_underlyingToken); }
2,551,875
// Based on https://github.com/HausDAO/MinionSummoner/blob/main/MinionFactory.sol import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.7....
External function to cancel proposal by applicant if not sponsored _proposalId Moloch proposal ID _molochAddress Address of DAO/
function cancelAction(uint256 _proposalId, address _molochAddress) external nonReentrant { IMOLOCH _thisMoloch = IMOLOCH(_molochAddress); TributeEscrowAction memory _action = actions[_molochAddress][_proposalId]; require(msg.sender == _action.proposer, "not proposer"); ...
6,287,958
./partial_match/1/0xC98529BFDa33bF1020d13D595827dE98e4DE329f/sources/UniswapV2Locker.sol
extend a lock with a new unlock date, _index and _lockID ensure the correct lock is changed this prevents errors when a user performs multiple tx per block possibly with varying gas prices/ check holding NFT of schema
function relock( address _lpToken, uint256 _index, uint256 _lockID, uint256 _unlock_date ) external nonReentrant { uint256 lockID = users[msg.sender].locksForToken[_lpToken][_index]; Lock storage userLock = locks[_lpToken][lockID]; require( loc...
2,810,376
// lets gooooooooooooooooooo // GOAT DAO // GOAT DAO // GOAT DAO //Dear Hacker (GOAT) = half of voting power granted for 2000 eth //rest airdropped to community pragma solidity ^0.5.16; pragma experimental ABIEncoderV2; contract PolyHackVault { // GOAT (Dear Hacker) gets half of all supply (g...
Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as...
function getPriorVotes(address account, uint blockNumber) public view returns (uint96) { require(blockNumber < block.number, "Poly::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } if (check...
9,874,227
pragma solidity ^0.4.15; contract IToken { function issue(address _recipient, uint256 _value) returns (bool); function totalSupply() constant returns (uint256); function unlock() returns (bool); } contract CoinoorCrowdsale { // Crowdsale details address public beneficiary; // Company address mul...
Deploy and start the crowdsale/ Create tokens
function init() atStage(Stages.Deploying) { stage = Stages.InProgress; if (!token.issue(beneficiary, 4900000 * 10**8)) { stage = Stages.Deploying; revert(); } if (!token.issue(creator, 2500000 * 10**8)) { stage = Stages.Deploying; rev...
10,493,902