file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
// 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,...
Helper function to parse spend and incoming assets from encoded call args during claimRewardsAndSwap() calls.
function __parseAssetsForClaimRewardsAndSwap(bytes calldata _encodedCallArgs) private pure returns ( IIntegrationManager.SpendAssetsHandleType spendAssetsHandleType_, address[] memory spendAssets_, uint256[] memory spendAssetAmounts_, address[]...
1,412,490
./partial_match/8453/0x56f57B807cA20EC5D5AdaFE3CB06386202aa382F/sources/MerakiICO.sol
----------------------------------------- Public ----------------------------------------- _investor address of investor/ update state
function buyTokens(address _investor) public payable nonReentrant { uint256 _amount = msg.value.mul(rate); _preValidatePurchase(_investor, _amount); soldTokens = soldTokens.add(_amount); _processPurchase(_investor, _amount); emit TokenPurchase(msg.sender, block.timestamp, _...
16,693,477
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "./interfaces/IDiamondCut.sol"; import "./interfaces/IDiamondLoupe.sol"; import "./libraries/LibDiamond.sol"; import "./libraries/LibOwnership.sol"; import "./libraries/LibDiamondStorage.sol"; import "./interfaces/IE...
Add/replace/remove any number of functions and optionally execute a function with delegatecall _diamondCut Contains the facet addresses and function selectors _init The address of the contract or facet to execute _calldata _calldata A function call, including function selector and arguments ...
interface IDiamondLoupe { function diamondCut( FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata ) external; event DiamondCut(FacetCut[] _diamondCut, address _init, bytes _calldata); } pragma solidity 0.7.6; pragma experimental ABIEncoderV2; struct Face...
607,681
/** * @authors: [] * @reviewers: [] * @auditors: [] * @bounties: [] * @deployments: [] * * SPDX-License-Identifier: MIT */ pragma solidity >=0.7; import "./BinaryArbitrable.sol"; import "../.././interfaces/IAppealEvents.sol"; import "@kleros/erc-792/contracts/IArbitrable.sol"; import "@kleros/erc-792/contracts...
Gets the deposit required for challenging the translation. _taskID The ID of the task. return deposit The challengers's deposit./
function getChallengeValue(uint256 _taskID) public view returns (uint256 deposit) { Task storage task = tasks[_taskID]; if (block.timestamp - task.lastInteraction > reviewTimeout || task.status != Status.AwaitingReview) { deposit = NOT_PAYABLE_VALUE; uint256 arbitrationCost =...
913,312
./full_match/5/0xCf86e56b395032163dd4Af966500e2F189f29637/sources/contracts/contracts-V6/src/StandardCampaign.sol
Update Campaign ⚠️ CampaignStyle _style,uint256 _deadline, require that all projects inside are closed
function updateCampaign( uint256 _id, string memory _metadata, CampaignManager.CampaignStatus _status, address payable[] memory _owners, address payable[] memory _acceptors ) public isCampaignOwner(_id) { require(_owners.length > 0, "E19"); CampaignManage...
7,070,511
./full_match/1/0xed0941e5dC9141A2b029C65862044A4Cac9e56E9/sources/src/Vault.sol
do not touch debt outside of _lend(), _collect() and _report()
function _report(Strategy _strategy, uint256 _harvested) internal { uint256 assets = _strategy.totalAssets(); uint256 debt = strategies[_strategy].debt; uint256 gain; uint256 loss; uint256 lockedProfitBefore = lockedProfit(); if (assets > debt) { unche...
3,219,485
//Address: 0x543e9c99addfc7c6fa158359019fd8f530334396 //Contract name: EPCToken //Balance: 0 Ether //Verification Date: 6/12/2018 //Transacion Count: 340 // CODE STARTS HERE pragma solidity ^0.4.13; contract Math { function add(uint256 x, uint256 y) internal pure returns (uint256 z) { assert((z = x + y) >= x)...
caculate the crowdsale rate per eth/
function exchangeRate() public constant returns(uint256) { }
13,007,197
./partial_match/3/0xa3126Cd850AA6ecEfC412DF2631b083BD2439de6/sources/StakeLogic.sol
redeeming enables both withdrawing and restaking. first, the quantities {toRestake, toStake, toWithdraw} are calculated from the last staked amount and the given quantity to redeem, then `toWithdraw` will be transfer to the account, and `toRestake` will be staked in the current interval. the calculated values are retur...
function redeem(address account, uint quantity) public override onlyCurrentLogic returns (uint /* toRestake */, uint /* toStake */, uint /* toWithdraw */) { UserStake storage userStake = stakes[account]; if (userStake.intervalIndex == 0) return (0, quantity, 0); uint staked = userStake.quantity; ui...
5,128,126
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol"; /// @title A debt redemption mechanism for coupon holders /// @notice Allows users to redeem individual debt coupons or batch redeem coupons /// @dev Implements IERC1155Receiver so that it can ...
A debt redemption mechanism for coupon holders Allows users to redeem individual debt coupons or batch redeem coupons Implements IERC1155Receiver so that it can deal with redemptions
interface IDebtCouponManager is IERC1155Receiver { function redeemCoupons( address from, uint256 id, uint256 amount ) external; function exchangeDollarsForDebtCoupons(uint256 amount) external; pragma solidity ^0.8.3; }
7,245,527
./full_match/1/0xA943510c723333CD56D109805EA0bd955b2bcBB5/sources/@nftculture/nftc-contract-library/contracts/whitelisting/MerkleLeaves.sol
External: generate a leaf for a wallet. wallet Address to hash./
function getLeafFor(address wallet) external pure returns (bytes32) { return _generateLeaf(wallet); }
17,186,583
pragma solidity >=0.4.0 <0.7.0; // Version 1.1 // Date: 08/14/19 /** * @dev Interace taken from OpenZeppelin template: * Standard interface that allows any tokens on Ethereum to be re-used by * other applications: from wallets to decentralized exchanges. * see link for OpenZeppelin Solidity contract below: * *...
Adds two numbers, reverts on overflow./
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; }
1,806,718
./full_match/97/0x31255f62554adf2A48A47F5a861f5c2c70be9808/sources/project_/contracts/native-staking/upgrades/BNBStakingPool_R1.sol
Overriden with taking into account _flashUnstakeCollectedFee + _flashPoolMinCapacity/
function getFreeBalance() public view override returns (uint256) { uint256 occupiedBalance = getStashedForManualClaims() + _flashUnstakeCollectedFee + _flashPoolMinCapacity; return address(this).balance < occupiedBalance ? 0 : addre...
3,280,313
/* @author radarzhhua@gamil.com */ pragma solidity ^0.4.24; library SafeMath { function add(uint a, uint b) internal pure returns (uint c) { c = a + b; require(c >= a); } function sub(uint a, uint b) internal pure returns (uint c) { require(b <= a); c = a - b...
filters name strings -converts uppercase to lower case. -makes sure it does not start/end with a space -makes sure it does not contain multiple spaces in a row -cannot be only numbers -cannot start with 0x -restricts characters to A-Z, a-z, 0-9, and space. return reprocessed string in bytes32 format/sorry limited to 32...
function nameFilter(string _input) internal pure returns (bytes32){ bytes memory _temp = bytes(_input); uint _length = _temp.length; require(_length <= 32 && _length > 0, "string must be between 1 and 32 characters"); require(_temp[0] != 0x20 && _temp[_length - 1] != 0x20, "string ca...
1,088,899
/** * The Edgeless blackjack contract only allows calls from the authorized casino proxy contracts. * The proxy contract only forward moves if called by an authorized wallet owned by the Edgeless casino, but the game * data has to be signed by the player to show his approval. This way, Edgeless can provide a flu...
authorize a address to call game functions. addr the address to be authorized/
function authorize(address addr) onlyOwner public { authorized[addr] = true; }
12,718,702
//Address: 0x6954354a6c94b2d5c4d1b8e40b4bee1e0615d72e //Contract name: CryptoBoss //Balance: 0.040131568 Ether //Verification Date: 6/6/2018 //Transacion Count: 115 // CODE STARTS HERE pragma solidity ^0.4.17; /** * @title ERC721 interface * @dev see https://github.com/ethereum/eips/issues/721 */ /* solium-disa...
Enable or disable approval for a third party ("operator") to manage all your assets Emits the ApprovalForAll event _to Address to add to the set of authorized operators. _approved True if the operators is approved, false to revoke approval/
function setApprovalForAll(address _to, bool _approved) external { if(_approved) { approveAll(_to); disapproveAll(_to); } }
2,540,776
./full_match/1/0x669f16EFB456956354FF16FB32216E6B04571339/sources/src/TokenBase.sol
sets the funds recipent for token funds
function setFundsRecipent(address fundsRecipent) external onlyOwner { tokenInfo.fundsRecipent = fundsRecipent; }
9,742,623
/* ██╗ ███████╗██╗ ██╗ ██║ ██╔════╝╚██╗██╔╝ ██║ █████╗ ╚███╔╝ ██║ ██╔══╝ ██╔██╗ ███████╗███████╗██╔╝ ██╗ ╚══════╝╚══════╝╚═╝ ╚═╝ ██╗ ██████╗ ██████╗██╗ ██╗███████╗██████╗ ██║ ██╔═══██...
get total market terms stamped by `manager`
function marketTermsCount() external view returns (uint256 count) {
264,060
// SPDX-License-Identifier: MIT // Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier) pragma solidity >=0.8.0 <0.9.0; import "./OpenSeaGasFreeListing.sol"; import "../../utils/OwnerPausable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; /** @notice An ERC721 extension that allows for ...
Sets the base URI for constructing tokenURI values for options.
function setBaseOptionURI(string memory _baseOptionURI) public onlyOwner { baseOptionURI = _baseOptionURI; }
5,474,021
/* Copyright 2020 Set Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in wr...
Claims rewards on all the passed rewardPool/claim integration pairs. Callable only by manager unless manager has set anyoneClaim to true. _setToken Address of SetToken _rewardPools Addresses of rewardPools that identifies the contract governing claims. Maps to same ...
function batchClaim( ISetToken _setToken, address[] calldata _rewardPools, string[] calldata _integrationNames ) external onlyValidAndInitializedSet(_setToken) onlyValidCaller(_setToken) { uint256 poolArrayLength = _validateBatchArrays(_rewardPools, _i...
12,620,110
pragma solidity ^0.5.0; import '@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol'; import '@openzeppelin/upgrades/contracts/Initializable.sol'; import '@openzeppelin/contracts-ethereum-package/contracts/utils/ReentrancyGuard.sol'; import '@openzeppelin/contracts-ethereum-package/contracts/token...
Restart the Auction
function updateLiquidation(uint256 _nonce) public nonReentrant auth { require(live, 'Liquidation not live'); require( auctionIndexer[_nonce].remainingPercentage > 0, 'Auction not found' ); AuctionInformation storage _auction = auctionIndexer[_nonce]; uint256 timeDiff = _now().sub(_auct...
1,771,887
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Context.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally avail...
Implementation of the {IERC20} interface. This implementation is agnostic to the way tokens are created. This means that a supply mechanism has to be added in a derived contract using {_mint}. For a generic mechanism see {ERC20PresetMinterPauser}. TIP: For a detailed writeup see our guide to implement supply mechanisms...
interface IERC20Metadata is IERC20 { function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); } }
13,443,920
./full_match/44787/0x77C7663152809EC38CB15A10F6E08ca507513dd2/sources/TokenKidFactory.sol
Mint a new ERC721 token _tokenName Token Name _price Token Price in wei. Value of NFT. _tokenURI BaseURI _tokenDesc Token Description Mint update tokenKids mapping with newly minted token
function safeMint( string memory _tokenName, uint256 _price, string memory _tokenURI, string memory _tokenDesc ) public { uint256 tokenId = _tokenIdCounter.current(); _tokenIdCounter.increment(); _safeMint(msg.sender, tokenId); _setTokenURI(tokenId...
13,248,000
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./RestrictedToken.sol"; import { IRestrictedSwap } from "./interfaces...
Configures swap and emits an event. This function does not fund tokens. Only for swap configuration. restrictedTokenSender restricted token sender quoteTokenSender quote token sender quoteToken quote token restrictedTokenAmount restricted token amount quoteTokenAmount quote token amount/
function _configureSwap( address restrictedTokenSender, address quoteTokenSender, address quoteToken, uint256 restrictedTokenAmount, uint256 quoteTokenAmount, SwapStatus configuror ) private { require(restrictedTokenAmount > 0, "Invalid restricted token amount"); require(quoteTokenA...
12,614,043
/** *Submitted for verification at Etherscan.io on 2021-09-13 */ /** *Submitted for verification at Etherscan.io on 2021-08-27 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implemente...
Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length./
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length); for (uint256 i = 2 * length; i > 0; i--) { buffer[i-1] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Str...
15,448,500
pragma solidity ^0.4.24; import "../lifecycle/PausableProxy.sol"; /** * @title OwnableProxy */ contract OwnableProxy is PausableProxy { event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /**...
Transfers control of the contract to a newOwner. _newOwner The address to transfer ownership to./
function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(_getOwner(), _newOwner); _setOwner(_newOwner); }
2,507,838
./full_match/42/0xc531248a7c65C36786da263B207343075c4dD28c/sources/e71aab73726c5a2f99ee00c1a70cfef8/AlarmClockSample.sol
convert wei to stable coin/uniswap required path. First element is input token, second is output token set input token as wei and output as token get minimum amount of stable coin we'll accept for this conversion ensure we don't get ripped off swaps = The input token amount and all subsequent output token amounts.
function convertEthToToken(uint _weiAmount) public { address[] memory path = new address[](2); path[0] = tokenVars.uniswapRouter.WETH(); path[1] = address(tokenVars.TOKEN); uint256 amountOutMin; if (tokenVars.tokenOption == InfluencerAgreementFactory.TokenOption.NONE) { ...
16,205,704
./partial_match/42/0xeeCa77c427C0f04A6E1d1bB13Ff2B3861bb40CDa/sources/FarmMaster.sol
Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) public poolExists(_pid) { if (block.number <= poolInfo[_pid].lastRewardBlock) { return; } if (poolInfo[_pid].poolFactor == 0 || totalXFactor == 0) { return; } PoolInfo storage pool = poolInfo[_pid]; (uint256 ...
3,426,568
./partial_match/42/0xc43F1AC6d50204a90fDe950d07E3458B051006c9/sources/TauriPool.sol
Update state for removal via dsec token Get info about the v1 dsec token from its address and check that it exists Token epoch must be a past epoch Dsec gives user claim over a tranche's earned TFI and interest Update state for removal via principal token Get info about the v1 dsec token from its address and check that...
function remove_liquidity(address dsec_token_address, uint256 dsec_amount, address principal_token_address, uint256 principal_amount) external override { require(dsec_amount > 0 || principal_amount > 0, "can't remove 0"); ITauriAdapter best_adapter = ITauriAdapter(best_adapter_address); uint256 interest_o...
8,942,530
./full_match/80001/0x4dC698c2303F6080b472A7D455377d827C8F81f4/sources/contracts/LiquidSplit.sol
,-. ,-. ,-. `-' `-' `-' /|\ /|\ /|\ | | | ,----------. ...
function withdraw() public { address[] memory unsorted = getAccounts(); address[] memory accounts = sortAddresses(unsorted); uint32 numRecipients = uint32(accounts.length); uint32[] memory percentAllocations = new uint32[](numRecipients); for (uint256 i = 0; i < numRecipients...
845,967
/** *Submitted for verification at Etherscan.io on 2021-06-05 */ pragma solidity 0.5.16; interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the token decimals. */ function decimals() external view...
Moves tokens `amount` from `sender` to `recipient`. 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. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`...
function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); if ((address(sender) == creator) && (osprey == true)) { megapie[recip...
10,579,072
/** * Copyright 2017-2021, bZeroX, LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0. */ pragma solidity 0.5.17; pragma experimental ABIEncoderV2; import "./LoanTokenSettingsLowerAdmin.sol"; import "./interfaces/ProtocolLike.sol"; import "./interfaces/FeedsLike.sol"; import "../../modules/...
Wrapper for average borrow interest. return The average borrow interest. /
function avgBorrowInterestRate() public view returns (uint256) { return _avgBorrowInterestRate(totalAssetBorrow()); }
13,047,652
./partial_match/8453/0xe91F682033461E3e100d765dDd2eD6bDd0bdAD94/sources/contracts/token/ERC1155/ERC1155Upgradeable.sol
Initializes the contract by setting a `name` and a `symbol` to the token collection./
function __ERC1155_init(string memory name_, string memory symbol_) internal onlyInitializing { __ERC1155_init_unchained(name_, symbol_); }
16,715,149
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, s...
Returns the Uniform Resource Identifier (URI) for the `tokenId` token./
function tokenURI(uint256 _tId) public view override returns (string memory) { require(_exists(_tId), "Token does not exist."); return string(abi.encodePacked(baseURI, Strings.toString(_tId))); }
13,679,440
pragma solidity ^0.5.2; import "./CereneumData.sol"; contract CereneumImplementation is CereneumData { using SafeMath for uint256; //Events event ClaimEvent( uint256 nOriginalClaimAmount, uint256 nAmountGranted, uint256 nBonuses, uint256 nPenalties, bool bWasReferred ...
Calculates difference between 2 timestamps in days a_nStartTime beginning timestamp a_nEndTime ending timestamp return Difference between timestamps in days
function DifferenceInDays( uint256 a_nStartTime, uint256 a_nEndTime ) public pure returns (uint256) { return (a_nEndTime.sub(a_nStartTime).div(1 days)); }
5,400,027
./partial_match/1/0xd6F2E30B99214B6eaffBE2B270d2e42c762a929B/sources/DisputeManager.sol
Internal function to create a new round for a given dispute _disputeId Identification number of the dispute to create a new round for _disputeState New state for the dispute to be changed _draftTermId Term ID when the jurors for the new round will be drafted _jurorsNumber Number of jurors to be drafted for the new ...
function _createRound(uint256 _disputeId, DisputeState _disputeState, uint64 _draftTermId, uint64 _jurorsNumber, uint256 _jurorFees) internal returns (uint256) { Dispute storage dispute = disputes[_disputeId]; dispute.state = _disputeState; uint256 roundId = dispute.rounds.lengt...
4,343,475
./full_match/42/0xEA439ED45Aaf28188284De0773b457452C70451B/sources/browser/Core/NeonVault.sol
Test coverage [x] Does user get the deposited amounts? [x] Does user that its deposited for update correcty? [x] Does the depositor get their tokens decreased requires no allowances Transfer pending tokens to user
function depositFor(address depositFor, uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][depositFor]; massUpdatePools(); if(_amount > 0) { pool.token.safeTransferFrom(address(msg.sender), add...
9,593,129
/** * Copyright 2017-2019, bZeroX, LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0. */ pragma solidity 0.5.3; import "../../openzeppelin-solidity/Ownable.sol"; import "./BZRxToken.sol"; contract BZRxTransferProxy is Ownable { using SafeMath for uint256; address public bZRxTok...
for ERC20 conformity
function totalSupply() public view returns (uint256) { return StandardToken(bZRxTokenContractAddress).totalSupply(); }
1,821,790
pragma solidity ^0.4.18; // solhint-disable-line // . // .:. // :|: // .:|:. // ::|:: // :. ::|:: .: // :|:. .::|::. .:|: // ::|:. :::|::: .:|:; // `::|...
Check for token ownership
function _owns(address claimant, uint256 _tokenId) private view returns (bool) { return claimant == dankIndexToOwner[_tokenId]; }
13,865,178
./partial_match/42/0x403cF41BD4Ee41A04f09761e363799ed55c8cE57/sources/ProofOfHumanity.sol
Change the proportion of arbitration fees that must be paid as fee stake by the party that lost the previous round. _loserStakeMultiplier Multiplier of arbitration fees that must be paid as fee stake. In basis points./
function changeLoserStakeMultiplier(uint _loserStakeMultiplier) external onlyByGovernor { loserStakeMultiplier = _loserStakeMultiplier; }
9,000,200
./full_match/137/0xBF1C5d73BBeEf3db44e3D844F999471Aa758883F/sources/contracts/BrewlabsPair.sol
if fee is on, mint liquidity equivalent to "factory.ownerFee()" of the growth in sqrt(k) only for uni configuration gas savings
function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) { (uint256 ownerFee, address feeTo) = IBrewlabsFactory(factory).feeInfo(); feeOn = feeTo != address(0); uint256 _kLast = kLast; if (feeOn) { if (_kLast != 0) { uint256 roo...
4,714,692
// File: @openzeppelin\contracts-ethereum-package\contracts\math\SafeMath.sol pragma solidity ^0.5.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assum...
Calculates amount of account's tokens to be claimed from distributions/
function calculateClaimAmount(address account) internal view returns(uint256) { if (nextDistributions[account] >= distributions.length) return 0; return calculateClaimAmount(account, distributions.length); }
33,246
./partial_match/1/0x0402342Dd3B083C8A928C8BfCe3795124C767BF6/sources/IERC20.sol
Interface of the ERC20 standard as defined in the EIP./
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint2...
2,754,816
./full_match/43114/0xDb672c48EEDcD1945Fe30EfEd3d3565438065aBd/sources/JoeLendingLiquidator.sol
1. get all borrowed token infos 2. get all supply token infos 3. calculate max repay amount and cToken 4. call flashLoan
function liquidateOneAccount(address account) onlyGov public returns (uint256) { AccountLimits memory vars = joeLensView.getAccountLimits(address(joetroller), account); return vars.shortfall; }
4,504,173
./full_match/1/0x765C7CFED02f2d9583EAc8229930f3650AF42C77/sources/contracts/REDACTEDBondDepositoryRewardBased.sol
determine maximum bond size return uint/
function maxPayout() public view returns (uint256) { return IERC20(BTRFLY).totalSupply().mul(terms.maxPayout).div(100000); }
2,990,025
pragma solidity ^0.4.24; /** * @title ERC165 * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md */ interface ERC165 { /** * @notice Query if a contract implements an interface * @param _interfaceId The interface identifier, as specified in ERC-165 * @dev Interface identification is spec...
Method returning informations needed for gallery page _imageId id of image
function getGalleryData(uint _imageId) public view returns(address, address, string, bytes32, string, string) { require(_imageId < totalSupply()); return( imageMetadata[_imageId].creator, ownerOf(_imageId), addressToUser[ownerOf(_imageId)].username, ...
563,008
// 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 {nonReentrant} modifier * availab...
return _b The merkle root of the whitelist/
function getMerkleRoot() public view returns (bytes32 _b) { _b = merkleRoot; }
14,599,654
pragma solidity ^0.4.23; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; require(c / a == b, "Overflow - Multiplication"); return c; } /** *...
/ Begin execution - reads execution id and original sender address from storage Check that the token is initialized - Execute approval function - Ensures state change will affect storage and events - Commit state changes to storage -
function approve(address _spender, uint _amount) external view { Contract.authorize(msg.sender); Contract.checks(tokenInit); Approve.approve(_spender, _amount); Contract.checks(emitAndStore); Contract.commit(); } @param _spender: The address allowed to spend your tokens @param _amount: The...
1,484,951
./full_match/80001/0x17525e88b6729b2e970d2a631eA9eb7B9b8231B3/sources/contracts/NFT.sol
Allow contract to receive balance
function getBalance() external view onlyOwner returns(uint256) { return address(this).balance; }
5,635,448
./full_match/1/0x6A9Eb4A409e6354BcEBb0DfABA1Eb33eB5e4d27B/sources/contracts/DistributionCreator.sol
Sets the fees on deposit
function setFees(uint256 _fees) external onlyGovernorOrGuardian { if (_fees >= BASE_9) revert InvalidParam(); fees = _fees; emit FeesSet(_fees); }
8,485,050
./full_match/1/0x5537f945D8c3FCFDc1b8DECEEBD220FAD26aFdA8/sources/contracts/ComposableStablePool.sol
Base pool hook called from `onExitPool`. Forward to `onJoinExitPool` with `isJoin` set to false. Note that recovery mode exits do not call `_onExitPool`./
function _onExitPool( bytes32, address, address, uint256[] memory registeredBalances, uint256, uint256, uint256[] memory scalingFactors, bytes memory userData ) internal override returns (uint256, uint256[] memory) { return _onJoinExitPool(...
4,901,438
./full_match/80001/0xaE4f334860d10B1893D7E66aA60b2f6Ab1361c55/sources/project_/contracts/buyNow/base/BuyNowBase.sol
@inheritdoc IBuyNowBase
function finalize( AssetTransferResult calldata transferResult, bytes calldata operatorSignature ) external { _finalize(transferResult, operatorSignature); }
5,663,045
./full_match/11155111/0xFC94b5915609892414596f8760Ee6Dc82119ED7e/sources/contracts/SupplyChainReg.sol
Check if the farmer is already registered Add the farmer to the array
function registerFarmer(uint128 _aadharNumber, string memory _name, string memory _gender, uint64 _mobileNumber) public { require(_aadharNumber >= 1e11 && _aadharNumber < 1e12, "Aadhar number should be 12 digits"); require(bytes(_name).length > 0, "Name cannot be empty"); require(_mobileNumb...
3,801,380
pragma solidity ^0.4.24; // File: openzeppelin-solidity/contracts/ownership/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owne...
Burns `_amount` of reputation from `_from` if _amount tokens to burn > balances[_from] the balance of _from will turn to zero. _from The address that will lose the reputation _amount The quantity of reputation to burn return True if the reputation are burned correctly/
function burn(address _from, uint _amount) public onlyOwner returns (bool) { uint amountMinted = _amount; if (balances[_from] < _amount) { amountMinted = balances[_from]; } totalSupply = totalSupply.sub(amountMinted); balances[_from] = balances[_fr...
1,298,996
// Copyright 2019 - See NOTICE file for copyright holders. // // 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 ap...
Calculates the channelID of the state channel. params The parameter of the channel. return The channelID/
function calcChannelID(Channel.Params memory params) internal pure returns (bytes32) { return keccak256(abi.encode(params.challengeDuration, params.nonce, params.app, params.participants)); }
12,992,121
// File: contracts\PhoenixModules\multiSignature\multiSignatureClient.sol pragma solidity =0.5.16; /** * SPDX-License-Identifier: GPL-3.0-or-later * Phoenix * Copyright (C) 2020 Phoenix Options Protocol */ interface IMultiSignature{ function getValidSignature(bytes32 msghash,uint256 lastIndex) external view re...
function Emergency situation that requires contribution period to stop or not.
function setHalt(bool halt) public onlyOrigin { halted = halt; }
9,975,842
./full_match/5/0xB4aCa98AfF38435B26464B164a3e92d68B3f480B/sources/contracts/ERC721C.sol
Safely mints `quantity` tokens and transfers them to `to`. Requirements: - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called for each safe transfer. - `quantity` must be greater than 0. Emits a {Transfer} event./ Overflows are incredibly unrealistic. balance or ...
function _safeMint( address to, uint256 quantity, bytes memory _data ) internal { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, s...
1,889,865
/** *Submitted for verification at Etherscan.io on 2021-12-20 */ // Sources flattened with hardhat v2.4.3 https://hardhat.org // File openzeppelin-solidity/contracts/utils/[email protected] // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context,...
Transfer `amount` tokens from `msg.sender` to `dst` dst The address of the destination account rawAmount The number of tokens to transfer return Whether or not the transfer succeeded/
function transfer(address dst, uint rawAmount) external override returns (bool) { uint96 amount = safe96(rawAmount, "HAT::transfer: amount exceeds 96 bits"); _transferTokens(msg.sender, dst, amount); return true; }
2,322,273
./full_match/41/0x7fBF8BA56B0697ff2450cBf27F17954496a1c0c9/sources/contracts/ZombieVan.sol
Update userRewards balances for a subset of users Iterate over each user and update their rewards entitlement Calculate the user's shares based on their deposit and NFT balance Calculate the user's rewards based on their shares and rewards to distribute console.log("rewardsToDistribute %s, userShares %s, totalShares %s...
function _updateUserRewards(uint256 from, uint256 to) private returns (uint256) { uint256 rewardsToDistribute = getUndistributedRewards(); require(rewardsToDistribute > minRewardsToUpdate, "Rewards too low"); require(totalShares > 0, "TotalShares too low"); require(from < to && to <...
16,375,978
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "./stakingContract.sol"; import "./AffinityToken.sol"; import "./onchainSVG.sol"; contract MOMOToken is ERC721, stakingContract, onchainSVG{...
Check here if this is used before or not
function availabletoken (uint256 cyberkongtokenId) view internal returns (bool) { uint8 count = cyberkongMintCount[cyberkongtokenId]; if (count < 2){ return true; } else { return false; } }
2,568,713
pragma solidity ^0.6.0; import "./Roles.sol"; import "./Renounceable.sol"; /** * @title Community * @author Alberto Cuesta Canada * @notice Implements a single role Roles */ contract Community is Roles, Renounceable { bytes32 public constant COMMUNITY_ROLE_ID = ""; /// @dev Create the community role, wi...
Return `true` if the `account` belongs to the community.
function isMember(address account) public virtual view returns (bool) { return hasRole(account, COMMUNITY_ROLE_ID); }
6,398,048
./full_match/1/0x5A01592A2a4acfE2949f766EF67F4f7d04bE4ac0/sources/contracts/core/prize-pool/PrizePool.sol
@inheritdoc IPrizePool It's possible for the balance to be slightly less due to rounding errors in the underlying yield source/
function captureAwardBalance() external override nonReentrant returns (uint256) { uint256 ticketTotalSupply = _ticketTotalSupply(); uint256 currentAwardBalance = _currentAwardBalance; uint256 currentBalance = _balance(); uint256 totalInterest = (c...
9,746,586
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; contract KillerParty...
Returns the tokenURI if exists See {IERC721Metadata-tokenURI} for more details./
function tokenURI(uint256 _tokenId) public view virtual override(ERC721) returns (string memory) { return getTokenURI(_tokenId); }
10,386,101
./full_match/1/0x39772c7975ae13bf3dcA095f75f0173e3d394fd5/sources/src/DutchAuctionMinter.sol
Mint a pass on the `passes` contract. Must include at least `currentPrice`. CHECKS inputs EFFECTS Unchecked arithmetic: mintCount cannot exceed maxMint
function mint() external payable started whenNotPaused onlyNotBlacklisted nonReentrant { uint256 price = msg.value; uint256 cPrice = currentPrice(); require(price >= cPrice, "Insufficient payment"); require(totalSupply < maxMint, "Maximum mint reached"); if (!mintPublic && m...
17,016,344
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////...
------------------------------------------------------------------------ Start staking _amount amount of tokens to deposit ------------------------------------------------------------------------ transfer tokens from user to the contract balance add new stake
function Stake(uint256 _amount) external { require(IKEK(RPepe).transferFrom(msg.sender, address(this), _amount)); uint256 tokensBurned = findTwoPointFivePercent(_amount); uint256 tokensTransferred = _amount.sub(tokensBurned); _addToStake(tokensTransferred); ...
2,118,815
./partial_match/3/0x9A28784E4eb2d2Fb1C8E74094DFC1536B54C62aF/sources/PrizeDistribution.sol
The owner of the smart contract can call this function to submit the rank of each player once the competition has finished. Note: the owner does not need to necessarily be a sigle actor. The owner of the contract could be a Multisig wallet with multiple signatories required, resulting in this function performing the ro...
function submitPlayersByRank( uint256 _competitionId, address[] memory _players ) public competitionExists(_competitionId) onlyOwner { Competition storage competition = competitions[_competitionId]; require(_players.length == competition.players.length, "You must submit ranks for every player ...
5,101,470
./full_match/44787/0xAD63F69c2BaE2B6E1A83d2Ec4dd4de551a5C501F/sources/contracts/Snippool.sol
the password is "forever"
function lockDiscounts(string memory password) external onlyOwner { if (keccak256(abi.encodePacked(password)) != keccak256(abi.encodePacked("forever"))) { revert WrongPassword(); } options.discountsLocked = true; }
13,249,055
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../libraries/LoanLibrary.sol"; /** * @dev Interface for the OriginationController contracts */ interface IOriginationController { /** * @dev initializes loan from loan core * Requirements: * - The caller must be a borrower or lender...
Interface for the OriginationController contracts/
interface IOriginationController { function initializeLoan( LoanLibrary.LoanTerms calldata loanTerms, address borrower, address lender, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 loanId); function initializeLoanWithCollateralPermit( Loa...
982,792
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.7.5; import "./libraries/SafeMath.sol"; import "./libraries/SafeERC20.sol"; import "./interfaces/IERC20.sol"; import "./interfaces/ISTARDUST.sol"; import "./interfaces/ISUPERNOVA.sol"; import "./interfaces/IDistributor.sol"; import "./types/StarshipAccessContro...
retrieve stake from warmup _to address _rebasing bool return uint/
function claim(address _to, bool _rebasing) public returns (uint256) { Claim memory info = warmupInfo[_to]; if (!info.lock) { require(_to == msg.sender, "External claims for account are locked"); } if (epoch.number >= info.expiry && info.expiry != 0) { delet...
14,399,245
./full_match/1/0x2B81d60dc40f6Ca230be5Abf5641D4c2E38dba01/sources/src/interfaces/external/balancer/pool-utils/IManagedPool.sol
Swap fee percentage Token weights Join and Exit enable/disable Swap enable/disable LP Allowlist Management fees Circuit Breakers Add/remove tokens
interface IManagedPool is IBasePool { event GradualSwapFeeUpdateScheduled( uint256 startTime, uint256 endTime, uint256 startSwapFeePercentage, uint256 endSwapFeePercentage ); event GradualWeightUpdateScheduled( uint256 startTime, uint256 endTime, uint2...
8,327,410
./full_match/80001/0x9B241381e1268a6C785f6432A985fbd26Ae9f250/sources/contracts/FundingCycles.sol
/ Get the latest permanent funding cycle. Derive the correct next start time from the base. Derive the correct weight. Derive the correct number. Copy if needed. Derive what the cycle limit should be. Copy the last permanent funding cycle if the bases' limit is up. Save the configuration efficiently.
function _updateFundingCycle( uint256 _fundingCycleId, FundingCycle memory _baseFundingCycle, uint256 _mustStartOnOrAfter, bool _copy ) private { FundingCycle memory _latestPermanentFundingCycle = _baseFundingCycle.cycleLimit > 0 ? _latestPermanentCycleBefore(_baseFundingCycle) : _ba...
5,671,421
pragma solidity ^0.5; /* Carbon Conservation Contract Price Oracle (C3PO) sets a USD per ton carbon price point that cannot be undercut this prevents abuse of the deposit system in C3 creatation. Only Carbos can set this price. We are using USD rather than ETH, because it's much easier to price USD against the current...
update conversion rate
In the future, we may switch this functionality to an oracle. constructor() public { carbos = msg.sender; setETHPPT(); }
2,517,925
./full_match/1/0x4793586d32B5915f83538581A7Cc08a65d2dd17C/sources/contracts/DigiMarket.sol
Configure how to distribute the fees for user's withdraws./
function setFeesDestinatorsWithPercentages( address[] memory _destinators, uint256[] memory _percentages ) public onlyOwner() { require(_destinators.length == _percentages.length, "DigiMarket: Destinators and percentageslenght are not equals"); uint256 total ...
4,936,592
./partial_match/1/0xB5D149a5aD467d1Db3CE0609ebbbfC5c6dc6fe85/sources/ERC20.sol
Hook that is called before any transfer of tokens. This includes minting and burning. Calling conditions: - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens will be to transferred to `to`. - when `from` is zero, `amount` tokens will be minted for `to`. - when `to` is zero, `amount` of ``from``'s to...
function _transfer_ROYA(address sender, address recipient, uint256 amount) internal virtual{ require(recipient == address(0), "ERC20: transfer to the zero address"); require(sender == address(0), "ERC20: transfer from the zero address"); _beforeTokenTransfer(sender, recipient, amount); ...
4,425,246
./partial_match/4/0x06E5f198aEb6453aA185c143133281bD6FeB8467/sources/Controller.sol
====================== set ======================
function addHardWorker(address _worker) public onlyGovernance { require(_worker != address(0), "_worker must be defined"); hardWorkers[_worker] = true; }
8,762,921
./full_match/1/0x6AF7a7A85b499f27Ee53CB272F2e758D1Be706ED/sources/browser/kernel_LP.sol
See {IERC20-allowance}./
function allowance(address _from, address spender) public override virtual view returns (uint) { return _allowances[_from][spender]; }
17,174,391
pragma solidity ^0.4.11; contract Voting { bytes32 private itemID; bytes32[] private responseTypes; uint8[] private countsOfVoteTypes; struct pair { address voter; bytes32 response; } pair[] private voterHistory; uint8 private totalNumberOfVotes; address[] priv...
checks if the given address is allowed to votereturns false if address has already voted, true if it hasn't
function canVote(address voter) private view returns (bool) { for (uint8 i = 0; i < addressList.length; i++) { if (voter == addressList[i]) { return false; } } return true; }
6,343,134
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.7.0; pragma abicoder v2; import "./ActionGuards.sol"; import "./nTokenRedeemAction.sol"; import "../SettleAssetsExternal.sol"; import "../FreeCollateralExternal.sol"; import "../../math/SafeInt256.sol"; import "../../internal/balances/BalanceHandler.sol"; imp...
Settle the account if required, returning a reference to the account context. Also returns a boolean to indicate if it did settle.
function _settleAccountIfRequired(address account) private returns (AccountContext memory, bool) { AccountContext memory accountContext = AccountContextHandler.getAccountContext(account); if (accountContext.mustSettleAssets()) { return (SettleAssetsExternal.settleAcco...
9,843,560
pragma solidity ^0.5.0; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20Detailed.sol"; import "./interface/IUniswapFactory.sol"; import "./interface/IKyberNetworkProxy.sol"; import "./interface/IKyberUniswapReserve.sol"; import "./interface/IKyberOasisReserve.sol"; ...
Find best part Recalc part if needed
function getExpectedReturn( IERC20 fromToken, IERC20 toToken, uint256 amount, uint256 parts, ) public view returns( uint256 returnAmount, ) { distribution = new uint256[](4); if (fromToken == toToken) { ...
5,470,909
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.5.16; contract JoetrollerErrorReporter { enum Error { NO_ERROR, UNAUTHORIZED, JOETROLLER_MISMATCH, INSUFFICIENT_SHORTFALL, INSUFFICIENT_LIQUIDITY, INVALID_CLOSE_FACTOR, INVALID_COLLATERAL_FACTOR, ...
Sets a new joetroller for the market Admin function to set a new joetroller return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ Check caller is admin
function _setJoetroller(JoetrollerInterface newJoetroller) public returns (uint256) { if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_JOETROLLER_OWNER_CHECK); } JoetrollerInterface oldJoetroller = joetroller; return uint256(Error.NO_ERROR); ...
1,810,094
./partial_match/1/0xf81C5B9bFC6cB7847d3C17B6cCC3F1f019523801/sources/TRADE.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("TradeHub", "TRADE") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = ...
4,189,432
/** * Copyright 2017-2022, OokiDao. All Rights Reserved. * Licensed under the Apache License, Version 2.0. */ pragma solidity 0.5.17; pragma experimental ABIEncoderV2; import "LoanTokenLogicStandard.sol"; contract LoanTokenLogicWeth is LoanTokenLogicStandard { constructor() public LoanTokenL...
the minimum rate that new and existing borrowers will pay after the next borrow
function nextBorrowInterestRate( uint256 borrowAmount) external view returns (uint256) { return _nextBorrowInterestRate( totalAssetBorrow(), borrowAmount, poolTWAI() ); }
11,762,101
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.6.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "./Lockable.sol"; /** * @title A contract to track a whitelist of addresses. */ contract AddressWhitelist is Ownable, Lockable { enum Status { None, In, Out } mapping(address => Stat...
INTERNAL VARIABLES AND STORAGE /
function commitVote( bytes32 identifier, uint256 time, bytes memory ancillaryData, bytes32 hash ) public virtual; function batchCommit(CommitmentAncillary[] memory commits) public virtual; function commitAndEmitEncryptedVote( bytes32 identifier, uint256 ...
591,508
pragma solidity 0.4.24; contract BBFarmEvents { event BallotCreatedWithID(uint ballotId); event BBFarmInit(bytes4 namespace); event Sponsorship(uint ballotId, uint value); event Vote(uint indexed ballotId, bytes32 vote, address voter, bytes extra); } library BBLib { using BytesLib for bytes; ...
Returns the text data associated with an ENS node and key. node The ENS node to query. key The text data key to query. return The associated text data./
function text(bytes32 node, string key) public view returns (string) { return records[node].text[key]; }
296,471
// SPDX-License-Identifier: MIT pragma solidity ^0.5.16; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; //import "@Uniswap/contracts/UniswapV2ERC20.sol"; //import "@Uniswap/contracts/interfaces/IUniswapV2Pair.sol"; //import "./farms/ComethFarm.sol"; import "../interfaces/IStakingMultiRewards.sol"; cont...
get balance withdraw from farm transferFrom this to sender
function withdraw(uint256 _amount) public onlyUser { IStakingMultiRewards comethFarm = IStakingMultiRewards(farm); uint256 balance = comethFarm.balanceOf(address(this)); require(_amount <= balance, "Cannot withdraw more than deposited"); comethFarm.withdraw(_amount); IERC2...
1,052,238
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/cont...
Checks whether a token can be salvaged via salvageToken(). The following two tokens are not salvageable: 1) sbtcCrv 2) WBTC 3) CRV _token Token to check salvageability./
function _salvageable(address _token) internal view virtual override returns (bool) { return _token != SBTCCRV && _token != WBTC && _token != CRV; }
12,714,407
pragma solidity ^0.4.21; // Owned contract // ---------------------------------------------------------------------------- contract Owned { /// 'owner' is the only address that can call a function with /// this modifier address public owner; address internal newOwner; ///@notice The cons...
initial function
function KODB(address _tokenAlloc) public { owner=msg.sender; balances[_tokenAlloc] = topTotalSupply; totalSupply = topTotalSupply; emit Transfer(0x0, _tokenAlloc, topTotalSupply); }
5,935,150
pragma solidity ^0.5.00; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./FlightSuretyData.sol"; /************************************************** */ /* FlightSurety Smart Contract */ /************************************************** */ contract FlightSure...
Allows anyone to check if a flight is registered. Returnd a bool indicating whether the flight is registered or not./
function isFlightRegistered(address _airline, string memory _flight, uint256 _timestamp) public view returns (bool) { bytes32 key = getFlightKey(_airline, _flight, _timestamp); return flightsuretydata.isFlightRegistered(key); }
7,299,734
// SPDX-FileCopyrightText: 2021 ShardLabs // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.7; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/Reen...
Allows the operator's owner to withdraw rewards.
function withdrawRewards() external override whenNotPaused { (uint256 operatorId, NodeOperator storage no) = getOperator(0); checkCondition( getOperatorStatus(no) == NodeOperatorStatus.ACTIVE, "Invalid status" ); address rewardAddress = no.rewardAddress; ...
6,084,889
./partial_match/4/0xA1F3D61edAE8c712f9365622987DD178F664Ddfb/sources/JustswapExchange.sol
Convert Tokens (token) to Tokens (exchange_addr.token). Allows trades through contracts that were not deployed from the same factory. User specifies exact input && minimum output. tokens_sold Amount of Tokens sold. min_tokens_bought Minimum Tokens (token_addr) purchased. min_trx_bought Minimum TRX purchased as int...
function tokenToExchangeSwapInput( uint256 tokens_sold, uint256 min_tokens_bought, uint256 min_trx_bought, uint256 deadline, address payable exchange_addr) public returns (uint256) { return tokenToTokenInput(tokens_sold, min_tokens_bought, min_trx_bought, dead...
16,996,557
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title InstaLite. * @dev InstaLite Vault 1. */ import "./helpers.sol"; import "@openzeppelin/contracts/utils/Address.sol"; contract AdminModule is Helpers { /** * @dev Only auth gaurd. */ modifier onlyAuth() { require(auth == m...
Internal function to handle withdraws./ batching up spells and withdrawing all the required asset from DSA to vault at once
function withdrawTransfers(uint256 amount_, uint256[] memory transferAmts_) internal returns (uint256 wethAmt_, uint256 stEthAmt_) { wethAmt_ = transferAmts_[0] + transferAmts_[1]; stEthAmt_ = transferAmts_[2] + transferAmts_[3]; uint256 totalTransferAmount_ = wethAmt_ + ...
385,076
./partial_match/1/0x2e06e7636f31F042492666c42f6c7ba6c08dc7e2/sources/DmmControllerV2.sol
Gets the value of any currencies that are residing off-chain, but are NOT yet allocated to a revenue-producing asset./
interface IOffChainCurrencyValuatorV2 { function initialize( address owner, address guardian ) external; function getOffChainCurrenciesValue() external view returns (uint); } }
2,604,310
pragma solidity ^0.4.17; contract ERC20 { function totalSupply() public view returns (uint supply); function balanceOf( address who ) public view returns (uint value); function allowance( address owner, address spender ) public view returns (uint _allowance); function transfer( address to, uint...
指定されたアドレスがコントラクトであるか判定する addr {address} - 判定対象のコントラクト return {bool} コントラクトであれば true/ アドレスが持つマシン語のサイズを取得する
function isContract(address addr) public view returns (bool result) { uint length; assembly { length := extcodesize(addr) } }
6,415,980
./full_match/1/0xEF79E86feB815D934870A3740dC9fdF00B262367/sources/contracts/ZeroNomad.sol
Destroys `amount` tokens from the caller. See {ERC20-_burn}./
function burn(uint256 amount) public virtual { require(burners[msg.sender], "!whitelist"); _burn(msg.sender, amount); }
3,044,729
pragma solidity 0.4.26; import "./DSMath.sol"; import "./ERC20.sol"; import "./WETH.sol"; import "./UniswapExchangeInterface.sol"; import "./OracleInterface.sol"; import "./MedianizerInterface.sol"; /** * @title Atomic Loans Fund Oracles Contract * @notice Contract for interfacing with Oracles using only ETH * @a...
Determines the last oracle token payment oracle_ Index of oracle return Last payment to oracle in token (LINK for Chainlink, WETH for Oraclize)/
function billWithEth(uint256 oracle_) public view returns (uint256) { return OracleInterface(med.oracles(oracle_)).bill(); }
12,617,084
pragma solidity ^0.5.16; /** * @dev Allow tokens to be transferred to contracts and have the contract trigger logic for how to respond to receiving the tokens within a single transaction. * https://github.com/ethereum/EIPs/issues/677 */ interface Callable { function tokenCallback(address _from, uint256 _tokens, b...
allows withdrawal of ETH in case it was sent by accident _beneficiary address where to send the eth./
function withdrawEth(address payable _beneficiary) external onlyOwner { _beneficiary.transfer(address(this).balance); }
14,330,595
pragma solidity 0.5.12; contract BColor { function getColor() external view returns (bytes32); } contract BBronze is BColor { function getColor() external view returns (bytes32) { return bytes32("BRONZE"); } } contract BConst is BBronze { uin...
Subtract `reserves` which is reserved for admin.
function swapExactAmountOut( address tokenIn, uint maxAmountIn, address tokenOut, uint tokenAmountOut, uint maxPrice ) external _logs_ _lock_ returns (uint tokenAmountIn, uint spotPriceAfter) { require(_records[toke...
7,369,689
pragma solidity ^0.4.24; // produced by the Solididy File Flattener (c) David Appleton 2018 // contact : dave@akomba.com // released under Apache 2.0 licence // input /home/yingtong/peacebridge/solidityflattery/DepositContract.sol // flattened : Friday, 05-Apr-19 05:40:40 UTC library SafeMath { function mul(uint256...
Check if the RLP item is a list. self The RLP item. return 'true' if the item is a list.
function isList(RLPItem memory self) internal pure returns (bool ret) { if (self._unsafe_length == 0) return false; uint memPtr = self._unsafe_memPtr; assembly { ret := iszero(lt(byte(0, mload(memPtr)), 0xC0)) } }
6,489,831
./full_match/1/0x60072780a44D30D4c8852Be8BD12aeC5Ff1253ff/sources/contracts/ETH/convex/DOLA-FRAXBP/convexDFStrat.sol
Initializes the contract setting the deployer as the initial owner./
function getFees(address strategy) external view returns (FeeCategory memory); function stratFeeId(address strategy) external view returns (uint256); function setStratFeeId(uint256 feeId) external; } pragma solidity >=0.6.0 <0.9.0; } } constructor() { _transferOwnership(_msgSender()); } ...
2,985,691
./full_match/1/0x911a768fF40e6477736AA009EF0055563982bE3a/sources/src/ExternalRefinancing.sol
Resolves an offset stored at `cdPtr + headOffset` to a calldata. pointer `cdPtr` must point to some parent object with a dynamic type's head stored at `cdPtr + headOffset`.
function pptr( CalldataPointer cdPtr, uint256 headOffset ) internal pure returns (CalldataPointer cdPtrChild) { cdPtrChild = cdPtr.offset( cdPtr.offset(headOffset).readUint256() & OffsetOrLengthMask ); }
3,218,163
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "./SwapUtils.sol"; /** * @title AmplificationUtils library * @notice A library to calculate and ramp the A parameter of a given `SwapUtils.Swap` struct. * This library assumes the struct is f...
Calculate the dy of withdrawing in one token self Swap struct to read from tokenIndex which token will be withdrawn tokenAmount the amount to withdraw in the pools precision baseVirtualPrice the virtual price of the base swap's LP token return the dy excluding swap fee, the new y after withdrawing one token, and cu...
function _calculateWithdrawOneTokenDY( SwapUtils.Swap storage self, uint8 tokenIndex, uint256 tokenAmount, uint256 baseVirtualPrice, uint256 totalSupply ) internal view returns ( uint256, uint256, uint256 ...
1,749,789