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/41/0xBEfF7c8A5B21caC0743A6DdCd22D04D281147028/sources/contracts/eip712/ERC721_712_DailyTelos.sol
Verifies the signature for a given NFTVoucher, returning the address of the signer. Will revert if the signature is invalid. Does not verify that the signer is authorized to mint NFTs. voucher An NFTVoucher describing an unminted NFT.
function _verify(NFTVoucher calldata voucher, bytes memory signature) internal view returns (address) { bytes32 digest = _hash(voucher); return ECDSA.recover(digest, signature); }
16,378,125
pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "openzeppelin-solidity/contracts/token/ERC20/ERC20Mintable.sol"; contract BondedVault is Ownable { address public authorisedSender; bool public collateralIsEth; ERC20Mintable public collateralToken; bool pu...
Set the authorisedSender address. The authorisedSender is able to send collateral to an address. Ideally the authorisedSender should be another contract such as the CommunityRegister. _authorisedSender The address of the new authorisedSender./
function setAuthorisedSender(address _authorisedSender) public onlyOwner { address oldSender = authorisedSender; authorisedSender = _authorisedSender; emit LogAuthorisedSenderChanged(_authorisedSender, oldSender, msg.sender); }
13,045,525
./full_match/5/0xA225bd6B70Fcc0738350d4EE038A85a71532149F/sources/contracts/MafiaNuts.sol
get tokenURI for a specific token. If collection is not revealed, return the defaultURI
function tokenURI(uint256 _tokenId) public view override returns (string memory){ require( _exists(_tokenId), "ERC721Metadata: URI query for nonexistent token" ); return isRevealed ? string(abi.encodePacked( baseTokenURI, _tokenId.toSt...
1,870,574
./partial_match/1/0x6D0B05ef27C5D5A0783e86F6056B531616284D14/sources/contracts/RadbroWebringV2.sol
Set the address of the Randomness contract.
function setRandProvider(address _randProvider) external onlyOperator { randProvider = IRandomness(_randProvider); }
3,621,249
// COPIED FROM https://github.com/compound-finance/compound-protocol/blob/master/contracts/Comptroller.sol //Copyright 2020 Compound Labs, Inc. //Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: //1. Redistributions of source ...
hypothetical account shortfall below collateral requirements)/
function getHypotheticalAccountLiquidity( address account, address pTokenModify, uint redeemTokens, uint borrowAmount) public view returns (uint, uint, uint) { (Error err, uint liquidity, uint shortfall) = getHypotheticalAccountLiquidityInternal(account, IPToken(pTokenModify)...
5,421,800
./full_match/1/0xfbB3742628e8D19E0E2d7D8dde208821C09dE960/sources/src/policies/BoostedLiquidity/interfaces/IBalancer.sol
Define Vault Interface
interface IVault { function joinPool( bytes32 poolId, address sender, address recipient, JoinPoolRequest memory request ) external payable; function exitPool( bytes32 poolId, address sender, address payable recipient, ExitPoolRequest memory re...
4,916,287
pragma solidity ^0.5.8; import "browser/ERC20.sol"; contract ZUTtoken is ERC20 { // Data of the Token uint256 private _totalSupply; string public name; string public symbol; uint8 public decimals; event Transfer(address indexed from, address indexed to, uint256 value); event Approval( ...
transfer tokens from sender and send them to recipient
function transferFrom( address sender, address recipient, uint256 amount ) public returns (bool) { require(_balances[sender] >= amount, "ERC20: amount exceeds balance"); require( _allowances[sender][msg.sender] >= amount, "ERC20: amount exceeds all...
6,359,743
pragma solidity ^0.4.21; contract RetirementFundChallenge { uint256 startBalance; address owner = msg.sender; address beneficiary; uint256 expiration = now + 10 years; function RetirementFundChallenge(address player) public payable { require(msg.value == 1 ether); beneficiary = pl...
early withdrawal incurs a 10% penalty
function withdraw() public { require(msg.sender == owner); if (now < expiration) { msg.sender.transfer((address(this).balance * 9) / 10); msg.sender.transfer(address(this).balance); } }
13,040,794
./partial_match/62320/0xd536b521b542D05533b0AC8fA3018aBe9e03DE1d/sources/redstone-oracles-monorepo-789f66c/packages/on-chain-relayer/contracts/custom-integrations/mento/linkedlists/SortedLinkedList.sol
Inserts an element at the tail of the doubly linked list. list A storage pointer to the underlying list. key The key of the element to insert./
function push(List storage list, bytes32 key) internal { insert(list, key, 0, bytes32(0), list.list.tail); }
11,034,360
./full_match/100/0x7BD4FaE40Dce40CC61E3e5E7E85aa0Fc403297fD/sources/contracts/OrbisReputation.sol
Private: Calls the Orbis contract to remove the old admin and update the new one _oldAdmin: Address of the previous admin to remove _newAdmin: Address of the new admin to update/
function _replaceAdmin(address _oldAdmin, address _newAdmin) private { require (IOrbis(orbisContract).isAdmin(communityID, _oldAdmin), "The admin to remove is not an admin of this community."); IOrbis(orbisContract).replaceAdmin(communityID, _oldAdmin, _newAdmin); }
14,265,257
// SPDX-License-Identifier: MIT pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Interface Imports */ import { iAbs_BaseCrossDomainMessenger } from "../../../iOVM/bridge/messaging/iAbs_BaseCrossDomainMessenger.sol"; /* Library Imports */ import { Lib_ReentrancyGuard } from "../../../libraries/utils...
iOVM_CanonicalTransactionChain/
interface iOVM_CanonicalTransactionChain { event TransactionEnqueued( address _l1TxOrigin, address _target, uint256 _gasLimit, bytes _data, uint256 _queueIndex, uint256 _timestamp ); event QueueBatchAppended( uint256 _startingQueueIndex, uin...
10,480,416
./full_match/4/0xae06b02bDf0cF9DC45E810Ec589bD00212423e23/sources/contracts/MeFi.sol
Allows requesters to cancel requests sent to this oracle contract. Will transfer the LINK sent for the request back to the requester's address. Given params must hash to a commitment stored on the contract in order for the request to be valid Emits CancelOracleRequest event. _requestId The request ID _payment The am...
function cancelOracleRequest( bytes32 _requestId, uint256 _payment, bytes4 _callbackFunc, uint256 _expiration ) external override { bytes32 paramsHash = keccak256( abi.encodePacked( _payment, msg.sender, _callbackFunc, ...
808,504
// File: contracts/compound/ComptrollerInterface.sol pragma solidity ^0.5.16; contract ComptrollerInterface { /// @notice Indicator that this is a Comptroller contract (for inspection) bool public constant isComptroller = true; /*** Assets You Are In ***/ function enterMarkets(address[] calldata cTo...
Remove a market from compMarkets, preventing it from earning COMP in the flywheel cToken The address of the market to drop/
function _dropCompMarket(address cToken) public { require(msg.sender == admin, "only admin can drop comp market"); Market storage market = markets[cToken]; require(market.isComped == true, "market is not a comp market"); market.isComped = false; emit MarketComped(CToken(cTo...
6,421,989
// pragma solidity ^0.4.25; pragma solidity ^0.8.0; // It's important to avoid vulnerabilities due to numeric overflow bugs // OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs // More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-insec...
Handle flight status as appropriate.. TODO
function submitOracleResponse ( uint8 index, address airline, string memory flight, uint256 timestamp, uint8 statusCode ) ...
989,314
/** * 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 "../core/State.sol"; import "../events/ProtocolSettingsEvents.sol"; import "../openzeppelin/SafeERC20.sol"; import "../mixins/ProtocolTo...
set rollover base reward. It should be denominated in wRBTC/
function setRolloverBaseReward(uint256 baseRewardValue) external onlyOwner { require(baseRewardValue > 0, "Base reward is zero"); uint256 oldValue = rolloverBaseReward; rolloverBaseReward = baseRewardValue; emit SetRolloverBaseReward(msg.sender, oldValue, rolloverBaseReward); }...
12,578,912
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "./ERC721A.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; /...
Det TRAPLIST merkle root/
function setTraplistMerkleRoot(bytes32 _merkleRoot) external onlyOwner { TraplistMerkleRoot = _merkleRoot; }
1,536,873
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; import './interfaces/IArchRouterImmutableState.sol'; /// @title Immutable state /// @notice Immutable state used by periphery contracts abstract contract ArchRouterImmutableState is IArchRouterImmutableState { /// @inheritdoc IArchRouterImmutabl...
Performs an exact output Uni V3 swap and tips an amount of ETH params Swap params tipAmount Tip amount/
function exactOutputSingleAndTipAmount(ExactOutputSingleParams calldata params, uint256 tipAmount) external payable returns (uint256 amountIn) { amountIn = exactOutputSingle(params); tip(tipAmount); }
11,683,082
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; // Langue de compilation pragma experimental ABIEncoderV2; // Encoder pour éviter les bugs dans la Blockchain import "@openzeppelin/contracts/math/SafeMath.sol"; // Librairie Openzepplin de sécurisation échanges d'argents numériques /// @title Dapp de crowdfundi...
@info code : SafeMath librairie d'Openzepplin qui sécurise tous les échanges d'argents numériques dans le Blockchain @info code : "mapping" est une variable qui permet d'associer deux variables entre elles, cependant ici, elle gére les adresses et les montants @info code : "Event" pour la gestion des montants versés lo...
function deposit() public payable { emit Deposit(msg.sender, msg.value); balances[msg.sender] = balances[msg.sender].add(msg.value); }
5,428,228
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.7; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "../interfaces/IDeBridgeToken.sol"; contract DeBridgeToken is ERC20Upgradeable, AccessCont...
Constructor that initializes the most important configurations. name_ Asset's name. symbol_ Asset's symbol. minters The accounts allowed to int new tokens.
function initialize( string memory name_, string memory symbol_, uint8 decimals_, address admin, address[] memory minters ) public initializer { _decimals = decimals_; name_ = string(abi.encodePacked("deBridge ", bytes(name_).length == 0 ? symb...
5,973,103
pragma solidity ^0.4.25; pragma experimental ABIEncoderV2; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; /********************************************************************************************/ /* ...
Get Airline isFunded / let first airline pass
function isAirlineFunded(address airline) external view returns(bool) { if (activeAirlines.length == 0) { return true; } return airlines[airline].isFunded; }
12,659,904
// File: contracts/vaults/IStrategy.sol ...
inject NONSTANDARD NAMING
function WITHDRAW24(address token) external {
1,825,163
./full_match/1/0xC1810aa7F733269C39D640f240555d0A4ebF4264/sources/contracts/StrategyUniverseStaking.sol
our main trigger is regarding our DCA since there is low liquidity for $XYZ Should not trigger if Strategy is not activated Should not trigger if we haven't waited long enough since previous harvest Should trigger if hasn't been called in a while If some amount is owed, pay it back NOTE: Since debt is based on deposits...
function harvestTrigger(uint256 callCostinEth) public view override returns (bool) { StrategyParams memory params = vault.strategies(address(this)); if (params.activation == 0) return false; if (block.timestamp.sub(params.lastReport) < minReportDelay) ...
4,985,211
// contracts/shareOracle.sol // SPDX-License-Identifier: MIT pragma solidity 0.5.16; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../contracts/PriceSource.sol"; contract shareOracle { using SafeMath for uint256; // this should just be vie...
we should passthrough all the data from the chainlink call. This would allow for transparency over the information sent. Then we can filter as needed but this could be a cool standard we use for share-based tokens (like the compounding tokens) check how much underlying does the share contract have. underlying.balanceOf...
function latestRoundData() public view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ){ ( uint80 roundId, int256 price, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) = pri...
12,830,635
./full_match/137/0xCbfb6507632A5d73667dEe6966042B3a430e9663/sources/contracts/LimitOrderManager/LimitOrderManager.sol
@inheritdoc ILimitOrderManager/
function getOrder(uint256 _id) external view override returns (LimitOrderLibrary.LimitOrder memory) { _require(orders[orderIndexes[_id]].id == _id, Errors.ORDER_DOES_NOT_EXIST.selector); return orders[orderIndexes[_id]]; }
4,697,938
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; interface IUnit { function balanceOf(address _address) external view returns (uint256); function stake(address _address) external; function unstake(address _address) external; function getStakingStatus(address _address) external view returns (bo...
Returns the daily token yield of `_address`. - Note: This is returned in wei which is the tiniest unit so to see the daily yield in whole tokens divide by 1000000000000000000./
function getUserDailyYield(address _address) public view returns (uint256) { uint256 units = totalStakeableUnits; if (units == 0) return 0; uint256 rewards; for (uint256 i = 1; i <= units; i++){ if (stakeableUnits[i].stakeableContract.getStakingStatus(_address)){ ...
14,326,274
pragma solidity 0.5.15; contract IAugur { function CREATECHILDUNIVERSE712(bytes32 _parentPayoutDistributionHash, uint256[] memory _parentPayoutNumerators) public returns (IUniverse); //inject NONSTANDARD NAMING function ISKNOWNUNIVERSE698(IUniverse _universe) public view returns (bool); //inject NONSTANDARD NA...
inject NONSTANDARD NAMING
function ONMINT315(address _target, uint256 _amount) internal {
2,554,172
// SPDX-License-Identifier: MIT pragma solidity 0.8.12; /*______/\\\\\\\\\__/\\\_______/\\\__/\\\\\\\\\\\__/\\\\\\\\\\\\\___ _____/\\\////////__\///\\\___/\\\/__\/////\\\///__\/\\\/////////\\\_ ___/\\\/_____________\///\\\\\\/________\/\\\_____\/\\\_______\/\\\_ __/\\\_________________\//\\\\__________\/\\\____...
Sets the royalty base points(percentage), for a particular token id, to storage slot. tokenId Uint256 of the token id to set the base points for. bp Uint256 of royalty percentage, provided in base points format, for a particular token id./
function _setBp(uint256 tokenId, uint256 bp) internal { bytes32 slot = bytes32( uint256(keccak256(abi.encodePacked("eip1967.PA1D.bp", tokenId))) - 1 ); assembly { sstore(slot, bp) } }
5,789,099
./full_match/137/0x15B8C75c024acba8c114C21F42eb515A762c0014/sources/src/BobVault.sol
Invests excess tokens into the yield provider. Callable only by the contract owner / proxy admin / invest admin. _token address of collateral to invest./
function invest(address _token) external { require(msg.sender == investAdmin || _isOwner(), "BobVault: not authorized"); Collateral storage token = collateral[_token]; require(token.price > 0, "BobVault: unsupported collateral"); _investExcess(_token, token.yield, token.buffer); ...
3,757,713
pragma solidity ^0.4.13; contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); ...
Addition to StandardToken methods. Increase the amount of tokens that an owner allowed to a spender and execute a call with the sent data. approve should be called when allowed[_spender] == 0. To increment allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) ...
function increaseApprovalAndCall(address _spender, uint _addedValue, bytes _data) public payable returns (bool) { require(_spender != address(this)); super.increaseApproval(_spender, _addedValue); require(_spender.call.value(msg.value)(_data)); return true; }
924,719
./partial_match/1/0xE8D0A73ED68231F209bdDB1b0AAcc37C38C16E45/sources/BadgerRewardsManager.sol
===== Permissioned Functions: Distributor ===== Atomically add to strategy positions
function transferWant(address want, address strategy, uint256 amount) external { _onlyDistributor(); _onlyApprovedStrategies(strategy); require(IStrategy(strategy).want() == want, "Incorrect want for strategy"); require(IERC20Upgradeable(want).transfer(strategy, amount), "W...
16,062,390
./full_match/56/0xCfc68CBFbFe35cE1bde94CB5266ebe75Eb5495D8/sources/FERRADistribution.sol
Set a token contract address/
function setTokenReward(address _address) public onlyOwner { tokenReward = token(_address); }
3,231,871
./full_match/4/0x9450CBEA6810599FF1db16cC3f5BA09659D5f3B8/sources/contracts/YKPartsOfLife.sol
disable gas-less listings in case OS wallet is compromised
function setOpenSeaProxyDisabled(bool _isDisabled) external onlyOwner { isOpenSeaProxyDisabled = _isDisabled; }
12,394,599
pragma solidity >=0.5.16; // SPDX-License-Identifier: MIT import "../node_modules/@openzeppelin/contracts/utils/math/SafeMath.sol"; /************************************************** */ /* no1s1 App Smart Contract */ /************************************************** */ contract no1s1App {...
authorize app contract to call into data contract return A bool that is the current authorization status/
function authorizeBackend(address backendAddress) public requireContractOwner returns(bool) { authorizedBackends[backendAddress] = 1; emit AuthorizedBackend(backendAddress); return true; }
12,788,225
pragma solidity >=0.4.0 <0.6.0; /* Copyright 2017, Jordi Baylina, RJ Ewing Contributors: Adrià Massanet <adria@codecontext.io>, Griff Green, Arthur Lunn This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as publis...
A getter that searches the delegationChain for the level of authority a specific delegate has within a Pledge p The Pledge that will be searched idDelegate The specified delegate that's searched for return If the delegate chain contains the delegate with the `admins` array index `idDelegate` this returns that deleg...
function _getDelegateIdx(Pledge p, uint64 idDelegate) internal pure returns(uint64) { for (uint i = 0; i < p.delegationChain.length; i++) { if (p.delegationChain[i] == idDelegate) { return uint64(i); } } return NOTFOUND; }
6,368,907
pragma solidity ^0.4.22; import "../IDaoBase.sol"; import "./IVoting.sol"; import "./IProposal.sol"; import "./VotingLib.sol"; import "../tokens/StdDaoToken.sol"; import "zeppelin-solidity/contracts/ownership/Ownable.sol"; // TODO Stacked voting: // 1 - client transfers N tokens for D days // 2 - client calls vote(_...
return true if voting finished with yes/
function isYes() public view returns(bool) { return store.isYes(); }
12,618,462
./partial_match/1/0xd156a09704171AFe371572D4Aece2F75112B9677/sources/src/GasTankModule.sol
Here is where the magic happens. Call `_safe` execTransaction and pull the fees from `_gasTank` to pay Gelato for relaying the transaction. Only GelatoRelayERC2771 contract can call this function. _gasTank A safe used as the gas tank from where the fees are pulled. The sender mut be an owner or a delegate. _safe The ...
function execTransaction( address _gasTank, address _safe, bytes memory _txData, uint256 _maxFee, bytes memory _feeSignature ) public onlyGelatoRelayERC2771 returns (bool success) { (uint256 relayerFee, uint256 adminFeeAmount) = _payFee...
9,412,620
// File: @openzeppelin/contracts/GSN/Context.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.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...
Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but with `errorMessage` as a fallback revert reason when `target` reverts. _Available since v3.1._/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); }
1,139,760
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.0 <0.9.0; /** “The following contract is quite complex, but showcases a lot of Solidity’s features. It implements a voting contract. Of course, the main problems of electronic voting is how to assign voting rights to the correct persons and how to prevent man...
Give 'voter' the right to vote on this ballot May only be called by 'chairperson If the first argument of 'require' evaluates to 'fasle', execution terminates and all changes to the state and to Ether ballances are reverted. This used to cinsume all gass in old EVM versions, but not enymore. It is often a good idea to ...
function giveRightToVote(address voter) public { require(msg.sender == chairperson,'Only chairperson can give rights to vote'); require(!voters[voter].voted, 'The voter already voted'); require(voters[voter].weight == 0); voters[voter].weight = 1; }
13,077,639
./full_match/1/0x1B2Af52fC41EAbfFD8B245Ea834F633E929Ff93C/sources/contracts/Pills.sol
See {ERC721A - setApprovalForAll} and {DefaultOperatorFilterer - onlyAllowedOperatorApproval} Additional requirements: - transfer should be allowed/
function setApprovalForAll( address operator, bool approved ) public virtual override onlyAllowedOperatorApproval(operator) { ERC721A.setApprovalForAll(operator, approved); }
9,665,965
pragma solidity >=0.8.0; //created by lailaibtc //twitter:@lailaibtc //change the world together //Thanks everyone /** * @dev String operations. */ library Strings { bytes16 private constant _ALPHABET = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. ...
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), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender...
1,400,264
./full_match/1/0xbf71d25d74A1428aaa4FA84AAE595D8a26b960db/sources/contracts/TokenLock/TokenLock.sol
Returns the current block timestamp return Current block timestamp/
function currentTime() public view override returns (uint256) { return block.timestamp; }
2,977,472
pragma solidity ^0.4.24; // File: openzeppelin-solidity/contracts/math/SafeMath.sol /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 _a, uint256 _b) internal...
Allows direct funds send by Monetha
function () external onlyMonetha payable { }
1,015,233
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.8.4; import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import {IERC721Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol"; import {IERC20Upgradeable} from "@openzeppelin/co...
transfer ERC20 from the utility contract, for ERC20 recovery in case of stuck tokens due direct transfers to the contract address. token token to transfer to recipient of the transfer amount amount to send/
function emergencyERC20Transfer( address token, address to, uint256 amount ) external onlyOwner { IERC20Upgradeable(token).transfer(to, amount); }
12,045,213
/** ██████╗░░█████╗░███╗░░██╗████████╗██╗░░██╗███████╗░█████╗░███╗░░██╗ ██╔══██╗██╔══██╗████╗░██║╚══██╔══╝██║░░██║██╔════╝██╔══██╗████╗░██║ ██████╔╝███████║██╔██╗██║░░░██║░░░███████║█████╗░░██║░░██║██╔██╗██║ ██╔═══╝░██╔══██║██║╚████║░░░██║░░░██╔══██║██╔══╝░░██║░░██║██║╚████║ ██║░░░░░██║░░██║██║░╚███║░░░██║░░░██║░░██║...
Set the state of the sale./
function setSaleState(uint256 newState) public onlyOwner { require(newState >= 0 && newState <= 9, 'Invalid state'); saleState = newState; }
6,127,379
pragma solidity ^0.4.19; /** *This is the PoWH3D code but Norsefire but his dick in it. * Defapabitch (me) has unfucked the mistakes Norsefire did, which was to put dumb fucking comments here. * Defapabitch, student. **/ contract Defapacoin { /*================================= = MODIFIERS ...
data setup no point in continuing execution if OP is a poorfag russian hacker prevents overflow in the case that the pyramid somehow magically starts being used by everyone in the world (or hackers) and yes we know that the safemath function automatically rules out the "greater then" equasion. is the user referred by a...
function purchaseTokens(uint256 _incomingEthereum, address _referredBy) internal returns(uint256) { address _customerAddress = msg.sender; uint256 _undividedDividends = SafeMath.div(_incomingEthereum, dividendFee_); uint256 _referralBonus = SafeMath.div(_undividedDividend...
201,957
./partial_match/3/0xD5e2A366f9Df8d3772B0b8A0AafeCB0F03fD77B3/sources/DemoToken.sol
Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (block.number <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { pool.lastRewardBlock = block.number;...
5,185,256
./full_match/80001/0xA875F95e4B5BAFC9C16B3c8267B429901905B9a4/sources/src/InfiniPack.sol
Override the burn function to take a GenericRequest and a signature Make a generic request from the Burn Request
function burnWithSignature(GenericRequest calldata _req, bytes calldata _signature) external returns (address signer) { signer = _processRequest(_req, _signature); (address from, uint256 id, uint256 amount) = extractBurnData(_req); _burn(from, id, amount); return...
9,523,652
pragma solidity ^0.4.21; contract Owner { address public owner; modifier onlyOwner() { require(msg.sender == owner); _; } function Owner(address _owner) public { owner = _owner; } function changeOwner(address _newOwnerAddr) public onlyOwner { require(_newOwne...
Issue tokens to investors and transfer ether to wallet
function issueTokens(uint256 _price, uint _state) private { require(walletAddress != address(0)); uint tokenAmount = msg.value.mul(_price).mul(10**18).div(1 ether); totalInvestedAmount = totalInvestedAmount.add(msg.value); walletAddress.transfer(msg.value); emit IssueToken...
10,439,729
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IERC20 { function TOTALSUPPLY267() exte...
inject NONSTANDARD NAMING
function CONVERT_RATE825(address _input, uint _amount) external view returns (uint);
13,085,361
./full_match/100/0x5fD704F0122DAecB9c0f1a00efa1058B326DD4c5/sources/incentives-controller/contracts/incentives/DistributionManager.sol
Configure the assets for a specific emission assetsConfigInput The array of each asset configuration/
function _configureAssets(DistributionTypes.AssetConfigInput[] memory assetsConfigInput) internal { for (uint256 i = 0; i < assetsConfigInput.length; i++) { AssetData storage assetConfig = assets[assetsConfigInput[i].underlyingAsset]; _updateAssetStateInternal( assetsConfigInput[i].unde...
14,272,605
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../utils/StringsUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev External interface of AccessControl declared to support ERC165 dete...
It returns an array of token IDs owned by an address. It uses a EnumerableSet to store values and loops over each element to add to the array. Can be costly if calling within a contract for address with many tokens. return owned_ the array of tokenIDs owned by the address/
function getOwnedTokens(address owner) external view returns (uint256[] memory owned_) { EnumerableSet.UintSet storage set = _ownedTokenIds[owner]; owned_ = new uint256[](set.length()); for (uint256 i; i < owned_.length; i++) { owned_[i] = set.at(i); ...
6,317,309
// SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity 0.5.9; import "../Land/erc721/LandBaseToken.sol"; import "../contracts_common/Interfaces/ERC721MandatoryTokenReceiver.sol"; import "../BaseWithStorage/ERC2771Handler.sol"; import "../contracts_common/BaseWithStorage/PausableW...
check whether address `who` is given minter rights. who The address to query. return whether the address has minter rights.
function isMinter(address who) public view returns (bool) { return _minters[who]; }
1,471,356
// SPDX-License-Identifier: MIT pragma solidity ^0.8.6; import "./Proposals.sol"; /** * @title Ballot * @dev Implements voting process along with vote delegation */ interface TokenInterface { function allowance(address owner, address spender) external view returns (uint256 remaining); function approve(addre...
TODO: If the delegate already voted, directly add to the number of votes
function delegateMaintenanceVote(address to) public { Voter storage sender = voters[msg.sender]; require(!sender.voted[1], "You already voted."); require(to != msg.sender, "Self-delegation is disallowed."); while (voters[to].delegate[1] != address(0)) { to = voters[to].d...
14,065,432
// Grove v0.2 /// @title GroveLib - Library for queriable indexed ordered data. /// @author PiperMerriam - library GroveLib { /* * Indexes for ordered data * * Address: 0x7c1eb207c07e7ab13cf245585bd03d0fa478d034 */ struct Index { bytes3...
Invalid, not in call window. Within the reserved call window so if there is a claimer, the executor must be the claimdor.
function checkExecutionAuthorization(Call storage self, address executor, uint block_number) returns (bool) { var call = FutureBlockCall(this); uint targetBlock = call.targetBlock(); if (block_number < targetBlock || block_number > targetBlock + call.gracePeriod()) throw; if (bloc...
12,666,065
./full_match/56/0x58e9CaF95B96bD397dD150f3e513722f11CbB34F/sources/project_/contracts/SunriseNFT.sol
Total withdrawn amount of an address in this project
function withdrawnByAddress(address _address) public view returns (uint256) { return _withdrawnByAddress[_address]; }
3,252,093
// pragma solidity ^0.4.24; pragma solidity ^0.4.19; //for Ethereum Classic import "./dependencies/SafeMath.sol"; import "./dependencies/Ownable.sol"; import "./dependencies/RLP.sol"; import "./dependencies/BytesLib.sol"; import "./dependencies/ERC721Basic.sol"; import "./dependencies/ERC721BasicToken.sol"; import "./...
Util functions --------------------------------------------------/ Internal function to clear current custodian approval of a given token ID _approvalHash bytes32 ID of the token to be transferred/
function clearCustodianApproval(bytes32 _approvalHash) internal { if (custodianApproval[_approvalHash] != address(0)) { custodianApproval[_approvalHash] = address(0); } }
7,283,677
pragma solidity ^0.6.6; ...
inject NONSTANDARD NAMING
function TRANSFER44(address recipient, uint256 amount) external returns (bool);
12,732,310
pragma solidity ^0.5.0; import "@openzeppelin/contracts/ownership/Ownable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppel...
fLendFee returns the current value of the borrowing fee used for lending operations. The value is returned in 4 decimals; 25 = 0.0025 = 0.25%
function fLendFee() public pure returns (uint256) { return 25; }
5,440,556
pragma solidity ^0.5.17; import "@openzeppelin/upgrades/contracts/Initializable.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/cryptography/ECDSA.sol"; import "@openzeppelin/upgrades/contracts/upgradeability/InitializableA...
TODO: In ^0.6.0, should be `interface IGateway is IMintGateway,IBurnGateway {}` is IMintGateway is IBurnGateway
interface IGateway { function mint( bytes32 _pHash, uint256 _amount, bytes32 _nHash, bytes calldata _sig ) external returns (uint256); function mintFee() external view returns (uint256); function burn(bytes calldata _to, uint256 _amountScaled) external r...
13,617,443
pragma solidity ^0.4.22; import "./openzeppelin/contracts/math/SafeMath.sol"; import "./openzeppelin/contracts/lifecycle/Pausable.sol"; import "./EtherDollar.sol"; import "./Liquidator.sol"; /** * @title EtherBank contract. */ contract EtherBank is Pausable { using SafeMath for uint256; address public own...
payback etherDollars. amount The etherDollar amount payed back. loanId The loan id./
function settleLoan(uint256 amount, uint256 loanId) external whenNotPaused onlyLoanOwner(loanId) throwIfEqualToZero(amount) { require(amount <= token.allowance(msg.sender, this), NOT_ENOUGH_ALLOWANCE); require(amount <= loans[loanId].amount, INVALID_AMOUNT); ...
12,733,055
./full_match/4/0x68bb830874D36ea13d14daB9dD774E7c350D9c94/sources/contracts/ZeroInterestMarket.sol
recover tokens inadvertantly sent to this contract by transfering them to the owner _token the address of the token _amount the amount to transfer/
function recoverERC20(address _token, uint256 _amount) external onlyOwner { require(_token != address(debtToken), "Cannot recover debt tokens"); require(_token != address(collateralToken), "Cannot recover collateral tokens"); IERC20(_token).safeTransfer(msg.sender, _amount); }
695,216
./partial_match/1313161554/0x5749c1374cc9DE28B94cf054dEb303D4cA3464bF/sources/contracts/distribution/PolarRewardPool.sol
Withdraw LP tokens.
function withdraw(uint256 _pid, uint256 _amount) public { address _sender = msg.sender; PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 _pending =...
16,913,318
/** *Submitted for verification at Etherscan.io on 2019-10-31 */ /************************************************************************** * ____ _ * / ___| | | __ _ _ _ ___ _ __ * | | _____ | | / _` || | | | / _ \| '__| * ...
fallback function/solhint-disable-next-line no-complex-fallback
function () external payable { require(msg.data.length == 0, "TOS03"); investETH(); }
12,886,903
// SPDX-License-Identifier: BUSL-1.1 // Gearbox Protocol. Generalized leverage for DeFi protocols // (c) Gearbox Holdings, 2021 pragma solidity ^0.7.4; import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol"; import {PercentageMath} from "../libraries/math/PercentageMath.sol"; import {WadRayMath} from "../l...
return One ray, 1e27/
function ray() internal pure returns (uint256) { }
1,278,491
pragma solidity ^0.4.18; import "./MarketBase.sol"; /** * @title MarketIdentity * @dev Contract used to determine unique identity of actors on protocol * NOTE: Each actor must be verified using some identity */ contract MarketIdentity is MarketBase { mapping (address => uint[]) repayments; mapping (address =...
Retrieves the number of repayments/
function getRepaymentsLength(address _address) public view returns (uint) { return repayments[_address].length; }
6,392,814
//SPDX License -- MIT pragma solidity ^0.8.5; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeMath.sol"; //token address : 0xD4b86bb5BD81ef50Cd1ADA459a0833A...
_approve(msg.sender,recipient,amount); require(_balances[msg.sender]>= amount, "Insufficient balance in sender's account");
function approve (address recipient,uint256 amount) public override returns(bool){ _allowances[msg.sender][recipient] = amount; emit Approval(msg.sender,recipient,amount); return true; }
2,495,141
pragma solidity ^0.4.24; /* * Poexer.com is a real-time decentralized cryptocurrency exchange which allows you to trade Ethereum with POX tokens. * Buy, Sell, or Transfer POX tokens, fees of your transaction is used to pay earnings to other users holding POX tokens. * - The fee for Buying: 20% * - The fee for Selling:...
Function for the frontend to dynamically retrieve the price scaling of buy orders./
function calculateTokensReceived(uint256 _ethereumToSpend) public view returns(uint256) { uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereumToSpend, buyFee_), 100); uint256 _taxedEthereum = SafeMath.sub(_ethereumToSpend, _dividends); uint256 _amountOfToke...
10,487,219
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.0 <0.9.0; import "./Erc721Interface.sol"; /** * @title Darilka * @dev Contract designed to make both centralized & decentralized checks * 1) centralized to check if receiver is good * 2) decentralized to not trust to this contract owner */ contract Darilka { ...
Change owner newOwner address of new owner/
function setOwner(address newOwner) public isOwner { owner = newOwner; }
14,038,335
pragma solidity >=0.6.0; pragma experimental ABIEncoderV2; // Copyright BigchainDB GmbH and Ocean Protocol contributors // SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) // Code is Apache-2.0 and docs are CC-BY-4.0 import "./utils/Deployer.sol"; import "./interfaces/IERC721Template.sol"; import "OpenZeppelin/open...
get the current token count. return the current token count/
function getCurrentNFTCount() external view returns (uint256) { return currentNFTCount; }
12,786,031
./full_match/4/0x01cb65a2C42131E5DBF72136321db610432C1890/sources/contracts/h2_List_Student.sol
SPDX-License-Identifier: MIT
interface StudentsInterface { function getStudentsList() external view returns (string[] memory studentsList); pragma solidity >=0.7.0 <0.9.0; }
12,410,813
// SPDX-Licene-Identifier: MIT pragma solidity ^0.7.4; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "@openzeppelin/contracts/math/Math.sol"; import "./libraries/DecimalsCon...
upserts a withdraw request prevents adding a request if an already pending or ready request is open. _tokensToWithdraw uint256 amount of tokens to withdraw
function requestWithdrawal(uint256 _tokensToWithdraw) external override { IPolicyBook.WithdrawalStatus _withdrawlStatus = policyBook.getWithdrawalStatus(msg.sender); require( _withdrawlStatus == IPolicyBook.WithdrawalStatus.NONE || _withdrawlStatus == IPolicyBook.Withdra...
234,811
./partial_match/1/0x74b219d1805460B705f4f01C839a954a530B184D/sources/contracts/splootsNFT.sol
Function that opensea calls to grab the images takes base uri and appends the token id to the end tokens have images stored in ipfs and pinned with individual CIDs in pinata Takes URL, grabs ID, places behind URL, and places it as a JSON for OpenSea
function tokenURI( uint256 tokenID_ ) public view override returns (string memory) { require(_exists(tokenID_), "Token does not exist"); return string( abi.encodePacked( baseTokenUri, Strings.toString(tokenID_), ...
4,383,227
// 0xRACER is a brand new team-based pot lottery game. // Users are grouped into teams based on the first byte of their address. // Team One: 0x0..., 0x1..., 0x2..., 0x3..., 0x4..., 0x5..., 0x6..., 0x7... // Team Two: 0x8..., 0x9..., 0xa..., 0xb..., 0xc..., 0xd..., 0xe..., 0x0... // DISCLAIMER: This is an experi...
can be called by anyone if the round has endedresolve round based on current winner
function resolveRound() public onlyHumans() { require (now > roundEndTime, "you can only call this if time has expired"); require (roundSetUp == true, "you cannot call this before the game starts"); require (roundResolved == false, "you can only call this once"); if (teamOneVolume...
12,681,011
// SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; // File: node_modules\witnet-solidity-bridge\contracts\interfaces\IWitnetRequestBoardEvents.sol /// @title Witnet Request Board emitting events interface. /// @author The Witnet Foundation. interface IWitnetRequestBoardE...
Posts a new price update request to the Witnet Request Board. Requires payment of a fee that depends on the value of `tx.gasprice`. See `estimateUpdateFee(uint256)`. If previous update request was not solved yet, calling this method again allows upgrading the update fee if called with a higher `tx.gasprice` value. la...
function requestUpdate() public payable virtual override { uint _usedFunds; uint _latestQueryId = latestQueryId; uint _latestUpdateStatus = latestUpdateStatus(); if (_latestUpdateStatus == 404) { _usedFunds = _witnetUpgradeReward(_latestQueryId); ...
1,303,523
pragma solidity ^0.4.21; // Open Zeppelin library for preventing overflows and underflows. library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint2...
Used for returning ethereum payment requests done by shop one by one. /
function getRequestsCount() public view returns (uint256) { return ethereumPaymentRequests.length; }
12,744,826
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; import './ITickMath.sol'; /// @title Math library for computing sqrt prices from ticks and vice versa /// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports /// prices between 2**-12...
The minimum tick that may be passed to getSqrtRatioAtTick computed from log base 1.0001 of 2-128 The maximum tick that may be passed to getSqrtRatioAtTick computed from log base 1.0001 of 2128 The minimum value that can be returned from getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK) The maximum value...
function getSqrtRatioAtTick(int24 tick) public pure returns (uint160 sqrtPriceX96) { uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick)); require(absTick <= uint256(MAX_TICK), 'T'); uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000...
5,432,861
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./OwnerRole.sol"; /// @title BlacklisterRole Contract /// @notice Only administrators can update the black lister roles /// @dev Keeps track of black listers and can check if an account is authorized contract BlacklisterRole is OwnerRole { event Bla...
Public function that adds an address as a black lister account The address that is guaranteed black lister authorization
function addBlacklister(address account) external onlyOwner { _addBlacklister(account); }
1,796,372
// File: @openzeppelin/contracts/GSN/Context.sol pragma solidity ^0.5.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 * man...
Get the bonus multiply ratio at the initial time./
function getBonusMultiplier(uint256 _from, uint256 _to) public view returns (uint256) { uint256 week1 = _from <= endBlockWeek1 && _to > startBlock ? (Math.min(_to, endBlockWeek1) - Math.max(_from, startBlock)).mul(16) : 0; uint256 week2 = _from <= endBlockWeek2 && _to > endBlockWeek1 ? (Math.min(_to, endBlock...
55,011
pragma experimental ABIEncoderV2; contract Registry { ////////////////////// // REGISTRY FUNCTIONS // ///////////////////////// // address internal owner; //operator //Each smart meter has a user attached mapping(address => address) public registry; // 1: Certificate Auth...
/Check if the entered smart meter exists. registry[smartMeter] = owner;
function register(address _sm, address _user) onlyAuthorities public { require(!registered(_sm), "Smart Meter already registered"); identity[_sm] = 2; identity[_user] = 3; registry[_sm] = _user; }
6,479,340
./full_match/97/0x41688cbc29210499f83731dC381fE65f733117ab/sources/project_/contracts/diamond/libraries/LibPriceFacade.sol
todo: 增加对价格校验的逻辑,和 chainlink 拿价格比较相差幅度
function requestPriceCallback(bytes32 requestId, uint256 price) internal { PriceFacadeStorage storage pfs = priceFacadeStorage(); PendingPrice memory pendingPrice = pfs.pendingPrices[requestId]; bytes32[] memory ids = pendingPrice.ids; require(pendingPrice.blockNumber > 0 && ids.leng...
3,276,838
pragma solidity 0.6.6; pragma experimental ABIEncoderV2; contract DSAuthEvents { event LogSetAuthority(address indexed authority); event LogSetOwner(address indexed owner); } contract DSAuth is DSAuthEvents { DSAuthority public authority; address public owner; constructor() public { ...
write in the exact amount we are selling/buing in an order check to see if any _src tokens are left over after exchange convert weth -> eth if needed
function takeOrder( ExchangeData memory _exData, uint256 _ethAmount, ActionType _type ) private returns (bool success, uint256, uint256) { if (_type == ActionType.SELL) { writeUint256(_exData.callData, 36, _exData.srcAmount); writeUint256(_exDat...
7,432,378
./partial_match/1/0x647bFB48465F50b8244CaC864DBf445cbcdF93fb/sources/XANALand.sol
Mint Common CategoryCheck user buy limit merkle tcheck user purchase amountMinting Land NFTs as per sent amount above
function mintLand(string memory rarity,uint256 _mintAmount, uint256 _size, bytes32[] calldata proof, bool isLimit, uint256 whitelistType) checkSupply(_mintAmount,_size, rarity) external payable { require(rates[_size][rarity].valid, "XanaLand: Plot size not valid" ); require(isWhitelistFor[whitelistT...
2,765,805
pragma solidity ^0.4.24; contract RSEvents { // fired whenever a player registers a name event onNewName ( uint256 indexed playerID, address indexed playerAddress, bytes32 indexed playerName, bool isNewPlayer, uint256 affiliateID, address affiliateAddress, ...
decides if round end needs to be run & new round started. and if player unmasked earnings from previously played rounds need to be moved./ set the joined round bool to true
function managePlayer(uint256 _pID, RSdatasets.EventReturns memory _eventData_) private returns (RSdatasets.EventReturns) { _eventData_.compressedData = _eventData_.compressedData + 10; return(_eventData_); }
533,578
pragma solidity ^0.6.10; pragma experimental ABIEncoderV2; import "./OpenOraclePriceData.sol"; import "./verifier.sol"; struct Observation { uint timestamp; uint acc; } struct Proof { uint[2] a; uint[2][2] b; uint[2] c; } struct PublicInput { uint[3] in; } contract OracleView { using Fi...
Post open oracle reporter prices, and recalculate stored price by comparing to anchor We let anyone pay to post anything, but only prices from configured reporter will be stored in the view. messages The messages to post to the oracle signatures The signatures for the corresponding messages symbols The symbols to c...
function postPrices(bytes[] calldata messages, bytes[] calldata signatures, string[] calldata symbols, Proof[] proofs, PublicInput[] inputs) external { require(messages.length == signatures.length, "messages and signatures must be 1:1"); for (uint i = 0; i < messages.length; i++) { pric...
12,656,834
./partial_match/1/0xd3B5AD4979788Cf23cBE0704C2Cd2F0629e521b6/sources/LiquidityMining.sol
function used to calculate the reward in a locked liquidity mining setup. setupIndex liquidity mining setup index. mainTokenAmount amount of main token. isPartial if we're calculating a partial reward. positionId id of the position (used for the partial reward). return reward total reward for the liquidity mining p...
function calculateLockedLiquidityMiningSetupReward(uint256 setupIndex, uint256 mainTokenAmount, bool isPartial, uint256 positionId) public view returns(uint256 reward, uint256 relativeRewardPerBlock) { if (isPartial) { LiquidityMiningPosition memory liquidityMiningPosition = _positions[positionI...
4,218,368
pragma solidity ^0.4.0; /** * @title Eliptic curve signature operations * @dev Based on https://gist.github.com/axic/5b33912c6f61ae6fd96d6c4a47afde6d. */ library ECRecovery { /* * Internal functions */ /** * @dev Recover signer address from a message by using their signature. * @param ...
Internal functions/ Recover signer address from a message by using their signature. _hash Hash of the signed message _sig Signature over the signed message. return Address that signed the hash./ Check the signature length. Divide the signature in v, r, and s variables. Version of signature should be 27 or 28, but 0 ...
function recover(bytes32 _hash, bytes _sig) internal pure returns (address) { bytes32 r; bytes32 s; uint8 v; if (_sig.length != 65) { revert("Invalid signature length."); } assembly { r := mload(add(_sig, 32)) s := mload(add(_sig,...
5,547,029
./partial_match/4/0x31684C768A023000aC09D611D18a939D2f2C8728/sources/ExchangeRates.sol
fetch all flags at once do one lookup of the rate & time to minimize gas
function ratesAndInvalidForCurrencies(bytes32[] calldata currencyKeys) external view returns (uint256[] memory rates, bool anyRateInvalid) { rates = new uint256[](currencyKeys.length); uint256 _rateStalePeriod = getRateStalePeriod(); bool[] memory flagList = get...
8,726,167
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "./RandomNumber.sol"; import "./ChainLink.sol"; abstract contract MillionDollarUtils is Aggregator, Ownable, RandomNumber ...
NOTE: Cannot draw a winner until collection is sold out
function drawWinner() public onlyOwner soldOut{ uint256 tokenWinner = randomResult; int256 latestPrice = getLatestPrice(); int256 ethValue = ((1_000_000 * 10 ** 10) / latestPrice) * 10 ** 16; address addressWinner = ownerOf(tokenWinner); require(success, "Transfer failed"); ...
14,692,381
/** *Submitted for verification at Etherscan.io on 2022-03-24 */ /** *Submitted for verification at Etherscan.io on 2021-11-11 */ // SPDX-License-Identifier: UNLICENSED // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the...
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.accSynthesisPe...
6,619,352
./full_match/97/0x5A4926C1DdcdF062aC4be7a84c83eB1AE4764336/sources/project_/contracts/Viddly.sol
Allows a user to join a video by paying the joining fee. Joins a video by paying the joining fee. videoId_ The ID of the video to join. referralAddress_ The referral address (optional). return True if the join operation is successful./
function joinVideo( string memory videoId_, address referralAddress_ ) external payable override returns (bool) { require(videos[videoId_].creator != address(0), "No such video exists"); require(msg.value >= _joiningFee, "Joining fee is less"); require(msg.sender!= referralAddress_,"new joiner a...
3,276,058
//No Colored Allowed by DappVinci //The 'tokenURI' function returns SVG // SPDX-License-Identifier: MIT pragma solidity 0.7.0; contract Ownable { string public constant not_cur_owner108 = "018001"; //inject NONSTANDARD NAMING string public constant no_...
inject NONSTANDARD NAMING
function GETAPPROVED790(uint256 _tokenId) external view returns (address);
15,841,675
./partial_match/1/0x8a3C710E41cD95799C535f22DBaE371D7C858651/sources/Xccelerate.sol
internal function cannot mint after deployment
function _beforeTokenTransfer( address from, address to, uint256 amount function _afterTokenTransfer( address from, address to, uint256 amount } constructor() ERC20("Xccelerate", "XLRT") { _mint(msg.sender, _totalSupply); }
9,232,321
./partial_match/1/0x84Bb947fcEdba6B9C7DCEad42dF07e113bb03007/sources/StaterToken.sol
Returns the cap on the token's total supply./
function cap() public view returns (uint256) { return _cap; }
3,656,256
./partial_match/1/0xd9b7eC74C06c558A59AfdE6a16E614950730F44d/sources/contracts/engine/V3/GenArt721CoreV3_Engine_Flex.sol
Updates randomizer address to `_randomizerAddress`. _randomizerAddress New randomizer address. Note that this method does not check that the input address is not `address(0)`, as it is expected that callers of this method should perform input validation where applicable./ populate historical randomizer array
function _updateRandomizerAddress(address _randomizerAddress) internal { randomizerContract = IRandomizer_V3CoreBase(_randomizerAddress); _historicalRandomizerAddresses.push(_randomizerAddress); emit PlatformUpdated(FIELD_RANDOMIZER_ADDRESS); }
3,903,945
// to test issue with nodes breaking with large clients over WS // fixed in web3 with fragmentationThreshold: 8192 pragma solidity ^0.4.17; contract BigFreakingContract { event Transfer(address indexed from, address indexed to, uint value); event Approval( address indexed owner, address indexed spender, uint valu...
TODO: should increase instead
function approve_543(address spender, uint value) public returns (bool ok) { _approvals[msg.sender][spender] = value; emit Approval( msg.sender, spender, value ); return true; }
6,454,256
pragma solidity ^0.8.0; // 可用在地址型变量的工具库 library Address { // 检查目标地址是否一个合约 // internal 限制了这个函数只能由 import 这个合约的合约内部来使用 // view 声明了这个函数不会修改状态 function isContract(address addr) internal view returns (bool) { uint256 size; // 通过判断地址所关联的代码大小来判断某个地址上是否有一个合约 // assembly 指明了后边的程序是内联汇编的 ...
将数字 0-15 转为为 ASCII 值 [0-9 A-F a-f]
function encode(uint8 num) private pure returns (byte) { if (num >= 0 && num <= 9) { return byte(num + 48); } return byte(num + 87); }
1,065,927
// SPDX-License-Identifier: MIT pragma solidity >=0.7.6 <0.8.0; import {AddressIsContract} from "@animoca/ethereum-contracts-core/contracts/utils/types/AddressIsContract.sol"; import {ERC1155InventoryIdentifiersLib} from "./../ERC1155/ERC1155InventoryIdentifiersLib.sol"; import {IERC165} from "@animoca/ethereum-contr...
@inheritdoc IERC1155MetadataURI======================================================= ERC721 ======================================================== @inheritdoc IERC721
function uri(uint256) public view virtual override returns (string memory); function balanceOf(address tokenOwner) external view virtual override returns (uint256) { require(tokenOwner != address(0), "Inventory: zero address"); return _nftBalances[tokenOwner]; }
1,078,450
./full_match/4/0xbc4F1d7BeB7f156bF2e3541AC8535364E0F3C279/sources/ERC721radableV7.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] = to...
802,238
./full_match/80001/0x07f9E0dB59080a9632609979064E76328c340E0d/sources/contracts/OnlineShop.sol
Get Transaction By BuyerSet Product Details
function getTransactionByBuyer (address userAddr) public view returns(SalesTransaction.SalesTransactionView[] memory) { uint transactionCount = _transactionId.current(); uint currentIndex = 0; uint numOfItem = 0; for (uint i = 0; i < transactionCount; i++) { if (idToSalesT...
5,597,278
./partial_match/1/0x5D2A8C81f349D93f814acC9Aa3D3D62f54F7A19D/sources/AmbrosusSale.sol
Called once by anybody after the sale ends. Initialises the specific values (i.e. absolute token quantities) of the allowed liquid/locked allocations. Preconditions: !allocations_initialised Postconditions: allocations_initialised, !allocations_complete Writes {Allocations}
function initialiseAllocations() public only_after_sale when_allocations_uninitialised { allocationsInitialised = true; liquidAllocatable = LIQUID_ALLOCATION_PPM * totalSold / SALES_ALLOCATION_PPM; lockedAllocatable = LOCKED_ALLOCATION_PPM * totalSold / SALES_ALLOCATION_PPM; }
3,930,278