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: UNLICENSED
pragma solidity 0.8.7;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzep... | Emergency method, funds gets transferred to the governanceRecoveryFund address | function transferToken(address token, uint256 value) external onlyOwner nonReentrant {
require(token != address(0), 'Address is 0');
IERC20Detailed(token).safeTransfer(governanceRecoveryFund, value);
}
| 11,824,201 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "hardhat/console.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/util... | concatenate two lists of strings/ | function concat(string[] memory list1, string[] memory list2)
internal
pure
returns (string[] memory)
{
string[] memory result = new string[](list1.length + list2.length);
for (uint256 i = 0; i < list1.length; i++) {
result[i] = list1[i];
}
for (uint256 i = 0; i < list2.length; i++... | 17,505 |
// SPDX-License-Identifier: GPL-3.0
// File: @openzeppelin/contracts/utils/Strings.sol
pragma solidity ^0.8.9;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
... | mint a number of NFTs in presale | function presaleMint(uint256 number, uint8 _v, bytes32 _r, bytes32 _s) onlyValidAccess(_v, _r, _s) public payable {
require(!paused_, "Sale is paused!");
State saleState_ = saleState();
require(saleState_ != State.NoSale, "Sale in not open yet!");
require(saleState_ != State.PublicS... | 5,856,582 |
// SPDX-License-Identifier: MIT
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 representation.
*/
function toString(uint256 value) internal pure returns ... | Returns the substraction of two unsigned integers, with an overflow flag. _Available since v3.4._/ | function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
| 336,020 |
./full_match/1/0xBe2440C38Cdb7920Ed8D77df6c97112779957286/sources/contracts/BullRun/BullRun.sol | mass update the nftType mapping | function setBatchNFTType(uint16[] calldata _idNumbers, uint8[] calldata _types) external onlyOwner {
require(_idNumbers.length == _types.length);
for (uint16 i = 0; i < _idNumbers.length;) {
require(_types[i] != 0 && _types[i] <= 3);
NFTType[_idNumbers[i]] = _types[i];
... | 17,174,843 |
pragma solidity ^0.4.0;
contract ItemTracking {
struct Item {
uint id;
address owner;
uint[] components;
bool exists;
bool created;
}
mapping(uint => Item) items;
modifier itemCreated(uint id) {
if (items[id].created == false) {
thro... | Extract the sub-components listed in the parameter. Leave the rest of the components in the parent item. Parent item maintains its old ID. If less than 2 components would remain in the parent component, then extract behaves exactly like split. If less than 2 components would remain in the parent item after the extracti... | function extract(uint srcId, uint[] toBeExtractedIds)
itemExists(srcId)
itemOwnedBySender(srcId)
itemIsCombined(srcId)
itemContainsComponents(srcId, toBeExtractedIds) {
if (items[srcId].components.length - toBeExtractedIds.length < 2) {
split(srcId);
return;
}... | 7,320,419 |
/**
*Submitted for verification at Etherscan.io on 2021-04-28
*/
/**
*/
pragma solidity ^0.4.11;
contract Owned {
address public owner;
function Owned() {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function setOwner(address _n... | estimate stage return current stage deployed but not initialized not started yet all sold out in sale early bird stage | function stage() constant returns (Stage) {
if (finalized) {
return Stage.Finalized;
}
if (!initialized) {
return Stage.Created;
}
if (blockTime() < startTime) {
return Stage.Initialized;
}
if (uint256(soldOut.official).... | 2,089,930 |
./full_match/1/0x0000000000F7A60F1C88F317f369e3D8679C6689/sources/contracts/tokens/ERC721/ERC721.sol | Returns the total amount of tokens minted in the contract./ | function _totalMinted() internal view virtual returns (uint256) {
return _mintCounter;
}
| 17,130,791 |
./full_match/1/0x39159BE9E506d73b776c063D117B8367aA1139e9/sources/contracts/SamuraiJack.sol | Excludes the specified account from tax./ | function exclude(address account) public onlyOwner {
require(!isExcluded(account), "ERC20: Account is already excluded");
excludeList[account] = true;
}
| 2,998,985 |
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
mapping(address => uint256) public balances;
function totalSupply() public view returns (uint256);
function balanceOf(address who) ... | Agent sign on user data by agent/ | function setAgentVerificationByAgent(bytes32 _property, address _user) public onlyAgent {
_setPropertyStatus(_property, _user, Statuses.Agent);
_signPropertyByAgent(msg.sender, _user, _property);
}
| 6,111,697 |
./full_match/1/0x402993515350c973f1D44FC8762644E3806cB9bC/sources/contracts/data/Keys.sol | key for amount of tokens in a market's pool market the market to check token the token to check return key for amount of tokens in a market's pool | function poolAmountKey(address market, address token) internal pure returns (bytes32) {
return keccak256(abi.encode(
POOL_AMOUNT,
market,
token
));
}
| 16,543,142 |
./partial_match/1/0x947a2e766F5e7A6002F02c08eAbE6f236Cc41C9B/sources/QuantumCreatures.sol | Approve `to` to operate on `tokenId` Emits a {Approval} event./ | function _approve(
address to,
uint256 tokenId,
address owner
) internal {
_tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
| 3,903,040 |
pragma solidity >=0.4.25 <0.6.0;
pragma experimental ABIEncoderV2;
import "../contracts/IToken.sol";
import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/MatryxPlatform.sol";
import "../contracts/LibPlatform.sol";
import "../contracts/LibTournament.sol";
contract TestLibTournament... | set token set total balance set tournament balance set tournament owner current round Abandoned | function testRecoverBounty() public
{
info.token = address(this);
data.totalBalance = 20;
data.tournamentBalance[address(this)] = 20;
data.tournaments[address(this)].info.owner = msg.sender;
data.tournaments[address(this)].rounds.length = 1;
LibTournament.RoundDat... | 12,733,571 |
pragma solidity ^0.4.24;
// File: @0xcert/ethereum-utils/contracts/math/SafeMath.sol
/**
* @dev Math operations with safety checks that throw on error. This contract is based
* on the source code at https://goo.gl/iyQsmU.
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.... | Transfers _value amount of tokens from address _from to address _to, and MUST fire the Transfer event. _from The address of the sender. _to The address of the recipient. _value The amount of token to be transferred./ | function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool _success)
{
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
... | 5,546,330 |
pragma solidity ^0.4.26;
/**
* Math operations with safety checks
*/
contract SafeMath {
function safeMul(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) internal returns (uint2... | Check if the sender has enough Subtract from the sender | function unfreeze(uint256 _value) returns (bool success) {
if (freezeOf[msg.sender] < _value) throw;
if (_value <= 0) throw;
freezeOf[msg.sender] = SafeMath.safeSub(freezeOf[msg.sender], _value);
balanceOf[msg.sender] = SafeMath.safeAdd(balanceOf[msg.sender], _value);
Unfreez... | 13,537,238 |
./partial_match/1/0x4f19e6A97778417C33AA6034089378b093619fe5/sources/src/AuraAdapterBase.sol | solhint-disable-previous-line no-empty-blocks | function underlyingBalance() public view virtual returns (uint256) {
}
| 4,075,290 |
./partial_match/1/0xe300C0DBDd784Cc2CD1A86b2126Fc95629389F91/sources/contracts/modules/credit/SpigotedLine.sol | see ISpigotedLine.useAndRepay | function useAndRepay(uint256 amount) external whileBorrowing returns (bool) {
bytes32 id = ids[0];
Credit memory credit = credits[id];
if (msg.sender != borrower && msg.sender != credit.lender) {
revert CallerAccessDenied();
}
if (amount > unusedTokens[credit.to... | 15,654,146 |
./full_match/11155111/0xbdDB47066f93690e6de26037646ECe6D1F468245/sources/staking/saturn_staking.sol | This function is used to get the staking end date for program/ | function getStakeEndDate() external view returns (uint256) {
return _stakeEndDate;
}
| 3,834,581 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.8.0;
// Sources flattened with hardhat v2.6.4 https://hardhat.org
// File contracts/Oracle/AggregatorV3Interface.sol
interface AggregatorV3Interface {
function decimals() external view returns (uint8);
function description() external view returns... | getRoundData and latestRoundData should both raise "No data present" if they do not have data to report, instead of returning unset values which could be misinterpreted as actual reported values. | interface AggregatorV3Interface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
function getRoundData(uint80 _roundId)
external
view
returns (
uint80 roundId,
int256 a... | 5,840,283 |
pragma solidity ^0.6.12;
/*
forked from SUSHI and YUNO and KIMCHI
*/
/*
* @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
* mann... | Withdraw LP tokens from MasterSommelier. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accVaultPerSha... | 1,100,428 |
./full_match/1/0xA8C6B0d3a06E834A8F0F70603625a475b87703a0/sources/contracts/token/oft/v2/OFTCoreV2.sol | credit to this contract first, and then transfer to receiver only if callOnOFTReceived() succeeds store the failed message into the nonblockingLzApp | function _sendAndCallAck(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual {
(bytes32 from, address to, uint64 amountSD, bytes memory payloadForCall, uint64 gasForCall) = _decodeSendAndCallPayload(_payload);
mapping(uint64 => bool) storage nonces =... | 4,998,518 |
./full_match/80001/0x7aA01b23ae3B28f166C44228746CE0b8616a51C4/sources/project:/contracts/FundingPool.sol | Repays the monthly installment. _poolId The Id of the pool. _ERC20Address The address of the erc20 funds. _bidId The Id of the bid. _lender The lender address./ | function repayMonthlyInstallment(
uint256 _poolId,
address _ERC20Address,
uint256 _bidId,
address _lender
) external nonReentrant {
require(poolOwner == msg.sender, "You are not the Pool Owner");
FundDetail storage fundDetail = lenderPoolFundDetails[_lender][_pool... | 838,792 |
/*
*
* $DEWO Token - The Native Token In DecentraWorld's Ecosystem
* DecentraWorld - Increasing Privacy Standards In DeFi
*
* Documentation: http://docs.decentraworld.co/
* GitHub: https://github.com/decentraworldDEWO
* DecentraWorld: https://DecentraWorld.co/
* DAO: https://dao.decentraworld.co/
* Governance: https:/... | The burn function will be used to burn tokens that were cross-chained into another EVM chain | function burn(address from, uint256 amount) external onlyAuth returns (bool) {
require(from != address(0), "DecentraWorld: address(0x0)");
_burn(from, amount);
return true;
}
| 14,413,846 |
/*
Copyright 2017-2018 RigoBlock, Rigo Investment Sagl.
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 a... | turn faucet off return bool on success | function turnFaucetOff()
external
onlyOwner
faucetOn
returns (bool success)
{
faucetStatus = false;
emit FaucetOff(faucetStatus);
return true;
}
| 2,508,825 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.7;
pragma experimental ABIEncoderV2;
import "../strategy-base.sol";
import "../../../lib/balancer-vault.sol";
contract StrategyBalancerWmaticUsdcWethBalLp is StrategyBase {
// Token addresses
address public vault = 0xBA12222222228d8Ba445958a75a0704d566BF2C8... | 10% is locked up for future gov | function harvest() public override onlyBenevolent {
uint256 _rewardBalance = IERC20(bal).balanceOf(address(this));
if (_rewardBalance > 0) {
uint256 _keepReward = _rewardBalance.mul(keepReward).div(keepRewardMax);
IERC20(bal).safeTransfer(
IController(controll... | 5,447,177 |
pragma solidity ^0.6.12;
... | inject NONSTANDARD NAMING | function ALLOWANCE1(address OWNER0, address SPENDER5) public view virtual override returns (uint256) { | 13,119,640 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
interface IERC20 {
function TOTALSUPPLY57() external view returns (uint256); //inject NONSTANDARD NAMING
function BALANCEOF949(address account) external view returns (uint256); //inject ... | inject NONSTANDARD NAMING | function _BURNFROM245(address account, uint256 amount) internal { | 12,740,432 |
pragma solidity 0.5.8;
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
function owner() public view retu... | Public function that allows the owner to create any contract using create2 data bytecode of the new contract salt Create2 salt parameter/ | function execCreate2(bytes memory data, uint salt) onlyOwner public returns (bool) {
require(_execCreate2(data, salt));
return true;
}
| 6,353,877 |
//██████╗ █████╗ ██╗ █████╗ ██████╗ ██╗███╗ ██╗
//██╔══██╗██╔══██╗██║ ██╔══██╗██╔══██╗██║████╗ ██║
//██████╔╝███████║██║ ███████║██║ ██║██║██╔██╗ ██║
//██╔═══╝ ██╔══██║██║ ██╔══██║██║ ██║██║██║╚██╗██║
//██║ ██║ ██║███████╗██║ ██║██████╔╝██║██║ ╚████║
//╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════... | Starts the Loan and Delegate the voting Power to the Delegatee Sets the amount values for the Loan, then delegate the voting power to the Delegatee _delegatee Address to delegate the voting power to _amount Amount of the underlying token for this loan _feesAmount Amount of fees (in the underlying token) paid by the... | function initiate(
address _motherPool,
address _borrower,
address _underlying,
address _delegatee,
uint _amount,
uint _feesAmount
) external returns(bool){
require(motherPool == address(0));
motherPool = payable(_motherPool);
borrower = _... | 14,680,278 |
// SPDX-License-Identifier: MIT License
pragma solidity >=0.8.0 <0.9.0;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emerge... | Counts the number of nonoverlapping occurrences of `needle` in `self`. self The slice to search. needle The text to search for in `self`. return The number of occurrences of `needle` found in `self`./ | function count(slice memory self, slice memory needle)
internal
pure
returns (uint256 cnt)
{
uint256 ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr) +
needle._len;
while (ptr <= self._ptr + self._len) {
cnt++;
ptr =
... | 443,030 |
./full_match/5/0xf9eF10daDc9b525c35Ae7dC45bfc8700a5e0F68b/sources/contracts/Records.sol | Store treatment summary details patient_id patient patient id _treatment treatment _date_treatment date of treatment _doctor_id id of doctor treated _hospital_id id of hospital _discharge date of discharge _follow_up date for follow up / | function treatment_summary(
uint256 patient_id,
string memory _treatment,
string memory _date_treatment,
uint256 _doctor_id,
uint256 _hospital_id,
string memory _discharge,
string memory _follow_up
) public isOwner {
tr.treatment = _treatment;
... | 7,076,882 |
/**
*Submitted for verification at Etherscan.io on 2019-12-02
*/
pragma solidity ^0.5.4;
/**
* ERC20 contract interface.
*/
contract ERC20 {
function totalSupply() public view returns (uint);
function decimals() public view returns (uint);
function balanceOf(address tokenOwner) public view returns (uin... | Overrides refund to add the refund in the daily limit. 21000 (transaction) + 7620 (execution of refund) + 7324 (execution of updateDailySpent) + 672 to log the event + _gasUsed | function refund(BaseWallet _wallet, uint _gasUsed, uint _gasPrice, uint _gasLimit, uint _signatures, address _relayer) internal {
uint256 amount = 36616 + _gasUsed;
if(_gasPrice > 0 && _signatures > 0 && amount <= _gasLimit) {
if(_gasPrice > tx.gasprice) {
amount = amount... | 2,499,627 |
/* Copyright (C) 2021 Soteria.fund
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.
This program is distributed... | Returns amount of SOTE Tokens locked as Cover Note for given coverId. _of address of the coverHolder. _coverId coverId of the cover./ | function getUserLockedCNTokens(address _of, uint _coverId) external view returns(uint) {
return _getUserLockedCNTokens(_of, _coverId);
}
| 7,238,575 |
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import { SignatureChecker } from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
import { ECDSA } from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
contract DataToChain {
struct UserInfo {
uint256 userId;
... | Stores a new value in the contract | function store(uint256 userId,uint256 parentId,uint256 lockeBalance,uint256 assetsBalance,uint256 changeBalance,bytes memory signature) public {
require(userId != 0,"DataToChain: userId cannt be zero");
require(userIdMapAddress[userId] == address(0),"DataToChain:userId Have imported");
requi... | 1,276,807 |
./full_match/5/0xeDbDfF00161080D8929A3aEBF88c72A96477d25a/sources/contracts/pools/stable/StableMath.sol | Computes how many tokens can be taken out of a pool if `tokenAmountIn` are sent, given the current balances. The amplification parameter equals: A n^(n-1) outGivenIn token x for y - polynomial equation to solve ay = amount out to calculate ... | function _calcOutGivenIn(
uint256 amplificationParameter,
uint256[] memory balances,
uint256 tokenIndexIn,
uint256 tokenIndexOut,
uint256 tokenAmountIn
) internal pure returns (uint256) {
uint256 invariant = _calculateInvariant(amplificationParameter, balances);... | 11,617,981 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin... | The following functions are overrides required by Solidity. | function _authorizeUpgrade(address newImplementation)
internal
onlyRole(UPGRADER_ROLE)
override
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721Upgradeable, AccessControlUpgradeable)
returns (bool)
{
return super.sup... | 15,811,379 |
pragma solidity ^0.4.4;
contract Token {
function totalSupply() public constant returns(uint256 supply) {} /// @return total amount of tokens
/// @param _owner The address from which the balance will be retrieved
function balanceOf(address _owner) public constant returns (uint256 balance) {} /// @re... | / return total amount of tokens | function totalSupply() public constant returns(uint256 supply) {} | 13,057,337 |
./full_match/42/0xb4540cf1684D8f566f15daa17441B8a33211A9AB/sources/dex/Main.sol | Weth= WETH(_WETH); Weth.approve(address(this),Weth.balanceOf(address(this))); | function setWETH(address _WETH) public{
tokenWETH= _WETH;
}
| 9,581,558 |
// SPDX-License-Identifier: MIT
/**
ScacContract
*/
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces,... | Interface of the ERC165 standard, as defined in the Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}./ | interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
ScacContract
pragma solidity ^0.8.0;
}
| 13,961,890 |
//Address: 0xceffdb3f1aed635e94a0b565239d4353ae44c744
//Contract name: BancorBuyer
//Balance: 0 Ether
//Verification Date: 6/10/2017
//Transacion Count: 5
// CODE STARTS HERE
pragma solidity ^0.4.11;
/*
Bancor Buyer
========================
Buys Bancor tokens from the crowdsale on your behalf.
Author: /u/Cintix
... | Only allow deposits if the contract hasn't already purchased the tokens. Update records of deposited ETH to include the received amount. Withdraw the sender's tokens if the contract has already purchased them. Store the user's BNT balance in a temporary variable (1 ETHWei -> 100 BNTWei). Update the user's balance prior... | function () payable {
if (!bought_tokens) {
balances[msg.sender] += msg.value;
}
else {
uint amount = balances[msg.sender] * 100;
balances[msg.sender] = 0;
uint fee = 0;
if (now > time_bought + 1 hours) {
fee = amount / 100;
}
ERC20(token).transfer(develop... | 13,113,660 |
./partial_match/3/0xB8dfa8a6B569390a13777bE08D10f52E16302926/sources/Crowdsale.sol | Event for token purchase logging purchaser who paid for the tokens beneficiary who got the tokens value weis paid for purchase amount amount of tokens purchased/ _rate Number of token units a buyer gets per wei _wallet Address where collected funds will be forwarded to _token Address of the token being sold/ | function Crowdsale(uint256 _rate, address _wallet, ERC20 _token, uint _releaseTime) public {
require(_rate > 0);
require(_wallet != address(0));
require(_token != address(0));
rate = _rate;
wallet = _wallet;
token = _token;
releaseTime = _releaseTime;
}
| 5,311,268 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.9;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./CurveStable.sol";
import "./ConvexBase.sol";
/// @notice Implements the strategy using Convex. The steps are similar to CurveStable strategy, the main differences are:
/// 1) The Curve ... | Initialises the state variables. Put them in a function to allow for testing. Testing contracts can override these. | function _initCurvePool(address _pool) internal virtual {
curveAddressProvider = ICurveAddressProvider(CURVE_ADDRESS_PROVIDER_ADDRESS);
curveMinter = ICurveMinter(CURVE_MINTER_ADDRESS);
curvePool = ICurveDeposit(_pool);
curveGauge = ICurveGauge(_getCurvePoolGaugeAddress());
}
| 519,079 |
./full_match/80001/0xD238dD70E5376DA21274717eaa6053075c8b62b4/sources/contracts/TraderBalanceVault/TraderBalanceVault.sol | @inheritdoc ITraderBalanceVault/ | function withdrawFrom(
address _from,
address _to,
address _asset,
uint256 _amount,
bool fromLocked
) external override onlyRole(VAULT_ACCESS_ROLE) {
if (fromLocked) {
_require(balances[_from][_asset].lockedBalance >= _amount, Errors.INSUFFICIENT_FREE_... | 9,522,276 |
./full_match/1/0xb867dF3efF1B234CA08B7D0d85Fb51Fd25C2c2d0/sources/contracts/v2/strategies/RamosStrategy.sol | Shutdown the strategy. First unstake all BPT and liquidate into temple & stables, and then repay to the TRV. shutdownData abi encoded data of struct `PopulateShutdownParams`/ | function _doShutdown(bytes calldata shutdownData) internal virtual override {
(ShutdownParams memory params) = abi.decode(shutdownData, (ShutdownParams));
ramos.removeLiquidity(params.requestData, params.bptAmount);
uint256 stableBalance = quoteToken.balanceOf(address(this));
if (st... | 3,120,050 |
./partial_match/1/0xeEFe0487f16082cABef73974aD689D3F55544240/sources/PitchHero.sol | The ETH balance of the account is not enough to perform the operation./ There's no code at `target` (it is not a contract)./ A call to an address target failed. The target may have reverted./ Replacement for Solidity's `transfer`: sends `amount` wei to `recipient`, forwarding all available gas and reverting on error... | function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert AddressInsufficientBalance(address(this));
}
if (!success) {
revert FailedInnerCall();
}
}
| 2,649,760 |
// File: contracts\lib\TransferHelper.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.6;
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
function safeApprove(address token, address to, uint value) intern... | Freeze token balances Balances ledger tokenAddress Destination token address value token amount | function _freeze(mapping(address=>UINT) storage balances, address tokenAddress, uint value) private {
UINT storage balance = balances[tokenAddress];
uint balanceValue = balance.value;
if (balanceValue < value) {
balance.value = 0;
TransferHelper.safeTransferFrom(toke... | 52,786 |
pragma solidity ^0.4.17;
import "ds-test/test.sol";
import "./OMT.sol";
import "./ERC223ReceivingContract.sol";
contract TokenReceivingEchoDemo {
OMT omt;
function TokenReceivingEchoDemo(address _token)
{
omt = OMT(_token);
}
function tokenFallback(address _from, uint256 _value, bytes ... | check that the msg.sender _token is equal to token address | function tokenFallback(address _from, uint256 _value, bytes _data) public
{
require(msg.sender == address(omt));
omt.transfer(_from, _value);
}
| 6,422,843 |
/**
*Submitted for verification at Etherscan.io on 2021-09-12
*/
/**
*Submitted for verification at Etherscan.io on 2021-01-27
*/
pragma solidity ^0.5.0;
/**
* @title ERC165
* @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
*/
interface IERC165 {
/**
* @notice Query if a contract imp... | Transfers amount amount of an _id from the _from address to the _to address specified _from Source address _to Target address _id ID of the token type _amount Transfered amount/ Update balances Update balances | function _safeTransferFrom(
address _from,
address _to,
uint256 _id,
uint256 _amount,
bool _buyrequest
) internal {
if(_buyrequest){
}
else{
}
}
| 10,054,437 |
./full_match/1/0x5478a4e605D7AA798dC70eCD0A1C3299aaeaFDD7/sources/contracts/utils/AnalyticMath.sol | The global "maxExpArray" is sorted in descending order, and therefore the following statements are equivalent: - This function finds the position of [the smallest value in "maxExpArray" larger than or equal to "x"] - This function finds the highest position of [a value in "maxExpArray" larger than or equal to "x"] This... | function findPosition(uint256 x) internal view returns (uint8) { unchecked {
uint8 lo = MIN_PRECISION;
uint8 hi = MAX_PRECISION;
while (lo + 1 < hi) {
uint8 mid = (lo + hi) / 2;
if (maxExpArray[mid] >= x)
lo = mid;
else
hi ... | 4,962,038 |
./full_match/1/0x88d0D1a1472307d1853809C3aA455B1B76c9bCfe/sources/contracts/Wrapper.sol | Set the SwapERC20 contract _swapERC20Contract address Address of the new swap contract/ | function setSwapERC20Contract(address _swapERC20Contract) external onlyOwner {
require(_swapERC20Contract != address(0), "INVALID_SWAP_ERC20_CONTRACT");
wethContract.approve(address(swapERC20Contract), 0);
swapERC20Contract = ISwapERC20(_swapERC20Contract);
wethContract.approve(_swapERC20Contract, MAX... | 17,176,973 |
./full_match/80001/0xC3111E853d888D7f919361f162e82a93CA486044/sources/contracts/BurnToMintFightMe.sol | emit BurnedToMint( _tokenId, msg.sender ); 1. Check if the burner is the owner of the token 2. Burn the token 3. Call a mint function on another contract to mint a new token to the burnerfighterContract.mintViaLootbox(_tokenId, msg.sender); | function burnToMint(uint256 _tokenId) external {
_burn(_tokenId, true);
fighterContract.testExternalCall();
}
| 5,662,235 |
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Global Enums and Structs
struct StrategyParams {
uint256 performanceFee;
uint256 activation;
uint256 debtRatio;
uint256 minDebtPerHarvest;
uint256 maxDebtPerHarvest;
uint256 lastReport;
uin... | Here we determine if better to market-buy yvBOOST or mint it via backscratcher Using reserve ratios of swap pairs will allow us to compare whether it's more efficient to: 1) Buy yvBOOST (unwrapped for yveCRV) 2) Buy CRV (and use to mint yveCRV 1:1) Convert yvBOOST to yveCRV Here we favor minting by a % value defined ... | function shouldMint(uint256 _amountIn) internal returns (bool) {
address[] memory path = new address[](3);
path[0] = usdc;
path[1] = weth;
path[2] = yvBoost;
uint256[] memory amounts = ISwap(sushiswap).getAmountsOut(_amountIn, path);
uint256 projectedYvBoost = amounts... | 14,747,200 |
/**
*Submitted for verification at Etherscan.io on 2021-11-01
*/
// Sources flattened with hardhat v2.6.7 https://hardhat.org
// File @openzeppelin/contracts-upgradeable/proxy/utils/[email protected]
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
/**
* @dev This is a base contract to aid in writing ... | Returns the `cashOutAmount` of the perpetual owned by someone at a given oracle value perpetualID ID of the perpetual rate Oracle value return The `cashOutAmount` of the perpetual return Whether the position of the perpetual is now too small compared with its initial position and should hence be liquidated This func... | function getCashOutAmount(uint256 perpetualID, uint256 rate) external view override returns (uint256, uint256) {
Perpetual memory perpetual = perpetualData[perpetualID];
return _getCashOutAmount(perpetual, rate);
}
| 7,761,012 |
./full_match/1/0x06EF85C7DCA052aad296935D44Cef572367E3dE7/sources/contracts/PrimeApeAthletes.sol | will set default royalty info./ | function setDefaultRoyalty(address receiver, uint96 feeNumerator)
public
onlyOwner
{
_setDefaultRoyalty(receiver, feeNumerator);
}
| 16,466,271 |
pragma solidity 0.5.17;
import "./IRewardTransferLogic.sol";
import "./LockedSOVRewardTransferLogicStorage.sol";
import "../locked/ILockedSOV.sol";
import "../openzeppelin/ERC20.sol";
import "../openzeppelin/SafeERC20.sol";
contract LockedSOVRewardTransferLogic is IRewardTransferLogic, LockedSOVRewardTransferLogicSt... | _lockedSOV The contract instance address of the lockedSOV vault. SOV rewards are not paid directly to liquidity providers. Instead they are deposited into a lockedSOV vault contract. _unlockedImmediatelyPercent The % which determines how much will be unlocked immediately./ | function initialize(address _lockedSOV, uint256 _unlockedImmediatelyPercent) public onlyAuthorized {
changeLockedSOV(_lockedSOV);
changeUnlockedImmediatelyPercent(_unlockedImmediatelyPercent);
}
| 939,649 |
/*
* This file was generated by MyWish Platform (https://mywish.io/)
* The complete code could be found at https://github.com/MyWishPlatform/
* Copyright (C) 2018 MyWish
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as publis... | Do inner action if check was success./ | function internalAction() internal {
finalization();
Finalized();
isFinalized = true;
}
| 104,879 |
// SPDX-License-Identifier: CC0
pragma solidity ^0.6.9;
pragma experimental ABIEncoderV2;
import "./IOrgRegistry.sol";
import "./Registrar.sol";
import "../../../lib/contracts/ERC165Compatible.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/// @dev Contract for maintaining organization registry
/// Contra... | This function is a helper function to be able to get the set interface id by the setInterfaces() | function getInterfaces() external pure returns (bytes4) {
return this.registerOrg.selector ^
this.registerInterfaces.selector ^
this.getOrgCount.selector ^
this.getInterfaceAddresses.selector;
}
| 5,456,416 |
./full_match/44787/0xABf8b0501Ca1C41CfD3a5B5FA1512e3E7492e07E/sources/contracts/Payroll.sol | Perform the refound of the leftover ETH./ Celo Native currency is an ERC20 | function refundETH() internal {
if (block.chainid == 42220 || block.chainid == 44787) return;
uint256 leftOver = address(this).balance;
if (leftOver > 1) {
require(success, "Payroll: ETH leftOver transfer failed");
}
}
| 13,281,400 |
// SPDX-License-Identifier: MIT
// GO TO LINE 1904 TO SEE WHERE THE cybercar CONTRACT STARTS
// File: @openzeppelin/contracts/utils/Context.sol
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these a... | Returns the license for tokens | function tokenLicense(uint _id) public view returns(string memory) {
require(_id < totalSupply(), "CHOOSE A cybercar WITHIN RANGE");
return LICENSE_TEXT;
}
| 14,501,739 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// OpenZeppelin Contracts v4.3.2 (token/ERC20/ERC20.sol)
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppel... | Deploys the current byte code. Returns address of newly deployed contract/ | function deploy(bytes memory _code) internal returns (address addr)
{
assembly {
addr:= create(0,add(_code,0x20), mload(_code))
}
require(addr != address(0), "tipsy: deploy failed");
return addr;
}
| 12,677,816 |
./partial_match/1/0x049BeffDB026D6D1D64cFc8fE29Bd12142967B09/sources/contracts/libraries/Oracle.sol | Fetches the observations beforeOrAt and atOrAfter a given target, i.e. where [beforeOrAt, atOrAfter] is satisfied Assumes there is at least 1 initialized observation. Used by observeSingle() to compute the counterfactual accumulator values as of a given block timestamp. self The stored oracle array time The current ... | function getSurroundingObservations(
Observation[65535] storage self,
uint32 time,
uint32 target,
int24 tick,
uint16 index,
uint16 cardinality
) private view returns (Observation memory beforeOrAt, Observation memory atOrAfter) {
beforeOrAt = self[index];
if (lte(time, beforeOrA... | 4,138,463 |
pragma solidity 0.4.23;
// File: contracts/IBoomstarterToken.sol
/// @title Interface of the BoomstarterToken.
interface IBoomstarterToken {
// multiowned
function changeOwner(address _from, address _to) external;
function addOwner(address _owner) external;
function removeOwner(address _owner) externa... | performs only allowed state transitions | function changeState(State _newState)
external
onlyController
{
assert(m_state != _newState);
else assert(false);
m_state = _newState;
StateChanged(m_state);
}
| 396,384 |
./full_match/1/0xeF6303006a994f469Ef0FBDe20b269e804adB985/sources/src/Control/Authorizable.sol | always return true for the owner | function _isAuthorized(address account) internal virtual view returns (bool) {
return account == _owner() ? true : _authorized[account];
}
| 16,403,991 |
./partial_match/1/0xF9f7234c2B5E000D38759eFbc104f413e1Dc17f1/sources/src/ERC20Token.sol | Override increaseAllowance to add whenNotPaused and notBlacklisted check. Make a function callable only when the contract is not paused and account is not blacklisted./ | function increaseAllowance(address spender, uint256 addedValue) public whenNotPaused notBlacklisted(msg.sender) notBlacklisted(spender) override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, spender) + addedValue);
return true;
}
| 15,602,533 |
// SPDX-License-Identifier: BlueOak-1.0.0
pragma solidity 0.8.9;
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "contracts/plugins/assets/abstract/AaveOracleMixin.sol";
import "contracts/plugins/assets/abstract/Collat... | External interfaces from: https:git.io/JX7iJ return RAY{fiatTok/tok} solhint-disable-next-line func-name-mixedcase | interface IStaticAToken is IERC20Metadata {
function claimRewardsToSelf(bool forceUpdate) external;
function rate() external view returns (uint256);
function ATOKEN() external view returns (AToken);
function getClaimableRewards(address user) external view returns (uint256);
pragma solidity 0.8.9;
}
| 15,817,304 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import './UpgradeabilityProxy.sol';
/**
* @title AdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `... | Upgrade the backing implementation of the proxy. Only the admin can call this function. newImplementation Address of the new implementation./ | function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
| 5,007 |
./full_match/4/0x6290C56F2237622463572770748dBb800f97580C/sources/contracts/NuffitiToken.sol | Ensure tha the user is a beneficiaryEnsure that the beneficiaries account is not lockedEnsure that the beneficiary has exceeded the vesting periodRequire that the user has not withdrawn for at atleast one dayDetermine how much to send out to the beneficiaryRequire that the user still has funds allocated to himSend the ... | function claimSeedReward() public {
require(isBeneficiary[msg.sender], "This acount holder is not a beneficiary");
require(beneficiaryAccountStatus[msg.sender] == AccountStatus.unlocked, "Beneficiary account is Locked");
uint timeDiff = block.timestamp - beneficiaryLastCla... | 691,323 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount o... | Calculate the given cToken's underlying token balance of the caller. _cToken The address of the cToken contract. return Outstanding balance in the given token./ | function balanceOfUnderlying(CToken _cToken) internal returns (uint256) {
return mulScalarTruncate(_cToken.exchangeRateCurrent(), balanceOf(_cToken));
}
| 118,223 |
./full_match/42/0x864e8728F9c6f4eEB9750FBC77F6c47F1Df5dd7F/sources/browser/test.sol | bool isInvalid = bytes(name).length == 0 && bytes(symbol).length == 0 && decimals == 0; !isInvalid | function getTokenDetails(address[] memory tknAddress) public view returns (Details[] memory) {
Details[] memory details = new Details[](tknAddress.length);
for (uint i = 0; i < tknAddress.length; i++) {
TokenInterface token = TokenInterface(tknAddress[i]);
string memory name ... | 16,215,044 |
/* SPDX-License-Identifier: MIT
@**********@ @*********** @*********** @*********** #***@ @***( *********** @**********# @*********** @*********** @*******@ .***********
@***@@@@***@ @***@@@@@@@@ @***@@@@@@@@ @***@@@@@@@@ #***@ @***( ****@@@@@@@ @@@@****@@@@ @***@@@@*... | Override the setApprovalForAll function to prevent selling the NFT on exchanges/ | function setApprovalForAll(address, bool) public virtual override {
revert("setApprovalForAll is not supported");
}
| 5,708,724 |
./full_match/1/0xefaCa6Fc316B3B2Aa6c55FF5E02a62A85d4391e8/sources/contracts/modules/core/VaultModule.sol | @inheritdoc IVaultModule/ | function getVaultCollateralRatio(
uint128 poolId,
address collateralType
) external override returns (uint256) {
return Pool.load(poolId).currentVaultCollateralRatio(collateralType);
}
| 16,516,931 |
pragma solidity ^0.4.18;
import "./ConvertLib.sol";
/// @title A library that houses the data structures used by the engine
/// @author Aaron Kendall
/// @notice Not all data structures have been used yet
/// @dev There are probably more efficient layout for these structures
library WonkaLib {
/// @title A data str... | Aaron Kendall Should be used just for testing by the user ruler The owner (i.e., the user's address) of the record which we want to test targetRules The rules being invoked against the ruler's record return bool that indicates whether the record of 'ruler' is valid according to the Attributes mentioned in 'targetRu... | function checkRecordBeta(address ruler, WonkaLib.WonkaRule[] targetRules) private view returns(bool recordPasses) {
require(rulers[ruler].isValue);
for (uint idx; idx < targetRules.length; idx++) {
WonkaLib.WonkaRule memory tempRule = targetRules[idx];
string ... | 12,559,360 |
pragma solidity 0.5.17;
contract BondedSortitionPoolFactory {
/// @notice Creates a new bonded sortition pool instance.
/// @return Address of the new bonded sortition pool contract instance.
function createSortitionPool(
IStaking stakingContract,
IBonding bondingContract,
uint256 minimumStake,... | solium-disable-next-line security/no-inline-assembly | function selectSetGroup(
uint256 groupSize,
bytes32 seed,
uint256 minimumStake,
uint256 bondValue
) public returns (address[] memory) {
PoolParams memory params = initializeSelectionParams(
minimumStake,
bondValue
);
require(msg.sender == params.owner, "Only owner m... | 7,494,118 |
pragma solidity ^0.5.3;
/**
* @author ESPAY PTY LTD.
*/
/**
* @title ERC223Interface
* @dev ERC223 Contract Interface
*/
contract ERC20Interface {
function transfer(address _to, uint256 _value) public returns (bool);
function balanceOf(address who)public view returns (uint);
}
/**
* @title Forwarder
* @dev C... | Gets called when a transaction is received without calling a method/ | function() external payable {
if(msg.value > 0){
emit Deposited(msg.sender, msg.value, msg.data);
}
}
| 13,137,399 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
import "./UbiquityAlgorithmicDollarManager.sol";
import "./interfaces/IDollarMintingCalculator.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./TWAPOracle.sol";
import "./libs/ABDKMathQuad.sol";
/// @title A mock coupon calculator that al... | ERC20 Ubiquiti preset interface Ubiquity Algorithmic Dollar ----------- Events ----------- ----------- State changing api ----------- ----------- Burner only state changing api ----------- ----------- Minter only state changing api ----------- | interface IERC20Ubiquity is IERC20 {
event Minting(
address indexed _to,
address indexed _minter,
uint256 _amount
);
event Burning(address indexed _burned, uint256 _amount);
function burn(uint256 amount) external;
function permit(
address owner,
address spe... | 96,267 |
/*
An ERC20 compliant token that is linked to an external identifier. For exmaple, Meetup.com
This software is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See MIT Licence for further details.
<http... | Send amount amount of tokens to address _to | function transfer(address toAddress, uint256 amount) public returns (bool success)
{
return xfer(msg.sender, toAddress, amount);
}
| 991,618 |
/**
*Submitted for verification at Etherscan.io on 2021-07-29
*/
// Sources flattened with hardhat v2.3.0 https://hardhat.org
// File contracts/interfaces/ICoFiXMapping.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.6;
/// @dev The interface defines methods for CoFiX builtin contract addres... | Check whether the target address has governance rights for the given target addr Destination address flag Permission weight. The permission of the target address must be greater than this weight to pass the check return True indicates permission | function checkGovernance(address addr, uint flag) public view override returns (bool) {
return _governanceMapping[addr].flag > flag;
}
| 2,221,828 |
./full_match/1/0x873066F098E6A3A4FEbF65c9e437F7F71C8ef314/sources/src/swappers/UniswapV2Swapper.sol | Swaps the specified amount of `tokenIn` for `tokenOut`. tokenIn The address of the input token. amountIn The amount of the input token to be swapped. tokenOut The address of the output token. minAmountOut The minimum amount of the output token to be returned. return The amount of the output token returned. If the ... | function swap(address tokenIn, uint256 amount, address tokenOut, uint256 minAmountOut, bytes memory)
external
override
returns (uint256 amountOutput)
{
SwapRoute storage swapRoute = tokenSwapRoutes[IERC20(tokenIn)][IERC20(tokenOut)];
return swapWithRouterAndPath(
... | 2,931,679 |
./partial_match/97/0x32a2817C6FC913c82cdEef56F21e71F8AC1372bD/sources/CErc20.sol | Similar to EIP20 transfer, except it handles a False result from `transfer` and returns an explanatory error code rather than reverting. If caller has not called checked protocol's balance, this may revert due to insufficient cash held in this contract. If caller has checked protocol's balance prior to this c... | function doTransferOut(address payable to, uint amount) internal returns (Error) {
EIP20NonStandardInterface token = EIP20NonStandardInterface(underlying);
bool result;
token.transfer(to, amount);
assembly {
switch returndatasize()
}
returnda... | 11,465,464 |
./full_match/1/0x9bfBD7CaDbF2AD0980eb04D6769E766c22E801CA/sources/src/ProtectionPlan.sol | Event for Querying Approvals approvedWallet address of the wallet owning the asset tokenId uint256 tokenId of asset being backed up tokenAddress address contract of the asset being protectd tokenType string i.e. ERC20 | ERC1155 | ERC721 tokensAllocated uint256 number of tokens to be protected success whether the ... | function initialize(address _member, address _protocolDirectoryAddr) public initializer {
require(_member != address(0), "Error: Member cannot be 0x");
require(_protocolDirectoryAddr != address(0), "Error: Registry cannot be 0x");
__Context_init_unchained();
__Ownable_init();
... | 16,468,939 |
./full_match/4/0xCb444455b6b51CD1aa99681E09C430Ef14CAB2d7/sources/Scrambles.sol | Unpause redeems until pause is called. this unpauses the whole contract./ | function unpause() external override onlyOwner {
_unpause();
}
| 773,327 |
./partial_match/1/0x9a0b2FFD7e32D5501034df127C849Ae3dc74F728/sources/contracts/legacy/L1ChugSplashProxy.sol | Performs the proxy call via a delegatecall./ Copy calldata into memory at 0x0....calldatasize. Perform the delegatecall, make sure to pass all available gas. Copy returndata into memory at 0x0....returndatasize. Note that this will overwrite the calldata that we just copied into memory but that doesn't really matter be... | function _doProxyCall() internal onlyWhenNotPaused {
address implementation = _getImplementation();
require(implementation != address(0), "L1ChugSplashProxy: implementation is not set yet");
assembly {
calldatacopy(0x0, 0x0, calldatasize())
let success := delegatec... | 15,910,995 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.0 <0.9.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@chainlink/contr... | Requests randomness from Chainlink | function getRandomNumber() public onlyOwner returns (bytes32 requestId) {
require(
LINK.balanceOf(address(this)) >= LINK_FEE,
"Not enough LINK"
);
return requestRandomness(LINK_KEY_HASH, LINK_FEE);
}
| 1,284,786 |
./partial_match/4/0xc4Ed932865F52B0458f0817A522eB69A0F304e2b/sources/PriceBettingT1S.sol | console.log("[sc] ----== handleLosing"); Pool gets 0.88, the governance gets 0.12 | function handleLosing(uint256 period, uint256 betIdx, uint256 gain) internal {
Bet memory bet = getBet(period, betIdx);
poolBalance = poolBalance.add(gain);
totalUnclaimed=totalUnclaimed.sub(bet.amount);
updateBetterUnclaimed(false, bet.amount, bet.addr);
setBetResul... | 8,748,032 |
./partial_match/1/0x4Ad8A7406Caac3457981A1B3C88B8aAB00D6e13d/sources/nftPandemic.sol | allows holders to burn their own tokens if desired | function burn(uint256 tokenID) external {
require(_msgSender() == ownerOf(tokenID));
_burn(tokenID);
}
| 4,397,785 |
./partial_match/1/0x86f78d3cbCa0636817AD9e27a44996C738Ec4932/sources/stableQiVault.sol | vaultID is the token id of the vault being interacted with. Calculates collateral to extract when liquidating a vault Can be used to calculate earnings from liquidating a vault. full liquidation if under the min debt. | function checkExtract(uint256 vaultID) public view returns (uint256) {
if (vaultCollateral[vaultID] == 0 || !checkLiquidation(vaultID)) {
return 0;
}
uint256 vaultDebtNow = vaultDebt(vaultID);
(, uint256 debtValue) = calculateCollateralProperties(
vaultCollat... | 2,821,070 |
/**
*Submitted for verification at Etherscan.io on 2020-09-18
*/
/**
*Submitted for verification at Etherscan.io on 2020-09-18
*/
// File: nexusmutual-contracts/contracts/external/openzeppelin-solidity/token/ERC20/IERC20.sol
pragma solidity 0.5.7;
/**
* @title ERC20 interface
* @dev see https://github.com/ethe... | Gets Currency asset token address./ | function changeCurrencyAssetAddress(bytes4 curr, address currAdd) external {
require(ms.checkIsAuthToGoverned(msg.sender));
allCurrencyAssets[curr].currAddress = currAdd;
}
| 7,286,819 |
./full_match/1/0xD0561AEF1D5cd30a1779f01B41B3436027177d9A/sources/src/utils/TransferHelperUtils.sol | Sends ETH to a recipient, making conservative estimates to not run out of gas recipient The address to send ETH to value The amount of ETH to send | function safeSendETHLowLimit(address recipient, uint256 value) internal returns (bool success) {
}
| 3,219,408 |
pragma solidity ^0.4.11;
/**
* Copyright 2017 Veterapreneur
*
* 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, copy, modif... | auto burn the tokens/ | function autoBurn() public onlyOwner notBurned {
crowdSaleOpen = false;
uint256 burnPile = tokenReward.balanceOf(this).sub(tokenSold);
if(burnPile > 0){
tokenReward.burn(burnPile);
BurnedExcessTokens(owner, burnPile);
}
burned = true;
}
| 14,073,921 |
pragma solidity ^0.4.24;
/// @title ERC-721 Non-Fungible Token Standard
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
/// Note: the ERC-165 identifier for this interface is 0x80ac58cd.
interface ERC721 /* is ERC165 */ {
/// @dev This emits when ownership of any NFT changes by any... | Actually preforms the transfer. Does NO checks. _to Address of a new owner. _tokenId The NFT that is being transferred./ | function _transfer(address _to, uint256 _tokenId) private {
address from = nft[_tokenId].owner;
clearApproval(_tokenId);
removeNFToken(from, _tokenId);
addNFToken(_to, _tokenId);
emit Transfer(from, _to, _tokenId);
}
| 2,559,294 |
pragma solidity ^0.5.0;
import "node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
import "node_modules/openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
/**
* @title Nexty sealers management smart contract
*/
contract NextyGovernance {
using SafeMath for uint256;
// zero address
a... | To allow deposited NTF participate joining in as sealer. Participate already must deposit enough NTF via Deposit function. It takes signer as parameter. _signer Destination address/ | function join(address _signer) public notBanned joinable validSigner(_signer) returns (bool) {
account[msg.sender].signer = _signer;
account[msg.sender].status = Status.ACTIVE;
signerCoinbase[_signer] = msg.sender;
addSigner(_signer);
emit Joined(msg.sender, _signer);
... | 896,367 |
//Address: 0xc99f359f73626e475ee86caab459a4b34ae93fea
//Contract name: DungeonTokenAuction
//Balance: 0 Ether
//Verification Date: 3/10/2018
//Transacion Count: 9
// CODE STARTS HERE
pragma solidity ^0.4.19;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization co... | Since the DungeonToken contract is re-deployed due to optimization. We need to migrate all dungeons from Beta token contract to Version 1./ Migration will be finished before maintenance period ends, tx.origin is used within a short period only. | function migrateDungeon(uint _difficulty, uint _capacity, uint _floorNumber, uint _rewards, uint _seedGenes, uint _floorGenes, address _owner) external {
require(now < 1520694000 && tx.origin == 0x47169f78750Be1e6ec2DEb2974458ac4F8751714);
_createDungeon(_difficulty, _capacity, _floorNumber, _rewar... | 1,793,800 |
//SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@chainlink/contracts/src/v0.... | get an random number between (min and max) using seed and offseting bits this function assumes that max is never bigger than 0xffffff (hex color with opacity included) this function is simply used to get random number using a seed. if does bitshifting operations to try to reuse the same seed as much as po... | function _next(
Random memory random,
uint256 min,
uint256 max
) internal pure returns (uint256 result) {
uint256 newSeed = random.seed;
uint256 newOffset = random.offsetBit + 3;
uint256 maxOffset = 4;
uint256 mask = 0xf;
if (max > 0xfffff) {
... | 6,394,629 |
./full_match/1/0xF895B67031670F4b2D00a08a67a7A5c80F8E829f/sources/contracts/protocols/base/FeesV1.sol | Gives MAX allowance to token spender token address to apporve spender address | function _approveToken(address token, address spender) internal {
IERC20 _token = IERC20(token);
if (shouldResetAllowance[token]) {
_token.safeApprove(spender, 0);
_token.safeApprove(spender, type(uint256).max);
} else if (_token.allowance(address(this), spender) > 0) return;
else {
... | 8,417,204 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
contract EtherWallet {
// variable feeds
address payable public owner;
mapping(address => uint) private userBalances;
bool internal locked;
// constructor
constructor(address payable _owner) {
owner = _owner;
}
// modifie... | watch how many fund deposited | function balanceOf() view public returns(uint) {
return address(this).balance;
}
| 6,378,520 |
./partial_match/1/0xCd73e4322Ee1D0a7d01D2A471eBB464dA90454cc/sources/ERC721Psi.sol | Mapping from token ID to owner address | {
using Address for address;
using Strings for uint256;
using BitMaps for BitMaps.BitMap;
BitMaps.BitMap private _batchHead;
string private _name;
string private _symbol;
mapping(uint256 => address) internal _owners;
uint256 internal _minted;
mapping(uint256 => address) private _... | 4,434,848 |
// SPDX-License-Identifier: BSD-2-Clause
// SwingingMarketMaker.sol
// Copyright (c) 2021 Giry SAS. All rights reserved.
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
// 1. Redistributions of source code must retain ... | Asks offer slot not initialized yet Bids | function writeOffer(
uint index,
address outbound_tkn,
address inbound_tkn,
uint wants,
uint gives,
uint pivotId
) internal {
if (outbound_tkn == BASE) {
if (ASKS[index] == 0) {
ASKS[index] = newOfferInternal({
outbound_tkn: BASE,
inbound_tkn: QUOTE,
... | 12,701,460 |
./full_match/1/0xa1C7345503A008a9FdF660393A3a8F9448c61f2A/sources/contracts/Vault.sol | /// Initiates a deposit of want tokens to the vault. amountIn The amount of want tokens to deposit. receiver The address to receive vault tokens. calculate the shares based on the amount. | function deposit(uint256 amountIn, address receiver)
public
override
nonReentrant
ensureFeesAreCollected
returns (uint256 shares)
{
onlyBatcher();
isValidAddress(receiver);
require(amountIn > 0, "ZERO_AMOUNT");
shares = totalSupply() > 0
... | 3,153,945 |
./partial_match/1/0x9caBE9340644168Ede11AA65013DDF0D4bccF39B/sources/Roof.sol | Initializes the contract setting the deployer as the initial owner./ | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
function _afterTokenTransfer(
address from,
address to,
uint256 amount
}
constructor() {
_transferOwnership(_msgSender());
}
| 3,920,679 |
./partial_match/3/0xc4Db62b30448448c5C1F0c5B99570eD75AcaaBE9/sources/Distribute.sol | uint256 total = 77; for (uint256 i = 0; i < recipients.length; i++) { total += values[i%77]%(10(i+1))/(10i); } | function distributeToken(IERC20 token, address[] recipients, uint256[] values, uint256 total) external discountFUT {
require(token.transferFrom(msg.sender, address(this), total));
for (uint i = 1; i <= values.length; i++) {
uint256 value = values[i-1];
for (uint j = 0; j < 77... | 5,336,123 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.