file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
/* Copyright 2017-2018 RigoBlock, Rigo Investment Sagl. 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 a...
Calculates the correct purchase amounts return Number of new shares return Value of fee in shares return Value of fee in shares to dao return Value of net purchased shares
function getPurchaseAmounts(uint _totalEth) internal view returns ( uint grossAmount, uint feeVault, uint feeVaultDao, uint amount ) { grossAmount = safeDiv(_totalEth * BASE, data.price); return ( grossAmount, ...
12,737,013
./partial_match/5/0x1536b20b2dddCe47b8e91bE56dFb9Ca4ED59f7a7/sources/YieldFarming.sol
IF( (time.now - stakedTime) / theMultiplierCyclePeriod < theMultiplierMaxCycle, (time.now - stakedTime) / theMultiplierCyclePeriod, theMultiplierMaxCycle) theTokenMultiplier / 100 stakeAmount
function calculateReward(uint256 _planId, uint256 _stakeAmount, uint256 _stakedTime) internal view returns (uint256 ){ uint256 _TimeDifference = now.sub(_stakedTime); uint256 _FinalCycle; if(_TimeDifference.div(plans[_planId].multiplierCyclePeriod) < plans[_planId].multiplierMaxCyc...
16,834,535
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/math/SignedSafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/...
shares Number of liquidity tokens to redeem as pool assets to Address to which redeemed pool assets are sent from Address from which liquidity tokens are sent return amount0 Amount of token0 redeemed by the submitted liquidity tokens return amount1 Amount of token1 redeemed by the submitted liquidity tokens update fe...
function withdraw( uint256 shares, address to, address from ) external override returns (uint256 amount0, uint256 amount1) { require(shares > 0, "shares"); require(to != address(0), "to"); zeroBurn(); (uint256 base0, uint256 base1) = _burnLiquidity( ...
130,105
pragma solidity ^0.5.17; // Brought from https://github.com/aragon/aragonOS/blob/v4.3.0/contracts/lib/math/SafeMath.sol // Adapted to use pragma ^0.5.17 and satisfy our linter rules /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { string private constan...
Returns the current block number. Using a function rather than `block.number` allows us to easily mock the block number in tests./
function getBlockNumber() internal view returns (uint256) { return block.number; }
91,613
./partial_match/1/0x17C714Bfb6C65bB88A223d4BF9e52aD4DF862F2f/sources/ETFUSDCAndCompound.sol
Start Investing Send 50% USDC offline Start the contract
function start() initialized isBincentive public { uint256 amountSentOffline = currentInvestedAmount.mul(percentageOffchainFund).div(100); require(StableToken.transfer(trader, amountSentOffline)); fundStatus = 4; emit StartFund(investors.length, currentInvestedAmount, totalMintedTok...
15,475,382
./full_match/1/0x19BEC0cCDf4e2cDcb216c2b2162c08A2B4c655b9/sources/contracts/UtilityWenUpgradeable.sol
Guarantee mint function _amount The amount of nfts to mint _proof The merkle proof for whitelist check/
function guaranteedMint(uint _amount, bytes32[] calldata _proof) external payable isLive isCorrectPrice(_amount, price) isWhitelisted(guaranteedMerkleRoot, _proof) withinThreshold(_amount) { _processMint(_msgSenderERC721A(), _amount); }
2,935,990
/* 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...
Retrieves the current chunk auction price for the particular Set _set Address of the SetToken _quantity The chunk auction's currentSetQuantity to rebalance return TokenFlow Struct with array, inflow, and outflow data/
function getBidPrice( address _set, uint256 _quantity ) public view returns (Rebalance.TokenFlow memory) { return LinearAuction.getTokenFlow(chunkAuction(_set), _quantity); }
12,665,139
pragma solidity 0.4.20; contract Betting { /* Constructor function, where owner and outcomes are set */ function Betting(uint[] _outcomes) public payable { owner = msg.sender; outcomeLength = 0; for (uint i = 0; i < _outcomes.length; i++) { outcomes[i] = _outcomes[i]; ...
Allow anyone to check the outcomes they can bet on /
function checkOutcomes(uint outcome) public view returns (uint) { for (uint i = 0; i < outcomeLength; i++) { if (outcomes[i] == outcome) { return i; } } }
5,501,909
/** *Submitted for verification at Etherscan.io on 2021-11-07 */ // SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/utils/introspection/IERC165.sol pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implemente...
Returns the subtraction of two unsigned integers, reverting with custom message on overflow (when the result is negative). CAUTION: This function is deprecated because it requires allocating memory for the error message unnecessarily. For custom revert reasons use {trySub}. Counterpart to Solidity's `-` operator. Requi...
function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } }
6,764,481
// SPDX-License-Identifier: MIT AND AGPL-3.0-or-later pragma solidity =0.8.9; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import "../../shared/ProtocolConstants.sol"; import "../../...
Returns true if a `leaf` can be proved to be a part of a Merkle tree defined by `root`. For this, a `proof` must be provided, containing sibling hashes on the branch from the leaf to the root of the tree. Each pair of leaves and each pair of pre-images are assumed to be sorted./ Hash(current computed hash + current ele...
function getClaim(address _vester) external view returns (uint256 vestedAmount); function claim() external returns (uint256 vestedAmount); function begin(address[] calldata vesters, uint192[] calldata amounts) external; function vestFor(address user, uint256 amount) e...
6,092,726
pragma solidity ^0.4.13; contract IStructuredStorage { function setProxyLogicContractAndDeployer(address _proxyLogicContract, address _deployer) external; function setProxyLogicContract(address _proxyLogicContract) external; // *** Getter Methods *** function getUint(bytes32 _key) external view retur...
Function to read from mapping username => address _username is the username of the user/
function getUserName2UserAddress( string _username ) public view returns (address) { bytes32 usernameBytes = stringToBytes32(_username); return PROXY_STORAGE_CONTRACT.getAddress(keccak256("username2currentAddress", usernameBytes)); }
12,215,303
./partial_match/42220/0x754068011bad2686BaC50b86d1745C565bD94b01/sources/src/SpiralsCUSDVault.sol
cUSD -> spcUSD/
function _convertToShares(uint256 assets, MathUpgradeable.Rounding) internal pure override returns (uint256 shares) { }
3,495,886
./partial_match/3/0x817C28FEac12Fcc9d21e9F47f6d19d0c9f26D6b0/sources/yyy.sol
require(now >= lgeEndTime, "Liquidity generation ongoing");require(now > (lgeEndTime + 2 hours), "Please wait for dev grace period");
function addLiquidityToUniswapPair() public onlyOwner { require(tokenAddress != address(0), "ERC20: can not zero address"); require(tokenUniswapPair != address(0), "ERC20: can not zero address"); require(LPGenerationCompleted == false, "Liquidity generation already finished"); if(_ms...
5,060,663
./partial_match/1/0x486Ae5A2df309Cbd7f86b6EaCF81f607e79c6128/sources/contracts/interfaces/IMultiFarmingPod.sol
View functions User functions Owner functions Distributor functions
interface IMultiFarmingPod is IPod { event FarmCreated(address token, address reward); event DistributorChanged(address oldDistributor, address newDistributor); event RewardAdded(address token, uint256 reward, uint256 duration); function totalSupply() external view returns(uint256); function distri...
16,161,540
./full_match/80001/0xBC87AE5C385a8687564dB945ccB8fb5b63AD7388/sources/project_/contracts/erc20/ERC20.sol
frozen account/
function _freezeAccount(address target, bool freeze) internal { _frozenAccount[target] = freeze; emit FrozenFunds(target, freeze); }
5,646,087
./partial_match/3/0xB204F02376982afd1C592AED3cCD30Da624e11B1/sources/Hype_BetStake.sol
------------------------------------------------------------------------ Token holders can stake their tokens using this function tokens number of tokens to stake ------------------------------------------------------------------------
function STAKE(uint256 tokens) external { require(totalStakes <= maxAllowed, "Max Stake amount exceed"); require(IERC20(Hype_Bet).transferFrom(msg.sender, address(this), tokens), "Tokens cannot be transferred from user account"); (uint256 transferToAmount,,) = IERC20(Hype_Bet).calcu...
5,083,002
./full_match/42/0x35948ad060a41f3d65669cFc07eb2C253147E63C/sources/Contract/eflint_decentralised.sol
Reverts the state of the eFLINT instance n steps. Choose negative n to revert to start./
function revertState(uint decentralisedInstanceID, int n) public { status = "start request for revert command"; string memory path = "data.response.response"; sendRequestToOracles("", path, "command", "revert", decentralisedInstanceID, int2str(n)); }
16,291,274
pragma solidity ^0.4.19; import "zeppelin-solidity/contracts/math/SafeMath.sol"; import "zeppelin-solidity/contracts/crowdsale/distribution/FinalizableCrowdsale.sol"; import './AutoRefundVault.sol'; /** * @title AutoRefundableCrowdsale * @dev Extension of Crowdsale contract that adds a funding goal, and * the poss...
Constructor, creates AutoRefundVault./
function AutoRefundableCrowdsale() public { vault = new AutoRefundVault(wallet); }
7,284,893
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "@open...
notice Redeems an NFTVoucher for an actual NFT, creating it in the process. param redeemer The address of the account which will receive the NFT upon success. param voucher A signed NFTVoucher that describes the NFT to be redeemed. make sure signature is valid and get the address of the signer make sure that the signer...
function redeem(address redeemer, NFTVoucher calldata voucher) public payable returns (uint256) { address signer = _verify(voucher); require(hasRole(MINTER_ROLE, signer), "Signature invalid or unauthorized"); require(msg.value >= voucher.minPrice, "Insufficient funds to redeem"); _mint(signer, voucher...
5,404,177
./full_match/5/0x672Eb83E33a4bc3b436e484D6428A424aC538092/sources/MultiSigWalletV2.sol
Web3 call functions/ Returns number of confirmations of a transaction. transactionId Transaction ID. return count Number of confirmations.
function getConfirmationCount(uint transactionId) public view returns (uint count) { for (uint i = 0; i < owners.length; i++) if (confirmations[transactionId][owners[i]]) count += 1; }
1,874,404
//! The KeyServerSet contract. Owned version with migration support. //! //! Copyright 2017 Svyatoslav Nikolsky, Parity Technologies Ltd. //! //! Licensed under the Apache License, Version 2.0 (the "License"); //! you may not use this file except in compliance with the License. //! You may obtain a copy of the License ...
Get new key server address.
function getNewKeyServerAddress(address keyServer) isOnNewSet(keyServer) external constant returns (string) { return newSet.map[keyServer].ip; }
5,401,811
./full_match/97/0xcc2187E84CBc609263DCBF21A25023fE1369486e/sources/project_/contracts/BlocVestTreasury.sol
Buy token from BNB/
function buyBack() external onlyOwner nonReentrant { uint256 ethAmt = address(this).balance; uint256 _fee = ethAmt * performanceFee / 10000; if(_fee > 0) { payable(feeWallet).transfer(_fee); ethAmt = ethAmt - _fee; } ethAmt = ethAmt * buybackRate / 100...
5,041,811
./full_match/1/0x02e7B8511831B1b02d9018215a0f8f500Ea5c6B3/sources/@aave/periphery-v3/contracts/adapters/paraswap/ParaSwapRepayAdapter.sol
Uses the received funds from the flash loan to repay a debt on the protocol on behalf of the user. Then pulls the collateral from the user and swaps it to the debt asset to repay the flash loan. The user should give this contract allowance to pull the ATokens in order to withdraw the underlying asset, swap it and repay...
function executeOperation( address asset, uint256 amount, uint256 premium, address initiator, bytes calldata params ) external override nonReentrant returns (bool) { require(msg.sender == address(POOL), 'CALLER_MUST_BE_POOL'); uint256 collateralAmount = amount; address initiatorLoca...
16,605,995
pragma solidity 0.5.1; // Pr000xy - a public utility ERC20 for creating & claiming transparent proxies // with gas-efficient addresses. Tokens are minted when specific salts or nonces // are submitted that result in the creation of new proxies with more zero bytes // than usual. They are then burned when transferring ...
Internal function to assign a new administrator to a proxy. The implementation can be upgraded as well, or skipped by leaving the argument to the implementation parameter set to the null address. proxy address The proxy in question. implementation address The new logic contract to point the proxy to. If it is set to ...
) internal { AdminUpgradeabilityProxyInterface proxyInterface = ( AdminUpgradeabilityProxyInterface(proxy) ); function _transferProxy( address proxy, address implementation, address owner, bytes memory data if (implementation != address(0)) { if (data.length > 0) { p...
1,770,597
./partial_match/5/0xf96dc01589969B85e27017F1bC449CB981eED9C8/sources/contracts/L1/rollup/ChainStorageContainer.sol
@inheritdoc IChainStorageContainer/
function get( uint256 _index ) public view returns ( bytes32 ) { return buffer.get(uint40(_index)); }
16,868,730
./partial_match/1/0x2b95b49ECec323AD6836Cc7A224BcDa984A2517A/sources/KIBBLEStake.sol
Returns econds until the next epoch begins
function secondsToNextEpoch() external view returns (uint256 seconds_) { return epoch.end - block.timestamp; }
2,765,204
//Address: 0x22a1ed2f03206be150ede2a7ffa909f7be033d99 //Contract name: AuthenticationManager //Balance: 0 Ether //Verification Date: 10/24/2017 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.11; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMat...
Handle receiving ether in ICO phase - we work out how much the user has bought, allocate a suitable balance and send their change / Forbid funding outside of ICOuint256 tokensPurchased = msg.value.div(icoUnitPrice);uint256 purchaseTotalPrice = tokensPurchased icoUnitPrice;uint256 change = msg.value.sub(purchaseTotalPr...
function () onlyDuringIco payable { if (now < icoStartTime || now > icoEndTime) throw; xWinToken.mintTokens(msg.sender, msg.value.mul(100000000).div(icoUnitPrice)); mainWallet.send(msg.value); throw;*/
6,355,911
/** * @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(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper ...
Get s from the serialized withdrawal data ser_data Serialized withdrawal data return s Signature s/
function _getWithdrawalS(bytes memory ser_data) internal pure returns (bytes32 s) { s = ser_data.toBytes32(WITHDRAWAL_SIZE - 140); }
15,834,851
./full_match/1/0xee80a37B9d529A085A0e4A6c7BAFdF9fA222f217/sources/solady/src/tokens/ERC1155.sol
Destroys `amount` of `id` from `from`. Requirements: - `from` must have at least `amount` of `id`. - If `by` is not the zero address, it must be either `from`, or approved to manage the tokens of `from`. Emits a {Transfer} event.
function _burn(address by, address from, uint256 id, uint256 amount) internal virtual { if (_useBeforeTokenTransfer()) { _beforeTokenTransfer(from, address(0), _single(id), _single(amount), ""); } assembly { let from_ := shl(96, from) mstore(0x20, or(_ERC1...
16,416,015
pragma solidity ^0.4.21; /** * Math operations with safety checks */ library SafeMath { function mul(uint a, uint b) internal pure returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint a, uint b) internal pure returns (uint) { // assert(b > 0); // Solidity...
close session, only escrow can call _priceClose price of ETH in USD uint price = namiToken.getPrice(); require(price != 0); etherToBuy = (session.amountInvest[i] - session.amountInvest[i] rateFee / 100) rateWin / 100; uint etherReturn = session.amountInvest[i] - session.amountInvest[i] rateFee / 100; (session.inves...
function closeSession (uint _priceClose) public onlyEscrow { require(_priceClose != 0 && now > (session.timeOpen + timeOneSession * 1 minutes)); require(!session.investOpen && session.isOpen); session.priceClose = _priceClose; uint result = (_priceClose>session.pr...
7,913,948
./partial_match/42/0xD3a294Fc6d40C70Ff4A463f64f9406D6B0e7e27E/sources/MasterChef.sol
Interface of the ERC20 standard as defined in the EIP./
interface IERC20 { function decimals() external view returns (uint8); 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(addre...
8,904,338
// Dependency file: contracts/dk/DuelistKingItem.sol // SPDX-License-Identifier: Apache-2.0 // pragma solidity >=0.8.4 <0.9.0; /** * Item of Duelist King * Name: Item * Domain: Duelist King */ library DuelistKingItem { // We have 256 bits to store an item's id so we dicide to contain as much as posible data ...
Return registry address
function getRegistry() external view returns (address) { return address(_registry); }
1,079,718
./full_match/80001/0x9C56925937b30988b7aF383db335cAc54560B5d3/sources/src/Interfaces/IExecutor.sol
Interface for Executor LI.FI (https://li.fi)
interface IExecutor { function swapAndCompleteBridgeTokens( bytes32 _transactionId, LibSwap.SwapData[] calldata _swapData, address transferredAssetId, address payable receiver ) external payable; pragma solidity 0.8.17; import { LibSwap } from "../Libraries/LibSwap.sol"; }
9,505,492
./full_match/42161/0x79bE5964789B5EaC1d09cb7c99f59b155950AEAb/sources/contracts/GaurStrategyLendingOptimizerImpermax.sol
Sets the minimum amount of want to deposit or withdraw out of a pool/
function setMinWantToDepositOrWithdraw(uint256 _minWantToDepositOrWithdraw) external { _onlyStrategistOrOwner(); minWantToDepositOrWithdraw = _minWantToDepositOrWithdraw; }
16,297,924
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; // This is only kept for backward compatability / upgrading import {OwnableUpgradeable} from "../oz/access/OwnableUpgradeable.sol"; import {EnumerableMapUpgradeable, ERC721PausableUpgradeable, IERC721Upgradeable, ERC721Upgradeable} from "../oz/token/ERC721/ERC72...
Interface of the ERC165 standard, as defined in the Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}./
interface IERC165Upgradeable { function supportsInterface(bytes4 interfaceId) external view returns (bool); }
143,966
/** *Submitted for verification at Etherscan.io on 2021-03-25 */ pragma solidity =0.6.6; interface IBoxswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (ad...
given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) { require(amountIn > 0, 'BoxswapV2Library: INSUFFICIENT_INPUT_AMOUNT'); require(reserveIn > 0 && reserveOut > 0, 'BoxswapV2Library: INSUFFICIENT_LIQUIDITY'); uint amountInWithFee = am...
10,838,967
// File: contracts/pike/BaseBank.sol pragma solidity >=0.5.0 <0.6.0; contract BaseBank { } // File: contracts/library/ERC20Not.sol pragma solidity >=0.5.0 <0.6.0; interface ERC20Not { function decimals() external view returns (uint8); function totalSupply() external view returns (uint256); function...
ERC Token Standard 20 Interface https:github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
interface ERC20Yes { function totalSupply() external view returns (uint256); function balanceOf(address tokenOwner) external view returns (uint256 balance); function allowance(address tokenOwner, address spender) external view returns (uint256 remaining); ...
14,984,677
pragma solidity ^0.6.0; /** * @title Primitive's Prime Contract * @notice The core ERC721 contract that holds all Instruments.Primes. * A Prime is a ERC-721 token that wraps ERC-20 assets * with functions to interact with them. * @author Primitive */ /** * @title Primitive's Instrument...
Utility to compare hashes of Prime properties. _collateralId id of token that is having its collateral withdraw _burnId id of token that is being burned return bool of whether Instruments.Primes match./
function arePrimesInSameSeries( uint256 _collateralId, uint256 _burnId ) public view returns (bool) { bytes4 hashCollateral = getFullChain(_collateralId); bytes4 hashBurn = getFullChain(_burnId); require(hashCollateral == hashBurn, ...
12,698,941
pragma solidity ^0.4.11; /* This FYN token contract is derived from the vSlice ICO contract, based on the ERC20 token contract. Additional functionality has been integrated: * the function mintTokens() only callable from wallet, which makes use of the currentSwapRate() and safeToAdd() helpers * the function mintR...
Allow setting only once
function setTokenContract(address newTokenContractAddr) onlyowner { if (newTokenContractAddr == address(0x0)) throw; if (tokenCtr != address(0x0)) throw; tokenCtr = Token(newTokenContractAddr); }
6,421,090
./partial_match/56/0xe83d290bCd59881C4f74E3F666E2c811C07D9257/sources/PancakePair.sol
this low-level function should be called from a contract which performs important safety checks
function mint(address to) external lock returns (uint liquidity) { uint balance0 = IERC20(token0).balanceOf(address(this)); uint balance1 = IERC20(token1).balanceOf(address(this)); uint amount0 = balance0.sub(_reserve0); uint amount1 = balance1.sub(_reserve1); bool feeOn = _...
11,098,200
/** *Submitted for verification at Etherscan.io on 2022-01-22 */ // hevm: flattened sources of src/FlapperMassBid.sol // SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity =0.8.11 >=0.5.12; ////// lib/dss-interfaces/src/ERC/GemAbstract.sol /* pragma solidity >=0.5.12; */ // A base ERC-20 abstract class // h...
https:github.com/makerdao/dss-chain-log
interface ChainlogAbstract { function wards(address) external view returns (uint256); function rely(address) external; function deny(address) external; function keys() external view returns (bytes32[] memory); function version() external view returns (string memory); function ipfs() external vie...
2,203,225
pragma solidity 0.5.1; /** * @dev Base contract for teams */ contract CryptoTeam { using SafeMath for uint256; //Developers fund address payable public teamAddressOne ; //inject UNINIT LOCAL/STATE VAR address payable public teamAddressTwo ; //inject UNINIT LOCAL/STATE VAR address payable public...
Allows the owner to set the starting time. _start the new _start/
function setStart(uint _start) public onlyOwner { start = _start; }
1,070,631
/* Copyright 2017-2018 Phillip A. Elsasser 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 a...
determines the amount of needed collateral for a given position (qty and price) priceFloor lowest price the contract is allowed to trade before expiration priceCap highest price the contract is allowed to trade before expiration qtyMultiplier multiplier for qty from base units qty signed integer corresponding to th...
{ uint maxLoss; function calculateNeededCollateral( uint priceFloor, uint priceCap, uint qtyMultiplier, int qty, uint price ) pure internal returns (uint neededCollateral) if (price <= priceFloor) { maxLoss = 0; max...
5,379,085
./full_match/42/0x7D0A14DBD574601bBb004475d6AcD49Ae7e36035/sources/browser/contracts/Adam.sol
Sends an amount of tokens from any caller to any address. The sender must have enough tokens to send Adjusts token balances of the two addresses
function transfer(address receiver, uint amount) public { require(amount <= balances[msg.sender], "Insufficient balance."); balances[msg.sender] -= amount; balances[receiver] += amount; }
16,230,104
./full_match/80001/0x33F0375DA7F26d95f2fC109B4650c804BcC4f5Ec/sources/contracts/Contract.sol
function to get random addresses based on area of interest and number of published papers here we are selecting 4 random reviewers.address[] memory selectedAddresses;
function selectResearchers(address userSubAddress) public returns (address[] memory selectedAddresses) { CID memory selectForCID = submission[userSubAddress]; uint8 interestedLen = selectForCID.reviewerLen; for (uint256 i = 0; i < 1; i++) { uint256 randomInd...
861,888
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol"...
Get token detail information/
function tokenDetail(uint256 tokenId) public view returns (Product memory) { require(_exists(tokenId), "Token not exists"); return _tokenIdDetailMapping[tokenId]; }
1,571,431
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.2; import "AccessControlUpgradeable.sol"; import "UUPSUpgradeable.sol"; import "PausableUpgradeable.sol"; import "SafeERC20.sol"; import "ERC20.sol"; import "ECDSA.sol"; import { Address } from "Address.sol"; import { Supervisor } from "Supervisor.sol"; import ...
Check if there are enough signed signatures to the signature hash sigIdHash The signature hash to be signed signatures Signed signatures by different validators
function checkSignatures(bytes32 sigIdHash, bytes[] memory signatures) public view { require(signatures.length >= threshold, "ERR_NOT_ENOUGH_SIGNATURES"); address prevAddress = address(0); for (uint i; i < threshold; i++) { address recovered = sigIdHash.recover(signatures[i]); ...
11,696,864
pragma solidity ^0.4.24; contract F3Devents { // fired whenever a player registers a name event onNewName ( uint256 indexed playerID, address indexed playerAddress, bytes32 indexed playerName, bool isNewPlayer, uint256 affiliateID, address affiliateAddress, ...
logic runs whenever a reload order is executed. determines how to handle incoming eth depending on if we are in an active round or not/ setup local rID grab time if round is active get earnings from all vaults and return unused to gen vault because we use a custom safemath library. this will throw if player tried to ...
function reLoadCore(uint256 _pID, uint256 _affID, uint256 _eth, F3Ddatasets.EventReturns memory _eventData_) private { uint256 _rID = rID_; uint256 _now = now; if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr =...
10,164,216
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { function hasRole(bytes32 role, ad...
updates the fee pool. _newFeePool The new fee pool.
function updateFeePool(address payable _newFeePool) external onlyOperator { require(_newFeePool != address(0), "LiquidityPoolV2: feepool cannot be 0x0"); feePool = _newFeePool; }
7,323,829
/** *Submitted for verification at Etherscan.io on 2021-06-10 */ pragma solidity ^0.5.17; // Brought from https://github.com/aragon/aragonOS/blob/v4.3.0/contracts/lib/math/SafeMath.sol // Adapted to use pragma ^0.5.17 and satisfy our linter rules /** * @title SafeMath * @dev Math operations with safety checks tha...
Close the evidence period of dispute `_disputeId` _subject IArbitrable instance requesting to close the evidence submission period _disputeId Identification number of the dispute to close its evidence submitting period/ Check current term is within the evidence submission period Update the draft term of the first rou...
function closeEvidencePeriod(IArbitrable _subject, uint256 _disputeId) external onlyController { (Dispute storage dispute, AdjudicationRound storage round) = _getDisputeAndRound(_disputeId, 0); require(dispute.subject == _subject, ERROR_SUBJECT_NOT_DISPUTE_SUBJECT); uint64 termId = _ensureC...
10,544,558
pragma solidity ^0.5.0; /** @title PostIt. */ contract PostIt { /** * Variable declarations */ mapping (address => bool) public enrolled; mapping (address => User) public userProfiles; mapping (uint256 => Post) public posts; uint256[] public postsIndexes; address[] public upVotersIndexes; address[] p...
Get all up voters indexed. return a array of upVotersIndexes./
function getAllUpVoters() external view returns(address[] memory) { return upVotersIndexes; }
5,523,225
pragma solidity 0.5.8; import "../roles/WhitelisterRole.sol"; /** * @title Whitelistable * @dev Allows tracking whether addressess are allowed to hold tokens. */ contract Whitelistable is WhitelisterRole { event WhitelistUpdate(address _address, bool status, string data); // Tracks whether an address is ...
Determine if sender and receiver are whitelisted, return true if both accounts are whitelisted from The address sending tokens. to The address receiving tokens./
function checkWhitelists(address from, address to) external view returns (bool) { return whitelist[from].status && whitelist[to].status; }
6,395,730
pragma solidity ^0.5.0; import {SafeMath} from "./SafeMath.sol"; import {ERC20Token} from "./Token.sol"; contract Project is ERC20Token { using SafeMath for uint; string name_; string description_; uint price_; address owner_; address intermediary_; ERC20Token currency_; constructor(...
Buy token - avaliable only for intermediary (for now).
function buyToken(uint amount) public onlyByV(intermediary_, "Problem in buyToken: wrong account.") returns(bool success) { currency_.transfer(owner_, amount.mul(price_)); return true; }
12,985,981
./partial_match/1/0x0795D136c053eBDD25966a54608309D5ae650afC/sources/PocketwithLoveSBT.sol
OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.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 inde...
9,280,084
./full_match/8453/0xE4AD80eD0c7d12A8B687c6C987d07f1D486fEd85/sources/src/royalty/ABRoyalty.sol
Update the subscription units for the previous holder and the new holder Only anotherblock Data Registry contract can perform this operation _previousHolder previous holder address _newHolder new holder address _dropId drop identifier _quantity array of quantity (per index)/ Remove `_quantity` of `_dropId` shares ...
function updatePayout721(address _previousHolder, address _newHolder, uint256 _dropId, uint256 _quantity) external onlyRole(REGISTRY_ROLE) { _loseShare(_previousHolder, _dropId, _quantity * IDA_UNITS_PRECISION); _gainShare(_newHolder, _dropId, _quantity * IDA_UNITS_PRECISION); ...
11,535,353
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.7.0 <0.9.0; import "./WalliroProxy.sol"; import "./IProxyCreationCallback.sol"; /// @title Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction. contract WalliroProxyFactory { event Proxy...
Allows to get the address for a new proxy contact created via `createProxyWithNonce` This method is only meant for address calculation purpose when you use an initializer that would revert, therefore the response is returned with a revert. When calling this method set `from` to the address of the proxy factor...
function calculateCreateProxyWithNonceAddress( address _singleton, bytes calldata initializer, uint256 saltNonce ) external returns (WalliroProxy proxy) { proxy = deployProxyWithNonce(_singleton, initializer, saltNonce); revert(string(abi.encodePacked(proxy))); }
242,169
/** *Submitted for verification at Etherscan.io on 2021-07-05 */ pragma solidity =0.4.25; //interface tokenRecipient { // function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external; //} contract Erc20Token { // Public variables of the token string public n...
Internal transfer, only can be called by this contract/
function _transfer(address _from, address _to, uint _value) internal { uint burnAmount; if (_from == burnAddress || _to == burnAddress) { burnAmount = 0; burnAmount = _value * burnFee / 100; } uint transferAmount = _value - burnAmount; require(balance...
6,683,618
./full_match/3/0x57763B44f9fD2B5Dc5a7e131721b8569630F3A95/sources/browser/TokenERC721.sol
Transfers the ownership of an NFT from one address to another address Throws unless `msg.sender` is the current owner, an authorized operator, or the approved address for this NFT. Throws if `_from` is not the current owner. Throws if `_to` is the zero address. Throws if `_tokenId` is not a valid NFT. When transfer...
function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes memory data) public payable { transferFrom(_from, _to, _tokenId); uint32 size; assembly { size := extcodesize(_to) } if(size > 0){ ERC721TokenReceiver receiver = ERC721TokenReceiver(_to); require(recei...
8,266,096
./full_match/5/0x29e4DBa9185D5cAc26A7369b111e8D74841B6b4a/sources/contracts/base/SignatureValidator.sol
Implementation of ISignatureValidator (see `interfaces/ISignatureValidator.sol`) Should return whether the signature provided is valid for the provided data. _data Arbitrary length data signed on the behalf of address(msg.sender) _signature Signature byte array associated with _data return a bool upon valid or inval...
function isValidSignature(bytes calldata _data, bytes calldata _signature) public view override returns (bytes4) { RestrictedSafe safe = RestrictedSafe(payable(msg.sender)); bytes32 messageHash = getMessageHashForSafe(safe, _data); if (_signature.length == 0) { require(safe.signe...
7,045,545
pragma solidity >=0.4.25 <0.6.0; import 'openzeppelin-solidity/contracts/math/SafeMath.sol'; import 'openzeppelin-solidity/contracts/token/ERC20/ERC20.sol'; import 'openzeppelin-solidity/contracts/access/roles/MinterRole.sol'; import 'openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol'; import 'openzeppelin...
Override the transfer method to support our custom verify transfer functoin Still fixing a bug with transfer method
function transfer(address _to, uint256 _value) public returns (bool) { verifyTransfer(msg.sender, _to); _transfer(msg.sender, _to, _value); return true; }
5,423,190
pragma solidity ^0.5.0; // Import the `Roles` library import "../milkcore/Ownable.sol"; import "../milkaccesscontrol/PoultererRole.sol"; import "../milkaccesscontrol/DairyfactoryRole.sol"; import "../milkaccesscontrol/DistributorRole.sol"; import "../milkaccesscontrol/RetailerRole.sol"; import "../milkaccesscontrol/Su...
Define a function 'shipItemToDistributor' that allows the dairy factory to mark an item 'ShippedToDistributor' Use the above modifers to check if the item is sold Update the appropriate fields Emit the appropriate event
function shipItemToDistributor(uint _upc) public onlyDairyfactory() checkUpcInItems (_upc) checkItemState (_upc, State.SoldToDistributor, "Milk is not sold to distributor!") { items[_upc].itemState = State.ShippedToDistributor; emit ShippedToDistributor(_upc, msg.sender); ...
1,004,333
pragma solidity ^0.4.18; // // EtherPiggyBank // (etherpiggybank.com) // // <`--&#39;\>______ // /. . `&#39; \ // (`&#39;) , @ // `-._, / // )-)_/--( > // &#39;&#39;&#39;&#39; &#39;&#39;&#39;&#39; // // Invest Ethereum into a long term stable solution where // your invest...
start up the contract! set the dev address make the gold level investor make the silver level investor make the bronze level investor
function EtherPiggyBank() public { dev = msg.sender; investorPositions.push(InvestorPosition({ investor: dev, startingTime: now, })); investorPositions.push(InvestorPosition({ investor: 0x6c0cf053076681cecbe31e5e19df8fb97deb5...
10,943,753
// _________ _________ _______ __________ // /__ __\| _____) / . \/ _____/ // |___| |___|\____\/___/ \___\________\ // SPDX-License-Identifier: MIT pragma solidity ^0.8.10; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/...
See {IERC721-ownerOf}./
function ownerOf(uint256 tokenId) public view override returns (address) { require(_exists(tokenId), "nonexistent"); uint16 id = uint16(tokenId); address owner = _transfers[id].owner; if (owner != address(0)) { return owner; } for (; id > 0; id--) { owner = _minters[id].owner; ...
348,840
pragma solidity ^0.6.0; import "./MultiSig.sol"; /** * @title LockableSig * @dev LockableSig contract * @author Cyril Lapinte - <cyril@openfiz.com> * SPDX-License-Identifier: MIT * * Error messages * LS01: Contract must be unlocked to execute */ contract LockableSig is MultiSig { bytes public constant LOC...
override execute internal call/
function executeInternal(address payable _destination, uint256 _value, bytes memory _data) internal override { require(!locked_, "LS01"); super.executeInternal(_destination, _value, _data); }
6,380,224
./full_match/1/0x3fa3B62F0c9c13733245A778DE4157E47Cf5bA21/sources/src/libraries/CallbackLibrary.sol
Flag for identifying the initialized state and reducing gas cost when resetting `_callbackWithCharge` Flag for identifying whether to charge fee determined by the least significant bit of `_callbackWithCharge`
function isCharging(bytes32 flag) internal pure returns (bool) { return (flag & _CHARGE_MASK) != bytes32(0); }
8,319,089
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; pragma abicoder v2; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "./ApproveAndCallFallBack.sol"; contract SCV...
returns daily limit
function quota() public view returns (uint256) { return _quotaPerDay; }
5,783,957
//SPDX-License-Identifier: Unlicensed pragma solidity ^0.8.0; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/security/Pausable.sol'; import '@openzeppelin/contracts/utils/math/SafeMath.sol'; import '@openzeppelin/co...
Calculate claimable amount for a beneficiary _addr beneficiary address iterate across all the vestings & check if the releaseTimestamp is elapsed then, add all the amounts as claimable amount
function claimableAmount(address _addr) public view whenNotPaused returns (uint256) { uint256 sum = 0; for (uint256 i = 0; i < timelocks[_addr].length; i++) { if ( block.timestamp >= timelocks[_addr][i].releaseTimestamp ) { sum = sum.add(timelocks[_addr][i].amount); ...
1,082,809
//SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "../Common/library/math/SafeMath.sol"; import "../Common/library/Ownable.sol"; import "../Common/library/token/ERC20/SafeERC20.sol"; import "../Common/library/token/ERC1155/ERC1155Holder.sol"; contract Track { } // // fee system -> for every sell cont...
Sell ERC1155 track in batch
function sellTrackInBatch( address[] memory _nfts, uint256[] memory _tokenIds, uint256[] memory _amounts, uint256[] memory _pricesPerUnit ) external { require((_nfts.length == _amounts.length) && (_amounts.length == _pricesPerUnit.length), 'd'); for (uint256 i = 0...
12,778,135
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then ...
Unkill contract (unfreezes deposits) return True if contract unkilling is successful
function unkill() external govOnly returns (bool) { killed = false; return true; }
13,582,549
// SPDX-License-Identifier: AGPL-3.0-or-later /// MultiplyProxyActions.sol // Copyright (C) 2021-2021 Oazo Apps Limited // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either versio...
Gets actual rate from the vat Gets actual art value of the urn Gets actual dai amount in the urn If the rad precision has some dust, it will need to request for 1 extra wad wei
function _getWipeAllWad( address vat, address usr, address urn, bytes32 ilk ) internal view returns (uint256 wad) { (, uint256 rate, , , ) = IVat(vat).ilks(ilk); (, uint256 art) = IVat(vat).urns(ilk, urn); uint256 dai = IVat(vat).dai(usr); uint256 rad = art.mul(rate).sub(dai); w...
10,329,501
pragma solidity >=0.7.4; contract MyToken { address public minter; mapping (address =>uint) public balance; uint public constant RETRate = 1000000000000000; //one Royal Entry Token Cost 1 finney; constructor() { minter = msg.sender; } function mint(address rec...
assuming one person entry require one Ticket.
function enterCoffeeShop(address payable _shopAddress ,uint _tickets ) public returns (bool success) {
12,721,280
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import {PercentageMath} from '../protocol/libraries/math/PercentageMath.sol'; import {SafeMath} from '../dependencies/openzeppelin/contracts/SafeMath.sol'; import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20....
Returns the list of the initialized reserves/
function getReservesList() external view override returns (address[] memory) { address[] memory _activeReserves = new address[](_reservesCount); for (uint256 i = 0; i < _reservesCount; i++) { _activeReserves[i] = _reservesList[i]; } return _activeReserves; }
68,743
./full_match/5/0x201e479D966a08f2B0E9c886c9cb9E3e5c1d0A65/sources/contracts/DAOToken.sol
Returns whether tokens can be minted in the given execution context.
function _canMint() internal view override returns (bool) { return msg.sender == owner(); }
1,898,441
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.7.0; pragma experimental ABIEncoderV2; // File: witnet-ethereum-block-relay/contracts/BlockRelayInterface.sol /** * @title Block Relay Interface * @notice Interface of a Block Relay to a Witnet network * It defines how to interact with the Block Relay in o...
Reads the length of the next CBOR item from a buffer, consuming a different number of bytes depending on the value of the `additionalInformation` argument.
function readLength(BufferLib.Buffer memory _buffer, uint8 additionalInformation) private pure returns(uint64) { if (additionalInformation < 24) { return additionalInformation; } if (additionalInformation == 24) { return _buffer.readUint8(); } if (additionalInformation == 25) { r...
901,245
pragma solidity ^0.4.11; import "./PrismLibData.sol"; import './SafeMath.sol'; import './IPrism.sol'; import './CerberusOracle.sol'; import './Registrar.sol'; import './PortfolioProposalLib.sol'; import './DecimalMath.sol'; library PortfolioLib { using PortfolioProposalLib for PortfolioProposalLib.Data; /******...
Returns the current market value of the given contract in ETH. /
function getValue(Data storage self) public constant returns (uint) { uint portValue = 0; uint coinPrice; address oracleAddress = Registrar(self.registrar).registry('oracle'); if (oracleAddress == 0x0) revert(); for (uint16 i=0; i<self.coinsHeld.length; i++){ uint coinAmount = self.coins[s...
12,723,136
./partial_match/1/0xEa5eDEF1169713C425ce57Cf5c154D732b1B7af6/sources/contracts/core/RcaShieldNormalized.sol
Interesting edgecase in which 1 person is in vault, they request redeem, underlying continue to gain value, then withdraw their original value. Vault is then un-useable because below we're dividing 0 by > 0.
function _rcaValue(uint256 _uAmount, uint256 _totalForSale) internal view override returns (uint256 rcaAmount) { uint256 balance = _uBalance(); if (balance == 0 || totalSupply() == 0 || balance < _totalForSale) { rcaAmount = _uAmount; rcaAmount = ((totalSupply() + pendingWit...
2,777,738
pragma solidity ^0.5.0; /** * @title Tellor Transfer * @dev Contais the methods related to transfers and ERC20. Tellor.sol and TellorGetters.sol * reference this library for function's logic. */ library TellorTransfer { using SafeMath for uint256; event Approval(address indexed _owner, address indexed _spende...
Functions/ Helps initialize a dispute by assigning it a disputeId when a miner returns a false on the validate array(in Tellor.ProofOfWork) it sends the invalidated value information to POS voting _requestId being disputed _timestamp being disputed _minerIndex the index of the miner that submitted the value being d...
function beginDispute(TellorStorage.TellorStorageStruct storage self, uint256 _requestId, uint256 _timestamp, uint256 _minerIndex) public { TellorStorage.Request storage _request = self.requestDetails[_requestId]; require(now - _timestamp <= 1 days, "The value was mined more than a day ago"); ...
12,861,363
/* Copyright 2019 The Hydro Protocol Foundation 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 applicabl...
Move asset from a balances map to another
function transfer( Store.State storage state, address asset, Types.BalancePath memory fromBalancePath, Types.BalancePath memory toBalancePath, uint256 amount ) internal { Requires.requirePathMarketIDAssetMatch(state, fromBalancePath, asset); R...
6,438,624
./partial_match/1/0x39B5B793f162BF5c90c34165DE0107f17dFacAE4/sources/contracts/CErc20Delegator.sol
The sender liquidates the borrowers collateral. The collateral seized is transferred to the liquidator. borrower The borrower of this cToken to be liquidated cTokenCollateral The market in which to seize collateral from the borrower repayAmount The amount of the underlying borrowed asset to repay return uint 0=succ...
function liquidateBorrow( address borrower, uint256 repayAmount, CTokenInterface cTokenCollateral ) external override returns (uint256) { bytes memory data = delegateToImplementation(abi.encodeWithSignature("liquidateBorrow(address,uint256,address)", borrower, repayAmount, cTokenCollateral)); re...
4,336,341
// File: contracts/libraries/TransferHelper.sol pragma solidity >=0.6.0; // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove( address token, address to, uint256 value ) internal { ...
Internal function to return the pair address on a given factory
function _pair(address tokenA, address tokenB, address factory) internal view returns (address pair) { require(exchangeFactoryWhitelist[factory], 'GnosisProtocolRelayer: INVALID_FACTORY'); pair = IDXswapFactory(factory).getPair(tokenA, tokenB); }
409,956
pragma solidity 0.4.16; library CommonLibrary { struct Data { mapping (uint => Node) nodes; mapping (string => uint) nodesID; mapping (string => uint16) nodeGroups; uint16 nodeGroupID; uint nodeID; uint ownerNotationId; uint addNodeAddressId; } struct Node { string nodeName; address producer; ...
buy stocks for starcoinswrite stockOwnerInfo and stockOwners for dividendstransfer starcoins to sellersave the transaction into event StocksTradeHistory;delete stockSellOrders[_node][_price][iii] and move each elementedit stockSellOrders[_node][_price][iii]buy stocks for starcoinswrite stockOwnerInfo and stockOwners fo...
function stockBuyCertainOrder(StarCoinLibrary.Data storage self, uint _node, uint _price, uint _amount, uint _thisOrderID) returns (bool) { require(self.balanceOf[msg.sender] >= _price*_amount); for (uint8 iii = 0; iii < self.stockSellOrders[_node][_price].length; iii++) { if (self.stockSellOrders[_node][_price...
2,114,748
pragma solidity ^0.4.20; /* * Team JUST presents.. * Proof Of Sunny Decree * -> What? * The original autonomous pyramid, improved: * [x] More stable than ever, having withstood severe testnet abuse and attack attempts from our community!. * [x] Audited, tested, and approved by known community security specialists such...
-- APPLICATION ENTRY POINTS --/
function Hourglass() public { ambassadors_[0xA72393CED6d615E9928FB443f42092f1dBb39c07] = true; }
14,904,529
./partial_match/56/0x4b99d3C782d9ca3f3bD91c1A7686AD319c02B292/sources/TokenVesting.sol
Allows the owner to revoke the vesting. Tokens already vested remain in the contract, the rest are returned to the owner. token BEP20 token which is being vested/
function revoke(IBEP20 token) public onlyOwner { require(_revocable, "TokenVesting: cannot revoke"); require(!_revoked[address(token)], "TokenVesting: token already revoked"); uint256 balance = token.balanceOf(address(this)); uint256 unreleased = _releasableAmount(token); u...
11,117,125
./full_match/1/0x8570EF8b2B793A0E641c9A6c0864c9968416DA75/sources/contracts/CryptoNinjaChildrenSBT.sol
================================================================== Override Ownerble for fail safe ==================================================================
function renounceOwnership() public view override onlyOwner { revert("Can not renounceOwnership. In the absence of the Owner, the system will not be operational."); }
9,776,511
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be *...
Changes the address of Rubic in the certain blockchain _blockchainNum Existing number of blockchain _RubicAddress The Rubic address/
function setRubicAddressOfBlockchain( uint128 _blockchainNum, bytes32 _RubicAddress ) external onlyOwnerAndManager { RubicAddresses[_blockchainNum] = _RubicAddress; }
2,531,598
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.6.0; import 'hardhat/console.sol'; import { UniswapV2Library } from '@uniswap/v2-periphery/contracts/libraries/UniswapV2Library.sol'; import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol'; import {SafeMath} from '@openzeppelin/contracts/math/...
Initiate physical settlement, locking obligations owned by the specified seller. In order to prevent replay attacks we require the use of `OP_RETURN` to embed the request id - the keccak256 hash of the contract address and a nonce which is incremented after each request. Caller is assumed to be the `buyer`. seller Ac...
function requestExercise(address seller, uint256 satoshis) external override canExercise { address buyer = msg.sender; uint256 options = calculateAmountIn(satoshis); _locked[seller] = _locked[seller].add(options); require( _locked[seller] <= _...
13,068,253
// File: @openzeppelin/contracts/utils/cryptography/MerkleProof.sol // OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Trees proofs. * * The proofs can be generated using the JavaScript library ...
Blinklist early mint function (sender must be Blinklisted - IYKYK)/limit supplyyou can only mint onceonly Blinklisted addresses can minttrack this wallet has minteddo it!!!
function blinklistMint(bytes32[] memory proof, bytes32 leaf) external payable callerIsUser{ require(mintMode == 1, "Blinklist mint only!"); require((totalSupply() + 2) < maxSupply, "We are sold out!"); require(BLHasMinted[msg.sender] != true, "You have already minted!"); require(isBl...
6,005,194
// SPDX-License-Identifier: MIT pragma solidity 0.8.3; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin...
Get a status NFT on sale _assetId - NFT id return isForSale - true if nft is for sale or false if nft is out of sale/
function getOnSale(uint256 _assetId) public view returns(bool isForSale) { return tokens[_assetId].isForSale; }
12,952,796
./full_match/8453/0x8512BfF6a9E0DCD62A2eECeCAE41c033359E3E16/sources/contracts/Libraries/SafeTransferLib.sol
Sends `amount` (in wei) ETH to `to`, with a `gasStipend`. The `gasStipend` can be set to a low enough value to prevent storage writes or gas griefing. Simply use `gasleft()` for `gasStipend` if you don't need a gas stipend. Note: Does NOT revert upon failure. Returns whether the transfer of ETH is successful instead. @...
function trySafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal returns (bool success) { assembly { success := call(gasStipend, to, amount, 0, 0, 0, 0) } }
11,555,346
//HEXBET.sol // // pragma solidity 0.6.4; import "./SafeMath.sol"; import "./IERC20.sol"; import "./HEX.sol"; import "./Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or ...
returns locking reward in hxb
function calcLockingRewards(address _user) public view returns(uint) { return (tokenLockedBalances[_user].div(2500) * (minLockDayLength + daysPastMinLockTime())); }
11,774,535
//SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.9.0; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/access/...
Withdraw LP tokens from Chef.
function withdraw(uint256 _amount) public nonReentrant { PoolInfo storage pool = poolInfo; UserInfo storage user = userInfo[msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(); uint256 pending = user.amount.mul(pool.accRewardPerShare)....
13,062,001
pragma solidity ^0.5.0; //Contracts are equivalent to classes contract ContentTracking { //Private variable hash array of type bytes32 bytes32[] public documentArray; //Pass in a document and hash function hashDocument(string memory document) private pure returns (bytes32) { ret...
Check a new document to see if contained in hashedDocument array
function newDocument(string memory document) public view returns(bool) { bytes32 newHashedDocument = hashDocument(document); for(uint256 i = 0; i < documentArray.length; i++){ if(documentArray[i] == newHashedDocument){ return true; } } ...
6,436,118
./full_match/3/0xD7b903AC1D7818b9712162cC47565429A5595EE6/sources/browser/github/NEST-Protocol/NEST-oracle-V3/VoteContract/Nest_3_VoteFactory.sol
check whether the vote is effective/
function ifEffective() private { if (_totalAmount >= _circulation) { _effective = true; } }
8,162,221
/* Copyright 2020 dYdX Trading 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 ...
Allows an account below the minimum collateralization to be liquidated by another account. This allows the account to be partially or fully subsumed by the liquidator. A proportion of all liquidation profits is directed to the insurance fund. Emits the LogLiquidatorProxyUsed event. liquidatee The account to liqu...
function liquidate( address liquidatee, bool isBuy, SignedMath.Int calldata maxPosition ) external returns (uint256) { I_PerpetualV1 perpetual = I_PerpetualV1(_PERPETUAL_V1_); perpetual.deposit(msg.sender, 0); P1Types.Balance memory initialBal...
12,681,860
pragma solidity 0.5.8; import "../interfaces/ISecurityToken.sol"; import "../interfaces/IOwnable.sol"; import "../interfaces/IDataStore.sol"; import "./DataStoreStorage.sol"; /** * @title Data store contract that stores data for all the modules in a central contract. */ contract DataStore is DataStoreStorage, IData...
Inserts a uint256 element to the array identified by the key _key Unique key to identify the array _data Element to push into the array/
function insertUint256(bytes32 _key, uint256 _data) external { _isAuthorized(); _setData(_key, _data, true); }
2,503,224
./full_match/4/0x164c24d0844c267DA15a4c841eaBae817d211EA1/sources/Users/hristiyangeorgiev/Documents/Projects/Redemeum/ERC20/bsn-core-prototype/contracts/ERC1155ERC721.sol
Safely transfers the ownership of a given token ID to another address If the target address is a contract, it must implement `onERC721Received`, which is called upon a safe transfer, and return the magic value `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, the transfer is reverted. R...
function safeTransferFrom(address _from, address _to, uint256 _tokenId) public override { safeTransferFrom(_from, _to, _tokenId, ""); }
13,350,708
./full_match/11155111/0x2d43c99479F4e5aE23fB930a3350D44b6a632CAa/sources/contracts/manifold/creator-core/core/CreatorCore.sol
Helper function to set royalties/
function _setRoyalties( address payable[] calldata receivers, uint256[] calldata basisPoints, RoyaltyConfig[] storage royalties ) private { for (uint i; i < basisPoints.length; ) { royalties.push( RoyaltyConfig({ receiver: receivers...
3,836,233
./full_match/5/0xa7Be4B4Bca2F64c6C9CB6f49D7F53824Fa4ABFb4/sources/project_/contracts/modules/wrapper/optional/DebtModule/CreditEventsModule.sol
Events / AccessControlUpgradeable inherits from ERC165Upgradeable AuthorizationModule inherits from AccessControlUpgradeable Security own function
function __CreditEvents_init(address admin) internal onlyInitializing { __Context_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); __AuthorizationModule_init_unchained(admin); __CreditEvents_init_unchained(); }
1,954,856
pragma solidity >=0.4.25 <0.6.0; pragma experimental ABIEncoderV2; import "../contracts/IToken.sol"; import "truffle/Assert.sol"; import "truffle/DeployedAddresses.sol"; import "../contracts/MatryxPlatform.sol"; import "../contracts/LibPlatform.sol"; import "../contracts/LibTournament.sol"; contract TestLibTournament...
set tournament balance set tournament owner create wData create rDetails current round is InReview submission must exist on platform
function testSelectWinnersCloseTournament() public { data.tournamentBalance[address(this)] = 20; data.tournaments[address(this)].info.owner = msg.sender; bytes32 winner = keccak256("winner"); bytes32 commitHash = keccak256("commit"); LibTournament.WinnersData memory wData...
12,733,566
pragma solidity ^0.5.10; import {SafeMath} from "@summa-tx/bitcoin-spv-sol/contracts/SafeMath.sol"; import {BytesLib} from "@summa-tx/bitcoin-spv-sol/contracts/BytesLib.sol"; import {BTCUtils} from "@summa-tx/bitcoin-spv-sol/contracts/BTCUtils.sol"; import {IBondedECDSAKeep} from "@keep-network/keep-ecdsa/contracts/ap...
Anyone can provide a signature that was not requested to prove fraud during funding ECDSA is NOT SECURE unless you verify the digest _d deposit storage pointer _v Signature recovery value _r Signature R value _s Signature S value _signedDi...
function provideFundingECDSAFraudProof( DepositUtils.Deposit storage _d, uint8 _v, bytes32 _r, bytes32 _s, bytes32 _signedDigest, bytes memory _preimage ) public { require( _d.inAwaitingBTCFundingProof(), "Signer fraud during fundin...
5,376,899