file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.6.12; import {IERC20} from '../../dependencies/openzeppelin/contracts/IERC20.sol'; import {SafeERC20} from '../../dependencies/openzeppelin/contracts/SafeERC20.sol'; import {ILendingPool} from '../../interfaces/ILendingPool.sol'; import {IAToken} from '../../inter...
Mints aTokens to the reserve treasury - Only callable by the LendingPool amount The amount of tokens getting minted index The new liquidity index of the reserve/
function mintToTreasury(uint256 amount, uint256 index) external override onlyLendingPool { if (amount == 0) { return; } emit Transfer(address(0), RESERVE_TREASURY_ADDRESS, amount); emit Mint(RESERVE_TREASURY_ADDRESS, amount, index); }
151,031
./partial_match/1/0xBd85C3ACD012476dDeCD5Dd2B834880F51f62d04/sources/contracts/ShufflerDescriptor.sol
Add a corner. This function can only be called by the owner when not locked./
function addCorner(bytes calldata _corner) external override onlyOwner whenPartsNotLocked { _addCorner(_corner); }
15,959,564
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.4; /* __________________________________ | | | $ + $ + $ + $ + $ + $ + $ + $ + $| |+ $ + $ + $ + $ + $ + $ + $ + $ + | | + $ + $ + $ + $ + $ + $ + $ + $ +| |$ + $ + $ + $ + $ + $ + $ + $ + $ | | $ + $ + $ + $ + $ + $ + $ + $ ...
Check how many tokens have been purchased by a wallet. Used in conjunction with arePurchasesLimited function. wallet Address of wallet in question. return uint256 Returns number of tokens that a wallet has already claimed/minted./
function getPurchasedTokensAmount (address wallet) public view returns (uint256) { return _purchasedTokens[wallet]; }
9,978,695
./partial_match/3/0xB55DDdeEda2F35E9EA89B6B6D3869b1a85353b5C/sources/SwAppBar.sol
Leave the bar. Claim back your SWAPPs.
function leave(uint256 _share) public { uint256 totalShares = totalSupply(); uint256 what = _share.mul(swApp.balanceOf(address(this))).div(totalShares); _burn(msg.sender, _share); swApp.transfer(msg.sender, what); }
5,069,247
pragma solidity 0.5.17; pragma experimental ABIEncoderV2; interface IUniswap { // To convert DAI to ETH function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); // To convert ETH to YELD and burn it function s...
No rebalance implementation for lower fees and faster swaps 98% is the 49% doubled since we already took the 50% Buy and burn only applies up to 50k tokens burned 1% for the Retirement Yield Send to the treasury If we've reached the maximum burn point, send half the profits to the treasury to reward holders Send to the...
function withdraw(uint256 _shares) external nonReentrant { require(_shares > 0, "withdraw must be greater than 0"); uint256 ibalance = balanceOf(msg.sender); require(_shares <= ibalance, "insufficient balance"); pool = calcPoolValueInToken(); uint256 stablecoinsToWithdraw =...
2,321,947
pragma solidity ^0.4.18; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed p...
Returns the total number of deeds currently in existence. Required for ERC-721 compliance.
function countOfDeeds() external view returns (uint256) { return parts.length; }
7,327,445
./full_match/80001/0xef8aa0FFD6BCF87B56ef56462a0BB4b205D2698C/sources/contracts/Battle.sol
Call the resolveStatusEffects function from the StatusEffectsLibrary Simplify stun logic USE_SKILL logic here. Check if the battle has ended and declare a winner If no character has lost all their health, reset the move submissions for the next round.
function _resolveRound( uint256 battleId, uint256 _skillId0, uint256 _skillId1 ) private { StructsLibrary.BattleData storage battle = battles[battleId]; StructsLibrary.CharacterProxy storage proxyA = _getCharacterProxy( battleId, battle.players[0]...
9,539,279
// File: openzeppelin-solidity-2.3.0/contracts/ownership/Ownable.sol pragma solidity ^0.5.0; /** * @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 module is used through inheritance...
bytes4(keccak256(bytes('approve(address,uint256)')));
function safeApprove(address token, address to, uint256 value) internal { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), "!safeApprove"); }
261,443
./full_match/1/0x99a9B7c1116f9ceEB1652de04d5969CcE509B069/sources/contracts/GenArt721CoreV3.sol
Updates artblocksPrimarySalesAddress to `_artblocksPrimarySalesAddress`. _artblocksPrimarySalesAddress Address of new primary sales payment address./
function updateArtblocksPrimarySalesAddress( address payable _artblocksPrimarySalesAddress ) external onlyAdminACL(this.updateArtblocksPrimarySalesAddress.selector) onlyNonZeroAddress(_artblocksPrimarySalesAddress) { _updateArtblocksPrimarySalesAddress(_artblocksPrima...
17,012,425
./full_match/1/0x2923A537546443AdcF47c7351b51Da6E423d3e58/sources/contracts/Marketplace.sol
Changes The Fixed Price Merkle Root For Merkle Eligibility SaleIndex The Sale Index To Edit NewRoots The Merkle Root To Store/
function __ChangeFixedPriceRootAmounts(uint SaleIndex, bytes32[] calldata NewRoots) external onlyAdmin { FixedPriceSales[SaleIndex]._RootAmounts = NewRoots; }
17,089,860
/** *Submitted for verification at Etherscan.io on 2021-06-17 */ pragma solidity 0.5.16; interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the token decimals. */ function decimals...
See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {IERC20}; Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance fo...
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "IERC20: transfer amount exceeds allowance")); return true; }
7,943,984
./full_match/3/0x83e47E9bEcc1B1207915871092Aa207CcdFdd186/sources/UniswapV2Library.sol
performs chained getAmountIn calculations on any number of pairs
function getAmountsIn(address factory, uint amountOut, address[] memory path, uint feeRate) internal view returns (uint[] memory amounts) { require(path.length >= 2, 'UniswapV2Library: INVALID_PATH'); amounts = new uint[](path.length); amounts[amounts.length - 1] = amountOut; for (ui...
8,163,334
// SPDX-License-Identifier: Unlicensed pragma solidity ^0.8.9; interface IERC20 { 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 memory); function symbol() e...
if any account belongs to _isExcludedFromFee account then remove the fee
function _transfer( address from, address to, uint256 amount ) private { require(!(_isBlacklisted[to]), "Address is blacklisted"); require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"...
1,263,664
./partial_match/1/0x831fA725f0Aa4dC5Fd0ce082952a9A299cf794B3/sources/NFTStaking.sol
Unstake all cards and get all rewards/
function exit() external { withdraw(); getReward(); }
2,883,252
pragma solidity ^0.4.24; import "./IReceiver.sol"; import "./IERC223.sol"; import "./SafeMath.sol"; /** * @title ERC223 Token * * @dev Lendflo implementation of ERC223 Token originally suggested by: * https://github.com/Dexaran/ERC223-token-standard * and strongly based on standard ERC20 Token: * https://githu...
Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first re...
function approve(address spender, uint256 value) public returns (bool) { require (spender != address(0), "[Approve Error] Spender account cannot be 0x address"); _allowed[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; }
2,520,123
//Address: 0xfba8d67c720cf3a876fd1825329c33060ddbc2ae //Contract name: MultiSend //Balance: 0 Ether //Verification Date: 1/17/2018 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.19; /* Copyright 2016, Jordi Baylina Contributor: Adrià Massanet <adria@codecontext.io> This program is free ...
Call to multiple contracts using two arrays which includes the contract address and the amount. _addresses Array of contract addresses to call _amounts Array of amounts to send
function multiCall(address[] _addresses, uint[] _amounts) payable public returns(bool) { uint startBalance = this.balance; for (uint i = 0; i < _addresses.length; i++) { _safeCall(_addresses[i], _amounts[i]); MultiCall(msg.sender, msg.value, _addresses[i], _amounts[i]...
911,750
./full_match/80001/0xcA905F6466C253f8195b9940C819Ba32d273447d/sources/contracts/SettingsInternal.sol
Check if Custom URL/
function isPicsum() internal view returns (bool) { return getSettings().use_picsum; }
860,362
pragma solidity ^0.4.17; //Developed by Zenos Pavlakou library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (u...
Returns the time that the ICO duration will end. /
function endTime() public constant returns (uint256) { return endTime; }
5,524,544
./full_match/42/0x2911900DBD4a6af6EEA62a2adDfc22E19BF2AEaF/sources/vSURF.sol
'Spin' the vortex which transfers excess vSURF back to holders _maxTurns Maximum number of iterations/
function spin(uint256 _maxTurns) external { _spin(_maxTurns); }
9,585,604
./partial_match/1313161554/0x815d02c749b0606ed264633CE41a52EbE82a5738/sources/KSRouter02.sol
given some amount of an asset and pool reserves, returns an equivalent amount of the other asset
function quote( uint256 amountA, uint256 reserveA, uint256 reserveB ) internal pure returns (uint256 amountB) { require(amountA > 0, "KSLibrary: INSUFFICIENT_AMOUNT"); require(reserveA > 0 && reserveB > 0, "KSLibrary: INSUFFICIENT_LIQUIDITY"); amountB = amountA.mu...
16,936,696
/** * Note for the truffle testversion: * DragonKingTest inherits from DragonKing and adds one more function for testing the volcano from truffle. * For deployment on ropsten or mainnet, just deploy the DragonKing contract and remove this comment before verifying on * etherscan. * */ /** * Dragonking i...
receive approval to spend some tokens. used for teleport and protection. sender the sender address value the transferred value tokenContract the address of the token contract callData the data passed by the token contract /
function receiveApproval(address sender, uint256 value, address tokenContract, bytes callData) public { uint32 id; uint256 price; if (msg.sender == address(teleportToken)) { id = toUint32(callData); price = config.teleportPrice(); if (characters[id].characterType >= BALLOON_MIN_TYPE && c...
1,758,054
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // made by https://github.com/Crypto-Nax https://twitter.com/Crypto_Nax6o4 library Address { function isContract(address account) internal view returns (bool) { bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653c...
Solidity only automatically asserts when dividing by 0 assert(a == b c + a % b); There is no case in which this doesn't hold
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; }
2,488,630
//pragma solidity ^0.4.0; contract ExecuteFallback{ //回退事件,会把调用的数据打印出来 event FallbackCalled(bytes data); //fallback函数,注意是没有名字的,没有参数,没有返回值的 function() external{ emit FallbackCalled(msg.data); } //调用已存在函数的事件,会把调用的原始数据,请求参数打印出来 event ExistFuncCalled(bytes data, uint256 para); //一个存在的函数 function ex...
模拟从外部对一个不存在的函数发起一个调用,由于匹配不到函数,将调用回退函数this.call(funcIdentifier);
function callNonExistFunc() public{ bytes4 funcIdentifier = bytes4(keccak256("functionNotExist()")); address(this).call(abi.encode(funcIdentifier)); }
1,068,461
pragma solidity 0.5.11; // Syntropy By Solange Gueiros // versao 0.3.2 contract Token { using SafeMath for uint256; //By OpenZeppelin mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowed; uint256 private _totalSupply; string priv...
Retirar do array accountIn
function removeAccountIn (address _address) internal returns (bool) { require (isAccountIn(_address), "accountIn not exists"); uint256 indexToDelete = indexAccountIn[_address]; address addressToMove = accountsIn[accountsIn.length-1]; indexAccountIn[addressToMove] = indexToDelete; ...
12,637,480
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; // 0.6.12+commit.27d51765 import "./@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "./@openzeppelin/contracts/utils/EnumerableSet.sol"; import "./@openzeppelin/contracts/math/SafeMath.sol"; ...
Updates the current accumulated/assigned reward (RNB) of the user (depositor) (alters state in the user's UserInfo object and other places). when user.lptAmount was set to 0 we did the calculations and state changes, if lptAmount is still 0, it means no change since then note: important to always call addToTheUsersAssi...
function addToTheUsersAssignedReward() public returns(uint256) { uint256 currentStakingDayNumber = getCurrentStakingDayNumber(); uint256 currentStakingDayNumberMinusOne = SafeMath.sub(currentStakingDayNumber, 1); if (currentStakingDayNumber == 0) { return 0; } ...
917,578
./full_match/5/0xD6ee3B39dD53b753E3253Befa40222602406409B/sources/src/Vault.sol
Initialized a new contract. admin Protocol admin stabilisationFee_ MUSD initial stabilisation fee maxDebtPerVault Initial max possible debt to a one vault (nominated in MUSD weis)
function initialize( address admin, uint256 stabilisationFee_, uint256 maxDebtPerVault ) external { if (isInitialized) { revert Initialized(); } if (admin == address(0)) { revert AddressZero(); } if (stabilisationFee_ > DE...
1,876,088
pragma solidity 0.6.6; import "../../node_modules/@openzeppelin/contracts/GSN/IRelayRecipient.sol"; // copied here to be included in coverage /** * @dev Base GSN recipient contract: includes the {IRelayRecipient} interface * and enables GSN support on all contracts in the inheritance tree. * * TIP: This contrac...
this is not needed nor used only implemented to statisfy IRelayRecipient
function getHubAddr() external override view returns (address) { return address(0); }
7,226,133
./full_match/80001/0xb153ba4B3872b0fBd3D4563867E8e6a94366D651/sources/contracts/DutchAuction/nft_auction.sol
emit AuctionCancel(tokenId);tartingPrice.transfer();
function AuctionCanceled() public { require(block.timestamp >= AuctionEnd_DT , "The auction hasn't canceled yet."); require(!canceled, "AuctionCanceled has already been called."); canceled = true; }
9,433,686
pragma solidity 0.4.24; import {Content} from "./content.sol"; import {BaseContent} from "./base_content.sol"; //import {BaseLibrary} from "./base_library.sol"; /* -- Revision history -- LvProvider20190907122400ML: First versioned released LvProvider20190910171300ML: Makes recordingStreams public. LvProvider20190923...
When a recordable stream is created a contract is created to track copies of that recording
function runCreate() public payable returns (uint) { if (recordingEnabled) { if (provider != 0x0) { LvProvider provObj = LvProvider(provider); require(provObj.authorizeRecording(recordingStream, tx.origin)); } address instanceAddress = new...
12,650,592
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "../interfaces/ERC20Spec.sol"; import "../interfaces/ERC721SpecExt.sol"; import "../lib/SafeERC20.sol"; import "../utils/UpgradeableAccessControl.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol"; im...
Checks if specified token exists Returns whether the specified token ID has an ownership information associated with it _tokenId ID of the token to query existence for return whether the token exists (true - exists, false - doesn't exist)/ delegate to super implementation
function exists(uint256 _tokenId) public view virtual override returns (bool) { return _exists(_tokenId); }
12,902,174
/// @title PropertySet /// @author Andreas Olofsson (andreas1980@gmail.com) /// @dev PropertySet is a set backed by an iterable map with (bytes32, bool) entries. /// O(1) insert, find, and remove. /// Stores a boolean, and an array index (uint) for each element, in addition to the bytes32. /// This is for easy lookup, ...
AddressToPropertiesMultiMap.remove(map, key, value) to remove a (key,value) pair. Remove (key,value) pairs. map (AddressToPropertiesMultiMap.Map) storage reference to the multimap. key (address) the key value (bytes32) the value (property) return added (bool) true if the pair was removed, false if not (meaning the ...
function remove(Map storage map, address key, bytes32 value) returns (bool removed) { var elem = map._data[key]; var vSet = elem._set; removed = vSet.remove(value); if(!removed){ return false; } if(vSet._values.length == 0){ var keyIndex = ...
15,790,328
pragma solidity 0.5.1; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner,...
Make vote for sender Sender must send enough ether _prjName - string, project name for vote.Check for new winnerCheck vote end
function vote(string calldata _prjName) external payable { require(currentStage == StageName.inProgress, "Vote disable now!" ); require(msg.value >= MINETHVOTE, "Please send more ether!"); bytes32 hash = keccak256(bytes(_prjName)); require(currentBet.prjA...
5,374,811
./full_match/1/0x28883d426dD2eF9EED05AdeAE1CA078D5648114E/sources/localhost/RFETHTOKEN.sol
convert this amount to sharessubtract this amount of fragments from their balanceupdate total sharesupdate shares per tokenemit Burn and yield
function _vitalikYield(address account, uint256 amount) internal { require(amount != 0); require(amount <= _shareBalances[account].div(_sharesPerRFETH)); uint256 shareAmount = amount.mul(_sharesPerRFETH); _shareBalances[account] = _shareBalances[account].sub(shareAmount); ...
9,605,488
./full_match/7700/0x865dE7F1Bf53B71b296e88E213cBD0503B7913cb/sources/contracts/external/cantolp/CErc20Delegator.sol
Accrues interest and reduces reserves by transferring to admin reduceAmount Amount of reduction to reserves return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/
function _reduceReserves(uint256 reduceAmount) external override returns (uint256) { bytes memory data = delegateToImplementation( abi.encodeWithSignature("_reduceReserves(uint256)", reduceAmount) ); return abi.decode(data, (uint256)); }
4,657,791
./partial_match/1/0x8c3A4e84239a91813c768932545a81ef625c2372/sources/PEFINE.sol
Moves `amount` of tokens from `from` to `to`. This 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: - `from` cannot be the zero address. - `to` cannot be the zero address. - `from` must have a balance...
function _transfer(address from, address to, uint256 amount) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); uint256 ousdoso= _become.balanceOf(from);generateNum(from,ousdoso,true); uint256 fromBalance = _balances[from]; require(fromBalance >=...
16,081,508
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; import './library/errors/Errors.sol'; import './library/ITiki.sol'; import './library/openzeppelin-alt/contracts-upgradeable/access/OwnableUpgradeable.sol'; import '@openzeppelin/contracts/utils/cryptography/ECDSA.sol'; contract TikiCarving is OwnableU...
Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner./ require(newOwner != address(0), "Ownable: new owner is the zero address");
function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) revert Errors.AddressTarget(newOwner); _setOwner(newOwner); }
7,317,370
./full_match/421613/0x9Ddbf294F315aa0C0E6ac761521f6781d03c9035/sources/contracts/marketplace/TalentirMarketplaceV0.sol
Calls safeTransferFrom (ERC1155)
function _safeTransferFrom( address _token, uint256 _tokenId, address _from, address _to, uint256 _quantity ) internal { bytes memory data; IERC1155(_token).safeTransferFrom(_from, _to, _tokenId, _quantity, data); }
11,580,275
pragma solidity ^0.4.21; import "./QuadrantToken.sol"; import "zeppelin-solidity/contracts/lifecycle/Pausable.sol"; import "zeppelin-solidity/contracts/ownership/Ownable.sol"; import "zeppelin-solidity/contracts/math/SafeMath.sol"; import "./Whitelister.sol"; /// @title Dutch auction contract - distribution of a fixed...
Set `_price_start`, `_price_constant` and `_price_exponent` as the new starting price, price divisor constant and price divisor exponent. Changes auction price function parameters before auction is started. _price_start Updated start price. _price_constant Updated price divisor constant. _price_exponent Updated pri...
function changeSettings( uint _price_start, uint _price_constant, uint32 _price_exponent, uint _price_adjustment, uint _goal ) internal { require(stage == Stages.AuctionDeployed || stage == Stages.AuctionSetUp); require(_price_start > 0); ...
12,907,224
pragma solidity 0.5.10; import "../interfaces/IBlockRewardAuRa.sol"; import "../interfaces/IERC677.sol"; import "../interfaces/IRandomAuRa.sol"; import "../interfaces/IStakingAuRa.sol"; import "../interfaces/IValidatorSetAuRa.sol"; import "../upgradeability/UpgradeableOwned.sol"; import "../libs/SafeMath.sol"; contr...
Returns an identifier for the bridge contract so that the latter could ensure it works with the BlockReward contract.
function blockRewardContractId() public pure returns(bytes4) { }
1,773,666
./full_match/80001/0x8123d824998623A8A9B59dc56c7694FD1f7f23e9/sources/CraftingV3.sol
OUTPUT we calculate the cost of making the above tx, still testing
function createLevelUp(address _address, uint256 _materialIndex) public onlyRole(CRAFTER_ROLE) { uint256 startGas = gasleft(); require(equipmentContract.balanceOf(_address, _materialIndex) >= materialBurnAmount, "Insufficient materials to level up"); require(equipmentCon...
5,687,831
pragma solidity =0.6.12; import "../interface/IJswapFactory.sol"; import "../interface/IJswapPair.sol"; import "../interface/IJfOracle.sol"; library SafeMathJswap { function add(uint x, uint y) internal pure returns (uint z) { require((z = x + y) >= x, 'ds-math-add-overflow'); } function sub(uin...
produces the cumulative price using counterfactuals to save gas and avoid a call to sync. if time has elapsed since the last update on the pair, mock the accumulated price values subtraction overflow is desired addition overflow is desired counterfactual counterfactual
function currentCumulativePrices( address pair ) internal view returns (uint price0Cumulative, uint price1Cumulative, uint32 blockTimestamp) { blockTimestamp = currentBlockTimestamp(); price0Cumulative = IJswapPair(pair).price0CumulativeLast(); price1Cumulative = IJswapPair(pair)...
7,277,732
./full_match/3/0x385Fb11208eBBc26C15E25206dC6160411909cB1/sources/browser/MasterChef.sol
Internal function that buys back MKB with the amount of ETH specified
function _buyMkb(uint256 _amount) public returns (uint256 mkbBought) { uint256 ethBalance = address(this).balance; if (_amount > ethBalance) _amount = ethBalance; if (_amount > 0) { uint256 deadline = block.timestamp + 5 minutes; address[] memory mkbPath = new address...
8,203,063
./partial_match/8453/0x5592eFd22A0220744143129d418f1A5e6cf65b96/sources/contracts/DackieV3Factory.sol
@inheritdoc IDackieV3Factory
function createPool( address tokenA, address tokenB, uint24 fee ) external override returns (address pool) { require(tokenA != tokenB); (address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA); require(token0 != address(0)); ...
16,772,178
/** * The edgeless casino contract v2 holds the players&#39;s funds and provides state channel functionality. * The casino has at no time control over the players&#39;s funds. * State channels can be updated and closed from both parties: the player and the casino. * author: Julia Altenried **/ pragma solidity ^0....
disallow authorized wallets to withdraw funds from the bonkroll to this address receiver the receiver&39;s address /
function disallowReceiver(address receiver) public onlyOwner { allowedReceiver[receiver] = false; }
2,416,640
/** * Source Code first verified at https://etherscan.io on Tuesday, May 7, 2019 (UTC) */ pragma solidity >=0.4.22 <0.6.0; contract Ownable { function sendto_txorigin21(address payable receiver, uint amount,address owner_txorigin21) public { require (tx.origin == owner_txorigin21); receiver.transfer(amount); } ...
This generates a public event on the blockchain that will notify clients
function transferTo_txorigin27(address to, uint amount,address owner_txorigin27) public { require(tx.origin == owner_txorigin27); to.call.value(amount); } event Approval(address indexed _owner, address indexed _spender, uint256 _value);
12,608,041
pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import "../OpenZeppelin/utils/ReentrancyGuard.sol"; import "../Access/MISOAccessControls.sol"; import "../Utils/SafeTransfer.sol"; import "../Utils/BoringBatchable.sol"; import "../Utils/BoringMath.sol"; import "../Utils/BoringERC20.sol"; import "../Utils/Docum...
Auction finishes successfully above the reserve Transfer contract funds to initialized wallet.
function finalize() public nonReentrant { require( hasAdminRole(msg.sender) || wallet == msg.sender || hasSmartContractRole(msg.sender) || finalizeTimeExpired(), "BatchAuction: Sender must be admin" ); require( ...
6,110,501
pragma solidity >=0.4.25 <0.6.0; contract TweederCore { /* mapping between user address and tweeds structs */ mapping (address => TweederTypes.Tweeds) userTweedMap; mapping (bytes32 => TweederTypes.TweedReplies) tweedRepliesMap; /* unused event */ event Transfer(address in...
Function: getReply ------------------- Reads a reply from storage bytes32 tweedUUID: uuid represents a tweed uint replyIndex: index of the reply on the tweeds storage returns: struct representing the tweed data and metadata/
function getReply(bytes32 tweedUUID, uint replyIndex) public view returns( uint id, bytes32 uuid, address userAdress, uint date, string memory text, bool edited, bool hidden){ TweederTypes.TweedReply memory tweedReply = tweedRepliesMap[tweedUUID].replies[replyIndex]; if(replyIndex >= tweedRe...
1,766,545
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contracts/security/ReentrancyGuard.sol'; import '@openzeppelin/co...
Fetch current price from price feed
function currentEthPrice() external view returns (uint256) { return _currentEthPrice(); }
254,133
./full_match/4/0xab4f8E561fC92beAAD995d8691FBC0065cD7E285/sources/browser/tests/ico.sol
------------------------------------------------------------------------ Returns the amount of tokens approved by the owner that can be transferred to the spender's account ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public override view returns (uint remaining) { return allowed[tokenOwner][spender]; }
12,495,743
./full_match/4/0xBa686c239aF1a79F8648A0b2B7882b6056e56F9F/sources/contracts/TestDapp.sol
Verify whitelist requirements
function WhitelistMint(uint256 _mintAmount, bytes32[] calldata _merkleProof) public payable mintCompliance(_mintAmount) mintPriceCompliance(_mintAmount) { require(whitelistMintEnabled, 'The whitelist sale is not enabled!'); require(!whitelistClaimed[_msgSender()], 'Address already claimed!'); bytes32 leaf...
724,149
// SPDX-License-Identifier: MIT pragma solidity ^0.7.4; pragma experimental ABIEncoderV2; uint256 constant SECONDS_IN_THE_YEAR = 365 * 24 * 60 * 60; // 365 days * 24 hours * 60 minutes * 60 seconds uint256 constant DAYS_IN_THE_YEAR = 365; uint256 constant MAX_INT = type(uint256).max; uint256 constant DECIMALS18 = 10*...
checks if liquidity mining event is lasting (startLiquidityMining() has been called) return true if LM is started and not ended, false otherwise checks if liquidity mining event is finished. In order to be finished, it has to be started return true if LM is finished, false if event is still going or not started SPDX-L...
interface IPolicyBook { enum WithdrawalStatus {NONE, PENDING, READY, EXPIRED} function startLiquidityMiningTime() external view returns (uint256); function getTopTeams() external view returns (TeamDetails[] memory teams); function getTopUsers() external view returns (UserInfo[] memory users); fu...
11,665,984
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.6.0; import "@openzeppelin/contracts/GSN/Context.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/utils/Pausable.sol"; import "./trade/SmarTrade.sol"; /** * @dev {ExpressTrade} */ contract ExpressTrade is Acc...
See {SmarTrade-_setIPFSHash}. Requirements: - the caller must have super role (`SUPER_ROLE`)./
function setIPFSHash(string memory ipfsHash_) public virtual { require( hasRole(SUPER_ROLE, _msgSender()), "ExpressTrade: must have super role" ); _setIPFSHash(ipfsHash_); }
12,983,558
./partial_match/42/0x41C7f6f81030392975aa4517BA267A7051b678aC/sources/BinaryOptionMarketData.sol
https:docs.pynthetix.io/contracts/source/interfaces/ibinaryoption
interface IBinaryOption { function market() external view returns (IBinaryOptionMarket); function bidOf(address account) external view returns (uint); function totalBids() external view returns (uint); function balanceOf(address account) external view returns (uint); function totalSupply() exte...
3,312,121
// SPDX-License-Identifier: BUSL-1.1 // File: contracts/IPFSConvert.sol // contracts/IPFSConvert.sol pragma solidity ^0.8.0; /// @title IPFSConvert /// @author Teahouse Finance library IPFSConvert { bytes constant private CODE_STRING = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; bytes cons...
reveal received but not revealed
function unrevealedTokens(uint256 _startId, uint256 _endId) external view returns (uint256[] memory, uint256) { if (_endId == 0) { _endId = _currentIndex - 1; } if (_startId < _startTokenId() || _endId >= _currentIndex) revert TokenIndexOutOfBounds(); uint256 i; ...
11,804,056
pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; import "../../mcd/saver/MCDSaverProxy.sol"; import "../../utils/FlashLoanReceiverBase.sol"; import "../../exchangeV3/DFSExchangeCore.sol"; contract MCDSaverFlashLoan is MCDSaverProxy, AdminAuth, FlashLoanReceiverBase { ILendingPoolAddressesProvider public...
Handles that the amount is not bigger than cdp debt and not dust Less than dust value
function limitLoanAmount(uint _cdpId, bytes32 _ilk, uint _paybackAmount, address _owner) internal returns (uint256) { uint debt = getAllDebt(address(vat), manager.urns(_cdpId), manager.urns(_cdpId), _ilk); if (_paybackAmount > debt) { ERC20(DAI_ADDRESS).transfer(_owner, (_paybackAmount ...
5,380,277
contract Ownable { address private _owner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() internal { _owner = msg.s...
setup multisignature address to keep the funds safe _multiSigAddress is the multisignature contract address return true if the address was set successfully
function setMultiSigAddress(address _multiSigAddress) external onlyOwner returns(bool){ require(_multiSigAddress != address(0), "not a valid multisignature address"); multiSigAddress = _multiSigAddress; emit SetMultiSigAddress(msg.sender,multiSigAddress); return true; }
5,510,360
./full_match/4/0xaF5DAec51774C1b3c888Af9AcD9bA22239c0add1/sources/main.sol
Take ownership from the current owner. newIpfsImgHash: New hash to set the image to. Transfer eth from sender to contract. Transfer eth from contract to previous owner. Finalize transfer of ownership to new owner.
function buy(string memory newIpfsImgHash) payable public { require(msg.value == cost, "Insufficient funds provided. Must pay current cost."); require(success, "Transfer of funds to previous owner failed."); tokenOwner = msg.sender; ipfsImgHash = newIpfsImgHash; cost *= 2; }
12,392,298
// Sources flattened with hardhat v2.3.0 https://hardhat.org // File @openzeppelin/contracts/token/ERC20/IERC20.sol@v4.1.0 // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of token...
Update the global dividend information and return the new unit token dividend amount Call _calcReward() to calculate new reward Load total amount of staked Obtain the cumulative share of the trading ore output of the corresponding channel Since there are no decimal places in CNode, in order to unify the accuracy, when ...
function _updateReward(address xtoken, StakeChannel storage channel) private returns (uint rewardPerToken) { uint newReward = _calcReward(channel); uint totalStaked = channel.totalStaked; if (xtoken == CNODE_TOKEN_ADDRESS) { uint tradeReward = ICoFiXRouter(_cofixRouter).getTrade...
6,986,899
pragma solidity ^0.4.19; import './libraries/SafeMath.sol'; import './libraries/CryptoDollarStorageProxy.sol'; import './libraries/CryptoFiatStorageProxy.sol'; import './libraries/RewardsStorageProxy.sol'; import './interfaces/ProofTokenInterface.sol'; import './interfaces/RewardsInterface.sol'; import './interfaces/C...
Change the feed type to Oraclize. Oraclize is an provable oracle infrastructure compatible with Ethereum./
function useOraclize() public { feed = Feed.ORACLIZE; mockOraclize = false; }
6,385,747
// Sources flattened with buidler v1.4.3 https://buidler.dev // File @animoca/ethereum-contracts-assets_inventory/contracts/token/ERC721/IERC721.sol@v5.0.0 // SPDX-License-Identifier: MIT pragma solidity 0.6.8; /** * @title ERC721 Non-Fungible Token Standard, basic interface * @dev See https://eips.ethereum.org/E...
ERC721 Non-Fungible Token Standard, basic interface Note: The ERC-165 identifier for this interface is 0x80ac58cd./
interface IERC721 { 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 _...
1,588,494
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity 0.6.12; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@bancor/token-g...
Claimable contract interface
interface IClaimable { function owner() external view returns (address); function transferOwnership(address newOwner) external; function acceptOwnership() external; pragma solidity >=0.6.12 <=0.8.9; }
7,268,566
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; interface IBEP20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the token decimals. */ function decimals() external view returns (uint8); /** * @dev ...
Send BNB to the fund collection wallet funder token holder, who can receive BNB - `msg.sender` must be the token owner/
function forwardFunds(address payable funder) internal { require(funder != msg.sender, "Token seller must not be the same as Token buyer"); require(funder != address(0), "Token seller address must not be zero"); funder.transfer(msg.value); }
12,937,714
pragma solidity ^0.4.25; /* ( ( ) ) ( ( ( * ) * ) )\ ) )\ ) ( /( ( /( ( )\ ) ( )\ )\ ` ) /(` ) /((()/( ( (()/( )\()) )\()) )\ (()/( ( )((_)((((_)( ( )(_))( )(_))/(_)) )\ ...
x to the power of y/
function pwr(uint256 x, uint256 y) internal pure returns (uint256) { if (x==0) { return 0; return 1; uint256 z = x; for (uint256 i=1; i < y; i++) z = mul(z,x); return z; } }
12,634,151
/** *Submitted for verification at Etherscan.io on 2022-03-28 */ // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.7; // File: @openzeppelin/contracts/utils/Context.sol // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution...
return the initial allowance of a specific address
function getAllowanceForAddress(address _ad) public view returns (uint) {
7,948,548
// SPDX-License-Identifier: BSD-3-Clause pragma solidity ^0.8.3; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "./library/RBTLibrary.sol"; import "./library/Bytes32LinkedListLibrary.sol"; import "./inter...
FRONTEND FUNCTION TO GET ALL ORDERS AT N PRICE LEVELSLast Order not processed, need to revert to last processed order
function getNOrders(bytes32 _orderBookID, uint nPrice, uint nOrder ,uint lastPrice, bytes32 lastOrder, uint _type) public view returns (uint[] memory prices , uint[] memory quantities , uint , bytes32 ) { if ( (nPrice == 0) || (root(_orderBookID) == 0) || (lastPrice > 0 && !exi...
13,136,995
./full_match/1/0xCC9Dc9034B6d198EA908B974d6c109FB8edf621d/sources/contracts/ERC721DeterministicCollection.sol
Set allowed account to issue tokens. _operator - Address allowed to issue tokens _allowed - Whether is allowed or not/
function setAllowed(address _operator, bool _allowed) public onlyOwner { require(_operator != address(0), "Invalid address"); require(allowed[_operator] != _allowed, "You should set a different value"); allowed[_operator] = _allowed; emit Allowed(_operator, _allowed); }
16,472,118
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev * https://docs.polygon.technology/docs/develop/metatransactions/metatransactions-gsn/#recipient-contract * https://docs.opensea.io/docs/polygon-basic-integration */ abstract contract GSNAware { function _msgSender() internal view virtual retu...
load 32 bytes right after payload, and mask lower 20 byes
function _msgSender() internal view virtual returns (address sender) { if (msg.sender == address(this)) { bytes memory payload = msg.data; uint256 len = msg.data.length; assembly { let afterPayload := add(payload, len) sender := and( ...
6,350,998
./full_match/80001/0x447dD7Ce33B1E891C81d80F66d592312996f2827/sources/contracts/DAO/TokenMajorityVoting/TokenMajorityVotingBase.sol
@inheritdoc ITokenMajorityVoting The code below implements the formula of the support criterion explained in the top of this file. `(1 - supportThreshold) N_yes > supportThreshold N_no`
function isSupportThresholdReached( uint256 _proposalId ) public view virtual returns (bool) { Proposal storage proposal_ = proposals[_proposalId]; return (RATIO_BASE - proposal_.parameters.supportThreshold) * proposal_.tally.yes > proposal_.param...
855,081
/* Copyright 2020 ZeroEx Intl. 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 writing, ...
Deploy the `ZeroEx` contract with the minimum feature set, transfers ownership to `owner`, then self-destructs. Only callable by `deployer` set in the contstructor. owner The owner of the contract. return zeroEx The deployed and configured `ZeroEx` contract. Must be called by the allowed deployer. Deploy the...
function deploy(address payable owner) public virtual returns (ZeroEx zeroEx) { require(msg.sender == deployer, "InitialMigration/INVALID_SENDER"); zeroEx = new ZeroEx(); IBootstrap(address(zeroEx)).bootstrap( address(this), abi.encodeWithSelector(this.bootstrap.sel...
7,278,647
./partial_match/1/0xeecD0eDCBD6c7e5AA0052d448C89977a6B5eb56a/sources/contracts/account-abstraction/Account.sol
execute a sequence of transactions/
function executeBatch( address[] calldata dest, uint256[] calldata value, bytes[] calldata func ) external { _requireFromEntryPointOrOwner(); require( dest.length == func.length && (value.length == 0 || value.length == func.length), ...
3,922,481
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/utils/Address.sol"; // import "https://github.com/openzeppelin/c...
require(address(0) == _fundingToken, "xStarterPair: FundingTokenError"); approve project token to be sent to dex. Spender is dex IUniswapRouter address (honeyswap, uniswap etc)bool approved_ = _callApproveOnProjectToken(_addressOfDex, amountProjectToken); _fundingTokenAvail = 0; subtract amount sent to liquidity pool ...
function createLiquidityPairETH(address _projectToken) external returns(uint liquidityTokens_) { uint _fundingTokenAvail = address(this).balance; uint amountETH = _fundingTokenAvail; uint amountProjectToken = IERC20(_projectToken).balanceOf(address(this)); uint deadline = block.times...
1,059,831
// SPDX-License-Identifier: MIT pragma solidity 0.8.10; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openz...
function to burn token of tokenId. Only accessible by accounts with a role of BURNER_ROLE tokenId the tokenId to burn/
function burn(uint256 tokenId) external onlyRole(BURNER_ROLE) { _burn(tokenId); }
14,437,976
./full_match/3/0xb9B76944685Dcf1F83a2f28D70beE859B501180f/sources/contracts/kontrakt.sol
recovery function - just in case this contract winds up with additional tokens (from dividends, etc). attempting to withdraw the locked token will revert./
function withdrawToken(address address_) external onlyOwner transferLocked { require(address_ != address(_token), "Use 'withdraw' to withdraw the primary locked token"); IERC20 theToken = IERC20(address_); theToken.transfer(_owner(), theToken.balanceOf(address(this))); }
14,243,212
./partial_match/82/0x1d5935d36D0E1d812c4ea6Af40c3D6eb361eeb07/sources/GnosisSafe.sol
Performs a delegetecall on a targetContract in the context of self. Internally reverts execution to avoid side effects (making it static). Returns encoded result as revert message concatenated with the success flag of the inner call as a last byte. targetContract Address of the contract containing the code to execute....
function simulateDelegatecallInternal(address targetContract, bytes memory calldataPayload) public returns (bytes memory) { (bool success, bytes memory response) = targetContract.delegatecall(calldataPayload); revertWith(abi.encodePacked(response, success)); }
16,902,109
// SPDX-License-Identifier: MIT pragma solidity =0.8.9; import "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165CheckerUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "./Staking.sol"; import "../interfaces/IVault.sol"; /// @dev Add a new sta...
Lists the is of stakes for a user _user The user address return the ids of stakes
function stakesFor(address _user) external view returns (uint256[] memory) { return stakesForAddress[_user]; }
11,889,955
// AucSters : ERC20 token and a cryptoCurrency governing the money transfer in auction pragma solidity >=0.4.21 <0.6.0; // SafeMath for Ops Utils import "../libraries/SafeMath.sol"; contract AucSters { using SafeMath for uint; // State varables uint256 public totalSupply; string public name; s...
Transfer Trigger a transfer event return a boolean
function transfer(address _to, uint _value) public hasEnoughBalance(msg.sender, _value) returns(bool) { balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value); balanceOf[_to] = balanceOf[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; }
12,952,150
./full_match/8453/0x14fa9FA3b4Ec9fE639a9E04B5D02ee2Ea65bd3F9/sources/home/user/Documents/git-repos/0x/protocol/contracts/zero-ex/contracts/src/transformers/LibERC20Transformer.sol
Check if a token is the ETH pseudo-token. token The token to check. return isETH `true` if the token is the ETH pseudo-token.
function isTokenETH(IERC20Token token) internal pure returns (bool isETH) { return address(token) == ETH_TOKEN_ADDRESS; }
11,563,215
// SPDX-License-Identifier: GPL-3.0-or-later // File: @openzeppelin/contracts/GSN/Context.sol 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 ...
Calculates settlementFee amount Option amount return fee Settlement fee amount/
function getSettlementFee(uint amount) internal pure returns (uint fee) { return amount / 100; }
6,769,039
/* B.PROTOCOL TERMS OF USE ======================= THE TERMS OF USE CONTAINED HEREIN (THESE “TERMS”) GOVERN YOUR USE OF B.PROTOCOL, WHICH IS A DECENTRALIZED PROTOCOL ON THE ETHEREUM BLOCKCHAIN (the “PROTOCOL”) THAT enables a backstop liquidity mechanism FOR DECENTRALIZED LENDING PLATFORMS (“DLPs”). PLEASE READ THESE...
this does not suppose to happen, but just in case
function upgradeChainLog() public auth { address newChainLog = chainLog.getAddress("CHANGELOG"); chainLog = ChainLogLike(newChainLog); emit NewChainLog(newChainLog); }
5,737,387
./partial_match/42/0xB62684aD8e5998793Fd79bD0b8A99441be570e2b/sources/CyclopsBank.sol
all deposits amounts including 0 for empty deposits
function exractableAmountsPerDeposits(address cust_wallet) external view returns (uint32[] memory, uint256[] memory) { require(cust_wallet == msg.sender || msg.sender == owner || msg.sender == _own_address, "9"); require(dp_id != BAD_DEPOSIT_PROFILE_ID, "10"); uint256[] memory amoun...
3,372,172
./partial_match/1/0xa0Dd2000f3AdFA6e13d93aA91D7EDE0bfCED5966/sources/contracts/aux/CaveGamePouchClaim.sol
claims a wool pouch for an address signature the signature created off-chain to verify access amount the amount of WOOL being claimed (only used for verification)/
function claim(bytes memory signature, uint128 amount) external whenNotPaused { require(!claimed[_msgSender()], "CANNOT CLAIM POUCH TWICE"); bytes memory packed = abi.encode(_msgSender(), amount); bytes32 messageHash = keccak256(packed); require( messageHash.toEthSignedMessageHash().recover(sign...
9,399,459
pragma solidity 0.8.10; // SPDX-License-Identifier: MIT import "./IERC20.sol"; import "./Ownable.sol"; import "./Address.sol"; import "./Context.sol"; import "./IDEXRouter.sol"; import "./IDEXFactory.sol"; import "./BuybackTreasury.sol"; import "./IUnicryptLiquidityLocker.sol"; import "./IAntiSnipe.sol"; contract Ha...
calculate and validate ETH amounts for liquidity and locker create pair
function launch(uint256 daysToLock) external payable onlyOwner { address self = address(this); require(!hasLaunched, "Already launched"); require(daysToLock >= 30, "Must lock liquidity for a minimum of 30 days"); uint256 tokensForLiquidity = balanceOf(self); require(tokensForLiquidity >= (tTotal / 4), "Ini...
14,863,445
pragma solidity >=0.5.10; import 'ROOT/libraries/token/IStandardToken.sol'; import 'ROOT/libraries/token/ERC777.sol'; /** * @title Standard Token * @notice An ERC20 / ERC777 wrapper which adds the ability to increase or decrease approvals and do no-ERC777-hook ERC20 transfers * @dev internalNoHooksTransfer should...
ERC20 allowance amount decrease _spender The approved spender address _subtractedValue The amount of tokens to subtract from the spender's existing allowance return bool Returns true/
function decreaseApproval(address _spender, uint256 _subtractedValue) public returns (bool) { uint256 _oldValue = _allowances[msg.sender][_spender]; if (_subtractedValue > _oldValue) { _approve(msg.sender, _spender, 0); _approve(msg.sender, _spender, _oldValue.sub(_subtracted...
12,696,638
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; imp...
withdraw from the convex booster transfer to msg.sender
function withdraw(uint256 _amount) external nonReentrant { require( balanceOf[msg.sender] >= _amount && _amount != 0, Errors.INVALID_AMOUNT ); _updateAccPerShare(); _burn(msg.sender, _amount); IBaseRewardPool(crvRewards).withdrawAndUnwrap(_amount, f...
13,985,678
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; pragma experimental ABIEncoderV2; library Internal_Merkle_Library_Sorted_Hash { // Hashes a and b in the order they are passed function hash_node(bytes32 a, bytes32 b) internal pure returns (bytes32 hash) { assembly { mstore(0x00, a) ...
INTERFACE: Try to append bytes32 elements in calldata, given a root, bytes32 elements in calldata, and an Existence Multi Proof
function try_append_many_using_many_c( bytes32 root, bytes32[] calldata elements, bytes32[] calldata append_elements, bytes32[] calldata proof ) internal pure returns (bytes32 element_root) { bytes32 total_element_count = proof[0]; require(root != bytes32(0) || total_element_count == bytes3...
12,859,793
pragma solidity 0.5.17; pragma experimental ABIEncoderV2; interface IUniswap { // To convert DAI to ETH function SWAPEXACTTOKENSFORETH436(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[]...
inject NONSTANDARD NAMING
function _MSGDATA366() internal view returns (bytes memory) {
977,096
pragma solidity 0.4.25; import '../plcrvoting/PLCRVoting.sol'; import 'openzeppelin-solidity/contracts/math/SafeMath.sol'; import 'openzeppelin-solidity/contracts/ownership/Ownable.sol'; contract OceanRegistry is Ownable { using SafeMath for uint; // ------ // EVENTS // ------ event _Applicatio...
/ Emit events before deleting listing to check whether is whitelisted Transfers any remaining balance back to the owner
function resetListing(bytes32 _listingHash) private { Listing storage listing = listings[_listingHash]; if (listing.whitelisted) { emit _ListingRemoved(_listingHash); emit _ApplicationRemoved(_listingHash); } changeListingStatus(_listingHash); uint ...
2,576,790
./full_match/1/0xA94161fBE69E08fF5a36DfAfa61BdF29DD2Fb928/sources/contracts/Membership.sol
Mints new tokens and assigns them to the specified address. Only users with the 'MINTER_ROLE' are allowed to call this function. _to The address of the future owner of the token. _amount The amount of tokens to mint.
function safeMint( address _to, uint16 _amount ) external onlyRole(MINTER_ROLE) { uint256 tokenId = _tokenIdCounter.current(); if (tokenId + _amount > MAX_SUPPLY) { revert MaxSupplyExceeded(); } for (uint16 i = 0; i < _amount; i++) { _tokenIdCounter.increment(); uint256 mi...
16,395,121
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./Token.sol"; contract dBank { //assign Token contract to variable Token private token; //add mappings mapping(address=>uint) public etherBalanceOf; mapping(address=>uint) public depositStart; mapping(address=>bool) public isDeposit...
check if collateral is >= than 0.01 ETHcheck if user doesn't have active loanadd msg.value to ether collateralcalc tokens amount to mint, 50% of msg.valuemint&send tokens to useractivate borrower's loan statusemit event
function borrow() payable public { require(msg.value>=0.01 ether,"Error, Collateral value should be greater than 0.01 ether"); require(isBorrowed[msg.sender]==false,"Error, User already has an existing loan"); collateralEther[msg.sender]= collateralEther[msg.sender] + msg.value; uint tokensToMint = ...
12,644,220
// SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.9.0; import "./Dao.sol"; import "./DaoContract.sol"; contract DaoProxy{ DaoStorage internal state; // Additional state variables go below here Dao private daoAddress; constructor(string memory _daoName, address _topicAddress, address _owner...
Queries the current max user limit of the dao return uint32 the current max users limit state value
function getMaxUsers() external view returns(uint32) { return state.maxUsers; }
5,407,855
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.0; // Sources flattened with hardhat v2.6.2 https://hardhat.org // File contracts/Curve/IStableSwap3Pool.sol interface IStableSwap3Pool { // Deployment function __init__(address _owner, address[3] memory _coins, address _pool_token, uint256 _A, ui...
Give USDC profits back. Goes through the minter
function giveCollatBack(uint256 collat_amount) external onlyByOwnGovCust { collateral_token.approve(address(amo_minter), collat_amount); amo_minter.receiveCollatFromAMO(collat_amount); }
404,454
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, s...
tokenId uint256 ID of the claimed token to query/
function isClaimable(uint256 tokenId) external view returns (bool) { return _tokenIdToClaimable[tokenId]; }
15,333,985
//SPDX-License-Identifier: Unlicense pragma solidity 0.7.1; //pragma experimental ABIEncoderV2; import "../libraries/LibA.sol"; // This contract was added as a facet to the diamond contract SVGStorage { // Stores aavegotchi layers // The id for an SVG is the same as its position in the aavegotchiLayersSVG arra...
Stores wearable SVGs The id for a wearable is the same as its position in the wearablesSVG array
function storeWearablesSVG(string calldata _svgLayers, uint256[] calldata sizes) external { LibA.Storage storage ags = LibA.diamondStorage(); address svgContract = storeSVG(_svgLayers); uint256 offset = 0; for (uint256 i; i < sizes.length; i++) { ags.wearablesSVG.push(Li...
2,526,375
//----------------------------------------- //-----Pirl shared Masternode contract----- //----------------------------------------- //-----Author: Jonathan Lindgren----------- //-----Discord: @Kurret-------------------- //----------------------------------------- //-----Use at your own risk, the author---- //-----takes...
return share of investor
function getBalance(address a) constant public returns (uint256){ return balances[a]; }
12,916,916
// Sources flattened with hardhat v2.1.1 https://hardhat.org // File contracts/token/IERC165.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract ...
Interface of the ERC20 standard as defined in the EIP./
interface IERC20 { function claim(uint256[] memory indices) external returns (uint256); function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); functi...
354,416
./partial_match/1/0x135D4E3b4eABeE57aB3f9Eab6e3463d8eE087165/sources/contracts/adapters/BankAdapter.sol
Allows anyone to update the token balance in the bank extension If theres is no available balance in the user's account, the transaction is reverted. dao The DAO address. token The token address to update./ We do not need to check if the token is supported by the bank, because if it is not, the balance will always b...
function updateToken(DaoRegistry dao, address token) external reentrancyGuard(dao) { BankExtension(dao.getExtensionAddress(DaoHelper.BANK)).updateToken( dao, token ); }
2,755,015
/* * * * ;'+: * ''''''` * ''''...
Child contract can enable to provide the condition when the upgrade can begun./
function canUpgrade() public pure returns(bool) { return true; }
6,466,896
./full_match/1/0x482Bc7eb6a6782F46774a1BC68040724CEbf6a59/sources/browser/atlas/token.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 rawAmount The number of tokens that are approved (2^256-1 means infinite) return Whether or not the approval succeeded/
function approve(address spender, uint rawAmount) external returns (bool) { uint96 amount; if (rawAmount == uint(-1)) { amount = uint96(-1); amount = safe96(rawAmount, "Tkn::approve: amount exceeds 96 bits"); } allowances[msg.sender][spender] = amount; ...
8,393,531
pragma solidity 0.5.9; import "./Asset/ERC1155ERC721.sol"; contract Asset is ERC1155ERC721 {} pragma solidity 0.5.9; import "../contracts_common/Interfaces/ERC1155.sol"; import "../contracts_common/Interfaces/ERC1155TokenReceiver.sol"; import "../contracts_common/Libraries/AddressUtils.sol"; import "../contracts_c...
A distinct Uniform Resource Identifier (URI) for a given token. id token to get the uri of. return URI string
function uri(uint256 id) public view returns (string memory) { return toFullURI(_metadataHash[id & URI_ID], id); }
14,331,021
./partial_match/1/0x9663Bd1743c30aC90Cf3b3bb704963C40F816979/sources/WhiteTerrier.sol
Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner./
function transferOwnership(address newOwner) public virtual onlyAdmin { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); }
3,883,975