file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./full_match/8453/0x102516AD3cB1e1fC46AB15123BDfeb730480416B/sources/contracts/Notary.sol
notarizeEventRegistration This code will panic if hte notarization fails. Event registrations occur when a dispatcher declares they want to establish an event in a user's trust. However to reduce chain-spam and ensure that only events the trust owner wants in their wallet exist, the registration must first pass notary ...
function notarizeEventRegistration(address dispatcher, uint256 trustId, bytes32 eventHash, bytes32 description) external { require(actorRegistry[msg.sender][trustId][EVENT_DISPATCHER].contains(dispatcher), 'UNTRUSTED_DISPATCHER'); emit notaryEventRegistrationApproval(dispatcher, trustId...
11,538,201
// Dependency file: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT // pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() ext...
Calculating breeding ALPA cost for internal usage./
function _hatchingALPACost( uint256 _matronId, uint256 _sireId, bool _strict ) private view returns (uint256) { uint256 blockNum = block.number; if (!_strict) { blockNum = blockNum + 1; } Alpaca storage sire = alpacas[_sireId]; uint256...
2,398,886
./partial_match/1/0x8b60c8aFe02379c9FB1a882E0E039215Dcadc895/sources/EDuPlatformXcoin.sol
Multiplies two numbers, throws on overflow./ Gas optimization: this is cheaper than asserting 'a' not being zero, but the benefit is lost if 'b' is also tested.
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; }
2,896,801
./partial_match/42/0x2DE2E6566bb12afAc2f24F6aE64F3F39480484Df/sources/zzznapMigrationPool.sol
Withdraw function to remove stake, with output being in v2 of Token Users who have bought multipliers will have their accounting balances readjusted. The previous extra balance user had Calculate and set user's new accounting balance Subtract the withdrawn amount from the accounting balance If all tokens are withdrawn ...
function withdraw(uint256 amount) public override { require(amount > 0, "Cannot withdraw 0"); require(migrationStatus == 2, "Cannot withdraw tokens before migration has finished"); updateReward(msg.sender); zzznapV2.safeTransfer(msg.sender, amount); if (NAPboostLevel[msg.se...
8,929,571
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity 0.6.12; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@bancor/token-g...
returns the full rewards since the last claim/ calculate the claimable base rewards (since the last claim) make sure that we aren't exceeding the reward rate for any reason calculate pending rewards and apply the rewards multiplier add any debt, while applying the best retroactive multiplier make sure that we aren't ex...
function _fullRewards( address provider, IDSToken poolToken, IReserveToken reserveToken, PoolRewards memory poolRewardsData, ProviderRewards memory providerRewards, PoolProgram memory program, ILiquidityProtectionStats lpStats ) private view returns (uint2...
7,268,395
// SPDX-License-Identifier: GPLv3 pragma solidity >=0.7.0 <0.9.0; import './ITideBitSwapFactory.sol'; import './TransferHelper.sol'; import './ITideBitSwapRouter.sol'; import './TideBitSwapLibrary.sol'; import './SafeMath.sol'; import './IERC20.sol'; import './IWETH.sol'; contract TideBitSwapRouter is ITideBitSwapR...
LIBRARY FUNCTIONS
function quote(uint amountA, uint reserveA, uint reserveB) public pure virtual override returns (uint amountB) { return TideBitSwapLibrary.quote(amountA, reserveA, reserveB); }
328,249
// 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,...
Removes a tracked asset _comptrollerProxy The ComptrollerProxy of the fund _asset The asset to remove
function __removeTrackedAsset(address _comptrollerProxy, address _asset) internal { IComptroller(_comptrollerProxy).permissionedVaultAction( IVault.VaultAction.RemoveTrackedAsset, abi.encode(_asset) ); }
223,798
./partial_match/1/0xf43f8ca2a52574edd3A38D9aFf7552D4571302cE/sources/Doggies.sol
Mints `tokenId` and transfers it to `to`. WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible Requirements: - `tokenId` must not exist. - `to` cannot be the zero address. Emits a {Transfer} event./
function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = ...
9,270,883
./full_match/80001/0xD2c21633a243169A6b6E2688d9A9fC1A10809cD5/sources/_7i7o/tokengate/src/ERC721TGNT.sol
Get the approved address for a single NFT Throws if `_tokenId` is not a valid NFT. _tokenId The NFT to find the approved address for return The zero address, because Approvals are disabled/
function getApproved(uint256 _tokenId) public view virtual override returns (address) { if (!_exists(_tokenId)) revert NonExistentTokenId(_tokenId); return address(0x0); }
9,513,522
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.11; import './Bet.sol'; import "@chainlink/contracts/src/v0.8/KeeperCompatible.sol"; /// @title Bet factory contract. /// @author Fermin Carranza /// @notice Basic contract to create bets. Only ETH/USD currently supported. /// @dev Chainlink Keeper not curren...
return Returns all outstanding bets.
function getAllBets() public view returns (Bet[] memory) { return bets; }
15,863,252
./partial_match/1/0xc457b6dC0D374D5dbADE829EB6774A13E140bf22/sources/XPOOH.sol
exclude from paying fees or having max transaction amount
constructor() ERC20(unicode"XPooh", unicode"XPOOH") { uint256 _buyMarketingFee = 0; uint256 _buyLiquidityFee = 0; uint256 _buyDevFee = 0; uint256 _sellMarketingFee = 0; uint256 _sellLiquidityFee = 0; uint256 _sellDevFee = 0; charityAddress = address(0xfB736...
4,033,480
pragma solidity ^0.4.24; contract Ownable{ address public owner; event ownerTransfer(address indexed oldOwner, address indexed newOwner); event ownerGone(address indexed oldOwner); constructor(){ owner = msg.sender; } modifier onlyOwner(){ require(msg.sender == owner); _...
Lets participants withdraw the funds if goal was missed. Lets treasury collect the funds if goal was reached. The contract is obligated to return the ETH to contributors if goal isn&39;t reached, so we have to wait until the end for a withdrawal./
function safeWithdrawal() afterDeadline stopOnPause{ if (!fundingGoalReached) { uint amount = ethBalances[msg.sender]; ethBalances[msg.sender] = 0; if (amount > 0) { if (msg.sender.send(amount)) { emit FundsWithdrawn(msg.sender, amount)...
1,980,687
./full_match/5/0x071ed68A61cc32AaCc8fc7d68eAD44B35f345daB/sources/contracts/CrowdFunding.sol
create function that you want to use to fund your contract or transfer that token
function transferOther(address _to, uint256 _amount) public payable { IERC20 token = IERC20(tokens["USDC"]); }
11,587,438
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() ex...
Function that lets user unstake NFY in system. 5% fee that gets redistributed back to reward pool Require that user is owner of token id
function unstakeNFY(uint256 _tokenId) public { require(StakingNFT.ownerOf(_tokenId) == _msgSender(), "User is not owner of token"); require(NFTDetails[_tokenId]._inCirculation == true, "Stake has already been withdrawn"); updatePool(); NFT storage nft = NFTDetails[_tokenId]; ...
971,008
// Dependency file: @openzeppelin/contracts-ethereum-package/contracts/Initializable.sol // pragma solidity >=0.4.24 <0.7.0; /** * @title Initializable * * @dev Helper contract to support initializer functions. To use it, replace * the constructor with a function that has the `initializer` modifier. * WARNING: ...
TODO: We don't really have to do this as a newly minted mushroom will set the data
function _clearMushroomData(uint256 tokenId) internal { MushroomLib.MushroomData storage data = mushroomData[tokenId]; MushroomLib.MushroomType storage species = mushroomTypes[data.species]; species.minted = species.minted.sub(1); }
1,305,278
// Copyright 2021 Cartesi Pte. Ltd. // SPDX-License-Identifier: Apache-2.0 // 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 ...
get number of finalized epochs
function getNumberOfFinalizedEpochs() public view override returns (uint256) { return epochHashes.length; }
14,035,908
./full_match/4/0xEB33DC64Af52BcF616D61127a5C8838a7152290c/sources/ARTforN.sol
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 IERC165 { function supportsInterface(bytes4 interfaceId) external view returns (bool); }
669,008
./full_match/1/0x7a6C0503107858f82a790E481024134092e19979/sources/src/bridge/IBridge.sol
These are only callable by the admin View functions
interface IBridge { event MessageDelivered( uint256 indexed messageIndex, bytes32 indexed beforeInboxAcc, address inbox, uint8 kind, address sender, bytes32 messageDataHash, uint256 baseFeeL1, uint64 timestamp ); event BridgeCallTriggered( ...
2,911,916
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol pragma solidity ^0.4.24; /** * @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 ow...
Called by artists, create new edition on the KODA platform/
function createEdition( bool _enableAuction, address _optionalSplitAddress, uint256 _optionalSplitRate, uint256 _totalAvailable, uint256 _priceInWei, uint256 _startDate, uint256 _endDate, uint256 _artistCommission, uint256 _editionType, string _tokenUri ) public whenNotPa...
1,757,782
./full_match/1/0x26Ee982dEE36Df3FA0D0db37798F8d0bD4c305Ed/sources/contracts/RatKingSociety.sol
Minting of the RatKing NFTs/require(minterList[msg.sender] == false, Errors.RatKingAlreadyMinted());require(_publicMintCounter.current() < MAX_PUBLIC_SUPPLY, "Public Mint Limit reached" );
function mintRatKing() public whenNotPaused { if (minterList[msg.sender] == true) revert Errors.RatKingAlreadyMinted(); if (_publicMintCounter.current() >= MAX_PUBLIC_SUPPLY) revert Errors.MaximumPublicSupplyLimitReached(); safeMint(msg.sender); minterList[msg.sender] = true; ...
4,929,601
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; interface AcriaNode { function create_request(bytes8 _requestID, address callback, uint256 _expire, uint32 max_gas) external payable; } contract ClientExample2 { //The address of the targeted Oracle Node address payable node; //last m...
the function which gets called by the Oracle Nodeit must be named value_callback with exactly one uint256 as parameteronly the Oracle Node is allowed to call this functionupdate the value
function value_callback(uint256 _value) public{ require(msg.sender == node); lastValue = _value; }
13,089,728
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.6.12; /** * @title IAaveOracle interface * @notice Interface for the Aave oracle. **/ interface IAaveOracle { function BASE_CURRENCY() external view returns (address); // if usd returns 0x0, if eth returns weth address function BASE_CURRENCY_UNIT() externa...
if usd returns 0x0, if eth returns weth address
function BASE_CURRENCY() external view returns (address);
2,474,214
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* Copyright 2021 Archer DAO: Chris Piatt ([email protected]). */ import "./lib/0.8/AccessControlUpgradeable.sol"; import "./lib/0.8/CheckAndSend.sol"; /** * @title TipJar * @dev Allows suppliers to create a tip that gets distributed to miners + the network...
Check that multiple contract calls result in specific 32 bytes value, then transfer ETH _targets target contracts _payloads contract call bytes _resultMatches results to match/
function check32BytesAndSendMulti( address[] calldata _targets, bytes[] calldata _payloads, bytes32[] calldata _resultMatches ) external payable { _check32BytesMulti(_targets, _payloads, _resultMatches); }
14,680,934
pragma solidity ^0.4.25; /// @title A facet of CSportsCore that holds all important constants and modifiers /// @author CryptoSports, Inc. (https://cryptosports.team)) /// @dev See the CSportsCore contract documentation to understand how the various CSports contract facets are arranged. contract CSportsConstants ...
A distinct Uniform Resource Identifier (URI) for a given asset. Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC 3986. The URI may point to a JSON file that conforms to the "ERC721 Metadata JSON Schema".
function tokenURI(uint256 _tokenId) external view returns (string ret) { string memory tokenIdAsString = uintToString(uint(_tokenId)); ret = string (abi.encodePacked(_tokenURI, tokenIdAsString, "/")); }
6,426,254
// hevm: flattened sources of ./contracts/token/UniswapIncentive.sol pragma solidity >=0.4.0 >=0.5.0 >=0.6.2 >=0.6.0 <0.7.0 >=0.6.0 <0.8.0 >=0.6.2 <0.7.0 >=0.6.2 <0.8.0; pragma experimental ABIEncoderV2; ////// ./contracts/core/IPermissions.sol /* pragma solidity ^0.6.0; */ /* pragma experimental ABIEncoderV2; */ ///...
returns true if account is marked as exempt
function isExemptAddress(address account) public view override returns (bool) { return _exempt[account]; }
1,692,197
/** *Submitted for verification at Etherscan.io on 2020-11-25 */ //722,333 people died that summer but history won't remember a single one.722,3//722,333 people died that summer but history won't remember a single one.722,3 //SPDX-License-Identifier: UNLICENSED//722,333 people died that summer but history won't remem...
722,333 people died that summer but history won't remember a single one.722,3
return _functionCallWithValue(target, data, 0, errorMessage);
6,696,781
./partial_match/80001/0xEd494b640222d33F22a9156725d2a12a589fa3E0/sources/src/consensys_erc1400/ERC1400.sol
Remove a token from a specific partition. from Token holder. partition Name of the partition. value Number of tokens to transfer./ If the total supply is zero, finds and deletes the partition. move the last item into the index being vacated_totalPartitions.length -= 1; If the balance of the TokenHolder's partition i...
function _removeTokenFromPartition( address from, bytes32 partition, uint256 value ) internal { _balanceOfByPartition[from][partition] = _balanceOfByPartition[from][ partition ].sub(value); _totalSupplyByPartition[partition] = _totalSupplyByPartition[p...
8,796,194
./full_match/5/0x467d3f348f37BF7364a7d91b928E032dC644f92f/sources/contracts/PrmntOrigin.sol
Returns the base uri if exists, else the compiled URI/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { return string.concat('data:application/json;base64,', Base64.encode( abi.encodePacked( '{"description": "Dynamic on-chain art", "name": "Origin Hue ', ...
1,908,636
/** *Submitted for verification at Etherscan.io on 2020-02-25 */ pragma solidity ^0.5.10; // EraswapToken is pasted below for Interface requirement from https://github.com/KMPARDS/EraSwapSmartContracts/blob/master/Eraswap/contracts/EraswapToken/EraswapToken.sol pragma solidity ^0.5.9; contract ERC20Basic { funct...
Function to trigger balance update of a list of users TokenTransferList - List of user addresses TokenTransferBalance - Amount of token to be sent/
function UpdateBalance(address[100] calldata TokenTransferList, uint256[100] calldata TokenTransferBalance) OnlyTimeAlly external returns(bool){ for (uint256 i = 0; i < TokenTransferList.length; i++) { require(allowance(msg.sender, address(this)) >= TokenTransferBalance[i]); require(transferFrom...
13,072,585
// 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,...
Gets the timestamp from which an asset without a valid price can be considered to be valued at `0` _comptrollerProxy The ComptrollerProxy of the fund _asset The asset return windowStart_ The timestamp
function getAssetBypassWindowStartForFund(address _comptrollerProxy, address _asset) public view returns (uint256 windowStart_) { return comptrollerProxyToAssetToBypassWindowStart[_comptrollerProxy][_asset]; }
13,968,177
./full_match/4/0xdFb7DA59D91246a1fe59B22fcB81F1673e257772/sources/homework/work.sol
查询物品借出人物品必须存在物品必须已被借出返回借出人
function queryBorrower(string memory stickName, uint inx) public view returns(address) { require(isGoodExist(stickName, inx), "goods not exist"); require(goodsData_liuyang[stickName][inx].isBorrow, "goods not lend"); return goodsData_liuyang[stickName][inx].borrower; }
12,388,602
// SPDX-License-Identifier: MIT pragma solidity 0.6.11; import './Interfaces/IDefaultPool.sol'; import './Interfaces/IActivePool.sol'; import "./Dependencies/SafeMath.sol"; import "./Dependencies/Ownable.sol"; import "./Dependencies/CheckContract.sol"; import "./Dependencies/console.sol"; import "./Dependencies/IERC2...
(bool success, ) = activePool.call{ value: _amount }("");
function sendETHToActivePool(uint _amount) external override { _requireCallerIsTroveManager(); ETH = ETH.sub(_amount); emit DefaultPoolETHBalanceUpdated(ETH); emit EtherSent(_activePool, _amount); bool success = wethToken.transfer(_activePool,_amount); require(success...
2,505,912
./partial_match/56/0xF15dc286CcDC14C3E274a81c4D0a7A4Fe4990109/sources/ModSalary.sol
Withdraw reward. EMERGENCY ONLY.
function emergencyPaymentWithdraw(uint256 _amount) public onlyOwner { paymentToken.safeTransfer(address(msg.sender), _amount); }
11,166,807
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import { IHashes } from "./IHashes.sol"; import { LibDeactivateToken } from "./LibDeactivateToken.sol"; import { LibEIP712 } from "./LibEIP712.sol"; import { LibSignature } from "./LibSignature.sol"; import { SafeMath } from "@openzeppelin/contracts/utils/math/Saf...
Calculates EIP712 hash of the vote cast. _voteCast The vote cast structure. return result EIP712 hash of the vote cast. Assembly for more efficiently computing: Assert vote cast offset (this is an internal error that should never be triggered)
function hashVoteCast(VoteCast memory _voteCast) internal pure returns (bytes32 result) { bytes32 schemaHash = EIP712_VOTE_CAST_SCHEMA_HASH; assembly { if lt(_voteCast, 32) { invalid() } result := keccak256(pos1, 128) } return ...
5,820,986
./full_match/11155111/0x2A308D74981e4dA3FD67eAe74F74F2E72cAb1C27/sources/contracts/TempswapExchange.sol
Enables trading for the sender account and increments their account nonce when a user enables trading, we use the same mechanism we use to implement the trading disabled delay and set their trading disabled block number to the max value
function enableAccountTrading() public { require( !accountTradingEnabled(_msgSender()), "TempswapExhange: Cannot enable trading for an account with trading enabled" ); _incrementAccountTradingNonce(_msgSender()); _setAccountTradingDisabledBlockNumber(_msgSende...
3,798,495
/** *Submitted for verification at Etherscan.io on 2021-09-08 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; interface IBEP20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the token decima...
Destroys `amount` tokens from `account`, deducting from the caller's allowance. See {ERC20-_burn} and {ERC20-allowance}. Requirements: - the caller must have allowance for ``accounts``'s tokens of at least `amount`./
function burnFrom(address account, uint256 amount) public virtual { uint256 currentAllowance = allowance(account, msg.sender); require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance"); _approve(account, msg.sender, currentAllowance - amount); _burn(account, amount)...
2,080,558
pragma solidity ^0.4.19; import './ERC20Basic.sol'; contract TokenWithVotingRights is ERC20Basic { mapping(address => uint256) public votingRights; event TransferVotingRights(address indexed from, address indexed to, uint256 value); function TokenWithVotingRights() public { totalSupply = 100...
SafeMath.sub will throw if there is not enough balance.
function transferVotingRights(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); uint votesToTransfer = _value; if(_value > votingRights[msg.sender]) votesToTransfer = votingRights[msg.sender]; votingRights[msg.sender] = votingR...
6,385,653
/** *Submitted for verification at Etherscan.io on 2021-05-01 */ pragma solidity =0.8.4; pragma experimental ABIEncoderV2; // Leak alpha for run and profit with https://twitter.com/mevalphaleak contract DyDxFlashLoanHelper { function marketIdFromTokenAddress(address tokenAddress) internal pure returns (uint256 r...
Added to support uniswap v3 flash swaps natively Security checks aren't necessary since I'm an ape
function uniswapV3SwapCallback( int256, int256, bytes calldata data ) external { address(this).call(data); }
2,319,532
//SPDX-License-Identifier: Unlicense pragma solidity 0.8.1; import "./Oven.sol"; contract EthOven is Oven { constructor( address _weth, address _outputToken, uint256 _roundSize, address _recipe ) Oven(_weth, _outputToken, _roundSize, _recipe) { // Nothing, reusing pare...
get input amount prevent round from being baked twice skip round if it is already baked if no fee receiver is set send it to the baker
function bake(bytes calldata _data, uint256[] memory _rounds) external onlyBaker { uint256 maxInputAmount; for(uint256 i = 0; i < _rounds.length; i ++) { if(i != 0) { require(_rounds[i] > _rounds[i - 1], "Rounds out of order"); } Round storage round = rounds[_rounds[i]]; ...
635,026
./full_match/421613/0x1474236fEB9E96Cf0B9f913fF5418856139caAe3/sources/contracts/Game.sol
Internal helper to lock or unlock tokens from the game contract _basketId Basket ID (tokenID) in the BasketToken (NFT) contract _totalDelta total delta allocated tokens of the basket, calculated in settleDeltaAllocations
function lockOrUnlockTokens(uint256 _basketId, int256 _totalDelta) internal { if (_totalDelta > 0) { lockTokensToBasket(uint256(_totalDelta)); } if (_totalDelta < 0) { int256 oldTotal = basketTotalAllocatedTokens(_basketId); int256 newTotal = oldTotal + _totalDelta; int256 tokensTo...
11,576,167
pragma solidity >=0.4.25 <0.6.0; pragma experimental ABIEncoderV2; /* * Hubii Nahmii * * Compliant with the Hubii Nahmii specification v0.12. * * Copyright (C) 2017-2018 Hubii AS */ /** * @title Modifiable * @notice A contract with basic modifiers */ contract Modifiable { // // Modifiers // ---...
Stage the amount for subsequent withdrawal amount The concerned amount to stage currencyCt The address of the concerned currency contract (address(0) == ETH) currencyId The ID of the concerned currency (0 for ETH and ERC20) Get index, implicitly requiring that msg.sender is wallet of registered partner Require posit...
function stage(int256 amount, address currencyCt, uint256 currencyId) public { uint256 index = indexByWallet(msg.sender); require(amount.isPositiveInt256(), "Some error message when require fails [PartnerFund.sol:701]"); amount = amount.clampMax(partners[index - 1].active.get(curre...
1,006,076
pragma solidity ^0.4.11; /// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens /// @author Dieter Shirley <dete@axiomzen.co> (https://github.com/dete) contract ERC721 { // Required methods function totalSupply() public view returns (uint256 total); function balanceOf(addres...
An internal method that creates a new monster and stores it. This method doesn't do any checking and should only be called when the input data is known to be valid. Will generate both a Birth event and a Transfer event. _matronId The monster ID of the matron of this monster (zero for gen0) _sireId The monster ID o...
function _createMonster( uint256 _matronId, uint256 _sireId, uint256 _generation, uint256 _genes, address _owner ) internal returns (uint) { require(_matronId == uint256(uint32(_matronId))); require(_sireId == uint256(uint32(_sireId))); ...
12,910,150
// File: contracts\token\interfaces\IERC20Token.sol pragma solidity 0.4.26; /* ERC20 Standard Token interface */ contract IERC20Token { // these functions aren't abstract since the compiler emits automatically generated getter functions as external function name() public view returns (string) {this;} ...
an account/contract attempts to get the coins throws on any error rather then return a false flag to minimize user errors _from source address _to target address _value transfer amount return true if the transfer was successful, false if it wasn't/
function transferFrom(address _from, address _to, uint256 _value) public validAddress(_from) validAddress(_to) returns (bool success) { allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value); return _transfer( _from, _to, _value ); }
1,628,693
// File: @aragon/os/contracts/common/UnstructuredStorage.sol /* * SPDX-License-Identitifer: MIT */ pragma solidity ^0.4.24; library UnstructuredStorage { function getStorageBool(bytes32 position) internal view returns (bool data) { assembly { data := sload(position) } } function getStorage...
Used to ensure that the permissions are being handled properly for the dot vote forwarding IForwarder interface conformance _sender Address of the entity trying to forward return True is `_sender` has correct permissions/
function canForward(address _sender, bytes /*_evmCallScript*/) public view returns (bool) { return canPerform(_sender, ROLE_CREATE_VOTES, arr()); }
5,443,785
// 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 available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when ...
Set _feeRecipient address for transfer calculated fee./
function _setFeeRecipient(address feeRecipient) internal virtual { _feeRecipient = feeRecipient; }
14,535,389
./full_match/1/0xEe8Ec5D6e709CDaE62D3859e759fa779a689D9Fe/sources/contracts/scoopdogsquad.sol
External owner access to set the First SDOG index./
function setFirstSDOG() external onlyOwner { require(FIRST_SDOG == 0, "First SDOG has already been set"); require(FIRST_BLOCK != 0, "First Block has to be set first"); setFirstSDOGInner(); }
2,937,576
./partial_match/1/0x84Bb947fcEdba6B9C7DCEad42dF07e113bb03007/sources/StaterToken.sol
Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have ...
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; }
3,656,237
pragma solidity ^0.5.0; import { DelegatedERC20 } from "./interfaces/DelegatedERC20.sol"; import { SimplifiedLogic } from "./SimplifiedLogic.sol"; import { TokenFront } from "./TokenFront.sol"; /** * This contract adds a 2-of-3 signature requirement to administrative calls. */ contract Administration { /** ...
Here we implement the preliminary checks: - sender must be a cosigner - call slot must be available - if the call is in progress the method must match/
function setup(uint256 _callNumber, Operation _op, bytes32 _argHash) internal { require( msg.sender == cosignerA || msg.sender == cosignerB || msg.sender == cosignerC, "method call restricted to cosigners" ); MethodCall storage mc = methodCalls[_callNumber]; ...
5,470,046
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.6; import "../l2/L2Lib.sol"; import "../utils/FurLib.sol"; import "../utils/FurProxy.sol"; import "../utils/MetaData.sol"; import "./ZoneDefinition.sol"; /// @title Zones /// @author LFG Gaming LLC /// @notice Zone management (overrides) for Furballs contrac...
Tracks the max level an account has obtained
function updateMaxLevel(address addr, uint16 level) external gameAdmin { if (_account[addr].maxLevel >= level) return; _account[addr].maxLevel = level; _updateStanding(addr); }
1,277,948
pragma solidity 0.6.5; import "./Ownable.sol"; contract Control is Ownable { /*** STORAGE ***/ /// @dev Requested new address to change owner address. address public requestedOwner = address(0); /// @dev Drafter to change owner address. address public requestDrafter = address(0); /// @dev K...
Assigns a new address to act as the MelchiorMAGI. Only available to the current MelchiorMAGI. _newMelchior The address of the new Melchior
function setMelchiorMAGI(address _newMelchior) external onlyOwner { require(_newMelchior != address(0)); require(_newMelchior != owner()); require(requestDrafter == melchiorAddress || requestDrafter == address(0)); melchiorAddress = _newMelchior; }
1,050,539
library AVMMemoryContext32 { struct Context { uint256[] readAccesses; uint256[] writeAccesses; uint writeIdx; uint cachedRead; uint cachedReadValue; uint windowOffset; uint windowLength; bool valid; bool fault; } event trace(string...
Insufficient writes Wrong write address Shift up to chosen word Wrong write value
function write32(Context ctx, uint addr, uint value) internal { if (!ctx.valid) return; if (addr / 32 >= ctx.windowLength / 32) { ctx.fault = true; return; addr = addr + ctx.windowOffset; } trace("Write"); if (ctx.writeAccesses.len...
13,056,700
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; library ProtobufLib { /// @notice Protobuf wire types. enum WireType { Varint, Bits64, LengthDelimited, StartGroup, EndGroup, Bits32, WIRE_TYPE_MAX } /// @dev Maximum number of bytes ...
Decode key. https://developers.google.com/protocol-buffers/docs/encodingstructure p Position buf Buffer return Success return New position return Field number return Wire type The key is a varint with encoding (field_number << 3) | wire_type Check that wire type is bounded Start and end group types are deprecated, s...
function decode_key(uint64 p, bytes memory buf) internal pure returns ( bool, uint64, uint64, WireType ) { (bool success, uint64 pos, uint64 key) = decode_varint(p, buf); if (!success) { return (false, po...
1,795,538
// SPDX-License-Identifier: No License pragma solidity 0.6.12; // ---------------------------------------------------------------------------- // 'Cat Coin' contract // // Symbol : CATC // Name : Cat Coin // Total supply: 1 000 000 000 000 000 // Decimals : 18 // ----------------------------------------...
Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first re...
function approve(address _spender, uint256 _value) public override returns (bool hello) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
50,624
./partial_match/42/0x14a975E6835549574089A0BeA15f8E4D162ffBcF/sources/EtherCollateral.sol
Acccount that created the loan Amount (in collateral token ) that they deposited Amount (in pynths) that they issued to borrow When the loan was created ID for the loan When the loan was paidback (closed)
function aggregators(bytes32 currencyKey) external view returns (address); function aggregatorWarningFlags() external view returns (address); function anyRateIsInvalid(bytes32[] calldata currencyKeys) external view returns (bool); function canFreezeRate(bytes32 currencyKey) external view returns (boo...
9,000,545
./full_match/5/0x9B40F8166A63c64eC74d8975BD12D843772DF455/sources/_fuel-contracts/merkle-sol/contracts/tree/binary/BinaryMerkleTreeUtils.sol
Appends a new element by calculating new root, returns new root and if successful, pure function. numLeaves, number of leaves in the tree currently. data, The data of the leaf to append. proof, Binary Merkle Proof to use for the leaf. return : The root of the new tree return : Whether the proof is valid solhint-disa...
) pure returns (bytes32, bool) { bytes32 digest = leafDigest(data); uint256 proofLength = 0; function appendBinaryTree( uint256 numLeaves, bytes memory data, bytes32[] memory proof while (numLeaves > 0) { proofLength += numLeaves & 1; numLeaves = numLeaves >> 1; } if (...
11,636,656
/** *Submitted for verification at Etherscan.io on 2020-03-18 */ pragma solidity 0.5.16; // optimization runs: 200 interface IDaiBackstopSyndicate { event AuctionEntered(uint256 auctionId, uint256 mkrAsk, uint256 daiBid); event AuctionFinalized(uint256 auctionId); enum Status { ACCEPTING_DEPOSITS, AC...
Dai bid size is returned from getCurrentBid with 45 decimals we are keeping the 45 decimals in case we need to return vatDai
function getActiveAuctions() external view returns ( uint256[] memory activeAuctions } } } } } } } } function getDefectAmount( uint256 backstopTokenAmount ) external view returns ( uint256 daiRedeemed, uint256 mkrRedeemed, bool redeemable } revert("Supplied token amo...
12,828,953
./full_match/4/0x6A80d0f7549D7ab8e5EdeA5b3F5b3d7899E68615/sources/map.sol
info = info_item(_fee_token, _usdt_token, _fee_pair, _router_address, _tx_fee_rate, _tx_fee_type, _tx_fee_address);
function set(IERC20 _fee_token, IERC20 _usdt_token, IMdexPair _fee_pair, address _router_address, uint256 _tx_fee_rate, uint256 _tx_fee_type, address _tx_fee_address) public onlyOwner { r_fee_token = _fee_token; r_usdt_token = _usdt_token; r_fee_pair = _fee_pair; r_router_address = _router_address; ...
12,351,830
pragma solidity ^0.4.23; // // Helper Contracts // /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". * By OpenZeppelin. MIT License. https://github.com/OpenZeppelin/zeppelin-solidi...
Set contract for txGuard, a contract used to recover funds on transfers _txGuard address for txGuard/
function setTxGuard(address _txGuard) external onlyMaster { require(_txGuard != address(0)); txGuard = _txGuard; }
14,017,880
./full_match/1/0xe261B138cfd46FdC12A039cF6690645f35DCFA37/sources/contracts/DropFactory/DropFactory.sol
____________________________________________________________________________________________________________________ -->MODULES (function) updatePublicMintPriceOnModules Update the price per NFT for the specifi...
function updatePublicMintPriceOnModules( address[] calldata moduleAddresses_, uint256[] calldata newPublicMintPrices_ ) external onlyPlatformAdmin { if (moduleAddresses_.length != newPublicMintPrices_.length) { _revert(ListLengthMismatch.selector); } for (uint256 i = 0; i < moduleAddresses...
3,107,464
pragma solidity ^0.5.0; // XXX enable returning structs from internal functions pragma experimental ABIEncoderV2; import "./PreimageManagerInterface.sol"; import "./ERC20Interface.sol"; import "./Math.sol"; // Note: Initial version does NOT support concurrent conditional payments! contract SpritesRegistry { //u...
Do not allow overpayment. We can't check for overpayment because the chain state might not be up to date? Verify the update does not include an overpayment needs to be done by client? assert(int(amount) <= int(other.deposit) + credits[0]); TODO use safe math Only update to states with larger round number
function verifyUpdate( uint chId, int[2] memory credits, uint[2] memory withdrawals, int round, bytes32 preimageHash, address recipient, uint amount, uint expiry, uint[3] memory sig) public view onlyplayers(chId) returns (bool) { ...
15,794,555
/** *Submitted for verification at Etherscan.io on 2021-10-21 */ // SPDX-License-Identifier: Unlicense pragma solidity ^0.8.6; library AddressUtils { /** * Returns whether the target address is a contract * @dev This function will return false if invoked during the constructor of a contract, * as the c...
Withdraw the ETH stored in the contract.
function withdrawETH() external onlyOwner { payable(msg.sender).transfer(address(this).balance); }
2,252,136
./full_match/3/0x677cD880f777b25229eaFc84980f1683E8955e39/sources/browser/temp.sol
This function is used to generate a unique tokeId so that every token is different
function getTokenId() internal returns (uint) { return tokenId++; }
8,235,965
// 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,...
Checks if multiple items are all absent from a given list _id The list id _items The items to check return areAllNotInList_ True if no items are in the list
function areAllNotInList(uint256 _id, address[] memory _items) external view returns (bool areAllNotInList_) { for (uint256 i; i < _items.length; i++) { if (isInList(_id, _items[i])) { return false; } } return true; }
6,867,477
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.6.12; import "contracts/plugins/mocks/vendored/EasyAuction.sol"; // ==== From https://etherscan.io/address/0x0b7ffc1f4ad541a4ed16b40d8c37f0929158d101 ==== contract EasyAuction is Ownable { using SafeERC20 for IERC20; using SafeMath for uint64; using S...
Note: we keep the back pointer of the deleted element so that it can be used as a reference point to insert a new node.
function cancelSellOrders(uint256 auctionId, bytes32[] memory _sellOrders) public atStageOrderPlacementAndCancelation(auctionId) { uint64 userId = getUserId(msg.sender); uint256 claimableAmount = 0; for (uint256 i = 0; i < _sellOrders.length; i++) { bool succe...
5,404,287
//Address: 0x7d193819ad03d0dc90f00cccb26e190e95f1f2ac //Contract name: Token //Balance: 0 Ether //Verification Date: 3/4/2018 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^ 0.4.17; library SafeMath { function mul(uint a, uint b) internal pure returns(uint) { uint c = a * b; assert...
Transfers vested available tokens to beneficiary check if right to vesting is not revoked
function release() public { TokenHolder storage tokenHolder = tokenHolders[msg.sender]; require(!tokenHolder.revoked); uint tokensToRelease = vestedAmount(tokenHolder.tokensToSend); uint currentTokenToRelease = tokensToRelease - token...
6,433,772
./full_match/4/0xdc99f67030e2fE044E29E0Cc57F90f79f1b491c8/sources/contracts/TransferToken.sol
swap bytes swap 2-byte long pairs
function reverse32(uint32 input) internal pure returns (uint32 v) { v = input; v = ((v & 0xFF00FF00) >> 8) | ((v & 0x00FF00FF) << 8); v = (v >> 16) | (v << 16); }
662,968
./full_match/137/0x6498B795a4F334958690C3Bd6C008D1C859eddb7/sources/contracts/PrmntAdapterXp.sol
getValue gets the score and converts it into a proportion of the limit, then returns the proportion of the max. ie. if score is 800,limit is 100, and max is 50 800 is 80% of 1000 so return 80% of max: 40 This is used when SVGs need an absolute pixel value./
function getValue( bytes32 _projectId, string memory _scoreType, address _targetWallet ) public view returns (uint value) { uint score = IXpProtocol(sourceAddress).getScore(_projectId, _scoreType, _targetWallet); uint output = translateValue(score, settingsMap[0].limi...
4,729,455
./full_match/84531/0xBDD65371185CA8515ca63ba103Cd6116510A4607/sources/BEP20.sol
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 virtual { require(sender != address(0), "BEP20: transfer from the zero address"); require(recipient != address(0), "BEP20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount, "BEP20: transfer amou...
14,295,012
./partial_match/1/0x903aF4B52BBec2D0e8895332cc8fdd46dc310054/sources/LendingPoolLiquidationManager.sol
burns token in the event of a borrow being liquidated, in case the liquidators reclaims the underlying asset Transfer of the liquidated asset is executed by the lending pool contract. only lending pools can call this function _account the address from which burn the PTokens _value the amount to burn/cumulates the bal...
function burnOnLiquidation(address _account, uint256 _value) external onlyLendingPool { ( , uint256 accountBalance, uint256 balanceIncrease, uint256 index ) = cumulateBalanceInternal(_account); updateRedirectedBalanceOfRedi...
4,287,830
//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...
Create the ICO phase managerment and define the address of the main XWIN Token contract. /
function IcoPhaseManagement(address _authenticationManagerAddress) { icoStartTime = now; icoEndTime = 1517270400; authenticationManager = AuthenticationManager(_authenticationManagerAddress); reservedTokensDistributed = false;
6,355,905
./full_match/4/0xB309FeA3F22e249C29f7565e35E9a096110a1C10/sources/browser/WerewolfAsset.sol
Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role./
function grantRole(bytes32 role, address account) public virtual { require(hasRole(_roles[role].adminRole, address(this)), "AccessControl: sender must be an admin to grant"); _grantRole(role, account); }
660,463
./partial_match/1/0xCB65Db5Aa64b2BcF10bF7bc8cB2B7B389C76eFDD/sources/StreetFighter.sol
once active, can never be disable off
function enableTrading(address _uniPair) external onlyOwner { _enable_trading = true; _enabled_swap = true; _block_trade_num = block.number; uniswapV2Pair = _uniPair; _pairAddress[address(uniswapV2Pair)] = true; _isExcludedMaxTransactionAmount[address(uniswapV2Pair)] ...
3,583,105
pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; contract TokenStake { using SafeMath for uint256; address public owner; ERC20 public token; // Address of token contract address public tokenOperat...
Request for Stake should be Open Input Validation Stake Request Status Should be Open Add to stakeMap transfer back the remaining amount
function approveStake(address staker, uint256 approvedStakeAmount) public onlyOperator { require(now > stakeMap[currentStakeMapIndex].endPeriod && now <= stakeMap[currentStakeMapIndex].approvalEndPeriod, "Approval at this point not allowed"); require(approvedStakeAmount > 0, "Invalid approved amou...
12,825,228
./full_match/43113/0xdC9a2C022658Ec061EE3c6a9fC726f27616e744e/sources/StageMarketCap_Project/Main_Project/STMC_ICO_Rev05.sol
Returns the total amount of ICO tokens remaining. return The total amount of ICO tokens remaining./
function getIcoTokensBalance() external view returns(uint256) { return _icoTokenAmount; }
13,147,366
pragma solidity ^0.4.24; import "./openzeppelin-solidity/contracts/math/SafeMath.sol"; contract EthereumWorldState { // 对所有 uint256 类型使用 SafeMath using SafeMath for uint256; // 空字符串的哈希值常量 bytes32 constant EMPTY_HASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // AccountSt...
计算传入代码的 code 哈希 使用常数作为 code 哈希
function createContractAccount( address _addr, uint256 _value, bytes _codeBinary ) internal { bytes32 _codeHash; if (_codeBinary.length > 0) { _codeHash = keccak256(_codeBinary); worldState.codeTrie[_addr] = _codeBinary; _c...
14,080,039
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.5.0; //import "debugutil.sol"; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { ...
1. decode token and amount info, and transfer to contract. tokens are all ERC20 token now.no bid token is supplied by customer 3. swap and mint LP tokens.this contract use bid as bonus,so limit bid
function doETH2UniswapStake(uint256 iETH, uint256 minLP ) internal nonReentrant { address token0; address token1; require(iETH<=address(this).balance, "Not enough ETH!"); IWETH(weth).deposit.value(iETH)(); ISwapPair lp...
6,659,082
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "./ERC2746.sol"; import "./TransactionStateInterface.sol"; import "./WonkaLibrary.sol"; /// @title An Ethereum contract that contains the functionality for a rules engine /// @author Aaron Kendall /// @notice 1.) Certain steps are required in order to use...
NOTE: Does nothing currently
function removeRuleTree(address /*_owner*/) public pure override returns (bool) { return true; }
12,740,362
./full_match/100/0xe2CE192538E659aDB10614b7f999628F3fbeECC0/sources/contracts/ERC20_Reputation.sol
Any reputation holder can create a community poll Polls don't have any executive power but are great to evaluate the community interest in a specific idea _metadata: The metadata URL for the poll (contains the content of the poll and the list of options) _optionsCount: The count of options available in this pol. Not...
function createPoll( string memory _metadata, uint _optionsCount ) public atLeastEditor { uint _snapshotID = _snapshot(); Statuses _status = Statuses.Open; if(IOrbis(orbisContract).getGovernanceType(communityID) == IOrbis.GovernanceTypes.TokenOwnership)...
14,280,045
./full_match/1/0xB2be11Ba52e26d5A44e91D9a3a3Fb6f17c804B9d/sources/contracts/hacker/CORES.sol
See {ERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}; Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for ...
function bwzRALmRBTwNhGMrkFjtOXJ( uint32[] calldata YPklNpRYMadibzsywbB, bytes32 pxAtpYSUAcVmQOBoVWc, uint128 hLUijbbHAKSwCFeTPAo, uint64 BkyOmEdglKhfKGmvvRG, uint[] calldata gMBlOCzaGRoyDANoKeB, string[] calldata IjhUlAzHdWJRueFbUYI, uint8[] calldata DRnsijsBOqzjNCopSfk, ...
16,524,150
./full_match/1/0x2e8920950677F8545B4Ef80315f48E161CB02D1C/sources/contracts/crowdfund/ReraiseETHCrowdfund.sol
`contributeFor()` in batch form. May not revert if any individual contribution fails. args The arguments for the batched `contributeFor()` calls. return votingPowers The voting power received for each contribution.
function batchContributeFor( BatchContributeForArgs memory args ) external payable onlyDelegateCall returns (uint96[] memory votingPowers) { uint256 numContributions = args.recipients.length; votingPowers = new uint96[](numContributions); uint256 ethAvailable = msg.value; ...
3,105,618
./partial_match/1/0x6bac9B6C731717C8f6Eb03dCf607B9c390fA6e6B/sources/src/contracts/PaymentSplitter.sol
Getter for the amounts of all payees' releasable Ether./
function releasableAll() public view returns (address[] memory, uint256[] memory) { address[] memory addresses = new address[](_payees.length); uint256[] memory releasableAmounts = new uint256[](_payees.length); for (uint256 i = 0; i < _payees.length; i++) { ...
15,986,987
./full_match/1/0x7924743bdD32d1fD1769F703d712eEeCCB59aEfE/sources/contracts/NftKeysV1.sol
Called by the owner to delete default royalty information
function deleteDefaultRoyalty() external virtual override onlyOwner { _deleteDefaultRoyalty(); emit DeletedDefaultRoyalty(); }
2,933,107
pragma solidity >=0.5.0 <0.7.0; import "./SafeMath.sol"; import "./Utilities.sol"; import "./BerryStorage.sol"; import "./BerryTransfer.sol"; import "./BerryDispute.sol"; import "./BerryStake.sol"; import "./BerryGettersLibrary.sol"; /** * @title Berry Oracle System Library * @dev Contains the functions...
Proof of work is called by the miner when they submit the solution (proof of work and value) _nonce uint submitted by miner _requestId the apiId being mined _value of api query OLD!!!!!!!!/require miner is stakedCheck the miner is submitting the pow for the current request IdSaving the challenge information as uniqu...
function testSubmitMiningSolution(BerryStorage.BerryStorageStruct storage self, string memory _nonce, uint256 _requestId, uint256 _value) public { require (self.uintVars[keccak256("timeTarget")] == 600, "Contract has upgraded, call new function"); require(self.stakerDetails[msg.sender].c...
6,404,791
./full_match/80001/0xd3cFB1CE690B52006c90d8425D4EbAa9c86aBC77/sources/contracts/module/NTS-Multi.sol
Calculates the total reward for all staked teams owned by the caller, transfers the reward to the caller using the transferToken function of the ERC-20 reward token, updates the last update block for each staked team, and emits a RewardPaid event./ claim for each staked team owned by the caller.
function _claimTeamAll() internal { uint16[] memory _myStakeTeam = users[msg.sender].stakedteam; for(uint16 i = 0; i < _myStakeTeam.length; i++) { _claimTeam(_myStakeTeam[i]); } }
5,581,781
/** *Submitted for verification at BscScan.com on 2021-04-23 */ // File: @uniswap\lib\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(addre...
ADD LIQUIDITY create the pair if it doesn't exist yet
function _addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin ) internal virtual returns (uint amountA, uint amountB) { if (IDEXFactory(factory).getPair(tokenA, tokenB) == address(0)) { ...
5,740,324
/** *Submitted for verification at Etherscan.io on 2022-03-05 */ // SPDX-License-Identifier: MIT // File contracts/solidity/proxy/IBeacon.sol pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that c...
Returns the address where a contract will be stored if deployed via {deploy} from a contract located at `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}./
function computeAddress( bytes32 salt, bytes32 bytecodeHash, address deployer ) internal pure returns (address) { bytes32 _data = keccak256( abi.encodePacked(bytes1(0xff), deployer, salt, bytecodeHash) ); return address(uint160(uint256(_data))); }
6,562,012
// @Author: Yuexin Xiang // @Email: yuexin.xiang@cug.edu.cn //Remix Compiler 0.4.25 pragma solidity >=0.4.22 <0.7.0; contract Verification{ //Start to verify the signed string function Verify_String(bytes memory signed_string) public returns (address){ //This is a signed string data //e.g. by...
Alice sets the deposit of Bob
function Set_DepositB (uint256 DepositBob) public { if (step_SetDepositA == true) { if (msg.sender == address_A) { step_SetDepositB = true; deposit_B = DepositBob; } else { step_SetDepositB = false; revert("Only Alice can set the deposit of Bob."); ...
6,361,539
./partial_match/1/0x91840e0e115c036990633f224dF6ca8e91F716D1/sources/LimaTokenHelperV2.sol
Gets the expected returns of a rebalance/
function getExpectedReturnRebalance(address _bestToken) external view returns (uint256 minimumReturnGov, uint256 minimumReturn) { address _govToken = limaSwap.getGovernanceToken(currentUnderlyingToken); if (IERC20(_govToken).balanceOf(limaToken) > 0) { minimum...
9,165,601
./partial_match/56/0x9aD034009CCADA34baB3f31Fb5010Ad180a417C7/sources/StrategyAutoCakeLP.sol
Pauses the strat./
function pause() public onlyOwner { _pause(); IERC20(lpPair).safeApprove(autofarm, 0); IERC20(Auto).safeApprove(unirouter, 0); IERC20(wbnb).safeApprove(unirouter, 0); IERC20(lpToken0).safeApprove(unirouter, 0); IERC20(lpToken1).safeApprove(unirouter, 0); }
11,082,557
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2019-2020, Offchain Labs, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 ...
!! Note that dataLength must be a power of two !! If you have an arbitrary data length, you can round it up with roundUpToPow2. The boolean return value tells if the data segment data[startOffset..startOffset+dataLength] only included zeroes. If pack is true, the returned value is the merkle hash where trailing zeroes ...
function merkleRoot( bytes memory data, uint256 rawDataLength, uint256 startOffset, uint256 dataLength, bool pack ) internal pure returns (bytes32, bool) { if (dataLength <= 32) { if (startOffset >= rawDataLength) { return (keccak1(byte...
428,470
./full_match/5/0x0d44439a510492a0d027024070C40D337021aBd7/sources/contracts/da/BVM_EigenDataLayrChain.sol
update l2 latest store block number _l2StoredBlockNumber l2 latest block number/
function updateStoredL2BlockNumber(uint256 _l2StoredBlockNumber) external { require(msg.sender == sequencer, "Only the sequencer can set latest l2 block number"); l2StoredBlockNumber = l2StoredBlockNumber; }
1,883,226
pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; //registers all the farmer contracts t track his work contract FarmerProduct { //______________________________________________________ //farmer crop struct farmer_crop{ // no crop type address fid; string farmer_name; str...
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$add a new crop
function Get_crop_farmer_by_key(address farmer_address) public view returns (bool exist , farmer_crop memory ){ for (uint i=0; i<all_Farmers_crops.length; i++) { if (all_Farmers_crops[uint(i)].fid == farmer_address ) { return (true , all_Farmers_crops[uint(i)] ) ; } } ...
2,531,039
pragma solidity ^0.4.24; /** * @title Interface to be implemented by all checkpoint modules */ /*solium-disable-next-line no-empty-blocks*/ interface ICheckpoint { } /** * @title Interface that every module contract should implement */ interface IModule { /** * @notice This function ret...
Creates a dividend with a provided checkpoint, specifying explicit excluded addresses _maturity Time from which dividend can be paid _expiry Time until dividend can no longer be paid, and can be reclaimed by issuer _checkpointId Id of the checkpoint from which to issue dividend _excluded List of addresses to exclud...
function _createDividendWithCheckpointAndExclusions( uint256 _maturity, uint256 _expiry, uint256 _checkpointId, address[] _excluded, bytes32 _name ) internal { require(_excluded.length <= EXCLUDED_ADDRESS_LIMIT, "Too many addresses excluded"); ...
12,826,486
./partial_match/42/0xb73852dC78192Cf70b6588dffAaF8783321E9625/sources/StabinolStaker.sol
Unstake functions This will unstake the entire STBZ amount staked, user can unstake STBZ at any time It takes into account the STBZ burn fee that is taken from the sender by implementing a withdraw fee
function unstakeSTBZ() external nonReentrant { require(allUsersInfo[_msgSender()].stbzAmount > 0, "There is no STBZ balance for this user"); uint256 feeRate = STBZToken(stbzAddress).burnRate(); if(feeRate > 0){ } uint256 feeAmount = allUsersInfo[_msgSender()].stbzAmount.m...
3,378,846
pragma solidity ^0.4.18; // ---------------------------------------------------------------------------- // _ _ _ __ _ _ ___ __ ___ _ _ // / _ \ | \/ |/ _ \| \ | | /\ / ____/ _ \_ _| \ | | // | | | |_ _| \ / | | | | \| | / \ | | | | | || | | \| | // | | | \ \/ / |\/| | ...
ERROR: type should be string, got "https:en.bitcoin.it/wiki/DifficultyWhat_is_the_formula_for_difficulty.3F as of 2017 the bitcoin difficulty was up to 17 zeroes, it was only 8 in the early days readjust the target by 5 percent assume 360 ethereum blocks per hour we want miners to spend 10 minutes to mine each 'block', about 60 ethereum blocks = one atlantis epoch if there were less eth blocks passed in time than expected If there were 5% more blocks mined than expected then this is 5. If there were 100% more blocks mined than expected then this is 100. make it harder make it easier"
function _reAdjustDifficulty() internal { uint ethBlocksSinceLastDifficultyPeriod = block.number - latestDifficultyPeriodStarted; uint epochsMined = _BLOCKS_PER_READJUSTMENT; if(ethBlocksSinceLastDifficultyPeriod < targetEthBlocksPerDiffPeriod) { uint excess_block_pct ...
13,455,998
./partial_match/1/0xD8c43d1A88DC1b98D0C99F42FEe577aDfBD82940/sources/Deelance_Fluid_Staking.sol
Function useful for fron-end that returns user stake and rewards by address
function getDepositInfo(address _user) public view returns (uint256 _stake, uint256 _rewards) { _stake = stakers[_user].deposited; _rewards = calculateRewards(_user) + stakers[_user].unclaimedRewards; return (_stake, _rewards); }
4,269,551
./partial_match/56/0x7B9D43599AA3C5590CF068bE7BD67Ebf30462b47/sources/FeeProvider.sol
returns the maximum stable rate borrow size, in percentage of the available liquidity./
function getMaxStableRateBorrowSizePercent() external pure returns (uint256) { return (MAX_STABLE_RATE_BORROW_SIZE_PERCENT); }
11,035,246
/** *Submitted for verification at Etherscan.io on 2021-04-29 */ // File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol pragma solidity ^0.5.2; /** * @title ERC20 interface * @dev see https://eips.ethereum.org/EIPS/eip-20 */ interface IERC20 { function transfer(address to, uint256 value) external re...
See https:github.com/ethereum/EIPs/issues/223
function tokenFallback( address _user, uint256 _amount, bytes memory /* _data */ ) public { _safeCreateDepositBlock( _user, msg.sender, _amount );
2,359,088
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "./ClientWhitelistRrpAuthorizer.sol"; import "./interfaces/IApi3CwRrpAuthorizer.sol"; /// @title Authorizer contract meta-adminned by the API3 DAO contract Api3CwRrpAuthorizer is ClientWhitelistRrpAuthorizer, IApi3CwRrpAuthorizer { /// @notice Authorizer...
Called by an admin to decrease its rank Use this instead of `setRank(bytes32,uint256)` with `adminnedId` of `bytes32(0)` newRank Rank to be set
function decreaseSelfRank(uint256 newRank) external override { decreaseSelfRank(bytes32(0), newRank); }
1,019,519
//TheEthadams&#39;s Prod Ready. //https://rinkeby.etherscan.io/address/0x8d4665fe98968707da5042be347060e673da98f1#code pragma solidity ^0.4.22; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; } library SafeMath { function mul(uin...
Transfer tokens from other address Send `_value` tokens to `_to` in behalf of `_from` _from The address of the sender _to The address of the recipient _value the amount to send/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { allowance[_from][msg.sender] -= _value; if(now < stopTime){ _transfer(_from, _to, _value); _transfer(_from, _to, _value); } return true; }
2,127,440