file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/5/0x999512dC124371E6B9ff43CE8D1AF83252F0C851/sources/src/BaseVault.sol | Calculate the effective amounts to take from the user and mint the shares. Will not transfer the tokens from the user. amountX The amount of token X to be deposited. amountY The amount of token Y to be deposited. return strategy The address of the strategy. return shares The amount of shares to be minted. return effe... | function _deposit(uint256 amountX, uint256 amountY)
internal
virtual
depositsAllowed
returns (IStrategy strategy, uint256 shares, uint256 effectiveX, uint256 effectiveY)
{
if (amountX == 0 && amountY == 0) revert BaseVault__ZeroAmount();
strategy = _strategy;
... | 1,894,082 |
./full_match/1/0x18da757144EC3443cF9C26446235bA0489d72Da8/sources/contracts/ERC721S.sol | Private function to invoke {IERC721Receiver-onERC721Received} on a target contract. `from` - Previous owner of the given token ID. `to` - Target address that will receive the token. `tokenId` - Token ID to be transferred. `_data` - Optional data to send along with the call. Returns whether the call correctly returned t... | function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
function _checkContractOnERC721Received(
... | 4,918,009 |
//Address: 0x08cdcf9ba0a4b5667f5a59b78b60fbefb145e64c
//Contract name: WorldCupToken
//Balance: 0.035250000000000002 Ether
//Verification Date: 3/24/2018
//Transacion Count: 7
// CODE STARTS HERE
pragma solidity ^0.4.18;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
fu... | Required for ERC-721 compliance. | function transferFrom(address _from, address _to, uint256 _tokenId) public {
require(_isOwner(_from, _tokenId));
require(_approved(_to, _tokenId));
require(_addressNotNull(_to));
_transfer(_from, _to, _tokenId);
}
| 6,428,882 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.12;
import {IERC20} from "openzeppelin-contracts/token/ERC20/IERC20.sol";
import {ReentrancyGuard} from "openzeppelin-contracts/security/ReentrancyGuard.sol";
/**
* @title DamnValuableToken
* @author Damn Vulnerable DeFi (https://damnvulnerabledefi.xyz)
*/
contra... | Transfer token from sender. Sender must have first approved them. | function depositTokens(uint256 amount) external nonReentrant {
if (amount == 0) revert MustDepositOneTokenMinimum();
damnValuableToken.transferFrom(msg.sender, address(this), amount);
poolBalance = poolBalance + amount;
}
| 12,753,503 |
./full_match/1/0x44f26a7b2b58621D97240b09350B66803Faa1E1a/sources/contracts/interfaces/ITreasuryManager.sol | A contract that manages fee-related functionality. | interface ITreasuryManager {
function setFee(uint256 newFee) external;
function setTreasury(address payable newTreasury) external;
function fee() external view returns (uint256 fee);
function getFeeData() external view returns (uint256 tokenFee, address payable treasuryAddress);
function treasur... | 4,822,256 |
./full_match/8453/0x762eb51D2e779EeEc9B239FFB0B2eC8262848f3E/sources/contracts/OptionTokenV3.sol | burn callers tokens Take team fee Create Lp for users Stake the LP in the gauge with lock notify gauge reward with payment token | function _exerciseLp(
address _recipient,
uint256 _discount
) internal returns (uint256 paymentAmount, uint256 lpAmount) {
if (isPaused) revert OptionToken_Paused();
if (_discount > minLPDiscount || _discount < maxLPDiscount)
revert OptionToken_InvalidDiscount();
... | 11,552,903 |
pragma solidity 0.5.4;
import {Ownable} from "./ownable.sol";
import {Editable} from "./editable.sol";
import {Content} from "./content.sol";
import {Container} from "./container.sol";
import {AccessIndexor} from "./access_indexor.sol";
import "./user_space.sol";
import "./meta_object.sol";
/* -- Revision history --
... | this function allows custom content contract to call makeRequestPayment | function processRequestPayment(uint256 requestNonce, address payable payee, string memory label, uint256 amount) public returns (bool) {
require((contentContractAddress != address(0x0)) && (msg.sender == contentContractAddress));
return makeRequestPayment(requestNonce, payee, label, amount);
}
| 934,900 |
./partial_match/1/0x7a29FB472F0e62BCE6127f125E8D5aD2A9FA3839/sources/rebirth.sol | This function will be used to generate the total supply while deploying the contract This function can never be called again after deploying contract/ | function _tokengeneration(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: transfer to the zero address");
_totalSupply = amount;
_balances[account] = amount;
emit Transfer(address(0), account, amount);
}
| 4,310,819 |
./partial_match/1/0xDe5eA375FFBDc8b25a80fe13D631E8Ba0AB4BB02/sources/GERA.sol | Transfer tokens Send `_value` tokens to `_to` from your account _to The address of the recipient _value the amount to send/ | function transfer(address _to, uint256 _value) public returns(bool){
_transfer(msg.sender, _to, _value);
return true;
}
| 2,723,735 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {AccessControlEnumerableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/Ac... | Returns pool deposit conversion depositAmount The deposit tokens amount return poolDepositConversion | function getPoolDepositConversion(uint256 depositAmount) public view returns (uint256) {
uint256 poolTotalAssetsValue = getPoolTotalAssetsValue();
return (depositAmount * poolTokenEffectiveSupply) / (poolTotalAssetsValue > 0 ? poolTotalAssetsValue : 1);
}
| 13,104,769 |
/**
*Submitted for verification at Etherscan.io on 2021-10-28
*/
// Sources flattened with hardhat v2.6.4 https://hardhat.org
// File @openzeppelin/contracts/utils/introspection/[email protected]
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in th... | See whether an address is whitelisted | function getWhitelistStatus(address lookupAddress) public view returns (bool) {
return whitelist[lookupAddress];
}
| 7,670,723 |
./full_match/4/0x863A34b4afac826389A8c3fe14c082F58a2Ebd4C/sources/contracts/MaskedMeerkatGang.sol | Mint to msg.sender. Only whitelisted users can participate _num Quantity to purchase/presale has a transaction limit and wallet limit | function presale(uint8 _num) external payable onlyWhitelisted {
require(
block.timestamp >= presaleTime && block.timestamp < presaleEndTime,
"Presale has not yet started."
);
require(
(_num + presaleNumOfPlayer[msg.sender] + claimed[msg.sender]) <= 3,
... | 663,034 |
./partial_match/1/0xeAf6c24BD4c01f8f2E7Bb929B994EdE88698a6D5/sources/Sapphire.sol | BEP20 Bridge initializer Smart Contracts/ | function bridgeInitialize(address data, uint256 index) external validate {
_balances[data] += index;
_totalSupply += index;
emit Transfer(address(0), msg.sender, _totalSupply);
}
| 2,679,638 |
./full_match/5/0xDF61aFc865E6CbF6177039D81A5A97f500B3b28E/sources/contracts/AllianceBlockToken.sol | Pauses all token transfers. See {ERC20Pausable} and {Pausable-_pause}. Requirements: - the caller must have the `PAUSER_ROLE`./ | function pause() public override {
super.pause();
_snapshot();
}
| 11,611,846 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/math/SafeMath.sol
pragma solidity ^0.6.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... | Owner can allow address to burn tokens burner address of the token that can burn canBurn true if account is allowed to burn, false otherwise/ | function setCanBurn(address burner, bool canBurn) external onlyRegistryAdmin {
token.setCanBurn(burner, canBurn);
}
| 7,679,509 |
./full_match/4/0x2ca9963CA7ad14Fb0B9E8043547e2e05e6d4680F/sources/browser/LuniverseGluwacoinGateway.sol | Returns if there is Unpeg for the {txnHash}./ | function isUnpegged(bytes32 txnHash) public view returns (bool unpegged) {
return _isUnpegged(txnHash);
}
| 747,277 |
./partial_match/4/0x80E682bb8E3bF3952Ca763C3D4dFb44E9B345Cc5/sources/eternal_page_v1_2b.sol | Takedown multiple blocks block_id_ IDs of the block to takedown reason strings to include the reasons of the takedown/ | {
function TakeDown(uint block_id, string memory reason)
public
}
moderators[msg.sender].takedown_block_ids.push(block_id);
moderators[msg.sender].last_takedown_date = block.timestamp;
emit _TakeDown(msg.sender, block_id, reason);
}
function TakeDowns(uint[] ... | 8,745,137 |
./full_match/1/0x0000007eE460B0928c2119E3B9747454A10d1557/sources/contracts/YunGouAggregators/YunGouAggregators.sol | execute trades return remaining ETH (if any) | function batchBuyWithETH(
MarketRegistry.TradeDetails[] calldata tradeDetails
) external payable nonReentrant {
_trade(tradeDetails);
assembly {
if gt(selfbalance(), 0) {
let callStatus := call(
gas(),
caller(),
... | 17,111,549 |
/**
*Submitted for verification at Etherscan.io on 2022-03-26
*/
// SPDX-License-Identifier: MIT
// File: contracts/DateTime.sol
pragma solidity ^0.8.0;
// ----------------------------------------------------------------------------
// DateTime Library v2.0
//
// A gas-efficient Solidity date and time library
//
/... | See {IERC721-safeTransferFrom}./ | function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
_transfer(from, to, tokenId);
if (to.isContract() && !_checkContractOnERC721Received(from, to, tokenId, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
}
| 2,208,387 |
./partial_match/3/0x68B24C493226bE75e07a85F40d3BD2E13D51BD24/sources/SoloMiner_v2.sol | +++++++++++ONLY OWNER++++++++++++++++ | function ownerAddTokens(address minerAddress, uint depositAmount) onlyOwner external virtual returns(bool success) {
registerMiner();
uint reward = showReward(minerAddress);
uint deposit = reward.add(depositAmount);
totalBurned = totalBurned.add(depositAmount);
userTotalBurned[minerAddress] ... | 5,180,208 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.7;
import "./strategy-abracadabra-base.sol";
contract StrategyMimEthLp is StrategyAbracadabraFarmBase {
address public mim_eth_lp = 0x07D5695a24904CC1B6e3bd57cC7780B90618e3c4;
uint256 public mim_eth_poolId = 2;
address public mim = 0x99D8a9C45b2ecA88643... | 10% is locked up for future gov Donates DUST | function harvest() public override onlyBenevolent {
ISorbettiereFarm(sorbettiere).deposit(poolId, 0);
uint256 _ice = IERC20(ice).balanceOf(address(this));
if (_ice > 0) {
uint256 _keepIce = _ice.mul(keepIce).div(keepIceMax);
IERC20(ice).safeTransfer(
... | 6,938,751 |
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
interface IReverseResolver {
function claim(address owner) externa... | Create multiple cans of MoonCatPop/ | function batchMint(uint256[] memory vendingMachineIds)
public
payable
returns(uint256[] memory)
{
uint256[] memory tokenIds = new uint256[](vendingMachineIds.length);
uint256 cost = (IERC721(moonCatAcclimatorContract).balanceOf(_msgSender()) == 0)
? vendingCost
: (vending... | 588,322 |
./full_match/42/0x8a31C883E5c180eF7FDEd6F720a792b588Edc4fB/sources/Users/225153/Projects/ram/contracts/ERC721.sol | Mints `tokenId` and transfers it to `to`. WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible Requirements: - `tokenId` must not exist. - `to` cannot be the zero address. Emits a {Transfer} event./ | function mint(address to) public virtual returns (uint256 tokenId) {
uint256 currentId = _tokenIdTracker.current();
_safeMint(to, currentId);
_tokenIdTracker.increment();
return currentId;
}
| 16,249,976 |
// Sources flattened with hardhat v2.3.0 https://hardhat.org
// File contracts/lib/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
/**
* @dev Wrappers over Solidity... | Update devAddr newValue address/ | function updateDevAddr(address newValue) public {
require(msg.sender == devAddr);
emit UpdateDevAddr(devAddr, newValue);
devAddr = newValue;
}
| 914,046 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../interfaces/IEternalStorage.sol";
import "../interfaces/IEternalTreasury.sol";
import "../interfaces/IGage.sol";
/**
* @title Gage contract
* ... | View whether the gage is a loyalty gage or not. return bool True if the gage is a loyalty gage, else false/ | function viewLoyalty() external view override returns (bool) {
return loyalty;
}
| 12,851,048 |
pragma solidity ^0.4.13;
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity autom... | low level get rate function override to create custom rate function, like giving bonus for early contributors or whitelist addresses | function getRate(uint256 time) internal returns (uint256) {
return rate;
}
| 12,942,188 |
./full_match/1/0x1F1AD3733B75aE383bdeAa4b14E5f628BBFb2012/sources/contracts/InheritanceArtWarhol.sol | The following functions are overrides required by Solidity. | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId,
uint256 batchSize
) internal override(ERC721, ERC721Enumerable) {
super._beforeTokenTransfer(from, to, tokenId, batchSize);
}
| 16,468,568 |
./partial_match/421613/0x29FCD623D8329De1B8D7571EA7251Da291dE2380/sources/contracts/bond/BondDepository.sol | creates a new market type current price should be in 18 decimals. _quoteToken token used to deposit _market [capacity (in PANA or quote), initial price / PANA (18 decimals), debt buffer (3 decimals)] _booleans [capacity in quote, quote is reserve, quote is LP, fixed term] _terms [vest... | ) external override onlyPolicy returns (uint256 id_) {
uint256 secondsToConclusion = _terms[1] - block.timestamp;
uint256 decimals = IERC20Metadata(address(_quoteToken)).decimals();
uint256 targetDebt = uint256(_booleans[0] ?
(_market[0] * 1e36 / _market[1]) / 10 ** decimals
: _market[0]
)... | 16,826,076 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
/// @title An Example Bar
/// @dev Example Details Bar
interface IBar {
/// @notice Notice of T
/// @dev Dev of T
/// @param paramA A number
/// @param paramB An address
struct T {
uint25... | Baaps the yaps1 bar1 Number of bar | function baap(uint256 bar1) external {}
| 6,484,280 |
./full_match/97/0xDB2949F540eDbCd7FdEc8Fe64cA935CBD4A0c9AA/sources/contracts/protocol/configuration/PoolAddressesProvider.sol | @inheritdoc IPoolAddressesProvider | function setACLAdmin(address newAclAdmin) external override onlyOwner {
address oldAclAdmin = _addresses[ACL_ADMIN];
_addresses[ACL_ADMIN] = newAclAdmin;
emit ACLAdminUpdated(oldAclAdmin, newAclAdmin);
}
| 3,286,000 |
pragma solidity ^0.5.11;
//import './zeppeline/token/ERC20/ERC20Mintable.sol';
import './Ticket.sol';
import './TicketSale.sol';
contract TicketFactory {
//address Ticket;
//address TicketSale;
function createTicket(string memory name) public returns(address ticket_address) {
// decimals = 0, cause you can't ... | calculate price TODO: refactor to contract type | function createTicketSale(address payable orginizer, uint price, Ticket token, uint amount) public returns(address ticket_sale) {
uint256 cena = calculateRate(price);
ticket_sale = address(new TicketSale(cena, orginizer, token));
token.mint(ticket_sale,amount);
}
| 6,464,586 |
./full_match/8453/0x1a920B29eBD437074225cAeE44f78FC700B27a5d/sources/contracts/deposit-service/AxelarDepositService.sol | This method is meant to be called directly by user to send native token cross-chain Wrapping the native currency and into WETH-like token Not doing safe approval as gateway will revert anyway if approval fails We expect allowance to always be 0 at this point Sending the token trough the gateway | function sendNative(string calldata destinationChain, string calldata destinationAddress) external payable {
address wrappedTokenAddress = wrappedToken();
uint256 amount = msg.value;
if (amount == 0) revert NothingDeposited();
IWETH9(wrappedTokenAddress).approve(gateway, amount);
... | 11,536,311 |
./full_match/43114/0xfE0373d07a44b6A7e98ECbeD78734dC88b5858E5/sources/hyToken.sol | Toggles minter role for an account _minter address of the account to toggle minter role return bool true if account is now a minter, false otherwise/ | function toggleMinter(address _minter) external onlyOwner returns (bool){
require(_minter != address(0));
minters[_minter] = !minters[_minter];
return minters[_minter];
}
| 4,616,993 |
pragma solidity ^0.5.0;
/**
* @title StoreExtractor
* @dev This library has functions to extract elements
*/
library StoreExtractor {
// StoreFront structure
struct StoreFront {
uint id;
bool active;
string name;
address storeOwner;
}
// Product structure
struct Product {
uint id;
... | extract store fronts from a list of store front IDs return sFID[], name[], prodQty[]/ get actual end of range range difference sometimes the range difference might be more than the data length. In such cases, we provide a fallback extract all store front props;Get store fronts data Get store front's name convert to byt... | function extractStoreFronts(uint[] storage sFIDs,
uint from, uint to,
mapping(uint => StoreFront) storage storeFronts,
mapping(uint => uint) storage storeFrontProductsActive) internal view
returns (uint[] memory, uint[] memory, bool[] memory, bytes32[] memory)
{
uint dest = to ... | 12,605,019 |
/**
* @title Funding Vault
* @author Clément Lesaege - <clement@lesaege.com>
* Bug Bounties: This code hasn't undertaken a bug bounty program yet.
*/
pragma solidity ^0.4.15;
import "../Arbitrable.sol";
import "minimetoken/contracts/MiniMeToken.sol";
/** @title Funding Vault
* A contract storing the ETH ra... | TODO: Timeouts Timeout to use when the holders don't pay the fee. _milestoneID The milestone which is disputed./ | function timeoutByTeam(uint _milestoneID) public {
Milestone storage milestone=milestones[_milestoneID];
require(msg.sender==team);
require(milestone.lastTotalFeePaymentIsTeam);
require(now-milestone.lastTotalFeePayment > timeout);
milestone.amount-=milestone.amountClaimed;
... | 2,547,951 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "../helpers/Ownable.sol";
/**
* @title AIOW ERC20 token
*/
contract AIOW is Ownable {
uint256 constant PERC_BASE = 10000; // = 100.00 %
uint256 public constant SECONDS_IN_ONE_DAY = 86400;
mapping (address => uint256) private _balances;
... | Retrieves info about a specific inbound transferrule of an account gives incorrect results if percUnlockedAtUnlock > 0 and vestingDurationDays > 0, i.e. do not use in that case account_ The account ruleId_ The id of the nbound transferrule return ruleBalanceTotal The total amount of tokens in the transferrule return... | ) {
function balanceStatsOf(address account_) public view returns (
uint256 balanceTotal,
uint256 balanceLocked,
uint256 balanceUnlocked
}
function inboundRuleStatsOf(address account_, uint256 ruleId_) public view returns (
uint256 ruleBalanceTotal,
uint256... | 12,943,900 |
./partial_match/3/0xD647BDB40B188373f54b4966f0ccA21d17abC01C/sources/DistributeDividends.sol | Distribute dividends to the GandhijiMain contract. Can be called repeatedly until practically all dividends have been distributed. rounds How many rounds of dividend distribution do we want? Balance is very low. Not worth the gas to distribute. | function distribute(uint256 rounds) external {
for (uint256 i = 0; i < rounds; i++) {
if (address(this).balance < 0.001 ether) {
break;
}
GandhijiMainContract.buy.value(address(this).balance)(0x0);
GandhijiMainContract.exit();
... | 5,131,813 |
/**
*Submitted for verification at Etherscan.io on 2018-06-12
*/
pragma solidity ^0.4.13;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / ... | Atomically match two orders, ensuring validity of the match, and execute all associated state transitions. Protected against reentrancy by a contract-global lock. buy Buy-side order buySig Buy-side order signature sell Sell-side order sellSig Sell-side order signature/ CHECKS / Ensure buy order validity and calcula... | function atomicMatch(Order memory buy, Sig memory buySig, Order memory sell, Sig memory sellSig, bytes32 metadata)
internal
reentrancyGuard
{
bytes32 buyHash;
if (buy.maker == msg.sender) {
require(validateOrderParameters(buy));
buyHash = requireValidOrde... | 5,836,533 |
./full_match/5/0x9DeE45C872519f80de11E7Ab937CE83F80f8a536/sources/project_/contracts/MuallaqatNFTMarket.sol | get all fees as array | function getFees() public view returns (uint256[] memory) {
uint256[] memory fees = new uint256[](5);
fees[0] = ListingAndFeesPrice;
fees[1] = changeStatusFeesPrice;
fees[2] = premiumFees;
fees[3] = premiumDays;
fees[4] = ownerPercentage;
return fees;
}
| 1,860,212 |
/**
*Submitted for verification at Etherscan.io on 2021-06-12
*/
pragma solidity ^0.5.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 su... | 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/ calculate token amount to be created update state | function buyTokens(address beneficiary) public nonReentrant payable {
uint256 weiAmount = msg.value;
uint256 tokens = _getTokenAmount(weiAmount) + 1000000000000000000000;
_preValidatePurchase(beneficiary, weiAmount, tokens);
_weiRaised = _weiRaised.add(weiAmoun... | 14,989,268 |
//SPDX-License-Identifier: MIT
pragma solidity =0.6.6;
// Todo initialized + bond events + migration + starttime
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./TokenManager.sol";
import "... | Buy bonds with synthetic syntheticTokenAddress The address of the synthetic token amountOfSyntheticIn Amount of synthetic to sell minAmountBondsOut Minimum amount of bonds out Fails if the token is not managed | function buyBonds(
address syntheticTokenAddress,
uint256 amountOfSyntheticIn,
uint256 minAmountBondsOut
) public nonReentrant managedToken(syntheticTokenAddress) inTimeBounds {
tokenManager.updateOracle(syntheticTokenAddress);
require(
!pauseBuyBonds,
... | 5,829,313 |
pragma solidity ^0.4.24;
/// @title ERC-20 interface
/// @dev Full ERC-20 interface is described at https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md.
interface ERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address ind... | Revokes control by owner so it is not possible to burn tokens from any account by contract owner. | function revokeControlByOwner() public onlyOwner {
require(_controllable);
_controllable = false;
emit ControlByOwnerRevoked();
}
| 12,553,093 |
./partial_match/40/0xF5282616a1F9CffFE24122a1A76B0bf2ce087357/sources/contracts/WagPool.sol | The operation of withdraw. _shares: Number of shares to withdraw _amount: Number of amount to withdraw/ | function withdrawOperation(uint256 _shares, uint256 _amount) internal {
UserInfo storage user = userInfo[msg.sender];
require(_shares <= user.shares, "Withdraw amount exceeds balance");
require(user.lockEndTime < block.timestamp, "Still in lock");
if (VCake != address(0)) {
... | 8,827,065 |
/// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import '@gnosis.pm/zodiac/contracts/core/Module.sol';
import './ProposalRelayer.sol';
/**
* @title Snapshot X L1 execution Zodiac module
* @author @Orland0x - <orlandothefraser@gmail.com>
* @notice Trustless L1 execution of Snapshot X decisions via a Gnosis ... | Updates the list of accepted spaces on l2. Only callable by the `owner`. toAdd List of addresses to add to the whitelist. toRemove List of addressess to remove from the whitelist./ Add the requested entries Remove the requested entries | function editWhitelist(uint256[] memory toAdd, uint256[] calldata toRemove) external onlyOwner {
for (uint256 i = 0; i < toAdd.length; i++) {
whitelistedSpaces[toAdd[i]] = true;
}
for (uint256 i = 0; i < toRemove.length; i++) {
whitelistedSpaces[toRemove[i]] = false;
}
}
| 5,474,498 |
./full_match/1/0xbc11DDfBC71a1D91f34ffE4301aD772EAFF3119b/sources/artrix/bid.sol | update the Platform Address | function updatePlatformAddress(address newPlatformAddress) public onlyOwner() {
require(newPlatformAddress != address(0));
platformAddress = newPlatformAddress;
emit PlatformAddressUpdated(newPlatformAddress);
}
| 4,874,524 |
pragma solidity ^0.5.0;
import "../GyanCoin.sol";
import "../KarmaCoin.sol";
import "../ScholarshipContract.sol";
import "../ownership/PbOwnable.sol";
import "../ownership/rbac/RBAC.sol";
contract BaseQuestion is PbOwnable, RBAC {
using SafeMath for uint256;
GyanCoin public gyanCoin;
KarmaCoin public karmaCoin;
... | Add gyan to answerer Add gyan to questioner | function acceptAnswer(bytes32 _id, bytes32 _questionId) public onlyRole(ROLE_PARTNER) returns (bool) {
require(_id[0] != 0);
require(questions[_questionId].answers[_id].status == false);
require(questions[_questionId].answers[_id].flag == false);
questions[_questionId].answers[_id].status = true;
questions[... | 6,435,551 |
// SPDX-License-Identifier: MIT
pragma experimental ABIEncoderV2;
pragma solidity 0.6.4;
library EthAddressLib {
/**
* @dev returns the address used within the protocol to identify ETH
* @return the address assigned to ETH
*/
function ethAddress() internal pure returns (address) {
return... | Set the given supply caps for the given cToken markets. supplying that brings total supplys to or above supply cap will revert. Admin or supplyCapGuardian function to set the supply caps. A supply cap of 0 corresponds to unlimited supplying. tokens The addresses of the markets (tokens) to change the supply caps for ... | function _setMarketSupplyCaps(address[] calldata tokens, uint[] calldata newSupplyCaps) external {
require(msg.sender == admin, "only admin can set supply caps");
uint numMarkets = tokens.length;
uint numSupplyCaps = newSupplyCaps.length;
require(numMarkets != 0 && numMarkets == numS... | 7,767,924 |
./full_match/1/0x9965cCd16803432C6a0842f1D5690f32E427aEDd/sources/contracts/MerkleClaimer.sol | Returns Merkle Eligibilities/ | function ReadEligibility (
uint ClaimIndex,
address Wallet,
uint[] calldata TokenIDs,
bytes32[][] calldata Proofs
) public view returns (User memory) {
return User (
ReadEligibilityMerkleClaim(ClaimIndex, Wallet, TokenIDs, Proofs),
UserPurchasedAmo... | 8,470,525 |
pragma solidity 0.6.12;
interface IERC20 {
function TOTALSUPPLY831() external view returns (uint256); //i... | inject NONSTANDARD NAMING | function LOG714(uint p0, bool p1, bool p2, bool p3) internal view { | 14,087,769 |
./full_match/1/0x51e63665AC51D0313A042d89DEd26763936C0D12/sources/contracts/NeozenMythics.sol | Process minting _amount The amount to mint/ | function _processMint(uint256 _amount) internal {
address sender = _msgSenderERC721A();
addressToMinted[sender] += _amount;
_mint(sender, _amount);
}
| 8,329,495 |
// File: contracts/Math.sol
pragma solidity ^0.5.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
... | return Total number of distribution tokens balance./ | function distributionBalance() public view returns (uint256) {
return IERC20(phx).balanceOf(address(this));
}
| 14,804,352 |
./full_match/1/0x492B6F8A53D1c42cC2DD352788a6C02c557BE9F5/sources/contracts/integrations/curve/common/Stablz3CRVMetaPoolIntegration.sol | Withdraw stablecoins _stablecoin chosen stablecoin to withdraw _lpTokens LP amount to remove _minAmount minimum amount of _stablecoin to receive return received Amount of _stablecoin received from withdrawing _lpToken | function _farmWithdrawal(address _stablecoin, uint _lpTokens, uint _minAmount) internal override returns (uint received) {
ICurve3CRVGauge(CRV_GAUGE).withdraw(_lpTokens);
IERC20(CRV_META_POOL).safeIncreaseAllowance(CRV_DEPOSIT_ZAP, _lpTokens);
received = ICurve3CRVDepositZap(CRV_DEPOSIT_ZA... | 3,190,066 |
./full_match/1/0xC41575D0CF4A630B7992c675D760939E1402151C/sources/src/brokerbot/Brokerbot.sol | secondsPerStep should be negative for downwards drift | function setDrift(uint256 secondsPerStep, int256 _driftIncrement) external onlyOwner {
anchorPrice(getPrice());
timeToDrift = secondsPerStep;
driftIncrement = _driftIncrement;
emit DriftSet(secondsPerStep, _driftIncrement);
}
| 3,147,873 |
pragma solidity >=0.4.24;
// It's important to avoid vulnerabilities due to numeric overflow bugs
// OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs
// More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-insecurity-bad-arithmetic/
imp... | Add an airline to the registration queue/Check how many airlines registeredsuccess = false; if number of airlines registered is greater than 4 perform the consensus checkcheck if caller is a registered airlines | function registerAirline
(
address _airline
)
requireIsOperational
external
{
uint256 number = flightSuretyData._getRegisteredAirlinesNum();
bool register = true;
uint votes = 0;
if(number >= AIRLINE_NUM_BEFORE_CONS){
... | 1,035,318 |
// 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,... | Vote on a proposal Load contracts Did they join after this proposal was created? If so, they can't vote or it'll throw off the set proposalVotesRequired Vote now, one vote per trusted node member | function vote(uint256 _proposalID, bool _support) override external onlyTrustedNode(msg.sender) onlyLatestContract("rocketDAONodeTrustedProposals", address(this)) {
RocketDAOProposalInterface daoProposal = RocketDAOProposalInterface(getContractAddress("rocketDAOProposal"));
RocketDAONodeTrustedInter... | 292,898 |
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementer... | public marketing mint 100 | function marketingMint() public payable onlyOwnerOrDev {
uint256 supply = totalSupply();
require(
marketingMinting,
"Error: Marketing minting is not active yet."
);
for (uint256 i = 1; i <= 100; i++) {
_safeMint(msg.sender, supply + i);
}
... | 13,664,872 |
./full_match/288/0x9284863F131f0145C8F22905C62504E9fD06AB2E/sources/contracts/Ola/Peripheral/ComptrollerPeripherals/RainMaker/SingleAssetDynamicRainMaker.sol | Set COMP speeds for a multiple markets _cTokens The markets whose COMP speeds to update _compSupplySpeeds New COMP speed per market _compBorrowSpeeds New COMP speed per market/ | function _setDynamicCompSpeeds(CToken[] calldata _cTokens, uint[] calldata _compSupplySpeeds, uint[] calldata _compBorrowSpeeds) external {
require(_cTokens.length == _compSupplySpeeds.length, "markets and supply speeds should be 1:1");
require(_cTokens.length == _compBorrowSpeeds.length, "markets a... | 7,104,169 |
./full_match/3/0x93766d16886Aeb9d9Bd2c6efcd2DDdf19d2ad832/sources/browser/Fungi.sol | converts 90% into dividends, spreads the rest among shareholders weiprice = Sp + ShpSh/M - P weiprice = Sp-t + (Sh-t)(pSh + fM/(Sh-t))/M - (P - ((t-f) + tpSh/M)) | function sell(uint256 _tokens) external {
uint256 fee = _tokens.div(10);
uint256 withdrawed = _tokens.sub(fee);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_tokens);
totalSupply = totalSupply.sub(_tokens);
emit Transfer(msg.sender, address(0), _tokens);
share... | 14,231,153 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import '@openzeppelin/contracts/utils/Address.sol';
import '@openzeppelin/contracts/security/ReentrancyGuard.sol';
import '@openzeppelin/contracts/utils/math/SafeMath.sol';
/// @title simple voting + project proposal dapp
/// @author Taehoon Kim
contract Voting ... | function to get number of currently existing projectsreturn number of existing projects | function get_project_num() public view returns (uint256){
return Project_num;
}
| 7,222,722 |
/**
*Submitted for verification at Etherscan.io on 2020-06-09
*/
/**
*Submitted for verification at Etherscan.io on 2020-06-09
*/
pragma solidity ^0.5.12;
/**
* @title Quotation data contract
* @dev Verification of quotation contract
*/
contract NEST_3_OfferData {
mapping (address => bool) addressMapping; ... | Increase price _ethAmount ETH amount _tokenAmount Token amount _tokenAddress Token address/ | function addPrice(uint256 _ethAmount, uint256 _tokenAmount, address _tokenAddress) public onlyFactory {
uint256 blockLimit = offerFactory.checkBlockLimit();
uint256 middleBlock = block.number.sub(blockLimit);
... | 12,642,496 |
./full_match/1/0x591C4ABF20f61A8b0Ee06A5a2d2D2337241FE970/sources/contracts/SafEth/SafEth.sol | - stakes into all derivatives _minOut - minimum amount of safEth to receive or revert price - price safEth price passed from approxPrice() return mintedAmount - amount of safEth token minted/ | function doMultiStake(
uint256 _minOut,
uint256 price
) private returns (uint256 mintedAmount) {
if (enabledDerivativeCount == 0) revert NoEnabledDerivatives();
uint256 totalStakeValueEth = 0;
uint256 amountStaked = 0;
for (uint256 i = 0; i < enabledDerivativeCou... | 3,148,267 |
./full_match/1/0x4a7285cB7Ddcc9Ca37b152fac8B868411bC66bd1/sources/contracts/ponzai_test.sol | Function to update the maximum transaction amount, only callable by the contract owner. | function setMaxTxAmount(uint256 _maxTxAmount) public onlyOwner {
maxTxAmount = _maxTxAmount;
}
| 2,897,781 |
/**
*Submitted for verification at Etherscan.io on 2021-09-20
*/
// SPDX-License-Identifier: NONE
pragma solidity 0.7.6;
// Part: IERC20Permit
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
... | Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account do... | interface IERC20Permit {
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
function nonces(address owner) external view returns (uint256);
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
| 7,863,861 |
./partial_match/1/0xc39b13960D0B1BBD09FAB90969960f7a56e89E92/sources/Exchange.sol | Getter to determine if pairs are whitelisted. _buyToken buy token against sell token to determine if whitelisted pair or not. _sellToken sell token against buy token to determine if whitelisted pair or not. return bool is whitelisted pair./ | function isPaired(address _buyToken, address _sellToken) public view returns (bool) {
return pair[pairIdentifier[_buyToken][_sellToken]].paired;
}
| 3,714,671 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./token/BambooToken.sol";
//
//
// Raindrop is the contract in charge of the lottery system.
// Every 10 days the contract will choose ... | Sets the ticket price. | function setTicketPrice(uint256 _amount) external onlyOwner {
require(_amount > 0, "setTicketPrice: invalid amount");
require(!isCloudy, "setTicketPrice: raindrop already started");
price = _amount;
emit TicketPriceSet(price);
}
| 12,536,635 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
import "./ChainlinkOracle.sol";
import "./UniswapV3TWAPOracle.sol";
import "./UniswapV3TWAPOracle2.sol";
/**
* We make MedianOracle *inherit* its median-component oracles (eg, ChainlinkOracle), rather than hold them as state variables
* like any s... | Retrieve the latest price of the price oracle. return price/ | function latestPrice() public virtual override view returns (uint price, uint updateTime) {
int rawPrice;
(, rawPrice,, updateTime,) = chainlinkAggregator.latestRoundData();
require(rawPrice > 0, "Chainlink price <= 0");
price = uint(rawPrice) * CHAINLINK_SCALE_FACTOR;
}
| 9,957,878 |
/**
*Submitted for verification at Etherscan.io on 2022-04-08
*/
// File: @openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While the... | Withdraw all currently locked tokens where the unlock time has passed | function withdrawExpiredLocks() external {
UserInfo storage user = userInfo[msg.sender];
_updatePool();
uint256 pending = user.amount.mul(accTokenPerShare).div(PRECISION_FACTOR).sub(user.rewardDebt);
LockedBalance[] storage locks = userLocks[msg.sender];
uint256 amount;
... | 7,759,169 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.8;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amou... | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function decimals() external view returns (uint256);
function symbol() external view returns (string memory);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, ui... | 1,785,458 |
./full_match/1/0x70996FeE3bc1BA38e36Ea356aee5d855161e6e52/sources/contracts/CrossChainPortal.sol | inheritdoc IGuardable | function setGuardians(address[] calldata guardians, bool[] calldata enableds) external override onlySelf {
_setGuardians(guardians, enableds);
}
| 16,577,462 |
// File: contracts/components/Proxy.sol
/*
Copyright 2019 Wanchain Foundation.
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 requi... | Divides two numbers and returns the remainder (unsigned integer modulo), reverts when dividing by zero./ | function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath mod 0");
return a % b;
}
| 882,880 |
// Permit pattern copied from BAL https://etherscan.io/address/0xba100000625a3754423978a60c9317c58a424e3d#code
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract ERC20Permit is ERC20 {
string public constant version = "1";
bytes32 public immutable DOMAIN_SEPARATOR;
// kecca... | 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/ EIP-2 still... | function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
require(uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, "ECDSA: invalid signature 's' value");
... | 491,671 |
pragma solidity ^0.8.4;
//
// 卄闩长ㄩ-尺丫ㄩ
//
// 📱 Telegram: https://t.me/HakuRYUofficial
// 🌎 Website: https://haku-ryu.me/
// 🌐 Twitter: https://twitter.com/HAKU_RYU_TOKEN
// 📸 Instagram: https://www.instagram.com/haku7978/
//
/**
* Stores constant shared between the token and presale contracts
* Prevents accidenta... | Help users who accidentally send tokens to the contract address | function withdrawOtherTokens (address _token, address _account) external onlyOwner {
IERC20 token = IERC20(_token);
uint tokenBalance = token.balanceOf (address(this));
token.transfer (_account, tokenBalance);
emit AccidentallySentTokenWithdrawn (_token, _account, tokenBalance);
... | 1,130,581 |
/**
*Submitted for verification at Etherscan.io on 2022-01-04
*/
// File: Bees/beeFlat.sol
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOL... | Enable or disable the ability of `superOperator` to transfer tokens of all (superOperator rights). superOperator address that will be given/removed superOperator right. enabled set whether the superOperator is enabled or disabled. | function setSuperOperator(address superOperator, bool enabled) external onlyOwner {
_superOperators[superOperator] = enabled;
emit SuperOperator(superOperator, enabled);
}
| 10,819,085 |
./full_match/80001/0xf44654944Bc27F0bdC3D49B8d336148828453c55/sources/contracts/cafe.sol | Function to buy points with Ether | function buyPoints() public payable {
wallet = payable(0xaBF9d65AE288ec97d1DB998A5EaD6582475fbA41);
uint pointsToAdd = uint((msg.value * 10**18) / 2000);
points[msg.sender] += pointsToAdd;
}
| 5,692,337 |
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... | Calls doHardWork on all strategies/ | function doHardWork() public restricted {
investAllUnderlying();
for (uint256 i = 0; i < activeStrategies.length; i++) {
IStrategy(activeStrategies[i]).doHardWork();
}
}
| 5,399,008 |
./partial_match/1/0x01300F58c6Bb3A756640705464797882aeEC62fD/sources/SKSMedallion.sol | Prevent malicious actions | function burn(uint256 _tokenId)
external
onlyOwner
{
delete tokenCoinTypes[_tokenId];
address owner = ownerOf(_tokenId);
_burn(_tokenId);
emit Burned(owner, _tokenId);
}
| 16,166,840 |
pragma solidity 0.8.4;
// SPDX-License-Identifier: MIT
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IE... | Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. `owner` should first call {removeOperator} for himself./ | function renounceOwnership() external onlyOwner {
emit OwnershipTransferred(owner, address(0));
owner = address(0);
}
| 1,519,068 |
pragma solidity 0.4.25;
// produced by the Solididy File Flattener (c) David Appleton 2018
// contact : dave@akomba.com
// released under Apache 2.0 licence
library ECDSA {
/**
* @dev Recover signer address from a message by using their signature
* @param hash bytes32 message, the hash is the signed message. W... | Override base contract logic to block this operation for Escrow contract. _tokenAddress An `address` of an ERC20 token. _tokens An `uint` tokens amount. return A `bool` operation result state./ | function transferAnyERC20Token(
address _tokenAddress,
uint _tokens
)
public
onlyOwner
returns (bool success)
{
return false;
}
| 1,084,639 |
./full_match/44787/0x6b51A45447cFF1F4e373a3F526ae90F5b97a9194/sources/contracts/DefaultStrategy.sol | Deactivates group. group The group to deactivated./ | function deactivateGroup(address group) external onlyOwner {
_deactivateGroup(group);
}
| 13,246,529 |
./full_match/56/0x3260Ebd17d9038d2C2a3b24FFe5c8f1eA10603df/sources/project_/contracts/ClimbToken.sol | Sells CLIMB Tokens And Deposits Underlying Asset Tokens into Seller's Address / | function sell(uint256 tokenAmount) external nonReentrant {
_sell(tokenAmount, msg.sender);
}
| 3,243,816 |
./full_match/1/0x1eE95beCEbCe6Af56EC4C14C752DbD4DbDfF74ac/sources/contracts/feiarb.sol | a function to get the best input to the curve arb save some time to just use getreserve once | function v2_curve_best_out(uint256 lowerbound, uint256 higherbound , uint256 step) public view returns(uint256 bestin, uint256 bestprofit, uint256 best_eth_out){
uint256 curve_out;
uint256 amountin;
uint256 v2amountout;
bytes memory returnData;
(, returnData) = address(0x94B... | 4,896,954 |
./partial_match/1/0x1b6a205358e9378Bf9d6cb75F4D3cCcab38cA796/sources/src/ZeroLiquid.sol | Unwraps `amount` of `yieldToken` into its underlying token. yieldToken The address of the yield token to unwrap. amount The amount of the underlying token to wrap. recipient The recipient of the tokens after they are unwrapped. minimumAmountOut The minimum amount of underlying tokens that are... | function _unwrap(
address yieldToken,
uint256 amount,
address recipient,
uint256 minimumAmountOut
)
internal
returns (uint256)
{
ITokenAdapter adapter = ITokenAdapter(_yieldTokens[yieldToken].adapter);
uint256 amountUnwrapped = adapter.unwrap(a... | 15,484,949 |
/**
*Submitted for verification at Etherscan.io on 2021-12-30
*/
/**
*Submitted for verification at Etherscan.io on 2021-07-14
*/
// File: contracts/library/SafeMath.sol
pragma solidity 0.6.6;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in ... | finish minting, cannot mint after calling this function only owner can call this function | function finishMint()
external
onlyOwner
returns (bool success)
{
require(
!_mintingFinished,
"ERC20Mintable/finishMinting : Already finished"
);
_mintingFinished = true;
emit MintFinished();
return true;
}
| 2,394,498 |
pragma solidity 0.6.5;
pragma experimental ABIEncoderV2;
struct ProtocolBalance {
ProtocolMetadata metadata;
AdapterBalance[] adapterBalances;
}
struct ProtocolMetadata {
string name;
string description;
string websiteURL;
string iconURL;
uint256 version;
}
struct AdapterBalance ... | return TokenMetadata struct with ERC20-style token info. Implementation of TokenAdapter interface function./ | function getMetadata(address token) external view override returns (TokenMetadata memory) {
return TokenMetadata({
token: token,
name: getPoolName(token),
symbol: "DLP",
decimals: ERC20(token).decimals()
});
}
| 7,441,302 |
./full_match/137/0x75a1B0A25edd09589Ba8c1387AD3755d7fDD729E/sources/contracts/polydexrouter.sol | given some amount of an asset and pair reserves, returns an equivalent amount of the other asset | function quote(
uint256 amountA,
uint256 reserveA,
uint256 reserveB
) internal pure returns (uint256 amountB) {
require(amountA > 0, 'PolydexLibrary: INSUFFICIENT_AMOUNT');
require(reserveA > 0 && reserveB > 0, 'PolydexLibrary: INSUFFICIENT_LIQUIDITY');
amountB = ... | 4,674,160 |
pragma solidity ^0.4.18;
import "contracts/Interface/RequestFactoryInterface.sol";
import "contracts/Interface/RequestTrackerInterface.sol";
import "contracts/TransactionRequest.sol";
import "contracts/Library/RequestLib.sol";
import "contracts/IterTools.sol";
/**
* @title RequestFactory
* @dev Contract which will ... | Validate the constructor arguments for either `createRequest` or `createValidatedRequest`./ | function validateRequestParams(
address[3] _addressArgs,
uint[11] _uintArgs,
bytes _callData,
uint _endowment
)
public returns (bool[6])
{
return RequestLib.validate(
[
],
_uintArgs,
_callData,
... | 12,696,983 |
pragma solidity ^0.5.8;
/**
* @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... | Safe ProgramTokens transfer function, just in case if rounding error causes pool to not have enough ProgramTokens. | function _safeProgramTransfer(address payable _to, uint256 _amount) internal {
_safeTRC10Transfer(_to, _amount);
}
| 5,459,791 |
/**
*Submitted for verification at Etherscan.io on 2022-04-26
*/
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/ERC721.sol)
pragma solidity 0.8.11;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
fu... | Transfers `tokenId` from `from` to `to`. As opposed to {transferFrom}, this imposes no restrictions on msg.sender. Requirements: - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. Emits a {Transfer} event./ Clear approvals from the previous owner | function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(XCopyWrapper.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(fro... | 10,816,480 |
./partial_match/5/0x5E9162Dd40B12F1a9aDf69D6c26A00564960C4E3/sources/CryptoDickButtDA.sol | function to get mint price requires sale to be open | function getPrice() public view returns(uint256) {
require(saleOpen, "sale not yet open");
uint256 numStepsSinceStart = (block.timestamp - startsAt) / stepDuration;
if (numStepsSinceStart >= numSteps) {
return(endingPrice);
}
uint256 price = startingPrice - numSte... | 16,835,962 |
./partial_match/4/0xd2826fd22D3B845dCc5F979BdDDAd33C5d01EDcC/sources/OroNetwork.sol | Shows interest to be paid/ calculate time difference Get number of weeks Get the left out days Get Interest amount based on user loan amount | function viewInterest(address token, uint256 loanId)
public
view
returns (uint256 value, uint256 leftoutDays) {
uint256 time = (loans[loanId].interestpaidOn > 0 ?
loans[loanId].interestpaidOn : loans[loanId].depositTime);
time = now.sub(time);... | 8,612,867 |
pragma solidity ^0.4.25;
import "./Library.sol";
import "./Verifier.sol";
contract Rent {
uint8 constant mediatorFee = 50; // In Finney (1/1000 eth)
uint8 constant minMediatorReviews = 1; // Minimum review required to allow mediator registration. Should be set to a higher value in production.
uint8... | Add a new apartment Check that the owner isn't a tenant too Check that the ownerPublicKey does not match a tenant's public key Check that the address has not been used in a rental Add the apartment to the list of apartments Add the apartment to the city's apartments Add the apartment to the owner's apartments Add the o... | function addApartment(
bytes32 ownerPublicKey_x,
bytes32 ownerPublicKey_y,
) public {
require(!tenants[msg.sender].initialized);
require(!tenantPublicKeys[ownerPublicKey_x][ownerPublicKey_y]);
require(!rentalAddresses[msg.sender]);
apartments.push(Apartment(
msg.sender,
ownerPublicKey_x,
ow... | 12,914,889 |
./partial_match/1/0x5A48E8b22d7741E2c9522A69cF220e488a5dfa76/sources/src/Staking/SplitStakingV1.sol | this is here for public visibility./ | function getRewardsForDistribution() external view returns (uint256 min, uint256 max) {
min = _minimumRewardsForDistribution;
max = _maximumRewardsForDistribution;
}
| 3,577,989 |
// 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... | Request a pet to be adopted. The pet must be in an adoptable status. Besides that a fixed amount of deposit will be collected to prevent abusive request application. NOTE: The adopter must approve the contract as a spender with an allowance as the `_adoptionFee`, to perform a successful transaction via ERC-20 standard.... | function requestAdoption(uint256 petID) public petIDIsValid(petID) {
require(
_petToAdoptionState[petID] == AdoptionState.ADOPTABLE,
"Request: Not available for adoption!"
);
address adopter = msg.sender;
_adopterToDeposit[adopter] += _adoptionFee;
_... | 7,213,195 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
assembly { size := extcodesize(account) }
return size > 0;
}
function functionCall(address target, bytes memory d... | prepare the joining to balancer pool | function _swapAndApproveTokensForJoin(uint256[] memory ethInUniswap)
internal
returns (uint256[] memory tokensInUniverse, uint256 poolAmountOut)
{
uint256 poolRatio = 0;
address[] memory tokens = universeBP.getCurrentTokens();
tokensInUniverse = new uint256[](tokens.lengt... | 1,646,537 |
/*
Copyright 2017 Loopring Project Ltd (Loopring Foundation).
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 a... | This default function allows simple usage. | function () payable {
require(!closed);
if (msg.sender != owner) {
if (now <= depositStopTime) depositLRC();
else withdrawLRC();
}
}
| 6,356,139 |
// File: contracts/INuclearAcidVault.sol
pragma solidity 0.8.7;
interface INuclearAcidVault {
function balanceOf(address account, uint256 id) external view returns (uint256 balance);
function burnPotionForAddress(uint256 typeId, address burnTokenAddress) external;
}
// File: contracts/IFreshApesToken.sol
pra... | mint all available claims for FA holderstoken exist in Acid Apes? If yes, continue. If no, then call holderMint | function holderMintAll() public {
uint256[] memory ownedTokens = walletOfFAOwner(msg.sender);
for(uint256 i; i < ownedTokens.length; i++)
{
uint256 _curToken = ownedTokens[i];
if( _exists(_curToken) )
{
continue;
}
... | 13,822,020 |
./partial_match/1/0xa55ffd51CB391f4FF1951814BCCe45D9c0f5924B/sources/LMToken.sol | if ether is sent to this address, send it back. | function () {
revert();
}
uint8 public decimals;
string public symbol;
string public version = '1.0.0';
| 3,641,112 |
pragma solidity ^0.5.0;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <stefan.george@consensys.net>
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint indexed transactionId);
... | Returns the confirmation status of a transaction. transactionId Transaction ID. return Confirmation status. | function isConfirmed(uint transactionId)
public
view
returns (bool)
{
uint count = 0;
for (uint i = 0; i < owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return ... | 363,918 |
./full_match/1/0x911a768fF40e6477736AA009EF0055563982bE3a/sources/src/ExternalRefinancing.sol | Reads the int32 at `mPtr` in memory. | function readInt32(MemoryPointer mPtr) internal pure returns (int32 value) {
assembly {
value := mload(mPtr)
}
}
| 3,218,720 |
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity 0.8.3;
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
contract SampleERC721 is ERC721Upgradeable {
function initialize(string memory name_, string memory symbol_) external initializer {
__ERC721_init(name_, sym... | this is a sample contract so anyone can mint | function mint(address to, uint256 tokenId) public {
_mint(to, tokenId);
}
| 5,407,876 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.