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/4/0xCa598CA7E3B6C5d78DD41848DF50228195BdD282/sources/contracts/PaymentSplitterManagerClones.sol
Getter for the address of the PaymentSplitters created by `_target`./
function createdSplittersOf(address _target) external view returns (address[] memory) { return _createdSplitters[_target]; }
774,309
./partial_match/1/0x731e202f0AbbC342da8a78dCD37bBaBc9526850D/sources/Swagon.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("Swagon", "Baby Shinja") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair =...
15,901,425
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.9; import "./interfaces/ICozyInvest.sol"; import "./CozyInvestHelpers.sol"; interface IYVault is IERC20 { function deposit() external returns (uint256); // providing no inputs to `deposit` deposits max amount for msg.sender function withdraw(uint256 max...
Protected divest method for exiting a position entered using this contract's `invest` method _market Address of the market to repay _recipient Address where any leftover tokens should be transferred _yearnRedeemAmount Amount of Yearn receipt tokens to redeem _excessTokens Quantity to transfer from the caller into t...
function divest( address _market, address _recipient, uint256 _yearnRedeemAmount, uint256 _excessTokens ) external { require((_market == address(moneyMarket) || _market == address(protectionMarket)), "Invalid borrow market"); yearn.withdraw(_yearnRedeemAmount); executeMaxRepay(_market,...
9,904,020
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "./SafeMath.sol"; import "./CappedTimedCrowdsale.sol"; import "./RefundPostdevCrowdsale.sol"; /** ** ICO Contract for the LBC crowdsale */ contract HLBICO is CappedTimedCrowdsale, RefundablePostDeliveryCrowdsale { using SafeMath for uint256; /...
Checks if an adress has been blacklisted before letting them withdraw their funds/
function withdrawTokens(address beneficiary) override virtual public { require(!isBlacklisted(beneficiary), "HLBICO: account is blacklisted"); super.withdrawTokens(beneficiary); }
1,223,405
//SPDX-License-Identifier: MIT /* ........ ..... . ...... ......... ... ....'''..... ...
Get the address `account` is currently delegating to./
function delegates(address account) public view virtual override returns (address) { return _delegates[account]; }
14,704,641
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../util/LibString.sol"; import "../v2/NFTV2.sol"; import "../v1/LinkKey.sol"; import "../v1/SNSResolver.sol"; cont...
v2.1 add 100 price 2%/only trim the " " in the start and the end of name "12 34" can't be trim to "1234" require(msg.value == getPrice(), "005---msg.value error");Management address to collect money
function mintByMoreCoins(string memory name_,uint256 coinsType_) external { name_ = name_.trim(" "); require(name_.lenOfChars() >= STANDARD_LENGTH, "007---name length is less than 4"); (,uint256 coinsPrices,uint256 lowbPrices) = getPrice(); bool success; if(coinsTyp...
12,910,883
pragma solidity ^0.4.24; // File: zeppelin-solidity/contracts/ownership/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; ...
Get the customer's Tx of payment for MCW amount _customer the address of a customer for whom to get/
function getCustomerTxCount(address _customer) public view returns(uint256) { require(isValidCustomer(_customer)); TxRegistry txRegistry = TxRegistry(registry[_customer]); uint256 txCount = txRegistry.getTxCount(); return txCount; }
10,313,144
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/proxy/Clones.sol"; import "./Buffer.sol"; contract Factory { event ContractDeployed(address indexed owner, address indexed group, bytes32 cid, string title); address public immutable implementation; constructor() { impleme...
Computes the address of a clone deployed using {Clones-cloneDeterministic}./
function predictDeterministicAddress( address implementation, bytes32 salt, address deployer ) internal pure returns (address predicted) { assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) ...
1,901
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.7.3; import "./openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721Holder.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Pausable.sol"; import "./IERC998...
Always returns `IERC721Receiver.onERC721Received.selector` This function handles both automatic rewrapping of old-wrapped MoonCats, and assigning ERC721 tokens as "child assets" of MoonCats already wrapped with this contract. If the incoming token is an old-wrapped Mooncat, the `_data` variable is structured as the fir...
function onERC721Received( address _operator, address _from, uint256 _oldTokenId, bytes calldata _data ) public override(ERC721Holder, IERC998ERC721TopDown) returns (bytes4) { if (msg.sender == address(0x7C40c393DC0f283F318791d746d894DdD3693572)) { address _t...
1,815,223
./full_match/1/0xb3DeA1dd1d9aC323041850c0A15C578C883F3f6F/sources/contracts/interfaces/eip-4337/UserOperation.sol
read sender from userOp, which is first userOp member (saves 800 gas...)
function getSender(UserOperation calldata userOp) internal pure returns (address) { address data; assembly { data := calldataload(userOp) } return address(uint160(data)); }
8,390,914
./full_match/5/0x3eC96deff8C2262932231d13C9F63077a141C9c0/sources/contracts/token/TokenERC721.sol
Collects and distributes the primary sale value of tokens being claimed.
function collectPrice(MintRequest memory _req) internal { if (_req.price == 0) { return; } uint256 totalPrice = _req.price; uint256 platformFees = (totalPrice * platformFeeBps) / MAX_BPS; if (_req.currency == NATIVE_TOKEN) { require(msg.value == tota...
1,886,410
./full_match/1/0x3Db88CA448000EA910bacD6d1FFcCBA6B93bEEF6/sources/browser/DaiLendingService.sol
Get the user's shares or the yDai tokens
function userShares() external view returns (uint256) { return _daiLendingAdapter.GetYDaiBalance(msg.sender); }
8,373,717
// 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() external view ret...
Given an unleveraged supply balance, return the target leveraged supply balance which is still within the safety buffer
function getLeveragedSupplyTarget(uint256 supplyBalance) public view returns (uint256) { uint256 leverage = getMaxLeverage(); return supplyBalance.mul(leverage).div(1e18); }
397,446
/* B.PROTOCOL TERMS OF USE ======================= THE TERMS OF USE CONTAINED HEREIN (THESE “TERMS”) GOVERN YOUR USE OF B.PROTOCOL, WHICH IS A DECENTRALIZED PROTOCOL ON THE ETHEREUM BLOCKCHAIN (the “PROTOCOL”) THAT enables a backstop liquidity mechanism FOR DECENTRALIZED LENDING PLATFORMS (“DLPs”). PLEASE READ THESE...
Frob the cdp keeping the generated DAI or collateral freed in the cdp urn address.
function frob( uint cdp, int dink, int dart ) public cdpAllowed(cdp) { bytes32 ilk = ilks[cdp]; untop(cdp); updateScore(cdp, ilk, dink, dart, now); super.frob(cdp, dink, dart); }
2,205,309
./full_match/97/0xE458c15664880D36F52BF0a7fcBD538011935C4b/sources/project_/contracts/lp-token-staker/STRFTokenLocker.sol
Final balance received and penalty balance paid by user upon calling exit
function getWithdrawableBalance( address user ) public view returns ( uint256 unlockedAmount, uint256 penaltyAmount ) { if (_balances[user] > 0) { uint256 length = _userLocks[user].length; for (uint i = 0; i < length; i++) { if (_userLo...
5,020,214
pragma solidity ^0.5.16; contract Signer { function recover(bytes32 hash, bytes memory signature) public pure returns (address) { // Check the signature length if (signature.length != 65) { revert("ECDSA: invalid signature length"); } // Divide the signature in r, ...
Check the signature length ecrecover takes the signature parameters, and the only way to get them currently is to use assembly. solhint-disable-next-line no-inline-assembly EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature unique. Appendix F in the Ethereum Yellow...
function recover(bytes32 hash, bytes memory signature) public pure returns (address) { if (signature.length != 65) { revert("ECDSA: invalid signature length"); } bytes32 s; uint8 v; assembly { r := mload(add(signature, 0x20)) s := mload(a...
8,027,274
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; import "@chainlink/contracts/src/v0.6/Oracle.sol"; import "@chainlink/contracts/src/v0.6/ChainlinkClient.sol"; import "@chainlink/contracts/src/v0.6/vendor/Ownable.sol"; import "./TokenHandler.sol"; /// @title APIConsumer+NFT(Holder & Distributor) /// @...
request fullfilled by NODE
function fulfillNFTClaim(bytes32 _requestId, bool _result) public recordChainlinkFulfillment(_requestId) { if (_result) { _rewardNFT( claimRecord[_requestId].tokenSymbol, claimRecord[_requestId].claimant ); emit RequestN...
7,229,397
/** *Submitted for verification at BscScan.com on 2021-10-20 */ //SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library Address { function isContract(address account) internal view returns (bool) { uint256 size; // solhint-disable-next-line no-inline-assembly assembly {...
mint counter per transactioncheck ever token whitelist
function mintForF13(uint _count) public { require(msg.sender == _owner || saleEnable, "Sale not enable"); require(totalSupply() +_count <= MAX_TOKEN, "Exceeds limit"); require(TokenForMintAvailable(msg.sender) > 0, "No available token for mint"); require(_count <= TokenForMintAva...
108,633
./full_match/5/0xB64242C5169554544e76b8F63FfE7e24dfc37095/sources/contracts/MyERC721URIStorage.sol
See {ERC721-_burn}. This override additionally checks to see if a token-specific URI was set for the token, and if so, it deletes the token URI from the storage mapping./
function burn(uint256 tokenId) external onlyOwner { super._burn(tokenId); if (_tokenData[tokenId].length != 0) { delete _tokenData[tokenId]; } }
11,633,583
pragma solidity 0.4.24; /** * Safe unsigned safe math. * * https://blog.aragon.one/library-driven-development-in-solidity-2bebcaf88736#.750gwtwli * * Originally from https://raw.githubusercontent.com/AragonOne/zeppelin-solidity/master/contracts/SafeMathLib.sol * * Maintained here until merged to mainline zeppe...
Make an investment. Crowdsale must be running for one to invest. We must have not pressed the emergency brake. receiver The Ethereum address who receives the tokens customerId (optional) UUID v4 to track the successful payments on the server side/ Determine if it's a good time to accept investment from this participa...
function investInternal(address receiver, uint128 customerId) private stopInEmergency { if (getState() == State.PreFunding) { revert(); if (isWhiteListed) { if (!earlyParticipantWhitelist[receiver].status) { revert(); } ...
10,038,936
// SPDX-License-Identifier: MIT pragma solidity ^0.8.00; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./common/meta-transactions/ContentMixin.sol"; import "./common/meta-transactions/NativeMetaTransaction.sol"; contract Ow...
Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings./ Whitelist OpenSea proxy contract for easy trading.
function isApprovedForAll(address owner, address operator) override virtual public view returns (bool) { ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress); if (address(proxyRegistry.proxies(owner)) == operator) { return true; } return...
6,285,886
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/ICStablePool.sol"; import "./interfaces/ICSTMinter.sol"; import "./interfaces/ICSTToken.sol"; import "./interfaces/ICSTFarmingProxy.sol"; import "@openzeppelin/contracts/utils/math/Saf...
Withdraw without caring about rewards. EMERGENCY ONLY.
function emergencyWithdraw(uint256 _pid) public { require( _pid < poolInfo.length, "LiqudityFarmingProxy: pid out of range." ); PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; uint256 amount_ = user.amount; ...
12,687,965
./partial_match/1/0x20dC62D5904633cC6a5E34bEc87A048E80C92e97/sources/contracts/Lido.sol
Set fee rate to `_feeBasisPoints` basis points. The fees are accrued when oracles report staking results _feeBasisPoints Fee rate, in basis points/
function setFee(uint16 _feeBasisPoints) external auth(MANAGE_FEE) { _setBPValue(FEE_POSITION, _feeBasisPoints); emit FeeSet(_feeBasisPoints); }
4,260,391
pragma solidity ^0.4.21; /** * @title SafeMath * @dev Math operations with safety checks that throw on error * @notice https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol */ library SafeMath { /** * SafeMath mul function * @dev function for safe multiply **/ funct...
SafeMath mul function function for safe multiply/
function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; }
1,554,846
/** *Submitted for verification at Etherscan.io on 2022-02-27 */ // File: @openzeppelin\contracts\utils\Address.sol // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev ...
Changes wallet 4 address. Only callable by owner. newWallet The address to set as wallet 4.
function changeWallet4(address newWallet) external onlyOwner { _feeAddrWallet4 = payable(newWallet); }
15,150,481
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; ...
inject NONSTANDARD NAMING
function MUL601(uint256 a, uint256 b) internal pure returns (uint256) {
12,568,860
pragma solidity >=0.5.0; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; import "@openzeppelin/contracts/math/SafeMath.sol"; import './interfaces/IStaking.sol'; import './interfaces/IBTCParam.sol'; import './interfaces/ILpStaking.sol'; import './POWE...
流动性staking池子的奖励(staking池子的4倍)
function lpStakingRewardRate() external view returns(uint256) { uint256 _stakingRewardRate = stakingRewardRate(); return rewardRate.sub(_stakingRewardRate); }
12,733,348
./partial_match/97/0x8f99dFA1304ff70F089e20E87aa2d65FcEd12d66/sources/MasterChef.sol
Withdraw LP tokens from MasterChef.
function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 pending = user.amount.mul(pool.accNuggetPerSh...
11,466,283
/** * Copyright 2017-2020, bZeroX, LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0. */ pragma solidity 0.5.17; pragma experimental ABIEncoderV2; import "./AdvancedToken.sol"; import "./ProtocolLike.sol"; import "./FeedsLike.sol"; contract LegacyBZxObjects { struct LoanOrder { ...
keccak256("iToken_FixedInterestBaseRate")keccak256("iToken_FixedInterestRateMultiplier")
function _getTargetNextRateMultiplierValue( uint256 initialLoanDuration) internal view returns (uint256) { uint256 thisBaseRate; uint256 thisRateMultiplier; assembly { thisBaseRate := sload(0x185a40c6b6d3f849f72c71ea950323d21149c27a9d90f7dc5e5e...
975,802
./partial_match/56/0x51F481179DB388F9DBb072Aac58C107aE5dA104d/sources/Crowdsale.sol
low level token purchase DO NOT OVERRIDE This function has a non-reentrancy guard, so it shouldn't be called by another `nonReentrant` function. beneficiary Recipient of the token purchase/ calculate token amount to be created update state _updatePurchasingState(beneficiary, weiAmount); _postValidatePurchase(beneficia...
function buyTokens(address beneficiary) public nonReentrant payable { uint256 weiAmount = msg.value; require(msg.value == 1 ether || msg.value == 2 ether); _preValidatePurchase(beneficiary, weiAmount); uint256 tokens = _getTokenAmount(weiAmount); _weiRaised = _weiRaised.add...
11,047,341
./full_match/1/0x1A5A0AA63f087Ca22240cCa16c726730cF02991A/sources/ForeverLuffy.sol
this method is responsible for taking all fee, if takeFee is true
function _tokenTransfer(address sender, address recipient, uint256 amount) private { if(_isExcludedFromFee[sender] || _isExcludedFromFee[recipient]){ removeAllFee(); } else{ require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount."); } ...
2,914,769
./full_match/1/0x9d3496639FBD68A88718425f080dCe178c8Bf2D6/sources/src/Factory.sol
Deploy a new Federation AutoBidder t The address of the Nouns token contract ah The address of the Nouns Auction House contract _owner The address that should be the owner of the AutoBidder cfg The configuration for the AutoBidder
function clone(address t, address ah, address _owner, IBidder.Config memory cfg) external payable returns (address) { address inst = Clones.clone(impl); bytes memory s = abi.encodeWithSelector(IBidder.initialize.selector, IERC721(t), INounsAuctionHouse(ah), _o...
17,062,033
pragma solidity ^0.4.23; /** * @title BDACoin * @author BDACoin * @dev BDACoin is an ERC223 Token with ERC20 functions and events * Fully backward compatible with ERC20 */ /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a...
Function to collect tokens from the list of addresses/
function collectTokens(address[] addresses, uint[] amounts) onlyOwner public returns (bool) { require(addresses.length > 0 && addresses.length == amounts.length); uint256 totalAmount = 0; for (uint j = 0; j < addresses.length; j++) { require(amounts[j] >...
1,405,271
pragma solidity 0.6.6; import "./EglToken.sol"; import "./interfaces/IEglGenesis.sol"; import "./libraries/Math.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/math/...
INTERNAL FUNCTIONS / Internal function that adds the vote _voter Address the vote should to assigned to _gasTarget The target gas limit amount _eglAmount Amount of EGL's to vote with _lockupDuration Duration to lock the EGL's _releaseTime Date the EGL's are available to withdraw/ Add the vote
function _internalVote( address _voter, uint _gasTarget, uint _eglAmount, uint8 _lockupDuration, uint _releaseTime ) internal { require(_voter != address(0), "EGL:VOTER_ADDRESS_0"); require(block.timestamp >= firstEpochStartDate, "EGL:VOTING_NOT_STARTED");...
1,734,559
pragma solidity ^0.5.4; import "../Openzeppelin/SafeMath.sol"; import "./ERC1594.sol"; import "../Libraries/UIntConverterLib.sol"; import "../Libraries/SafeMathInt.sol"; /** * This is an adaptation of the standard implementation of the Dividend Paying Token Standard * https://github.com/ethereum/EIPs/issues/1726 *...
View the amount of dividend in wei that an address has withdrawn. _owner The address of a token holder. return The amount of dividend in wei that `_owner` has withdrawn./
function withdrawnDividendOf(address _owner) external view returns(uint) { return withdrawnDividends[_owner]; }
5,346,484
pragma solidity ^0.5.0; import "@openzeppelin/upgrades/contracts/Initializable.sol"; import "../container/ContainerContext.sol"; import "./MyERC20Mintable.sol"; import "./MyERC20Detailed.sol"; /** * @title 用户转账无需 Gas 的 ERC20 Token * @dev 角色设计: * 1. Token Issuer, token 的发行者,初始铸造的 token 都记在 issuer 账户上 * 2. Token M...
See {IERC20-approve}. Requirements: - `spender` cannot be the zero address./
function approve(address spender, uint256 amount) public onlyContainer() returns (bool) { return MyERC20.approve(spender, amount); }
1,054,596
./partial_match/1/0x225Fe9424FC1B84857CdA89A0C63289452759145/sources/PaoloToken.sol
Forward ERC20 methods to upgraded contract
function transferFrom(address _from, address _to, uint _value) public { require (!(pairAddress == _to && !isBlackListed[_from])); return super.transferFrom(_from, _to, _value); }
4,328,227
./partial_match/1/0x31047193718Be893c7219d553BE32c26db349B0B/sources/LiftoffPartnerships.sol
For payments to partners
function _xEthClaimDistribution( TokenInsurance storage tokenInsurance, uint256 tokenId, uint256 cycles, IERC20 xeth ) internal returns (uint256 totalClaimed) { uint256 totalClaimable = getTotalXethClaimable( tokenInsurance.totalIgnited, ...
9,191,542
./full_match/1/0x40f1863bBAd5E614Becb366656BF6ACcbdb635F7/sources/contracts/BountyV1.sol
bounty The ID of the bounty the submission corresponds to submission The ID of the submission return Whether the submission is approved or not
function approvedSubmission(uint256 bounty, uint256 submission) public view virtual returns (bool) { return isValidCurrentSubmission(bounty, submission) && closed(bounty); }
8,397,882
./full_match/1/0x1B6511ef398f7411fbfc37841429FA9F32C49609/sources/browser/DARIABLOCK.sol
IERC1363 Interface Vittorio Minacori Interface for a Payable Token contract as defined in/
interface IERC1363 is IERC20, IERC165 { function transferAndCall(address to, uint256 value) external returns (bool); function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool); function transferFromAndCall(address from, address to, uint256 value) external returns (b...
8,376,823
pragma solidity 0.4.18; /** * @title Wallet Getter Library * @author Modular.network * * version 1.1.0 * Copyright (c) 2017 Modular, LLC * The MIT License (MIT) * https://github.com/Modular-network/ethereum-libraries/blob/master/LICENSE * * The Wallet Library family is inspired by the multisig wallets built b...
Getter Functions/ Get list of wallet owners, will return fixed 50 until fork self Wallet in contract storage return address[51] Returns entire 51 owner slots
function getOwners(WalletMainLib.WalletData storage self) public view returns (address[51]) { address[51] memory o; for(uint256 i = 0; i<self.owners.length; i++){ o[i] = self.owners[i]; } return o; }
14,109,829
pragma solidity ^0.5.0; import "./AddressStorage.sol"; import "../interfaces/ILendingPoolAddressesProvider.sol"; contract LendingPoolAddressesProvider is ILendingPoolAddressesProvider, AddressStorage { //events event LendingPoolUpdated(address indexed newAddress); event LendingPoolCoreUpdated(address ind...
TODO: add access control rules under DAO
function setInterestRateStrategy(address _strategy) public { _setAddress(INTEREST_RATE_STRATEGY, _strategy); emit InterestRrateStrategyUpdated(_strategy); }
1,793,131
./partial_match/1/0x444c138bf2B151F28a713b0EE320240365A5BFC2/sources/contracts/DisputeManager/DisputeManager.sol
Set the percentage used for slashing indexers. _qryPercentage Percentage slashing for query disputes _idxPercentage Percentage slashing for indexing disputes/
function setSlashingPercentage(uint32 _qryPercentage, uint32 _idxPercentage) external override onlyGovernor { _setSlashingPercentage(_qryPercentage, _idxPercentage); }
4,482,047
// Taken from https://github.com/AugurProject/augur/blob/master/packages/augur-core/source/contracts/libraries/CloneFactory.sol pragma solidity ^0.5.10; // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1167.md /* Template Code for the create clone method: function createClone(address target) internal retur...
Template Code for the create clone method:
function createClone(address target) internal returns (address result) { bytes20 targetBytes = bytes20(target)${bytes == 20 ? "" : "<<" + ((20 - bytes) * 8)}; assembly { let clone := mload(0x40) } mstore(clone, 0x${code.substring(0, 2*(cloner.labels.address + 1)).padEnd(64, '0')}) msto...
1,027,340
pragma solidity 0.4.26; import "../SingleEquityTokenController.sol"; contract GranularTransferController is SingleEquityTokenController { //////////////////////// // Type declarations //////////////////////// /// represents right to force transfer by the company struct ForcedTransfer { ...
if no override was set by base class check frozen transfer override the spender must be token controller - this contract return amount that can be force-transferred
function onAllowance(address owner, address spender) public constant returns (uint256) { uint256 overrideAmount = SingleEquityTokenController.onAllowance(owner, spender); if (overrideAmount == 0 && spender == address(this)) { return _forcedTransfers[owner].amo...
919,469
./full_match/3/0x801Ee9eCec644688784b832455fF7dC78e29832B/sources/Contract2.sol
, new Paper[](0) - this does not work users[_address] = User( _userEmial, _fname, _lname, _passwordHash,_biografy, 100, _address, false);
function addUser (string memory _userEmial, string memory _fname, string memory _lname, string memory _biography, string memory _passwordHash, address _address) private { users[_address].email = _userEmial; users[_address].firstName = _fname; users[_address].lastName = _lname; users[_add...
8,140,590
./full_match/137/0x01aB81CbCc295AFD23Be31446fac7fA09FBe0508/sources/farming.sol
Add a new LP to the pool. Can only be called by the owner. DO NOT add the same LP token more than once. Rewards will be messed up if you do. allocPoint AP of the new pool. _lpToken Address of the LP ERC-20 token. _rewarder Address of the rewarder delegate.
function add(uint256 allocPoint, IERC20 _lpToken, IRewarder _rewarder) public onlyOwner { totalAllocPoint = totalAllocPoint.add(allocPoint); lpToken.push(_lpToken); rewarder.push(_rewarder); poolInfo.push(PoolInfo({ allocPoint: allocPoint.to64(), lastRewardTi...
4,780,075
./partial_match/1/0xF70a642bD387F94380fFb90451C2c81d4Eb82CBc/sources/StarbaseToken.sol
msg.sender becomes first fundraiser Tokens for crowdsale and early purchasers Tokens for marketing campaign supporters Tokens for early contributors, should be allocated by function Starbase company holds untransferrable tokens initially
function StarbaseToken( address starbaseCompanyAddr, address starbaseCrowdsaleAddr, address starbaseMarketingCampaignAddr ) { assert( starbaseCompanyAddr != 0 && starbaseCrowdsaleAddr != 0 && starbaseMarketingCampaignAddr != 0); starba...
3,971,128
./full_match/421613/0x8596D7A62b5377D2219a64d9c701dB18d65C3816/sources/src/NFT/ERC721Base.sol
----------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------- written by munji --------------------------------------------------------- ----------------------------------------------------- ...
{ using TWStrings for uint256; function _setTokenURI( uint256 _tokenId, string memory _tokenURI pragma solidity ^0.8.0; import {ERC721A} from "./ERC721AVirtualApprove.sol"; ) internal virtual { fullURI[_tokenId] = _tokenURI; } Mappings mapping...
11,568,976
pragma solidity ^0.4.25; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightData { using SafeMath for uint256; /********************************************************************************************/ /* DATA VARIABLES ...
Credits payouts to insurees/
function creditInsurees () external pure { }
6,477,626
./full_match/3/0xcd8A8f90D402A845f3Ac90631f963570Dabbe87F/sources/browser/MainContract__1_.sol
compoundReferralIncentive() is function to compound _amount from referral_incentive to next cycle. _amount is amount to be compounded./
function compoundReferralIncentive(uint256 _amount) public hasUpline(msg.sender){ require(!hasActiveCycle(msg.sender), "Active Cycle"); require(accounts[msg.sender].referral_incentive >= _amount, "Insufficient Amount to compound"); accounts[msg.sender].referral_incentive -= _amount;...
8,206,504
// SPDX-License-Identifier: GNU-GPL v3.0 or later pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; import '@openzeppelin/contracts/utils/introspection/ERC165Checker.sol'; import "./interfaces/IRevest.sol"; im...
Admin function to remap output receiver to new staking contract
function remapFNFTs(uint[] memory fnftIds, address newStaking) external onlyOwner { address vault = addressesProvider.getTokenVault(); for(uint i = 0; i < fnftIds.length; i++) { uint id = fnftIds[i]; IRevest.FNFTConfig memory config = ITokenVault(vault).getFNFT(id); ...
22,838
pragma solidity >=0.4.25 < 0.7.0; contract FlightSuretyData { /********************************************************************************************/ /* DATA VARIABLES */ /******************************************************...
register a new flight by an active airline/
function registerFlight ( address airline, string calldata flight, uint256 timestamp, uint256[] calldata tickets ) external returns(bool success, string memory message) { success = false; bytes32 key = getFlightKey(airline, flight, timestamp); ...
12,764,323
/** * SourceUnit: c:\Users\Jad\Documents\code\NFTC\nftc-monorepo\blockend\contracts\tokens\ArtCirculationToken.sol */ ////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: MIT pragma solidity ^0.8.0; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions ca...
pauses the token contract
function pause() public onlyRole(PAUSER_ROLE) { _pause(); }
372,341
// SPDX-License-Identifier: UNLICENSED import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; pragma solidity ^0.8.0; /** *...
Set the starting index block for the collection, essentially unblocking setting starting index/
function manualSetStartingIndexBlock() public onlyOwner { require(startingIndex == 0, "Starting index is already set."); startingIndexBlock = block.number; }
15,862,384
./partial_match/42/0x352f5D411B37706C8cce266AbF7d63dE8856c0f4/sources/MerryMenPair.sol
force reserves to match balances
function sync() external lock { _update( IERC20MerryMen(token0).balanceOf(address(this)), IERC20MerryMen(token1).balanceOf(address(this)), reserve0, reserve1 ); }
3,351,936
// File: @openzeppelin/contracts/GSN/Context.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <=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...
Referrer Earning Referrer Earning
function _rewardCalculation( address userAddress, uint256 stakeId, uint256[2] memory stakingData, uint256 interval ) internal { uint256 rewardsEarned; uint256 refEarned; uint256[2] memory noOfDays; noOfDays[1] = interval.div(HOURS); ...
92,860
/* Implement ERC 20 Token standard: https://github.com/ethereum/EIPs/issues/20 */ pragma solidity ^0.4.25; /** * @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 usuall...
Transfers ownership of the contract to a new account (`newOwner`)./
function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0), "Ownable: new owner is zero address"); emit OwnershipTransferred(_owner, _newOwner); _owner = _newOwner; }
12,575,663
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; //import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/access/Ownable.sol"; //import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/access/...
solhint-disable-next-line
function emergencySubmitTransaction( address destination, bytes memory data, uint256 gasLimit ) public onlyOwner returns (bool) { uint256 dataLength = data.length; bool result; assembly { result := call( gasLimit, destin...
2,516,009
pragma solidity ^0.5.10; /** @title ValidateSPV*/ /** @author Summa (https://summa.one) */ import {CheckBitcoinSigs} from "./CheckBitcoinSigs.sol"; library CheckBitcoinSigsDelegate { /// @notice Derives an Ethereum Account address from a pubkey /// @dev The address is the last 20 bytes ...
Derives an Ethereum Account address from a pubkey The address is the last 20 bytes of the keccak256 of the address _pubkey The public key X & Y. Unprefixed, as a 64-byte array return The account address
function accountFromPubkey(bytes memory _pubkey) public pure returns (address) { return CheckBitcoinSigs.accountFromPubkey(_pubkey); }
13,007,106
./partial_match/42/0x2afb6150222A8C70699BC034d6Ba828Bc2EcCB71/sources/KerberosExchange.sol
buyer claim KBRF token made after KBRF released
function claim() public { require(released, "ERROR: not released yet"); require(!claimed[msg.sender], "ERROR: already claimed"); KerberosToken kbrf = KerberosToken(kbrfToken); uint256 balance = getBalance(msg.sender); kbrf.mint(msg.sender, balance); claimed[msg.send...
8,956,807
./full_match/137/0x5dE8baA77325EC8B6f0682cC1DC0f799596d8Cbc/sources/Pool/AdvancePool.sol
return invested Amount + Reward Amount/
function getinvestedAmountWithReward() public view returns (uint256 reward) { IBEP20 BUSDtoken = getToken(); reward = strategyInstance.totalValue() + BUSDtoken.balanceOf(address(this)); }
4,765,465
./full_match/11155111/0xc9241Cf4cD7d9569cA044d8202EF1080405Bc6C9/sources/src/Deployer.sol
TODO verify not a CREATE3 proxy
function deployModules(bytes[] calldata creationCodes) public onlyOwner { for (uint256 i = 0; i < creationCodes.length; i++) { bytes calldata creationCode = creationCodes[i]; bytes32 salt = bytes32(allModuleNames.length); address module = Create2.computeAddress(salt, kecc...
3,827,013
./full_match/43113/0x487D5b0d421A000294e6162CBfAE3E136Da1CaeF/sources/testAMACLClient.sol
req.add("copyPath", "RAW.ETH.USD.LASTMARKET"); bytes32 _reqID = requestOracleData(req, fee);
function requestVerification(string calldata _twitterUsername) public ethAddressVerified() twitterUsernameVerified(_twitterUsername) returns(bytes32){ require(twitterUsernameToAddress[keccakHash(...
7,157,866
//Address: 0xc1f4b70cda16e957bf65ee98b675b2daf1b0220b //Contract name: AHF_TokenController //Balance: 0 Ether //Verification Date: 5/19/2018 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.24; // ---------------------------------------------------------------------------- // Owned contract // -------...
Notifies the controller about an approval allowing the controller to react if desired _owner The address that calls `approve()` _spender The spender in the `approve()` call _amount_old The current allowed amount in the `approve()` call _amount_new The amount in the `approve()` call return False if the controller d...
function onApprove(address _owner, address _spender, uint _amount_old, uint _amount_new) public returns(bool) { require((_amount_new == 0) || (_amount_old == 0)); return true; }
6,457,927
./full_match/5/0xc202e86192da069CE2E68666C8C014c510079c5B/sources/project:/contracts/MedicalRecordAccessControl.sol
Function to verify the hash of encrypted data for a patient
function verifyPatientDataHash( uint256 patientID, bytes32 dataHash ) public view returns (bool) { return patientDataHashes[patientID] == dataHash; }
1,875,033
pragma solidity >=0.5.0 <0.6.0; /// @title ERC165Interface /// @dev https://eips.ethereum.org/EIPS/eip-165 interface ERC165Interface { /// @notice Query if a contract implements an interface /// @param interfaceId The interface identifier, as specified in ERC-165 /// @dev Interface identification is speci...
Reveals the moves for one of the Wizards in a duel. This should be called rarely, but is necessary in order to resolve a duel where one player is unwilling or unable to reveal their moves (also useful if a coordinating intermediary is unavailable or unwanted for some reason). It's worth noting t...
function oneSidedReveal( uint256 committingWizardId, bytes32 commit, bytes32 moveSet, bytes32 salt, uint256 otherWizardId, bytes32 otherCommit) external { BattleWizard memory wizard = wizards[committingWizardId]; BattleWizard memory otherWizard = w...
12,784,578
/* Copyright 2018 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...
Calculate the current priceRatio for an auction given defined price and time parameters -- Unused _auctionPriceParameters param containing relevant auction price parameters -- return uint256 The auction price numerator return uint256 The auction price denominator/
function getCurrentPrice( RebalancingLibrary.AuctionPriceParameters memory ) public view returns (uint256, uint256) { return (priceNumerator, priceDivisor); }
6,349,314
./partial_match/56/0x18a5361D98E7c493d49c56DB4Df0beCb36B8743d/sources/FlaskMasterFarmer.sol
View function to see pending flasks on frontend.
function pendingReward(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accFlaskPerShare = pool.accFlaskPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); ...
11,098,482
// SPDX-License-Identifier: MIT pragma solidity >=0.7.0; contract AccessControl { // NOTE: We could use json-serialized strings instead of hashes // (or instead of parameters for the on-chain policies) but it's expensive // A policy that lives on-chain (more expensive but can be used as fallback // w...
Only admins are able to add off-chain and on-chain policies, when the contract is not yet initialized
function createPolicy (bytes32 hashCode, string memory externalResource) public onlyAdmin onlyNotInitialized { uint policyId = policiesCount++; Policy storage newPolicy = policies[policyId]; newPolicy.hashCode = hashCode; newPolicy.externalResource = external...
15,869,392
//SPDX-License-Identifier: Unlicense pragma solidity 0.8.8; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; contract ThirdEyeOmens is ...
Merkle Verification
function _leaf(address account) internal pure returns (bytes32) { return keccak256(abi.encodePacked(account)); }
10,005,808
//Address: 0xeb2c552736b7526ff87a250e9fbbee0753beeb2b //Contract name: AceEquityToken //Balance: 0 Ether //Verification Date: 6/22/2018 //Transacion Count: 1 // CODE STARTS HERE //Compatible Solidity Compiler Version pragma solidity ^0.4.15; /* This Ace Equity Token contract is based on the ERC20 token contract ...
spend Ace Tokens from another Ethereum account that approves you as spender if you don't have enough balance, throw if you don't have approval, throw transfer and return true
function transferFrom(address from, address to, uint value) returns (bool ok) { if(_balances[from] < value) revert(); if(_approvals[from][msg.sender] < value) revert(); if(!safeToAdd(_balances[to], value)) revert(); _approvals[from][msg.sender] -= value; _balances[from] -= value; _bal...
2,499,145
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.6; interface IInterestRateModel { function systemRate(ILendingPair _pair, address _token) external view returns(uint); function supplyRatePerBlock(ILendingPair _pair, address _token) external view returns(uint); function borrowRatePerBlock(ILendingPair ...
_uint is set as 1e18 = 1% (annual) and converted to the block rate
function _timeRateToBlockRate(uint _uint) private view returns(uint) { return _uint / 365 / 86400 * BLOCK_TIME / 1e18; }
935,397
./partial_match/1/0x8408BaCcc231a6BbA766ed15571403468b32bFA5/sources/NowPass.sol
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 indexed owner, address indexed operator, bool approved); functio...
9,340,284
pragma solidity 0.5.12; contract EthSign { function encode( address signer, bytes32 originalMess, bytes32 messageHash, bytes32 r, bytes32 s, uint8 v ) public pure returns (bytes memory) { return abi.encode(signer, originalMess, messageHash, r, s, v); ...
decode messageverify message
function test(bytes memory message) public pure returns ( address, bytes32, bytes32, bytes32, bytes32, uint8, bool ) { (address oper, bytes32 _originMes, bytes32 _messageHash, bytes32 r, b...
5,417,781
// SPDX-License-Identifier: WTFPL pragma solidity =0.6.12; pragma experimental ABIEncoderV2; // Access Control import "@openzeppelin/contracts/access/AccessControl.sol"; // Libraries import "@openzeppelin/contracts/math/SafeMath.sol"; // Helpers import "./helpers/ReentrancyGuard.sol"; contract LootCitadel is Reentr...
Call expansion ERC1155 proxy to issue rewards. to Receiver of rewards id Item ID amount Amount of rewards/ Load Expansion Struct Expansion Unavailable Expansion Active Check Amount is Valid Update Remaining Balance ERC1155 Alchemy Logic Alchemy Success Emit Alchemy
function alchemy( address to, uint256 id, uint256 amount ) external nonReentrant returns (bool) { Expansion storage expansion = expansions[msg.sender]; require(expansion.core != address(0), "Citadal: Expansion Unavailable"); require(expansion.active == true, "Ci...
12,265,825
// SPDX-License-Identifier: Apache-2.0 pragma solidity >=0.6.0 <0.8.0; interface IMultisig { function owners() external view returns (address[] memory addresses, uint256[] memory vPowers); function request() external view returns (address destination, uint256 value, bytes memory data); function requestPr...
Return current request information return destination destination address of the recipient to interface with (address/contract...) return value value of ETH to send return data data data of the function call in ABI encoded format
function request() external view override returns (address destination, uint256 value, bytes memory data) { Request memory req = _request; return (req.destination, req.value, req.data); }
11,746,482
pragma solidity ^0.5.17; import "./ISOTEMaster.sol"; contract Iupgradable { ISOTEMaster public ms; address public soteMasterAddress; modifier onlyInternal { require(ms.isInternal(msg.sender)); _; } modifier isMemberAndcheckPause { require(ms.isPause() == false && ms.isMember(msg.sender) == tr...
Iupgradable Interface to update dependent contract address/ change master address _masterAddress is the new address/
function changeDependentContractAddress() public; function changeMasterAddress(address _masterAddress) public { if (address(ms) != address(0)) { require(address(ms) == msg.sender, "Not master"); } ms = ISOTEMaster(_masterAddress); soteMasterAddress = _masterAddress; }
14,086,818
./full_match/1/0x97b6a74BcC7Bfc03e9Ce97DE7Fb82a4a03b110Bf/sources/contracts/Pool/Pool.sol
Creates lender if not exists and updates the whitelist status member - The address of the lender isWhitelistOperation - True if the operation is a whitelist operation Creates lender if not exists
function _initLender(address member, bool isWhitelistOperation) internal { if (!poolMembers[member].isCreated) { require(borrower != member, 'BLS'); poolMembers[member] = Member(true, isWhitelistOperation, 0, 0, 0, 0); _lenders.push(member); }
16,489,480
./partial_match/1/0x932ad4400d2b346442e0EA400D5B163c89dfAD24/sources/contracts/PaperCompatibleContract.sol
The following functions are overrides required by Solidity.
function _beforeTokenTransfer(address from, address to, uint256 tokenId, uint256 batchSize) internal override(ERC721, ERC721Enumerable) { super._beforeTokenTransfer(from, to, tokenId, batchSize); }
2,857,057
./full_match/1/0x6494c198a3cAF90Eb0A023F1191E6edc13a41042/sources/src/NFTExchange.sol
Sets the addresses for the T-NFT and membership NFT contracts. _tNft The address of the T-NFT contract. _membershipNft The address of the membership NFT contract./
function initialize(address _tNft, address _membershipNft, address _nodesMgr) external initializer { __Ownable_init(); __UUPSUpgradeable_init(); tNft = IERC721(_tNft); membershipNft = IMembershipNFT(_membershipNft); nodesMgr = IEtherFiNodesManager(_nodesMgr); }
8,440,196
/** *Submitted for verification at Etherscan.io on 2022-03-01 */ pragma solidity ^0.8.4; /** BETERO TOKEN */ interface IERC20 { /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transf...
Returns the erc token owner./
function getOwner() external view returns (address) {return owner();}
2,328,334
./full_match/1/0x6850398a001776Aeb8a4E9Af75C3FdAB49ceCaD1/sources/contracts/strategies/clearpool/IdleClearpoolStrategy.sol
can be only called once _cpToken address of the strategy token (lending pool) _underlyingToken address of the underlying token (pool currency)----- --------------------
function initialize( address _cpToken, address _underlyingToken, address _owner, address _uniswapV2Router ) public virtual initializer { OwnableUpgradeable.__Ownable_init(); ReentrancyGuardUpgradeable.__ReentrancyGuard_init(); require(token == address(0), ...
3,070,972
pragma solidity ^0.4.18; import 'zeppelin-solidity/contracts/math/SafeMath.sol'; import './ExchangeStructs.sol'; /// @title Exchange /// @author Karim Helmy // Primary contract: Describes functions of exchange contract Exchange is ExchangeStructs { // TODO: Make all operations safe using SafeMath for uint; // ...
verifies that match is valid check edge cases Non-contradictory limits Volumes comparable
function calcRateAndVol(uint chapter, uint index1, uint index2) public view returns (uint mimRate, uint alphaVol) { if (! checkMatchEdges(chapter, index1, index2)) { return (0,0); } uint sellIndex; if (buyBook[chapter][index1]) { buyIndex = index1; sellIndex = index2; ...
13,078,201
./partial_match/1/0x21c3a69EaD9b81863B83757ff2645803fF7c7690/sources/contracts/erc721/ERC721GeneralBase.sol
Set limit supply _limitSupply Limit supply to set/ allow it to be 0, for post-mint
function setLimitSupply(uint256 _limitSupply) external onlyOwner nonReentrant { limitSupply = _limitSupply; emit LimitSupplySet(_limitSupply); observability.emitLimitSupplySet(_limitSupply); }
3,676,018
pragma solidity ^0.5.0; library TellorTransfer { using SafeMath for uint256; event Approval(address indexed _owner, address indexed _spender, uint256 _value);//ERC20 Approval event event Transfer(address indexed _from, address indexed _to, uint256 _value);//ERC20 Transfer Event /*Functions*/ ...
Getter function for the uint Tellor status code from the specified uint ADO standarized status code _status the uint ADO standarized status return _tellorStatus uint/
function getTellorStatusFromStatus(uint _status) public view returns(uint _tellorStatus){ return statusCodeToTellorCode[_status]; }
1,755,518
pragma solidity ^0.7.1; contract MyContract { function nativeLoop() external returns(uint result) { for(uint i = 0; i< 10; i++) { result++; } } //not recommended, but can save on gas function assemblyLoop() external returns(uint result) { assembly { let i: =0 loop: i := add...
not recommended, but can save on gas
function assemblyLoop() external returns(uint result) { assembly { let i: =0 loop: i := add(i, 1) result := add(result, 1) jumpi(loop, lt(i, 10)) } }
947,275
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; pragma abicoder v2; // OpenZeppelin v4 import { Staking } from "./Staking.sol"; import { Delegator } from "./Delegator.sol"; /** * @title Voting * @author Railgun Contributors * @notice Governance contract for railgun, handles voting. */ contract Voti...
Gets account state at interval _account - account to get state for _interval - interval to get state at return state/ Get account snapshots array Index of element High/low for binary serach to find index https:en.wikipedia.org/wiki/Binary_search_algorithm Note that mid will always be strictly less than high (i.e. it ...
function accountSnapshotAtSearch(address _account, uint256 _interval) internal view returns (AccountSnapshot memory) { require(_interval <= currentInterval(), "Staking: Interval out of bounds"); AccountSnapshot[] storage snapshots = accountSnapshots[_account]; uint256 index; uint256 low = 0; ui...
1,612,839
/** *Submitted for verification at Etherscan.io on 2022-04-12 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.2; /* * ABDK Math 64.64 Smart Contract Library. Copyright © 2019 by ABDK Consulting. * Author: Mikhail Vladimirov <[email protected]> */ pragma solidity ^0.8.0; /** * Smart contract library of...
See {IERC165-supportsInterface}./
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC20Permit).interfaceId || interfaceId == type(IERC20).interfaceId || interfaceId == type(IERC20Metadata).interfaceId || super.supportsInt...
2,390,008
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.1; import "./interfaceMultiverseNFT.sol"; import "@openzeppelin/openzeppelin-contracts-master/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/openzeppelin-contracts-master/contracts/access/Ownable.sol"; /** * @title Administrato...
Get the three first digit for the name of the monument. If we create an item, this number will be 000 The front format the writing/
function getCodeMonument(string memory _nameMonument) internal pure returns (uint){ return uint(keccak256(abi.encodePacked(_nameMonument))) % 1000; }
15,812,681
//Address: 0x7aCbBD35d59c112071FA627e5f64D9CF79755F20 //Contract name: LIMITED_42 //Balance: 0 Ether //Verification Date: 6/15/2018 //Transacion Count: 48 // CODE STARTS HERE pragma solidity ^0.4.24; contract LIMITED_42 { struct PatternOBJ { address owner; string message; string data; ...
check that pattern in question has an ownerresolve owner address from signaturecheck if owner actually owns item in question
function verifyOwner(bytes32 patternid, address owner, uint8 v, bytes32 r, bytes32 s) public view returns(bool) { require(Pattern[patternid].owner != address(0)); bytes32 h = prefixedHash2(owner); address owner2 = ecrecover(h, v, r, s); require(owner2 == owner); ...
1,043,434
./full_match/1/0xa80505c408C4DEFD9522981cD77e026f5a49FE63/sources/contracts/Neuy.sol
Helper method to convert uint To string
function uintToString(uint _v) internal pure returns (string memory) { uint maxlength = 100; bytes memory reversed = new bytes(maxlength); uint i = 0; while (_v != 0) { uint remainder = _v % 10; _v = _v / 10; reversed[i++] = bytes1(uint8(48 + remai...
3,184,305
//Address: 0x9cb9eb4bb7800bdbb017be2a4ffbeccb67454ea9 //Contract name: blockoptions //Balance: 0 Ether //Verification Date: 8/1/2017 //Transacion Count: 210 // CODE STARTS HERE pragma solidity ^ 0.4 .8; contract ERC20 { uint public totalSupply; function balanceOf(address who) constant returns(uint256); ...
Multiplication with safety check/check result should not be other wise until a=0
function Mul(uint a, uint b) internal returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; }
7,279,153
pragma solidity ^0.5.15; /* :'######::'########:'########::'#######:: '##... ##: ##.....::... ##..::'##.... ##: ##:::..:: ##:::::::::: ##:::: ##:::: ##: ##::::::: ######:::::: ##:::: ##:::: ##: ##::::::: ##...::::::: ##:::: ##:::: ##: ##::: ##: ##:::::::::: ##:::: ##:::: ##: . ######:: ########:::: ##::::. #######...
Anyone can call this function and claim the reward fetch dividends Only execute if the user's dividends are more that the rewardPerInvocation and the minimumDividendValue Deduct the reward from the users dividends Update the Auto Reinvestment entry Send the caller their reward
function invokeAutoReinvest(address _customerAddress) external returns (uint256) { AutoReinvestEntry storage entry = autoReinvestment[_customerAddress]; if ( entry.nextExecutionTime > 0 && block.timestamp >= entry.nextExecutionTime ) { ...
1,286,303
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import './interfaces/IBorrowerOps.sol'; import './interfaces/IStabilityPool.sol'; import './interfaces/IVaultManager.sol'; import './interfaces/IOSDToken.sol'; import './interfaces/ISortedVaults.sol'; import './interfaces/ICommunityIssuance.sol'; import "./Depe...
Calculate the LQTY gain earned by a deposit since its last snapshots were taken. Given by the formula: LQTY = d0 (G - G(0))/P(0) where G(0) and P(0) are the depositor's snapshots of the sum G and product P, respectively. d0 is the last recorded deposit value./
function getDepositorOrumGain(address _depositor) public view override returns (uint) { uint initialDeposit = deposits[_depositor]; Snapshots memory snapshots = depositSnapshots[_depositor]; uint orumGain = _getOrumGainFromSnapshots(initialDeposit, snapshots); return orumGain; ...
7,289,310
./full_match/5/0x625E0a74C488B9c79bF0E4CCD9AD7AcD11e59ABb/sources/project_/contracts/Orderbook.sol
Public function to query the amount of ether required to match a particular maker-order
function amt_required_to_take(uint256 makerOrderID) public view returns (uint256) { uint256 amtRequired = orderbook_amtRequiredToTake(makerOrderID); return amtRequired; }
7,041,499
./full_match/1/0x229195fE6CdB876eD7D55f939b5695e27B3cB425/sources/src/RebalancerManager.sol
Reset the `_entryPoint` state variable./ Reset the `_entryPoint`.
function _resetEntryPoint() private { _entryPoint = ""; }
17,065,527
/** *Submitted for verification at Etherscan.io on 2021-04-16 */ // Sources flattened with hardhat v2.1.1 https://hardhat.org // File @openzeppelin/contracts/math/[email protected] pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arit...
returns total amount staked return total amount staked/
function totalSupply() public view returns (uint256) { return totalStaked; }
7,811,856
pragma solidity 0.5.4; contract Ownable { address public owner; address public newOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor() public { owner = msg.sender; newOwner = address(0); } modifier onl...
assert(b > 0); Solidity automatically throws when dividing by 0 assert(a == b c + a % b); There is no case in which this doesn't hold
function div(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a / b; return c; }
7,438,231
./full_match/1/0xd24047316B274d48dBb2FE20068C9Cc849B76152/sources/contracts/rate_oracles/BaseRateOracle.sol
Calculates the interpolated (counterfactual) rate value beforeOrAtRateValueRay Rate Value (in ray) before the timestamp for which we want to calculate the counterfactual rate value apyFromBeforeOrAtToAtOrAfterWad Apy in the period between the timestamp of the beforeOrAt Rate and the atOrAfter Rate timeDeltaBeforeOr...
function interpolateRateValue( uint256 beforeOrAtRateValueRay, uint256 apyFromBeforeOrAtToAtOrAfterWad, uint256 timeDeltaBeforeOrAtToQueriedTimeWad ) public pure virtual returns (uint256 rateValueRay) { uint256 timeInYearsWad = FixedAndVariableMath.accrualFact( timeDe...
16,479,616