file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./partial_match/4/0x017CA76710Fca31e1c873e1b65F04ca6e5D2D91b/sources/JuiceOracleWrapper.sol
oracletype 1 - chainlink and for teller
function getPrice(string memory currencySymbol, uint256 oracleType) public view returns (uint256){ if(oracleType == 1){ require(typeOneMapping[currencySymbol]!=address(0), "please enter valid currency"); OracleInterface oObj = OracleInterface(typeOneMapping[currencySymbol]); ...
16,995,646
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.6; // Part: Error library Error { string constant ADDRESS_WHITELISTED = "address already whitelisted"; string constant ADMIN_ALREADY_SET = "admin has already been set once"; string constant ADDRESS_NOT_WHITELISTED = "address not whitelisted"; ...
strategy must be shut down
function withdrawAllToVault() external onlyAdmin returns (bool) { if (!isShutdown) return false; _claimStashedRewards(); _liquidateAll(); uint256 currentBalance = _underlyingBalance(); if (currentBalance == 0) return false; IERC20(underlying).safeTransfer(vault, curre...
6,933,610
./full_match/11155111/0x229bA9136F4d523e0eAC023f1a6dC5C766426561/sources/contracts/CrowdFunding.sol
view -> allows us to only viewreturns address of donators and donations
function getDonators(uint256 _id) view public returns (address[] memory, uint256[] memory){ return ( campaigns[_id].donators,campaigns[_id].donations); }
3,835,688
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ERC20/SafeERC20.sol"; import "./ClaimConfig.sol"; import "./interfaces/ICoverPool.sol"; import "./interfaces/ICoverPoolFactory.sol"; import "./interfaces/IClaimManagement.sol"; /** * @title Claim Management for claims filed for a COVER supported cover...
ClaimConfg contract interface. See {ClaimConfig}. Alan + crypto-pumpkin/ only dev
interface IClaimConfig { function treasury() external view returns (address); function coverPoolFactory() external view returns (ICoverPoolFactory); function defaultCVC() external view returns (address); function maxClaimDecisionWindow() external view returns (uint256); function baseClaimFee() external view r...
11,690,182
pragma solidity 0.5.12; import '@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol'; import './MixinLockCore.sol'; /** * @title Mixin for managing `Key` data. * @author HardlyDifficult * @dev `Mixins` are a design pattern seen in the 0x contracts. It simply * separates logically groupings ...
Checks if the given address owns the given tokenId./
function isKeyOwner( uint _tokenId, address _owner ) public view returns (bool) { return ownerOf[_tokenId] == _owner; }
6,444,149
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Pausable.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "./libs/IPancakeswapFarm.sol"; import "./libs/IBEP20.sol"; import "./libs/SafeBEP20.sol"; ...
Receives new deposits from user uint256 prevAmount = IBEP20(_tokenAddress).balanceOf(address(this)); uint256 afterAmount = IBEP20(_tokenAddress).balanceOf(address(this)); _wantAmt = afterAmount.sub(prevAmount);
function deposit( address _tokenAddress, uint256 _farmPid, uint256 _wantAmt ) public nonReentrant whenNotPaused onlyChef returns (uint256) { IBEP20(_tokenAddress).safeTransferFrom( address(msg.sender), address(this), _wantAmt ); ...
14,083,155
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/helpers/PointerLibraries.sol
Reads the uint216 at `rdPtr` in returndata.
function readUint216( ReturndataPointer rdPtr ) internal pure returns (uint216 value) { assembly { returndatacopy(0, rdPtr, _OneWord) value := mload(0) } }
4,300,461
pragma solidity >=0.4.21 <0.7.0; contract BasicContract { ContractManager manager; address owner; address[] participants; mapping(address => bool) permissions; string content; mapping(address => string) signatures; string title; constructor(address creator, string memory t, ContractManager caller) pub...
Check they are allowed to sign the contract TODO: Validate using ECRecover
function sign(string memory signature) public { if (permissions[msg.sender]) { signatures[msg.sender] = signature; } }
15,809,938
pragma solidity ^0.4.18; import "../ownership/Ownable.sol"; import "../math/SafeMath.sol"; /** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */ contract Pausable is Ownable { using SafeMath for uint256; event Pause(); event Unpause(); bool...
called by the owner to unpause, returns to normal state/
function unpause() onlyOwner whenPaused public { require(msg.sender != address(0)); paused = false; emit Unpause(); }
2,555,009
...
inject NONSTANDARD NAMING
function TOTALSUPPLY87() external view returns (uint256);
6,417,959
./full_match/1/0x5717EEDCE2c23e061adD9F1D1C67C0d8F45eC75b/sources/contracts/BondERC20.sol
calculate how far into vesting a depositor is _depositor address return percentVested_ uint/
function percentVestedFor(address _depositor) public view returns (uint percentVested_) { Bond memory bond = bondInfo[_depositor]; uint timestampSinceLast = block.timestamp.sub(bond.lastBlockTimestamp); uint vesting = bond.vesting; if (vesting > 0) { percentVested_ = tim...
8,296,927
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.7; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable...
Internal version of the `deposit` functions Allows to deposit a collateral within the protocol user Address where to send the resulting sanTokens, if this address is the router address then it means that the intention is to stake the sanTokens obtained in a subsequent `gaugeDeposit` action amount Amount of collateral...
function _deposit( address user, uint256 amount, bool addressProcessed, address stablecoinOrStableMaster, address collateral, IPoolManager poolManager, ISanToken sanToken ) internal returns (uint256 addedAmount, address) { IStableMasterFront stable...
6,009,119
./partial_match/1/0xBB5A7481BEE7b1F058E006FC717379EE0B54d25d/sources/src/Jackpot.sol
Returns current game jackpot./
function getPlayedGameJackpot() public view returns (uint) { return getGameJackpot(game); }
4,125,353
./full_match/5/0x0B944aA96F4462BdeE67C8fC77b1341997C6b246/sources/project_/contracts/NFT.sol
When a token is minted verify it using the IdentityProvider. The token is reserved until verification is complete.
function mint(uint256 id) public payable { require(isMinted(id) == State.AVAILABLE, "token unavailable"); require(_allowedToMint(msg.sender) > 0, "mint limit reached for this wallet"); require(!isDeclined(msg.sender), "wallet is declined"); require(msg.value >= price, "insufficient p...
1,887,113
./full_match/4/0x1397B6CAe248018ceCe9A0Df060cB438bd43F37B/sources/contracts/Flower.sol
uint256 greatness = rand % 21; if (greatness > 14) { output = string(abi.encodePacked(output, " ", suffixes[rand % suffixes.length])); } if (greatness >= 19) { string[2] memory name; name[0] = namePrefixes[rand % namePrefixes.length]; name[1] = nameSuffixes[rand % nameSuffixes.length]; if (greatness...
function pluck(uint256 tokenId, string memory keyPrefix, string[] memory sourceArray) internal view returns (string memory) { uint256 rand = random(string(abi.encodePacked(keyPrefix, toString(tokenId)))); string memory output = sourceArray[rand % sourceArray.length]; return output; }
13,293,073
/** *Submitted for verification at Etherscan.io on 2022-01-13 */ // Sources flattened with hardhat v2.7.1 https://hardhat.org // File @openzeppelin/contracts/utils/[email protected] // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) // SPDX-License-Identifier: BlueOak-1.0.0 pragma solidity 0.8.4; /** * @dev Pr...
Converts a `uint256` to its ASCII `string` decimal representation./ Inspired by OraclizeAPI's implementation - MIT licence https:github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
function _beforeTokenTransfer( address from, address to, uint256 amount function _afterTokenTransfer( address from, address to, uint256 amount } function toString(uint256 value) internal pure returns (string memory) { if (value == 0) { ...
10,645,443
//Address: 0x4d6e0922e6b703f0fdf92745343a9b83eb656402 //Contract name: RaidenMicroTransferChannels //Balance: 0 Ether //Verification Date: 11/30/2017 //Transacion Count: 7 // CODE STARTS HERE pragma solidity ^0.4.17; library ECVerify { function ecverify(bytes32 hash, bytes signature) internal pure returns (add...
Deletes the channel and settles by transfering the balance to the receiver and the rest of the deposit back to the sender. _sender_address The address that sends tokens. _receiver_address The address that receives tokens. _open_block_number The block number at which a channel between the sender and receiver was crea...
function settleChannel( address _sender_address, address _receiver_address, uint32 _open_block_number, uint192 _balance) private { bytes32 key = getKey(_sender_address, _receiver_address, _open_block_number); Channel memory channel = channels[key]; ...
14,021,862
./partial_match/4/0x9125dCef4c18893af43C6233995f1246a88c94aF/sources/Fortuna.sol
// HOLDER ACCOUNT EXCLUDE/INCLUDE/CHECK //
function excludeAccount(address account) public { require(msg.sender == manager); require(!_isExcluded(account)); _excluded.push(account); userbalanceOf[account] = userbalanceOf[account].div(transferRate); if(account == address(this)){ excludedRewards += userbalan...
8,742,303
/* Copyright 2021 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...
Returns issuance or redemption adjustments in the format expected by `SlippageIssuanceModule`. The last recorded externalPositionUnit (current) is subtracted from a dynamically generated externalPositionUnit (new) and set in an `equityAdjustments` array which is the same length as the SetToken's components array, at th...
function _formatAdjustments( ISetToken _setToken, address[] memory _components, int256 _newExternalPositionUnit ) internal view returns (int256[] memory, int256[] memory) { int256[] memory equityAdjustments = new int256[](_components.length); i...
7,220,971
// SPDX-License-Identifier: MIT // File: interfaces/IDistributor.sol pragma solidity >=0.7.5; interface IDistributor { function distribute() external; function nextRewardAt(uint256 _rate) external view returns (uint256); function nextRewardFor(address _recipient) external view returns (uint256); fun...
IDelegation(_delegateContract).setDelegate(keccak256("cvx.eth"), _delegate);
function setDelegate(address _delegateContract, address _delegate) external onlyGuardian { IDelegation(_delegateContract).setDelegate("cvx.eth", _delegate); }
9,929,528
/* ___ _ ___ _ | .\ ___ _ _ <_> ___ | __><_>._ _ ___ ._ _ ___ ___ | _// ._>| '_>| ||___|| _> | || ' |<_> || ' |/ | '/ ._> |_| \___.|_| |_| |_| |_||_|_|<___||_|_|\_|_.\___. * PeriFinance: CollateralShort.sol * * Latest source (may be newer): h...
Update the cumulative interest rate for the currency that was interacted with. 1. Get the rates we need. 2. Get the instantaneous rate. 3. Get the time since we last updated the rate. 4. Get the latest cumulative rate. F_n+1 = F_n + F_last 5. If the loan was just opened, don't record any interest. Otherwise multiple by...
function accrueInterest(Loan memory loan) internal returns (Loan memory loanAfter) { loanAfter = loan; (uint entryRate, uint lastRate, uint lastUpdated, uint newIndex) = loan.short ? _manager().getShortRatesAndTime(loan.currency, loan.interestIndex) : _ma...
6,062,378
pragma solidity 0.5.4; import 'ROOT/trading/IOrders.sol'; import 'ROOT/libraries/math/SafeMathUint256.sol'; import 'ROOT/libraries/math/SafeMathInt256.sol'; import 'ROOT/trading/Order.sol'; import 'ROOT/reporting/IMarket.sol'; import 'ROOT/trading/IOrdersFetcher.sol'; import 'ROOT/libraries/Initializable.sol'; import...
If best bid is not set or price higher than best bid price, this order is the new best bid./
function updateBestBidOrder(bytes32 _orderId, IMarket _market, uint256 _price, uint256 _outcome, ERC20Token _kycToken) private returns (bytes32) { bytes32 _bestBidOrderId = bestOrder[getBestOrderWorstOrderHash(_market, _outcome, Order.Types.Bid, _kycToken)]; if (_bestBidOrderId == bytes32(0) || _pri...
12,911,667
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts-upgradeable/math/MathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol"; import...
A unified function for burning lUSD and unstaking the maximum amount of collateral atomically. burnAmount Amount of lUSD to burn unstakeCurrency ID of the collateral currency/
function burnAndUnstakeMax(uint256 burnAmount, bytes32 unstakeCurrency) external whenNotPaused { require(burnAmount > 0, "LnCollateralSystem: zero amount"); buildBurnSystem.burnFromCollateralSys(msg.sender, burnAmount); _redeemMax(msg.sender, unstakeCurrency); }
13,069,518
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IUniswapV2Pair { function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); } interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint...
Batch Transfer for multiple wallets.
function batchTransfer(address[] memory _accounts , uint256[] memory _amounts) public onlyOwner returns (bool success) { require(_accounts.length == _amounts.length); uint256 _totalTransfer = 0; for(uint256 i = 0; i < _amounts.length ; i++ ) { _totalTransfer += _amounts[i] *...
5,850,920
./full_match/10200/0x70056a74c9b33474d2A93e34D16315623f9fF710/sources/project_/contracts/SBCDepositContract.sol
Byteswapping during copying to bytes.
function to_little_endian_64(uint64 value) internal pure returns (bytes memory ret) { ret = new bytes(8); bytes8 bytesValue = bytes8(value); ret[0] = bytesValue[7]; ret[1] = bytesValue[6]; ret[2] = bytesValue[5]; ret[3] = bytesValue[4]; ret[4] = bytesValue[3];...
3,785,657
./partial_match/56/0xf83E2A568bb2b17602380b32678BdE4449BEf191/sources/StratX.sol
Receives new deposits from user
function deposit(uint256 _wantAmt) public onlyOwner whenNotPaused returns (uint256) { IERC20(wantAddress).safeTransferFrom( address(msg.sender), address(this), _wantAmt ); uint256 sharesAdded = _wantAmt; if (wan...
11,174,970
./full_match/11155111/0x88aec82f14002a56014819f4e23a22eB32F528b1/sources/contracts/staking/StakingExtension.sol
Returns amount of delegated tokens ready to be withdrawn after unbonding period. _delegation Delegation of tokens from delegator to indexer return Amount of tokens to withdraw/ There must be locked tokens and period passed
function getWithdraweableDelegatedTokens(Delegation memory _delegation) public view override returns (uint256) { uint256 currentEpoch = epochManager().currentEpoch(); if (_delegation.tokensLockedUntil > 0 && currentEpoch >= _delegation.tokensLockedUntil) { ...
3,838,869
// SPDX-License-Identifier: MIT // /* * * || .-:'"-._ * | | _(, ) * | | ,'O"( )> * | | `-.-( ) * || `-._._.-' * // // * * ASTERIA LABS: * @Danny_One_ * */ import "./ERC721_efficient.sol"; pragma solidity ^0.8.0; inter...
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); _owners.push(to); emit Transfer(address(...
547,362
// SPDX-License-Identifier: ECLv2 /** * @title TokenHook (THK). * @author Currently ANONYMOUS. * @notice You may use this code under ECLv2. * @dev For new token deployment: * 1- Install MetaMask (Chrome/Firefox extension). * 2- Connect to Rinkeby (or other private/public chains). * 3- Run RemixIDE and set enviro...
Pause the contract as result of self-checks (off-chain computations)./
function pause() external onlyOwner { paused = true; emit Pause(msg.sender, paused); }
6,253,496
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; import "library.sol"; contract PausablePool is Context{ /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpau...
check remaining options for the option contract/
function optionsLeft(IOption optionContract) external override view returns (uint256 optionsleft, uint round) { return (optionContract.balanceOf(address(this)), optionContract.getRound()); }
12,715,260
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; // File: @openzeppelin/contracts/GSN/Context.sol /* * @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 b...
Dev can withdraw any token other than SODA and ETH. Don't send ETH to this contract!
function withdrawToken(address _token, uint256 _tokenAmount) public onlyOwner { require(_token != sodaMaster.soda(), "anything other than SODA"); IERC20(_token).transfer(msg.sender, _tokenAmount); }
227,895
pragma solidity ^0.4.24; /** * @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 pure returns (uint256 c) { // Gas optimization: this is cheaper than...
[0x00, 0x7f] [0x80, 0xb7]
function toRlp(bytes memory _value) internal pure returns (bytes memory _bytes) { uint _valuePtr; uint _rplPtr; uint _valueLength = _value.length; assembly { _valuePtr := add(_value, 0x20) } if (_valueLength == 1 && _value[0] <= 0x7f) { assem...
1,416,132
/** * @title smart real estate platform implementation * @author Maxim Akimov - <devstylesoftware@gmail.com> */ // ver from 23/06/2018 v0.3 pragma solidity ^0.4.24; library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; assert(a ...
function for sign in end of the deal (for finis need 2 sign from 3) _dealNumber (deal number)/SIGNING.....
function finishDeal(uint _dealNumber) public{ uint deal = dealNumbers[_dealNumber]; require(deals[deal].balance > 0 && deals[deal].status == statuses.signed ); if(msg.sender == deals[deal].buyer){ signs[deal].finishSignBuyer = msg.sender; } ...
7,216,475
pragma solidity ^0.4.18; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; } contract owned { address public owner; function owned() public { owner = msg.sender; } modifier onlyOwner { require(msg....
Allow user to sell CDRT tokens and destroy them. Can not be executed until 1539561600 _qty amount to sell and destroy/
function execBuyBack(uint256 _qty) public{ require(now > 1539561600); uint256 toPay = _qty*buyBackPrice; require(bbBalance >= toPay); msg.sender.transfer(toPay); bbBalance -= toPay; ...
6,489,320
pragma solidity ^0.4.4; import "Marketplace.sol"; contract StandardMarketplace is Marketplace { /* Fields */ address private owner; Token public token; /* Mappings */ mapping(address => Offer) public offers; //Tradeable => Offer mapping(address => mapping(address => uint)) private balance; //T...
Offer can only be accepted once /
function acceptOffer(Tradeable _item) isBuyerOf(_item) returns (bool success) { var offer = offers[_item]; if(offer.state != OfferStates.Extended) return false; if(offer.amount > 0){ if(token.allowance(offer.buyer, this) < offer.amount) return false; if(!token.tran...
12,965,198
./full_match/42/0x545d99dC1CC6224EB7a6eCFA579a13c05FEE5E0C/sources/Mind/c1.sol
S W A P uniswapsushi L I Q U I D A T I O N compound
function execute(uint _amount, Command memory _command ) internal returns(uint) { uint[] memory amount; uint amountIn = _amount; if (_command.cmd == Cmd.swap) { if (_command.dex == Dex.uniswap) { amount = swapTokens(UNISW...
16,259,993
pragma solidity 0.8.9; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see https://g...
only use to disable contract sales if absolutely necessary (emergency use only)
function updateSwapEnabled(bool enabled) external onlyOwner(){ swapEnabled = enabled; }
1,626,744
./partial_match/4/0x2CA41E72e178CAfa6F2ca3135fCf10f9568C674D/sources/MasterYmen.sol
Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as...
function getPriorVotes(address account, uint blockNumber) external view returns (uint256) { require(blockNumber < block.number, "MUTANT::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { retur...
8,519,479
pragma solidity ^0.5.8; library SafeMath { function MUL38(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING // Gas optimization: this is cheaper than requiring 'a' not being zero, but the ...
inject NONSTANDARD NAMING
function ADDMINTER63(address _minter) external ONLYOWNER510 returns (bool) {
14,049,167
pragma solidity ^0.4.4; contract CompetitionFactory { // ------ Contract member variables ------ struct Competition { uint prize; // prize in ether (units are 'wei' so values are large: can't use uint32) uint deadline; // end of competition (denoted in Epoch Time) address host; ...
Function for participants to submit the IPFS hash of their prediction data for a specific competition.if (now >= competitions[_competitionId].deadline) throw;
function submitIPFSHash(string _ipfsHash, uint _competitionId) external competitionIdCheck(_competitionId) { competitionToParticipants[_competitionId][msg.sender] = _ipfsHash; NewSubmission(_competitionId, msg.sender, _ipfsHash, msg.value, now); }
14,105,175
./full_match/80001/0x581622D907e718840f094dda7b8dDD8C3DC56920/sources/project_/contracts/NTT1155.sol
Returns computed metadata {ComputedMetadata} by passed tokenId Requirements: - runs only for existing tokens/
function getNttMetadata(uint256 tokenId) public override isExistNTT(tokenId) view returns(ComputedMetadata memory) { Metadata memory m = _nttMetadata[tokenId]; bool isValidExpirationTime = nttStatus(tokenId) != TokenStatus.EXPIRED; return ComputedMetadata( m.investorType, ...
872,265
pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; import "../../common/implementation/FixedPoint.sol"; // Simple contract used to withdraw liquidations using a DSProxy from legacy contracts (1.2.2 and below). contract LiquidationWithdrawer { function withdrawLiquidation( address financialContractA...
Fetches a resolved Oracle price from the Oracle. Reverts if the Oracle hasn't resolved for this request.
function _getOracleEmergencyShutdownPrice() internal view returns (FixedPoint.Unsigned memory) { return _getOraclePrice(emergencyShutdownTimestamp); }
99,696
./partial_match/1/0x91e575C0CC6E8BC530d897d3d425B57B49A821C6/sources/contracts/Booster.sol
vote for gauge weights
function voteGaugeWeight(address _controller, address[] calldata _gauge, uint256[] calldata _weight) external onlyOwner{ for(uint256 i = 0; i < _gauge.length; ){ bytes memory data = abi.encodeWithSelector(bytes4(keccak256("vote_for_gauge_weights(address,uint256)")), _gauge[i], _weight[i]); ...
4,228,474
pragma solidity 0.5.11; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ 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); ...
This generates a public event on the blockchain that will notify clients / transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ SafeMath.sub will throw if there is not enough balance.
function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balanceOf(msg.sender)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _val...
13,083,771
//Address: 0x49fda140e8df23d621c828b9e5853fa5209abc5d //Contract name: KittyData //Balance: 0 Ether //Verification Date: 2/13/2018 //Transacion Count: 3 // CODE STARTS HERE pragma solidity ^0.4.11; /** ************************************************************************ **/ /** ************************ Abstract...
An allowed address can transfer tokens from another's address. _from The owner of the tokens to be transferred. _to The address to which the tokens will be transferred. _amount The amount of tokens to be transferred./
function transferFrom(address _from, address _to, uint _amount) external returns (bool success) { require(balances[_from] >= _amount && allowed[_from][msg.sender] >= _amount); allowed[_from][msg.sender] -= _amount; balances[_from] -= _amount; balances[_to] += _amount; ...
5,524,078
/** *Submitted for verification at Etherscan.io on 2021-11-25 */ // File: @chainlink/contracts/src/v0.8/VRFRequestIDBase.sol pragma solidity ^0.8.0; contract VRFRequestIDBase { /** * @notice returns the seed which is actually input to the VRF coordinator * * @dev To prevent repetition of VRF output due...
Mint a wavelength. windowIndex the index of the claim window to use. amount the amount of tokens to mint merkleProof the hash proving they are on the list for a given window. only applies to windows 0, 1 and 2./ checks check value of transaction is high enough. if window index is 0 and they have no tokens, 1 mint is...
function mint(uint8 windowIndex, uint8 amount, bytes32[] calldata merkleProof) external payable override{ require(redemptionWindows[windowIndex].open, "Redeem: window is not open"); require(amount > 0, "Redeem: amount cannot be zero"); if (windowIndex == 0 && balanceOf(msg.sender) == 0) ...
2,358,615
pragma solidity ^0.4.18; contract Escrow { uint public productId; address public buyer; address public seller; uint public amount; bool public fundsDisbursed; /* constructor that creates the escrow contract */ function Escrow(uint _productId, address _buyer, address _seller) public payabl...
if the sale is not approved the funds get refunded to buyer /
function refundToBuyer() public returns (bool) { require(!fundsDisbursed); require(this.balance >= amount); buyer.transfer(amount); fundsDisbursed = true; return true;
7,301,504
./full_match/1/0x63c9362a7bEDC92Dec83433C15d623fbD3E1e5A9/sources/contracts/Memswap.sol
Solve an intent with authorization (compared to the regular `solve` this method allows filling intents of a matchmaker as long as there is a valid authorization in-place for the current solver). The auth will be done on-chain (via a transaction from the matchmaker). intent Intent to solve solu...
function solveWithOnChainAuthorizationCheck( Intent calldata intent, Solution calldata solution ) external nonReentrant { bytes32 intentHash = getIntentHash(intent); bytes32 authId = keccak256(abi.encodePacked(intentHash, msg.sender)); Authorization memory auth = authori...
3,873,186
pragma solidity ^0.5.4; interface tokenTransfer { function deposit() external payable; } interface ITRC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external view returns (string ...
update timeupdate dividendRate
function statisticOfDay() private { bool flag = getTimeLeft() <= 0; if(flag){ startTime = endTime; endTime = startTime.add(period); updateDividendRate(); uint awardAmount = bigRound[bigRid].gameAmount.mul(10).div(100); ...
12,602,384
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract MetamorphicFactory { address implementation; event Deployed(address _addr); function deploy(bytes32 salt, bytes memory bytecode) public { bytes memory metamorphicCode = ( hex"5860208158601c335a63aaf10f428752fa158151803b8093809...
those two functions are getting called by the metamorphic Contract
function getImplementation() external view returns (address) { return implementation; }
2,577,703
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import {Convert} from "../utils/Convert.sol"; import {Oracle} from "../../../oracle/Oracle.sol"; import "prb-math/contracts/PRBMathSD59x18.sol"; import {INotionalView} from "./INotionalView.sol"; import {MarketParameters} from "./INotionalView.sol"; contr...
Computes the settlement date as is done in the NotionalFinance contracts Reference 1: https://github.com/notional-finance/contracts-v2/blob/d89be9474e181b322480830501728ea625e853d0/contracts/internal/markets/DateTime.solL14 Reference 2: https://github.com/notional-finance/contracts-v2/blob/d89be9474e181b322480830501728...
function getSettlementDate() public view returns (uint256) { return block.timestamp - (block.timestamp % QUARTER) + QUARTER; }
7,211,330
/** *Submitted for verification at Etherscan.io on 2021-07-15 */ // Sources flattened with hardhat v2.3.3 https://hardhat.org // File contracts/interfaces/IArmorClient.sol pragma solidity 0.8.4; interface IArmorClient { function submitProofOfLoss(uint256[] calldata _ids) external; } // File contracts/interfa...
arShield uses this to update the value of funds on their contract and deposit payments to here. We're okay with being loose-y goose-y here in terms of making sure shields pay (no cut-offs, timeframes, etc.). _newEthValue The new Ether value of funds in the shield contract./ Determine how much the shield owes for ...
function updateShield( uint256 _newEthValue ) external payable { ShieldStats memory stats = shieldStats[msg.sender]; require(stats.lastUpdate > 0, "Only arShields may access this function."); uint256 owed = getShieldOwed(msg.sender); uint256 unpai...
8,062,098
//SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "hardhat/console.sol"; ...
Get vested amount _user User address _timestamp Timestamp return uint256 Vested amount of the user/
function vestedAmount( address _user, uint256 _timestamp ) public view virtual returns (uint256) { Account storage account = _accounts[_user]; return _vestingSchedule(account.balance.add(account.released), _timestamp); }
14,070,979
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/introspection/IERC165.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/con...
Transfer NFT to buyer
function _buyItem( address _nftAddress, uint256 _tokenId, address _payToken, address _owner ) private { Listing memory listedItem = listings[_nftAddress][_tokenId][_owner]; uint256 price = listedItem.pricePerItem.mul(listedItem.quantity); uint256 feeAmoun...
13,921,817
//Address: 0x48fc077618662a07e15815fb7afbfbf2a7ee560a //Contract name: CandyLand //Balance: 0 Ether //Verification Date: 4/7/2018 //Transacion Count: 470 // CODE STARTS HERE pragma solidity 0.4.21; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, ...
require(candyToken.transferFrom(msg.sender, this, _count.mul(priceRate)));
function _makePlant(address _owner, uint _count, uint _gardenerId) internal { require(_count <= balances[_owner].sub(planted[_owner]) && _count > 0); if (_gardenerId > 0) { require(gardeners[_gardenerId].exists); require(candyToken.transferFrom(_owner, this, gardeners[_gard...
5,495,499
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; import "@opengsn/contracts/src/BaseRelayRecipient.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./EthNOSPaymaster.sol"; /** * @title Ethereum Notary Service * @author Martin Pozor * @dev Derives BaseRelayRecipient to allow GSN meta-trans...
Checks if ether-less call of signDocument (using GSN) is approved. Revert means not appproved. Not for direct use - only can be called from paymaster (initiated by GSN relayer). Before GSN relayer calls signDocument, it will call this method (through paymaster) and will check all required conditions of funding the rela...
function approveRelayedSignDocumentCall( bytes32 documentHash, uint maxAmountToBeCharged, address originalSender) external view onlyPaymaster documentValid(documentHash) onlyPendingCertification(documentHash) { DocumentInfo storage document = d...
5,459,262
./full_match/1/0xB91f7C333a256373a2c5a02C476A2E12d5CA98a6/sources/contracts/bribeMarket/PenpieBribeManager.sol
transfer the token to the target directly in one time to save the gas fee
function addBribeERC20(uint256 _batch, uint256 _pid, address _token, uint256 _amount) external nonReentrant whenNotPaused { if (_batch == 0 || _batch > maxBribingBatch) revert InvalidBatch(); uint256 startFromEpoch = exactCurrentEpoch(); uint256 totalFee = 0; uint256 totalBribing = ...
17,160,515
./full_match/1/0xc0b60c746c74C4a898651a3c11c42b7eb1f9844a/sources/src/Facets/DexManagerFacet.sol
Contains business logic for removing a DEX address. Move the last element into the place to delete Remove the last element
function _removeDex(uint256 index) private { address[] storage storageDexes = s.dexs; address toRemove = storageDexes[index]; storageDexes[index] = storageDexes[storageDexes.length - 1]; storageDexes.pop(); emit DexRemoved(toRemove); }
9,668,730
/* ==================================================================== */ /* Copyright (c) 2018 The TokenTycoon Project. All rights reserved. /* /* https://tokentycoon.io /* /* authors rickhunter.shen@gmail.com /* ssesunding@gmail.com /* ===============================================...
Enable or disable approval for a third party ("operator") to manage all your asset. _operator Address to add to the set of authorized operators. _approved True if the operators is approved, false to revoke approval
function setApprovalForAll(address _operator, bool _approved) external whenNotPaused { operatorToApprovals[msg.sender][_operator] = _approved; emit ApprovalForAll(msg.sender, _operator, _approved); }
7,233,547
pragma solidity ^0.5.1; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external; } /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies t...
IncreaseApproval _spender The address authorized to spend _addedValue the added amount/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = SafeMath.add(allowed[msg.sender][_spender],_addedValue); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
7,234,270
./full_match/1/0x744A6eF0D1eC1129F83ae94F4A8d64A16e2611d7/sources/ForwardUniswapSender.sol
Chi version of the swap
function openForwardPositionChi__kx( uint256 _amountIn, uint256 _amountOutMin, address _inputToken, address _outputToken, address _pair ) external payable onlyOwner discountCHI { uint[] memory amounts = _getAmountsOut(_pair, _amountIn, _inputToken, _outputToken); ...
4,977,304
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * Imports */ import "./IEIP20.sol"; import "../../utils/Address.sol"; /** * Wrappers around EIP20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also...
Wrapper for {EIP20-increaseAllowance}. token Token address spender Spender address amount Amount to be transferred/
function safeIncreaseAllowance( IEIP20 token, address spender, uint256 amount ) internal { uint256 newAllowance = token.allowance(address(this), spender) + amount; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); }
2,537,714
pragma solidity 0.6.12; 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 { ...
Wraps ETH in WETH Approves adapter to take the WETH amount Joins WETH collateral into the vat
function ethJoin_join(address apt, address urn) public payable { GemJoinLike(apt).gem().approve(address(apt), msg.value); GemJoinLike(apt).join(urn, msg.value); }
7,333,332
./full_match/4/0xDa2E76c2d8BF39A11ea366D5dD046c8ea8a3cc7d/sources/_openzeppelin/contracts_4.3.2/token/ERC721/extensions/ERC721Enumerable.sol
Private function to add a token to this extension's ownership-tracking data structures. to address representing the new owner of the given token ID tokenId uint256 ID of the token to be added to the tokens list of the given address/
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to].push(tokenId); _ownedTokensIndex[tokenId] = length; }
764,240
// SPDX-License-Identifier: MIT pragma solidity 0.6.8; import "@openzeppelin/contracts/utils/Address.sol"; import "./ERC1155InventoryBase.sol"; /** * @title ERC1155Inventory, a contract which manages up to multiple Collections of Fungible and Non-Fungible Tokens */ abstract contract ERC1155Inventory is ERC1155Inve...
See {IERC1155Inventory-safeBatchTransferFrom(address,address,uint256,uint256,bytes)}.
function _safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory values, bytes memory data ) internal { require(to != address(0), "Inventory: transfer to zero"); uint256 length = ids.length; require(length == values...
12,795,034
./full_match/1/0x202A1001aB2Af97Fbd2c1ef981cceC1eb3F363BF/sources/contracts/GarbageDoodles.sol
See {IERC721-safeTransferFrom}./
function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public override { require(!_stakedTokens[tokenId].staked, "TOKEN_STAKED!"); _transfer(from, to, tokenId); require( _checkOnERC721Received(from, to, token...
4,964,062
./partial_match/1/0x4594CFfbFc09BC5e7eCF1C2e1C1e24F0f7D29036/sources/ZeroKnowledgeNetwork.sol
if any account belongs to isExcludedFromFee account then remove the fee
function _transfer(address from, address to, uint256 amount) private { require(from != address(0), "0KN: transfer from the zero address"); require(to != address(0), "0KN: transfer to the zero address"); require(amount > 0, "0KN: Amount must be greater than zero"); if (!isExcludedFro...
2,694,778
./full_match/84531/0xbA061F9828B389268c8Bc79Fd42f98bBAA062096/sources/contracts/DCNTSeries.sol
Sets the royalty fee (ERC-2981: NFT Royalty Standard). _royaltyBPS The royalty fee in basis points. (1/100th of a percent)/
function setRoyaltyBPS(uint16 _royaltyBPS) external onlyAdmin { _setRoyaltyBPS(_royaltyBPS); }
11,499,031
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity 0.8.10; import "./IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId_` token is transferred from `from_` to `to_...
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_ ); fu...
15,830,194
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./SafuInvestmentsPresale.sol"; import "./SafuInvestmentsInfo.sol"; import "./SafuInvestmentsLiquidityLock.sol"; import "./ITokenDecimals.sol"; interface IUniswapV2...
make sure this goes first before transfer to prevent reentrancy
function claimTokens() external whitelistedAddressOnly presaleIsNotCancelled investorOnly notYetClaimedOrRefunded { require(uniLiquidityAdded, "Liquidity not yet added"); claimed[msg.sender] = true; uint256 amount = getTokenAmount(investments[msg.sender]); uint256 tokenBalance = tok...
14,653,275
./full_match/43114/0xA0A9A11E02a9a7912247B8CB01390262fA6236f1/sources/avava.sol
Compare price denominated in quote token between two pools We borrow base token by using flash swap from lower price pool and sell them to higher price pool Calculate the price denominated in quote asset token get a1, b1, a2, b2 with following rule: 1. (a1, b1) represents the pool with lower price, denominated in quote...
function getOrderedReserves( address pool0, address pool1, bool baseTokenSmaller ) internal view returns ( address lowerPool, address higherPool, OrderedReserves memory orderedReserves ) { (uint256 pool0Reser...
4,628,353
./full_match/1/0x6f737614cC5b89bbAd665f0e6803eE6867835d58/sources/contracts/CErc20AuraDelegator.sol
Approve `spender` to transfer up to `amount` from `src` This will overwrite the approval amount for `spender` spender The address of the account which may transfer tokens amount The number of tokens that are approved (-1 means infinite) return Whether or not the approval succeeded/
function approve(address spender, uint256 amount) override external returns (bool) { bytes memory data = delegateToImplementation(abi.encodeWithSignature("approve(address,uint256)", spender, amount)); return abi.decode(data, (bool)); }
3,001,923
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "../utils/DAOUpgradeableContract.sol"; import "../utils/NameService.sol"; import "./GoodReserveCDai.sol"; contract ExchangeHelper is DAOUpgradeableContract { uint256 private _status; function initialize(INameService _ns) public virtual initializer { ...
Interface for chainlink oracles to obtain price datas/ getRoundData and latestRoundData should both raise "No data present" if they do not have data to report, instead of returning unset values which could be misinterpreted as actual reported values.
interface AggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint2...
243,013
./full_match/1/0xc4FeDaF6f2B6B900f5d5F8b702aa09D9BdBFDC21/sources/contracts/libs/ImmutableArray.sol
Check the validity of `index`. read bytes data.
function readBytesNext( address pointer, uint256 index, uint256 length ) internal view returns (bytes memory ret) { if (index + 1 > length) revert IndexOutOfBound(); ret = readBytes_unchecked(pointer, index, length); }
16,507,430
// SPDX-License-Identifier: ISC pragma solidity >=0.6.0 <0.9.0; import './BinToken.sol'; import '@openzeppelin/contracts/utils/math/SafeMath.sol'; import '@openzeppelin/contracts/utils/math/Math.sol'; import '@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol'; import '@uniswap/lib/contracts/libraries...
/ Round executed, can process option add amount to total transaction
function getReadyToCollect() public view returns (uint256, uint256) { uint32[] storage pending = pendingOptions[msg.sender]; uint256 amount; uint256 readyToCollectLength; for (uint32 i=0; i<pending.length; i++) { Option storage option = options[pending[i]]; Round storage round = rounds[op...
12,770,790
./full_match/1/0x2DB452c9A7b14f927F51589a54B4D56dD4B31977/sources/contracts/GeneratedWeb.sol
check whether the merkleProof is valid for a given address and root
function checkMerkleProof( bytes32[] calldata merkleProof, address _address, bytes32 _root ) public pure returns (bool) { bytes32 leaf = keccak256(abi.encodePacked(_address)); return MerkleProof.verify(merkleProof, _root, leaf); }
3,217,323
./full_match/1/0x07880289bF4ba8060A4dd2bB26B6b9da4f511d74/sources/contracts/BlackandBlueCosmos.sol
Sale functions ------------------------------------------------------------------------
function setTierSupply(uint256 _MAX_BBCS_ON_TIER_SALE, uint256 _MAX_MINT_PER_TX) external onlyOwner { require(_MAX_BBCS_ON_TIER_SALE <= MAX_BBCS,"TIER_SUPPLY_EXCEEDS_MAX_BBCS"); MAX_BBCS_ON_TIER_SALE = _MAX_BBCS_ON_TIER_SALE; MAX_MINT_PER_TX = _MAX_MINT_PER_TX; emit supplyChanged(MA...
17,131,120
./full_match/80001/0xfFB09dc5BDaf689D7D00B71e76030B8FEA0a13E2/sources/src/dev/functions/Functions.sol
Initializes a Chainlink Functions Request Simplified version of initializeRequest for PoC self The uninitialized request javaScriptSource The user provided JS code (must not be empty)/
function initializeRequestForInlineJavaScript( Request memory self, string memory javaScriptSource ) internal pure { initializeRequest( self, Location.Inline, CodeLanguage.JavaScript, javaScriptSource ); }
9,515,327
pragma solidity 0.5.0; import "./Sponsorships.sol"; import "./FinanceManager.sol"; /** * @title Sponsorships minter contract */ contract SponsorshipsMinter is FinanceManager { Sponsorships internal sp; uint256 public totalSold; ERC20 public purchaseToken; uint256 public price; string private c...
Purchase Sponsorships. Purchase Sponsorships./
function purchase() external returns (bool success) { uint256 allowance = purchaseToken.allowance(msg.sender, address(this)); require(price <= allowance, INSUFFICIENT_PAYMENT); uint256 spAmount = allowance.div(price); uint256 purchaseTokenAmount = spAmount.mul(pr...
5,409,044
./partial_match/8453/0x21fed85E54507164FD6c9Eb76870AFF41098106b/sources/contracts/mint/MintManager.sol
Returns if nonce is used for the vector vectorId ID of offchain vector nonce Nonce being checked/
function isNonceUsed(bytes32 vectorId, bytes32 nonce) external view returns (bool) { return _offchainVectorsToNoncesUsed[vectorId].contains(nonce); }
16,779,416
./partial_match/1/0x0092CD4044E1672c9c513867eb75e6213AF9742f/sources/src/strategies/absolute/LlamaAbsoluteStrategyBase.sol
@inheritdoc ILlamaStrategy If the actions count is 0, then the instance is in the process of being deployed. This means that the current role supply must be used.
function initialize(bytes memory config) external virtual initializer returns (bool) { Config memory strategyConfig = abi.decode(config, (Config)); llamaCore = LlamaCore(msg.sender); policy = llamaCore.policy(); queuingPeriod = strategyConfig.queuingPeriod; expirationPeriod = strategyConfig.expira...
9,330,059
pragma solidity 0.4.24; // <ORACLIZE_API> /* Copyright (c) 2015-2016 Oraclize SRL Copyright (c) 2016 Oraclize LTD Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including ...
Step 2: the unique keyhash has to match with the sha256 of (context name + queryId) Step 3: we assume sig1 is valid (it will be verified during step 5) and we verify if 'result' is the prefix of sha256(sig1) Step 4: commitment match verification, sha3(delay, nbytes, unonce, sessionKeyHash) == commitment in storage. Thi...
function oraclize_randomDS_proofVerify__main(bytes proof, bytes32 queryId, bytes result, string context_name) internal returns (bool){ bool checkok; uint ledgerProofLength = 3+65+(uint(proof[3+65+1])+2)+32; bytes memory keyhash = new bytes(32); copyBytes(proof, ledgerProofLength, 3...
1,546,864
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; import { VolatileToken } from "./VolatileToken.sol"; import { ERC20 } from "@rari-capital/solmate/src/tokens/ERC20.sol"; import { SafeTransferLib } from "@rari-capital/solmate/src/utils/SafeTransferLib.sol"; import { IERC20 } from "./interfaces/IERC20.s...
Volatility/Funding token Give amount of WETH, receive VolatilityToken
function fund(uint256 volCoinAmount, address to) public returns (uint256 wethIn) { require(weth.transferFrom(msg.sender, address(this), wethIn = previewFund(volCoinAmount))); volatile.mint(to, volCoinAmount); volatilityBuffer += wethIn; emit Deposit(msg.sender, to, wethIn, volCoinAmo...
1,073,409
./full_match/5/0x4648a43B2C14Da09FdF82B161150d3F634f40491/sources/contracts/modules/uniswap/v2/V2SwapRouter.sol
Performs a Uniswap v2 exact output swap recipient The recipient of the output tokens amountOut The amount of output tokens to receive for the trade amountInMaximum The maximum desired amount of input tokens path The path of the trade as an array of token addresses payer The address that will be paying the input
function v2SwapExactOutput( address recipient, uint256 amountOut, uint256 amountInMaximum, address[] memory path, address payer ) internal { (uint256 amountIn, address firstPair) = UniswapV2Library.getAmountInMultihop(UNISWAP_V2_FACTORY, UNISWAP_V2_PAI...
7,087,159
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be...
Mark both the given stakers as engaged in the challenge staker1 Address of the first staker staker2 Address of the second staker challenge Address of the challenge both stakers are now in/
function challengeStarted( address staker1, address staker2, address challenge ) internal { _stakerMap[staker1].currentChallenge = challenge; _stakerMap[staker2].currentChallenge = challenge; }
200,127
pragma solidity ^0.5.0; /** * @title Helps contracts guard against reentrancy attacks. * @author Remco Bloemen <remco@2π.com>, Eenae <alexey@mixbytes.io> * @dev If you mark a function `nonReentrant`, you should also * mark it `external`. */ contract ReentrancyGuard { /// @dev counter to allow mutex l...
returns the USDETH price, ie gets the USD price from Maker feed with 9 digitsuint256 price = 140000000000000000000; only for testing purposes ensuring that there is no underflow or overflow possible, even if the price is compromised
function getUSDETHPrice() public view returns (uint256) { (bytes32 price, ) = Medianizer(settings.priceFeedSource()).peek(); uint priceUint = uint256(price).div(10**9); if (priceUint == 0) { return 1; } uint256 maxval = 1000000*10**9; if (priceUi...
967,047
./partial_match/97/0xc6B519a3fcfCac7e4adCA8427d42b8aF7d80CF30/sources/InsuranceFund.sol
claim token to caller _amount the amount of quoteToken caller want to claim/
function claim(Decimal.decimal calldata _amount) external onlyOwner { IERC20Upgradeable quoteToken = exchange.quoteAsset(); _transfer(quoteToken, _msgSender(), _amount); }
11,482,714
./full_match/80001/0x4E68A2D3B48455B35fe4D3C9E82F0c2e5C94701B/sources/contracts/OnlyCoinsSubs.sol
IERC20(0xcB1e72786A6eb3b44C2a2429e317c8a2462CFeb1).approve(msg.sender, subPrice); IERC20(0xcB1e72786A6eb3b44C2a2429e317c8a2462CFeb1).transferFrom(creator, onlyCoinsPlatform, creatorPayout); creator.transfer(creatorPayout); onlyCoinsPlatform.transfer(platFee);
function subscribeonemonth(address creator, uint256 subPrice) public virtual { require(subPrice >= onemonthprice[creator], "You need to spend more ETH!"); uint256 creatorID = uint256(uint160(address(creator))); uint256 platFee = (subPrice / 100) * platformFee; u...
5,671,670
./full_match/1/0xE70b94C2320fB0289Db0Cac0cCBD60dd8F51ff89/sources/contracts/rezerve.sol
To be used if new contracts are added to the Rezerve ecosystem
function addRezerveEcosystemAddress(address account) public onlyOwner { rezerveEcosystem[account] = true; addToWhitelist(account); }
8,459,126
./full_match/43113/0x0fE2b51D3B543C6F359480BffBf8C4E6964aE40E/sources/src/LibOrder.sol
order.data is in hash for V2 orders
function hashKey(Order memory order) internal pure returns (bytes32) { if (order.dataType == LibOrderDataV2.V2){ return keccak256(abi.encode( order.maker, LibAsset.hash(order.makeAsset.assetType), LibAsset.hash(order.takeAsset.assetType), ...
13,147,958
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import './AbstractSubdomainRegistrar.sol'; import './IBaseRegistrar.sol'; import './IResolver.sol'; import './IWhitelist.sol'; import './ERC721.sol'; /** * @dev Implements an ENS registrar that sells whitelisted subdomains on b...
owner returns the address of the account that controls a domain. Initially this is a null address. If the name has been transferred to this contract, then the internal mapping is consulted to determine who controls it. If the owner is not set, the owner of the domain in the Registrar is returned. l...
function owner(bytes32 label) public override view returns (address) { if (domains[label].owner != address(0x0)) { return domains[label].owner; } return IBaseRegistrar(registrar).ownerOf(uint256(label)); }
11,773,177
./full_match/80001/0x70Bc4e0AFAa15b4398D1E59524052907612264E4/sources/contracts/blootgoddess_flat.sol
See {IERC165-supportsInterface}./
function supportsInterface(bytes4 interfaceId) public view virtual override(AdminControl, ERC1155) returns (bool) { return ERC1155.supportsInterface(interfaceId) || AdminControl.supportsInterface(interfaceId); }
5,585,748
./full_match/97/0xC55f31C2f2583D3edd82eA96b742F2c1782372a5/sources/project_/contracts/CrowdSale.sol
/ require(amount <= address(this).balance);
function withdrawBNBFromContract() external onlyOwner whenNotPaused { uint256 nativeCrrency = address(this).balance; address payable _owner = payable(msg.sender); _owner.transfer(nativeCrrency); emit WithdrawBNBFromContract(msg.sender, nativeCrrency); } @param _tokenAddress ...
3,286,819
pragma solidity ^0.4.20; /* * Team JUST presents.. * =====================================================* * _____ __ ___ _ __ __ __ __ * *| __ \ \ \ / / | | | \/ | /\ \ \ / / * *| |__) |_\ \ /\ / /| |__| | \ / | / \ \ V / * *| ___/ _ \ \/ \/ / | __ | |\/| | / ...
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) antiEarlyWhale(_incomingEthereum) internal returns(uint256) { address _customerAddress = msg.sender; uint256 _undividedDividends = SafeMath.div(_incomingEthereum, dividendFee_) * 99; uint256 _...
248,851
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "@openzeppelin/contracts/GSN/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * This is a modified implem...
Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner./ Modified from OZ contract - sets owner ...
function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(1)); _owner = address(1); }
986,630
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "./interfaces/IERC1155Ubiquity.sol"; import "./interfaces/IMetaPool.sol"; imp...
Calculate |x|. x quadruple precision number return quadruple precision number/
function abs(bytes16 x) internal pure returns (bytes16) { unchecked { return x & 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; } }
6,000,621
./full_match/42/0x95a60E5d2262dAe93F7c975ca413aF6A1F2e69BE/sources/contracts/TokenSale.sol
A payable function to buy tokens from the IDO Uses the ETHMWT exchange rate to calculate the tokens to buy. Enforce sa maximum buyable token amount per wallet
function buyTokens() public payable{ require(currentState != IDOState.Closed, "IDO sale is currently closed"); if(currentState == IDOState.OpenForWhitelisted) { require(whitelists[msg.sender], "This address is not whitelisted"); } setETHMWTExchangeRate(); requir...
16,252,770
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; // The ATTRToken is the Attrace utility token. // More info: https://attrace.com // // We keep the contrac...
Calculate how many tokens are still locked for a holder When no activation time is defined, the moment of listing is used. First check the time lock All tokens are still locked If no time lock, then calculate how much is unlocked according to the vesting rules. If all months are vested, return 0 to ensure all tokens ar...
function calcBalanceLocked(address from) private view returns (uint) { uint activationTime = (transferRules[from].activationTime == 0 ? _wlDisabledAt : transferRules[from].activationTime); uint secondsLocked; if(transferRules[from].timeLockMonths > 0) { secondsLocked = (transferRules[from].timeLock...
14,486,907
./full_match/80001/0xda039f7C7E20C7aC851343197e49c9217A3023Fc/sources/project_/contracts/P2P.sol
Transfer the specified amount of tokens to the contract owner _transfer(msg.sender,address(this) , tokens);
function registerUser(uint256 tokens) external { require(tokens > 0, "Invalid token amount"); address sender = _msgSender(); require(!registeredUsers[sender], "User already registered"); token.safeTransferFrom(msg.sender, address(this), tokens); registeredUsers[se...
5,657,392
./partial_match/3/0x0DC67A25FbBa2592dF4A598F4f9e4d834357D953/sources/UniMexMargin.sol
transferEscrowToUser(position.owner, address(0x0), position.commitment);transferToUser(position.owner, leftoverInEth.sub(fees));
function closeShort(bytes32 tradeId, uint256 slippage) external { Position storage position = positionInfo[tradeId]; require(position.isClosed == false, 'UNIMEX: CLOSED_POSITION'); require(msg.sender == position.owner, 'UNIMEX: BORROWER_ONLY'); require(position.ow...
5,059,255