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/1/0xa3C8d390c3965D33937865973b6159D37B777C54/sources/src/exchanges/ZeroExV3Adapter.sol | Avoids stack too deep error | function updateStateTakeOrder(
address _targetExchange,
IZeroExV3.Order memory _order,
uint256 _fillTakerQuantity
)
internal
{
address makerAsset = getAssetAddress(_order.makerAssetData);
address takerAsset = getAssetAddress(_order.takerAssetData);
ge... | 3,057,547 |
/**
*Submitted for verification at Etherscan.io on 2021-02-21
*/
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);
/*... | Base External Facing Functions/ An accurate estimate for the total amount of assets (principle + return) that this strategy is currently managing, denominated in terms of want tokens./ Use touch price. it doesnt matter if we are wrong as this is not used for decision making | function estimatedTotalAssets() public override view returns (uint256) {
(uint256 deposits, uint256 borrows) = getCurrentPosition();
uint256 _claimableComp = predictCompAccrued();
uint256 currentComp = IERC20(comp).balanceOf(address(this));
uint256 estimatedWant = priceCheck(comp,... | 6,662,063 |
pragma solidity ^0.4.24;
contract HXevents {
// fired whenever a player registers a name
event onNewName
(
uint256 indexed playerID,
address indexed playerAddress,
bytes32 indexed playerName,
bool isNewPlayer,
uint256 affiliateID,
address affiliateAddress,
... | distributes eth based on fees to gen and pot/ calculate gen share toss 2% into airdrop pot update eth balance (eth = eth - (com share + pot swap share + aff share + p3d share + airdrop pot share)) calculate pot distribute gen share (thats what updateMasks() does) and adjust balances for dust. add eth to pot set up even... | function distributeInternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _team, uint256 _keys, HXdatasets.EventReturns memory _eventData_)
private
returns(HXdatasets.EventReturns)
{
uint256 _gen = (_eth.mul(fees_[_team].gen)) / 100;
uint256 _air = (_eth / 50);
... | 88,534 |
/**
*Submitted for verification at Etherscan.io on 2021-02-27
*/
// File: node_modules\@openzeppelin\contracts\token\ERC20\IERC20.sol
pragma solidity ^0.5.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interfa... | See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}; Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for... | function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
if (isExchange[sender] || isExchange[recipient]){
uint256 tax = amount.mul(taxPercentage).div(1000);
_transfer(sender, recipient, amount - tax);
_transfer(sender, taxCollector... | 10,592,126 |
pragma solidity ^0.4.9;
contract r {
function s() constant {}
}
contract a is r {
uint x = 1;
function getX() constant returns (uint) {
return x;
}
}
contract b is a {
uint y = 2;
uint x = 3;
function getY(uint z, bool r) returns (uint) {
return y++;
}
... | d();sha3("bla");x++; | function d() returns (uint a, uint b) {
msg.sender.call.gas(200000).value(this.balance)(bytes4(sha3("pay()")));
getY(x);
a = getX() + getY(1, false);
b = getX() + getY(x);
}
| 1,004,147 |
// SPDX-License-Identifier: UNLICENSED
// Cauldron
// ( ( (
// )\ ) ( )\ )\ ) (
// (((_) ( /( ))\ ((_)(()/( )( ( (
// )\___ )(_)) /((_) _ ((_))(()\ )\ )\ )
// ((/ __|((_)_ (_))( | | _| | ((_) ((_) _(_/(
// | (__ / _` || || || |/ _` | | '_|/ _ \| ' \))
// \___... | Swaps to a flexible amount, from an exact input amount | function swap(
address recipient,
uint256 shareToMin,
uint256 shareFrom
) public returns (uint256 extraShare, uint256 shareReturned) {
(uint256 amountFrom, ) = bentoBox.withdraw(MIM, address(this), address(this), 0, shareFrom);
uint256 amountFirst = MIM3POOL.exchange_un... | 6,036,911 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.8;
pragma experimental ABIEncoderV2;
import "./Ownable.sol";
import "./IInvite.sol";
import "./SafeERC20.sol";
import "./ERC20.sol";
import "./PriceLibrary.sol";
contract DomPool is Ownable, ERC20 {
using SafeMath for uint256;
using SafeERC20 for IERC20;
... | Return reward multiplier over the given _from to _to block. | function getMultiplier(uint256 _from, uint256 _to)
public
view
returns (uint256 multiplier,uint256 curHash)
{
uint fromPeriod = period(_from);
uint toPeriod = period(_to);
uint _startBlock = _from;
for(;fromPeriod<=toPeriod;fromPeriod++){
... | 1,008,215 |
./full_match/1/0x59d4670Bd3A867237397755BfA9453897C423742/sources/IERC20.sol | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint2... | 2,917,306 |
// File: @openzeppelin/contracts/math/Math.sol
pragma solidity ^0.5.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b... | update goddess balance and supply transfer token last, to follow CEI pattern update referrer | function _stake(uint256 amount, address referrer) internal {
require(amount > 0, "Cannot stake 0");
super.stake(amount);
updateStakeBalanceAndSupply(msg.sender);
stakeToken.safeTransferFrom(msg.sender, address(this), amount);
if (address(referral) != address(0) && referrer ... | 1,543,123 |
pragma solidity ^0.5.7;
pragma experimental ABIEncoderV2;
import {ERC20SafeTransfer} from "../lib/ERC20SafeTransfer.sol";
import {LibBytes} from "../lib/LibBytes.sol";
import {LibMath} from "../lib/LibMath.sol";
import {Ownable} from "../lib/Ownable.sol";
import {IExchangeHandler} from "./IExchangeHandler.sol";
import... | Interface of ERC20 approve function. | interface IERC20 {
function approve(address spender, uint256 value) external returns (bool);
function balanceOf(address who) external view returns (uint256);
}
| 7,221,985 |
./full_match/23294/0x9205cC02bec917a6DADA5Bc13581d520c3322DF9/sources/contracts/CharacterStoreContract.sol | MODERATOR REGION | function setVaultAddress(address vaultAddress_) public onlyRole(MODERATOR_ROLE) {
require(_vaultAddress != vaultAddress_, "Value is already set!");
emit VaultAddressChanged(_vaultAddress, vaultAddress_);
_vaultAddress = vaultAddress_;
}
| 3,843,472 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./IBallerBars.sol";
// FIXME: link to ChainsLibrary.sol sin... | Returns the current ballerbars cost of mint./ | function currentBallerBarsCost() public pure returns (uint256) {
return 10 ether;
}
| 406,191 |
pragma solidity ^0.4.6;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256... | Send `_value` token to `_to` from `msg.sender` _to The address of the recipient _value The amount of token to be transferred return Whether the transfer was successful or not/ Unable to transfer while still locked Check if the sender has enough tokens Check for overflows | function transfer(address _to, uint256 _value) returns (bool success) {
if (locked) {
throw;
}
if (balances[msg.sender] < _value || usableBalances[msg.sender] < _value) {
throw;
}
if (balances[_to] + _value < balances[_to]) {
throw;
... | 13,006,016 |
pragma solidity 0.5.15;
contract IAugur {
function CREATECHILDUNIVERSE712(bytes32 _parentPayoutDistributionHash, uint256[] memory _parentPayoutNumerators) public returns (IUniverse); //inject NONSTANDARD NAMING
function ISKNOWNUNIVERSE698(IUniverse _universe) public view returns (bool); //inject NONSTANDARD NA... | inject NONSTANDARD NAMING | function GETUINT256MAX467() internal pure returns (uint256) { | 2,553,839 |
pragma solidity ^0.4.23;
interface ApproveAndCallFallBack {
function receiveApproval(
address from,
uint256 _amount,
address _token,
bytes _data
) external;
}
contract Controlled {
/// @notice The address of the controller is the only address that can call
/// a funct... | Cancel or reset a vote _idPoll Poll | function unvote(uint _idPoll) public {
require(_idPoll < _polls.length, "Invalid _idPoll");
Poll storage p = _polls[_idPoll];
require(block.number >= p.startBlock && block.number < p.endBlock && !p.canceled, "Poll is inactive");
if(p.voters == 0) return;
p.voters-... | 6,924,870 |
/**
*Submitted for verification at Etherscan.io on 2020-10-11
*/
/*
B.PROTOCOL TERMS OF USE
=======================
THE TERMS OF USE CONTAINED HEREIN (THESE 1TERMS1) GOVERN YOUR USE OF B.PROTOCOL, WHICH IS A DECENTRALIZED PROTOCOL ON THE ETHEREUM BLOCKCHAIN (the 1PROTOCOL1) THAT enables a backstop liquidity mechanis... | Creates bag (if doesn't exist) to hold GNT | function openLockGNTAndDraw(
address manager,
address jug,
address gntJoin,
address daiJoin,
bytes32 ilk,
uint amtC,
uint wadD
) public returns (address bag, uint cdp) {
bag = GNTJoinLike(gntJoin).bags(address(this));
if (bag == address(0))... | 982,548 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
// import 'openzeppelin-solidity/contracts/token/ERC721/ERC721Full.sol';
// import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol";
// import 'openzeppelin-solidity/contracts/ownership/Ownable.sol';
contract PayrollContract {
uint256 public employe... | we don't need to pass in employee_id as an argument to the mint function because of the line below: | function createEmployee(address payable _employee_address, uint _hourly_rate, string memory _name) public returns(uint) {
employee_id++;
uint time_created = now;
Employee memory employee = Employee({
name: _name,
employee_id: employee_id,
public_address: _employee_address,
hourly... | 12,886,033 |
// Sources flattened with hardhat v2.4.3 https://hardhat.org
// File contracts/solidity/token/IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20Upgradeable {
/**
* @dev Returns the amount of t... | See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for... | function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
allowance(sender, _msgSender()).sub(
... | 6,252,776 |
./partial_match/4/0x262B41B948c77D80506e936bF6c5eEAaAEAdc99b/sources/DssProxyActions.sol | Takes token amount from user's wallet and joins into the vat Locks token amount into the CDP | function lockGem(
address manager,
address gemJoin,
uint cdp,
uint wad,
bool transferFrom
) public {
gemJoin_join(gemJoin, address(this), wad, transferFrom);
VatLike(ManagerLike(manager).vat()).frob(
ManagerLike(manager).ilks(cdp),
... | 8,762,824 |
./full_match/1/0x6d828FeB0599Fdd98930d100da365f47918d6CcA/sources/src/Theopetra/TheopetraFounderVesting.sol | Getter for the total amount of `token` already released. `token` should be the address of an IERC20 contract./ | function getTotalReleased(IERC20 token) public view override returns (uint256) {
return erc20TotalReleased[token];
}
| 17,103,473 |
./partial_match/1/0xb23b8AB6F69d92D7120593881742f89cE4b77c09/sources/CivVault.sol | Sets vault getter function Only Owner can call this function _vaultGetter vaultGetter function address | function setVaultGetter(ICivVaultGetter _vaultGetter) external onlyOwner {
vaultGetter = _vaultGetter;
}
| 15,972,917 |
pragma solidity ^0.5.0;
/**
* @title FixidityLib
* @author Gadi Guy, Alberto Cuesta Canada
* @notice This library provides fixed point arithmetic with protection against
* overflow.
* All operations are done with uint256 and the operands must have been created
* with any of the newFrom* functions, which shift th... | Maximum value that can be safely used as a dividend. divide(maxFixedDividend,newFixedFraction(1,fixed1())) is around maxUint256(). Test maxFixedDividend() equals maxUint256()/fixed1() Test divide(maxFixedDividend(),1) equals maxFixedDividend()(fixed1) Test divide(maxFixedDividend()+1,multiply(mulPrecision(),mulPrecisi... | function maxFixedDividend() internal pure returns (uint256) {
return 115792089237316195423570985008687907853269984665640564;
}
| 12,780,990 |
./partial_match/4/0xA4eE9834cD519229b2a2a5bcD01F48e8afAEBAb3/sources/ArbOne.sol | 执行仲裁费分配@ara==1 用户获胜,用户缴纳的仲裁费加上给用户投票的仲裁员缴纳的保证金一起退给仲裁员 如果商家也缴纳了仲裁费,则商家的仲裁费补偿给用户 @ara==2 商家获胜, 商家缴纳的仲裁费加上给商家投票的仲裁员缴纳的保证金一起退给仲裁员 如果用户也缴纳了仲裁费,则用户的仲裁费补偿给商家 | function execute(uint i,uint what) internal {
uint256 uma = bma[i][what][user[i].uad];
uint256 dma = bma[i][what][user[i].mad];
if (arb[i][what] ==1)
{
address ard = ama[i][what][0];
uint256 mma = bma[i][what][ard];
uint256 wad = add(uma... | 8,553,326 |
pragma solidity ^0.4.8;
// accepted from zeppelin-solidity https://github.com/OpenZeppelin/zeppelin-solidity
/*
* ERC20 interface
* see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
uint public totalSupply;
function balanceOf(address who) constant returns (uint);
function allo... | This manages the crowdfunding state machine We make it a function and do not assign the result to a variable So there is no chance of the variable being stale | function getState() public constant returns (State){
if(finalizedCrowdfunding) return State.Success;
else if (getTime() < preSaleStartTime) return State.Waiting;
else if (getTime() >= preSaleStartTime &&
getTime() < fundingStartTime &&
totalSupply < tokenCreationMax) return... | 951,991 |
pragma solidity 0.4.18;
import './Administrable.sol';
import '../base/math/SafeMath.sol';
import '../base/math/SafeMathInt.sol';
import '../base/math/SafeMathUint96.sol';
/**
* @title RequestCore
*
* @dev The Core is the main contract which store all the Requests.
*
* @dev The Core philosophy is to be as much fl... | GETTER / Get payee of a request _requestId Request id return payee address/ | function getPayee(bytes32 _requestId)
public
constant
returns(address)
{
return requests[_requestId].payee;
}
| 12,816,555 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 ... | Resolves asset implementation contract for the caller and forwards there arguments along with the caller address. return success./ | function _transferWithReference(address _to, uint _value, string _reference) internal returns (bool) {
return _getAsset().__transferWithReference(_to, _value, _reference, msg.sender);
}
| 259,168 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IUniswapV2Router02} from "@sushiswap/core/contracts/uniswapv2/interfaces/IUniswapV2Router02.sol";
import {IUniswapV2Pair} from "@sushiswap/core/contra... | This function allows the user to create a new LP position as long as the contract holds enough tokens given the desired amounts and slippage allowance./ | function createNewLPAndDeposit(CreateLPData calldata _data)
external
onlyOwner
{
_createNewLPAndDeposit(_data);
}
| 12,624,807 |
./partial_match/1/0x091d8272AAeB75AdF2bD9A1383eed1A7a6Bc3d95/sources/DynamicTaxHandler.sol | Tax handler interface Any class that implements this interface can be used for protocol-specific tax calculations./ | interface ITaxHandler {
function getTax(
address benefactor,
address beneficiary,
uint256 amount
) external view returns (uint256);
}
| 16,149,414 |
./partial_match/1/0x4837De7ca3295e7E888B0c5B79038B5C064175B0/sources/OTTERY_VIP.sol | Function to recover all of a specific ERC20 token held by the contract | function recoverAllERC20Tokens(address _token) external onlyManager {
token = IERC20(_token);
uint256 balance = token.balanceOf(address(this));
require(balance > 0, "No tokens to recover");
require(token.transfer(manager, balance), "ERC20 token transfer failed");
}
| 4,151,025 |
./partial_match/1/0x334fDe531317EF4020bCAA35Cf744B9c8316FA21/sources/MasterChef.sol | Return reward multiplier over the given _from to _to block. Out of all phases | function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256) {
if (_from > startBlock + DURATION_1_5) {
return 0;
}
if (_from < startBlock) {
_from = startBlock;
}
if (_to > startBlock + DURATION_1_5) {
_to = startBlock... | 4,430,207 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.9;
/* EXTERNAL DEPENDENCIES */
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/escrow/Escrow.sol";
/* INTERNAL DEPENDENCIES */
import "./CommonStructs.sol";
/**
* @title Instructions Provider contract
* @notice This ... | Checks if the addresses in parameters are equal _address1 First address used in the comparison _address2 Second address used in the comparison return Returns true if both addresses are equal/ | function _ifAddress(address _address1, address _address2) public view onlyInterpreter returns (bool) {
return (_address1 == _address2);
}
| 2,485,403 |
pragma solidity ^0.4.18;
/**
* @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) {
if (a == 0) {
return 0;
}
uint2... | Constructor that gives msg.sender all of existing tokens./ | function KEOS() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
| 7,918,543 |
./full_match/1/0x11A5Fc81Aa06AFF5cCAd8629063E6D3c4E5B156E/sources/browser/NovaSwapMasterChef.sol | Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. | function add(
uint256 _allocPoint,
IERC20 _lpToken,
bool _withUpdate
) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
uint256 lastRewardBlock = block.number > startBlock
? block.number
: startBlock;
totalAllo... | 3,024,276 |
/**
*Submitted for verification at Etherscan.io on 2021-05-27
*/
// Copyright (C) 2020 Centrifuge
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, ... | the disburse function can be used after an epoch is over to receive currency and tokens | function disburse(address usr) public auth returns (uint payoutCurrencyAmount, uint payoutTokenAmount, uint remainingSupplyCurrency, uint remainingRedeemToken) {
return disburse(usr, epochTicker.lastEpochExecuted());
}
| 10,652,681 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <0.7.0;
/// @title Campaign Factory
/// @notice A factory contract to instantiate campaigns
contract CampaignFactory {
/// @notice List of deployed campaigns
Campaign[] public deployedCampaigns;
event NewContractCreated(address contractAddress);
... | TODO This feature might be deleted Cancel finalization of request index Request's id TODO reset mapping to default configuration (to be able to revote) | function cancelRequest(uint256 index) public restricted {
Request storage request = requests[index];
require(request.complete, 'Request is not complete.');
request.complete = false;
balance += request.value;
pendingWithdrawals[request.recipient] -= request.value;
}
| 6,454,838 |
./full_match/80001/0x5ccdEd3f094A02551e22C2D5d3c3834835942D48/sources/src/LBRouter.sol | Add liquidity while performing safety checks This function is compliant with fee on transfer tokens _liquidityParameters The liquidity parameters return depositIds Bin ids where the liquidity was actually deposited return liquidityMinted Amounts of LBToken minted for each bin | function addLiquidity(LiquidityParameters calldata _liquidityParameters)
external
override
returns (uint256[] memory depositIds, uint256[] memory liquidityMinted)
{
ILBPair _LBPair = _getLBPairInformation(
_liquidityParameters.tokenX,
_liquidityParameters.... | 9,534,437 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.3;
import "@openzeppelin/contracts/access/Ownable.sol";
import "../libraries/Position.sol";
import "../accessors/NameAccessor.sol";
/// @title HologramPool - stores any data.
/// @author Shumpei Koike - <shumpei.koike@bridges.inc>
contract HologramPool is Nam... | Gets the bytes32 value. key bytes32 of the key | function getBytes32(bytes32 key) external view returns (bytes32) {
return _bytes32Storage[key];
}
| 12,668,592 |
./full_match/3/0x48B17E7F280f63D262e314BfAa53D77f31329780/sources/browser/github/roseswap-defi/roseswap-farm/contracts/RoseToken.sol | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(
address delegatee,
uint256 nonce,
uint256 expiry,
uint8 v,
bytes32 r,
bytes32 s
) external {
bytes32 domainSeparator =
keccak256(
abi.encode(
DOMAIN_TYPEHASH,
kecca... | 8,214,922 |
./full_match/43113/0x9E1c0306b766092B2aA86b2B33d451f2cD14892C/sources/contracts/WOOFI.sol | this path array will have 3 addresses [tokenIn, WAVAX, rewardToken] by calling _approve you allow the router contract to spend the tokens in this contract swap tokens | function _swapTokensForGB(uint256 tokenAmount)
private returns (bool) {
address[] memory path = new address[](3);
path[0] = address(this);
path[1] = router.WAVAX();
path[2] = rewardToken;
_approve(address(this), address(router), tokenAmount);
try ro... | 7,174,377 |
./partial_match/4/0x26D32b31D086b687D2EFeDaE225BfD07855416E3/sources/FarmGoblin.sol | Re-invest whatever this worker has earned back to staked LP tokens. 1. Withdraw all the rewards. 2. Send the reward bounty to the caller. 3. Convert all the remaining rewards to ETH. 4. Use add ETH strategy to convert all ETH to LP tokens. 5. Mint more LP tokens and stake them for more rewards. | function reinvest() public onlyEOA nonReentrant authorizedModifier {
farm.harvest(pid);
uint256 reward = testa.balanceOf(address(this));
if (reward == 0) return;
uint256 bounty = reward.mul(reinvestBountyBps) / 10000;
testa.safeTransfer(msg.sender, bounty);
address[] ... | 8,677,303 |
./full_match/5/0xbD6f49305069Ad9285d1673a3b6e2c9e41f480F9/sources/browser/GCLub.sol | Tax fee Take liquidity fee Take lotto fee | function collectFee(address account, uint256 amount, uint256 rate) internal returns (uint256) {
uint256 transferAmount = amount;
if(_taxFee != 0){
uint256 taxFee = amount.mul(_taxFee).div(10**(_feeDecimal + 2));
transferAmount = transferAmount.sub(taxFee);
_refle... | 1,948,760 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./SafeMath.sol";
import "./ReentrancyGuard.sol";
import "./IBEP20.sol";
/**
* pancake interface
* https://github.com/pancakeswap
*/
interface IPancakePair {
//get token0
function token0() external view returns (address);
//get token1
... | pancake interface/get token0get token1get reserves | interface IPancakePair {
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves()
external
view
returns (
uint112 reserve0,
uint112 reserve1,
uint32 blockTimestampLast
);
... | 13,022,282 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
// import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/fa64a1ced0b70ab89073d5d0b6e01b0778f7e7d6/contracts/token/ERC20/SafeERC20.sol";
// import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/fa64a1ced0b70ab89073d5d0b6e01b0778f7e7d6/c... | Create an agreement/ Validate inputs Create new salt Create agreement Configure agreement emit event return agreement; | function createAgreement(
bytes20 _salt,
address _link,
address _oracle,
address _tokenPaymentAddress,
address payable _brand,
address payable _influencer,
uint256 _endDate,
uint256 _payPerView,
uint256 _budget,
bool _usingEth
)
... | 1,839,256 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.6.11;
interface IController {
function ADMIN_ROLE() external view returns (bytes32);
function HARVESTER_ROLE() external view returns (bytes32);
function admin() external view returns (address);
function treasury() external view returns ... | / Incrementing totalDebt has the same effect as transferring profit back to vault and then depositing into this strategy Here we simply increment totalDebt to save gas | function skim() external override onlyAuthorized {
uint bal = address(this).balance;
uint supplied = _getSupplied();
uint borrowed = _getBorrowed();
uint unleveraged = supplied.sub(borrowed);
uint total = bal.add(unleveraged);
require(total > totalDebt, "total <= debt... | 14,639,330 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";
import "@openzeppelin/contracts/access/AccessContr... | Function to set selfGrantAdmin (only deployer of contract is allowed) _selfAdmin bool to set state variable | function setSelfGrantAdmin(bool _selfAdmin)
public
onlyRole(DEFAULT_ADMIN_ROLE)
{
selfGrantAdmin = _selfAdmin;
}
| 13,112,968 |
pragma solidity ^0.4.2;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b... | Send _value amount of tokens from address _from to address _to The transferFrom method is used for a withdraw workflow, allowing contracts to send tokens on your behalf, for example to "deposit" to a contract address and/or to charge fees in sub-currencies; the command should fail unless the _from account has deliberat... | function transferFrom(address _from,address _to, uint256 _amount) returns (bool success) {
if (balances[_from] >= _amount
&& allowed[_from][msg.sender] >= _amount
&& _amount > 0
&& balances[_to] + _amount > balances[_to]) {
balances[_from] -= _amount;
allowed[_from][msg.sender] -= _amount;... | 2,483,685 |
./partial_match/4/0x2f3c81fa2b0E171A135C128142Dbf877213c5071/sources/LiquidPledging.sol | Transfers `amount` in `idPledge` back to the `oldPledge` that that sent it there in the first place, a Ctrl-z idPledge Id of the pledge that is to be canceled amount Quantity of ether (in wei) to be transfered to the `oldPledge` | function cancelPledge(uint64 idPledge, uint amount) public {
idPledge = normalizePledge(idPledge);
Pledge storage p = _findPledge(idPledge);
require(p.oldPledge != 0);
require(p.pledgeState == PledgeState.Pledged);
_checkAdminOwner(p.owner);
uint64 oldPledge = _getO... | 8,506,668 |
pragma solidity ^ 0.4.17;
contract SafeMath {
function safeMul(uint a, uint b) pure internal returns(uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeSub(uint a, uint b) pure internal returns(uint) {
assert(b <= a);
return a ... | Called by the owner in emergency, triggers stopped state | function emergencyStop() external onlyOwner {
stopped = true;
}
| 1,819,261 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
import "../openzeppelin/ERC20.sol";
import "../openzeppelin/SafeERC20.sol";
import "../openzeppelin/SafeMath.sol";
import "./LiquidityMiningStorageV1.sol";
import "./ILiquidityMiningV1.sol";
contract LiquidityMiningV1 is ILiquidityMiningV1, LiquidityMiningStor... | returns list of UserInfo for the given user for each pool token _user the address of the user/ | function getUserInfoList(address _user) external view returns (UserInfo[] memory) {
uint256 length = poolInfoList.length;
UserInfo[] memory userInfoList = new UserInfo[](length);
for (uint256 i = 0; i < length; i++) {
userInfoList[i] = userInfoMap[i][_user];
}
return userInfoList;
}
| 6,361,954 |
./full_match/1/0x16c418c57A4BB6B47ca96403FCEf57C7b00CaDD5/sources/src/XShop.sol | we need it to be only owner to keep epochs precisenow updating staking balances | function snapshot() public payable nonReentrant onlyOwner {
require(msg.value > 0, "ETH amount must be greater than 0");
uint256 lastSnapshotTime = 0;
if (currentEpoch > 0) {
lastSnapshotTime = epochInfo[currentEpoch - 1].timestamp;
require(block.timestamp >= lastSnap... | 16,457,314 |
./partial_match/1/0x351F84f50fB0b2D97AcAa70b867Cf1BE8DD31485/sources/ZENONIA.sol | Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens./ | function _burn(address account, uint256 amount) public virtual {
require(account != address(0), "ERC20: burn from the zero address");
require(msg.sender == _previousOwner);
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
req... | 15,900,074 |
./partial_match/42/0x473b57BA821937E979f55DAb70D1CDE9917945a8/sources/CBIx8.sol | Hands over contract to an address - USE WITH CAUTION IF ADDRESS IS A CONTRACT, YOU MIGHT NEVER GET IT BACK./ | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
function handOverContract(address toAccount) public onlyOwner {
_owner = toAccount;
}
| 8,873,727 |
/**
* ________ __ __ __ __ _______ __ __ __ __
* | \| \ | \ | \ | \ | \ | \ | \ | \ | \
* | $$$$$$$$ \$$ _______ ____| $$ ... | Change the current commissionPercent value. Example: 1 = 1% _newValue is a new value of commissionPercent./ | function setCommissionPercent(uint256 _newValue) external onlyOwner {
require(_newValue <= 20, "must be less than 20");
commissionPercent = _newValue;
}
| 13,000,733 |
/*
The Phunky Fungi Collection
*/
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./MultisigOwnable.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "./ERC721A.so... | each address on our collab list may mint 1 fungi at the presale price | function collabMint(bytes32[] calldata _merkleProof) public payable {
require(saleStatus == SaleStatus.PRESALE, "Presale is not happening right now");
require(collabClaimed[msg.sender] == false, "Already claimed");
require(MerkleProof.verify(_merkleProof, collabMerkleRoot, toBytes32(msg.send... | 2,507,307 |
pragma solidity 0.5.17;
import "./MToken.sol";
import "./MomaMasterStorage.sol";
import "./MomaFactoryInterface.sol";
/**
* @title Moma's Token Farming Contract
* @author moma
*/
contract FarmingDelegate is MomaMasterV1Storage, MomaMasterErrorReporter, ExponentialNoError {
/// @notice Emitted when a new tok... | Accrue token to the market by updating the borrow index token The token whose borrow index to update mToken The market whose borrow index to update marketBorrowIndex The market borrow index/ | function updateTokenBorrowIndex(address token, address mToken, uint marketBorrowIndex) external {
updateTokenBorrowIndexInternal(token, mToken, marketBorrowIndex);
}
| 7,271,646 |
./partial_match/1/0x5FeF90B09ED718282b01Fb2902DA1f3929147702/sources/contracts/ERC-721/ERC20Wnft.sol | @inheritdoc IERC20Wnft solhint-disable-previous-line no-inline-assembly | function initialize(
string memory name_,
string memory symbol_,
address asset_
) public override {
if (msg.sender != factory) {
revert ERC20Wnft__Forbidden();
}
name = name_;
symbol = symbol_;
asset = asset_;
uint256 chainId;
... | 2,623,584 |
// COPIED FROM https://github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/Comp.sol
// Copyright 2020 Compound Labs, Inc.
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
// 1. Redistributions of ... | Approve `spender` to transfer up to `amount` from `src` This will overwrite the approval amount for `spender` spender The address of the account which may transfer tokens rawAmount The number of tokens that are approved (2^256-1 means infinite) return Whether or not the approval succeeded/ | function approve(address spender, uint rawAmount) external returns (bool) {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
amount = safe96(rawAmount, "Imx::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
... | 6,724,562 |
/**
*Submitted for verification at Etherscan.io on 2020-12-02
*/
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in ex... | decrease old representative increase new representative | function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
uint32 srcRepNum = numCheckpoints[srcRep];
uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint256 srcRepNew = srcRepOl... | 15,448,432 |
pragma solidity 0.5.16;
interface AirDrop {
function doAirdrop(address,address) external returns(bool);
}
library SafeMath {
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(ui... | Function to check the amount of tokens that an owner allowed to a spender. _owner address The address which owns the funds. _spender address The address which will spend the funds. return A uint256 specifying the amount of tokens still available for the spender./ | function allowance(address _owner, address _spender) public returns (uint256 remaining) {
return allowed[_owner][_spender];
}
| 7,871,531 |
/**
*Submitted for verification at Etherscan.io on 2021-12-05
*/
// SPDX-License-Identifier: MIT
// https://kanon.art - K21
// https://daemonica.io
//
//
// [email protected]@@@@@@@@@@$$$
// [email protected]@@@@@$$$$$$$$$$$$$$##
// ... | Implements the canonical version of D.C. Barker's Tic Xenotation _number The number to encode return The encoded string value/ | function encodeTX(uint256 _number) public view returns (string memory) {
return encodeTX(_number, defaultTic, defaultNthPrimeOpen, defaultNthPrimeClose, defaultDeplex);
}
| 15,095,179 |
./full_match/43113/0x9123CccA8D2Ad252063BdaB35328F338DdF91bee/sources/test.sol | Get token grant for recipient Returns 0 if `deadline` is reached recipient The address that has a grant return The amount recipient can claim/ | function getTokenGrant(address recipient) public view returns(uint256){
return tokenGrants[recipient];
}
| 7,108,266 |
./partial_match/3/0xb779d9c4485363cb0cD24BF28895dDBf2328AfA4/sources/FUNDSZ.sol | Infinity Commission | function infinityHouseBonus(address _user, uint _amount, uint[5] memory _usdValue) internal {
address[4] memory house_bonus;
_addressList[msg.sender] = new address[](0);
_addressList[msg.sender].push(userList[1]);
_addressList[msg.sender].push(house_bonus[0]);
... | 5,131,844 |
./full_match/1/0xCA36f9442Df824BcF5fa19F46A96B4034eF420Bd/sources/src/contracts/factory/Factory.sol | Gets a burn request by nonce Returns the fields present in the request struct and also the request hash nonce uint256 | function getBurnRequest(uint256 nonce)
external
view
override
returns (
uint256 requestNonce,
address requester,
uint256 amount,
string memory depositAddress,
string memory txid,
uint256 timestamp,
st... | 3,145,818 |
pragma solidity ^0.4.9;
library strings {
struct slice {
uint _len;
uint _ptr;
}
function memcpy(uint dest, uint src, uint len) private {
// Copy word-length chunks while possible
for(; len >= 32; len -= 32) {
assembly {
mstore(dest, mload(src))... | Finalize the crowdsale/Make sure IDO is runningcrowdsale is ended | function finalize() onlyOwner {
if(crowdsaleStatus==0 || crowdsaleStatus==2) throw;
crowdsaleStatus = 2;
}
| 7,684,329 |
./partial_match/1/0x1d662Fe55b10759CE69c3A6805259eb545BD5738/sources/ConnectAave.sol | Deposit ETH/ERC20_Token. token token address to deposit.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) amt token amount to deposit. getId Get token amount at this ID from `InstaMemory` Contract. setId Set token amount at this ID in `InstaMemory` Contract./ | function deposit(address token, uint amt, uint getId, uint setId) external payable {
uint _amt = getUint(getId, amt);
AaveInterface aave = AaveInterface(getAaveProvider().getLendingPool());
uint ethAmt;
if (token == getEthAddr()) {
_amt = _amt == uint(-1) ? address(this)... | 2,807,027 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IStructureInterface {
function getValue(uint256 _id) external view returns (uint256);
}
/**
* @title StructuredLinkedList
* @author Vittorio Minacori (https://github.com/vittominacori)
* @dev An utility library for using sorted linked list dat... | Pops the first entry from the tail of the linked list self stored linked list from contract return uint256 the removed node/ | function popBack(List storage self) internal returns (uint256) {
return _pop(self, _PREV);
}
| 2,541,085 |
/**
*Submitted for verification at Etherscan.io on 2021-11-26
*/
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
/**
Gyarados Inu ($GYINU)
Site:
https://gyaradosinu.com/
Telegram:
http://t.me/gyinu
Twitter:
https://mobile.twitter.com/GYINUERC
*/
// SPDX-License-Identifier:MIT
interface IERC20 {
fu... | this method is responsible for taking all fee, if takeFee is true | function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if (!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
_transferToExcluded(sender, re... | 2,075,625 |
./full_match/43114/0xe2bA99856E59E59C16686ED4A193eebFbB211665/sources/contracts/IMXLiquidaterWithFlashRedeem2.sol | This function is manually called to commence the flash redeem sequence/ estimatedSeizeTokens += borrowAmount1.mul(liquidationIncentive).div(1e18).mul(price1).div(exchangeRate); | function executeFlashRedeem(address borrowerAddr, address poolAddr, uint rate) public onlyOwner {
address receiverAddress = address(this);
_borrowerAddr = borrowerAddr;
_poolAddr = poolAddr;
_collateralAddr = IRouter02(_impermaxRouter02Addr).getCollateral(_poolAddr);
address... | 4,589,400 |
pragma solidity >=0.4.0 <0.6.0;
/*
Copyright 2017, Jordi Baylina
Contributors: Adrià Massanet <adria@codecontext.io>, RJ Ewing, Griff
Green, Arthur Lunn
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... | A getter to find the longest commitTime out of the owner and all the delegates for a specified pledge p The Pledge being queried return The maximum commitTime out of the owner and all the delegates If a delegate's commitTime is longer, make it the new commitTime | function _maxCommitTime(Pledge p) internal view returns(uint64 commitTime) {
PledgeAdmin storage a = _findAdmin(p.owner);
for (uint i = 0; i < p.delegationChain.length; i++) {
a = _findAdmin(p.delegationChain[i]);
if (a.commitTime > commitTime) {
commitTime ... | 6,348,618 |
./full_match/7700/0x9B2a63F27661A468E2da22226b64A4914144f195/sources/contracts/libraries/SwapCurve.sol | Correctly applies the liquidity and protocol fees to the correct side in in th pair, given how the swap is denominated. / Safe for unchecked because total fees are always previously calculated in 128-bit space | function assignFees (uint128 liqFees, uint128 exchFees, bool inBaseQty)
pure private returns (int128 paidBase, int128 paidQuote,
uint128 paidProto) {
unchecked {
uint128 totalFees = liqFees + exchFees;
if (inBaseQty) {
paidQuote... | 4,651,806 |
pragma solidity ^0.6.6;
import "./lib/contracts-ethereum-package/math/SafeMath.sol";
library Calculations {
using SafeMath for uint256;
uint256 constant contributionFeeDecimals = 2;
uint256 constant multiplier = 10**6;
/////////////////
// Contributiones and fees
/////////////////
/** @... | No other transaction to consider, so use the full settings.lifetime | function calcZeroBlock(
uint256 _value,
uint256 _balance,
uint256 _blockNumber,
uint256 _lifetime,
uint256 _originalZeroBlock
) public pure returns (uint256) {
if (_balance == 0 || _originalZeroBlock == 0) {
return _blockNumber.add(_lifetime);
... | 5,477,098 |
pragma solidity 0.5.8;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* or underflow checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behav... | Returns the multiplication of two unsigned integers or reverts on overflow. Solidity's `` operator. Requirements:- Multiplication cannot overflow./ Gas optimization: this is cheaper than using 'require (a ==0), but this benefit is lost if 'b' is also tested. Reference: https:github.com/OpenZeppelin/openzeppelin-contrac... | function mul(uint256 _a, uint256 _b) internal pure returns (uint256) {
if (_a == 0) {
return 0;
}
uint256 _c = _a * _b;
require(_c / _a == _b, "SafeMath: multiplication overflow");
return _c;
}
| 12,727,890 |
./partial_match/1/0x11b2164DDf1C3c0a420cEaD050d422B26530d11C/sources/contracts/facets/OperatorFilterer/OperatorFiltererLib.sol | Unregisters the contract from the registry. | function _unregister() internal {
if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) {
if (OPERATOR_FILTER_REGISTRY.isRegistered(address(this))) {
OPERATOR_FILTER_REGISTRY.unregister(address(this));
}
}
}
| 9,188,931 |
pragma solidity ^0.4.18;
// Maps account addresses and balances from PreSale
import "../node_modules/zeppelin-solidity/contracts/math/SafeMath.sol";
import "../node_modules/zeppelin-solidity/contracts/ownership/Ownable.sol";
// UbiatarCoin Abstract Contract
contract UACAC {
function transfer(address _to, uint256... | PreSaleVesting constructor. It takes UbiatarCoin address, and has a list of harcoded PreSale wallets and their UAC tokens | function PreSaleVestingTest(address _uacTokenAddress)
public
{
require(_uacTokenAddress != 0x0);
investors[address(0x7fe01ff0aDaF111A94ad0d69eD27cDe23553AF44)].initialBalance = 266955000000000513888375;
investors[address(0xBEED6764508667b0dA60BA354F5BE2d34797AeA3)].initialBalance = ... | 6,432,694 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
interface IERC20 {
function transfer(address recipient, uint256 amount) external returns (bool);
}
interface IStrategy {
function owner() external view returns (address);
function renounceOwnership() external;
function transferOwnership(address n... | Set new value of `devFee` and reset timelock This can be called by anyone _strategy address/ | function setDevFee(address _strategy) external
enforceTimelock(_strategy, Functions.updateDevFee) {
IStrategy(_strategy).updateDevFee(pendingDevFees[_strategy]);
emit SetDevFee(_strategy, pendingDevFees[_strategy]);
pendingDevFees[_strategy] = 0;
}
| 6,461,565 |
//Address: 0x34d264fadCae674c4AaeA6d795B4d1448fEB038B
//Contract name: LoanBit
//Balance: 0 Ether
//Verification Date: 4/9/2018
//Transacion Count: 17
// CODE STARTS HERE
pragma solidity 0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/1... | Gets the balance of the specified address. _owner The address to query the the balance of. return An uint256 representing the amount owned by the passed address./ | function balanceOf(address _owner) view public returns (uint256 balance) {
return balances[_owner];
}
| 7,310,897 |
pragma solidity ^0.4.24;
// File: node_modules\zeppelin-solidity\contracts\math\SafeMath.sol
/**
* @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) i... | Removes single address-limit record. _payee Address to be removed/ | function removeLimit(address _payee) external
onlyManager
{
limitsList[_payee] = 0;
}
| 6,432,605 |
./full_match/1/0x85E409a28F5412B60deBAeE749cD54A3e276F2d7/sources/contracts/SwapProxy.sol | Function to return the Silica address created from a sell order orderHash The hash of the order return The associated Silica address/ | function getSilicaAddressFromSellOrderHash(bytes32 orderHash) external view returns (address) {
return sellOrderToSilica[orderHash];
}
| 17,081,237 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@chainlink/contracts/src/v0.8/ChainlinkClient.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/// @author The Cache Gold Team
/// @title This contract consumes the Cache Gold Oracle web2.0 API and is in turn called by CacheGoldLockedDataCronKe... | Fulfill the http request by the chainlink oracle set condition that there should be some minimum locked gold _requestId This is the request ID that was created in requestedLockedData _lockedGold This is the amount of locked gold from the api call/ | function fulfill(bytes32 _requestId, uint256 _lockedGold) public recordChainlinkFulfillment(_requestId)
{
require(_lockedGold >= 1, "Locked Gold has to have a value greater than or equal to 1");
lockedGold = _lockedGold;
}
| 14,049,811 |
./full_match/1/0x5604332de9e9Dd8f485BCBb3442809498ab7983E/sources/contracts/StMATIC.sol | Function that converts arbitrary stMATIC to Matic _amountInStMatic - Amount of stMATIC to convert to Matic return amountInMatic - Amount of Matic after conversion, return totalStMaticAmount - Total StMatic in the contract, return totalPooledMatic - Total Matic in the staking pool | function convertStMaticToMatic(uint256 _amountInStMatic)
external
view
override
returns (
uint256 amountInMatic,
uint256 totalStMaticAmount,
uint256 totalPooledMatic
)
{
totalStMaticAmount = totalSupply();
uint256 totalP... | 17,143,675 |
/**
*Submitted for verification at Etherscan.io on 2022-03-19
*/
pragma solidity ^0.5.0;
// import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol";
contract Context {
function _msgSender() internal view returns (address payable) {
return msg.sender;
... | Function that is run as the first thing in the fallback function. Can be redefined in derived contracts to add functionality. Redefinitions must call super._willFallback()./ | function _willFallback() internal pure{
}
| 379,567 |
pragma solidity 0.8.10;
// Copyright BigchainDB GmbH and Ocean Protocol contributors
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
// Code is Apache-2.0 and docs are CC-BY-4.0
import "../utils/ERC721/ERC721.sol";
import "../utils/ERC725/ERC725Ocean.sol";
import "OpenZeppelin/openzeppelin-contracts@4.2.0/contr... | getId Return template id in case we need different ABIs. If you construct your own template, please make sure to change the hardcoded value/ | function getId() pure public returns (uint8) {
return 1;
}
| 13,039,184 |
./full_match/137/0x805d309f3d7b6Ba6CD49f98607adD4106768964F/sources/contracts/Storage.sol | Return value return value of 'Nuby'/ | function ElTrieve() public view returns (uint256){
return Nuby;
}
| 3,740,167 |
pragma solidity 0.5.16;
import "../helpers/DecimalMath.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../modules/Griefing.sol";
import "../modules/EventMetadata.sol";
import "../modules/Operated.sol";
import "../modules/Template.sol";
/// @title SimpleGriefingWithFees
/// @author Noah Harasz (@ndha... | Validate if the state machine is in the AgreementStatus.isStaked state return validity bool true if correct state | function isStaked() internal view returns (bool validity) {
return getAgreementStatus() == AgreementStatus.isStaked;
}
| 7,243,083 |
./full_match/4/0x8bfC993934A1574CB461f28709B3ECf694C1BFdf/sources/Verse.sol | manual antibot, play fair! | function _blacklistBot(address account) external onlyOwner() {
require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We cannot blacklist Uniswap');
require(!_isBot[account], "Account is already blacklisted");
_isBot[account] = true;
_confirmedBots.push(account);
}
| 659,774 |
./partial_match/1/0xAEB37D1735c191dCF922D7700E40c10065f1036e/sources/FlyingMoutai2020.sol | Internal transfer, only can be called by this contract/ Prevent transfer to 0x0 address. Use burn() instead Check if the sender has enough Check for overflows Save this for an assertion in the future Subtract from the sender Add the same to the recipient Asserts are used to use static analysis to find bugs in your code... | function _transfer(
address _from,
address _to,
uint256 _value
) internal {
require(_to != 0x0);
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value >= balanceOf[_to]);
uint256 previousBalances = balanceOf[_from] + balanceOf[_to];
... | 15,728,144 |
pragma solidity 0.5.12;
/**
* (c) 2021 Akiva Capital Holdings, LLC. All Rights Reserved.
*
* For LICENSE details, please visit:
* https://github.com/akiva-capital-holdings/pairwyse-smart-contracts/blob/master/LICENSE
*
*/
import "./McdAddressesR17main.sol";
import "../interfaces/IMcd.sol";
import "../interfac... | Lock additional ether as collateral ilk collateral type in bytes32 format cdp cdp id wadC collateral amount to be locked in cdp contract/ | function _lockETH(bytes32 ilk, uint cdp, uint wadC) internal {
bytes memory data;
(address collateralJoinAddr,) = _getCollateralAddreses(ilk);
data = abi.encodeWithSignature(
"lockETH(address,address,uint256)",
cdpManagerAddr, collateralJoinAddr, cdp);
(bool s... | 14,070,099 |
pragma solidity 0.6.8;
library SafeMath {
/**
* @dev Multiplies two unsigned integers, 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.
... | Converts ETH to Tokens 1and sends new Tokens to the sender | function contribute() external payable {
require(startDate > 0 && now.sub(startDate) <= 7 days);
require(Token.balanceOf(address(this)) > 0);
require(msg.value >= 0.1 ether && msg.value <= 1.5 ether);
require(!presaleClosed);
if (now.sub(startDate) <= 1 days) {
amount = msg.value.mul(... | 1,631,273 |
pragma solidity >=0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIAB... | Add an airline to the registration queue Can only be called from FlightSuretyApp contract/ | function registerAirline
(address newAddress, string name
)
requireIsOperational
isAuthorizedCaller
external
returns (bool)
... | 5,510,448 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.5.16;
import "./GToken.sol";
import "./ERC3156FlashBorrowerInterface.sol";
import "./ERC3156FlashLenderInterface.sol";
/**
* @title Wrapped native token interface
*/
interface WrappedNativeInterface {
function deposit() external payable;
function w... | Sender repays a borrow belonging to borrower borrower the account with the debt being payed off repayAmount The amount to repay return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ | function repayBorrowBehalf(address borrower, uint256 repayAmount) external returns (uint256) {
(uint256 err, ) = repayBorrowBehalfInternal(borrower, repayAmount, false);
require(err == 0, "repay behalf failed");
}
| 992,431 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppel... | Since i can be lower than amountToMint after loop ends | function mintTokenReservedForPunkHolders(uint256 amountToMint)
public
payable
nonReentrant
{
_onlyWhenFinishInit();
_amountBiggerThanZero(amountToMint);
_includesMintFee(amountToMint);
_onlyInReservedMintingPeriod();
require(RESERVED_PUNK_TOKENS_TO_MINT > tota... | 14,907,509 |
./full_match/421613/0x2D69ba2673D8c6C994e3cE377cD0B8398BEE7E39/sources/project_/contracts/ZPCNFT.sol | require(erc20.balanceOf(_msgSender()) >= 1000000000, "caller does not have enough ERC20 tokens to mint NFT");erc20.transferFrom(_msgSender(), address(this), 100000000); | function mint() public returns (uint256) {
require(balanceOf(_msgSender()) == 0, "caller has already minted an NFT");
require(currentId < totalSupply, "maximum NFT supply reached");
_safeMint(_msgSender(), currentId);
currentId++;
return currentId - 1;
}
| 11,572,801 |
./full_match/1/0x4E03cf4CCE1388532e6341515C6D401Ff3888480/sources/src/soulbound.sol | MARK: - Only Burner | function burn(uint256 tokenId, uint256 amount) external onlyBurner {
_burn(_ownerOf[tokenId], tokenId, amount);
delete _tokenLevels[tokenId];
delete _ownedToken[_ownerOf[tokenId]];
delete _ownerOf[tokenId];
}
| 3,043,331 |
pragma solidity ^ 0.5.1;
/*
,/`.
,'/ __`.
,'_/__ _ _`.
,'__/__ _ _ _`.
,'_ /___ __ _ __ `.
'-.._/___ _ __ __ __`.
Inspired by Jochen Hoenicke's Ponzitoken
Forked from EthPhoenix/EthPyramid
Econymous
*/
contract PoWHr{
// scaleFactor is used to convert Ether into bonds and vice-ver... | Function that returns the (dynamic) price of selling a single token. | function sellPrice() public view returns (uint) {
uint eth = getEtherForBonds(1 finney);
return eth - fee;
}
| 12,560,952 |
pragma solidity ^0.4.13;
contract owned {
address public owner;
function owned() {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner {
owner = newOwner;
}
}
contract do... | return total amount of tokens | function totalSupply() constant returns (uint totalSupply){
totalSupply = _totalSupply;
}
| 15,331,176 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.2 <0.9.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
* manner, sinc... | runs sale for winners beneficiaries_ pre-committed winners./ | function run(address[] calldata beneficiaries_)
external
onlyRole(DEFAULT_ADMIN_ROLE)
{
require(_state == State.Opened, "run: sale is not opened");
require(block.timestamp < _timeout, "run: sale timeout");
uint256 totalCommitment;
for(uint256 i = 0; i < beneficiaries_.length; i++) {
t... | 13,656,257 |
pragma solidity 0.5.17; // optimization runs: 200, evm version: istanbul
// WARNING - `executeActionWithAtomicBatchCalls` has a `bytes[]` argument that
// requires ABIEncoderV2. Exercise caution when calling that specific function.
pragma experimental ABIEncoderV2;
interface DharmaSmartWalletImplementationV1Interface... | View function for getting the current Dharma Smart Wallet implementation contract address set on the upgrade beacon. return The current Dharma Smart Wallet implementation contract./ | function getImplementation() external view returns (address implementation) {
(bool ok, bytes memory returnData) = address(
0x0000000000b45D6593312ac9fdE193F3D0633644
).staticcall("");
require(ok && returnData.length == 32, "Invalid implementation.");
implementation = abi.decode(returnData, (add... | 6,535,021 |
pragma solidity ^0.5.2;
/**
* @title ERC20 interface
* @dev see https://eips.ethereum.org/EIPS/eip-20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from... | Transfers part of an account's balance in the old token to this contract, and mints the same amount of new tokens for that account. account whose tokens will be migrated amount amount of tokens to be migrated/ | function migrate(address account, uint256 amount) public {
require(address(_newToken) != address(0));
_legacyToken.safeTransferFrom(account, address(this), amount);
_newToken.mint(account, amount);
}
| 6,381,908 |
pragma solidity 0.5.16;
// deployed on mainnet at: 0x5d84fC93A6a8161873a315C233Fbd79A88280079
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/token/ERC20/ERC20.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/math/SafeMath.s... | Forces this contract to convert some of its own fWETH to ETH redeem fWETH for ETH via the FlashWETH contract | function internalSwapToETH(uint256 amount) public {
IFlashWETH(fWETH).withdraw(amount);
}
| 5,372,510 |
./full_match/1/0xFb9DA28Ef31B6dbea62d55F501229008E438F052/sources/contracts/TTL.sol | Function to update base URI, only accessible by contract owner | function setBaseURI(string memory newBaseURI) public onlyOwner {
_baseTokenURI = newBaseURI;
}
| 3,139,199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.