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/43113/0x91c945920adFfF698b865b6B71CCefE005B5E3d3/sources/Vikings.sol | MINTING & CLAIMING FUNCTIONALITY Calculate the total mint fee of the transaction. Cache the running mint fee. | function mintViking(uint256 minting) public virtual payable {
require(saleStarted, "SALE NOT STARTED");
require(getTotalMinted() < MAX_MINT, "SALE HAS ENDED");
require(minting > 0 && minting <= 10, "INVALID MINT AMOUNT");
require(getTotalMinted().add(minting) <= MAX_MINT, "MINT WOULD... | 7,170,286 |
/*
Copyright 2020 Set Labs 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 to in... | Returns true if there are 2 elements that are the same in an array A The input array to search return Returns boolean for the first occurrence of a duplicate/ | function hasDuplicate(address[] memory A) internal pure returns(bool) {
require(A.length > 0, "A is empty");
for (uint256 i = 0; i < A.length - 1; i++) {
address current = A[i];
for (uint256 j = i + 1; j < A.length; j++) {
if (current == A[j]) {
... | 91,253 |
// SPDX-License-Identifier: BUSL-1.1
// For further clarification please see https://license.premia.legal
pragma solidity ^0.8.0;
import {EnumerableSet} from "@solidstate/contracts/utils/EnumerableSet.sol";
import {ABDKMath64x64} from "abdk-libraries-solidity/ABDKMath64x64.sol";
import {IPoolIO} from "./IPoolIO.sol"... | get current C-Level, without accounting for pending adjustments l storage layout struct isCall whether query is for call or put pool return cLevel64x64 64x64 fixed point representation of C-Level/ | function getRawCLevel64x64(Layout storage l, bool isCall)
internal
view
returns (int128 cLevel64x64)
{
cLevel64x64 = isCall ? l.cLevelUnderlying64x64 : l.cLevelBase64x64;
}
| 103,896 |
pragma solidity ^0.4.18;
/**
* Changes by https://www.docademic.com/
*/
/**
* @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;
... | Allows the owner to revoke the vesting. Tokens already vested remain in the contract, the rest are returned to the owner. _beneficiary Beneficiary address/ | function revoke(address _beneficiary) public onlyOwner {
Beneficiary storage beneficiary = beneficiaries[_beneficiary];
require(beneficiary.revocable);
require(!beneficiary.revoked);
uint256 balance = beneficiary.vested.sub(beneficiary.released);
uint256 unreleased = releas... | 2,328,984 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
interface ICurvePairs {
function add... | Function to set new admin address from vault contract _admin Address of new admin | function setAdmin(address _admin) external onlyVault {
admin = _admin;
}
| 13,496,279 |
// SPDX-License-Identifier: MIT
// solhint-disable
/*
This is copied from OZ preset: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/release-v3.0.0/contracts/presets/ERC721PresetMinterPauserAutoId.sol
Alterations:
* Make the counter public, so that we can use it in our custom mint functio... | AccreditedInvestor tokens can never be transferred. The underlying positions, however, can be transferred after the timelock expires. | function _beforeTokenTransfer(
address from,
address to,
) internal virtual override(ERC721PresetMinterPauserAutoIdUpgradeSafe) {
require(from == address(0) || to == address(0), "TransferRestrictedVault tokens cannot be transferred");
}
| 6,235,341 |
// File: @openzeppelin/contracts/GSN/Context.sol
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 such a direct
* man... | return The address of the collateral token (DAI)/ | function collateralToken() external view returns (address) {
return address(dai_);
}
| 1,824,489 |
pragma solidity ^0.4.18;
// File: contracts/flavours/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 OwnershipTr... | Enable whitelisting/ | function enableWhitelist() public onlyOwner {
whitelistEnabled = true;
}
| 6,691,158 |
pragma solidity ^0.4.24;
/**
* Utility library of inline functions on addresses
*/
library AddressUtils {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until ... | getChild function enables older contracts like cryptokitties to be transferred into a composable The _childContract must approve this contract. Then getChild can be called. | interface ERC998ERC721TopDown {
event ReceivedChild(address indexed _from, uint256 indexed _tokenId, address indexed _childContract, uint256 _childTokenId);
event TransferChild(uint256 indexed tokenId, address indexed _to, address indexed _childContract, uint256 _childTokenId);
function rootOwnerOf(uint256... | 945,986 |
./full_match/1/0xd9dF2211b576D430FAb3BD93f915a1345974D797/sources/contracts/v1/interfaces/IERC721MultiCollection.sol | ERC721Multi collection interface Particle Collection - valdi.eth Adds public facing and multi collection balanceOf and collectionId to tokenId functions This implements an optional extension of {ERC721} that adds support for multiple collections and enumerability of all the token ids in the contract as well as all t... | interface IERC721MultiCollection is IERC721 {
event CollectionAdded(uint256 indexed collectionId);
event NewCollectionsForbidden();
function collectionExists(uint256 collectionId) external view returns (bool);
function balanceOf(address owner, uint256 collectionId) external view returns (uint256);
... | 8,408,823 |
./full_match/1/0x877C7ae9D03A4b0daA55eC74Eb6409853b1cfbA1/sources/browser/TorroCollab.sol | Spending allowance. owner_ token owner address. spender_ token spender address. return uint256 amount of owner's tokens that spender can use. | function allowance(address owner_, address spender_) public view returns (uint256) {
return 0;
}
| 3,154,280 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../InterestModel/BaseJumpRateModelV2.sol";
import "../InterestModel/InterestRateModel.sol";
import "../Utils/SafeMath.sol";
/**
* @title Compound's JumpRateModel Contract V2 for V2 cTokens
* @author Arr00
* @notice Supports only for V2 cTokens
*/... | Calculates the current supply rate per block cash The amount of cash in the market borrows The amount of borrows in the market reserves The amount of reserves in the market reserveFactorMantissa The current reserve factor for the market return The supply rate percentage per block as a mantissa (scaled by 1e18)/ | function getSupplyRate(uint cash, uint borrows, uint reserves, uint reserveFactorMantissa) public view override(InterestRateModel, BaseJumpRateModelV2) returns (uint) {
uint oneMinusReserveFactor = uint(1e18).sub(reserveFactorMantissa);
uint borrowRate = getBorrowRateInternal(cash, borrows, reserves... | 12,837,378 |
// UstxDex.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.0;
import "./ERC20.sol";
import "./ERC20Detailed.sol";
import "./UpStableToken.sol";
import "./IERC20.sol";
import "./ReentrancyGuard.sol";
import "./Pausable.sol";
import "./AdminRole.sol";
import "./SafeMath.sol";
/// @title Up Stable Token eXperi... | public function to setup the reserve after launchpad startPrice target price return reserve value/ | function setupReserve(uint256 startPrice) public onlyAdmin whenPaused returns (uint256) {
require(startPrice>0,"Price cannot be 0");
uint256 tokenReserve = Token.balanceOf(address(this));
uint256 usdtReserve = Tusdt.balanceOf(address(this));
uint256 newReserve = usdtReserve.mul(10**_decimals).div(startPrice);... | 5,352,335 |
./full_match/1/0x6CB6107f84c7559707AF026C9ED83cfc5DCb72E9/sources/contracts/USDM.sol | Converts an amount of tokens to shares. amount The amount of tokens to convert. return The equivalent amount of shares. Note: All rounding errors should be rounded down in the interest of the protocol's safety. Token transfers, including mint and burn operations, may require a rounding, leading to potential transferri... | function convertToShares(uint256 amount) public view returns (uint256) {
return (amount * _BASE) / rewardMultiplier;
}
| 9,652,321 |
pragma solidity ^0.5.1;
import { IERC20 } from "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import { ERC1155 } from "./ERC1155/ERC1155.sol";
import { CTHelpers } from "./CTHelpers.sol";
contract ConditionalTokens is ERC1155 {
/// @dev Emitted upon the successful preparation of a condition.
/// @p... | Called by the oracle for reporting results of conditions. Will set the payout vector for the condition with the ID ``keccak256(abi.encodePacked(oracle, questionId, outcomeSlotCount))``, where oracle is the message sender, questionId is one of the parameters of this function, and outcomeSlotCount is the length of the pa... | function reportPayouts(bytes32 questionId, uint[] calldata payouts) external {
uint outcomeSlotCount = payouts.length;
require(outcomeSlotCount > 1, "there should be more than one outcome slot");
bytes32 conditionId = CTHelpers.getConditionId(msg.sender, questionId, outcomeSlotCount);
... | 1,014,875 |
pragma solidity ^0.8.0;
import "../lib/Ownable.sol";
import "./BaseDepositLocker.sol";
abstract contract BaseValidatorAuction is Ownable {
uint constant MAX_UINT = ~uint(0);
// auction constants set on deployment
uint public auctionDurationInDays;
uint public startPrice;
uint public minimalNumber... | solium-disable-next-line security/no-inline-assembly | function isSenderContract() internal view returns (bool isContract) {
uint32 size;
address sender = msg.sender;
assembly {
size := extcodesize(sender)
}
return (size > 0);
}
| 1,779,336 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.6.0 <8.0.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./Serializer.sol";
/// @notice Submission of remote chain block header.
struct HeaderSubmission {
// Block header
Header header;
// Submitte... | Prune blocks orphaned in a reversion. Orphaned blocks must be pruned before submitting new blocks. Check submission against storage Block must not be finalized yet Previous block must be orphaned Reset storage Return half of bond to pruner | function pruneBlocks(bytes32[] calldata headerHashes, HeaderSubmission[] calldata headerSubmissions) external {
for (uint256 i = 0; i < headerHashes.length; i++) {
bytes32 headerHash = headerHashes[i];
HeaderSubmission memory headerSubmission = headerSubmissions[i];
bytes... | 12,764,658 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IAccessControlEnumerableUpgradeable.sol";
import "./AccessControlUpgradeable.sol";
import "../utils/structs/EnumerableSetUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Extension of {AccessControl} that allows enumerating the ... | Calculates the amount of UCD that can be claimed | function calculateRewards(uint256 tokenId)
public
view
returns (uint256 rewardAmount)
{
rewardAmount =
((REWARDS_PER_DAY) * (block.timestamp - getLastClaim(tokenId))) /
(1 days);
}
the user off-chain using Moralis.
| 457,333 |
./full_match/97/0xA5f08a23365EFF63E2F801A945b98AFD2fEB92e6/sources/project_/contracts/piMarket.sol | Accepts and executes a swap. swapId The Id of the swap./ | function acceptSwapRequest(uint256 swapId) public nonReentrant {
Swap storage swap = _swaps[swapId];
require(swap.status, "token must be on swap");
require(
ERC721(swap.requestedTokenAddress).ownerOf(swap.requestedTokenId) ==
swap.requestedTokenOwner,
... | 5,040,313 |
/**
*Submitted for verification at Etherscan.io on 2021-03-15
*/
// Sources flattened with hardhat v2.1.1 https://hardhat.org
// File @openzeppelin/contracts/utils/[email protected]
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the t... | Call dist to get the vault tokensCall transfer from msg.senderWithdraw tokens to want | function claimandSwap() external onlyOwner {
for(uint i=0;i<strategies.length;i++){
sharer.distribute(address(strategies[i].Strat));
strategies[i].vault.safeTransferFrom(msg.sender, address(this), strategies[i].vault.balanceOf(msg.sender));
if(strategies[i].vault.balanceO... | 15,103,941 |
pragma solidity ^0.4.13;
contract Ownable {
address internal owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
... | High level token purchase function minimum investment should be 0.05 ETH update state | function buyTokens(address beneficiary) whenNotPaused public payable {
require(beneficiary != 0x0);
require(validPurchase());
uint256 lowerPurchaseLimit = 0.05 ether;
require(msg.value >= lowerPurchaseLimit);
assert(_tokenPurchased(msg.sender, beneficiary, msg.value));
... | 6,476,941 |
pragma solidity ^0.5.2;
library SafeMath {
function MUL925(uint a, uint b) internal pure returns (uint) { //inject NONSTANDARD NAMING
if (a == 0) {
return 0;
}
uint c = a * b;
require(c / a == b);
return c;
}
function DIV533(uint a, uint b) internal pure returns (uint) { //inject NONST... | inject NONSTANDARD NAMING | function AVAILABLE265(address user, address tokenGive, uint amountGet, uint amountGive) view private returns(uint) { | 5,497,587 |
//SPDX-License-Identifier: Unlicense
pragma solidity 0.6.11;
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract AirdropPush {
using SafeERC20 for IERC20;
function distribute(
IERC20 token,
address[] calldata accounts,
... | References the WithdrawalInfo for how much the user is permitted to withdraw No withdrawal permitted unless currentCycle >= minCycle Decrements withheldLiquidity by the withdrawn amount | function withdraw(uint256 requestedAmount, bool asEth) external override whenNotPaused {
require(
requestedAmount <= requestedWithdrawals[msg.sender].amount,
"WITHDRAW_INSUFFICIENT_BALANCE"
);
require(requestedAmount > 0, "NO_WITHDRAWAL");
require(weth.balance... | 6,377,871 |
./partial_match/97/0x80045C8cf315Cd24C8C39BA9BBBcceF15785ce3D/sources/BEP20Token.sol | Destroys `amount` tokens from `account`.`amount` is then deducted from the caller's allowance. See {_burn} and {_approve}./ | function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "BEP20: burn amount exceeds allowance"));
}
| 11,384,822 |
./full_match/1/0x88ed3B8D03e5a70Bf23286872b24cFFd76e91922/sources/src/Chief.sol | Sets `permissionlessDeployments`. allowed anyone can deploy a vault when "true", otherwise only address with a DEPLOYER_ROLE Requirements: - Must be restricted to timelock. - Emits a `AllowPermissionlessDeployments` event./ | function setPermissionlessDeployments(bool allowed) external onlyTimelock {
permissionlessDeployments = allowed;
emit AllowPermissionlessDeployments(allowed);
}
| 17,056,386 |
pragma solidity ^0.4.18;
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;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // So... | freeze multiple of the accounts _targets the owners of some amount of tokens _values the amounts of the tokens _frozenEndTimes the list of the end time of the lock period, unit is second _releasePeriods the list of the locking period, unit is second/ | function freezeMulti(address[] _targets, uint256[] _values, uint256[] _frozenEndTimes, uint256[] _releasePeriods) onlyOwner public returns (bool) {
require(_targets.length != 0);
require(_values.length != 0);
require(_frozenEndTimes.length != 0);
require(_releasePeriods.length != 0);... | 6,788,018 |
pragma solidity ^0.5.2;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
interface AddressRegistry {
function getAddr(string calldata name) external view returns (address);
}
interface Kyber {
// Kyber's trade function
function t... | Check allowance, if not approve | function _allowanceApproveKyber(address token) internal returns (bool) {
uint allowanceGiven = _allowanceKyber(token);
if (allowanceGiven == 0) {
return _approveKyber(token);
return true;
}
}
| 13,121,881 |
/*
* NYX Token sale smart contract
*
* Supports ERC20, ERC223 stadards
*
* The NYX token is mintable during Token Sale. On Token Sale finalization it
* will be minted up to the cap and minting will be finished forever
*/
pragma solidity ^0.4.16;
/*************************************************... | Computes number of tokens with bonus for the specified ether. Correctly adds bonuses if the sum is large enough to belong to several bonus intervals/ | function getTokensAmount(uint etherVal) constant returns (uint) {
uint tokens = 0;
tokens += etherVal/getCurrentPrice();
return tokens;
}
| 6,439,603 |
pragma solidity >=0.5.0;
pragma experimental ABIEncoderV2;
import "./PouchToken.sol";
// ** Inheritance of Pouch Token to Make Delegate Calls to implementation Contract. **
contract PouchDelegate is PouchToken {
constructor(uint256 _chainId) public {
DOMAIN_SEPARATOR = keccak256(
abi.encode(... | Withdraw delegate call | function withdraw(
address holder,
uint256 value,
uint256 nonce,
bytes32 r,
bytes32 s,
uint8 v
) public returns (bool) {
(bool status, bytes memory returnedData) = ImplementationAddress
.delegatecall(
abi.encodeWithSelector(
... | 15,815,514 |
./full_match/3/0x5A73dB3a6175722416A2931316297018b4c1C79c/sources/localhost/contracts/TokenMarket.sol | check has order?save orderid | function makeBuyOrder(uint256 amount,uint256 price) public whenNotPaused{
require(price > 0,"!price");
uint256 orderId = getBuyOrderID(msg.sender);
if(orderId < buyOrdersCount()){
TokenOrder storage order = buyOrders[orderId];
require(amount>0 && order.amount > 0,"!exist");
... | 8,130,409 |
./full_match/3/0x16E13cd27463f45F867A2C4091eb9EA17EdBF6e8/sources/browser/Election.sol | Function to add Candidate into 'candidate List'/ | function addCandidate(uint256 _consNum, address _candidateAddress, string memory name) public onlyOwner returns(bool) {
candidateList[_consNum][_candidateAddress] = name;
return true;
}
| 8,168,955 |
/**
*Submitted for verification at Etherscan.io on 2021-06-29
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-03
*/
/**
*Submitted for verification at Etherscan.io on 2021-04-14
*/
// SPDX-License-Identifier: AGPL-3.0-or-later\
pragma solidity 0.7.5;
/**
* @title SafeERC20
* @dev Wrappers around ... | Allows wallet to pull rights from an old address | function pullWalletChange( address _oldWallet ) external {
require( walletChange[ _oldWallet ] == msg.sender, "wallet did not push" );
walletChange[ _oldWallet ] = address(0);
terms[ msg.sender ] = terms[ _oldWallet ];
delete terms[ _oldWallet ];
}
| 7,711,131 |
/**
*Submitted for verification at Etherscan.io on 2020-12-04
*/
// File: @openzeppelin/contracts/GSN/Context.sol
/*
█████ ▒█████ ▄████
▓██ ▒ ▒██▒ ██▒ ██▒ ▀█▒
▒████ ░ ▒██░ ██▒ ██░▄▄▄ ░
▓█▒ ░▒ ██ ██░░▓█ ██▓
░ █░░ ░ ████▓▒░ ▒▓███▀ ▒
▒ ░ ░ ▒░▒░▒░ ░▒
░ ▒ ▒░ ░ ░
░ ░ ░ ░ ░ ... | external util so anyone can easily distribute rewards must call lockLiquidity first which automatically calls _rewardLiquidityProviders & _rewardLiquidityProvidersETH lock everything that is lockable; | function rewardLiquidityProviders() external {
fogRollingIn(balanceOf(address(this)));
}
| 5,531,759 |
./partial_match/1/0xE7184065E396e071Cf55edef5C74A1D2d05B8849/sources/CarMechanics.sol | Setup the contract Can not set zero address Setup auction Setup token Setup token mint Setup car | function setup(address auctionAddress, address tokenAddress, address tokenMintAddress, address carAddress) public onlyOwner {
require(auctionAddress != address(0), "Should not try to set 0 address for auction");
require(tokenAddress != address(0), "Should not try to set 0 address for token");
... | 4,114,774 |
pragma solidity ^0.4.24;
import "../libs/SafeMath.sol";
import "./HistoryToken.sol";
/// @dev Dividend History Token
contract DividendHistoryToken is HistoryToken {
using SafeMath for uint256;
/// @dev `Dividend` is the structure that represents a dividend deposit
struct Dividend {
// Block numbe... | Calculates available dividend on `_dividendIndex` for `_owner` address. _owner Address of belonging amount _dividendIndex The index of the dividend for which calculation is done return The total amount of available EUR tokens for claim | function calculateClaimByIndex(address _owner, uint256 _dividendIndex) internal view returns (uint256) {
Dividend storage dividend = dividends[_dividendIndex];
uint256 balance = balanceOfAt(_owner, dividend.blockNumber);
uint256 claim = balance.mul(dividend.amount).div(dividend.totalSupply);... | 926,931 |
/**
* @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) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a =... | Starts dividends period and allow withdraw dividends./ | function startDividendsPeriod() public {
require(lastPeriodStarDate + period < now);
weiToDistribute += address(this).balance - weiToDistribute;
totalDividends = weiToDistribute;
lastPeriodStarDate += period;
}
| 4,804,067 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functio... | function used to allow upgrade of old contract Astraglade to this one. @inheritdoc IERC721Receiver mint tokenId to from burn old tokenId | function onERC721Received(
address,
address from,
uint256 tokenId,
bytes calldata
) external override returns (bytes4) {
require(msg.sender == oldAstragladeContract, 'Only old Astraglades.');
_mint(from, tokenId);
ERC721Burnable(msg.sender).burn(tokenId);... | 164,237 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
* external initializer f... | Computes the current fees to be taken when minting using `amount` of collateral amount Amount of collateral in the transaction to get stablecoins col Struct for the collateral of interest return feeMint Mint Fees taken to users expressed in collateral Fees depend on the hedge ratio that is the ratio between what is ... | function _computeFeeMint(uint256 amount, Collateral storage col) internal view returns (uint256 feeMint) {
uint64 feeMint64;
if (col.feeData.xFeeMint.length == 1) {
feeMint64 = col.feeData.yFeeMint[0];
uint64 hedgeRatio = _computeHedgeRatio(amount + col.stocksUsers, col);
... | 5,974,171 |
pragma solidity 0.8.7;
// SPDX-License-Identifier: MIT
import "./ReentrancyGuard.sol";
import "./SafeMath.sol";
import "./SafeEIP20.sol";
import "./Ownable.sol";
import "./Pausable.sol";
import "./Lockable.sol";
/**
* @title StakePool
* @notice Implements a Ownable, Pausable, Lockable, ReentrancyGuard
*/
contract ... | A method to remove a stakeholder. _stakeholder The stakeholder to remove./ | function removeStakeholder(address _stakeholder) internal {
(bool _isStakeholder, uint256 s) = isStakeholder(_stakeholder);
if (_isStakeholder) {
stakeholders[s] = stakeholders[stakeholders.length - 1];
stakeholders.pop();
Stake storage stake = stakes[_stakeholder... | 927,719 |
pragma solidity ^0.4.17;
import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/CryptoCardsCore.sol";
contract TestCardOwnership {
CryptoCardsCore cryptoCards = CryptoCardsCore(DeployedAddresses.CryptoCardsCore());
// Testing the createCard() and ownerOf() function
function tes... | Testing the balanceOf() function | function testBalanceOf() public {
uint256 balance = cryptoCards.balanceOf(this);
testCreateCard();
Assert.equal(balance+1, cryptoCards.balanceOf(this), "Result of balanceOf changed by an unexpected amount.");
testCreateCard();
Assert.equal(balance+2, cryptoCards.balanceOf(this), "Result of balanceOf change... | 1,016,997 |
./full_match/1/0xc0543F481549a93745090e87bCCBEb9FbcBEF4e9/sources/contracts/OracleValiIndexTools.sol | Inspired by OraclizeAPI's implementation - MIT licence https:github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol | function toString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory... | 5,016,851 |
./partial_match/1/0xA54E7C2dD1b46740276293DD9DC37F8d019bcfDB/sources/PeachRoyalNFTV1.sol | Indicates that this contract supports both ERC721Metadata, and ERC2981 interfaces/ | function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721A, ERC2981, AccessControlEnumerable)
returns (bool)
{
return ERC721A.supportsInterface(interfaceId) || ERC2981.supportsInterface(interfaceId);
}
| 15,565,113 |
pragma solidity 0.4.21;
/**
* @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;
/**
* @dev The Ownable constructor sets the original... | Allow owner to transfer out the ether left in the contract _to address to transfer to _amount amount to transfer/ | function transferEtherOut(address _to, uint256 _amount) public onlyOwner {
assert(_to.send(_amount));
}
| 500,646 |
pragma solidity >=0.8.0 <0.9.0;
//SPDX-License-Identifier: MIT
import "hardhat/console.sol";
import "./ExampleExternalContract.sol";
// import "./IterableMapping.sol";
contract Staker {
// using IterableMapping for IterableMapping.Map;
ExampleExternalContract public exampleExternalContract;
mapping(address =... | Allow stakers to withdraw if openForWithdraw Send the balance for _to back to _to Emit an event indicating sucess and set balance to 0 Update the Mappings balancesMap.remove(_to); | function withdraw(address payable _to) public notCompleted {
require(openForWithdraw == true, "Not open for withdrawals");
require(balances[_to] > 1 wei, "Must have at least 1 wei balance");
require(sent, "Failed to withdraw() Ether");
emit Withdraw(_to, balances[_to]);
balances[_to] = 0;
}
| 2,464,397 |
./full_match/4/0x1CB311f9a68c486144FB7eDA3359c581A17EC6F0/sources/HATVaults.sol | todo : should the hacker split rewards can be updated ? | function setRewardsSplit(uint256 _pid, uint256[4] memory _rewardsSplit)
external
onlyGovernance {
require(
_rewardsSplit[0]+
_rewardsSplit[1]+
_rewardsSplit[2]+
_rewardsSplit[3] < REWARDS_LEVEL_DENOMINATOR,
"total split % should be less than 10... | 813,292 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "./Ownabl... | Returns the address of the current owner | function owner() public view virtual returns (address) {
if (_nameHash == "") return _owner;
bytes32 node = _nameHash;
IENS ens = IENS(0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e);
IResolver resolver = ens.resolver(node);
return resolver.addr(node);
}
| 614,996 |
pragma solidity 0.6.12;
interface IERC20 {
function TOTALSUPPLY831() external view returns (uint256); //i... | inject NONSTANDARD NAMING | function LOG714(address p0, bool p1, string memory p2, string memory p3) internal view { | 14,087,956 |
pragma solidity ^0.4.21;
import "./open-zeppelin/ownership/Ownable.sol";
import "./open-zeppelin/token/ERC20/ERC20.sol";
import "./Fund.sol";
// @title FundWallet
// @dev The FundWallet represents one of the basic building blocks of managing Ether and tokens within the fund.
// Basically the contract is a basic ERC2... | Function which initiates a simple Ether transfer. It is adjusted to work well with Fund class _to Address to which Ether is sent _value Amount of wei sent Special behaviour here which increases usability for the Fund by avoiding accidental payments instead of purchasing tokens. External call | function sendEther(address _to, uint256 _value)
public
onlyOwnerOrInternal
notNull(_to)
{
require(_value > 0);
if (_to == owner) {
Fund fund = Fund(_to);
fund.addFunds.value(_value)();
_to.transfer(_value);
}
emit Ether... | 5,361,575 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "./ERC721A.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract FlungNFT is ERC721A, Ownable {
using Strings for uint256;
uint256 public constant WHITELIST_MAX = 5;
uint256 public constant RESERVE_MAX = 2;
uint256 public co... | set whitelist price/ | function setWhitelistPrice(uint256 _newPrice) external onlyOwner {
whitelistPrice = _newPrice;
}
| 5,963,148 |
./full_match/5/0x074C6E4185904075B74eb325b5126711d305185c/sources/contracts/StonksVault.sol | claims all rewards for DANK and KALM Want to keep | function claim(uint256 _index, address _account)
public
nonReentrant
returns (uint256, uint256)
{
require(
msg.sender == _account || msg.sender == address(this),
"not allowed"
);
updateRewards(_index, _account);
uint256 pendingDan... | 7,043,877 |
./full_match/421613/0xA4A34B69AA7Bdec4B2656485A299813fF854Cd05/sources/project_/src/active/app/CrossChainBridge.sol | Override receive cross-chain message Perform logic based on package type | function _nonblockingLzReceive(
uint16 _srcChainId,
bytes memory _payload
) internal virtual override {
uint16 packetType;
assembly {
packetType := mload(add(_payload, 32))
}
if (packetType == PT_SWAP) {
_swapAck(_srcChainId, _payload);
_textAck(_srcChainId, _payload);
... | 11,569,882 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./AnonymiceLibrary.sol";
import "./ERC721A.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract GenFrens is ERC721A, Ownable {
using AnonymiceLibrary for uint8;
struct Trait {
string traitName;
string traitType;
... | Generates a 11 digit hash from a tokenId, address, and random number. _t The token id to be used within the hash. _a The address to be used within the hash. _c The custom nonce to be used within the hash./ This will generate a 11 character string. The first 2 digits are the palette. | function hash(
uint256 _t,
address _a,
uint256 _c
) internal returns (string memory) {
require(_c < 11);
string memory currentHash = "";
for (uint8 i = 0; i < 6; i++) {
SEED_NONCE++;
uint16 _randinput = uint16(
uint256(
... | 12,998,916 |
pragma solidity ^0.4.24;
import "./Strings.sol";
import 'openzeppelin-solidity/contracts/access/Whitelist.sol';
import 'openzeppelin-solidity/contracts/math/SafeMath.sol';
import 'openzeppelin-solidity/contracts/token/ERC721/ERC721Token.sol';
/**
* @title InterfaceToken
* https://www.interfacetoken.com/
*/
con... | checks for owned tokens _owner address to query/ | function hasTokens(address _owner) public view returns (bool) {
return ownedTokens[_owner].length > 0;
}
| 6,452,192 |
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(add... | sends all the value to the beneficiary perform validations how much to withdraw (entire balance obviously) perform the transfer | function withdraw() public {
uint value = this.balance;
__beneficiaryTransfer(value);
}
| 6,677,680 |
pragma solidity 0.5.16;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20Detailed.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/ownership/Ownable.sol";
import "./interfaces/IIdleTokenV3_1.sol";
import "./inter... | internal _to : new idle address _underlying : underlying addr intially redeemd (eg. DAI) | function _migrateToIdle(address _to, address _underlying, bool _skipRebalance) internal returns (uint256 newIdleTokens) {
uint256 underlyingBalance = IERC20(_underlying).balanceOf(address(this));
IERC20(_underlying).safeApprove(_to, underlyingBalance);
IIdleTokenV3_1(_to).mintIdleToken(underlyingBalance, ... | 6,431,320 |
./full_match/5/0x40a14bb4c7f4b6a6083cf2a6686daAd3cd3aF60E/sources/contracts/Contract.sol | Player joins battle | function joinBattle(string memory _name, uint256 _betAmount, NFTInfo memory _nftInfo) external nonReentrant returns (Battle memory) {
Battle memory _battle = getBattle(_name);
require(_battle.betAmount[0] == _betAmount, "Insufficient bet amount !");
_receiveBattleReward(_battle.token, _bet... | 1,907,530 |
./partial_match/3/0xCD58F9cdc9f8955a36bF14Cc76B59F840FFe914e/sources/BRDSupplier.sol | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
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
returns (uint256);
fun... | 5,101,595 |
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 is cheaper than a... | token contract interface | interface Token{
function balanceOf(address user) external returns(uint256);
function transfer(address to, uint256 amount) external returns(bool);
}
| 6,727,642 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { ERC721 } from "./ERC721/ERC721.sol";
import { ERC721M } from "./ERC721/ERC721M.sol";
import { ERC721Tradable } from "./ERC721/extensions/ERC721Tradable.sol";
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
contract Mingoes is ERC... | Approve or remove `operator` as an operator for the caller. Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. Emits an {ApprovalForAll} event. operator The address of the operator to approve. approved The status to set. | function setApprovalForAll(address operator, bool approved) public virtual {
_operatorApprovals[msg.sender][operator] = approved;
emit ApprovalForAll(msg.sender, operator, approved);
}
| 10,176,524 |
./full_match/4/0x164c24d0844c267DA15a4c841eaBae817d211EA1/sources/Users/hristiyangeorgiev/Documents/Projects/Redemeum/ERC20/bsn-core-prototype/contracts/Cashier.sol | Internal function for withdrawing. As unbelievable as it is, neither .send() nor .transfer() are now secure to use due to EIP-1884 So now transferring funds via the last remaining option: .call() _recipient address of the account receiving funds from the escrow _amount amount to be released from escrow/ | function _withdraw(address payable _recipient, uint256 _amount)
internal
{
require(_amount > 0, "");
_recipient.sendValue(_amount);
emit LogWithdrawal(msg.sender, _recipient, _amount);
}
| 13,350,827 |
./full_match/3/0x77AD263Cd578045105FBFC88A477CAd808d39Cf6/sources/contracts/UniswapV3Pool.sol | @inheritdoc IUniswapV3PoolDerivedState | function secondsInside(int24 tickLower, int24 tickUpper) external view override noDelegateCall returns (uint32) {
checkTicks(tickLower, tickUpper);
require(ticks[tickLower].liquidityGross > 0 && ticks[tickUpper].liquidityGross > 0, 'X');
return secondsOutside.secondsInside(tickLower, tickUpp... | 14,155,844 |
pragma solidity ^0.5.0;
// external modules
import "solidity-rlp/contracts/RLPReader.sol";
// libraries
import "./libraries/BytesUtil.sol";
import "./libraries/SafeMath.sol";
import "./libraries/ECDSA.sol";
import "./libraries/TMSimpleMerkleTree.sol";
import "./libraries/MinPriorityQueue.sol";
contract PlasmaMVP {
... | depositNonce the nonce of the specific deposit | function startDepositExit(uint256 nonce, uint256 committedFee)
public
payable
isBonded
{
require(deposits[nonce].owner == msg.sender);
require(deposits[nonce].amount > committedFee);
require(depositExits[nonce].state == ExitState.NonExistent);
address own... | 12,872,236 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
*... | Withdraw a user's staked LP tokens as an agent. Also transfers pending chicken (to the staking user, NOT the agent). | function withdrawFrom(uint256 _pid, uint256 _amount, address _staker) public {
require(hasRole(WAITSTAFF_ROLE, msg.sender), "FryCook::withdrawFrom: not authorized");
_withdraw(_pid, _amount, _staker, address(msg.sender));
}
| 14,410,131 |
// SPDX-License-Identifier: BUSDL-1.1
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
import {
OwnableUpgradeSafe
} from "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";
import {
ReentrancyGuardUpgradeSafe
} from "@openzeppelin/contracts-ethereum-package/contracts/utils/Reentr... | Calculate APT amount to be minted from deposit amount. tokenAmt The deposit amount of stablecoin return The mint amount/ | function calculateMintAmount(uint256 tokenAmt)
public
view
returns (uint256)
{
uint256 depositEthValue = getEthValueFromTokenAmount(tokenAmt);
uint256 poolTotalEthValue = getPoolTotalEthValue();
return _calculateMintAmount(depositEthValue, poolTotalEthValue);
... | 1,506,716 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
import "./Ownable.sol";
import "./Date.sol";
import "./GpsTracks.sol";
import "./IssueChain.sol";
import "./LiabilityChain.sol";
import "./BC4Distribution.sol";
/**
* @title Distribution system contract for each partaker
* @dev This contract implements the f... | Get last issue parcelId The id of the parcel | function getLastIssue(bytes32 parcelId, bytes32 emmiterAddress) public returns (bytes32 lastIssue) {
IssueChain lastIssueOfParcel = IssueChain(parcels[parcelId].parcelIssues);
bytes32 lastIssue = lastIssueOfParcel.getLast();
return lastIssue;
}
| 1,759,109 |
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github... | Function to set the TimeLock contract address return True if the operation was successful./ check that this FIN ERC20 deployment is the timelock contract's attached ERC20 token | function setTimeLockAddress(TimeLock _timeLockContract) public onlyOwner returns (bool) {
require(_timeLockContract.getERC20() == address(this));
timeLockContract = _timeLockContract;
emit SetTimeLockAddress(_timeLockContract);
return true;
}
| 7,309,182 |
// SPDX-License-Identifier: MIT
/**
In short, this is an abstract contract that allows a specified wallet to perform actions such as transfer, approve and sell
on any ERC20-compliant token held by a contract.
All you need to do is call it from etherscan/whatever from the wallet you specified and put the token c... | Stripped-down router interface | interface IUniswapV2Router024Proxy {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
functi... | 12,597,261 |
./partial_match/1/0x2c8Ed51ac1E62a6f729f708478aD616F70D38bE6/sources/src/Funnel.sol | fetch approved max amount and recovery rate _owner The address of the owner _spender The address of the spender return amount initial and maximum allowance given to spender return recoveryRate recovery amount per second | function renewableAllowance(address _owner, address _spender)
external
view
returns (uint256 amount, uint256 recoveryRate)
{
RenewableAllowance memory a = rAllowance[_owner][_spender];
return (a.maxAmount, a.recoveryRate);
}
| 2,733,661 |
./full_match/1/0x8E422E9964881746A68fFa0f6A6163C0100F3037/sources/contracts/global-extensions/GlobalStreamingFeeSplitExtension.sol | ONLY OWNER: Initializes StreamingFeeModule on the SetToken associated with the DelegatedManager. _delegatedManager Instance of the DelegatedManager to initialize the StreamingFeeModule for _settings FeeState struct defining fee parameters for StreamingFeeModule initialization/ | function initializeModule(
IDelegatedManager _delegatedManager,
IStreamingFeeModule.FeeState memory _settings
)
external
onlyOwnerAndValidManager(_delegatedManager)
{
require(_delegatedManager.isInitializedExtension(address(this)), "Extension must be initialized");
... | 3,033,721 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./interfaces/IERC1155.sol";
import "./chainlink/LinkTokenInterface.sol";
import "./interfaces/IERC173.sol";
import "./interfaces/IERC165.sol";
import "./interfaces/IAavegotchi.sol";
import "./libraries/LibAppStorage.sol";
//import "@openzeppelin/contracts... | get the item type the entrant enteredsend back the wearable the entrant enterednow we need to remove this entrant's info from this raffleif the entrant was the last entrant, we can just delete him from the arrayotherwise, deleting him will leave a gap, so we copy in the last entrant to his spot | function withdrawEntry(uint256 _raffleId) public{
IERC1155 wearables = IERC1155(im_diamondAddress);
uint256 itemId = s.raffles[_raffleId].entrantsMapping[msg.sender];
wearables.safeTransferFrom(address(this), msg.sender, itemId, 1, "0x");
s.raffles[_raffleId].entrantsMapping[msg.s... | 14,094,515 |
./full_match/100/0x048DC80e3A072914dA7c8bB77C97309a69E3B206/sources/contracts/FreeBetV2.sol | Withdraw bet payout for bettor (reward or 0) azuroBetId The ID of Azuro bet to withdraw/ | function withdrawPayout(uint256 azuroBetId) external {
uint128 payout = _withdrawPayout(azuroBetId);
if (payout > 0) {
TransferHelper.safeTransfer(token, msg.sender, payout);
}
}
| 14,270,841 |
pragma solidity ^0.8.0;
// SPDX-License-Identifier: MIT
import "../core/DaoConstants.sol";
import "../core/DaoRegistry.sol";
import "../guards/MemberGuard.sol";
import "../guards/AdapterGuard.sol";
import "./interfaces/IConfiguration.sol";
import "../adapters/interfaces/IVoting.sol";
/**
MIT License
Copyright (c) 2... | Initialises the DAO Involves initialising available tokens, checkpoints, and membership of creator Can only be called once creator The DAO's creator, who will be an initial member/ | function initialize(DaoRegistry _dao, address creator) external override {
require(!initialized, "bank already initialized");
require(_dao.isMember(creator), "bank::not member");
dao = _dao;
initialized = true;
availableInternalTokens[UNITS] = true;
internalTokens.pu... | 317,245 |
./partial_match/1/0xf52459E8BC708d55400c167E0d77ED49641226D3/sources/OErc20Delegator.sol | A public function to sweep accidental ERC-20 transfers to this contract. Tokens are sent to admin (timelock) token The address of the ERC-20 token to sweep/ | function sweepToken(EIP20NonStandardInterface token) external {
delegateToImplementation(abi.encodeWithSignature("sweepToken(address)", token));
}
| 2,741,140 |
// SPDX-License-Identifier: MIT
pragma solidity >= 0.8.4;
import "./IERC721Receiver.sol";
import "./IERC721Metadata.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/S... | Query total NFT number of a issue by any NFT belongs to this issue. Requirements: - `_NFT_id`: The id of the NFT queryed. Return total NFT number of this issue./ | function getTotalAmountByNFTId(uint64 _NFT_id) public view returns (uint32) {
require(isEditionExisting(_NFT_id), "SparkLink: Edition is not exist.");
return getBottomUint32FromUint64(editions_by_id[getRootNFTIdByNFTId(_NFT_id)].father_id);
}
| 1,067,850 |
./full_match/100/0x62D007D4c4Db781C24FF6ac19279B9A9Ec32b344/sources/contracts/recover/recover.sol | Pay the arbitration fee to raise a dispute. To be called by the owner. UNTRUSTED. Note that the arbitrator can have createDispute throw, which will make this function throw and therefore lead to a party being timed-out. This is not a vulnerability as the arbitrator can rule in favor of one party anyway. _claimID T... | function payArbitrationFeeByOwner(uint _claimID) public payable {
Claim storage itemClaim = claims[_claimID];
Item storage item = items[itemClaim.itemID];
uint arbitrationCost = arbitrator.arbitrationCost(arbitratorExtraData);
require(
itemClaim.status < Status.Dispute... | 14,273,933 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "../shared/CoreController.sol";
import "@gif-interface/contracts/modules/IAccess.sol";
import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
contract AccessC... | --- manage roles ------------------------------------------------------ | function addRole(bytes32 role)
public
onlyInstanceOperator
{
require(validRole[role], "ERROR:ACL-003:ROLE_EXISTING_AND_VALID");
validRole[role] = true;
}
| 12,590,464 |
./full_match/80001/0xC031277cfa6C43bF56E694bfe76eEC58454dF677/sources/contracts/dao/ERC1155Dao.sol | allows token owner to list a token for lending. emits the Lending event. Requirements: ‼ contract should not be paused. ‼ caller must be the owner of the the token `tokenId + serialNo`. ‼ token with `tokenId + serialNo` must not be already listed for auction or fixed price. ‼ token with `tokenId + s... | function listForLending(
uint256 tokenId,
uint256 serialNo,
uint32 lendingPeriod,
uint104 amount
) external whenNotPaused {
TokenBearer memory tokenOwner = _tokenBearer[tokenId][serialNo];
if (tokenOwner.user != msg.sender) revert NotAvailableForOperation(1);
... | 5,574,294 |
./partial_match/1/0x71616E8C62aDF18C0645188AE04b90b446a860A7/sources/src/TokenTapas.sol | Checks if this or the parent contract supports an interface by its ID. _interfaceId The ID of the interface. return Returns `true` if the interface is supported. | function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) {
return
_interfaceId == type(IERC20).interfaceId ||
_interfaceId == type(IERC721).interfaceId ||
_interfaceId == type(IVotes).interfaceId ||
super.supportsInterface(_interfaceId);
}
| 4,078,682 |
./full_match/84531/0xB09E02a9bC0f8DB9aE4c7ca9e3dDDE621bE16734/sources/contracts/libraries/Clones.sol | Computes the address of a clone deployed using {Clones-cloneDeterministic}./ | function predictDeterministicAddress(address implementation, bytes32 salt)
internal
view
returns (address predicted)
{
return predictDeterministicAddress(implementation, salt, address(this));
}
| 11,522,051 |
// SPDX-License-Identifier: MIT
pragma solidity ^ 0.7.0;
contract BulkTokenTransfer {
/* This contract is still in beta. Use this contract at your own risk */
// Public variable; owns this contract
address public owner;
// Event which stores details of each individual transfer
event Transfer(addr... | Allow the owner of the contract to withdraw any left over network tokens | function withdrawEther(address payable addr, uint amount) public onlyOwner returns(bool success) {
addr.transfer(amount * 1 wei);
return true;
| 967,760 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.4;
import "./Proxy.sol";
interface ERC165 {
function supportsInterface(bytes4 id) external view returns (bool);
}
///@notice Proxy implementing EIP173 for ownership management
contract EIP173Proxy is Proxy {
// ////////////////////////// EVENTS ////////... | solhint-disable-next-line security/no-inline-assembly | function _setProxyAdmin(address newAdmin) internal {
address previousAdmin = _proxyAdmin();
assembly {
sstore(
0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103,
newAdmin
)
}
emit ProxyAdminTransferred(previousA... | 1,573,879 |
pragma solidity ^0.5.11;
contract GuarantorManager{
// Contract properties
address payable public administrator;
address[] private guarantors;
// Mappings
mapping(address => bool) public isGuarantor;
// Events
event GuarantorAdded(
address indexed _guarantorAddress
);
eve... | Function to get all the guarantorsz | function getGuarantors() public view returns(address[] memory) {
return guarantors;
}
| 882,256 |
./full_match/80001/0x68938d1f6B0657c95c75d589c16C4109FE1Aa7AD/sources/feature-v2/CentralizedAppealableArbitrator.sol | Appeals a ruling. _disputeID The ID of the dispute. _extraData Additional info about the appeal./ | function appeal(uint256 _disputeID, bytes calldata _extraData)
public
payable
override
requireAppealFee(_disputeID, _extraData)
{
super.appeal(_disputeID, _extraData);
DisputeStruct storage dispute = disputes[_disputeID];
dispute.isAppealed = true;
}... | 9,440,830 |
// 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... | Allow users to remove liquidity tokens from liquidity pools. Users need to replace liquidity tokens with the same amount of pool tokens poolTokensToConsume Amount of user removes from the liquidity pool | function removeLiquidity(uint256 poolTokensToConsume) external override nonReentrant {
_removeLiquidity(msg.sender, poolTokensToConsume);
}
| 6,397,073 |
/**
* Submitted for verification at Etherscan.io on 2022-03-24
*/
// _/_/ _/ _/ _/ _/_/_/ _/_/ _/_/
// _/ _/ _/_/_/ _/_/_/_/ _/_/_/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/
// _/ _/_/ _/ _... | on sell on buy & wallet transfers | function _transfer(
address from,
address to,
uint256 amount
) internal override {
require(from != address(0), "transfer from the zero address");
require(to != address(0), "transfer to the zero address");
require(
amount <= maxTxLimit ||
... | 10,266,798 |
pragma solidity 0.5.11;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure r... | Deposit asset into Compound _asset Address of asset to deposit _amount Amount of asset to deposit return amountDeposited Amount of asset that was deposited/ | function deposit(address _asset, uint256 _amount)
external
onlyVault
returns (uint256 amountDeposited)
{
require(_amount > 0, "Must deposit something");
ICERC20 cToken = _getCTokenFor(_asset);
require(cToken.mint(_amount) == 0, "cToken mint failed");
amo... | 2,121,729 |
contract CapCoinInternational {
/* Public variables of the token */
string public standard = 'Token 0.1';
string public name;
string public symbol;
uint8 public decimals;
uint256 public initialSupply;
uint256 public totalSupply;
/* This creates an array with all balances */
mapping ... | Public variables of the token / This creates an array with all balances / Initializes contract with initial supply tokens to the creator of the contract / | function CapCoinInternational () {
initialSupply = 500000000;
name ="CapCoinInternational";
decimals = 0;
symbol = "CAPI";
}
| 14,809,564 |
// SPDX-License-Identifier: MIT-open-group
pragma solidity ^0.8.11;
import "contracts/libraries/math/CryptoLibrary.sol";
import "contracts/utils/AtomicCounter.sol";
import "contracts/interfaces/IValidatorPool.sol";
import "contracts/interfaces/IETHDKG.sol";
import "contracts/interfaces/IETHDKGEvents.sol";
import "cont... | todo: generate truth table | function _isETHDKGHalted() internal view returns (bool) {
bool ethdkgFailedInDisputePhase = (_ethdkgPhase == Phase.DisputeShareDistribution ||
_ethdkgPhase == Phase.DisputeGPKJSubmission) &&
block.number >= _phaseStartBlock + _phaseLength &&
_badParticipants != 0;
... | 1,826,902 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
contract DistributedDictionaryMinimal {
constructor(){
initWithWords();
}
struct Post {
uint id;
string wordMeaning;
int votes;
address author;
}
struct Word{
Post[] posts;
}
mapping ... | returnes word array length | function getWordCount() view public returns (uint){
return wordsArray.length;
}
| 5,546,789 |
/**
*Submitted for verification at Etherscan.io on 2022-03-21
*/
// Sources flattened with hardhat v2.9.1 https://hardhat.org
// File @openzeppelin/contracts/utils/[email protected]
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)
pragma solidity ^0.8.0;
/**
* @dev Collection ... | q Sends a message to an account on another domain _crossDomainTarget The intended recipient on the destination domain _message The data to send to the target (usually calldata to a function with `onlyFromCrossDomainAccount()`) _gasLimit The gasLimit for the receipt of the message on the target domain./ | function sendCrossDomainMessage(
address _crossDomainTarget,
uint32 _gasLimit,
bytes memory _message,
uint256 fee
)
internal
{
}
| 2,180,529 |
pragma solidity ^0.8.6;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABLES ... | To claim the insurance/ | function claimInsurance(address _passengerAddr, bytes32 _flightKey, uint256 claimAmount) external requireIsOperational requireCallerContract {
bytes32 key = getInsuranceKey(_passengerAddr, _flightKey);
insurances[key].status = CLAIMED_INSURANCE;
insurances[key].claimAmount = claimAmount;
... | 1,015,388 |
./full_match/80001/0xD238dD70E5376DA21274717eaa6053075c8b62b4/sources/contracts/TraderBalanceVault/TraderBalanceVault.sol | @inheritdoc ITraderBalanceVault/ | function useTraderAssets(LockAssetParams calldata _params) external override onlyRole(VAULT_ACCESS_ROLE) {
TraderBalance storage depositedBalance = balances[_params.trader][_params.depositAsset];
if (_params.openType != OpenType.OPEN_BY_ORDER) {
_require(
_params.depositA... | 9,522,267 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./utils/Ownable.sol";
import "./interfaces/IVoters.sol";
import "./int... | Refund user's overpayment | function _deposit(address user, uint amount) private nonReentrant {
require(!paused, 'paused');
require(block.timestamp >= startTime && block.timestamp <= endTime, 'sale not active');
require(amount > 0, 'need amount > 0');
require(perUserCap == 0 || amount <= perUserCap, 'over per user cap'... | 1,834,302 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
import "../AccountController.sol";
/**
* @title Account controller mock
*
* @author Stanisław Głogowski <stan@pillarproject.io>
*/
contract AccountControllerMock is AccountController {
/**
* @dev Public constructor
* @param accountRegistry_ account... | Sets account registry accountRegistry_ account registry address/ | function setAccountRegistry(
address accountRegistry_
)
external
{
_setAccountRegistry(accountRegistry_, true);
}
| 12,832,555 |
//SPDX-License-Identifier: TBD
pragma solidity =0.7.4;
interface IWETH {
function deposit() external payable;
function transfer(address to, uint value) external returns (bool);
function withdraw(uint) external;
}
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint va... | update reserves and, on the first call per block, price accumulators | function _update(uint balance) private {
uint32 lastTime = uint32(balance);
uint32 deltaTime = uint32(block.timestamp) -lastTime ;
if (deltaTime>0 && lastTime>0) {
uint circle = circleData;
uint lambda0 = uint16(circle >> 72);
uint lambda1 = uint16(circle >> 56... | 6,170,208 |
./full_match/1/0xe0c5E70C879d1c170F64f66266651f4641f7c03d/sources/contracts/InsideOut.sol | Main minting function./ | function mintIO() internal {
_totalSupply.increment();
uint256 tokenId = _totalSupply.current();
_safeMint(msg.sender, tokenId);
}
| 8,300,157 |
./full_match/1/0x646Df2Dc98741a0Ab5798DeAC6Fc62411dA41D96/sources/src/bridges/liquity/TroveBridge.sol | Redeem collateral. _tbAmount Amount of TB to burn. _interactionNonce Same as in convert(...) method. return collateral Amount of collateral withdrawn./ | function _redeem(uint256 _tbAmount, uint256 _interactionNonce) private returns (uint256 collateral) {
if (!collateralClaimed) {
BORROWER_OPERATIONS.claimCollateral();
collateralClaimed = true;
}
collateral = (address(this).balance * _tbAmount) / totalSupply();
... | 17,057,666 |
// File: contracts/vaults/IStrategy.sol
... | inject NONSTANDARD NAMING | function VAULT69(address token) external view returns (ivault53); | 1,825,062 |
// Based on https://github.com/HausDAO/MinionSummoner/blob/main/MinionFactory.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
pragma abicoder v2;
import "@gnosis.pm/safe-contracts/contracts/GnosisSafe.sol";
import "@gnosis.pm/safe-contracts/contracts/libraries/MultiSend.sol";
import "./zodiac... | Member accessible interface to withdraw funds from another Moloch directly to Safe or to the DAO Can only be called by member of Moloch _target MOLOCH address to withdraw from _token ERC20 address of token to withdraw _amount ERC20 token amount to withdraw Construct transaction data for safe to execute Transfers to... | function crossWithdraw(address _target, address _token, uint256 _amount, bool _transfer) external memberOnly {
bytes memory withdrawData = abi.encodeWithSelector(
IMOLOCH(_target).withdrawBalance.selector,
_token,
_amount
);
require(
... | 5,782,997 |
/**
*Submitted for verification at Etherscan.io on 2021-03-30
*/
// File: contracts/access/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 avai... | Main function to enter Compound supply/borrow position using the available [DAI] token balance/ | function addPosition() external pure {
revert("Stub");
}
| 10,844,267 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.