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: SEE LICENSE IN LICENSE
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../../ConverterVersion.sol";
import "../../interfaces/IConverter.sol";
import "../../interfaces/IConverterAnchor.sol";
import "../../interfaces/IConverterUpgrader.sol";
import "../..... | returns the amount of pool tokens entitled for given amounts of reserve tokens since an empty pool can be funded with any list of non-zero input amounts, this function assumes that the pool is not empty (has already been funded) _reserveTokens address of each reserve token _reserveAmounts amount of each reserve to... | function addLiquidityReturn(IReserveToken[] memory _reserveTokens, uint256[] memory _reserveAmounts)
public
view
returns (uint256)
{
uint256 totalSupply = IDSToken(address(anchor)).totalSupply();
uint256[2] memory baseBalances = baseReserveBalances(_reserveTokens);
... | 12,984,719 |
./full_match/4/0x80d21aABe30952DCbD7fca437e434F4A0059D688/sources/Users/patrick/Documents/TRON/Lottery/contracts/Gamble.sol | gets address balance | function getBalanceByAddress(address walletAddress) view external returns (uint) {
return balances[walletAddress];
}
| 12,283,708 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^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 functio... | @inheritdoc INFModuleWithRoyalties | function royaltyInfo(address, uint256)
public
view
override
returns (address receiver, uint256 basisPoint)
{
receiver = address(this);
basisPoint = 1000;
}
| 164,125 |
/**
*Submitted for verification at Etherscan.io on 2022-01-13
*/
/*
https://theburningtoken.com/
https://t.me/TheBurningToken
Vanilla Zeus fork woth removed ownership vulnerabilities
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.7;
interface IERC20 {
function totalSupply() external view retu... | function swapExactTokensForETHSupportingFeeOnTransferTokens( | interface IUniswapV2Router02 {
function swapExactTokensForETH(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (ad... | 7,893,659 |
/**
*Submitted for verification at Etherscan.io on 2020-07-14
*/
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
interface ICurve {
function get_virtual_price() external view returns (uint256 out);
function underlying_coins(int128 tokenId) external view returns (address token);
function calc_to... | Return Curve Swap Address/ | function getCurveSwapAddr() internal pure returns (address) {
return 0xA5407eAE9Ba41422680e2e00537571bcC53efBfD;
}
| 6,583,798 |
pragma solidity 0.5.16;
import "./OneInchStrategy_1INCH_X.sol";
/**
* This strategy is for the 1INCH/USDC LP token on 1inch
*/
contract OneInchStrategy_1INCH_USDC is OneInchStrategy_1INCH_X {
bool public unused_is_1inch;
address public usdc = address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);
constructor(
... | Invests all the underlying into the pool that mints crops (1inch)/ | function investAllUnderlying() public restricted {
uint256 underlyingBalance = IERC20(underlying).balanceOf(address(this));
if (underlyingBalance > 0) {
IERC20(underlying).safeApprove(pool, 0);
IERC20(underlying).safeApprove(pool, underlyingBalance);
IFarmingRewardsV2(pool).stake(underlyingB... | 10,470,853 |
./partial_match/4/0xB942536a4255a04622C16dB974f54002DE78Da7a/sources/Inflator.sol | solium-disable-next-line security/no-assign-params | function deflateInternal(uint value, address donor)
internal riskBelowThreshold
{
(ERC20 token, uint donorBalance, uint amountTaken) = takeFromDonorAndSupply(donor);
if (value == 0) value = uint(-1);
for(uint i = 0; value > 0; i++) {
value = deflateOnce(value, amountTaken... | 8,607,063 |
./full_match/137/0xa90dAF1975BA13c26F63976e0Fd73A21F966EE0D/sources/contracts/CarbonOffsetBatches.sol | Returns the current version of the smart contract | function version() public pure returns (string memory) {
return '1.2.0';
}
| 3,776,906 |
./full_match/3/0xd95b61d9C3eb332B9ab89EC9Cf728DFc30EB850d/sources/contracts/lilcoin_v5.sol | gets current rewards for account./ | function _getRewardsForAccount(address account) internal virtual returns (uint256) {
uint256 rewards = _getTotalDividendsOwed(account) - _dividendsClaimed[account];
return rewards;
}
| 14,168,546 |
./full_match/1/0x5A01592A2a4acfE2949f766EF67F4f7d04bE4ac0/sources/contracts/core/prize-pool/PrizePool.sol | @inheritdoc IPrizePool | function getFirstLidoRebaseTimestamp()
external
view
override
returns (uint32)
{
return firstLidoRebaseTimestamp;
}
| 9,746,581 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @title: X by Pak
/// @author: manifold.xyz
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/St... | See {IX-batchMint}/ | function batchMint(address to, uint16 count) external virtual override onlyOwner nonReentrant {
for (uint16 i = 0; i < count; i++) {
_mintCount++;
_safeMint(to,_mintCount);
}
}
| 10,021,954 |
./full_match/1/0x776d1E66abB5DFBB6784A3De5Ed249761C5C415F/sources/contracts/Staking/StakingPool.sol | to stake some amount of token _amount - amount to be staked | function stake(uint256 _amount, address user) external updateReward(user) {
_totalSupply += _amount;
staked[user] += _amount;
stakingToken.transferFrom(user, address(this), _amount);
| 16,497,752 |
./partial_match/1/0xc8024fB5C7beD98CcE0e498E54B7D89816B3521B/sources/GenesisLiquidityPool.sol | Calculate out amount of the GEX token | function amountOutGEX(uint256 inCollatAmount) public view returns(uint256 outGEXAmount) {
if (balanceCollateral == 0)
outGEXAmount = _initOutGEXAmount(inCollatAmount);
else {
uint256 halfInCollatAmount = inCollatAmount / 2;
uint256 k1 = balanceCollateral * balanc... | 3,668,760 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.0;
import "../libraries/Authorizable.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppel... | zapIn Exchanges a number of tokens which are used in a specific curve pool(s) for a principal token. _info See ZapInInfo struct _zap See ZapCurveLpIn struct - This is the "main" or parent zap which produces the lp token necessary to swap for the principal token _childZap See ZapCurveLpIn - This is used only in cases... | function zapIn(
ZapInInfo memory _info,
ZapCurveLpIn memory _zap,
ZapCurveLpIn memory _childZap,
PermitData[] memory _permitData
)
external
payable
nonReentrant
notFrozen
preApproval(_permitData)
returns (uint256 ptAmount)
{
... | 364,081 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
pragma abicoder v2;
import "interfaces/notional/NotionalProxy.sol";
import "@openzeppelin/contracts/proxy/Initializable.sol";
import "@openzeppelin/contracts/cryptography/ECDSA.sol";
import "../../proxy/utils/UUPSUpgradeable.sol";
/// @title Note ERC20 ... | SPDX-License-Identifier: GPL-3.0-only | interface nERC1155Interface {
event TransferSingle(
address indexed operator,
address indexed from,
address indexed to,
uint256 id,
uint256 value
);
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
... | 13,945,006 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/access/AccessControl.sol";
contract AccessController is AccessControl {
bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE");
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
constructor() publi... | Verify the merkle proof. Mark it claimed and send the token. | function claim(
uint256 _index,
address _account,
uint256 _amount,
bytes32[] calldata merkleProof
) external override whenActive {
require(!isClaimed(_index), "Drop already claimed");
bytes32 node = keccak256(abi.encodePacked(_index, _account, _amount));
require(MerkleProof.verify(merkl... | 12,889,145 |
./full_match/80001/0xa1A793d9Ff235FB02C570B2290Ee669144C6d053/sources/contracts/SaleManager.sol | admin can update end time until the sale ends | function setEnd(bytes32 saleId, uint endTime) public validSale(saleId) isAdmin(saleId){
require(block.timestamp < sales[saleId].endTime, "disabled after sale closes");
require(endTime > block.timestamp, "sale must end in future");
require(endTime <= 4102444800, "max: 4102444800 (Jan 1 2100)");
require... | 5,570,189 |
./partial_match/56/0xE2A8Fa5105cC2Deb83e10d16258C6e88465B8722/sources/token_flat.sol | Returns the number of tokens the user can take at the moment user - address user | function myCurrentAllocation(address user) public view returns (uint256) {
function myAllocationEmergency(
address user
}
if (_FUNDS_RAISED == 0) {
return 0;
}
uint256 amount;
if (_withoutCommission[user]) {
amount =
(
... | 11,189,364 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
//
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amo... | override underlying _transfer implementation; YDV shares can only be transferred to/from the liquidity rewards pool | function _transfer(address sender, address recipient, uint256 amount) internal override {
require(lrEnabled, "transfer rejected");
require(sender == address(lrPools) || recipient == address(lrPools), "transfer rejected");
super._transfer(sender, recipient, amount);
}
| 10,546,406 |
./full_match/5/0x81c7a9d494c74F113cCa32d174925352bD3875f1/sources/_connext/nxtp-contracts/contracts/nomad-core/contracts/NomadBase.sol | Hash of Home domain concatenated with "NOMAD"/ ============ Internal Functions ============ Hash of Home domain concatenated with "NOMAD" _homeDomain the Home domain to hash/ | function homeDomainHash() public view virtual returns (bytes32);
function _homeDomainHash(uint32 _homeDomain) internal pure returns (bytes32) {
return keccak256(abi.encodePacked(_homeDomain, "NOMAD"));
}
| 1,910,535 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
contract Millio... | Returns rat price in the current tier./ | function getRatPrice() public view returns (uint256) {
require(
block.timestamp >= SALE_START_TIMESTAMP,
"Sale has not started"
);
require(totalSupply() < MAX_RAT_SUPPLY, "Sale has ended");
uint256 currentSupply = totalSupply();
if (currentSupply >= ... | 11,705,235 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts-up... | / Check the auction to see if it can be resulted Check the auction real Check the auction has ended Ensure auction not already resulted Get info on who the highest bidder is Ensure there is a winner Ensure this contract is approved to move the token Result the auction Clean up the highest bid Work out total above the r... | function resultAuction(address _nftAddress, uint256 _tokenId)
external
nonReentrant
{
Auction storage auction = auctions[_nftAddress][_tokenId];
require(
IERC721(_nftAddress).ownerOf(_tokenId) == _msgSender() &&
_msgSender() == auction.owner,
... | 62,325 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.4;
import {Address} from '@openzeppelin/contracts/utils/Address.sol';
import {ISipherNFT} from '../interfaces/ISipherNFT.sol';
import {ISipherNFTSale} from '../interfaces/ISipherNFTSale.sol';
import {Whitelist} from '../utils/Whitelist.sol';
contract SipherNFTS... | Return the sale config/ | function getSaleConfig() external view override returns (SaleConfig memory config) {
config = _saleConfig;
}
| 6,409,855 |
pragma solidity >=0.4.25 <0.6.0;
import "openzeppelin-solidity/contracts/lifecycle/Pausable.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20Burnable.sol";
import "openzeppelin-soli... | Transfer a token to a specified address Transfer conditions: - msg.sender address must be valid - msg.sender cannot be on the blacklist - msg.sender must be whitelisted previously by KYC/AML process - contract must be unpaused to address to transfer to value amount to transfer return bool | function transfer(address to, uint value) public returns (bool) {
require(value > 0);
require(to != address(0));
require(isApproved(to));
return super.transfer(to, value);
}
| 14,038,781 |
./partial_match/3/0x1B0eD927c605f4CBc9065ac330dC0E009070Ce7D/sources/StakingRewardsStore.sol | adds a program poolToken the pool token representing the rewards pool reserveTokens the reserve tokens representing the liquidity in the pool rewardShares reserve reward shares endTime the ending time of the program rewardRate the program's rewards rate per-second/ verify that reserve tokens correspond to the pool... | function addPoolProgram(
IDSToken poolToken,
IERC20Token[2] calldata reserveTokens,
uint32[2] calldata rewardShares,
uint256 startTime,
uint256 endTime,
uint256 rewardRate
) private {
require(startTime < endTime && endTime > time(), "ERR_INVALID_DURATION")... | 5,325,931 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
interface IERC20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
function name() external view returns (string memory);
function getOw... | buy and sell tax can never be higher than MAX_TAX set at beginning of contractthis is a security check and prevents malicious tax use | function updateTax(uint8 newBuy, uint8 newSell, uint8 newTransfer) external authorized {
require(newBuy <= MAX_TAX && newSell <= MAX_TAX && newTransfer <= 50, "taxes higher than max tax");
_taxRates = Taxes(newBuy, newSell, newTransfer);
emit UpdateTaxes(newBuy, newSell, newTransfer);
}
... | 88,376 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
// File: contracts/lib/AddressUtil.sol
// Copyright 2017 Loopring Technology Limited.
/// @title Utility Functions for addresses
/// @author Daniel Wang - <daniel@loopring.org>
/// @author Brecht Devos - <brecht@loopring... | Store the current protocol fees in the previous protocol fees Get the latest protocol fees for this exchange | function validateAndSyncProtocolFees(
ExchangeData.State storage S,
uint8 takerFeeBips,
uint8 makerFeeBips
)
private
returns (bool)
{
ExchangeData.ProtocolFeeData memory data = S.protocolFeeData;
if (block.timestamp > data.syncedAt + ExchangeData.M... | 334,488 |
pragma solidity 0.5.17;
contract Context {
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence ... | Checks how much YELD the user currently has and sends him some eth based on that Calculate his holdings % in 1 per 10^18% instead of 1 per 100% | function redeemETH() public {
require(now >= stakes[msg.sender].timestamp + timeBetweenRedeems, 'You must wait at least a day after the snapshot to redeem your earnings');
uint256 burnedTokens = yeld.balanceOf(address(0));
uint256 userPercentage = stakes[msg.sender].yeldBalance.mul(1e18).div(yeld.totalSup... | 8,036,474 |
pragma solidity >=0.0;
/*
Copyright 2016, Jordi Baylina
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
... | return The number of milestones ever created even if they were canceled | function numberOfMilestones() public view returns (uint) {
return milestones.length;
}
| 15,850,329 |
./full_match/43113/0x5Af5A34b0B89b801D963FaAbC7007e5702654B6F/sources/project_/contracts/s0xCommunity/s0xFactory.sol | the s0xFactory creates the s0xial user friend and group interface and functions as central administration hub for all s0xial interactions the constructor creates a friends instance and stores the address of the contract/ | function createGroup(
string calldata _name,
uint256 _state,
string calldata _p,
address[] calldata _usrs
) external returns (address) {
address adr = _makeGroup(_name, _state, _p);
for (uint256 i = 0; i < _usrs.length; i++) {
_addUserToGroup(_usrs[i],... | 7,177,880 |
./full_match/40/0xf2B42Aa763428E48ff20DDF98248e96DF9568E2C/sources/omnidex-lending/misc/OmniDexOracleV2.sol | Gets an asset price by address asset The asset address | function getAssetPrice(address asset) public view override returns (uint256) {
string memory key = assetsKeys[asset];
if (asset == BASE_CURRENCY) {
return BASE_CURRENCY_UNIT;
return _fallbackOracle.getAssetPrice(asset);
(uint128 price, uint128 timeStamp) = DIA.getValue(key);
if ... | 9,549,400 |
pragma solidity ^0.5.0;
import "../FixidityLib.sol";
/**
* @dev
*/
contract FixidityLibMock {
/**
* @dev Number of positions that the comma is shifted to the right.
*/
function digits() public pure returns(uint8) {
return FixidityLib.digits();
}
/**
* @dev This is 1 in... | Converts to positive if negative/ | function abs(int256 x) public pure returns (int256) {
return FixidityLib.abs(x);
}
| 1,787,912 |
pragma solidity ^0.4.15;
//import "multisig-wallet/MultiSigWallet.sol";
import "./MultiSigWallet.sol";
import './TokenLifecycle.sol';
import './BasicToken.sol';
import './StandardToken.sol';
import './MintableToken.sol';
import 'zeppelin-solidity/contracts/math/SafeMath.sol';
/**
* @title TokenManager
* @author Ta... | Public grant tokens administrative function/ bytes4(sha3('grantVestedTokens(address,uint256,uint64,uint64,uint64,bool,bool)')) in truffle console: web3.sha3('grantVestedTokens(address,uint256,uint64,uint64,uint64,bool,bool)').substring(0, 10); 36 = 4 bytes of signature hash + 32 bytes of array length 68 = 36 as above... | function tokenGrantVestedTokens(
address _token,
address _to,
uint256 _value,
uint64 _start,
uint64 _cliff,
uint64 _vesting,
bool _revokable,
bool _burnsOnRevoke
) public
ownerExists(msg.sender)
{
bytes memory data =
hex"9754a4d90000... | 913,980 |
./full_match/1/0x8c6139FF1E9D7c1E32bDAFd79948d0895bA0a831/sources/contracts/Comptroller.sol | Return the address of the COMP token return The address of COMP/ | function getCompAddress() public pure returns (address) {
return 0x10010054c81c8c01951E6A631dD228bB02d8D1e5;
}
| 9,638,463 |
./full_match/1/0x408822E4E8682413666809b0655161093cd36f2b/sources/contracts/utils/TwoStepOwnable.sol | Clears the pending ownership. Can only be called by the current owner./ | function removePendingOwnership() public virtual onlyOwner {
_setPendingOwner(address(0));
}
| 3,169,781 |
./full_match/1/0x2a9fD373Ed3Ce392bb5ad8Ee146CFAB66c9fAEae/sources/contracts/main/TruStakeMATICv2.sol | Sets the distribution fee for loose distributions. _distPhi new distribution fee. | function setDistPhi(uint256 _distPhi) external onlyOwner {
if (_distPhi > PHI_PRECISION) {
revert DistPhiTooLarge();
}
emit SetDistPhi(distPhi, _distPhi);
distPhi = _distPhi;
}
| 8,326,200 |
/**
*Submitted for verification at Etherscan.io on 2021-09-06
*/
pragma solidity 0.6.12;
/**
helper methods for interacting with ERC20 tokens that do not consistently return true/false
with the addition of a transfer function to send eth or an erc20 token
*/
library TransferHelper {
function safeApprove... | withdraw spaceport tokens percentile withdrawls allows fee on transfer or rebasing tokens to still work | function userWithdrawTokens () external nonReentrant {
require(STATUS.LP_GENERATION_COMPLETE, 'AWAITING LP GENERATION');
BuyerInfo storage buyer = BUYERS[msg.sender];
require(STATUS.LP_GENERATION_COMPLETE_TIME + SPACEPORT_VESTING.vestingCliff < block.timestamp, "vesting cliff : not time yet"... | 14,023,361 |
/**
*Submitted for verification at Etherscan.io on 2022-03-30
*/
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// File: Address.sol
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is... | Make sure we only initialize one time Initialize BaseStrategy Initialize cloned instance | function initialize(
address _vault,
address _strategist,
address _rewards,
address _keeper,
address _lpStaker,
uint16 _liquidityPoolIDInLPStaking,
address _uniV3Swapper,
address _curvePool,
string memory _strategyName
) public {
_... | 6,670,274 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
pragma abicoder v2;
import "./ActionGuards.sol";
import "../../internal/nToken/nTokenHandler.sol";
import "../../internal/nToken/nTokenSupply.sol";
import "../../internal/nToken/nTokenCalculations.sol";
import "../../internal/markets/AssetRate.sol";
impo... | Claims incentives accrued on all nToken balances and transfers them to the msg.sender auth:msg.sender return Total amount of incentives claimed balance state is updated inside claim incentives manual balance state is updated inside claim incentives manual | function nTokenClaimIncentives() external override returns (uint256) {
address account = msg.sender;
AccountContext memory accountContext = AccountContextHandler.getAccountContext(account);
uint256 totalIncentivesClaimed = 0;
BalanceState memory balanceState;
if (accountCont... | 10,315,713 |
pragma solidity ^0.4.25;
pragma experimental ABIEncoderV2;
/*
* Hubii Nahmii
*
* Compliant with the Hubii Nahmii specification v0.12.
*
* Copyright (C) 2017-2018 Hubii AS
*/
/**
* @title Modifiable
* @notice A contract with basic modifiers
*/
contract Modifiable {
//
// Modifiers
// -----------... | Results functions ----------------------------------------------------------------------------------------------------------------- Get the double spender status of given wallet wallet The wallet address for which to check double spender status return true if wallet is double spender, false otherwise | function isDoubleSpenderWallet(address wallet)
public
view
returns (bool)
{
return doubleSpenderByWallet[wallet];
}
| 948,855 |
./partial_match/1/0x235b25f9f56B39eFD8293C0d2A9Ee70719E25B85/sources/src/libraries/PairMath.sol | Refer to [burn-math.md](https://github.com/buttonwood-protocol/buttonswap-core/blob/main/notes/burn-math.mdsingle-sided-burn) for more detail. Calculate what the liquidity is worth in terms of both tokens Whilst we appear to risk overflow here, the final `swappedReservoirAmountB` needs to be smaller than the reservoir ... | function getSingleSidedBurnOutputAmountB(
uint256 totalLiquidity,
uint256 liquidityIn,
uint256 totalA,
uint256 totalB,
uint256 movingAveragePriceA
) internal pure returns (uint256 amountOutB, uint256 swappedReservoirAmountB) {
uint256 amountOutA;
(amountOu... | 4,108,402 |
/*
______ __ __ __ __
/ \| \ | \ | \ | \
| ▓▓▓▓▓▓\ ▓▓____ \▓▓_| ▓▓_ | ▓▓ ______ ______ _______
| ▓▓___\▓▓ ▓▓ \| \ ▓▓ \ | ▓▓/ \ / \ / \
\▓▓ \| ▓▓▓▓▓▓▓\ ▓▓\▓▓▓▓▓▓ | ▓▓ ▓▓▓▓▓▓\ ▓▓▓▓▓▓\ ▓▓▓▓▓▓▓
_\▓▓▓▓▓▓\ ▓▓ | ▓▓ ▓▓ | ▓▓ __| ▓▓ ▓▓ ▓▓ ▓▓ \▓▓\▓▓ \
| ... | Royalties in any ERC20 are accepted | function withdrawERC20(IERC20 _token) public onlyTeam {
uint256 totalERC20 = _token.balanceOf(address(this));
if (totalERC20 == 0) revert EmptyWithdraw();
uint256 teamSize = team.length;
for (uint256 i; i < teamSize; ) {
uint256 payment = (totalERC20 * teamShares[i]) / T... | 14,960,871 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "./ITuxERC20.sol";
import "./library/RankedSet.sol";
import "./library/AddressSet.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
/**
* @dev {ERC20} token, including:
*
* - Preminted initial supply
* - Ability for ho... | Removes a value from a set. O(1). Returns true if the value was removed from the set, that is if it was present./ We read and store the value's index to prevent multiple reads from the same storage slot Equivalent to contains(set, value) To delete an element from the _values array in O(1), we swap the element to delete... | function remove(Set storage set, address value) internal returns (bool) {
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
... | 5,751,856 |
./full_match/1/0x7924743bdD32d1fD1769F703d712eEeCCB59aEfE/sources/contracts/NftKeysV1.sol | Mints token with ID This has to be overridden even though it is not used to Account that the token will be minted to tokenId Token ID | function _mint(
address to,
uint256 tokenId
) internal virtual override(ERC721Consecutive, ERC721) {
ERC721Consecutive._mint(to, tokenId);
}
| 2,933,115 |
pragma solidity ^0.5.2;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
/... | this function is used by contract to calculate benefit allocation when a staker makes a deposit _pet: this is a reference to staker's pet storage _depositAmount: this is amount deposited by staker _depositMonth: this is month at which deposit takes place return benefit amount to be allocated due to the deposit if... | function _getBenefitAllocationByDepositAmount(
PET storage _pet,
uint256 _depositAmount,
uint256 _depositMonth
) private view returns (uint256) {
uint256 _planId = _pet.planId;
uint256 _amount = _depositAmount != 0
? _depositAmount : _pet.monthlyDepositAmount[_depositMonth];
uint256 _m... | 12,883,764 |
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
pragma solidity ^0.4.24;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address p... | Check if the token has a valid Composable ERC721 implementation And its fingerprint is valid _tokenAddress - address of the token _tokenId - uint256 of the index _fingerprint - bytes of the fingerprint/ | function _requireComposableERC721(
address _tokenAddress,
uint256 _tokenId,
bytes memory _fingerprint
)
internal
view
{
ERC721Verifiable composableToken = ERC721Verifiable(_tokenAddress);
if (composableToken.supportsInterface(ERC721Composable_ValidateF... | 5,541,604 |
/**
*Submitted for verification at Etherscan.io on 2021-03-26
*/
pragma solidity ^0.7.1;
//SPDX-License-Identifier: UNLICENSED
/* New ERC23 contract interface */
interface IErc223 {
function totalSupply() external view returns (uint);
function balanceOf(address who) external view returns (uint);
funct... | Calculate sign of x, i.e. -1 if x is negative, 0 if x if zero, and 1 if x is positive. Note that sign (-0) is zero. Revert if x is NaN. x quadruple precision number return sign of x/ | function sign (bytes16 x) internal pure returns (int8) {
uint128 absoluteX = uint128 (x) & 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
if (absoluteX == 0) return 0;
else if (uint128 (x) >= 0x80000000000000000000000000000000) return -1;
else return 1;
}
| 10,947,087 |
./full_match/432204/0xDD23b1253020B8C66DB630fc091D1cC3E984A878/sources/contracts/library/Bytes32LinkedListLibrary.sol | Creates a bidirectional link between two nodes on direction `_direction` self stored linked list from contract _node first node for linking _link node to link to in the _direction/ | function createLink(LinkedList storage self, bytes32 _node, bytes32 _link, bool _direction) internal {
self.list[_link][!_direction] = _node;
self.list[_node][_direction] = _link;
}
| 16,381,337 |
/**
*Submitted for verification at Etherscan.io on 2021-07-13
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.12;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual retu... | Create a uniswap pair for this new token | function initContract(address _uniswapV2Pair) external onlyOwner{
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(_router);
uniswapV2Pair = _uniswapV2Pair;
uniswapV2Router = _uniswapV2Router;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = tru... | 10,743,982 |
./full_match/43113/0x16f2fA2d1148E95fEc87Ad8EE64A38d91F365835/sources/PriceOracle.sol | Stores the price for a given <underlyingToken>-<priceToken>-<settlementDate> triplet All prices are normalized to 8 decimals Stores the oracle address to use when looking for the price of a given token oracles are keyed by the pair of underlyingToken-priceToken, so for a BTCUSD oracle returning a price of $14_000, t... | function initialize(uint256 _dateOffset) external {
require(
_dateOffset == 1 days || _dateOffset == 1 weeks,
"PriceOracle: _dateOffset must align to 1 day or 1 week"
);
__Ownable_init();
dateOffset = _dateOffset;
}
| 7,155,011 |
./full_match/44787/0x8D6982B47A0af3BDCADf790551F5fAa9e0b583Eb/sources/contracts/CarbonPathNFT.sol | update the number of RetiredEAVs Requirements: - Only the admin address can update/ | function updateRetiredEAVs(uint256 tokenId, uint256 retiredAmount) public virtual onlyAdmin {
EAVTokens storage eavs = eavTokens[tokenId];
uint256 totalRetired = eavs.retiredEAVs + retiredAmount;
require(
eavs.advanceEAVs + eavs.bufferPoolEAVs >= totalRetired,
"CarbonPathNFT: retired amount w... | 13,248,414 |
pragma solidity >=0.4.25 <0.6.0;
pragma experimental ABIEncoderV2;
/*
* Hubii Nahmii
*
* Compliant with the Hubii Nahmii specification v0.12.
*
* Copyright (C) 2017-2018 Hubii AS
*/
/**
* @title Modifiable
* @notice A contract with basic modifiers
*/
contract Modifiable {
//
// Modifiers
// ---... | Unlock the given locked wallet's fungible amount of currency previously locked by the given locker wallet lockedWallet The address of the locked wallet lockerWallet The address of the locker wallet currencyCt The address of the concerned currency contract (address(0) == ETH) currencyId The ID of the concerned curre... | function unlockFungible(address lockedWallet, address lockerWallet, address currencyCt, uint256 currencyId)
public
{
uint256 lockIndex = lockedCurrencyLockerFungibleLockIndex[lockedWallet][currencyCt][currencyId][lockerWallet];
if (0 == lockIndex)
return;
require(
... | 12,574,539 |
// SPDX-License-Identifier: MIT
// Copyright (C) 2020, 2021, 2022 Swap.Pet@pm.me
// contracts/ChainlinkOracle.sol
pragma solidity ^0.6.0;
import "./lib/SafeMath.sol";
import "./Ownable.sol";
import "./interfaces/IOracle.sol";
// ChainLink Aggregator
interface IAggregator {
function latestRoundData() external view... | The rate can only be set once. It cannot be changed. | function set(address pair_, address base_, address quote_, uint256 decimals_) public {
require(msg.sender == owner, "ChainlinkOracle: not owner");
if (symbols[pair_].decimals == 0) {
symbols[pair_].base = base_;
symbols[pair_].quote = quote_;
symbols[pair_].decim... | 13,133,974 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC7... | and for the eternity! | function lockMetadata() external onlyDev {
locked = true;
}
| 14,762,852 |
/**
*Submitted for verification at Etherscan.io on 2021-11-29
*/
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Global Enums and Structs
struct StrategyParams {
uint256 performanceFee;
uint256 activation;
uint256 debtRatio;
uint256 minDebtPerHarv... | Sells our CRV -> WETH on UniV3 and CVX -> WETH on Sushi, then WETH -> stables together on UniV3 | function _sellCrvAndCvx(uint256 _crvAmount, uint256 _convexAmount)
internal
{
address[] memory convexTokenPath = new address[](2);
convexTokenPath[0] = address(convexToken);
convexTokenPath[1] = address(weth);
if (_convexAmount > 0) {
IUniswapV2Router02(sushi... | 10,719,637 |
./full_match/421613/0xD08Ab99480d02bf9C092828043f611BcDFEA917b/sources/src/libraries/SortitionSumTreeFactoryV2.sol | Query the leaves of a tree. Note that if `startIndex == 0`, the tree is empty and the root node will be returned. _key The key of the tree to get the leaves from. _cursor The pagination cursor. _count The number of items to return. return startIndex The index at which leaves start. return values The values of t... | function queryLeafs(
SortitionSumTrees storage self,
bytes32 _key,
uint256 _cursor,
uint256 _count
) external view returns (uint256 startIndex, uint256[] memory values, bool hasMore) {
SortitionSumTree storage tree = self.sortitionSumTrees[_key];
for (uint256 i =... | 11,568,865 |
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.7.5;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../presets/OwnablePausableUpgradeable.sol";
import "../interfaces/IVestingEs... | See {IOwnablePausable-isAdmin}./ | function isAdmin(address _account) external override view returns (bool) {
return hasRole(DEFAULT_ADMIN_ROLE, _account);
}
| 198,034 |
./partial_match/42/0x7f360502325964953B0737c22b2698Ba877fEE9C/sources/Exchanger.sol | Remit the fee in xUSDs Tell the fee pool about this. | function remitFee(IExchangeRates _exRates, IShadows _shadows, uint fee, bytes32 currencyKey) internal {
uint usdFeeAmount = _exRates.effectiveValue(currencyKey, fee, xUSD);
_shadows.synths(xUSD).issue(feePool().FEE_ADDRESS(), usdFeeAmount);
feePool().recordFeePaid(usdFeeAmount);
}
| 8,886,519 |
./full_match/1/0x71CED9A5eDA49125490e8f721f5Db54FB60c36FB/sources/contracts/NestedTrade.sol | Checks to see if a moonbird is escrowed within the NestedTrade contract | function isMoonbirdEscrowed(uint256 tokenId) public view returns (bool) {
return address(this) == moonbirds.ownerOf(tokenId);
}
| 16,525,314 |
./full_match/80001/0x0D0677caDC47e338fB222ca44708Ed398E108488/sources/_superfluid-finance/ethereum-contracts/contracts/apps/CFAv1Library.sol | Create flow without userData cfaLibrary The cfaLibrary storage variable receiver The receiver of the flow token The token to flow flowRate The desired flowRate/ | function createFlow(
InitData storage cfaLibrary,
address receiver,
ISuperfluidToken token,
int96 flowRate
) internal {
createFlow(cfaLibrary, receiver, token, flowRate, new bytes(0));
}
| 5,642,036 |
./partial_match/1/0xfc4913214444aF5c715cc9F7b52655e788A569ed/sources/Icosa.sol | Adds more HDRN to an existing stake. amount Amount of HDRN to add to the stake. return Number of stake points allocated to the stake./ load stake into memory get the HEX share rate and calculate additional stake points lock in payout from previous stake points update stake entry add additional points to the pool (foll... | function hdrnStakeAddCapital (
uint256 amount
)
external
nonReentrant
returns (uint256)
{
_stakeDailyUpdate();
StakeCache memory stake;
_stakeLoad(hdrnStakes[msg.sender], stake);
require(stake._isActive == true,
"ICSA: NO STAKE");... | 15,721,946 |
// SPDX-License-Identifier: MIT
/**
*Submitted for verification at Etherscan.io on 2020-03-04
*/
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
contract Comp {
/// @notice EIP-20 token name for this token
string public constant name = 'Compound';
/// @notice EIP-20 token symbol for this token... | 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, uint256 rawAmount)
external
returns (bool)
{
uint96 amount;
if (rawAmount == uint256(int256(-1))) {
amount = uint96(int96(-1));
amount = safe96(rawAmount, 'Comp::approve: amount exceeds 96 bits');
}
allowa... | 905,095 |
pragma solidity ^0.4.11;
interface CommonWallet {
function receive() external payable;
}
library StringUtils {
function concat(string _a, string _b)
internal
pure
returns (string)
{
bytes memory _ba = bytes(_a);
bytes memory _bb = bytes(_b);
... | Update token params and transfer to new owner. Only contract's own tokens could be updated. _to Address to transfer token to. _tokenId Id of token that should be transferred. _params New token params. Update send to the server's wallet the transaction cost withdraw it from the balance of the contract. this amount mu... | function updateAndTransferFrom(
address _to,
uint256 _tokenId,
string _params,
uint256 _petId,
uint256 _transferCost
)
public
ownOnly(_tokenId)
minionOnly
{
require(bytes(_params).length > 0, "params_length");
tokens_[_tokenId... | 5,397,211 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
pragma abicoder v2;
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@rarible/lib-broken-line/contracts/LibBrokenLine.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
contract StakingBase is... | Сalculate and return (newAmount, newSlope), using formula: k = (ST_FORMULA_COMPENSATE + ST_FORMULA_CLIFF_MULTIPLIER (cliffPeriod)^2 + ST_FORMULA_SLOPE_MULTIPLIER (slopePeriod)^2) / ST_FORMULA_MULTIPLIER newAmount = k amount / ST_FORMULA_DIVIDER newSlope = newAmount / slopePeriod/ | function getStake(uint amount, uint slope, uint cliff) public pure returns (uint stakeAmount, uint stakeSlope) {
uint cliffSide = cliff.mul(cliff).mul(ST_FORMULA_CLIFF_MULTIPLIER);
uint slopePeriod = divUp(amount, slope);
uint slopeSide = slopePeriod.mul(slopePeriod).mul(ST_FORMULA_SLOPE_MU... | 12,570,417 |
./full_match/97/0x860a6bA4136f6282967dFd72568d0826dfF7fD6e/sources/project_/contracts/diamond/facets/TradingCheckerFacet.sol | price qty 10^18 / 10^(8+10) = price qty The notional value must be greater than or equal to the minimum notional value allowed The notional value of the position must be less than or equal to the maximum notional value allowed by pair marginUsd = amountInUsd - openFeeUsd - executionFeeUsd leverage = notionalUsd / ma... | function openLimitOrderCheck(IBook.OpenDataInput calldata data) external view override {
_checkParameters(data);
IVault.MarginToken memory token = IVault(address(this)).getTokenForTrading(data.tokenIn);
require(token.token != address(0) && token.asMargin, "TradingCheckerFacet: This token is... | 3,282,191 |
pragma solidity 0.5.17;
import "./CErc20Immutable.sol";
import "./CEther.sol";
import "./ErrorReporter.sol";
import "./EIP20Interface.sol";
import "./Strings.sol";
import "./TriggerInterface.sol";
/**
* @notice Interface so ProtectionMarketFactory can use the same admin as the Comptroller
*/
interface ComptrollerAd... | Reduces reserves by transferring to admin Requires fresh interest accrual reduceAmount Amount of reduction to reserves return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ totalReserves - reduceAmount Check caller is Reserve Guardian or admin We fail gracefully unless market's block number ... | function _reduceReservesFresh(uint256 reduceAmount) internal returns (uint256) {
uint256 totalReservesNew;
if (msg.sender != comptroller.reserveGuardian() && msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.REDUCE_RESERVES_ADMIN_CHECK);
}
if (accrualBlockNumber != getBlockNum... | 14,760,608 |
./full_match/3/0xe30c6cC142633243F40d0F141938B0602FE3a6D0/sources/browser/AccredifyMultiSigDocStore.sol | Execute a multi-signature transfer transaction from this wallet using 2 signers: one from msg.sender and the other from ecrecover. This transaction transfers the ownership of the certificate store to a new owner. newOwner the new owner's address signature second signer's signature/ | function transfer(
address newOwner,
bytes memory signature
) public onlyCustodian {
bytes32 operationHash = keccak256(abi.encodePacked("TRANSFER", newOwner));
verify(operationHash, signature, 1);
documentStore.transferOwnership(newOwner);
}
| 8,264,560 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@uniswap/v3-periphery/co... | Use the public getter function for bids for a sinble bid return An array of type Bid/ | function getAllBids() public view returns (Bid[] memory) {
return bids;
}
| 13,436,049 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.... | Emergency function: In case any ERC20 tokens get stuck in the contract unintentionally Only owner can retrieve the asset balance to a recipient address | function rescueERC20(address asset) onlyAdmin external {
IERC20(asset).transfer(treasury, IERC20(asset).balanceOf(address(this)));
}
| 12,763,872 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.10;
import {IRoyaltyEngineV1} from "@manifoldxyz/royalty-registry-solidity/contracts/IRoyaltyEngineV1.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165Check... | Unchecks for loop post condition _i The value to increment | function increment(uint256 _i) internal pure returns (uint256) {
unchecked {
return _i + 1;
}
}
| 12,593,337 |
./full_match/1149/0xbaDAe50638507462896fEa9820845a1B70C08792/sources/Projects/Exchange/PlexRouter/contracts/PlexswapRouter.sol | SWAP (supporting fee-on-transfer tokens) requires the initial amount to have already been sent to the first pair scope to avoid stack too deep errors | function _swapSupportingFeeOnTransferTokens(address[] memory path, address _to) internal virtual {
for (uint256 i; i < path.length - 1; i++) {
(address input, address output) = (path[i], path[i + 1]);
(address token0, ) = PlexswapLibrary.sortTokens(input, output);
IPlexsw... | 4,664,819 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
// File: @openzeppelin/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally ava... | Returns total pending rewards of all input token ids | function getTotalClaimable(uint256[] memory _tokenIds)
external
view
returns (uint256 totalRewards)
{
for (uint256 i = 0; i < _tokenIds.length; i++) {
totalRewards += getPendingReward(_tokenIds[i]);
}
}
| 96,524 |
import 'dapple/test.sol';
import 'database.sol';
import 'dappsys/auth.sol';
import 'initial_controller.sol';
contract DappHubSimpleControllerTest is Test, DSAuthModesEnum {
DappHubNameOwnerDB names;
DappHubDB packages;
DappHubSimpleController controller;
Tester T1; address t1;
Tester T2; address t2;
funct... | Should be able to transfer a package owned by us DappHubSimpleController(t1).setPackage("foo", 1, 0, 0, "bar"); | function testAuthorizedTransfer() {
controller.setNameOwner('foo', address(this));
controller.transferName("foo", t1);
}
| 1,042,798 |
./full_match/1/0x2DE9441C3e22725474146450FC3467A2c778040F/sources/pickle.sol | Updates the active vault. This function reverts if the vault adapter is the zero address, if the token that the vault adapter accepts is not the token that this contract defines as the parent asset, or if the contract has not yet been initialized. _adapter the adapter for the new active vault. | function _updateActiveVault(IVaultAdapterV2 _adapter) internal {
require(_adapter != IVaultAdapterV2(ZERO_ADDRESS), "YumPickleVault: active vault address cannot be 0x0.");
require(_adapter.token() == token, "YumPickleVault: token mismatch.");
_vaults.push(VaultV2.Data({
adapter: _adapter,
tot... | 3,122,706 |
./partial_match/3/0x4dD7CB4fd785F515B9391312c077b3aD7ec33F10/sources/MasterChef.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.lastRewardBlock = block.number;... | 5,263,270 |
./full_match/1/0xD0561AEF1D5cd30a1779f01B41B3436027177d9A/sources/src/nft/ZoraCreator1155Impl.sol | Internal setter for contract admin with no access checks newOwner new owner address | function _setOwner(address newOwner) internal {
address lastOwner = config.owner;
config.owner = newOwner;
emit OwnershipTransferred(lastOwner, newOwner);
emit ConfigUpdated(msg.sender, ConfigUpdate.OWNER, config);
}
| 3,219,388 |
./partial_match/1/0xFCE1c68E7414605fF1f97D197D6Ba05a6d232311/sources/cache/solpp-generated-contracts/Portfolios.sol | skip numCurrencies the total number of currencies set by escrow/ | function setNumCurrencies(uint16 numCurrencies) external override {
require(calledByEscrow(), "20");
G_NUM_CURRENCIES = numCurrencies;
}
| 16,064,623 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { IOrderBook } from "./interfaces/IOrderBook.sol";
import "hardhat/console.sol";
contract OrderBookEther {
struct Order {
address maker;
uint256 price;
uin... | ERC20 makerToken = _isBuy ? baseToken : tradeToken; loop until find the correct place to insert makerToken.transferFrom(msg.sender, address(this), transferAmount); | function insertOrder(bool _isBuy, uint256 _price, uint256 _amount) internal {
uint256 headOrderId = _isBuy ? highestBuyOrderId: lowestSellOrderId;
Order memory headOrder = orderById[headOrderId];
bool shouldInsertHead = _isBuy ? _price > headOrder.price : _price < headOrder.price;
u... | 12,955,814 |
/**
*Submitted for verification at Etherscan.io on 2022-04-12
*/
//Forever Love Coin
//https://t.me/ForeverLoveCoin
//https://www.gracieroze.com/products/forever-love-coins-for-coin-shels
//Low Liquidity into a fearsome marvel!
//Initial Supply: 1,000,000,000 Tokens
//To assist with liquidity stabilisation and aggr... | exclude from paying fees or having max transaction amount | constructor() ERC20("Forever Love Coin", "FLC") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
airDropLimitLiftDate = block.timestamp + 10 days;
airDropLimitInEffect = true;
airDropDailySellPerc = 10;
... | 200,805 |
// Copyright (C) 2018 Argent Labs Ltd. <https://argent.xyz>
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version... | inject NONSTANDARD NAMING | function _NEWSALT377(bytes32 _salt, address _owner, address[] memory _modules, address _guardian) internal pure returns (bytes32) { | 2,513,407 |
pragma solidity ^0.4.23;
// File: contracts/Proxy/OwnedUpgradeabilityProxy.sol
/**
* @title OwnedUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with basic authorization control functionalities
*/
contract TrueAUD {
/**
* @dev Event to show ownership has been transferred
* @pa... | Fallback function allowing to perform a delegatecall to the given implementation. This function will return whatever the implementation call returns/ | function() external payable {
assembly {
let ptr := mload(0x40)
calldatacopy(ptr, returndatasize, calldatasize)
let result := delegatecall(gas, sload(0xc20777594ecafd73f44a72aa5ad2de8704211212d04473d4b208539e34ba14eb), ptr, calldatasize, returndatasize, returndatasize)
... | 13,072,510 |
// SPDX-License-Identifier: MIT
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 - s... | remove limits after token is stable | function removeLimits() external onlyOwner returns (bool) {
limitsInEffect = false;
return true;
}
| 1,324,795 |
pragma solidity 0.5.17;
import "./MToken.sol";
import "./ErrorReporter.sol";
import "./PriceOracle.sol";
import "./MomaMasterInterface.sol";
import "./MomaMasterStorage.sol";
import "./MomaPool.sol";
/**
* @title Moma's MomaMaster Contract
* @author Moma
*/
contract MomaMaster is MomaMasterInterface, MomaMasterV1S... | Get current farming contract return The contract address/ | function currentFarmingDelegate() public view returns (address) {
return MomaFactoryInterface(factory).farmingDelegate();
}
| 12,663,258 |
// SPDX-License-Identifier: MIT
//
// _ _ _ _ _
// | |__ _ _ | |_ ___ _ __ ___ ___ | | __ ___ | |_ __| | ___ __ __
// | '_ \ | | | || __|/ _ \| '__|/ _ \ / __|| |/ // _ \| __| / _` | / _ \\ \ / /
// | |_) || |_| || |_| __/| | | (_) || (_... | Change the IPFS base url | function modifyBaseUrl(string memory _baseUrl) external onlyOwner {
ipfsBase = _baseUrl;
}
| 12,721,378 |
./partial_match/42/0x6194cD9C04fA346733F0DBA45c4EFe0C00823dCE/sources/KovanLETH.sol | Goals: 1. if the _tokensToRedeem being claimed does not drain the vault to below 160% 2. pull out the amount of ether the senders' tokens entitle them to and send it to them | function redeem(uint _tokensToRedeem)
public
{
(uint collateralToUnlock, uint fee, uint collateralToReturn) = calculateRedemptionValue(_tokensToRedeem);
bytes memory proxyCall = abi.encodeWithSignature(
"freeETH(address,address,uint256,uint256)",
makerManager,
... | 8,834,890 |
./full_match/4/0x5Fa046d6f146d49DB2855C571F8D8610BDE96091/sources/contracts/ERC721A.sol | Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. The call is not executed if the target address is not a contract. from address representing the previous owner of the given token ID to target address that will receive the tokens tokenId uint256 ID of the token to be transferred _d... | function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try
IERC721Receiver(to).onERC721Received(
_msgSender(),
from,
tokenId,
_data
)
returns (bytes4 retval) {
return retval == IER... | 12,346,974 |
/*
Copyright 2019 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, ... | Decompose an ABI-encoded SignatureValidatorNotApprovedError. encoded ABI-encoded revert error. return signerAddress The expected signer of the hash. return validatorAddress The expected validator. | function decodeSignatureValidatorNotApprovedError(bytes memory encoded)
public
pure
returns (
address signerAddress,
address validatorAddress
)
{
return LibExchangeRichErrorDecoder.decodeSignatureValidatorNotApprovedError(encoded);
}
| 1,834,471 |
/**
*Submitted for verification at Etherscan.io on 2022-01-12
*/
pragma solidity 0.5.16;
// SPDX-License-Identifier: MIT @GoPocketStudio
interface IFactory {
function getPair(address tokenA, address tokenB) external view returns (address pair);
}
interface IPair {
function token0() external view returns (ad... | SPDX-License-Identifier: MIT @GoPocketStudio | interface IFactory {
function getPair(address tokenA, address tokenB) external view returns (address pair);
}
| 10,960,653 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
.'cdO0000OO00KKNNNXKOkdc'.
'cooolc;;lc',l:'':lloxO000KKOdc'
'ldoll;.'c..;; .:' ':..::;cxKKxccddl'
;ddlc'.:; ,..;c,cdxddk0Ox:.
;ddc..:, ... | Builds a prefixed hash to mimic the behavior of eth_sign. | function prefixed(bytes32 hash) internal pure returns (bytes32) {
return
keccak256(
abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)
);
}
| 168,729 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppel... | amount Amount to reimburse to vault contract in USD | function reimburse(uint farmIndex, uint amount) external onlyVault returns (uint USTAmt) {
if (farmIndex == 0) withdrawMMSFTUST(amount * 1e18 / getMMSFTUSTPoolInUSD(), 0);
else if (farmIndex == 1) withdrawMTWTRUST(amount * 1e18 / getMTWTRUSTPoolInUSD(), 0);
else if (farmIndex == 2) withdrawM... | 295,959 |
pragma solidity ^0.5.0;
import "./CcDAO.sol";
/**
* @title DAOFactory is a contract following Factory
* Pattern to generate CcDAOs.
*/
contract DAOFactory {
mapping(string => CcDAO) internal daos;
mapping(address => bool) internal isAdmin;
event DAOAdded(
address indexed _from,
... | createCrowdsale creates a new crowdsale. _crowdsaleID the crowdsale ID, must be unique. _firstlifePlaceID the placeID on Firstlife database. _tokenToGive the TokenTemplate instance used to give new tokens. _tokenToAccept the TokenTemplate instance used to accept contributions. _start the start time of the crowdsal... | function createCrowdsale(
string memory _crowdsaleID,
string memory _firstlifePlaceID,
string memory _tokenToGive,
string memory _tokenToAccept,
uint _start,
uint _end,
uint256 _acceptRatio,
uint256 _giveRatio,
uint _maxCap
) public {
... | 6,417,545 |
./partial_match/1/0x0649CFFa638931612649DfACE45bc8554e1be176/sources/Muntface_Decal.sol | Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}./ | function getRoleAdmin(
bytes32 role
) public view virtual override returns (bytes32) {
return _roles[role].adminRole;
}
| 3,697,446 |
./full_match/42161/0xB6007991cE40a203DbE5f8c088dfd7cE2a2360F1/sources/project_/contracts/ArbnowV2Pair.sol | update reserves and, on the first call per block, price accumulators never overflows, and + overflow is desired | function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private {
require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'ArbnowV2: OVERFLOW');
uint32 blockTimestamp = uint32(block.timestamp % 2**32);
if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) ... | 16,298,972 |
pragma solidity ^0.4.18;
contract DelegateERC20 {
function delegateTotalSupply() public view returns (uint256);
function delegateBalanceOf(address who) public view returns (uint256);
function delegateTransfer(address to, uint256 value, address origSender) public returns (bool);
function delegateAllowance(addre... | after a day, admin finalizes the staking fee change | function finalizeChangeStakingFees() public onlyAdminOrOwner {
require(changeStakingFeesOperation.admin == admin);
require(changeStakingFeesOperation.deferBlock <= block.number);
uint80 _transferFeeNumerator = changeStakingFeesOperation._transferFeeNumerator;
uint80 _transferFeeDenom... | 11,778,472 |
./partial_match/1/0x3Bd5A605f46096836a9518a33A95fa57567526f5/sources/PassiveNetworkEth.sol | band 1 & 2 - 3% base rate band 3 & 4 - 4% base rate band 5 & 6 - 5% base rate | function getInterestBandInfo(address _addr) public view returns (uint interestRate, uint maxEarning) {
uint secPassed = now.sub(players[_addr].time);
uint _lastWithdrawal = now - lastWithdrawal[_addr];
uint _trxDeposit = players[_addr].trxDeposit;
if (secPassed > 0 && player... | 9,321,371 |
pragma solidity ^0.4.4;
import '../token/SimpleToken.sol';
import 'zeppelin-solidity/contracts/math/SafeMath.sol';
contract TokenMarket {
using SafeMath for uint256;
// the token being sold
SimpleToken public token;
// Token Market owner
address public owner;
// amount of raised money in wei
uint256 p... | creates the token to be sold. override this method to have crowdsale of a specific mintable token. | function createTokenContract() internal returns (SimpleToken) {
return new SimpleToken();
}
| 5,465,274 |
pragma solidity ^0.4.25;
contract ParallelConfigPrecompiled
{
function registerParallelFunctionInternal(address, string, uint256) public returns (int);
function unregisterParallelFunctionInternal(address, string) public returns (int);
}
contract ParallelContract
{
ParallelConfigPrecompiled precompile... | Disable register parallel function | function disableParallel() public
{
unregisterParallelFunction("transfer(string,string,uint256)");
unregisterParallelFunction("test_1()");
}
| 1,758,495 |
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... | Changes the exclusive role holder of `roleId` to `newMember`. Reverts if the caller is not a member of the managing role for `roleId` or if `roleId` is not an initialized, ExclusiveRole. roleId the ExclusiveRole membership to modify. newMember the new ExclusiveRole member./ | function resetMember(uint256 roleId, address newMember) public onlyExclusive(roleId) onlyRoleManager(roleId) {
roles[roleId].exclusiveRoleMembership.resetMember(newMember);
emit ResetExclusiveMember(roleId, newMember, msg.sender);
}
| 99,157 |
pragma solidity ^0.4.22;
//
// complied with 0.4.24+commit.e67f0147.Emscripten.clang
// 2018-09-07
// With Optimization enabled
//
// Contact support@win1million.app
//
// Play at: https://win1million.app
//
// Provably fair prize game where you can win $1m!
//
//
/**
* @title SafeMath
* @dev Math o... | check if a game is in play for this bar... | function playGame(uint256 barId,
string _answer1, string _answer2, string _answer3) public
whenNotPaused
correctAnswers(barId, _answer1, _answer2, _answer3)
payable {
require(msg.value >= minGamePlayAmount);
uint256 houseAmt = (msg.value.di... | 1,021,284 |
./full_match/42220/0x0AbcaDdc3F22131b467F3f4E5cef6007e4a53268/sources/contracts/NFT.sol | owner() function overriding for OpenSea/ | function owner() public view override returns (address) {
return IFactory(IStorageContract(storageContract).factory()).platformAddress();
}
| 16,360,381 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.