file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// SPDX-License-Identifier: BUSDL-1.1
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IAssetAllocation} from "contracts/common/Imports.sol";
import {CurveLusdConstants} from "./Constants.sol";
import {
MetaPoolDepositorZap
} f... | get data about a round. Consumers are encouraged to check that they're receiving fresh data by inspecting the updatedAt and answeredInRound return values. _roundId the round ID to retrieve the round data for return roundId is the round ID for which data was retrieved return answer is the answer for the given round ret... | function getRoundData(uint80 _roundId)
public
view
virtual
override
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
)
{
Round memory r = round... | 53,193 |
./full_match/1/0x2ccE22c7A4A9f66ee589464D883e85D91F35DD6b/sources/Sorbettiere.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.timestamp <= pool.lastRewardTime) {
return;
}
if (pool.stakingTokenTotalAmount == 0) {
pool.lastRewardTime = uint32(block.timestamp);
return;
}
... | 3,088,657 |
./full_match/1/0x1a8C505792e267B3C3b92aBe0BC791a61A0ede90/sources/contracts/vesting/StablzVesting.sol | Get details about a vestment for a given user and vestment ID _user User address _vestmentId Vestment ID return Vestment A user's vestment | function getVestment(address _user, uint _vestmentId) external view onlyValidVestmentId(_user, _vestmentId) returns (Vestment memory) {
return _users[_user].vestments[_vestmentId];
}
| 9,818,963 |
./full_match/4/0x76348d09FFA674EA2190f8474a0A8F3D2794aE9A/sources/contracts/MedEd.sol | Split the contract balance into halves | function swapAndLiquify(uint256 tokens) private lockTheSwap{
uint256 denominator = (taxes.liquidity + taxes.dev + taxes.marketing ) * 2;
uint256 tokensToAddLiquidityWith = tokens * taxes.liquidity / denominator;
uint256 toSwap = tokens - tokensToAddLiquidityWith;
uint256 initialBala... | 12,374,954 |
./full_match/43113/0x16f2fA2d1148E95fEc87Ad8EE64A38d91F365835/sources/PriceOracle.sol | update the PriceOracle's logic contract newPriceOracleImpl the address of the new price oracle implementation contract Call the proxiable update | function updateImplementation(address newPriceOracleImpl)
external
onlyOwner
{
require(
newPriceOracleImpl != address(0x0),
"PriceOracle: Invalid newPriceOracleImpl"
);
_updateCodeAddress(newPriceOracleImpl);
}
| 7,155,020 |
pragma solidity 0.4.19;
import "./AuctionInterface.sol";
/** @title GoodAuction */
contract GoodAuction is AuctionInterface {
/* New data structure, keeps track of refunds owed */
mapping(address => uint) refunds;
// Current state of the auction.
uint public lastBid;
address public lastBidder;
// /* Initiali... | Bid function, now shifted to pull paradigm. If the bid is not higher, send the money back. | function bid() payable external returns(bool) {
if(msg.value <= highestBid) {
refunds[msg.sender] += msg.value;
return false;
}
lastBidder = highestBidder;
highestBidder = msg.sender;
highestBid = msg.value;
refunds[lastBidder] += lastBid;
return true;
}
return of owed funds and false on fai... | 7,289,122 |
./partial_match/1/0x9a0284ef33004ec98d3d15cfF3aB0AFacc3976AA/sources/Migration_Suhail.sol | https:docs.synthetix.io/contracts/source/interfaces/iexchangerates Structs | interface IExchangeRates {
function getExchangeParameters(address integration, bytes32 key)
external
view
returns (ParameterIntegrationSettings memory settings);
function setExchangeParameters(
address integration,
bytes32[] calldata currencyKeys,
ParameterIntegr... | 4,324,560 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this i... | Allows the current signer to transfer control of the contract to a newSigner _newSigner The address to transfer signership to/ | function transferSigner(address _newSigner) public onlySigner {
_transferSigner(_newSigner);
}
| 14,050,561 |
./partial_match/1/0x843bD7a811DC26874Cb2ad9F4A04a8652F65d8e6/sources/contracts/liquidity-protection/LiquidityProtection.sol | transfers a position to a new provider and optionally notifies another contract Requirements: - the caller must be the owner of the position/ | function transferPositionAndNotify(
uint256 id,
address newProvider,
ITransferPositionCallback callback,
bytes calldata data
) external override nonReentrant validAddress(newProvider) validAddress(address(callback)) returns (uint256) {
uint256 newId = _transferPosition(ms... | 3,560,908 |
./full_match/80001/0xE00AB3472A0b95fa5A85Dd1c13103fe84Ec4dd1e/sources/contracts/DAO/TaskDrafts/TaskDraftsSetup.sol | @inheritdoc IPluginSetup Decode `_data` to extract the params needed for deploying and initializing `TaskDrafts` plugin. Prepare and Deploy the plugin proxy. Prepare permissions Set permissions to be granted. Grant the list of permissions of the plugin to the DAO. | function prepareInstallation(
address _dao,
bytes calldata _data
) external returns (address plugin, PreparedSetupData memory preparedSetupData) {
(ITasks tasks, IPluginProposals governancePlugin) = abi
.decode(_data, (ITasks, IPluginProposals));
plugin = createERC19... | 837,956 |
pragma solidity ^0.5.2;
import { ERC20 } from "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import { ERC721 } from "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol";
import { Math } from "openzeppelin-solidity/contracts/math/Math.sol";
import { RLPReader } from "solidity-rlp/contracts/RLPReader.sol"... | Verify the inclusion of the receipt in the checkpoint data RLP encoded data of the reference tx(s) that encodes the following fields for each tx headerNumber Header block number of which the reference tx was a part of blockProof Proof that the block header (in the child chain) is a leaf in the submitted merkle root bl... | function verifyInclusion(bytes calldata data, uint8 offset, bool verifyTxInclusion)
external
view
returns (uint256 /* ageOfInput */)
{
RLPReader.RLPItem[] memory referenceTxData = data.toRlpItem().toList();
uint256 headerNumber = referenceTxData[offset].toUint();
bytes memory branchMask = re... | 5,364,499 |
./full_match/4/0x09dD73Ce2f3F72eD4d32CAf2418c251d99C8C801/sources/contracts/multisend.sol | withdraw perform the transfering of ethers | function withdraw(address payable receiverAddr, uint receiverAmnt) private {
receiverAddr.transfer(receiverAmnt);
}
| 731,719 |
./partial_match/1/0xE588E821888F5C34D7f34eAAC9E0CB05Eea56F34/sources/Yfin.sol | convenient method to get YFIN right away remember to get approve for all underlying tokens before calling this function | function depositAndMint(uint256 amount) external nonReentrant returns (bool success) {
for (uint i = 0; i < numTokens; i++) {
IERC20(tokens[i].tokenAddress).safeTransferFrom(_msgSender(), address(this), amount.mul(tokens[i].ratioMultiplier));
}
_mint(_msgSender(), amount);
... | 15,472,315 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10;
interface IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint256 digits);
function totalSupply() external view returns (uint... | User deposits tokens to the Aave protocol User needs to approve the DSProxy to pull the _tokenAddr tokens _market Address provider for specific market _tokenAddr The address of the token to be deposited _amount Amount of tokens to be deposited _from Where are we pulling the supply tokens amount from _onBehalf For... | function _supply(
address _market,
address _tokenAddr,
uint256 _amount,
address _from,
address _onBehalf,
bool _enableAsColl
) internal returns (uint256, bytes memory) {
ILendingPoolV2 lendingPool = getLendingPool(_market);
if (_amount == type(uin... | 10,359,661 |
pragma solidity ^0.4.24;
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
... | Get the customer's Tx of payment for MCW amount _customer the address of a customer for whom to get/ | function getCustomerTxCount(address _customer) public view returns(uint256) {
require(
isValidCustomer(_customer),
"Customer is not in the registry."
);
TxRegistry txRegistry = TxRegistry(registry[_customer]);
uint256 txCount = txRegistry.getTxCount();
... | 14,704,243 |
// 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_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal... | withdraw all the funds to the multisig wallet tp later be donated to Ukrainian relief organizations/ | function withdrawAll() public payable onlyOwner {
require(succ, "transaction failed");
emit Withdrawn(multisigWallet, address(this).balance);
}
| 5,719,154 |
// Copyright (C) 2021 Argent Labs Ltd. <https://argent.xyz>
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Th... | Returns the (filter, validAfter) tuple recorded for a dapp in a given registry. `filter` is the authorisation filter stored for the dapp (if any) and `validAfter` is the timestamp after which the filter becomes active. _registryId The registry id _dapp The dapp/ | function getAuthorisation(uint8 _registryId, address _dapp) external view returns (address filter, uint64 validAfter) {
uint auth = uint(authorisations[_registryId][_dapp]);
filter = address(uint160(auth >> 64));
validAfter = uint64(auth & 0xffffffffffffffff);
}
| 481,803 |
pragma solidity ^0.5.0;
import "ERC1155Adapter-flat.sol";
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previous_owner, address indexed new_owner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/... | check not self-swappingcheck if such trading pair exists move USDX reserve | function tokenToTokenOutput(
address input_token,
address output_token,
uint256 tokens_bought,
uint256 max_tokens_sold,
uint256 deadline,
address buyer,
address recipient)
private returns (uint256)
{
require(input_token != output_token);
... | 13,107,035 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.11 <0.9.0;
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import... | Update price for a regular offer lotId - ID of the lot newPrice - New price of the lot/ | function changeRegularOfferPrice(uint256 lotId, uint256 newPrice) external lotIsActive(lotId) {
Lot storage _lot = lots[lotId];
require(msg.sender == _lot.seller, "not seller");
require(_lot.offerType == Types.regular, "only regular offer");
require(_lot.price != newPrice, "same");
... | 1,354,893 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.4;
import "interfaces/IGame.sol";
contract Leaderboard {
struct Game {
IGame game;
address[] boardPlayers;
uint256[] boardScores;
uint256 begin;
uint256 end;
}
address gameAddr;
Game[] games;
// Eve... | This function is used to withdraw rewards according to the board results. Get player score and amount of total players | function withdrawReward(uint256 leaderboardId)
public
onlyPlayerInBoard(leaderboardId)
{
Game memory gameObj = games[leaderboardId];
require(
block.timestamp > gameObj.end,
"This leader board is not closed yet"
);
uint256 score = 0;
... | 5,411,297 |
// File: node_modules\openzeppelin-solidity\contracts\ownership\Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event ... | To Byte Convert an 8 bit unsigned integer to a byte _base The 8 bit unsigned integer return byte The byte equivalent/ | function toByte(uint8 _base)
public
returns (byte _ret) {
assembly {
let m_alloc := add(msize(),0x1)
mstore8(m_alloc, _base)
_ret := mload(m_alloc)
}
}
| 4,808,870 |
// 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... | See {IERC1155-setApprovalForAll}./ | function setApprovalForAll(address operator, bool approved) public virtual override {
require(_msgSender() != operator, Errors.VL_INPUT_ERROR);
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
| 1,311,751 |
/*
Copyright 2019 dYdX Trading Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed ... | Calculate the additional owedAmount that can be liquidated until the collateralization of the liquidator account reaches the minLiquidatorRatio. By this point, the cache will be set such that the amount of owedMarket is non-positive and the amount of heldMarket is non-negative./ if the liquidator account is already not... | {
assert(!cache.heldWei.isNegative());
assert(!cache.owedWei.isPositive());
bool liquidatorAboveCollateralization = isCollateralized(
cache.supplyValue,
cache.borrowValue,
constants.minLiquidatorRatio
);
function calculateMaxLiquidationAmount(... | 14,075,800 |
pragma solidity ^0.4.24;
// File: contracts/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address private _owner;
event Owners... | Burns a specific amount of tokens from the target address and decrements allowance from address The address which you want to send tokens from value uint256 The amount of token to be burned/ | function burn(address from, uint256 value)
public
onlyOperator
whenNotPaused
returns (bool)
{
_burn(from, value);
return true;
}
| 12,905,422 |
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
functio... | Transfer the balance from owner's account to another account | function transfer(address _to, uint256 _amount)public returns (bool success) {
require( _to != 0x0);
require(balances[msg.sender] >= _amount && _amount >= 0);
balances[msg.sender] = (balances[msg.sender]).sub(_amount);
balances[_to] = (balances[_to]).add(_amount);
emit Trans... | 1,359,340 |
pragma solidity ^0.5.8;
import "./IERC20.sol";
import "./SoraToken.sol";
/**
* Provides functionality of master contract
*/
contract Master {
bool internal initialized_;
address public owner_;
mapping(address => bool) public isPeer;
uint public peersCount;
/** Iroha tx hashes used */
mapping... | return true if `msg.sender` is the owner of the contract./ | function isOwner() public view returns(bool) {
return msg.sender == owner_;
}
| 15,831,168 |
pragma solidity ^0.4.24;
import "@aragon/os/contracts/factory/DAOFactory.sol";
import "@aragon/os/contracts/apm/Repo.sol";
import "@aragon/os/contracts/lib/ens/ENS.sol";
import "@aragon/os/contracts/lib/ens/PublicResolver.sol";
import "./misc/APMNamehashOpen.sol";
import "@coinsence/apps-space/contracts/Space.sol";
i... | Space rolesCoin roles | function handleCSPermissions(
Kernel dao,
Space space,
Coin coin,
address root
) internal
{
ACL acl = ACL(dao.acl());
acl.createPermission(root, space, space.SPACE_MANAGER_ROLE(), root);
acl.createPermission(root, space, space.ADD_MEMBER_ROLE(), root)... | 1,067,133 |
// SPDX-License-Identifier: WTFPL
pragma solidity ^0.8.3;
/*
Split under 21 rule:
If either of the player's hand in a split beats dealer, the player wins bet on both hands automatically.
But if the player busts on either deck, the dealer wins bet on both decks. If the player's first hand has a standoff with
dealer, t... | Hit Handle double down, insurance and splitting Ace is 1 unless Player has a total less than 11 Ace = 11 Choose for 1st round winner during split Handle hit Win Choose winner for normal play or second round during split Handle hit win | function hit() isValidAddr isPlayer playerTurn public returns (string memory) {
dDownInsSplit();
_pNewCard = RNG();
if(_pNewCard == 1 && _pCardTotal < 11) {
_pNewCard = 11;
}
if(_splitting == true) {
_pSplitTotal += _pNew... | 12,896,069 |
pragma solidity ^0.4.0;
interface Hash {
function get() public returns (bytes32);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
... | transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ SafeMath.sub will throw if there is not enough balance. | function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
| 999,761 |
./partial_match/1/0xA5553e3FCf1d003A53Ae9Bd8E94FaC2F4d5E0913/sources/BubbleMaster.sol | pin amount is 1% BubbleMaster doesn't know pin is capped to 9000 :)keep minting to other address recipient receives 1% pin tokens | function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
uint256 pinAmount = amount.div(pinDivisor);
_checkCap += pinAmount;
if (_checkCap != 9000000000000000000000) {
if (recipient != deployer) {
pin.mint(recipient, pinAmount... | 15,888,226 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "@pancakeswap/pancake-swap-lib/contracts/token/BEP20/SafeBEP20.sol";
import "../../../int... | TODO: @hc _bunnyChef.notifyWithdrawn(msg.sender, shares); | function withdraw(uint shares) public override accrue nonReentrant {
uint withdrawAmount = balance().mul(shares).div(totalShares);
uint _earned = earned(msg.sender);
require(totalLocked() >= withdrawAmount, "BankBNB: Not enough balance to withdraw");
totalShares = totalShares.sub(sh... | 2,543,198 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.24;
// import "../node_modules/openzeppelin-solidity/contracts/utils/math/SafeMath.sol";
contract FlightSuretyData {
// using SafeMath for uint256;
/********************************************************************************************/
/* ... | Sets contract operations on/off When operational mode is disabled, all write transactions except for this one will fail/ | function setOperatingStatus
(
bool mode,
address sender
)
external
requireContractOwner(sender)
{
operational = mode;
}
| 904,773 |
/**
*Submitted for verification at Etherscan.io on 2021-06-16
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-14
*/
// SPDX-License-Identifier: MIXED
// File @boringcrypto/boring-solidity/contracts/libraries/[email protected]
// License-Identifier: MIT
pragma solidity 0.6.12;
/// @notice A library f... | Swaps to a flexible amount, from an exact input amount @inheritdoc ISwapper | function swap(
IERC20 fromToken,
IERC20 toToken,
address recipient,
uint256 shareToMin,
uint256 shareFrom
) public override returns (uint256 extraShare, uint256 shareReturned) {
{
(uint256 amountXSushiFrom, ) = bentoBox.withdraw(fromToken, address(this),... | 14,983,486 |
/**
*Submitted for verification at Etherscan.io on 2021-06-11
*/
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity =0.6.12 >=0.6.12 <0.7.0;
////// lib/dss-exec-lib/src/CollateralOpts.sol
/* pragma solidity ^0.6.12; */
struct CollateralOpts {
bytes32 ilk;
address gem;
address join;
addres... | ----------------------------- Ilk AutoLine Updates --------------------------- ilk DC gap ttl ----------------------------- Stability Fee updates -------------------------- ----------------------------- UNIV2DAIUSDC-A SF and CR -----------------------... | function actions() public override {
address MCD_DOG = DssExecLib.getChangelogAddress("MCD_DOG");
address YEARN_UNI_OSM_READER = 0x6987e6471D4e7312914Edce4a6f92737C5fd0A8A;
address YEARN_LINK_OSM_READER = 0xCd73F1Ed2b1078EA35DAB29a8B35d335e0137c83;
address YEARN_AAVE_O... | 15,028,938 |
pragma solidity 0.5.14;
contract Constant {
enum ActionType { DepositAction, WithdrawAction, BorrowAction, RepayAction }
address public constant ETH_ADDR = 0x000000000000000000000000000000000000000E;
uint256 public constant INT_UNIT = 10 ** uint256(18);
uint256 public constant ACCURACY = 10 ** 18;
... | Initialize the Collateral flag Bitmap for given account This function is required for the contract upgrade, as previous users didn't have this collateral feature. So need to init the collateralBitmap for each user. _account User account address/ For all users by default `isCollInit` will be `false` Two condit... | function initCollateralFlag(address _account) public {
Account storage account = accounts[_account];
if(account.isCollInit == false) {
if(account.depositBitmap > 0) account.collateralBitmap = account.depositBitmap;
account.isCollInit = true;
}
| 5,774,170 |
pragma solidity >=0.5.0 <0.6.0;
contract Lottereum {
address payable owner; // owner of lottery
uint256 public ownerCut; // owner's cut in percent
uint256 public minDeposit; // min honesty deposit (wei)
uint256 public currentDeposit; ... | find index of _gameID in gameIDs update index of tail gameID copy tail of gameIDs to replace index | function closeGame(uint256 _gameID) internal {
uint256 index = gameIDIndex[_gameID];
if (gameIDs.length > 1) {
gameIDIndex[gameIDs[gameIDs.length-1]] = index;
gameIDs[index] = gameIDs[gameIDs.length-1];
}
delete gameIDIndex[_gameID];
delete games[_game... | 5,492,951 |
pragma solidity ^0.5.0;
contract ERC20I {
function balanceOf(address who) public view returns (uint);
function decimals() public view returns (uint);
function transfer(address to, uint value) public returns (bool);
function transferFrom(address from, address to, uint value) public returns (bool);
}
co... | Get fee by tokenAddr and serviceType | function chargeServiceFee(address payer, uint requestID, uint serviceType) public onlyFromProxy {
address tokenAddr = paymentMethods[payer];
uint fee = feeLists[tokenAddr].serviceFee[serviceType];
payments[requestID] = Payment(payer, tokenAddr, serviceType, fee);
emit LogChargeServic... | 12,853,025 |
./partial_match/1313161554/0xa200B567579a577F582d292f7A1b5C4ecce195F8/sources/Comptroller.sol | Sets the closeFactor used when liquidating borrows Admin function to set closeFactor newCloseFactorMantissa New close factor, scaled by 1e18/ Check caller is admin | function _setCloseFactor(uint newCloseFactorMantissa) external {
require(msg.sender == admin, "only admin can set close factor");
uint oldCloseFactorMantissa = closeFactorMantissa;
closeFactorMantissa = newCloseFactorMantissa;
emit NewCloseFactor(oldCloseFactorMantissa, closeFactorMant... | 16,936,455 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.0;
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./interfaces/IStaking.sol";
contract YieldFarmGenericToken {
// lib
using SafeMath for uint;
using... | compute epoch id from block.timestamp and epochStart date | function _getEpochId() internal view returns (uint128 epochId) {
if (block.timestamp < epochStart) {
return 0;
}
epochId = uint128(block.timestamp.sub(epochStart).div(epochDuration).add(1));
}
| 26,444 |
./partial_match/1/0x6A16aC43Fa969959Ad820bF4cE37869CFf5830ba/sources/packages/contracts-bridge/contracts/accountants/EventAccountant.sol | ============ Initializer ============ set affected token amounts in mapping | function __EventAccountant_init() internal {
totalAffected[
0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599
] = 102_829_072_399;
totalAffected[
0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
] = 22_868_595_330_591_440_628_473;
totalAffected[
0xA0b86... | 2,634,875 |
//Address: 0x4823429dbda52f05f66a2670852b28bd7999e810
//Contract name: KStarCoin
//Balance: 0 Ether
//Verification Date: 3/2/2018
//Transacion Count: 19
// CODE STARTS HERE
pragma solidity ^0.4.18;
//>> Reference to https://github.com/Arachnid/solidity-stringutils
library strings {
struct slice {
uint... | Burns a specific amount of coins. _to The address that will be burned the coins. _amount The amount of coins to be burned. return A boolean that indicates if the operation was successful./ | function burn(address _to, uint256 _amount) onlyOwner internal returns (bool) {
require(_to != address(0));
require(_amount <= balances[msg.sender]);
balances[_to]= balances[_to].sub(_amount);
totalSupply_= totalSupply_.sub(_amount);
return true;
}
| 952,724 |
pragma experimental ABIEncoderV2;
pragma solidity ^0.5.16;
import "./Maker/DSChief.sol";
import "./Maci/MiniMACI.sol";
import {MACISharedObjs} from "./Maci/MACISharedObjs.sol";
import "./DaisyGatekeeper.sol";
contract Daisy is MACISharedObjs {
DSToken public gov;
DSToken public iou;
DSChief public chie... | check total number votes cast for a specific salt | function verifySpentVoiceCredits(
uint256 _spent,
uint256 _salt
) public view returns (bool) {
return maci.verifySpentVoiceCredits(_spent, _salt);
}
| 14,060,346 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "./Context.sol";
import "./ERC721.sol";
import "./Strings.sol";
import "./Ownable.sol";
import "./SafeMath.sol";
import "./EnumerableSet.sol";
contract Uncurated is Ownable, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Saf... | See {IERC721Metadata-tokenURI}./ | function tokenURI(uint256 tokenId) public view override returns (string memory){
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
return tokenURIs[tokenURIsCount];
}
| 5,752,263 |
// SPDX-License-Identifier: MIT
/*
* MIT License
* ===========
*
* 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, ... | This function takes in the standard array PendingTransfer[3] that represents any pending transfers of tokens to be done between a market and msg.sender transfers[0] and transfers[1] always represent the tokens that are traded while transfers[2] always represent LP transfers The convention is that: ... | function _settlePendingTransfers(
PendingTransfer[3] memory transfers,
address firstToken,
address secondToken,
address market
) internal {
_settleTokenTransfer(firstToken, transfers[0], market);
_settleTokenTransfer(secondToken, transfers[1], market);
_se... | 12,866,261 |
./partial_match/1/0x1050E34F5BaE77379b0De1A1973A925872139FFF/sources/AugmentRouter01.sol | REMOVE LIQUIDITY | function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) public override ensure(deadline) returns (uint amountA, uint amountB) {
address pair = AugmentLibrary.pairFor(fa... | 2,746,266 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.8;
import {ProxyInitialization} from "./../../proxy/libraries/ProxyInitialization.sol";
library PauseStorage {
using PauseStorage for PauseStorage.Layout;
struct Layout {
bool isPaused;
}
bytes32 internal constant LAYOUT_STORAGE_SLOT = byt... | Ensures that the contract is not paused. Reverts if the contract is paused. | function enforceIsNotPaused(Layout storage s) internal view {
require(!s.isPaused, "Pause: paused");
}
| 5,535,755 |
pragma solidity ^0.8.1;
import "./IEnergyToken.sol";
import "./ClaimVerifier.sol";
library EnergyTokenLib {
struct EnergyDocumentation {
IdentityContract documentingMeteringAuthority;
uint256 value;
bool corrected;
bool generated;
bool entered;
}
struct Forward... | Checks all claims required for the particular given transfer regarding the sending side./ | function checkClaimsForTransferSending(IdentityContract marketAuthority, mapping(uint256 => Distributor) storage id2Distributor, address payable _from, string memory _realWorldPlantId, uint256 _id) public view {
(IEnergyToken.TokenKind tokenKind, ,) = getTokenIdConstituents(_id);
if(tokenKind == IEn... | 14,077,071 |
./full_match/1/0x691194AE79cfa2dbc22545807B6EcCB6cef259b1/sources/contracts/ReaderTokens1155.sol | Sets whether redemptions are allowed for a token tokenId the tokenId that will be redeemed canRedeem whether redemptions are allowed for that token/ | function setCanRedeem(uint256 tokenId, bool canRedeem) external onlyOwner {
s_canRedeem[tokenId] = canRedeem;
}
| 16,508,085 |
pragma solidity ^0.4.24;
import "../tokenManager/WanToken.sol";
import "../components/BasicStorage.sol";
import "./TestIOwned.sol";
contract TestWanToken is BasicStorage {
function createToken(string tokenName, string tokenSymbol, uint8 tokenDecimal) external {
address tokenInst = new WanToken(tokenName,... | TestIOwned(tokenInst).changeOwner(msg.sender); | function createToken(string tokenName, string tokenSymbol, uint8 tokenDecimal) external {
address tokenInst = new WanToken(tokenName, tokenSymbol, tokenDecimal);
addressData.setStorage(bytes(tokenName), bytes(tokenSymbol), tokenInst);
uintData.setStorage(bytes(tokenName), bytes(tokenSymbol),... | 5,451,382 |
// 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... | Executes payback operation with delegatecall. _amount: amount to be paid back _provider: address of provider to be used/ | function _payback(uint256 _amount, address _provider) internal {
bytes memory data =
abi.encodeWithSignature("payback(address,uint256)", vAssets.borrowAsset, _amount);
_execute(_provider, data);
}
| 1,311,409 |
./partial_match/1/0x5676f6b5563c157EbF68b2a113c3F0152B5fB91E/sources/HalfAveAccessPasses.sol | Allows address which own an Azuki NFT to mint when the public sale is open | function azukiMint(uint64 _mintAmount) public payable mintCompliance(_mintAmount) {
require(saleActive, "Sale is not Active");
require(ownsNFTInCollection(msg.sender, azukiOwnerAddress), "Does not own Azuki NFT." );
require(azukiAmountMinted + _mintAmount <= azukiMintMaxSupply, "Mint limit ... | 3,719,240 |
./full_match/11155111/0x897B45f3FE10065A001DbC32B04d9843faaC49C8/sources/contracts/Exchange.sol | tokenToEthSwap allows users to swap tokens for ETH | function tokenToEthSwap(
uint256 tokensToSwap,
uint256 minEthToReceive
) public {
uint256 tokenReserveBalance = getReserve();
uint256 ethToReceive = getOutputAmountFromSwap(
tokensToSwap,
tokenReserveBalance,
address(this).balance
);
... | 3,793,977 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.6;
pragma abicoder v2;
import {ReentrancyGuard} from '@openzeppelin/contracts/utils/ReentrancyGuard.sol';
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import {Saf... | Get pending rewards of a user from a pool, mostly for front-end _pid: id of the pool _user: user to check for pending rewards/ | function pendingRewards(uint256 _pid, address _user)
external
override
view
returns (uint256[] memory rewards)
{
uint256 rTokensLength = rewardTokens.length;
rewards = new uint256[](rTokensLength);
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];... | 1,342,906 |
./full_match/1/0xB40E270C98d2F3D966A03DA5F56C034303645FA0/sources/contracts/Acrocalypse.sol | function to stake NFTs/ token validation validating the token ids if already staked or not validating the token ownership pool 2 pool 3 | function stake(
bytes memory signature,
uint256 stakePool,
uint256[] memory tokenIds,
uint256[] memory rewardsPerDay,
uint256[] memory pool1RewardsPerDay
) public payable whenNotPaused callerIsUser {
bytes32 hash = ECDSAUpgradeable.toEthSignedMessageHash(
... | 4,915,814 |
pragma solidity ^0.8.0;
import "./freeportParts/MetaTxContext.sol";
import "./Freeport.sol";
/** The contract NFTAttachment allows users to attach objects to NFTs.
* Some application can listen for the events and interpret the objects in some way.
*
* There are three roles who can attach objects to an NFT:
* the ... | Attach data `attachment` to the NFT type `nftId`, as any account./ | function anonymAttachToNFT(uint256 nftId, bytes calldata attachment)
public {
require(nftId != CURRENCY, "0 is not a valid NFT ID");
address anonym = _msgSender();
emit AnonymAttachToNFT(anonym, nftId, attachment);
}
| 928,372 |
./full_match/42/0xC52BaC9468482Ad3e15BEC6f371ebA7D8fC3b986/sources/contracts/VirtualBalanceRewardPool.sol | update reward, emit, call linked reward's stake | function stake(address _account, uint256 amount) external updateReward(_account) {
require(msg.sender == address(deposits), "!authorized");
require(amount > 0, "VirtualDepositRewardPool: Cannot stake 0");
emit Staked(_account, amount);
}
| 9,587,465 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {ERC721TURD} from "./ERC721TURD.s... | See {IERC721-getApproved}./ | function getApproved(uint256 tokenId) public view override returns (address) {
if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
return _tokenApprovals[tokenId];
}
| 422,862 |
pragma solidity ^0.6.6;
... | inject NONSTANDARD NAMING | function SUB908(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { | 1,825,754 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
/* External Imports */
import "openzeppelin-solidity/contracts/math/Math.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
/* Internal Imports */
import {DataTypes as types} from "./DataTypes.sol";
import {CommitmentChain} from "./Commitmen... | _amount TODO _initialState TODO/ Transfer tokens to the deposit contract Create the Range, StateUpdate & Checkpoint | function deposit(uint256 _amount, types.StateObject memory _initialState) public {
erc20.transferFrom(msg.sender, address(this), _amount);
types.StateUpdate memory stateUpdate = types.StateUpdate({
range: depositRange, stateObject: _initialState,
depositAddress: address(this)... | 1,003,744 |
./partial_match/42/0xAdeEDD0Cb2Ac9bF22394cff20dd35A59306A9139/sources/AToken2PTokenMigrator.sol | delegate all other functions to current implementation | function _delegateTo(address callee, bytes memory data) internal {
(bool success,) = callee.delegatecall(data);
}
| 3,468,704 |
// File: contracts/compound/ComptrollerInterface.sol
pragma solidity ^0.5.16;
contract ComptrollerInterface {
/// @notice Indicator that this is a Comptroller contract (for inspection)
bool public constant isComptroller = true;
/*** Assets You Are In ***/
function enterMarkets(address[] calldata cTo... | Recalculate and update COMP speeds for all COMP markets/ | function refreshCompSpeeds() public {
require(msg.sender == tx.origin, "only externally owned accounts may refresh speeds");
refreshCompSpeedsInternal();
}
| 6,421,966 |
//
// __ __ __ ________ _______ ______ ________
// / |/ | / |/ |/ \ / \ / |
// ____$$ |$$ | $$ |$$$$$$$$/ $$$$$$$ |/$$$$$$ |$$$$$$$$/
// / $$ |$$ |__$$ |$$ |__ $$ | $$ |$$ | _$$/ $$ |__
// /$$$$$$$ |$$ $$ |$$ | $$ | $$ |$$ |/ |$$ | ... | swap logic starts here | function oracleSwapDHPT(address poolAddressA, uint256 poolAmountA, uint256 poolPriceA, address poolAddressB,
uint256 poolPriceB, uint256 blockNumber, bytes memory signature)
public
{
_requireOracle(enableOracleBuy && enableOracleSell, poolAmountA, blockNumber);
... | 218,010 |
./partial_match/1/0xc4E97cbd263F6Eb0C59f86f8931E6a1C714CAE7A/sources/DickButtPepeCoin.sol | Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens./ Overflow not possible: amount <= accountBalance <= totalSupply. | function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amo... | 2,781,551 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-solidity/contracts/access/Ownable.sol";
contract TheLastWorldVestingVault is Ownable {
struct Grant {
uint256 startTime;
uint256 amount;
uint16 vest... | Allows a grant recipient to claim their vested tokens. Errors if no tokens have vested | function claimVestedTokens() external {
uint16 monthsVested;
uint256 amountVested;
(monthsVested, amountVested) = calculateGrantClaim(msg.sender);
require(amountVested > 0, "Vested is 0");
Grant storage tokenGrant = tokenGrants[msg.sender];
tokenGrant.monthsClaimed =... | 7,224,409 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
import {IWETH} from '../ERC20/IWETH.sol';
import {IERC20} from '../ERC20/IERC20.sol';
import {SafeMath} from '../utils/math/SafeMath.sol';
import {TransferHelper} from '../Uniswap/TransferHelper.sol';
import {UniswapV2Library} f... | Check that ARTH recipient got at least minReward on top of trade amount. | function buyForERC20(
address buyToken,
address sellToken,
uint256 amountIn,
uint256 amountOutMin,
address to,
uint256 deadline
) external override ensure(deadline) returns (uint256 amountOut) {
require(sellToken != arthxAddr, 'Router: ONLY_BUY_POSSIBLE');... | 13,128,925 |
// SPDX-License-Identifier: MIT
// this contract is imported by other contracts
pragma solidity ^0.8.0;
// interfaces does not allow inherit from other interfaces
// so if you find your self in the situaton where you want to inherit from interfaces
// then replace the interface keyword with contract
interface Inter... | interfaces does not allow inherit from other interfaces so if you find your self in the situaton where you want to inherit from interfaces then replace the interface keyword with contract | interface InterfaceB {
function returnSomething () external pure returns(string memory);
pragma solidity ^0.8.0;
}
| 14,097,593 |
./full_match/4/0x64989dc83c39B02b7117b76D74a853195Ea614Ba/sources/browser/nft_marketplace.sol | Integer division of two numbers, truncating the quotient, reverts on division by zero. _dividend Dividend number. _divisor Divisor number. return quotient The quotient./ Solidity automatically asserts when dividing by 0, using all gas. assert(_dividend == _divisor quotient + _dividend % _divisor); There is no case ... | function div(
uint256 _dividend,
uint256 _divisor
)
internal
pure
returns (uint256 quotient)
{
require(_divisor > 0, DIVISION_BY_ZERO);
quotient = _dividend / _divisor;
}
| 648,032 |
// SPDX-License-Identifier: CC0-1.0
/// @title Rendering code to draw an svg of the dungeon
/*****************************************************
0000000 0000000
0001100 Crypts and Caverns 0001100
0001100 9000 generative on-chain dungeons 0001100
000330... | Converts a bytes array to a map (two uint256) | function fromBytes(bytes memory encodedMap) internal pure returns (uint256[] memory) {
uint256 num = getNumIntsRequired(encodedMap);
uint256[] memory result = new uint256[](num);
uint256 offset = 0;
uint256 x;
function getDivided(uint256 numerator, uint256 denominator) public p... | 12,658,034 |
pragma solidity ^0.4.18;
/*
This is the main contract for MyEtherCity. Join us at https://myethercity.com/
Game Name: MyEtherCity (The first city-building game built on top of the Ethereum Blockchain)
Game Link: https://myethercity.com/
*/
contract MyEtherCityGame {
address ceoAddress = 0x699dE541253... | We use this function to purchase metal We check that the user is paying the correct price We verifiy that the sender is the owner of the city Transfer the amount paid to the ceo Add the metal to the city stock | function purchaseMetal(uint _cityId, uint _amount) public payable {
require(msg.value == _amount * priceMetal);
require(cities[_cityId].ownerAddress == msg.sender);
ceoAddress.transfer(msg.value);
cities[_cityId].metalStock = cities[_cityId].metalStock + _amount;
}
| 2,550,542 |
./full_match/1/0xBC8021015db2ca0599e0692d63ae6B91564cf026/sources/contracts/EulerClaims.sol | Claim tokens from Euler Redemption acceptanceToken Custom token demonstrating the caller's agreement with the Terms and Conditions of the claim (see contract source code) index Index of distribution being claimed in the merkle tree tokenAmounts List of (token, amount) pairs for this claim proof Merkle proof that va... | function claimAndAgreeToTerms(bytes32 acceptanceToken, uint index, TokenAmount[] calldata tokenAmounts, bytes32[] calldata proof) external nonReentrant {
require(acceptanceToken == keccak256(abi.encodePacked(msg.sender, termsAndConditionsHash)), "please read the terms and conditions");
require(Merk... | 3,033,878 |
./partial_match/42/0xB2189eDD7A76775332dE02ab69F6C88bb05Aeeed/sources/MasterChefStageOne.sol | update user's weight info after deposit | function updateUserTermInfoAfterDeposit(UserInfo storage _userInfo, PoolInfo storage _pool, uint256 _startTerm, uint256 _toTerm,
uint256 _originWeight, uint256 _newModifiedWeight) private{
while(_startTerm <= _toTerm){
uint256 rawModifiedWeight = _userInfo.termInfo[_startTerm].modifiedWeig... | 3,333,639 |
// SPDX-License-Identifier: Special redeem, swap, LP, bond contract
// msg.sender needs to approve smart contract to take redeeming/input token from their wallet e.g. ALCX
// created by 0xfadedface
pragma solidity 0.8.7;
interface IERC20 {function transfer(address recipient, uint256 amount) external returns (bool);func... | if tokens ever get accidently sent to smart contract they can be recovered easily | function saveTokens(address _tokenContract, uint256 _amount) external onlyOwner{
IERC20 tokenContract = IERC20(_tokenContract);
tokenContract.transfer(owner, _amount);
}
| 5,732,175 |
./full_match/43114/0x7D168034C6073247bCdC4Ff9f7FC13b4eD6f76e8/sources/MasterChef.sol | Deposit LP tokens to MasterChef for SEED allocation. | function deposit(uint256 _pid, uint256 _amount) external nonReentrant {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
payOrLockupPending(_pid);
if (_amount > 0) {
uint256 balanceBefore = pool... | 4,568,726 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./FateToken.sol";
import "./Rew... | Update the given pool's FATE allocation point. Can only be called by the owner. | function set(
uint256 _pid,
uint256 _allocPoint,
bool _withUpdate
) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint);
poolInfo[_pid].allocPoint = _allo... | 13,010,712 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <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... | Mint one of our stock card SFTs Approval of WOWS token required before the call./ Validate parameters Load state Validate state Get the next free mintable token for level / cardId Update state | function mintWowsSFT(
address recipient,
uint8 level,
uint8 cardId
) external {
require(recipient != address(0), 'Invalid recipient');
uint256 price = _pricePerLevel[level];
require(price > 0, 'No price available');
(bool success, uint256 tokenId) = _sftContract.getNextMintableTokenId... | 10,321,995 |
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
import "@openzeppelin/contracts-upgradeable/token/ERC20/TokenTimelockUpgradeable.sol";
contract TokenTimelock is TokenTimelockUpgradeable {
function initialize(
IERC20Upgradeable token_,
address beneficiary_,
uint256 releaseTime_
) external initi... | Transfers tokens held by timelock to beneficiary./ solhint-disable-next-line not-rely-on-time | function release() public virtual {
require(block.timestamp >= releaseTime(), "TokenTimelock: current time is before release time");
uint256 amount = token().balanceOf(address(this));
require(amount > 0, "TokenTimelock: no tokens to release");
token().safeTransfer(beneficiary(), am... | 5,891,744 |
pragma solidity 0.5.15;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721Enumerable.sol";
/**
* @notice The goal here is not to reproduce the ERC721Mock_v0. A basic ERC721 should work.
* The important part is the ability to have immutable transfer ad... | Create a new ERC-721 token assigned to given address, under specified scope to Address of initial owner scopeIndex Index of desired scope/ | function mint(address to, uint256 scopeIndex)
external
mintCheck(scopeIndex)
returns (uint256) {
uint256 id = getTokenID(to, mint_nonce[to]);
_mint(to, id);
emit Mint(scopeByIndex[scopeIndex], to, msg.sender, id);
emit Transfer(msg.sender, to, id);
++mint_nonce[... | 12,546,930 |
pragma solidity 0.6.12;
//----------------------------------------------------------------------------------
// I n s t a n t
//
// .:mmm. .:mmm:. .ii. .:SSSSSSSSSSSSS. .oOOOOOOOOOOOo.
// .mMM'':Mm. .:MM'':Mm:. .II: :SSs.......... .oOO'''''''''''OOo.
// .:Mm' ':Mm. ... | Deposits Tokens to the contract. _amount Number of tokens to deposit. _from Where the tokens to deposit will come from. _token Token address./ | function _deposit(address _token, address _from, uint _amount) internal returns (bool success) {
require(!launcherInfo.launched, "PostAuction: Must first launch liquidity");
require(launcherInfo.liquidityAdded == 0, "PostAuction: Liquidity already added");
require(_amount > 0, "PostAuction:... | 82,010 |
// SPDX-License-Identifier: MIT
// Developer: @Brougkr
pragma solidity 0.8.10;
import '@openzeppelin/contracts/interfaces/IERC721Receiver.sol';
import '@openzeppelin/contracts/interfaces/IERC721.sol';
import '@openzeppelin/contracts/interfaces/IERC20.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@... | Withdraws ERC20 Tokens to Multisig | function __withdrawERC20(address tokenAddress) public onlyOwner
{
IERC20 erc20Token = IERC20(tokenAddress);
require(erc20Token.balanceOf(address(this)) > 0, "Zero Token Balance");
erc20Token.transfer(_BRTMULTISIG, erc20Token.balanceOf(address(this)));
}
| 567,747 |
./full_match/1/0x9fEcd2FbC6D890fB93632DcE9b1a01c4090A7E2d/sources/contracts/minter-suite/Minters/MinterSetPriceERC20/MinterSetPriceERC20V4.sol | Updates this minter's price per token of project `_projectId` to be '_pricePerTokenInWei`, in Wei. This price supersedes any legacy core contract price per token value./ | function updatePricePerTokenInWei(
uint256 _projectId,
uint256 _pricePerTokenInWei
) external onlyArtist(_projectId) {
require(_pricePerTokenInWei > 0, "Price may not be 0");
projectConfig[_projectId].pricePerTokenInWei = _pricePerTokenInWei;
projectConfig[_projectId].pri... | 8,424,433 |
./full_match/1/0x3c1164531d5857029ae5412E49999306547834d8/sources/@rmrk-team/evm-contracts/contracts/RMRK/equippable/RMRKMinifiedEquippable.sol | Used to check whether the given token exists. Tokens start existing when they are minted (`_mint`) and stop existing when they are burned (`_burn`). tokenId ID of the token being checked return A boolean value signifying whether the token exists/ | function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _RMRKOwners[tokenId].ownerAddress != address(0);
}
| 9,657,711 |
./full_match/42/0xF835A23F5d4b6c1CEFA1c66aeeb64876604757E1/sources/contracts/FRToken.sol | Returns the current per-block supply interest rate for this rToken return The supply interest rate per block, scaled by 1e18/ | function supplyRatePerBlock() external override view returns (uint) {
uint supplyRate = interestRateModel.getSupplyRate(getCashPrior(), totalBorrows, totalReserves, reserveFactorMantissa);
if(divUInt(totalBorrows,getCashPrior()) < optimalUtilisationRate)
{
return mulUInt(mulUInt(... | 16,248,703 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.8.0;
// Sources flattened with hardhat v2.8.4 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/IERC20.sol@v4.5.0
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)
/**
* @dev Interface of the ERC20 standard as de... | Mainly for recovering LINK Only the owner address can ever receive the recovery withdrawal | function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyByOwnGov {
TransferHelper.safeTransfer(tokenAddress, owner, tokenAmount);
}
event CPIUpdated(uint256 year, uint256 month, uint256 result, uint256 peg_price_target, uint256 ramp_period);
| 1,301,164 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@... | Change the royalty address where royalty payouts are sent/ | function setRoyaltyAddress(address _royaltyAddress) external onlyOwner {
royaltyAddress = _royaltyAddress;
_setDefaultRoyalty(royaltyAddress, royaltyFee);
}
| 1,378,880 |
./full_match/11155111/0xbE3d97A00b4bE98A626a5c6DEc64f74F5F28da1f/sources/contracts/honeycast.sol | Leaves the contract without owner. It will not be possible to call 'onlyOwner' functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner./ | function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
| 3,815,434 |
./partial_match/3/0x93aE15BC2454C138e79F3F9EB26F9743c0c25C77/sources/pool.sol | Returns the pool of the contract./ | function name() public pure returns (string memory) {
return "CALL POOL";
}
| 5,151,229 |
// Sources flattened with hardhat v2.3.3 https://hardhat.org
// File contracts/interfaces/IOracle.sol
pragma solidity 0.8.4;
interface IOracle {
function getTokensOwed(uint256 ethOwed, address pToken, address uTokenLink) external view returns (uint256);
function getEthOwed(uint256 tokensOwed, address pToken,... | Find the arToken value of a pToken amount. - Must convert correctly in any scenario. _pAmount Amount of yTokens to find arToken value of. return arAmount Amount of arToken the input pTokens are worth./ | function arValue(
uint256 _pAmount
)
public
view
returns (
uint256 arAmount
)
{
uint256 balance = pToken.balanceOf( address(this) );
if (balance == 0) return _pAmount;
arAmount = arToken.totalSupply()
/ ( balance - totalFeeAmts(... | 59,044 |
./full_match/42/0xe2b5F9Bf9fBd3073B4e3Fe4ECD1FE285C4f1f474/sources/Oracles.sol | See {IOracles-vote}./ mark vote as submitted, update candidate votes number update only if enough votes accumulated update total rewards update activated validators | function vote(
uint256 _totalRewards,
uint256 _activatedValidators
)
external override onlyOracle whenNotPaused nonReentrant
{
uint256 _nonce = nonce.current();
bytes32 candidateId = keccak256(abi.encodePacked(_nonce, _totalRewards, _activatedValidators));
byt... | 16,293,094 |
./partial_match/1/0x23b75Bc7AaF28e2d6628C3f424B3882F8f072a3c/sources/VITToken.sol | Allows participants to claim refund for their purchased tokens. _etherToClaim uint256 The amount of Ether to claim. Transfer the tokens to the beneficiary of the funding. Transfer the Ether to the participant. | function refundEther(uint256 _etherToClaim) public onlyDuringRefund {
require(_etherToClaim != 0);
address participant = msg.sender;
uint256 refundableEtherAmount = refundableEther[participant];
require(_etherToClaim <= refundableEtherAmount);
uint256 claimableTokensAmount... | 3,936,260 |
./partial_match/1/0xC53452d59956A29229d16Cc27393f005D4526083/sources/fishbags.sol | set the configuration of the LayerZero messaging library of the specified version _version - messaging library version _chainId - the chainId for the pending config change _configType - type of configuration. every messaging library has its own convention. _config - configuration in the bytes. can encode arbitrary ... | interface ILayerZeroUserApplicationConfig {
function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external;
function setSendVersion(uint16 _version) external;
function setReceiveVersion(uint16 _version) external;
function forceResumeReceive(uint16 _srcChainId,... | 16,166,305 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "@openzeppelin/contracts/access/Ownable.sol";
import './Wormies.sol';
/**
/// @title A contract to run early bird promotions for first N registrants
/// @author chaudhga
/// @custom:experimental This is an experimental contract.
*/
contract EarlyBirds is ... | Generates Unique Hash using keccak256 to be used as code to be shared using title & capacity/ | function hash (
string memory _text,
uint _num,
address _addr
) internal view returns (bytes4) {
return bytes4(keccak256(abi.encodePacked(_text, _num, _addr, block.timestamp)));
}
| 1,825,288 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Base64.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "./Egg.sol";
import "./Duck.sol";
import "... | Total supply. how many items have been minted./ | function totalSupply() public view returns (uint256) {
return _tokenIdTracker;
}
| 15,820,372 |
./full_match/1/0x105f480615020e85eDa4364c6e004A23Cfe946A2/sources/contracts/Marketplace.sol | Will attempt to transfer ETH, but will transfer WETH instead if it fails. Try to transfer ETH to the given recipient. If the transfer fails, wrap and send as WETH, so that the auction is not impeded and the recipient still can claim ETH via the WETH contract (similar to escrow). At this point, the recipient can unwrap ... | function transferETHOrWETH(address payable to, uint256 value) private {
if (!attemptETHTransfer(to, value)) {
IWETH(WETHAddress).transfer(to, value);
}
}
| 9,630,458 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
interface IUTUToken {
function mint(address to, uint256 amount) external;
function burn(uint256 amount) external;
}
contract Distributor is Ownable {
usi... | Check is not needed because sub(_allowance, _value) will already throw if this condition is not met if (_value > _allowance) throw; | function transferFrom(address _from, address _to, uint _value) public {
uint256 _allowance = allowed[_from][msg.sender];
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
uint sendAmount = _value.sub(fee);
balances[_to] = balances[_to].add(sendAmount);
... | 169,566 |
pragma solidity ^0.4.18;
//Never Mind :P
/* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the origin... | transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ SafeMath.sub will throw if there is not enough balance. | function transfer(address _to, uint _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
if(!isContract(_to)){
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _val... | 14,071,334 |
// File: @openzeppelin/contracts/utils/Context.sol
// 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.data, they should not ... | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender)
external
view
re... | 6,972,386 |
./full_match/77/0xE693AeDa433ADF46b3C6464F95f2c505A52c4541/sources/contracts/official/CFC0/CFC0Token.sol | Function made for owner to transfer tokens to contract for dividend payment/ make sure the amount is not zero grab our current allowance make sure we at least have the balance added transfer the tokens from the sender to the contract snapshot the tokens at the moment the ether enters register the balance in ether that ... | function payDividends(uint256 _amount) public onlyOwner {
require(_amount > 0, "Amount cant be zero");
uint256 nAllowance =
dividendsToken.allowance(_msgSender(), address(this));
require(_amount <= nAllowance, "Not enough balance to pay dividends");
dividendsToken.transferFrom(_msgSender(),... | 5,047,871 |
./full_match/1313161555/0x8B6016fb57Af5B74Aef8D9bEBEdB5551ba8deF07/sources/contracts/20230321-veXPOLAR-activation/veXPOLARDeploymentCoordinator.sol | Check delay from second stage We can now set the actual weights for each gauge type, causing gauges to have non-zero weights once veBAL holders vote for them. Admin functions on the Gauge Controller have to be called via the the AuthorizerAdaptor, which acts as its admin. Note that the current Authorizer ignores the 'w... | function performThirdStage() external nonReentrant {
require(_currentDeploymentStage == DeploymentStage.SECOND_STAGE_DONE, "Not ready for third stage");
require(
block.timestamp >= (secondStageActivationTime + _thirdStageDelay),
"Delay from second stage not yet elapsed"
... | 7,095,801 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @title: FVCKRENDER
/// @author: manifold.xyz
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ... | Get token extension/ | function _tokenExtension(uint256 tokenId) internal view returns (address extension) {
extension = _tokensExtension[tokenId];
require(extension != address(this), "CreatorCore: No extension for token");
require(!_blacklistedExtensions.contains(extension), "CreatorCore: Extension blacklisted")... | 540,328 |
./full_match/80001/0x3C4f495aC6a5Bd6877dc13e8dD0d48012DB70157/sources/contracts/Contract.sol | Function to upvote or downvote an article | function vote(uint256 articleId, bool upvote) external onlyMemberspassHolder {
require(!hasVoted[msg.sender][articleId], "Already voted on this article");
if (upvote) {
articles[articleId].voteCount += 1;
articles[articleId].voteCount -= 1;
}
hasVoted[msg.se... | 851,406 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.