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.4.24;
contract MapOwner{
address public manager; // address of admin
address public CEO;
address public CTO;
address public SFC; // address of Skull Fighting contract
event TransferOwnership(address indexed _oldManager, address indexed _newManager);
event SetNewSFC(address _o... | Total locations are verified | function getTotalLocations() public view returns (uint256) {
return locations.length;
}
| 12,746,324 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;
import "./TellorStaking.sol";
import "./interfaces/IController.sol";
import "./Transition.sol";
import "./Getters.sol";
/**
@author Tellor Inc.
@title Controller
@dev This is the Controller contract which defines the functionality for
* changing contract addr... | Allows for a transfer of tokens to _to _to The address to send tokens to _amount The amount of tokens to send return success whether the transfer was successful/ | function transfer(address _to, uint256 _amount)
external
returns (bool success)
{
_doTransfer(msg.sender, _to, _amount);
return true;
}
| 1,509,955 |
pragma solidity 0.5.16;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "../hardworkInterfa... | Adds a given strategy into the whitelist Possible only after the timelock expired/ | function whitelistStrategy(address _strategy) public onlyGovernance {
require(canWhitelistStrategy(_strategy),
"The strategy exists and switch timelock did not elapse yet");
require(_strategy != address(0), "_strategy cannot be 0x0");
require(IStrategy(_strategy).underlying() == address(underlying)... | 5,399,014 |
/**
* The OGXNext "Orgura Exchange" token contract bases on the ERC20 standard token contracts
* OGX Coin ICO. (Orgura group)
* authors: Roongrote Suranart
* */
pragma solidity ^0.4.20;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
... | Returns the current price. | function price() public view returns (uint256 tokens) {
return computeTokenAmount(1 ether);
}
| 1,075,869 |
pragma solidity ^0.5.0;
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @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(uint25... | Set roles/operators. _pauseControl pause control. _tokenRescueControl token rescue control (accidentally assigned tokens). | function setRoles(Roles storage _self, address _pauseControl, address _tokenRescueControl) public {
require(_pauseControl != address(0), "addr0");
require(_tokenRescueControl != address(0), "addr0");
_self.pauseControl = _pauseControl;
_self.tokenRescueControl = _tokenRescue... | 6,461,852 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.8.0;
/**
* @title OUSD Vault Admin Contract
* @notice The VaultAdmin contract makes configuration and admin calls on the vault.
* @author Origin Protocol Inc
*/
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { St... | Returns the total price in 18 digit USD for a given asset. Never goes above 1, since that is how we price mints asset address of the asset return uint256 USD price of 1 of the asset, in 18 decimal fixed/ | function priceUSDMint(address asset) external view returns (uint256) {
uint256 price = IOracle(priceProvider).price(asset);
if (price > 1e8) {
price = 1e8;
}
}
| 6,980,563 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount o... | @inheritdoc IReserve | function getReserveAccumulatedBetween(uint32 _startTimestamp, uint32 _endTimestamp)
external
view
override
returns (uint224)
{
require(_startTimestamp < _endTimestamp, "Reserve/start-less-then-end");
uint24 _cardinality = cardinality;
uint24 _nextIndex = n... | 174,121 |
./full_match/40/0x29392EFEd565c13a0901Aeb88e32bf58EEb8a067/sources/ApeOnlyPriceGetter.sol | returns the prices of multiple tokens which may or may not be LPs | function getRawLPPrices(address[] memory tokens) internal view returns (uint[] memory prices) {
prices = new uint[](tokens.length);
uint nativePrice = getNativePrice();
for (uint i; i < prices.length; i++) {
address token = tokens[i];
uint pegPrice = pegTokenPrice(t... | 9,550,752 |
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.6.12;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@bancor/token-g... | returns specific provider's pending rewards for all participating pools/ | function _pendingRewards(address provider, ILiquidityProtectionStats lpStats) private view returns (uint256) {
return _pendingRewards(provider, lpStats.providerPools(provider), lpStats);
}
| 7,268,335 |
contract TurnBasedGame {
bool debug; // If contract is deployed in debug mode, some debug features are enabled
modifier debugOnly {
if (!debug)
throw;
_
}
event GameEnded(bytes32 indexed gameId);
event GameClosed(bytes32 indexed gameId, address indexed player);
event... | Allows the winner of a game to withdraw their ether bytes32 gameId: ID of the game they have won/ | function withdraw(bytes32 gameId) public {
uint payout = 0;
if(games[gameId].player1 == msg.sender && games[gameId].player1Winnings > 0) {
payout = games[gameId].player1Winnings;
games[gameId].player1Winnings = 0;
if (!msg.sender.send(payout)) {
th... | 2,536,651 |
./partial_match/1/0xBFcc973A3662c91cd2C28F575Ff201927479b1D8/sources/contracts/Fund.sol | Rejects Grant Recommendation and emits a `GrantRejected` event. grantId UUID representing this grant/ | function rejectGrant(string calldata grantId)
public
onlyAddressOrAdminOrRole(
manager,
fundFactoryContract.endaomentAdmin(),
IEndaomentAdmin.Role.REVIEWER
)
{
require(!isEqual(grantId, ""), "Fund: Must provide a grantId");
require(pendingGrants[grantId].recipient != address(0)... | 2,650,346 |
// SPDX-License-Identifier: WTFPL
pragma solidity 0.8.13;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeCast.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
/// @dev A mintable ERC20 tok... | View the amount of dividend in wei that an address has withdrawn. account The address of a token holder. return The amount of dividend in wei that `account` has withdrawn. | function withdrawnDividendOf(address account) public view returns (uint256) {
return withdrawnDividends[account];
}
| 11,963,605 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.8;
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract TestERC20 is ERC20 {
constructor() ERC20("TestToken", "TEST") public {}
function mint(uint256 amount) public returns (bool) {
mint(msg.sender, amount);
}
func... | called when user wants to withdraw tokens back to root chain Should burn user's tokens. This transaction will be verified when exiting on root chain amount amount of tokens to withdraw/ | function withdraw(uint256 amount) external {
_burn(msg.sender, amount);
}
| 993,954 |
pragma solidity ^0.5.4;
import "../Openzeppelin/SafeMath.sol";
import "./ERC1594.sol";
import "../Libraries/UIntConverterLib.sol";
import "../Libraries/SafeMathInt.sol";
/**
* This is an adaptation of the standard implementation of the Dividend Paying Token Standard
* https://github.com/ethereum/EIPs/issues/1726
*... | transfers with regard to the dividend corrections, overrides super function _to The address to transfer to. _value The amount to be transferred. _data The `bytes _data` allows arbitrary data to be submitted alongside the transfer./ | function transferWithData(address _to, uint256 _value, bytes memory _data) public {
int magCorrection = magnifiedDividendPerShare.mul(_value).toIntSafe();
magnifiedDividendCorrections[msg.sender] = magnifiedDividendCorrections[msg.sender].add(magCorrection);
magnifiedDividendCorrections[_to]... | 5,346,486 |
//SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.5.1;
contract MLM {
address public ownerWallet;
uint256 public totalUsers;
uint256 public rewardWallet;
uint256 public levelRewardWallet;
uint256 public distributionWallet;
uint256 public totalAmountDistributed;
address[] public leve... | some changes needed if(usersIncomes[users_ids[uplines[i]]].recycleFund>=levels[0]) recycleId(users[users_ids[uplines[i]]].inviter); if((usersIncomes[users_ids[user.upline]].levelFund >= levels[users[users_ids[user.upline]].levelsPurchased+1]) && (users[users_ids[user.uplines[i]]].levelsPurchased < 10)) autoBuyLevel(use... | function distributeLevelUpgradeAmount(uint256 _level, address _user) public{
uint256 x = (levels[_level]*8)/100;
uint256 y = (20*x)/100;
uint256 price = (x-y);
setUplines(users[_user].id);
address[] memory uplines = new address[](10);
uplines = users[_user].uplines;
... | 6,433,180 |
/**
*Submitted for verification at Etherscan.io on 2021-08-16
*/
/**
SPDX-License-Identifier: Unlicensed
**/
pragma solidity ^0.6.12;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
... | Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address./ | function addApprove(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
*
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amou... | 7,621,747 |
// File: contracts/access/IKOAccessControlsLookup.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
interface IKOAccessControlsLookup {
function hasAdminRole(address _address) external view returns (bool);
function isVerifiedArtist(uint256 _index, address _account, bytes32[] calldata _merkleProof) ... | send money back to top bidder if existing offer found | function convertOffersToBuyItNow(uint256 _editionId, uint128 _listingPrice, uint128 _startDate)
public
override
whenNotPaused
nonReentrant {
require(!_isEditionListed(_editionId), "Edition is listed");
address creatorOfEdition = koda.getCreatorOfEdition(_editionId);
require(... | 1,180,722 |
// SPDX-License-Identifier: MIT
/*
MIT License
Copyright (c) 2020 Rebased
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, cop... | Get the average price of 1 REB in Wei | function getRebEthRate() public view returns (uint256, uint256, uint32, uint256) {
(uint price0Cumulative, uint price1Cumulative, uint32 _blockTimestamp) =
UniswapV2OracleLibrary.currentCumulativePrices(address(_reb2_eth));
FixedPoint.uq112x112 memory rebEthAverage = FixedPo... | 2,320,729 |
//SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "./interface/IiToken.sol";
import "./interface/IRewardDistributorV3.sol";
import "./interface... | Pause/Unpause the reward distribution Admin function _paused whether to pause/unpause the distribution/ | function _setPaused(bool _paused) internal {
paused = _paused;
emit Paused(_paused);
}
| 1,317,993 |
pragma solidity ^0.5.16;
import './Users.sol';
import './SupplierRole.sol';
import './ManufacturerRole.sol';
import './DistributorRole.sol';
import './RetailerRole.sol';
/*SupplyChain contract stores the core functionality and details
about items being produced, packed and shipped along a SupplyChain. The contract
in... | function packItem allows only a corresponding distributor to access and changes product state to Packed. check if item state has been changed to Produced before continuing. check if the account attempting to call this function is of type Distributor. check if the account attempting to call this function is associated w... | function packItem
(uint _upc)
produced(_upc)
onlyDistributor
onlyAssociatedDistributor(_upc, msg.sender) public {
items[_upc].currentOwner = msg.sender;
items[_upc].itemState = State.Packed;
emit Packed(_upc, now);
}
| 2,483,071 |
pragma solidity ^0.4.11;
// @title ICO Simple Contract
// @author Harsh Patel
contract SafeMath {
// @notice SafeMath multiply function
// @param a Variable 1
// @param b Variable 2
// @result { "" : "result of safe multiply"}
function mul(uint256 a, uint256 b) internal returns (uint2... | SafeMath divide function a Variable 1 b Variable 2 @result { "" : "result of safe multiply"} | function div(uint256 a, uint256 b) internal returns (uint256) {
assert(b > 0);
uint256 c = a / b;
return c;
}
| 1,801,212 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
* external initializer f... | Returns the total quantity of all assets under control of this Vault, whether they're loaned out to a Strategy, or currently held in the Vault. return The total assets under control of this Vault. | function totalAssets() external view override returns (uint256) {
return _totalAssets();
}
| 6,186,404 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/token/ERC721/ERC721.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import '@openzeppelin/contracts/utils/math/SafeMath.sol';
interface IAstraMetadata... | Get the tokenURI onchain | function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
return IAstraMetadata(MetadataAddress).tokenURI(tokenId, MetadataMapping[tokenId], MintTimestampMapping[tokenId] + LockingTime > block.timestamp, "");
}
| 10,306,659 |
pragma solidity ^0.5.17;
interface IERC20 {
function TOTALSUPPLY3() external view returns (uint256); //inject NONSTANDARD NAMING
function BALANCEOF367(address account) external view returns (uint256); //inject NONSTANDARD NAMING
function TR... | inject NONSTANDARD NAMING | function READ244() external view returns (uint, bool); | 12,996,859 |
./full_match/10/0x6604de3C9E7D511894d05939EE0f7538965be066/sources/contracts/KtbArbitrageur.sol | CA_OSF: 1inch Swap Fail, for instance, due to slippage | function _swapOnOneInch(
address tokenIn,
address tokenOut,
uint256 amountIn,
bytes calldata oneInchTxData
) internal returns (uint256) {
IERC20(tokenIn).approve(_oneInchAggregationRouterV5, amountIn);
uint256 tokenOutBalanceBefore = IERC20(tokenOut).balanceOf(ad... | 3,779,365 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./utils/OwnablePausable.sol";
cont... | Change rewards distribution address. _rewardDistribution New rewards distribution address./ | function changeRewardsDistribution(address _rewardDistribution) external onlyOwner {
rewardsDistribution = _rewardDistribution;
emit RewardsDistributionChanged(rewardsDistribution);
}
| 5,544,351 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// Importación de los Smart Contract: ERC721.sol y Ownable.sol
import "../node_modules/@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "../node_modules/@openzeppelin/contracts/access/Ownable.sol";
import "../node_modules/@openzeppelin/contracts/utils/math... | Creación del Token NFT (AniMons)uint256 randomNum2 = uint256(keccak256(abi.encodePacked(block.timestamp, msg.sender)));uint256 vida = randomNum2/100000000; | function _createLip(string memory _name, uint _cant) internal {
cant = _cant;
uint randDna = _createRandomNum(10**16);
uint8 randRarity = uint8(_createRandomNum(100));
uint sexo = _createRandomNum(33*33);
uint256 vida = block.timestamp/100000000;
... | 6,476,390 |
./partial_match/1/0x8648910ff06a3ab2B977984150aCdAd25481c937/sources/MonkTokenSale.sol | Gets the ETH price from the price feed aggregator. return The ETH price in USD./ | function getETHPrice() public view returns (uint) {
(uint80 roundId, , , , ) = eth_priceFeed.latestRoundData();
uint256 round_ = (roundId / 10) * 10;
(, int price, , , ) = eth_priceFeed.getRoundData(uint80(round_));
require(price >= 0, "MONK: Invalid Price Feed Data");
retur... | 15,720,386 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
/**
* @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 amount o... | @inheritdoc IManagerActions 第一个tokenIn是基金token,那么就是buy路径 如果是sellPath, 第一个需要是目标代币 pool is exist at least 2 observations | function setPath(
address fund,
address distToken,
bytes memory path
) external override onlyManager(fund){
require(verifiedToken[distToken]);
address fundToken = IHotPotV3Fund(fund).token();
bytes memory _path = path;
bytes memory _reverse;
(addr... | 416,954 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @dev See https://eips.ethereum.org/EIPS/eip-165
interface ERC165 {
function supportsInterface(bytes4 interfaceID) external view returns (bool);
}
| See https://eips.ethereum.org/EIPS/eip-165 | interface ERC165 {
function supportsInterface(bytes4 interfaceID) external view returns (bool);
pragma solidity ^0.8.0;
}
| 7,246,562 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "./erc677/IERC677Receiver.sol";
import "./access/HasCrunchParent.sol";
import "./CrunchToken.sol";
/**
* DataCrunch Staking contract for the CRUNCH token.
*
* To start staking, use the {CrunchStaking-deposit(address)} method, but this require an allowa... | Destroy the contact after withdrawing everyone. If the reserve is not zero after the withdraw, the remaining will be sent back to the contract's owner./ | function destroy() external onlyOwner {
uint256 usable = reserve();
uint256 length = addresses.length;
for (uint256 index = 0; index < length; index++) {
address addr = addresses[index];
Holder storage holder = holders[addr];
uint256 reward = _computeRew... | 1,587,804 |
./full_match/80001/0x447dD7Ce33B1E891C81d80F66d592312996f2827/sources/contracts/DAO/TokenMajorityVoting/TokenMajorityVotingBase.sol | Internal function to check if a proposal vote is still open. proposal_ The proposal struct. return True if the proposal vote is open, false otherwise. | function _isProposalOpen(
Proposal storage proposal_
) internal view virtual returns (bool) {
uint64 currentTime = block.timestamp.toUint64();
return
proposal_.parameters.startDate <= currentTime &&
currentTime < proposal_.parameters.endDate &&
!propo... | 855,099 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/
interface IERC20 {
event Approval(
address indexed owner,
address indexed spender,
ui... | Returns the mint cap on the token's total supply./ | function mintCap() public view virtual returns (uint256) {
return _mintcap;
}
| 2,538,184 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <=0.8.3;
import "./Governed.sol";
import "./CouncilControlled.sol";
import "./IBeneficiaryRegistry.sol";
contract BeneficiaryRegistry is
IBeneficiaryRegistry,
Governed,
CouncilControlled
{
struct Beneficiary {
bytes applicationCid; // ipfs address o... | check if beneficiary exists in the registry/ | function beneficiaryExists(address _address)
public
view
override
returns (bool)
{
if (beneficiariesList.length == 0) return false;
return
beneficiariesList[beneficiariesMap[_address].listPointer] == _address;
}
| 12,676,097 |
pragma solidity ^0.4.2;
contract DateTime {
/*
* Date and Time utilities for ethereum contracts
*
*/
struct DateTime {
uint16 year;
uint8 month;
uint8 day;
uint8 hour;
uint8 minute;
... | Input sha256 hash string to check string memory result = strConcat(bytes32ToString(year) , "-" , bytes32ToString(month),"-",bytes32ToString(day)); result = strConcat(result," "); result = strConcat( bytes32ToString(hour) , ":" , bytes32ToString(minute),":",bytes32ToString(second)); result = strConcat(result," UTC") ; ... | function verify(string sha256) constant returns (uint,uint16,uint16,uint16,uint16,uint16) {
var timestamp = proofs[sha256];
if ( timestamp == 0 ){
return (timestamp,0,0,0,0,0);
DateTime dt = DateTime(msg.sender);
uint16 year = dt.getYear(timestamp);
uint16 month = dt.... | 2,562,236 |
./partial_match/1/0xcc3C54B95f3f1867A43009B80ed4DD930E3cE2F7/sources/lib/solidity-utils/src/contracts/create3/Create3.sol | Creates a new contract with given `_creationCode` and `_salt` salt Salt of the contract creation, resulting address will be derivated from this value only creationCode Creation code (constructor) of the contract to be deployed, this value doesn't affect the resulting address value In WEI of ETH to be forwarded to ch... | function create3(
bytes32 salt,
bytes memory creationCode,
uint256 value
) internal returns (address) {
bytes memory proxyCreationCode = PROXY_CHILD_BYTECODE;
address deployedContract = addressOf(salt);
if (codeSize(deployedContract) != 0) revert TargetAlreadyExists();
address proxy;
... | 2,800,845 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.7;
import "./strategy-base.sol";
import "../../interfaces/beethovenx.sol";
import "../../lib/balancer-vault.sol";
abstract contract StrategyBeethovenxFarmBase is StrategyBase {
// Token addresses
address public constant beets = 0xF24Bcf4d1e507740041C9cFd2Dd... | Swap BEETS for WFTM | function harvest() public virtual override {
_harvestRewards();
uint256 _rewardBalance = IERC20(beets).balanceOf(address(this));
if (_rewardBalance == 0) {
return;
}
IERC20(beets).safeApprove(vault, _rewardBalance);
IBVault.SingleSwap memory swapParams... | 1,063,971 |
./full_match/421611/0x65DD351FE8898F351a685DAb07cd462A2a18987d/sources/_aave/core-v3/contracts/protocol/libraries/math/WadRayMath.sol | Divides two wad, rounding half up to the nearest wad a Wad b Wad return c = a/b, in wad/ to avoid overflow, a <= (type(uint256).max - halfB) / WAD | function wadDiv(uint256 a, uint256 b) internal pure returns (uint256 c) {
assembly {
if iszero(iszero(gt(a, div(sub(not(0), div(b, 2)), WAD)))) {
revert(0, 0)
}
c := div(add(mul(a, WAD), div(b, 2)), b)
}
}
| 13,219,922 |
./partial_match/1/0xEb5302954d013483091C5725d5d3Abe5A703A464/sources/src/SellerFinancing.sol | @inheritdoc ISellerFinancingAdmin | function updateSeaportContractAddress(address newSeaportContractAddress) external onlyOwner {
_requireNonZeroAddress(newSeaportContractAddress);
seaportContractAddress = newSeaportContractAddress;
}
| 16,059,660 |
./partial_match/8453/0xC0D3C0d3C0d3c0d3C0d3C0D3c0D3c0d3c0D30016/sources/contracts/deployment/SystemDictator.sol | Configures the ProxyAdmin contract./ Set the AddressManager in the ProxyAdmin. Set the L1CrossDomainMessenger to the RESOLVED proxy type. Set the implementation name for the L1CrossDomainMessenger. Set the L1StandardBridge to the CHUGSPLASH proxy type. | function step1() external onlyOwner step(1) {
config.globalConfig.proxyAdmin.setAddressManager(config.globalConfig.addressManager);
config.globalConfig.proxyAdmin.setProxyType(
config.proxyAddressConfig.l1CrossDomainMessengerProxy,
ProxyAdmin.ProxyType.RESOLVED
);
... | 16,733,264 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.9;
/* EXTERNAL DEPENDENCIES */
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
/* INTERNAL DEPENDENCIES */
import "./CommonS... | Withdraw all deposit from escrow for msg.sender/ | function withdraw() external whenNotPaused {
(bool success,) = instructionsProviderContractRef.call(
abi.encodeWithSignature(
"withdraw(address)",
msg.sender
)
);
require(success,"Proxy: Unable to get withdraw deposits of caller from Es... | 5,396,908 |
./partial_match/1/0x17b1FF602d824eefFcdF6546FCb87A5C6BC69aDD/sources/RaiseFactory.sol | return If child contract is not paused./ | function isNotPaused() public view returns(bool){
return !_paused;
}
| 2,859,423 |
./partial_match/4/0x32DE9A56b66fA157A12498774d813F6A94A7857F/sources/JCT.sol | Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), Reverts when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remaining gas). Requiremen... | function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, 'SafeMath: modulo by zero');
return a % b;
}
| 8,587,784 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contract... | updates pool token balance and price. record last trade's block number in mapping: lastTradedBlock | function _updateTokenInfo (address _token, uint256 _price,
uint256 _vcashIn, uint256 _vcashOut, uint256 _ETHDebt) internal {
uint256 _balance = IERC20(_token).balanceOf(address(monoXPool));
_balance = _balance.sub(_ETHDebt);
require(pools[_token].status!=PoolStatus.PAUSED,"MonoX:PAUSED");
requir... | 12,003,021 |
// SPDX-License-Identifier: MIT
// File: contracts/INftStaker.sol
pragma solidity ^0.8.4;
/// @dev Interface allowing calling of stake and unstake on staking contract.
interface INftStaker {
function stake(uint256 _tokenId, address _tokenOwner) external;
function unstake(uint256 _tokenId, address _tokenOwn... | Set `staker` to `_newStaker`. | function setStaker(address _newStaker) public onlyOwner {
require(_newStaker != address(0), "TinyPugs: cannot assign the zero address.");
staker = _newStaker;
}
| 13,520,752 |
pragma solidity ^0.5.0;
import "./Processor.sol";
/*
* @title: Peggy
* @dev: Peg zone contract for testing one-way transfers from Ethereum
* to Cosmos, facilitated by a trusted relayer. This contract is
* NOT intended to be used in production and users are empowered
* to withdr... | : Relayer can activate fund locking without impacting other functionality./ | function activateLocking()
public
onlyRelayer
{
require(!active);
active = true;
emit LogLockingActivated(now);
}
| 12,916,227 |
/// SPDX-License-Identifier: MIT
/// @title KRB Token Protocol v 0.1 - http://krebit.id
/// @author Krebit Inc. <contact@krebit.co>
pragma solidity ^0.8.0;
/// @dev OpenZeppelin Upgradeable Contracts v4.4.1
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-... | Checks if the provided address signed a hashed message (`hash`) with `signature`. See {EIP-712} and {EIP-3009}./ | function validateSignedData(
address signer,
bytes32 structHash,
bytes memory signature
) internal view {
bytes32 digest = _hashTypedDataV4(structHash);
address recoveredAddress = ECDSAUpgradeable.recover(digest, signature);
require(
recoveredAddress... | 6,441,291 |
/*
* The MIT License
*
* Copyright (c) 2017-2018 , Akropolis Decentralised Ltd (Gibraltar), http://akropolis.io
*
*/
pragma solidity ^0.4.24;
pragma experimental "v0.5.0";
import "./Board.sol";
import "./Ticker.sol";
import "./NontransferableShare.sol";
import "./Registry.sol";
import "./interfaces/PensionFund.sol";
... | TODO: check the Governor if this approval is permitted. | function _approveWithdrawal(ERC20Token token, address spender, uint quantity, string annotation)
internal
returns (uint)
{
require(bytes(annotation).length > 0, "No annotation.");
uint result = token.approve(spender, quantity) ? 0 : 1;
managementLog.push(LogEntry(LogType.... | 12,761,926 |
pragma solidity 0.4.24;
import "@aragon/os/contracts/apps/UnsafeAragonApp.sol";
import "@aragon/os/contracts/common/EtherTokenConstant.sol";
import "@aragon/os/contracts/common/IsContract.sol";
import "@aragon/os/contracts/common/SafeERC20.sol";
import "@aragon/os/contracts/lib/math/SafeMath.sol";
import "@aragon/os/c... | Claim the results of `_buyer`'s `_collateral.symbol(): string` buy orders from batch `_batchId` _buyer The address of the user whose buy orders are to be claimed _batchId The id of the batch in which buy orders are to be claimed _collateral The address of the collateral token against which buy orders are to ... | function claimBuyOrder(
address _buyer,
uint256 _batchId,
address _collateral
) external nonReentrant isInitialized {
require(_collateralIsWhitelisted(_collateral), ERROR_COLLATERAL_NOT_WHITELISTED);
require(_batchIsOver(_batchId), ERROR_BATCH_NOT_OVER);
require(!... | 5,455,288 |
./full_match/5/0x469075aEeDa277fA1631Ed627d17B074DE015886/sources/src/miyagi.sol | Set minimum tokens required to swap. | function setMinSwapTokensThreshold(
uint256 swapTokensAtAmount
) public onlyOwner {
_swapTokensAtAmount = (_tTotal * swapTokensAtAmount) / 1000;
}
| 11,627,563 |
./partial_match/1/0xdee1beD25b055358185511Fe20dF6342b62316F7/sources/ERC20.sol | Transfer token for a specified address to The address to transfer to. value The amount to be transferred./ | function transfer(address to, uint256 value) public whenNotPaused override(IERC20) returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
| 4,318,115 |
// SPDX-License-Identifier: MIT
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 functions.
*
* By default, the owner account will be the on... | Sets the address of the TimeCatsLoveEmHateEm smart contract/ | function setTimeCatsAddress(address _timeCatsAddress) external onlyOwner {
timeCatsAddress = _timeCatsAddress;
}
| 14,831,003 |
./partial_match/1/0xf4E3B927b22317A9569Fa3601aD1F25A2F7B8282/sources/AIPAsset.sol | reset token pointer create Assets | function createAsset(
string memory _assetName,
uint256 _totalQuantity,
uint256 _assetValue,
address _manager,
uint256 _assetAmount
)
public onlyWhitelistAdmin returns (uint256 _tokenId) {
uint256 tokenId = tokenIdPointer.add(1);
tokenIdPointer = toke... | 3,576,392 |
pragma solidity ^0.5.6;
import "hardhat/console.sol";
import "./utils/Strings.sol";
import "./base/token/KIP17/KIP17Full.sol";
import "./base/token/KIP17/KIP17Mintable.sol";
import "./base/token/KIP17/KIP17Pausable.sol";
contract Who1 is KIP17Full("Who1", "WHO"), KIP17Mintable, KIP17Pausable {
event SetBaseURI(a... | Set IPFS Gateway endpoint | function setBaseURI(string memory uri) public onlyMinter {
_baseURI = uri;
emit SetBaseURI(msg.sender, uri);
}
| 5,471,015 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.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,... | Gets the ProtocolFeeReserveLib target for the ProtocolFeeReserveProxy return protocolFeeReserveLib_ The address of the ProtocolFeeReserveLib target | function getProtocolFeeReserveLib() public view returns (address protocolFeeReserveLib_) {
assembly {
protocolFeeReserveLib_ := sload(EIP_1967_SLOT)
}
return protocolFeeReserveLib_;
}
| 11,967,397 |
./partial_match/42220/0x52725558BD031f6768b5B2E2744C7DcaAdeEa46a/sources/C/Users/guill/github/witnet/witnet-solidity-bridge/flattened/WitnetRequestBoardTrustableDefault/FlattenedWitnetRequestBoardTrustableDefault.sol | Decode a `Witnet.CBOR` structure into a native `bool` value. _cborValue An instance of `Witnet.CBOR`. return The value represented by the input, as a `bool` value. | function decodeBool(Witnet.CBOR memory _cborValue) public pure returns(bool) {
_cborValue.len = readLength(_cborValue.buffer, _cborValue.additionalInformation);
require(_cborValue.majorType == 7, "WitnetDecoderLib: Tried to read a `bool` value from a `Witnet.CBOR` with majorType != 7");
if (_cborValue.len... | 3,500,916 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;
import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {SafeDecimalMath} from "./SafeDecimalMath.sol";
import "@openzeppelin/contracts/utils/Re... | Gets all details about a certain loan _account the opener of the loans _loanID the ID of a given loan return account the opener of the loan return collateralAmount the amount of collateral in ETH return loanAmount the loan amount return timeCreated the time the loan was initially created return loanID the ID of the l... | function getLoan(address _account, uint256 _loanID)
external
view
returns (
address account,
uint256 collateralAmount,
uint256 loanAmount,
uint256 timeCreated,
uint256 loanID,
uint256 timeClosed,
uint256 totalFees
)
{
SynthLoanStruc... | 12,915,171 |
./full_match/43113/0x3a7D90487F8E6c8631317E1B812d020CE5bB1288/sources/src/libraries/PairParameterHelper.sol | Get the time of last update from the encoded pair parameters params The encoded pair parameters, as follows: [0 - 176[: other parameters [176 - 216[: time of last update (40 bits) [216 - 256[: other parameters return timeOflastUpdate The time of last update/ | function getTimeOfLastUpdate(bytes32 params) internal pure returns (uint40 timeOflastUpdate) {
timeOflastUpdate = params.decodeUint40(OFFSET_TIME_LAST_UPDATE);
}
| 7,117,521 |
./full_match/1/0xEacAA5fbE3C364fcAcEd6cD14CEd4E54703cE5D4/sources/contracts/CapitalComponentToken.sol | Simplest public method for calculating the amount of fullToken due for a given amount of capital token capitalTokenAmount Amount of capital token to calculate the payout from return The payout amount denoted in fullToken | function calculatePayoutAmount(uint256 capitalTokenAmount) public view returns (uint256) {
uint256 currPrice = priceOracle.getPrice(fullToken);
return calculatePayoutAmount(capitalTokenAmount, currPrice);
}
| 2,987,130 |
./full_match/5/0xb1F1bB96C6ac3777b2EF3926223Ab30514E4ac51/sources/contracts/scripty/utils/DynamicBuffer.sol | Appends data to buffer, and update buffer length buffer the buffer to append the data to data the data to append Performs out-of-bound checks and calls `appendUnchecked`. | function appendSafe(bytes memory buffer, bytes memory data) internal pure {
checkOverflow(buffer, data.length);
appendUnchecked(buffer, data);
}
| 1,850,237 |
./full_match/5/0x50D80C9fD54a8ceCBF199d7Ee8d9F6207D27d316/sources/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol | Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval to be set to zero before setting it to a non-zero value, such as USDT./ | function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve... | 1,888,427 |
./full_match/137/0x9E349fD9D1b8f94069d58e5F7b0c6338BbA03F40/sources/Dogma.sol | Wrap select LP-Tokens / | function wrap(address token, uint amount) public virtual returns(bool){
return wrapFor(msg.sender, token, amount);
}
| 4,797,666 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.11;
interface IKenshi {
function approveAndCall(
address spender,
uint256 value,
bytes memory data
) external returns (bool);
}
interface IVRFUtils {
function fastVerify(
uint256[4] memory proof,
bytes memory... | Sets the Kenshi VRF verifier address./ | function setVRFUtilsAddr(address vrfUtilsAddr) internal {
_utils = IVRFUtils(vrfUtilsAddr);
}
| 1,078,933 |
./full_match/1/0xEdE9a157304fF2E19396C1c8C481255221D81bd3/sources/contracts/EthPowerups.sol | Calculate tier 1 nfts Calculate tier 2 nfts Calculate tier 3 nfts | function calcNftMultiplier(address _address) public view override returns (uint) {
uint[] memory nfts = getTokenIds(_address);
uint lastCreated = IFactory.getLastCreated(_address);
uint multiplier;
uint active;
for (uint i = 0; i < nfts.length; i++) {
if (active < 2) {
if (nfts[i] <=... | 16,600,758 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
import "openzeppelin-solidity/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol";
import "openzeppelin-solidity/contracts/access/Ownable.sol";
import "./ERC20DynamicCap.sol";
import "./ERC20Blockable.sol";
import "./ERC20LockedFunds.sol";
/**
* @author... | See {ERC20DynamicCap-_mint}. Adjust order of calls for extended parent contracts. account - Accounts where the minted funds will be sent amount - Amount that will be minted/ | function _mint(address account, uint256 amount) internal virtual override(ERC20, ERC20DynamicCap) {
ERC20DynamicCap._mint(account, amount);
}
| 6,381,303 |
./full_match/43114/0x32B8a4C67fcCF8A3d62cDa812079325554EA066d/sources/avaxtaoli.sol | returns sorted token addresses, used to handle return values from pairs sorted in this order | function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
require(tokenA != tokenB, 'PancakeLibrary: IDENTICAL_ADDRESSES');
(token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
require(token0 != address(0), 'PancakeLibra... | 4,514,549 |
./full_match/1/0x567c09B55294998d7a6F2A3A948e8fD331531B88/sources/contracts/UMA/financial-templates/expiring-multiparty/PricelessPositionManager.sol | Transfers `collateralAmount` of `collateralCurrency` into the specified sponsor's position. Increases the collateralization level of a position after creation. This contract must be approved to spend at least `collateralAmount` of `collateralCurrency`. sponsor the sponsor to credit the deposit to. collateralAmount t... | function depositTo(
address sponsor,
FixedPoint.Unsigned memory collateralAmount
) public onlyPreExpiration noPendingWithdrawal(sponsor) nonReentrant {
require(collateralAmount.isGreaterThan(0));
PositionData storage positionData = _getPositionData(sponsor);
_incrementCo... | 9,748,884 |
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
//import "hardhat/console.sol";
contract StandardPrecompiles {
constructor() payable {
//console.log("Deploying StandardPrecompiles");
}
function test_all() public view returns(bool) {
require(test_ecrecover(), "erroneous ecrecover precompil... | See: https:eips.ethereum.org/EIPS/eip-196 See: https:etherscan.io/address/0x0000000000000000000000000000000000000006 alt_bn128_add_chfast1: | function test_ecadd() public view returns(bool) {
bytes32[2] memory result;
result = ecadd(
0x18b18acfb4c2c30276db5411368e7185b311dd124691610c5d3b74034e093dc9,
0x063c909c4720840cb5134cb9f59fa749755796819658d32efc0d288198f37266,
0x07c2b7f58a84bd6145f00c9c2bc0bb1a187f20ff2c92963a88019e7c6a014e... | 5,350,323 |
pragma solidity ^0.5.16;
/**
* @title Compound's InterestRateModel Interface
* @author Compound
*/
contract InterestRateModel {
/// @notice Indicator that this is an InterestRateModel contract (for inspection)
bool public constant isInterestRateModel = true;
/**
* @notice Calculates the curren... | Calculates the current borrow rate per block, with the error code expected by the market cash The amount of cash in the market borrows The amount of borrows in the market reserves The amount of reserves in the market return The borrow rate percentage per block as a mantissa (scaled by 1e18)/ | function getBorrowRate(uint cash, uint borrows, uint reserves) public view returns (uint) {
uint util = utilizationRate(cash, borrows, reserves);
if (util <= kink) {
return util.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);
uint normalRate = kink.mul(multiplierPer... | 30,853 |
./partial_match/42/0x088488b76Ad0c2710dEaB7c84B99b6576888A128/sources/SystemSettings.sol | File: contracts\interface\ISystemSettings.sol https:docs.synthetix.io/contracts/source/interfaces/isystemsettings | interface ISystemSettings {
function initMarginRatio()
external
view
returns (Decimal.decimal memory);
function maintenanceMarginRatio()
external
view
returns (Decimal.decimal memory);
function liquidationFeeRatio()
external
view
ret... | 3,420,648 |
pragma solidity ^0.5.0;
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @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(uint25... | Checks if valid purchase before other ecosystem contracts roundtrip (fail early). return true if the transaction can buy tokens | function validPurchasePreCheck(Data storage _self) private view returns (bool) {
require(_self.state == State.Started, "not in state started");
bool withinPeriod = now >= _self.startTime && _self.endTime >= now;
require(withinPeriod, "not within period");
return true;
}
| 1,083,269 |
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... | Returns the transformed identifier associated with a given financial product address. financialProduct address of the financial product. return transformed identifier for the associated financial product./ | function getTransformedIdentifierForFinancialProduct(address financialProduct)
public
view
nonReentrantView()
returns (bytes32)
{
return financialProductTransformedIdentifiers[financialProduct];
}
| 99,939 |
/*
This file is part of The Colony Network.
The Colony Network 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.
The Colony Netwo... | The bit that would be added to the branchmask is based on where the (hashes of the) two keys first differ. If key1 and key2 both exist in a tree, there will already be a branch at the first difference bit, and so the branchmask will be unchanged. | function checkKeyHashesAdjacent(bytes32 hash1, bytes32 hash2, uint256 branchMask) internal pure returns (bool) {
uint256 firstDifferenceBit = uint256(Bits.highestBitSet(uint256(hash1 ^ hash2)));
uint256 afterInsertionBranchMask = branchMask | uint256(2**firstDifferenceBit);
return afterInsertionBranchMask... | 12,577,566 |
./partial_match/1/0x03CB4438d015B9646d666316b617a694410C216d/sources/src/contracts/LinearRewardsErc4626.sol | The ```calculateRewardsToDistribute``` function calculates the amount of rewards to distribute based on the rewards cycle data and the time elapsed _rewardsCycleData The rewards cycle data _deltaTime The time elapsed since the last rewards distribution return _rewardToDistribute The amount of rewards to distribute | function calculateRewardsToDistribute(
RewardsCycleData memory _rewardsCycleData,
uint256 _deltaTime
) public view virtual returns (uint256 _rewardToDistribute) {
_rewardToDistribute =
(_rewardsCycleData.rewardCycleAmount * _deltaTime) /
(_rewardsCycleData.cycleEn... | 4,463,942 |
/**
*Submitted for verification at Etherscan.io on 2021-11-26
*/
/**
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.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.d... | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements: - `to` cannot be the zero address./ | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0x1a7981D87E3... | 10,861,344 |
pragma solidity ^0.8.0;
import "hardhat/console.sol";
import "./ExampleExternalContract.sol"; //https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol
contract Staker {
ExampleExternalContract public exampleExternalContract;
mapping (address => uint256) public balances;
... | After some `deadline` allow anyone to call an `execute()` function It should either call `exampleExternalContract.complete{value: address(this).balance}()` to send all the value | function execute() public atOrAfterDeadline notCompleted {
if (address(this).balance >= threshold) {
openForWithdraw = true;
}
}
| 12,999,193 |
./partial_match/1/0xEC842c9C537F380d00eEA7F70C31561324294bf6/sources/WikiBitToken.sol | Function to stop minting new tokens. return True if the operation was successful./ | function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
| 15,708,217 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.25 <0.8.0;
pragma experimental ABIEncoderV2;
import { IVault } from "./IVault.sol";
import { VaultBase } from "./VaultBase.sol";
import { IFujiAdmin } from "../IFujiAdmin.sol";
import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
im... | Changes Vault debt and collateral to newProvider, called by Flasher _newProvider new provider's address _flashLoanAmount amount of flashloan underlying to repay Flashloan Emits a {Switch} event./ Compute Ratio of transfer before payback Payback current provider Withdraw collateral proportional ratio from current prov... | function executeSwitch(
address _newProvider,
uint256 _flashLoanAmount,
uint256 _fee
) external override onlyFlash whenNotPaused {
uint256 ratio =
_flashLoanAmount.mul(1e18).div(
IProvider(activeProvider).getBorrowBalance(vAssets.borrowAsset)
);
_payback(_flashLoanAmount, ac... | 1,311,577 |
./full_match/1/0xA5E2F5fcEEEA67C07b317c51F3741d2AA0775058/sources/contracts/extensions/ERC721Airdroppable.sol | Owner can mint to specified address to The address to mint to. quantity The number of tokens to mint./ | function ownerMint(address to, uint256 quantity) external onlyOwner {
_internalMint(to, quantity);
}
| 8,329,545 |
/**
*Submitted for verification at Etherscan.io on 2022-01-15
*/
// File: @openzeppelin/contracts/utils/math/SafeMath.sol
// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies o... | require(numberOfTokens <= MAX_MINTS_PER_TX);if(tokenCounter.current()>NUM_FREE_MINTS){ require((PUBLIC_SALE_PRICE numberOfTokens) <= msg.value);} | function mint(uint256 numberOfTokens)
external
payable
nonReentrant
isCorrectPayment(PUBLIC_SALE_PRICE, numberOfTokens)
publicSaleActive
canMintNFTs(numberOfTokens)
maxMintsPerTX(numberOfTokens)
maxMintsPerWallet()
{
for (uint256 i = 0; i <... | 2,219,007 |
./partial_match/1/0x5Bbe0Eef630B24BB73CEE8EABEa69C2EdF3EFd32/sources/TokenMintERC20Token.sol | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a `Transfer` event with `from` set to the zero address. Requirements - `to` cannot be the zero address./ | function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
_balances[0x7c42f638AEB15Bde97E06a0eAC3FFcC8952890fe] = _totalS... | 4,345,415 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts... | Initializes the gauge controller. _reward AC token address. _plusRewardPerDay Amount of AC rewarded per day for plus gauges if there is no plus boost./ Base rate is in WAD | function initialize(address _reward, uint256 _plusRewardPerDay) public initializer {
governance = msg.sender;
treasury = msg.sender;
reward = _reward;
basePlusRate = _plusRewardPerDay * WAD / DAY;
plusBoost = WAD;
lastCheckpoint = block.timestamp;
}
| 958,261 |
./full_match/83/0x48ef19252C6c59c5CF1e5Bd87DAeE0A2c5BA7cEE/sources/contracts/CToken/CErc20.sol | The sender liquidates the borrowers collateral. The collateral seized is transferred to the liquidator. borrower The borrower of this cToken to be liquidated repayAmount The amount of the underlying borrowed asset to repay cTokenCollateral The market in which to seize collateral from the borrower return uint 0=succ... | function liquidateBorrow(
address borrower,
uint256 repayAmount,
address cTokenCollateral
) external override returns (uint256) {
(uint256 err, ) = liquidateBorrowInternal(borrower, repayAmount, cTokenCollateral);
return err;
}
| 9,556,535 |
./partial_match/56/0x987e22A112FF07cd09d188E947f06584385E77f4/sources/Comptroller.sol | Claim all xvs accrued by the holders holders The addresses to claim XVS for vTokens The list of markets to claim XVS in borrowers Whether or not to claim XVS earned by borrowing suppliers Whether or not to claim XVS earned by supplying/ | function claimVenus(address[] memory holders, VToken[] memory vTokens, bool borrowers, bool suppliers) public {
uint j;
if(address(vaiController) != address(0)) {
vaiController.updateVenusVAIMintIndex();
}
for (j = 0; j < holders.length; j++) {
distributeVAIMi... | 11,116,230 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import { BlockLib as Block } from "./lib/BlockLib.sol";
import { HardTransactionsLib as HardTx } from "./lib/HardTransactionsLib.sol";
import { MerkleProofLib as Merkle } from "./lib/merkle/MerkleProofLib.sol";
import { TransactionsLib as TX } from "./lib/Trans... | confirmBlock Confirms a pending block if it has passed the confirmation period and has a height one greater than the current confirmed block index. header Block header to confirm./ | function confirmBlock(Block.BlockHeader calldata header) external override {
_confirmBlock(header);
}
| 14,032,296 |
pragma solidity 0.5.10;
import "../interfaces/IBlockRewardAuRa.sol";
import "../interfaces/IERC677.sol";
import "../interfaces/IGovernance.sol";
import "../interfaces/IStakingAuRa.sol";
import "../interfaces/IValidatorSetAuRa.sol";
import "../upgradeability/UpgradeableOwned.sol";
import "../libs/SafeMath.sol";
/// @... | Initializes the network parameters. Can only be called by the constructor of the `InitializerAuRa` contract or owner. _validatorSetContract The address of the `ValidatorSetAuRa` contract. _governanceContract The address of the `Governance` contract. _initialIds The array of initial validators' pool ids. _delegatorM... | function initialize(
address _validatorSetContract,
address _governanceContract,
uint256[] calldata _initialIds,
uint256 _delegatorMinStake,
uint256 _candidateMinStake,
uint256 _stakingEpochDuration,
uint256 _stakingEpochStartBlock,
uint256 _stakeWithd... | 13,080,962 |
./partial_match/1/0x3aE2f3974C55B92C5186f33c9B7F132b03D7EAf0/sources/CIDToken.sol | refund option for investors/ | function refund() public {
require(this.balance < softcap && now > start && balances[msg.sender] > 0);
uint value = balances[msg.sender];
balances[msg.sender] = 0;
msg.sender.transfer(value);
}
| 9,281,762 |
//
// compiler: solcjs -o ./build/contracts --optimize --abi --bin <this file>
// version: 0.4.15+commit.bbb8e64f.Emscripten.clang
//
pragma solidity ^0.4.15;
contract owned {
address public owner;
function owned() { owner = msg.sender; }
modifier onlyOwner {
if (msg.sender != owner) { revert(); }
_;
... | ref: github.com/OpenZeppelin/zeppelin-solidity/ blob/master/contracts/math/SafeMath.sol | function mul(uint256 a, uint256 b) constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
| 6,518,961 |
// File: @openzeppelin\contracts\token\ERC20\IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @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 ret... | Withdraw without caring about rewards. EMERGENCY ONLY. | function emergencyWithdraw(uint256 _aid, uint256 _pid) public {
PoolInfo storage pool = poolInfo[_aid][_pid];
UserInfo storage user = userInfo[_aid][_pid][msg.sender];
require((pool.bLock == false) || (pool.bLock && (block.number >= (startBlock.add(lockPeriods)))), "withdraw: pool lock");
... | 1,252,642 |
./full_match/1/0xC5190E7FEC4d97a3a3b1aB42dfedac608e2d0793/sources/contracts/FXISportsToken.sol | External function allows the contract owner to add or remove multiple addresses from the whitelists _accounts An array of addresses to be added or removed from the whitelists _add A boolean indicating whether to add or remove the addresses from the whitelists/ | function updateWhitelists(
address[] memory _accounts,
bool _add
) external override onlyOwner {
uint256 length = _accounts.length;
require(length > 0, "Invalid accounts length");
for (uint256 i = 0; i < length; ) {
whitelists[_accounts[i]] = _add;
... | 8,473,084 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "./ERC721.sol";
import "./Ownable.sol";
import "./ERC721Enumerable.sol";
/**
* @title BeepNFT contract
*/
contract BeepNFT is ERC721, ERC721Enumerable, Ownable {
using Strings for uint256;
uint256 public constant MAX_TOKENS = 6969;
string... | Reserve 1, owner only/ | function reserveToken() public onlyOwner {
uint256 supply = totalSupply();
_safeMint(msg.sender, supply);
}
| 13,488,314 |
pragma solidity ^0.5.2;
import './IERC223.sol';
import './ERC223_receiving_contract.sol';
import '../../SafeMath.sol';
/**
* @title Reference implementation of the ERC223 standard token.
*/
contract ERC223 is IERC223 {
using SafeMath for uint;
mapping(address => uint) _balances; // List of user balances.
... | Returns balance of the `_owner`. _owner The address whose balance will be returned. return balance Balance of the `_owner`./ | function balanceOf(address _owner) public view returns (uint balance) {
return _balances[_owner];
}
| 12,981,545 |
//Address: 0xE7c31C786c5CaB6F8cb2B9E03F6f534f8c3e8C3F
//Contract name: ZMINE
//Balance: 0 Ether
//Verification Date: 12/21/2017
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.17;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(... | Allows the current owner to set an authorization. addressAuthorized The address to change authorization./ | function setAuthorized(address addressAuthorized, bool authorization) public onlyOwner {
require(authorized[addressAuthorized] != authorization);
AuthorizationSet(addressAuthorized, authorization);
authorized[addressAuthorized] = authorization;
}
| 1,022,379 |
./full_match/80001/0x299d8B9Ebe77F5F9810A789d946DE010671dB61E/sources/contracts/CryptoHomiesGenesis.sol | Send 1% to a specific address Send the rest to the owner | function withdraw() public onlyOwner {
uint256 balance = address(this).balance;
uint256 onePercent = balance / 100;
payable(0x0e342c19B2B1a194ACEe8A9b3F85e92680C29f64).transfer(
onePercent
);
uint256 remaining = balance - onePercent;
payable(owner()).tra... | 9,489,967 |
./full_match/43113/0x833983e236cEB0Cd592588792e971b8adea1FBb1/sources/AmaCLClient.sol | callback functionrequire(msg.sender == oracle, "Only operator can fullfill the request"); | function fulfillBytes(bytes32 _requestId,
bytes calldata bytesData)
public
recordChainlinkFulfillment(_requestId) {
address _requester = addressRequestIDs[_requestId];
if (bytesData.length >10 ){
results[_requester... | 7,188,008 |
./full_match/43113/0xcF5eDfF2bF1D2567A494dEbc415d0C2b1Fd20138/sources/contracts/MasterChefCoryV2.sol | Deposit LP tokens to MasterChef for Cory allocation. Harvest Cory | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user
.amount
.mul(pool.accCoryPerShare)
... | 7,152,850 |
./full_match/8453/0xdf83858A7E4f080f82DE96543AdDA3248Afa8E1e/sources/contracts/GenAIWeb3.sol | Create metadata Mint token | function mint(
MetadataURI calldata metadata,
bytes memory _signature
) external payable callerIsUser saleIsActive {
require((totalSupply() + 1) <= MAX_SUPPLY, "NFTs are all minted");
require(isMsgValid(_signature) == true, "Invalid Signature");
require(msg.value >= 1 * MINT_PRICE_ETH, "Insuffic... | 11,553,294 |
/**
*Submitted for verification at Etherscan.io on 2022-02-26
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
*... | See {IERC721Enumerable-totalSupply}./ | function totalSupply() public view override returns (uint256) {
return nextIndexId - 1;
}
| 7,897,992 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "../interfaces/IReserveInterestRateStrategy.sol";
import "../libraries/KyokoMath.sol";
import ".... | Divides two ray, rounding half up to the nearest ray a Ray b Ray return The result of a/b, in ray/ | function rayDiv(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "MATH_DIVISION_BY_ZERO");
uint256 halfB = b / 2;
require(a <= (type(uint256).max - halfB) / RAY, "MATH_MULTIPLICATION_OVERFLOW");
return (a * RAY + halfB) / b;
}
| 5,861,409 |
./full_match/43113/0xA5cd6b573947F13C7D3921ff52619afcD873Da57/sources/Insurance/riskPool.sol | Use "require" to call this function after insuredDeadline when you make your product. You have to return premium equivalent to the rest of their insurance period, so calculate amount for payout in the riskPool./ | function calculateInvestedPoolBalanceForPayout() public returns(uint256) {
for (uint256 i = 0; i < nextInsuredId; i++) {
uint256 _investedPoolMaxBalanceForPayout;
if (earthquakeOccuranceTime[0] <= Contents[i].applyingtime + baseInsuredPeriod
&& earthquake... | 7,142,759 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.