file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity 0.5.17;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
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... | Burns a specific amount of tokens. _value The amount of token to be burned./ no need to require value <= totalSupply, since that would imply the sender's balance is greater than the totalSupply, which should be an assertion failure | function _burn(address burner, uint256 _value) internal {
require(_value > 0);
require(_value <= balances[burner]);
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Transfer(burner, address(0), _value);
emit Burn(burner, _v... | 5,916,855 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "./abstract/AbstractDependant.sol";
import "./tokens/ERC1155Upgradeable.sol";
contract BMIUtilityNFT is OwnableUpgradeable, ... | if we want to use external ERC1155, then we need to send required NFTs directly to LM contract + change NFTs' indices there | function mintNFTsForLM() external onlyOwner {
require(!nftsMinted, "BMIUtilityNFT: NFTs are already minted");
nftsMinted = true;
uint256[] memory _ids = new uint256[](NFT_TYPES_COUNT);
uint256[] memory _amounts = new uint256[](NFT_TYPES_COUNT);
_ids[0] = 1;
_amount... | 1,400,445 |
pragma solidity >0.5.4;
import "@daostack/arc/contracts/controller/Controller.sol";
import "@daostack/arc/contracts/universalSchemes/SchemeRegistrar.sol";
import "@daostack/arc/contracts/universalSchemes/UpgradeScheme.sol";
import "@daostack/infra/contracts/votingMachines/AbsoluteVote.sol";
import "@daostack/infra/co... | _founders An array with the addresses of the founders of the organization _avatarTokenAmount Amount of tokens that the avatar receive on new organization _foundersReputationAmount An array of amount of reputation that the founders receive in the new organization/mint token to avatar Mint reputation for founders: | function addFounders(
GoodDollar nativeToken,
Reputation nativeReputation,
address _sender,
address[] memory _founders,
uint256 _avatarTokenAmount,
uint256[] memory _foundersReputationAmount
) public returns (Avatar) {
Avatar avatar = new Avatar("GoodDolla... | 12,727,939 |
./full_match/80001/0x4444572f8e6FB8b76f2943C1ba15f5aA9b38eC72/sources/gist-4c970e79d3a27a9edbbf04d6c737be27/UserConfiguration.sol | Returns the Isolation Mode state of the user self The configuration object reservesData The state of all the reserves reservesList The addresses of all the active reserves return True if the user is in isolation mode, false otherwise return The address of the only asset used as collateral return The debt ceiling of ... | function getIsolationModeState(
DataTypes.UserConfigurationMap memory self,
mapping(address => DataTypes.ReserveData) storage reservesData,
mapping(uint256 => address) storage reservesList
) internal view returns (bool, address, uint256) {
if (isUsingAsCollateralOne(self)) {
uint256 assetId = ... | 5,657,783 |
/***
* ██████╗ ██╗ ██╗███╗ ██╗ █████╗ ██████╗ ██╗ ███████╗
* ██╔═══██╗██║ ██║████╗ ██║██╔══██╗██╔══██╗██║ ██╔════╝
* ██║ ██║██║ █╗ ██║██╔██╗ ██║███████║██████╔╝██║ █████╗
* ██║ ██║██║███╗██║██║╚██╗██║██╔══██║██╔══██╗██║ ██╔══╝
* ╚██████╔╝╚███╔███╔╝██║ ╚████║██║ ██║... | Transfers Owner of the contract to a new account (`newOwner`). Internal function without access restriction./ | function _transferOwner(address newOwner) internal virtual {
address oldOwner = _Owner;
_Owner = newOwner;
emit OwnerTransferred(oldOwner, newOwner);
}
| 5,371,922 |
pragma solidity >=0.4.19 <0.6.5;
import "./OpsToken.sol";
import "./Multivest.sol";
contract SellableToken is Multivest {
OpsToken public token;
uint256 public constant DECIMALS = 18;
uint256 public minPurchase = 1000000; //10usd * 10 ^ 5
uint256 public softCap = 300000000000; //usd * 10 ^ 5
u... | set ether price in USD with 5 digits after the decimal pointex. 308.75000for updating the price through multivest check if dot is in 6 position from the last | function setEtherInUSDInternal(string _price) internal {
bytes memory bytePrice = bytes(_price);
uint256 dot = bytePrice.length.sub(uint256(6));
require(0x2e == uint256(bytePrice[dot]), "");
uint256 newPrice = uint256(10**23).div(parseInt(_price, 5));
require(newPrice > 0,... | 6,362,627 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;
import './Context.sol';
import './Strings.sol';
import './ERC165.sol';
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControlUpgradeable {
function hasRole(bytes32 role, address account) external view ... | Does the same thing as _settleBalance() for a user inactive balance, but limits the epoch we progress to, in order that we can put an upper bound on the gas expenditure of the function. See LS1Failsafe./ | function _failsafeSettleUserInactiveBalance(
address staker,
uint256 maxEpoch
)
internal
{
LS1Types.StoredBalance storage balancePtr = _getBalancePtr(staker, false);
LS1Types.StoredBalance memory balance =
_failsafeLoadUserInactiveBalanceForUpdate(balancePtr, staker, maxEpoch);
_stor... | 5,860,547 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
pragma abicoder v2;
import "./ActionGuards.sol";
import "../SettleAssetsExternal.sol";
import "../FreeCollateralExternal.sol";
import "../../math/SafeInt256.sol";
import "../../internal/balances/BalanceHandler.sol";
import "../../internal/AccountContextH... | Method for manually settling an account, generally should not be called because other methods will check if an account needs to be settled automatically. If a bitmap account has debt and is settled via this method, the hasDebt flag will not be cleared until a free collateral check is performed on the account. account ... | function settleAccount(address account) external returns (bool) {
requireValidAccount(account);
(AccountContext memory accountContext, bool didSettle) = _settleAccountIfRequired(account);
if (didSettle) accountContext.setAccountContext(account);
return didSettle;
}
| 1,525,205 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import '@openzeppelin/contracts/utils/math/SafeMath.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import "./SpookyToken.sol";
... | View function to see pending BOOs on frontend. | function pendingBOO(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accBOOPerShare = pool.accBOOPerShare;
if (block.timestamp > pool.lastRewardTime && pool.stakingTokenTotal... | 14,125,298 |
./partial_match/4/0x5ed8b6Cfe3938307C666f12b0246E730A30488e5/sources/Bank.sol | Owner can remove a loan duration and its interest rate. Owner remove a loan duration and its interest rate. _tariffId Loan tariff Id../ | function removeLoanDurationAndInterest(uint256 _tariffId) external onlyByManager {
lnTfId[fdTariffIdToFdTfIdIndex[_tariffId]] = lnTfId[lnTfId.length.sub(1)];
lnTfId.pop();
emit RemoveLoanDurationAndInterest(_tariffId);
}
| 8,723,683 |
pragma solidity >=0.5.11;
//Write a Person contract that has an owned reference to a Wallet object. Person should also have an addMoney()
//transaction that takes in a Money parameter and passes it to its Wallet's receiveMoney() transaction.
//addMoney() should return the old money that was replaced
//Note: the Perso... | m is owned initially but unowned in the end. | function addMoney(Money m) public returns (Money) {
return wallet.replaceMoney(m);
}
| 12,767,299 |
// File: contracts/SmartRoute/intf/IDODOAdapter.sol
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
interface IDODOAdapter {
function sellBase(address to, address pool, bytes memory data) external;
function sellQuote(... | transferIERC20(fromToken).transfer(pool, sellAmount); swap | function _uniV3Swap(address to, address pool, uint160 sqrtX96, bytes memory data) internal {
(address fromToken, address toToken, uint24 fee) = abi.decode(data, (address, address, uint24));
uint256 sellAmount = IERC20(fromToken).balanceOf(address(this));
bool zeroForOne = fromToken ... | 134,597 |
// SPDX-License-Identifier: MIT
// Smart Contract Written by: Ian Olson
/*
____ __ ______ __
/ __ )________ ____ ____/ /___ _____ / ____/__ _________ ____ _____ ____/ /__ ______
/ __ / ___/ _ \/ __ \/ __ / __ `/ __ \ / /_ / _ \/... | Return the support interfaces of this contract. Ian Olson | function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == _INTERFACE_ID_ERC165
|| interfaceId == _INTERFACE_RARIBLE_ROYALTIES
|| interfaceId == _INTERFACE_ID_ERC721
|| interfaceId == _INTERFACE_ID_ERC721_METADATA
|| int... | 1,116,427 |
pragma solidity 0.8.10;
// Copyright BigchainDB GmbH and Ocean Protocol contributors
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
// Code is Apache-2.0 and docs are CC-BY-4.0
import "../../interfaces/IERC20.sol";
import "../../interfaces/IERC20Template.sol";
import "../../interfaces/IPool.sol";
import "OpenZe... | / called by ERC20 Deployer of datatokencheck if the tokens are bound | function setPoolSwapFee(
address datatokenAddress,
address poolAddress,
uint256 swapFee
) external nonReentrant {
require(poolAddress != address(0), "Invalid poolAddress");
IPool bpool = IPool(poolAddress);
require(
bpool.getController() == address(thi... | 2,495,244 |
pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than... | Internal Function to add Team Sale, which duration check (atleast 1 min duration required) Adds an sale to the list of open sales. Also fires the SaleCreated event. _tokenIds The token identifiers _sale The sale/ Require that all sales have a duration of at least one minute. | function _addTeamSale(uint256[9] _tokenIds, Sale _sale) internal {
require(_sale.duration >= 1 minutes);
for(uint ii = 0; ii < 9; ii++) {
require(_tokenIds[ii] != 0);
require(nonFungibleContract.exists(_tokenIds[ii]));
tokenIdToSale[_tokenIds[ii]] = _sal... | 5,979,623 |
/**
*Submitted for verification at Etherscan.io on 2021-03-30
*/
/**
▄▄▄▄▄ ██ █▄▄▄▄ ▄█▄ ████▄ █ ▄▄ ▄ █ ██ ▄▀ ▄ ▄▄▄▄▄
█ ▀▄ █ █ █ ▄▀ █▀ ▀▄ █ █ █ █ █ █ █ █ ▄▀ █ █ ▀▄
▄ ▀▀▀▀▄ █▄▄█ █▀▀▌ █ ▀ █ █ █▀▀▀ ██▀▀█ █▄▄█ █ ▀▄ █ █ ▄ ▀▀▀▀▄
▀▄▄▄▄▀ █ █ █ █... | Returns sarcophagus data given an indentifier identifier the unique identifier a sarcophagus return sarc the Sarcophagus object/ | function sarcophagus(bytes32 identifier)
public
view
virtual
returns (Types.Sarcophagus memory)
{
return _data.sarcophaguses[identifier];
}
| 2,451,222 |
./full_match/1/0x9C1dC986D786534c13Ec32eFA6C7A1631898d102/sources/inari1.sol | Stake SUSHI `amount` into crXSUSHI and BENTO for benefit of `to` by batching calls to `sushiBar`, `crXSushiToken` and `bento`. | function stakeSushiToCreamToBentoTo(address to, uint256 amount) external {
}
| 3,117,004 |
./full_match/1/0x4e5482Aa7F6570e1EFC5bb70A244CD7fa3d82244/sources/contracts/shared/libraries/LibDiamond.sol | Internal function version of diamondCut | functionSelectors = new bytes4[](2);
functionSelectors[0] = IOwnable.transferOwnership.selector;
functionSelectors[1] = IOwnable.owner.selector;
diamondCut(cut, address(0), "");
}
function diamondCut(
IDiamondCut.FacetCut[] memory _diamondCut,
address _init,
... | 16,402,271 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.1;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
contract CommunityConnect {
using SafeMath for uint;
// holds the ETH address of the main customer
// allows the account owner to receive withdrawal payments at their Ethereum address
ad... | This function allows the Nonprofit to see the invoice Suppliers have sent | function viewApprovedInvoice() view public returns(address, uint256, uint256) {
return (approvedSupplier, compensationApproved, approvedInvoiceNumber);
}
| 14,086,115 |
/**
* Copyright 2017-2020, bZeroX, LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
import "../core/State.sol";
import "../events/ProtocolSettingsEvents.sol";
import "../openzeppelin/SafeERC20.sol";
import "../mixins/ProtocolTo... | The feesController calls this function to withdraw fees from three sources: lending, trading and borrowing. The fees (except SOV) will be converted to wRBTC. For SOV, it will be deposited directly to feeSharingProxy from the protocol. tokens The array of address of the token instance. receiver The address of the with... | function withdrawFees(address[] calldata tokens, address receiver)
external
whenNotPaused
returns (uint256 totalWRBTCWithdrawn)
{
require(msg.sender == feesController, "unauthorized");
for (uint256 i = 0; i < tokens.length; i++) {
uint256 lendingBalance = len... | 1,801,152 |
./full_match/137/0xb7097B5Cf1Dd5e3896Cc27366Dc2CA80De5502AC/sources/contracts/EnsoBeacon.sol | Accept ownership of another contract by this contract ownable The address of the contract that is getting it's ownership transferred | function acceptOwnership(address ownable) external onlyAdmin {
IOwnable(ownable).acceptOwnership();
}
| 3,744,841 |
pragma solidity ^0.4.24;
/**dev Utility methods for overflow-proof arithmetic operations
*/
library SafeMathLib {
/**dev Returns the sum of a and b. Throws an exception if it exceeds uint256 limits*/
function safeAdd(uint256 self, uint256 b) internal pure returns (uint256) {
uint256 c = self ... | calculates fee permille | function safePm(uint256 self, uint16 fee)
internal
pure
returns (uint256)
{
require (fee <= 1000);
return safeMult(self, uint256(fee)) / 1000;
}
| 1,052,231 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgrad... | Returns the total balance in both vault and strategy./ | function balance() public override view returns (uint256) {
IERC20Upgradeable want = IERC20Upgradeable(token);
return activeStrategy == address(0x0) ? want.balanceOf(address(this)) :
want.balanceOf(address(this)).add(IStrategy(activeStrategy).balanceOf());
}
| 2,491,743 |
pragma solidity ^0.5.0;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABLE... | Buy insurance for a flight/ | function buyInsurance
(
address buyer,
address airlineAddress,
string memory flightName,
uint256 departure
)
public
payable
{
by... | 2,509,767 |
./partial_match/1/0x6601d3f885D1A91FfE63B4b4A834Cf9E2490C2D8/sources/lib/core-physical/src/core/engines/BaseEngine.sol | exercises a long token in margin account at expiry but before settlement window this updates the account storage/ decode parameters | function _exerciseToken(address _subAccount, bytes calldata _data) internal virtual {
(uint256 tokenId, uint64 amount) = abi.decode(_data, (uint256, uint64));
_exerciseTokenInAccount(_subAccount, tokenId, amount);
emit ExercisedToken(_subAccount, tokenId, amount);
}
| 4,199,093 |
pragma solidity ^0.5.0;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
//using SafeMath for uint8;
/********************************************************************************************/
/* ... | Credits payouts to insurees/get all the insurees | {
bytes32 flightkey = getFlightKey(_airline,_flightName,_takeoffTimestamp);
address[] storage insurees = airlineinsurees[flightkey];
function authorizeCallerContract(address callerAddress)
external
requireContractOwner
requireIsOperational
}
function deauthorizeCaller... | 14,030,079 |
pragma solidity ^0.4.23;
/******* USING Registry **************************
Gives the inherting contract access to:
.addressOf(bytes32): returns current address mapped to the name.
[modifier] .fromOwner(): requires the sender is owner.
*************************************************/
// Returned by .getReg... | Increases totalCredits and credits[user] Optionally increases totalWonGwei stat. | function _creditUser(address _user, uint _amt, uint32 _gameId)
private
{
if (_amt == 0) return;
uint64 _incr = _gameId == 0 ? 0 : uint64(_amt / 1e9);
uint88 _totalCredits = vars.totalCredits + uint88(_amt);
uint64 _totalWonGwei = vars.totalWonGwei + _incr;
vars.to... | 2,445,955 |
pragma solidity ^0.8.5;
import "./interfaces/ICToken.sol";
import "./interfaces/ITrigger.sol";
/**
* @notice Defines a trigger that is toggled if the Compound exchange rate decreases between consecutive checks. Under
* normal operation, this value should only increase
*/
contract CompoundExchangeRate is ITrigger {... | Checks the yVault pricePerShare/ Read this blocks share price Check if current share price is below current share price, accounting for tolerance Save the new share price Return status | function checkTriggerCondition() internal override returns (bool) {
uint256 _currentPricePerShare = market.pricePerShare();
bool _status = _currentPricePerShare < ((lastPricePerShare * tolerance) / 1e18);
lastPricePerShare = _currentPricePerShare;
return _status;
}
| 6,992,379 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
/**
* @title Flashloan.
* @dev Flashloan aggregator.
*/
import "./helpers.sol";
import "@openzeppelin/contracts/utils/Address.sol";
contract AdminModule is Helper {
event updateOwnerLog(address indexed oldOwner, address indexed newOwner);
event... | Validates if the receiver sent the correct amounts of funds. Validates if the receiver sent the correct amounts of funds. _instaLoanVariables struct which includes list of initial balances, final balances and fees for the respective tokens./ | {
function validateFlashloan(FlashloanVariables memory _instaLoanVariables)
internal
pure
for (uint256 i = 0; i < _instaLoanVariables._iniBals.length; i++) {
require(
_instaLoanVariables._iniBals[i] +
_instaLoanVariables._instaFees[i] <=
... | 414,801 |
./full_match/4/0x6003CeE35E9D1faBa51C24B65D1B0aD6Ef0a4DDb/sources/contracts/scam.sol | Re-enables tax on the specified account./ | function removeExclude(address account) public onlyOwner {
require(isExcluded(account), "CoinToken: Account is not excluded");
excludeList[account] = false;
}
| 796,132 |
/*
Copyright 2019-2020 eMobilify GmbH
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... | Get the domain name of a given operator./ | function getNode(address operator) public view returns (string memory) {
return nodeOf[operator];
}
| 7,220,276 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import './token/PoolsInterestBearingToken.sol';
import './interfaces/ICrossChainBridgeERC20.sol';
import './interfaces/IBuyBackAndBurn.sol';
... | Private function that allows calls from other functions despite nonReentrant modifier/ get staker info and check if such a record exists update the liquidity mining pool calculations (e.g. rewardPerShare) calculate reward amount Save the current share of the pool as reward debt to prevent a staker from harvesting again... | function _harvest(address tokenAddress, address stakerAddress) private whenNotPaused {
StakerInfo storage staker = stakes[tokenAddress][stakerAddress];
require(staker.balance > 0, 'LiquidityMiningPools: Staker has a balance of 0');
updateRewards(tokenAddress);
uint256 accumulated = (staker.balance *... | 10,009,571 |
/*
........................................................................................................
................................ffff...................................................OOOOOOOO.........
...................llllll....fffffff..DDDDDDDDDDDDDD.............AAAAAAA.............OOOOOOOOOOOO.......
..... | mints 1 token per whitelisted address, does not charge a fee Max supply: 25 (token ids: 6-30)/ | function mintWorkerElf(
bytes32[] calldata merkleProof
)
public
isValidMerkleProof(merkleProof, workerElfMerkleRoot)
nonReentrant
{
require(workerElfId <= maxWorkerElfId, "minted the maximum # of elves");
require(!claimed[msg.sender], "Worker elf is already clai... | 1,099,801 |
./partial_match/137/0x7312050E8268287EAFBc318C0FB12BeBB48075C7/sources/TP3101.sol | addTP bulk max. 900 hashes/tx on Matic | function addBulk(bytes32[] calldata _hashes) external {
for(uint i = 0; i < _hashes.length; i++){
trueproofs[_hashes[i]] = true;
}
}
| 3,523,768 |
/**
*Submitted for verification at Etherscan.io on 2020-06-05
*/
pragma solidity =0.6.6;
interface IHiFiswapFactory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (add... | given an output amount of an asset and pair reserves, returns a required input amount of the other asset | function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) {
require(amountOut > 0, 'HiFiswapLibrary: INSUFFICIENT_OUTPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'HiFiswapLibrary: INSUFFICIENT_LIQUIDITY');
uint numerator = reserveIn... | 15,004,761 |
/*************************************************************************
* This contract has been merged with solidify
* https://github.com/tiesnetwork/solidify
*************************************************************************/
pragma solidity ^0.4.10;
/******************************************... | Returns number of investors, including reserved / | function getInvestorCount() constant returns(uint32) {
return investorsCount + knownReserved + unknownReserved;
}
| 13,021,356 |
./full_match/1313161554/0xCFEED4a123ECa680aeA2DdEa6dde42DFE724D955/sources/contracts/feedVaults/targetVaults/beefy/TargetVaultBeefy.sol | Withdraw all deposited balance back to target vault/ | function emergencyWithdrawAll() external virtual onlyOwner {
beefyVault.withdrawAll();
emit EmergencyWithdrawed();
}
| 13,235,102 |
./partial_match/42/0x5eFBC2dC413DBBaf58900bCc4d51EB016c1Ed478/sources/Lenrek1Vault.sol | Low level withdraw function | function _withdraw(uint256 _pid, uint256 _amount, address from, address to) internal {
PoolInfo storage pool = poolInfo[_pid];
require(pool.withdrawable, "Withdrawing from this pool is disabled");
UserInfo storage user = userInfo[_pid][from];
require(user.amount >= _amount, "withdraw... | 9,026,227 |
// SPDX-License-Identifier: UNLICENSED
// This code is taken from https://github.com/OpenZeppelin/openzeppelin-labs
// with minor modifications.
pragma solidity ^0.7.0;
import './UpgradeabilityProxy.sol';
/**
* @title OwnedUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with basic authori... | Tells the address of the owner return owner the address of the owner/ | function proxyOwner() public view returns (address owner) {
bytes32 position = proxyOwnerPosition;
assembly {
owner := sload(position)
}
}
| 302,183 |
pragma solidity 0.4.23;
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
... | Emergency transfer tokens to contract owner amount Number of tokens to transfer/ | function emergencyTokenDrain(uint256 amount) public onlyOwner hasBalance {
reb.transfer(owner, amount);
}
| 7,980,928 |
pragma solidity =0.6.6;
import "./IMdexPair.sol";
import "./IMdexFactory.sol";
library SafeMath {
function add(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x + y) >= x, "ds-math-add-overflow");
}
function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z... | 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 (
uint256 price0Cumulative,
uint256 price1Cumulative,
uint32 blockTimestamp
)
{
blockTimestamp = currentBlockTimestamp();
price0Cumulative = IMdexPair(pair).price0CumulativeLast();
price1Cumulative = I... | 7,267,859 |
pragma solidity ^0.4.24;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
functi... | this function specifies the possibility of a complete data set transferthe web3_batch_function explains how you use this function | function batchTransfer(address[] _tos, uint256[] _amount) onlyOwner public whenNotPaused returns (bool success) {
require(_tos.length == _amount.length);
uint256 i;
uint256 sum = 0;
for(i = 0; i < _amount.length; i++){
sum = sum.add(_amount[i]);
require(_tos[i] != address(0));
}
... | 5,914,504 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
import {MemberToken} from "@orcaprotocol/contracts/contracts/MemberToken.sol";
import {ControllerV1} from "@orcaprotocol/contracts/contracts/ControllerV1.sol";
import {TimelockController} from "@openzeppelin/contracts/governance/TimelockController.so... | Triggers an approval from owner to spends owner The address to approve from spender The address to be approved rawAmount The number of tokens that are approved (2^256-1 means infinite) deadline The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Hal... | function permit(
address owner,
address spender,
uint256 rawAmount,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external {
uint96 amount;
if (rawAmount == type(uint256).max) {
amount = type(uint96).max;
amount ... | 9,856,276 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "./interfaces/IERC20.sol";
import "./interfaces/IWrappedPosition.sol";
import "./interfaces/ITranche.sol";
import "./interfaces/ITrancheFactory.sol";
import "./interfaces/IInterestToken.sol";
import "./libraries/ERC20Permit.sol";
import "./librarie... | Note this is non standard but nearly all ERC20 have exposed decimal functions | interface IERC20 {
function symbol() external view returns (string memory);
function balanceOf(address account) external view returns (uint256);
function decimals() external view returns (uint8);
function transfer(address recipient, uint256 amount)
external
returns (bool);
functi... | 44,239 |
pragma solidity 0.4.21;
/**
* @title Array128 Library
* @author Modular Inc, https://modular.network
*
* version 1.2.0
* Copyright (c) 2017 Modular, Inc
* The MIT License (MIT)
* https://github.com/Modular-Network/ethereum-libraries/blob/master/LICENSE
*
* The Array128 Library provides a few utility function... | Returns the minimum value in an array. self Storage array containing uint256 type variables return minValue The highest value in the array | function getMin(uint128[] storage self) public view returns(uint128 minValue) {
uint256 term;
uint8 remainder;
assembly {
mstore(0x60,self_slot)
term := sload(add(sha3(0x60,0x20),div(i,2)))
remainder := mod(i,2)
term := div(term,4294967296)
}
term := an... | 14,392,789 |
pragma solidity ^0.5.8;
interface TokenInterface {
function allowance(address, address) external view returns (uint);
function balanceOf(address) external view returns (uint);
function approve(address, uint) external;
function transfer(address, uint) external returns (bool);
function transferFrom(a... | get Dai (Dai v2) address/ | function getDaiAddress() public pure returns (address dai) {
dai = 0x6B175474E89094C44Da98b954EedeAC495271d0F;
}
| 12,562,618 |
/**
*Submitted for verification at Etherscan.io on 2020-03-29
*/
/**
*Submitted for verification at Etherscan.io on 2019-10-18
*/
pragma solidity ^0.5.5;
library strings {
struct slice {
uint _len;
uint _ptr;
}
function memcpy(uint dest, uint src, uint len) private pure {
// Co... | Private function to remove a token from this extension's token tracking data structures. This has O(1) time complexity, but alters the order of the _allTokens array. tokenId uint256 ID of the token to be removed from the tokens list/ To prevent a gap in the tokens array, we store the last token in the index of the tok... | function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
_allTokens.length--;
_allTokensIndex[tokenId] = 0;
}
| 13,059,289 |
pragma solidity 0.5.11;
/**
* @title OUSD Vault Contract
* @notice The Vault contract stores assets. On a deposit, OUSD will be minted
and sent to the depositor. On a withdrawal, OUSD will be burned and
assets will be sent to the withdrawer. The Vault accepts deposits of
interest for... | Mint for multiple assets in the same call. _assets Addresses of assets being deposited _amounts Amount of each asset at the same index in the _assets to deposit./ Rebase must happen before any transfers occur. | function mintMultiple(
address[] calldata _assets,
uint256[] calldata _amounts
) external {
require(_assets.length == _amounts.length, "Parameter length mismatch");
uint256 priceAdjustedTotal = 0;
uint256[] memory assetPrices = _getAssetPrices(false);
for (uint25... | 1,233,158 |
/**
*Submitted for verification at Etherscan.io on 2022-03-10
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/cryptography/MerkleProof.sol
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
library MerkleProof {
function verify(
... | call contract owner & id owner function | function walletOfOwner(address _owner)
public
view
returns (uint256[] memory)
{
uint256 ownerTokenCount = balanceOf(_owner);
uint256[] memory ownedTokenIds = new uint256[](ownerTokenCount);
uint256 currentTokenId = 1;
uint256 ownedTokenIndex = 0;
... | 10,517,920 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import {ERC721BasicMint} from "../erc721/presets/ERC721BasicMint.sol";
//=====================================================================================================================
/// 🐻 ( ♥‿♥) OOGA BOOGA BONGA BEARA ( ♥‿♥) 🐻
//=======================... | Public function that sets the time for the mint to begin at. Time is stored as an integer represent the number of seconds since January 1st, 1970. This is referred to as epoch time. Only callable by contract admins. newLaunchTime uint256: The new launch time./ | function setLaunchTime(uint256 newLaunchTime) external virtual onlyRole(DEFAULT_ADMIN_ROLE) {
launchTime = newLaunchTime;
}
| 1,195,086 |
./partial_match/56/0x9b207c56bB1fa5d635254097f086D46B90511780/sources/StakezStaking.sol | emit OwnershipTransferred(owner, newOwner); | function transferOwnership(address payable _newOwner) external virtual onlyOwner {
newOwner = _newOwner;
}
| 11,226,195 |
./full_match/11155111/0x1b502402EB8fD08e657a4a2Bd6424AEc899D3c38/sources/contracts/core/DiGiHub.sol | @inheritdoc IDiGiHub | function comment(DataTypes.CommentData calldata vars)
external
override
whenPublishingEnabled
returns (uint256)
{
_validateCallerIsProfileOwnerOrDispatcher(vars.profileId);
return _createComment(vars);
}
| 3,800,502 |
pragma solidity ^ 0.5 .1;
// ----------------------------------------------------------------------------
//'Butt Coin' contract, version 1.0
// Version 0.1 was a fart during a launch, with a confusing _totalSupply and the way Ethereum tracks the burning.
// This coin can be mined, and a _totalSupply is dynamic.
//
//... | ------------------------------------------------------------------------ Owner can transfer out any accidentally sent ERC20 tokens ------------------------------------------------------------------------ | function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns(bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
| 12,678,143 |
./full_match/56/0x3816ECF9dBC8E1Cac423Fb764aAfe58DEc7c268E/sources/contracts/mooncakes.sol | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())... | 3,238,959 |
./full_match/1/0xD424E450bfc585224D6fc4e6e3D4E8659Ac24c1b/sources/contracts/DeliciouswapPair.sol | this low-level function should be called from a contract which performs important safety checks | function mint(address to) external override lock returns (uint liquidity) {
uint balance0 = IERC20(token0).balanceOf(address(this));
uint balance1 = IERC20(token1).balanceOf(address(this));
uint amount0 = balance0.sub(_reserve0);
uint amount1 = balance1.sub(_reserve1);
bool ... | 16,472,593 |
// SPDX-License-Identifier: MIT
import "./ShelterNOW.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./Pet.sol";
pragma solidity ^0.8.0;
/// @author Dylon Wong Chung Yee
/// @title An adoption contract to facilitate and keep track of adoptions in an animal shelter.
contract Adoption is Ownable, Pe... | Check if given adopter matches the pet ID. adopter: The adopter's address. petID: The pet ID adopted. return Match or not./ Pet should exists. | function _adopterMatches(address adopter, uint256 petID)
internal
view
petIDIsValid(petID)
returns (bool)
{
require(
_tempAdopters[petID] != address(0) || ownerOf(petID) != address(0),
"Pet does not exist."
);
return _tempAdopters[p... | 7,213,212 |
pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2;
import "./assign.sol";
contract demo is assign{
mapping(uint => uint) backrecord;
/**************用户定义空间***************/
/**************创建评估单功能类***************/
/**
* guobin
* 创建评估单基本信息
*/
function addvaluation(
string... | guobin 返回当前评估师注册时间/ | function checktime() view public returns (string) {
return _checktime();
}
| 895,595 |
./full_match/77/0xE92504e1a72c70589f27ED0D6D0569012C9B9a44/sources/verified-sources/0xf39617d8b0ed1cbBEE61dAA7CD4540BdD15f02D5/sources/COWCITIZEN.sol | Mint quantity to recipient address | function safeMint(address to, uint256 quantity) external onlyOwner {
_safeMint(to, quantity);
}
| 5,047,268 |
pragma solidity ^0.5.16;
import "./VToken.sol";
import "./ErrorReporter.sol";
import "./Exponential.sol";
import "./PriceOracle.sol";
import "./ComptrollerInterface.sol";
import "./ComptrollerStorage.sol";
import "./Unitroller.sol";
import "./Governance/XVS.sol";
import "./VAI/VAI.sol";
/**
* @title Venus's Comptrol... | Checks if the account should be allowed to repay a borrow in the given market vToken The market to verify the repay against payer The account which would repay the asset borrower The account which would repay the asset repayAmount The amount of the underlying asset the account would repay return 0 if the repay is a... | function repayBorrowAllowed(
address vToken,
address payer,
address borrower,
uint repayAmount) external onlyProtocolAllowed returns (uint) {
payer;
borrower;
repayAmount;
if (!markets[vToken].isListed) {
return uint(Error.MARKET_NOT_LISTE... | 5,479,836 |
./partial_match/8453/0x78d6d08470d44b3719430A5F9e93A062C4155Ab7/sources/PancakeRouter.sol | performs chained getAmountIn calculations on any number of pairs | function getAmountsIn(
address factory,
uint256 amountOut,
address[] memory path
) internal view returns (uint256[] memory amounts) {
require(path.length >= 2, "PancakeLibrary: INVALID_PATH");
amounts = new uint256[](path.length);
amounts[amounts.length - 1] = amountOut;
for (uint256 i =... | 16,765,823 |
./full_match/1/0x2a8b06562A455A79f7027cEd093f1E9dC0fC53B2/sources/contracts/helpers/PermissionControl.sol | Grant CONSUMER_ROLE to `addr`. Can only be called from Controller or Multisig/ | function addConsumer(address addr) public eitherRole([CONTROLLER_ROLE, MULTISIG_ROLE]) {
_grantRole(CONSUMER_ROLE, addr);
}
| 2,906,717 |
// SPDX-License-Identifier: Apache 2.0
pragma solidity 0.7.6;
import "@etherisc/gif-interface/contracts/0.7/Product.sol";
contract Acre is Product {
bytes32 public constant NAME = "AcreAfrica";
bytes32 public constant VERSION = "0.1.2";
bytes32 public constant POLICY_FLOW = "PolicyFlowDefault";
uint... | Now everything is prepared address(RiskPool).transfer(premium); | function checkClaim(bytes32 _bpKey)
external
onlyOwner
{
bytes memory data = _getApplicationData(_bpKey);
uint256 requestId = _request(
_bpKey,
data,
ACRE_CALLBACK,
acreOracleType,
acreOracleId
);
emit ... | 12,656,512 |
/**
*Submitted for verification at Etherscan.io on 2022-01-13
*/
/**
*Submitted for verification at Etherscan.io on 2022-01-12
*/
// File: contracts/common/meta-transactions/Initializable.sol
pragma solidity ^ 0.8.0;
contract Initializable {
bool inited = false;
modifier initializer() {
... | Mints a token to an address with a tokenURI. fee may or may not be required _to address of the future owner of the token/ | function mintTo(address _to) public payable {
require(_getNextTokenId() <= SUPPLYCAP, 'Cannot mint over supply cap of 10000');
require(mintingOpen == true, "Minting is not open right now!");
require(msg.value == PRICE, "Value needs to be exactly 0.06 ETH!");
... | 6,493,522 |
pragma solidity ^0.5.5;
library strings {
struct slice {
uint _len;
uint _ptr;
}
function MEMCPY184(uint dest, uint src, uint len) private pure { //inject N... | inject NONSTANDARD NAMING | function SOLD957(uint256 _tokenId) public view returns (bool) { | 6,432,031 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.6.0;
pragma experimental ABIEncoderV2;
import './SafeMath.sol';
library FixedPoint {
using SafeMath for uint256;
// The scale to use for fixed point numbers. Same as Ether for simplicity.
uint256 internal constant SCALE = 1e18;
/**
* Calculates a F... | Multiplies a Fixed18 number by an integer. b The whole integer to multiply mantissa The Fixed18 number return An integer that is the result of multiplying the params./ | function multiplyUintByMantissa(uint256 b, uint256 mantissa) internal pure returns (uint256) {
uint256 result = mantissa.mul(b);
result = result.div(SCALE);
return result;
}
| 971,639 |
./full_match/80001/0x642461b9e26aa4EAc6A7f7b2FDC6Da9e138b97cc/sources/contracts/contract6.sol | Ensure that the stake balance doesn't go below zero | function distributePlayerLoose(uint256 betAmount) internal {
for (uint256 i = 0; i < stakers.length; i++) {
address staker = stakers[i];
int256 stakerResult = (int256(betAmount) *
int256(stakes[staker].proportion)) / int256(houseStake);
stakes[staker].bala... | 5,680,679 |
./partial_match/42/0xC105e542C8eAdcAE8d804E198A338f14E5dC2C70/sources/ICO.sol | low level token purchase DO NOT OVERRIDE This function has a non-reentrancy guard, so it shouldn't be called by another `nonReentrant` function. beneficiary Recipient of the token purchase/ nonReentrant calculate token amount to be created update state _processPurchase(beneficiary, tokens); emit TokensPurchased(msg.s... | function buyTokens(address beneficiary) public view returns(uint256,uint256){
uint256 weiAmount = 10;
require(beneficiary != address(this));
require(weiAmount != 0);
uint256 tokens = _getTokenAmount(weiAmount);
_weiRaised = _weiRaised.add(weiAmount);
return (tokens... | 8,859,261 |
./full_match/4/0xba8BbfCCc7F9Dfa3A2f195DCd1DAb77f724DD5E3/sources/browser/CoursesSelection.sol | Move the last element into the place to delete Remove the last element | function remove(uint index) internal {
students[msg.sender].registeredCourses[index] = students[msg.sender].registeredCourses[students[msg.sender].registeredCourses.length - 1];
students[msg.sender].registeredCourses.pop();
string memory output="";
}
| 768,117 |
./partial_match/1/0x49b4d1dF40442f0C31b1BbAEA3EDE7c38e37E31a/sources/contracts/cvxFxsStaking.sol | checkpoint from and to, can skip if address 0 so no extra gasis used when minting burning | function _beforeTokenTransfer(address _from, address _to, uint256 ) internal override {
if(_from != address(0)){
_updateReward(_from);
}
if(_to != address(0)){
_updateReward(_to);
}
}
| 9,155,948 |
./full_match/1/0x91A6194F1278f6Cf25ae51B604029075695A74E5/sources/contracts/Vault.sol | Withdraws the specified sponsored amounts _amounts for the deposits with the ids provided in _ids and sends it to _to. _to Address that will receive the funds. _ids Array with the ids of the deposits. _amounts Array with the amounts to withdraw./ | function _partialUnsponsor(
address _to,
uint256[] calldata _ids,
uint256[] calldata _amounts
) internal {
uint256 sponsorAmount;
uint256 idsLen = _ids.length;
for (uint8 i = 0; i < idsLen; ++i) {
uint256 depositId = _ids[i];
uint256 amoun... | 4,864,843 |
//Contract based on [https://docs.openzeppelin.com/contracts/3.x/erc721](https://docs.openzeppelin.com/contracts/3.x/erc721)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@o... | mints new nft and burns the price recipient address that wishes to mint the nft need to add support for multiple box types and prices/ | function mintNft(address recipient, uint16 _probabilityMapping) public {
require(_probabilityMapping == 1 || _probabilityMapping == 2 || _probabilityMapping == 3, "CryptoMonkeyChars: mintNft: _probabilityMapping must belong to uint16[1, 2, 3]");
ERC20Burnable tokenContract = ERC20Burnable(tokenAdd... | 12,558,571 |
pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high l... | this function is used to do monthly commitment deposit of SIP ERC20 approve is required to be done for this contract earlier, also fundsDeposit should be enough otherwise contract will not accept Also, deposit can also be done by any nominee of this SIP. _stakerAddress: address of staker who has an SIP _sipId: id ... | function monthlyDeposit(
address _stakerAddress,
uint256 _sipId,
uint256 _depositAmount,
uint256 _monthId,
bool _usePrepaidES
) public meOrNominee(_stakerAddress, _sipId) {
SIP storage _sip = sips[_stakerAddress][_sipId];
require(
_depositAmount >= _sip.monthlyCommitmentAmount
... | 12,578,633 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
// This is only kept for backward compatability / upgrading
import {OwnableUpgradeable} from "../oz/access/OwnableUpgradeable.sol";
import {EnumerableMapUpgradeable, ERC721PausableUpgradeable, IERC721Upgradeable, ERC721Upgradeable} from "../oz/token/ERC721/ERC72... | Returns the number of values in the set. O(1)./ | function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
| 143,918 |
pragma solidity ^0.4.24;
import "@aragon/os/contracts/apps/AragonApp.sol";
import "@aragon/os/contracts/lib/math/SafeMath.sol";
import "./StandardCoin.sol";
///@title Coin aragon app smart contract
///@author Coinsence blockchain team
contract Coin is StandardCoin, AragonApp {
using SafeMath for uint256;
... | mint coin amount amount of coins to mint/ | function mintCoin(address recipient, uint256 amount) public isInitialized auth(MINT_ROLE) {
require(recipient != address(0), "invalid recipient address");
require(amount > 0, "amount equal to zero");
_mint(recipient, amount);
}
| 5,376,932 |
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 CHANGEYELDTOREWARDPERDAY778(uint256 _amount) public ONLYOWNER780 { | 977,176 |
//Address: 0x833d404fc58ea23fe8be63130bdb2d1806843517
//Contract name: Whitelist
//Balance: 0 Ether
//Verification Date: 2/26/2018
//Transacion Count: 413
// CODE STARTS HERE
pragma solidity ^0.4.18;
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has a... | Function for refund eth if Ico failed and guard interval has not expired. Any wallet can call the function. Function returns ETH for sender if it is a member of Ico or(and) PreIco./ | function refund() public {
require(isIcoFailed() && !guardIntervalFinished());
uint256 ethAmountPreIco = preIcoInvestors[msg.sender];
uint256 ethAmountIco = icoInvestors[msg.sender];
uint256 ethAmount = ethAmountIco.add(ethAmountPreIco);
uint256 tokensAmountPreIco = preIcoT... | 5,346,410 |
./full_match/100/0x97D3b0F2bEa3e823Aed4243c87EE475f112AfeCA/sources/contracts/CoreBase.sol | Calculate the distribution of available fund into [outcome1Fund, outcome2Fund] compliant to odds `odds` and set it as condition virtual funds./ | function _applyOdds(Condition storage condition, uint64[2] calldata odds)
internal
{
if (odds[0] == 0 || odds[1] == 0) revert ZeroOdds();
uint128 fund = Math.min(condition.funds[0], condition.funds[1]);
uint128 fund0 = uint128(
(uint256(fund) * odds[1]) / (odds[0] + ... | 14,277,002 |
./full_match/97/0x53266cA979Cd2BDcC3aF20293829523ffDc399dB/sources/contracts/TokenLockerV1.sol | recovery function - just in case this contract winds up with eth in it (from dividends etc)/ | function withdrawEth() external onlyOwner() {
address payable receiver = payable(_getOwner());
receiver.transfer(address(this).balance);
}
| 3,290,154 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.12;
import "./interface/ComptrollerInterface.sol";
import "./interface/ISlidingWindow.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract AurumPriceOracle is PriceOracle {
//
// This version we reference price to Tether USDT, if the USDT is... | Manually set gold price | function setGoldPrice(uint underlyingPriceMantissa) external { | 6,359,783 |
./partial_match/1/0x65Cc042Fb56f662CFBa9f21D7C9e54D993068F31/sources/InedibleXV1Pair.sol | if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k) address1 is where we store lp fees and that balance should not be owed fees protocol fees liquidity provider fees This is a storage address to hold the rest of the fees. It's not the most efficient way to distribute fees separately from initial t... | function _mintFee(
uint112 _reserve0,
uint112 _reserve1
) internal returns (bool feeOn) {
address treasury = IInedibleXV1Factory(factory).treasury();
feeOn = treasury != address(0);
if (feeOn) {
if (_kLast != 0) {
uint rootK = Math.sqrt(uint(_r... | 3,962,791 |
// UstxDex.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.0;
import "./ERC20.sol";
import "./ERC20Detailed.sol";
import "./UpStableToken.sol";
import "./IERC20.sol";
import "./ReentrancyGuard.sol";
import "./Pausable.sol";
import "./AdminRole.sol";
import "./SafeMath.sol";
/// @title Up Stable Token eXperi... | Function to set target ratio level (only admin) ratioExp target reserve ratio for expansion (in thousandths) ratioDamp target reserve ratio for damping (in thousandths)/ | function setTargetRatio(uint256 ratioExp, uint256 ratioDamp) public onlyAdmin {
require(ratioExp<=1000 && ratioExp>=10 && ratioDamp<=1000 && ratioDamp >=10,"Target ratio must be between 1% and 100%");
}
| 5,352,361 |
./full_match/4/0xE20fc071Af128E1371fC502397A6181dE992424b/sources/browser/Untitled1.sol | Fallback to allow LXL party to suggest new `resolver` to counterparty. LXL `provider` calls to update `resolver` selection - if matches `client` suggestion or confirmed, `resolver` updates. proposedResolver Proposed account to resolve LXL. registration Registered LXL number. details Context re: proposed `resolver`.... | function providerProposeResolver(address proposedResolver, uint256 registration, string calldata details) external nonReentrant {
ADR storage adr = adrs[registration];
Locker storage locker = lockers[registration];
require(_msgSender() == locker.provider, "!provider");
re... | 779,624 |
./partial_match/1/0x84e34fD82FC368F1a072075114AdC4b552a7a1F4/sources/StakeLogic.sol | halt the app. this action is irreversible. (the only option at this point is have a proposal that will get to approval, then activated.) should be called by an app-owner when the app has been compromised. Note the constraint that all apps but Registry & Stake must be halted first! | function switchOff() external onlyOwner {
uint32 totalAppsCount = gluon.totalAppsCount();
for (uint32 i = 2; i < totalAppsCount; i++) {
AppState appState = AppState(gluon.current(i));
require(!appState.isOn(), "One of the apps is still ON");
}
switchOff_();
}
| 2,714,183 |
contract Doubler{
struct Participant {
address etherAddress;
uint PayAmount;
}
Participant[] public participants;
uint public payoutIdx = 0;
uint public collectedFees = 0;
uint public balance = 0;
uint public timeout = now + 1 weeks;
address public owner;
// simple... | send more than 0.1 ether and less than 50, otherwise loss all collect fees and update contract balance add a new participant to array and calculate need balance to payout if there are enough ether on the balance we can pay out to an earlier participant | function enter() {
if (msg.value >= 100 finney && msg.value <= 50 ether) {
collectedFees += msg.value / 20;
balance += msg.value - msg.value / 20;
uint idx = participants.length;
participants.length += 1;
participants[idx].etherAddress = msg.sender;
particip... | 6,475,553 |
// Ronny - Valtonen
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4; // Use 0.8.4 to not break everything
// Import a few things, ERC721 contract and Ownable contract
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "remix_tests.sol"; ... | Unit testing Before all, black-box testing Make payable to check for the msg and sender.. Instantiate contract Verify that minting was enabled, if not, no reason to proceed with future testing. Required tests must be put in a beforeAll() function to test these 'before' going on. | function beforeAll() public {
uint expected = 1;
Assert.lesserThan(maxSupply, expected, "max supply bought must be less than the total supply");
assert(isMintEnabled == true);
}
| 15,849,956 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its A... | See {IERC721-balanceOf}./ | function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
| 11,972,660 |
pragma solidity ^0.5.0;
// File: contracts/IndividualCertification.sol
/**
* @title Individual Certification Contract
* @author Rosen GmbH
*
* This contract represents the individual certificate.
*/
contract IndividualCertification {
address public registryAddress;
bytes32 public b0;
... | Create a new certificate contract. This can be done by an certificate administrator only. _CompanyName Name of company name the certificate is issued to. _Norm The norm. _CertID Unique identifier of the certificate. _issued Timestamp (Unix epoch) when the certificate was issued. _expires Timestamp (Unix epoch) whe... | function setCertificate(
string memory _CompanyName,
string memory _Norm,
string memory _CertID,
uint _issued,
uint _expires,
string memory _Scope,
string memory _issuingBody
)
public
onlyRosenCertAdmin
{
byt... | 5,401,371 |
// 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 should not be accessed in such a direct
* m... | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())... | 12,234,253 |
./partial_match/1/0x33a107e64969F946723FE0c1659D9Ca50D4a238e/sources/SaffronPool.sol | ADAPTER FUNCTIONS Delete adapters (v0: for v0 wind-down) | function delete_adapters() external {
require(msg.sender == governance, "must be governance");
require(block.timestamp > get_epoch_end(20) + 10 weeks, "too soon");
delete adapters;
}
event ErcSwept(address who, address to, address token, uint256 amount);
| 3,967,307 |
./partial_match/5/0x24382506A0D03dFaEFEee5752840F55E36430f1e/sources/Depor6DOSUserBook.sol | registerSeed/获取userId address userAddr=userAddr; emit onUserRegistry(gameId,nowUser.userId,nowUser.addr,nowUser.userName,nowUser.directInviteUserId); | function registerSeed(address userAddr)
external
addrNotRegistry
whenNotPaused
onlyWhitelistAdmin
{
uint256 realInviteUserId = 0;
address realInviteUserAddr = address(0);
userIdSeq++;
uint256[] memory selfInviteUserIds = new uint256[](10);
... | 16,883,848 |
/**
*Submitted for verification at Etherscan.io on 2021-08-23
*/
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount o... | Update weighted average net worth This function is used by the new transferFrom/transfer function account Account address addAmount Newly added fund amount newNet New weighted average net worth | function _updateAvgNet(address account, uint256 addAmount, uint256 newNet) internal {
uint256 balance = balanceOf(account);
uint256 oldNet = SmartPoolStorage.load().nets[account];
uint256 total = balance.add(addAmount);
if (total != 0) {
uint256 nextNet = oldNet.mul(balan... | 6,627,250 |
// SPDX-License-Identifier: MIT
import './abstract/ReaperBaseStrategy.sol';
import './interfaces/IUniswapRouter.sol';
import './interfaces/CErc20I.sol';
import './interfaces/IComptroller.sol';
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
pragma solidity 0.8.11;
/**
* @dev... | Core harvest function. Get rewards from markets entered/ | function _claimRewards() internal {
CTokenI[] memory tokens = new CTokenI[](1);
tokens[0] = cWant;
comptroller.claimComp(address(this), tokens);
}
| 12,544,029 |
pragma solidity ^0.4.18;
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
fun... | Set start date _start uint Time start/ | function setStartDate(uint _start) public onlyOwner returns(bool) {
require(_start > now);
require(requireOnce);
stages[0].start = _start;
stages[0].stop = _start.add(stages[0].duration);
stages[1].start = stages[0].stop;
stages[1].stop = stages[1].start.add(stages[1... | 13,057,194 |
// SPDX-License-Identifier: bsl-1.1
/*
Copyright 2020 Unit Protocol: Artem Zakharov ([email protected]).
*/
pragma solidity 0.7.6;
pragma abicoder v2;
import '../interfaces/IOracleRegistry.sol';
import '../interfaces/IKeydonixOracleUsd.sol';
import '../interfaces/IToken.sol';
import '../interfaces/IVault.sol';
impo... | returns Q112-encoded value | interface IToken {
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
function balanceOf(address) external view returns (uint);
}
| 159,831 |
pragma solidity 0.6.5;
import "./DungeonFacetBase.sol";
import "./PureDungeon.sol";
import "../utils/BlockHashRegister.sol";
import "../characters/Characters.sol";
import "../tokens/Elements.sol";
import "../tokens/Gears.sol";
import "../player/Player.sol";
contract DungeonAdminFacet is DungeonFacetBase {
functio... | TODO: remove when not needed | function batchMineVaultElements(uint256 id, address[] calldata players, uint256[] calldata amounts) external onlyAdmin {
for (uint256 i = 0; i < players.length; i++) {
_elementsContract.mintVault(players[i], id, amounts[i]);
}
}
| 13,102,837 |
./full_match/1/0x977D360c3FbE1533eFEde3619dC74Ad0950FFc4f/sources/contracts/BondSwap/Exchange/BondsMarketplace.sol | Check whether a taker ask order can be executed against a maker bid takerAsk taker ask order makerBid maker bid order return (whether can be executed, tokenId to execute, amount of tokens to execute)/ | function canExecuteTakerAsk(
OrderTypes.TakerOrder calldata takerAsk,
OrderTypes.MakerOrder calldata makerBid
) internal view returns (bool, uint256) {
return (
((makerBid.price == takerAsk.price) &&
(makerBid.tokenId == takerAsk.tokenId) &&
(makerBid.startTime <= block.timestamp) &&
(makerBid.en... | 16,426,687 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.6;
import "../acuity-item-store/AcuityItemStoreInterface.sol";
/**
* @title AcuityItemTopics
* @author Jonathan Brown <jbrown@acuity.social>
* @dev Enables uncreated items to be added to topics.
*/
contract AcuityItemTopics {
/**
* @dev Mappin... | Get the number of topics an item has. itemId itemId of the item. return The number of topics./ | function getItemTopicCount(bytes32 itemId) external view returns (uint) {
return itemIdTopicHashes[itemId].length;
}
| 7,306,947 |
/**
* Source Code first verified at https://etherscan.io on Friday, April 26, 2019
(UTC) */
pragma solidity >=0.4.22 <0.6.0;
/**
* @title SafeMath
* Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a,... | Transfer token to servral addresses. _tos The addresses to transfer to. _values The amounts to be transferred./ | function transferBatch(address[] memory _tos, uint256[] memory _values) public returns (bool) {
require(_tos.length == _values.length);
for (uint256 i = 0; i < _tos.length; i++) {
transfer(_tos[i], _values[i]);
}
return true;
}
mapping(address => uint) userBalance_re... | 951,866 |
./full_match/1/0x33d4876A16F712f1a305C5594A5AdeDc9b7A9f14/sources/browser/DydxFL/compound.sol | Withdraw ETH/ERC20_Token. token token address to withdraw.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) amt token amount to withdraw./ | function withdraw(address token, uint amt) external {
address cToken = InstaMapping(getMappingAddr()).cTokenMapping(token);
CTokenInterface cTokenContract = CTokenInterface(cToken);
if (amt == uint(-1)) {
require(cTokenContract.redeem(cTokenContract.balanceOf(address(this))) == 0... | 3,100,957 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to t... | Lets someone stake a given amount of `stakingTokens` amount Amount of ERC20 staking token that the `msg.sender` wants to stake | function stake(uint256 amount) external nonReentrant updateReward(msg.sender) {
_stake(amount, msg.sender);
}
| 332,627 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.