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/0x48deE19C0e44c147934702c12dc98963CA831009/sources/contracts_common/src/Libraries/ObjectLib32.sol | return the updated binValue after writing amount at index binValue uint256 containing the balances of TYPES_PER_UINT256 types index Index at which to retrieve value amount Value to store at index in bin return Value at given index in bin/ Mask to retrieve data for a given binData Shift amount | function writeValueInBin(uint256 binValue, uint256 index, uint256 amount)
internal
pure
returns (uint256)
{
require(
amount < 2**TYPES_BITS_SIZE,
"Amount to write in bin is too large"
);
uint256 mask = (uint256(1) << TYPES_BITS_SIZE) - 1;
... | 4,919,273 |
/**
*Submitted for verification at Etherscan.io on 2020-09-28
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.6.8;
//
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because ... | Claims CRV from Curve and convert it back to renCRV. Anyone can trigger the harvest!/ Claims CRV from Curve Uniswap: CRV --> WETH --> WBTC Curve: WBTC --> renCRV | function harvest() public override {
if (_crv > 0) {
address[] memory path = new address[](3);
}
if (_wbtc > 0) {
}
if (_want > 0) {
deposit();
}
}
| 12,905,148 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "../node_modules/@openZeppelin/contracts/token/ERC20/ERC20.sol";
contract ECPToken is ERC20 {
address public owner;
address public ledger;
modifier onlyOwner() {
require(owner == msg.sender, "Acces Token Denied");
_;
}
... | define the mint function _customerContract address of the customerContract amount amount ECPToken to mint/ | function ownerMint (
address _customerContract,
uint amount)
onlyLedger() external returns (bool){
_mint(_customerContract, amount);
return true;
}
| 5,460,405 |
// File: iface/IParassetGovernance.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.4;
/// @dev This interface defines the governance methods
interface IParassetGovernance {
/// @dev Set governance authority
/// @param addr Destination address
/// @param flag Weight. 0 means to delet... | Receive income stakingToken staking token address | function getReward(address stakingToken) external override nonReentrant {
Channel storage channelInfo = _tokenChannel[stakingToken];
_getReward(channelInfo, msg.sender);
}
| 6,962,398 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error,... | Transfers fund shares from one account to another _comptrollerProxy The ComptrollerProxy of the fund _from The account from which to transfer shares _to The account to which to transfer shares _amount The amount of shares to transfer | function __transferShares(
address _comptrollerProxy,
address _from,
address _to,
uint256 _amount
) internal {
IComptroller(_comptrollerProxy).permissionedVaultAction(
IVault.VaultAction.TransferShares,
abi.encode(_from, _to, _amount)
);
... | 223,799 |
./full_match/3/0x7A55084D6b10Fa1cd02d81eb699e2dC9666d9223/sources/dpr.sol | If tokens are already locked, then functions extendLock or increaseLockAmount should be used to make any changes | function lock(
bytes32 _reason,
uint256 _amount,
uint256 _time)
public
override
whenNotPaused
returns (bool)
{
require(tokensLocked(msg.sender, _reason) == 0, ALREADY_LOCKED);
require(_amount != 0, AMOUNT_ZERO);
if (locked[m... | 8,150,546 |
/**
*Submitted for verification at Etherscan.io on 2022-03-31
*/
// SPDX-License-Identifier: MIT
pragma solidity =0.6.12;
//
/*
* @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.d... | View function to see pending APEs on frontend. | function pendingAPE(address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo;
UserInfo storage user = userInfo[_user];
uint256 accAPEPerShare = pool.accAPEPerShare;
uint256 lpSupply = totalAPEStaked;
if (block.number > pool.lastRewardBlock && lpSupply... | 2,416,971 |
// Copyright (C) 2021 Exponent
// This file is part of Exponent.
// Exponent 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.
// E... | submit multiple pool orders _orders array of ABI encoded trades to submit _txTypes array of order type, either redeem or lend _venues array of trading venues address each order based on corresponding index of the input | function _submitPoolOrders(
bytes[] calldata _orders,
Pool[] calldata _txTypes,
address[] memory _venues
) internal virtual returns (bool) {
require(
_orders.length == _txTypes.length &&
_orders.length == _venues.length,
"TradeSettlement: p... | 11,851,946 |
./full_match/5/0xFD52F9A9A5268c4617dFAa6B0C4feFACBF70a873/sources/contracts/core/vaults/RaffleVault.sol | Send tokens to the winner, and charge fee. | function closeRaffle() external virtual onlyRole(DEFAULT_ADMIN_ROLE) {
address winner = _randomPlayer();
_collectPoolFees();
(uint256 collectableFee0, uint256 collectableFee1) = collectedPoolFees();
Raffle storage raffle = raffles[nextRaffleId];
raffle.timestamp = block.tim... | 1,884,822 |
./full_match/43114/0x6351C5c0F6A7b9519F459d7C98aADA73594Ced5a/sources/perklefarms.sol | Add an account to the burner role. Restricted to admins. | function grantBurnerRole(address account) public {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), 'XPZ: Need DEFAULT_ADMIN_ROLE pahtna!');
grantRole(BURNER_ROLE, account);
}
| 4,608,573 |
pragma solidity 0.5.12;
contract ThrowProxy {
address public target;
bytes private data;
constructor (address _target) public {
target = _target;
}
// solhint-disable-next-line
function() external {
data = msg.data;
}
function execute() public returns (bool) {
... | solhint-disable-next-line | function execute() public returns (bool) {
(bool success, ) = target.call(data);
return success;
}
| 930,615 |
./full_match/421613/0xd6061b1141286b198B2cDB197c13C48DE01e2836/sources/contracts/PachiERC721/library/MulticallUpgradeable.sol | Receives and executes a batch of function calls on this contract./ | ) external virtual returns (bytes[] memory results) {
results = new bytes[](data.length);
for (uint256 i = 0; i < data.length; i++) {
results[i] = _functionDelegateCall(address(this), data[i]);
}
return results;
}
| 11,565,891 |
pragma solidity ^0.4.21;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner... | ability for owner to withdraw the commission _amount amount to withdraw cannot withdraw money reserved for requests | function withdrawCommission(uint _amount) public onlyOwner {
require(_amount <= availableCommission);
availableCommission = availableCommission.sub(_amount);
msg.sender.transfer(_amount);
}
| 7,812,017 |
./partial_match/42/0xeA308decBE26A1017378AC223Abf24b2Ef910B86/sources/Combust.sol | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTrans... | 9,033,192 |
./full_match/1/0xEbC49b236ff1920C788eF3c0687A3A1B6fCB35f1/sources/contracts/wrappers/ArbitrumMessengerWrapper.sol | Claim excess funds recipient The recipient to send to amount The amount to claim/ | function claimFunds(address payable recipient, uint256 amount) public onlyOwner {
recipient.transfer(amount);
}
| 17,106,982 |
./partial_match/1/0x8648910ff06a3ab2B977984150aCdAd25481c937/sources/MonkTokenSale.sol | Gets the address of the ETH price feed aggregator. return The address of the ETH price feed aggregator./ | function getETHPriceFees() external view returns (address) {
return address(eth_priceFeed);
}
| 15,720,374 |
./partial_match/1/0xcCf3621E609dE45d1230d23c02fd00f67Fa088C7/sources/contracts/smart-contracts-dev/main/MentaportERC721.sol | Set cost of token at mint - Emits a {SetCost} event./ | function setCost(uint256 _newCost) external onlyOwner {
cost = _newCost;
emit SetCost(cost);
}
| 3,916,936 |
./partial_match/1/0xB0F720Baa5BD1715897d4790A59f5c7aa1377D79/sources/MateriaLibrary.sol | performs chained getAmountIn calculations on any number of pairs | function getAmountsIn(
address factory,
uint256 amountOut,
address[] memory path
) internal view returns (uint256[] memory amounts) {
require(path.length >= 2, 'MateriaLibrary: INVALID_PATH');
amounts = new uint256[](path.length);
amounts[amounts.length - 1] = amo... | 3,922,566 |
./full_match/80001/0xdCdf0B3d68A4E11eF2703b87020dC5a9c66babf7/sources/@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol | get flow info between two accounts for given token token The token used in flow sender The sender of the flow receiver The receiver of the flow return lastUpdated Timestamp of flow creation or last flowrate change return flowRate The flow rate return deposit The amount of deposit the flow return owedDeposit The amou... | function getFlowInfo(ISuperToken token, address sender, address receiver)
internal view
returns(uint256 lastUpdated, int96 flowRate, uint256 deposit, uint256 owedDeposit)
{
(, IConstantFlowAgreementV1 cfa) = _getHostAndCFA(token);
(lastUpdated, flowRate, deposit, owedDeposit) = c... | 855,973 |
./partial_match/42/0x5fd9A1cA8fbbf50D1832F425DC262f263a5FE2F1/sources/FluxAggregator.sol | get data about the latest round. Consumers are encouraged to check that they're receiving fresh data by inspecting the updatedAt and answeredInRound return values. Consumers are encouraged to use this more fully featured method over the "legacy" latestRound/ latestAnswer/latestTimestamp functions. Consumers are encoura... | function latestRoundData()
public
view
virtual
override
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
)
{
return getRoundData(latestRoundId)... | 8,935,895 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.6.0 <0.7.0;
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/con... | Returns the credit balance for a given user. Not that this includes both minted credit and pending credit. user The user whose credit balance should be returned return The balance of the users credit | function balanceOfCredit(address user, address controlledToken) external override onlyControlledToken(controlledToken) returns (uint256) {
_accrueCredit(user, controlledToken, IERC20Upgradeable(controlledToken).balanceOf(user), 0);
return _tokenCreditBalances[controlledToken][user].balance;
}
| 23,316 |
./full_match/4/0x12f20E573d11Acad3bFdc95d84Ce15c58575685d/sources/browser/Potato.sol | Return the yield amount, when `account` balance was updated./ | function getLastPotatoYield(address account) public view returns (uint256) {
return _accounts[account].lastPotatoYield;
}
| 13,366,797 |
/**
* Copyright 2017-2020, bZeroX, LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
import "./AdvancedToken.sol";
import "./interfaces/ProtocolLike.sol";
import "./interfaces/FeedsLike.sol";
contract LoanTokenLogicStandard is... | used to read externally from the smart contract to see if a function is paused returns a bool / | function checkPause(string memory funcId) public view returns (bool isPaused){
bytes4 sig = bytes4(keccak256(abi.encodePacked(funcId)));
bytes32 slot = keccak256(abi.encodePacked(sig, uint256(0xd46a704bc285dbd6ff5ad3863506260b1df02812f4f857c8cc852317a6ac64f2)));
assembly {
isPaus... | 1,835,036 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC20Vesting.sol";
contract TaleToken is ERC20Vesting {
struct InstantBeneficiary {
address beneficiary;
uint256 amount;
}
uint256 private vestingPeriod = 2592000; // 30 days
uint256 private private... | Adds beneficiary and amount for private sale vesting One address can participate in one vesting beneficiary address of the beneficiary to whom vested tokens are transferred amount total amount of tokens to be released at the end of the vesting/ | function addPrivateSaleVestingAddress(address beneficiary, uint256 amount) onlyOwner external {
_createVestingSchedule(
beneficiary,
privateSaleVestingStart,
privateSaleVestingDuration,
vestingPeriod,
amount);
privateSaleVestingAddresses... | 1,036,558 |
./partial_match/8453/0xE2A21142A2C2a618eB6919f7087D047AfcB2F515/sources/MasterChefV2.sol | Safe WINE transfer function, just in case if rounding error causes pool to not have enough WINE. | function safeWINETransfer(address _to, uint256 _amount) internal {
uint256 wineBal = wine.balanceOf(address(this));
bool transferSuccess = false;
if (_amount > wineBal) {
transferSuccess = wine.transfer(_to, wineBal);
transferSuccess = wine.transfer(_to, _amount);
... | 16,736,660 |
/**
*Submitted for verification at Etherscan.io on 2022-03-17
*/
/*
Telegram: https://t.me/MasterElona
*/
pragma solidity ^0.7.5;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns... | change the minimum amount of tokens to sell from fees | function updateSwapTokensAtAmount(uint256 newAmount) external onlyOwner returns (bool){
require(newAmount >= totalSupply() * 1 / 100000, "Swap amount cannot be lower than 0.001% total supply.");
require(newAmount <= totalSupply() * 5 / 1000, "Swap amount cannot be higher than 0.5% total supply.");
... | 2,343,452 |
// SPDX-License-Identifier: BUSL-1.1
// For further clarification please see https://license.premia.legal
pragma solidity ^0.8.0;
import {EnumerableSet} from "@solidstate/contracts/utils/EnumerableSet.sol";
import {ABDKMath64x64} from "abdk-libraries-solidity/ABDKMath64x64.sol";
import {IPoolIO} from "./IPoolIO.sol"... | mint batch of tokens for given address ERC1155Receiver implementation is not checked account beneficiary of minting ids list of token IDs amounts list of quantities of tokens to mint data data payload/ | function _mintBatch(
address account,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(account != address(0), 'ERC1155: mint to the zero address');
require(
ids.length == amounts.length,
'ERC115... | 104,087 |
./partial_match/1/0xFaE3F1F42c24A7a1497eEAB4c6aC514A24093713/sources/CosaMonstraBoss.sol | set per transaction token limit | function setTransactionLimit(uint _limit) external onlyOwner{
maxPerTransaction = _limit;
}
| 15,670,297 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
/**
* @dev Interface of the BEP20.
*/
interface BEP20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
... | This method is responsible for taking all fee, if takeFee is true./ | function _tokenTransfer(address sender, address recipient, uint256 amount) private {
if(_isExcludedFromFee[sender] || _isExcludedFromFee[recipient]){
removeAllFee();
}
if(tokensBurned >= maxTokensBurned) {
burnFee = 0;
taxFee = 3;
_isExcluded[... | 6,474,689 |
pragma solidity ^0.4.15;
import "./CVExtender.sol";
contract MyExampleContract is CVExtender {
/**
* Your functions go here
*
* */
function MyFunction1() {}
function MyFunction2() {}
/**
* Below is for our CV!
* */
function getAddress() public constant returns(string) ... | Below is for our CV! / | function getAddress() public constant returns(string) {
}
| 14,070,433 |
./full_match/80001/0x90507Dcebc01166bBC1c216d442Fe3955AF72026/sources/contracts/Contract.sol | Total trades created return length Number of trades | function totalTrades() external view returns (uint256) {
return _trades.length;
}
| 9,452,010 |
./full_match/5/0x17C02f0d02F441A21d08b4c9E6F076223cd46280/sources/contracts/drop1.5.sol | parts[0] = '<svg xmlns="http:www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 350 350"><style>.base { fill: white; font-family: serif; font-size: 16px; }</style><style>.footnote { fill: white; font-family: verdana; font-size: 8px; }</style><rect width="100%" height="100%" fill="black" /><text x="25... | function tokenURI(uint256 tokenId) override public view returns (string memory){
string[8] memory parts;
parts[2] = ' /><text x="25" y="50" class="base">';
uint256 rand = random(string(abi.encodePacked(parts[0], toString(tokenId))));
uint256 rand2 = random(string(abi.encodePacke... | 1,931,571 |
./full_match/5/0x61c70415F0aF3c632fb798A9E77D20Cc50Df6e41/sources/contracts/CrowdFunding.sol | ================== FUNCTION ==================this function gets all the donators of a specific campaignthe fuction takes the id of the contract and returns array of addresses of donators and array of amounts of donations | function getDonators(
uint256 _id
) public view returns (address[] memory, uint256[] memory) {
return (campaigns[_id].donators, campaigns[_id].donations);
}
| 11,620,119 |
// File: contracts\libs\SafeMathLib.sol
pragma solidity ^0.4.24;
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------... | IEtherReclaimer interface protocol used by owner to reclaim other amount sent to contract address./ | interface IEtherReclaimer {
function reclaimEther(address _to) external returns (bool success);
}
}
| 1,033,532 |
pragma solidity 0.8.11;
import "./dependencies/Ownable.sol";
import "./interfaces/IERC20.sol";
import "./interfaces/solidly/IVotingEscrow.sol";
import "./interfaces/solidly/IVeDist.sol";
import "./interfaces/solidex/ILpDepositor.sol";
import "./interfaces/solidex/IFeeDistributor.sol";
import "./interfaces/solidex/ISol... | shared logic for transfer and transferFrom / | function _transfer(
address _from,
address _to,
uint256 _value
) internal {
require(balanceOf[_from] >= _value, "Insufficient balance");
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
}
@param _to The ... | 5,515,613 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.6 <0.8.0;
import {AddressIsContract} from "@animoca/ethereum-contracts-core/contracts/utils/types/AddressIsContract.sol";
import {ERC1155InventoryIdentifiersLib} from "./../ERC1155/ERC1155InventoryIdentifiersLib.sol";
import {IERC165} from "@animoca/ethereum-contr... | cannot overflow as supply cannot overflow | function _mintFungible(
address to,
uint256 id,
uint256 value
) internal {
require(value != 0, "Inventory: zero value");
uint256 supply = _supplies[id];
uint256 newSupply = supply + value;
require(newSupply > supply, "Inventory: supply overflow");
... | 1,078,515 |
./partial_match/56/0xae3eA4E4e48bb55ae46E9aD791c0Be771Ed0B961/sources/StrategysoakLP.sol | Takes out 4% as system fees from the rewards. 1% -> Call Fee 3% -> Treasury fee/ | function chargeFees() internal {
uint256 toWbnb =
IERC20(soak).balanceOf(address(this)).mul(40).div(1000);
IPancakeRouter(unirouter).swapExactTokensForTokensSupportingFeeOnTransferTokens(
toWbnb,
0,
soakToWbnbRoute,
address(this),
... | 11,044,586 |
./partial_match/8453/0xc7A50FE12C864963Ea5A5E0858a0E7Abe5b875c4/sources/FireBirdRouterV2.sol | solhint-disable-next-line avoid-low-level-calls | function swap(
IAggregationExecutor caller,
SwapDescription calldata desc,
bytes calldata data
) external payable returns (uint256 returnAmount) {
require(desc.minReturnAmount > 0, "Min return should not be 0");
require(data.length > 0, "data should be not zero");
uint256 amount = desc.amou... | 16,816,094 |
./full_match/3/0x2Ce9177960b34d6c9164bFd7d5A0c793a114F1e2/sources/browser/FreedomMasterchef.sol | Safe frd transfer function, just in case if rounding error causes pool to not have enough FRDs. | function safeFrdTransfer(address _to, uint256 _amount) internal {
uint256 frdBal = frd.balanceOf(address(this));
if (_amount > frdBal) {
frd.transfer(_to, frdBal);
frd.transfer(_to, _amount);
}
}
| 8,123,983 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
import "library.sol";
/**
* @title Implementation of the {IERC20} interface.
* @dev defines a dynamically generated ERC20-compliant option contract with given expiry date
*/
contract Option is Context, IOption {
using SafeMath for uint256;
/// @dev... | Returns the pool of the contract./ | function getPool() public view override returns (address) {
return address(_pool);
}
| 15,832,591 |
./partial_match/1/0xD3faD4C5e4D24646F90A0c8876314b17243E9460/sources/contracts/KounPass.sol | return Current mint phase/ | function getMintPhase() public view returns (MintPhase) {
return mintPhase;
}
| 2,677,016 |
// SPDX-License-Identifier: MIT
// chibidbs.com
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "./ERC721Accesslist.sol";
... | string memory payload = string(abi.encodePacked(msg.sender)); | function accesslistMint(uint256 amount, bytes32[] calldata proof) public payable {
require(MerkleProof.verify(proof, accesslistRoot, keccak256(abi.encodePacked(msg.sender))), "BAD_MERKLE_PROOF");
require(accesslistSaleActive, "SALE_CLOSED");
require(amount <= maxTokenPurchase, "AMOUNT_EXCEE... | 12,061,168 |
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------
// 'C4F' Coins4Favors contracts
//
// contracts for C4FEscrow and C4FToken Crowdsale
//
// (c) C4F Ltd Hongkong 2018
// ----------------------------------------------------------------------------
// ------------... | ---------------------------------------------------------------------------- allows the favor originator to reduce the token offer This can only be done until a provider has accepted (locked) the favor request ---------------------------------------------------------------------------- cannot change if locked by provid... | function changeTokenOffer(uint256 newOffer) public onlyRequester returns (bool success) {
require((!providerLocked) && (!providerDisputed) && (!providerCompleted));
require(status==1);
uint256 actTokenvalue = getTokenValue();
require(newOffer < actTokenvalue);
require(newOffe... | 1,501,486 |
//Address: 0xcD1e5a7cfd56a99d57AaE976A0530826a600a2b3
//Contract name: Rexpax
//Balance: 0 Ether
//Verification Date: 12/5/2017
//Transacion Count: 35
// CODE STARTS HERE
pragma solidity 0.4.18;
contract owned {
address public owner;
// The one who sent Rexpax the contract to the blockchain, will automati... | The initialization values when the contract has been mined to the blockchain For the tests replace 1512482400 to "now" | function ICO() internal {
presaleMaxSupply = 190000000 * 1 ether;
marketMaxSupply = 1260000000 * 1 ether;
}
| 1,757,152 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.4;
import {SafeMath} from "@openzeppelin/contracts/utils/math/SafeMath.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {
SafeERC20
} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {GnosisAuction} from "... | Sets the next option the vault will be shorting, and closes the existing short. This allows all the users to withdraw if the next option is malicious./ | function commitAndClose() external nonReentrant {
address oldOption = optionState.currentOption;
VaultLifecycle.CloseParams memory closeParams =
VaultLifecycle.CloseParams({
OTOKEN_FACTORY: OTOKEN_FACTORY,
USDC: USDC,
currentOption: oldOpt... | 5,808,839 |
pragma solidity ^0.4.17;
contract Authentic {
address public manufacturer;
address[] a = new address[](1);
//Constructor to initialize manufacturer who deploy this contract
function Authentic()public{
manufacturer=msg.sender;
a.push(manufacturer);
}
// Stru... | Returns caller address | function ask_manufacturer_address() public view returns (address){
return(a[1]);
}
| 1,004,530 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
// ERC721 standard implementation
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
// To only allow the owner of the smart contract to mint NFTs we’ve imported
// https://docs.openzeppelin.com/contracts/4.x/access-control
import "@openzeppelin/contracts/a... | Get token price _geohash asset geohash/ | function priceOfGeohash(string memory _geohash)
public
view
returns (uint256)
{
uint256 tokenId = tokenFromGeohash(_geohash);
return _tokenPrices[tokenId];
}
| 14,022,324 |
pragma solidity ^0.5.7;
... | inject NONSTANDARD NAMING | function CHANGEMINBALANCE924(uint256 newMinBalance) public ONLYOWNER245 { | 13,030,946 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "../inheritances/OwnableEnhanced.sol";
import "../interfaces/IEternalFactory.sol";
import "../interfaces/IEternalTreasury.sol";
import "../interfaces/IEternalStorage.sol";
import "../interfaces/ILoyaltyGage.sol";
import "@openzeppelin/contracts/token/ERC20/I... | Computes the minimum amount to swap a given asset for another asset, with a given percentage uncertainty amountAsset The specified asset being swapped reserveAsset The reserve of the asset being swapped reserveOtherAsset The reserve of the asset being swapped for uncertainty The denominator of the percentage uncert... | function _computeMinSwapAmount(uint256 amountAsset, uint256 reserveAsset, uint256 reserveOtherAsset, uint256 uncertainty) private view returns(uint256 minOtherAsset) {
uint256 amountOtherAsset = joeRouter.getAmountOut(amountAsset, reserveAsset, reserveOtherAsset);
minOtherAsset = amountOtherAsset - ... | 14,073,602 |
./full_match/5/0x1B9D8b2a21979218D1034f7af56F15ce463F3daF/sources/browser/BRDSupplier.sol | Update the given consumer's BRD allocation point. Can only be called by the owner./ | function set(address _consumer, uint256 _allocPoint) public onlyOwner {
require(
approvedConsumers.contains(_consumer),
"BRDSupplier: consumer isn't approved"
);
totalAllocPoint = totalAllocPoint.add(_allocPoint).sub(
consumerInfo[_consumer].allocPoint
... | 1,934,536 |
./full_match/5/0x09021d75b1e8f5F078A751fB6AbdfB9b80861Dd3/sources/project_/contracts/CCXClaim.sol | Function used to set new claimable amounts. Requirements: - `_recipients` length needs to be equal to `_amounts`. _recipients array of wallets for which new claimable amounts are set _amounts array of claimable amounts/ | function setClaimable(
address[] calldata _recipients,
uint256[] calldata _amounts
) external virtual onlyOwner {
require(_recipients.length == _amounts.length, "CCXClaim - Bad Inputs");
for (uint256 i; i < _recipients.length; i++) {
s_claimableAmount[_recipients[i]]... | 7,077,476 |
/**
* Source Code first verified at https://etherscan.io on Saturday, April 27, 2019
(UTC) */
// File: contracts/token/ERC20/IERC20.sol
pragma solidity >=0.4.22 <0.6.0;
/**
* @title ERC20 interface
* @dev see https://eips.ethereum.org/EIPS/eip-20
*/
interface IERC20 {
function transfer(address to, uint256 v... | Transfer token for a specified addresses. from The address to transfer from. to The address to transfer to. value The amount to be transferred./ | function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
address payable lastPlayer_re_ent23;
uint jackpot_re_... | 2,504,812 |
./full_match/4/0xb49091B5cbf374D4C85a76Add90AC61546051F23/sources/src/contracts/ERC721.sol | setting the address of nft owner to check the mapping of the address from tokenOwner at the tokenId return truthiness that address is not zero | function _exists(uint256 tokenId) internal view virtual returns(bool) {
address owner = _tokenOwner[tokenId];
return owner != address(0);
}
| 650,306 |
// 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... | we lose some precision here. but it shouldnt matter as we are underestimating | function virtualPriceToSynth() public view returns (uint256) {
return curvePool.get_virtual_price();
}
| 14,896,842 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/... | This is how you get one, or more.../ | function mint(uint256 amount) public payable nonReentrant {
require(amount > 0, "minimum 1 token");
require(amount <= totalTokenToMint - tokenIndex, "greater than max supply");
require(isSaleActive, "sale is not active");
require(amount <= 20, "max 20 tokens at once");
require(pricePerToken * amount == msg.v... | 6,458,959 |
./partial_match/1/0xf1254e912E4FB87c178Df9a9baf6dD49009E3fe4/sources/src/WrappedRebaseToken.sol | Withdraws a given amount of the wrapped token, calculates how much to send, and sends the unwrapped amount it to the user withdrawAmount The amount of wrapped rebase tokens to unwrap return unwrappedTokens The amount of unwrapped rebase tokens sent to the user/ | function withdraw(uint256 withdrawAmount) external returns (uint256 unwrappedTokens) {
if (balanceOf(msg.sender) < withdrawAmount) {
revert WrappedRebaseTokenErrors.UNWRAP_AMOUNT_EXCEEDS_BALANCE();
}
if (withdrawAmount == 0) {
revert WrappedRebaseTokenErrors.CANNOT_WI... | 15,557,393 |
./full_match/1/0x32fE0faC7929ca8CB57453055E1487C1b6474BBe/sources/Wolves.sol | Returns the SVG and metadata for a token Id _tokenId The tokenId to return the SVG and metadata for./ | function tokenURI(uint256 _tokenId)
public
view
override
returns (string memory)
{
require(_exists(_tokenId));
string memory tokenHash = _tokenIdToHash(_tokenId);
if (tokenIdTime[_tokenId] > block.timestamp){
return
s... | 4,892,373 |
./full_match/80001/0x2Ce3d1665B4d8d0546958CEEC8cFCEA7bC4aC1AA/sources/project_/contracts/ArtifactTokensERC1155.sol | Payable function for open mystery boxes boxId Id for mystery boxes to open (BASIC = 0; PRO = 1; MASTER = 2)/ Check valid mystery box id/ Check mystery box supply less than limit/ Check msg.value equal to price/ Calculate size of iterations/ Repeat iteration by iterations count/ Get count of tokens ... | function openBox(uint256 boxId) external payable {
require(boxId == BASIC || boxId == PRO || boxId == MASTER,
"ArtifactTokensERC1155: Wrong id for mystery box"
);
require(getMysteryBoxesSupply(boxId) < getMysteryBoxesLimit(boxId),
"ArtifactTokensERC1155: Mystery box ... | 9,478,549 |
./full_match/5/0xf9fED734926Ab286e715353B7aEC636AECaF5c5F/sources/project_/contracts/SmartLeaseContract.sol | 函數(6-2):確認、同意租客(房東限定、租約已提出、租客地址不為空值) (傳入參數:租客地址、租金、押金) 條件:租客累積數量 < 容量上限 (因為每次只能同意一位租客,所以租客累積量不超過容量上限即可) 條件:租客地址不可為房東地址(防止房東惡意搶租) 條件:租客地址不可重複 加入租客:將租可加入陣列「tenants」 租客地址對應到陣列「tenants」的索引值 租客累積量 +1 觸發事件:指定租客 | function assignTenant(
address _tenantAddress,
uint256 _rentAmount,
uint256 _depositAmount
) external onlyLandlord isContractProposed notZeroAddres(_tenantAddress) {
require(
tenantOccupancy < TENANT_CAPACITY,
"The rental unit is fully occupied."
)... | 7,043,833 |
pragma solidity ^0.5.16;
import "./CToken.sol";
import "./ERC3156FlashLenderInterface.sol";
import "./ERC3156FlashBorrowerInterface.sol";
/**
* @title Cream's CCollateralCapErc20 Contract
* @notice CTokens which wrap an EIP-20 underlying with collateral cap
* @author Cream
*/
contract CCollateralCapErc20 is CToke... | Similar to EIP20 transfer, except it handles a False result from `transferFrom` and reverts in that case. This will revert due to insufficient balance or insufficient allowance. This function returns the actual amount received, which may be less than `amount` if there is a fee attached to the transfer. ... | function doTransferIn(
address from,
uint256 amount,
bool isNative
) internal returns (uint256) {
EIP20NonStandardInterface token = EIP20NonStandardInterface(underlying);
uint256 balanceBefore = EIP20Interface(underlying).balanceOf(address(this));
token.transferF... | 1,445,615 |
./full_match/5/0x868D65C05E74325f55A9B3cF6B6C474809a1DFb0/sources/contracts/TokuToken.sol | change the wallet that receives owner tax benifits | function setOwnerWallet(address _newWallet) public onlyOwner {
ownerWallet = _newWallet;
}
| 1,943,278 |
pragma solidity ^0.5.0;
/* Oh wow, it's finally happening /*
╔══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╗
║ $$$$$$$\ $$\ $$\ $$\ $$\ $$$$$$\ $$$$$$$\ $$$$$$$$\ ║
║ $... | Alias of sell(amount, false) | function sell(uint256 amount) external returns(uint256 ethReceieved); | 1,778,940 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
/*
▒███████▒ ██▓ ██▓ ██▓ ▄▄▄
▒ ▒ ▒ ▄▀░▓██▒▓██▒ ▓██▒ ▒████▄
░ ▒ ▄▀▒░ ▒██▒▒██░ ▒██░ ▒██ ▀█▄
▄▀▒ ░░██░▒██░ ▒██░ ░██▄▄▄▄██
▒███████▒░██░░██████▒░██████▒▓█ ▓██▒
░▒▒ ▓░▒░▒░▓ ░ ▒░▓ ░░ ▒░▓ ░▒▒ ▓▒█░
░░▒ ▒ ░ ▒ ▒ ░░ ░ ▒ ░░ ░ ▒ ░ ▒ ... | can only be called from owner to mint Zillas that were already burned before migration - the zilla will be sent to community wallet | function mintBurnedZilla(uint256 oldId, uint256 newId) public onlyOwner {
require(!_exists(newId), "Token already minted");
require(Opensea(openseaSharedAddress).balanceOf(burnAddress, oldId), "Old Token still exists (isn't burned yet)");
_mint(communityWallet, newId);
emit Arise(co... | 248,385 |
/**
*Submitted for verification at Etherscan.io on 2020-08-03
*/
pragma solidity 0.5.16;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in exist... | Calculates the amount of unclaimed rewards per token since last update, and sums with stored to give the new cumulative reward per token return 'Reward' per staked token/ If there is no StakingToken liquidity, avoid div(0) | function rewardPerToken()
public
view
returns (uint256)
{
uint256 stakedTokens = totalSupply();
if (stakedTokens == 0) {
return rewardPerTokenStored;
}
}
| 1,083,793 |
pragma solidity ^0.5.17;
interface IERC20 {
function TOTALSUPPLY3() external view returns (uint256); //inject NONSTANDARD NAMING
function BALANCEOF367(address account) external view returns (uint256); //inject NONSTANDARD NAMING
function TR... | inject NONSTANDARD NAMING | function WITHDRAW88(uint) external; | 12,996,812 |
./full_match/3/0x8f449Cdf6249E608c661c37eeA40420A117501DE/sources/KickstarterDepFee.sol | See {IERC20-approve}. Requirements: - `spender` cannot be the zero address./ | function approve(address spender, uint256 amount) override public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
| 8,266,846 |
// 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 existence.
*/
function totalSupply() external view ret... | Anyone can harvest it at any given time. I understand the possibility of being frontrun But ETH is a dark forest, and I wanna see how this plays out i.e. will be be heavily frontrunned? if so, a new strategy will be deployed. Collects crv tokens Don't bother voting in v1 Burn some btfs first | function harvest() public override onlyBenevolent {
ICurveMintr(mintr).mint(gauge);
uint256 _crv = IERC20(crv).balanceOf(address(this));
if (_crv > 0) {
_swapUniswap(crv, weth, _crv);
}
if (_weth > 0) {
if (devFundFee > 0) {
uint256 _... | 8,001,527 |
pragma solidity ^0.4.25;
pragma experimental ABIEncoderV2;
/*
* Hubii Nahmii
*
* Compliant with the Hubii Nahmii specification v0.12.
*
* Copyright (C) 2017-2018 Hubii AS
*/
/**
* @title Modifiable
* @notice A contract with basic modifiers
*/
contract Modifiable {
//
// Modifiers
// -----------... | Public functions ----------------------------------------------------------------------------------------------------------------- Set operational mode to Exit Once operational mode is set to Exit it may not be set back to Normal | function setOperationalModeExit()
public
onlyEnabledServiceAction(OPERATIONAL_MODE_ACTION)
{
operationalMode = OperationalMode.Exit;
emit SetOperationalModeExitEvent();
}
| 415,238 |
./partial_match/1/0xad108A81e22FAA725Ea3c58788D0ff8245204A7f/sources/VolumeRestrictionTM.sol | Returns the permissions flag that are associated with Percentage transfer Manager/ | function getPermissions() public view returns(bytes32[] memory allPermissions) {
allPermissions = new bytes32[](1);
allPermissions[0] = ADMIN;
}
| 4,389,443 |
./partial_match/1/0x28A9317CD26B4e28780f929d89DcCbC62e08c886/sources/ATAB.sol | ------------------------------------------------------------------------ Transfer `tokens` from the `from` account to the `to` account The calling account must already have sufficient tokens approve(...)-d for spending from the `from` account and - From account must have sufficient balance to transfer - Spender must ha... | function transferFrom(address from, address to, uint tokens) public returns (bool success) {
require(to != address(0), "to address is a zero address");
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(token... | 4,018,389 |
./full_match/4/0xE49600b97FC4376292dB7598C17F9bd44d1B0c42/sources/contracts/ChargingStation.sol | Function to get the current ETH price in USD from chainlink ETH/USD rate | function getPrice() public view returns (uint256) {
AggregatorV3Interface priceFeed = AggregatorV3Interface(
0x8A753747A1Fa494EC906cE90E9f37563A8AF630e
);
(, int256 answer, , , ) = priceFeed.latestRoundData();
return uint256(answer * 10000000000);
}
| 12,451,920 |
./full_match/3/0x0bcf9a63A8d67eF1Dd4Dbc8BAFA7D9CCffcda96f/sources/browser/PYLON.sol | Transfer tokens to a specified address. to The address to transfer to. value The amount to be transferred. return True on success, false otherwise./ underlying balance is stored in pylons, so divide by current scaling factor note, this means as scaling factor grows, dust will be untransferrable. minimum transfer valu... | function transfer(address to, uint256 value)
external
validRecipient(to)
returns (bool)
{
uint256 pylonValue = value.mul(internalDecimals).div(pylonsScalingFactor);
_pylonBalances[msg.sender] = _pylonBalances[msg.sender].sub(pylonValue);
_pylonBalances[to] = _... | 8,271,481 |
./full_match/1/0xFfB55c7C36C11C3d3EF105aE22328a191F874Afd/sources/contracts/Audit.sol | Moves `amount` of tokens from `from` to `to`. This internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `from` must have a balance... | function _transfer(
address from,
address to,
uint256 amount
) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
... | 3,220,908 |
./partial_match/1/0xA2608594E83CB2913333Ff1fe6e1cC4EA66484f5/sources/src/TokenVesting.sol | Returns the number of vesting schedules associated to a beneficiary. return the number of vesting schedules/ | function getVestingSchedulesCountByBeneficiary(
address _beneficiary
) external view returns (uint256) {
return holdersVestingCount[_beneficiary];
}
| 2,747,846 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.9;
import "@openzeppelin/contracts/token/ERC777/IERC777.sol";
import "@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/introspection/IERC1820Registry.sol";
import "@openze... | PUBLIC: Get LAND/CROP compost ratio for global (entire network)/ If you haven't harvested or composted anything then you get the default 1x multiplier | function getGlobalRatio() public view returns (uint256) {
if (globalAllocatedAmount == 0) {
return 0;
}
globalCompostedAmount.mul(_ratioMultiplier).div(globalAllocatedAmount);
return globalRatio;
}
| 12,803,665 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;
pragma abicoder v2;
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@kyber.network/utils-sc/contracts/IERC20Ext.sol";
import "./interfaces/ISmartWalletImplementation.sol";
import ".... | get expected return including the fee return destAmount expected dest amount return expectedRate expected swap rate | function getExpectedReturn(ISmartWalletImplementation.GetExpectedReturnParams calldata params)
external
view
override
returns (uint256 destAmount, uint256 expectedRate)
{
uint256 actualSrc = (params.feeMode == FeeMode.FROM_SOURCE)
? (params.srcAmount * (BPS -... | 13,942,068 |
./full_match/1/0x1a801aDD97b35b17ba9968986CEaCD2CD6e74834/sources/contracts/BytesLib.sol | Returns the ENS namehash of a DNS-encoded name. self The DNS-encoded name to hash. offset The offset at which to start hashing. return The namehash of the name./ | function namehash(
bytes memory self,
uint256 offset
) internal pure returns (bytes32) {
(bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);
if (labelhash == bytes32(0)) {
require(offset == self.length - 1, "namehash: Junk at end of name");
return bytes32(0);
}
retu... | 3,138,684 |
./full_match/97/0x6226d8C86Ac16B17eED6d7E655D2f665DB2cCC8A/sources/project_/contracts/Crowdsale.sol | for(uint i = 0; i < stableCoins.length; i++) { StableCoinLP memory lp = stableCoinsLPs[stableCoins[i]]; (uint112 reserve0, uint112 reserve1,) = lp.pair.getReserves(); uint256 _price; if(reserve0 == 0 || reserve1 == 0) { _price = 0; } else { ... | function getETHPrice() public pure returns (uint256 price) {
price = 1657268369896177043863;
}
| 5,019,769 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/util... | Get the reward multipier based on the account status account Account address token ERC20 token address return Multiplier number (in wei)/ | function getRewardsMultiplier(address account, address token) public view override returns (uint256) {
IUserManager userManagerContract = IUserManager(_getUserManager(token));
uint256 stakingAmount = userManagerContract.getStakerBalance(account);
uint256 lockedStake = userManagerContract.get... | 12,185,294 |
./full_match/5/0xA416F18807Fdf0c5433a2A5487f7Ef648317dded/sources/contracts/libraries/Utils.sol | checks if two strings are equal | function stringsEqual(string memory _a, string memory _b)
internal
pure
returns (bool)
{
return
keccak256(abi.encodePacked(_a)) == keccak256(abi.encodePacked(_b));
}
| 1,916,239 |
/**
* Copyright (C) 2017-2018 Hashfuture Inc. All rights reserved.
*/
pragma solidity ^0.4.24;
library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
assert(c / a == b);
return c;... | Initialize asset file and legal file _assetFileUrl The url of asset file _assetFileHashType The hash type of asset file _assetFileHashValue The hash value of asset file _legalFileUrl The url of legal file _legalFileHashType The hash type of legal file _legalFileHashValue The hash value of legal file/ | function initAssetFile(
string _assetFileUrl,
string _assetFileHashType,
string _assetFileHashValue,
string _legalFileUrl,
string _legalFileHashType,
string _legalFileHashValue
) internal {
assetFile = data(
_assetFileUrl, _assetFileHashTyp... | 12,672,244 |
pragma solidity 0.5.0;
import "@openzeppelin/contracts/token/ERC721/ERC721Full.sol";
contract Color is ERC721Full{
string[] public colors;
mapping(string => bool) _colorExists;
constructor() ERC721Full("Color","COLOR") public {
}
function mint(string memory _color) public {... | Require unique colorColor - add it Call the mint function Color -track it | function mint(string memory _color) public {
require(!_colorExists[_color]);
uint _id = colors.push(_color);
_mint(msg.sender, _id);
_colorExists[_color] = true;
}
| 6,479,536 |
pragma solidity 0.6.5;
pragma experimental ABIEncoderV2;
struct UserInfo {
uint256 amount;
uint256 rewardDebt;
}
struct PoolInfo {
address lpToken;
uint256 allocPoint;
uint256 lastRewardBlock;
uint256 accSushiPerShare;
}
interface ProtocolAdapter {
/**
* @dev MUST return ... | return Amount of SUSHI rewards / staked tokens for a given account. Implementation of ProtocolAdapter interface function./ | function getBalance(address token, address account) external view override returns (uint256) {
uint256 length = MasterChef(MASTER_CHEF).poolLength();
if (token == SUSHI) {
uint256 totalRewards = 0;
for(uint256 i = 0; i < length; i++) {
totalRewards +=... | 7,331,997 |
/**
*Submitted for verification at Etherscan.io on 2022-04-26
*/
pragma solidity ^0.8.7;
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the ... | Purchases one or more passes. Requires price() token() per pass./ | function purchase(uint256 count) public virtual whenEnabled {
require(count > 0, "Must mint at least one");
require(totalSupply(0)+count <= MAX_SUPPLY-oldSupply, "Exceed max supply");
token.burn(msg.sender, count * price);
_mint(msg.sender, 0, count, hex"");
}
| 6,545,494 |
/**
*Submitted for verification at Etherscan.io on 2021-03-31
*/
/**
*Submitted for verification at Etherscan.io on 2021-03-31
*/
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
contract Gds {
/// @notice EIP-20 token name for this token
string public constant name = "GoodSwap";
/// @notice... | 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, "Dgs::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
... | 8,079,776 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
contract SafeMath {
function safeMul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
retur... | Upgrade tokens to the new token contract. value The number of tokens to upgrade Validate input value. update the balances here first before calling out (reentrancy) | function upgrade(uint256 value) external {
require (value > 0 && upgradeAgent.owner() != 0x0);
require (value <= balances[msg.sender]);
balances[msg.sender] = safeSub(balances[msg.sender], value);
totalSupply = safeSub(totalSupply, value);
totalUpgraded = safeAdd(totalUpgra... | 1,066,586 |
./full_match/44787/0xBCba425b9Dd7D56B49d2Af59DA15E284A49dbEc5/sources/contracts/pools/BaseCarbonTonne.sol | Redeem a whitelisted TCO2 without paying any fees and burn the TCO2. Initially added to burn HFC-23 credits, can be used in the future to dispose of any other whitelisted credits. User needs to approve the pool contract in the TCO2 contract for the amount to be burnt before executing this function. tco2 TCO2 to redee... | function redeemAndBurn(address tco2, uint256 amount)
external
whenNotPaused
{
require(redeemFeeExemptedTCO2s[tco2], 'Not exempted');
redeemSingle(tco2, amount);
IToucanCarbonOffsets(tco2).burnFrom(msg.sender, amount);
}
| 13,272,236 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to th... | Deprecated. This function has issues similar to the ones found in {IERC20-approve}, and its usage is discouraged. Whenever possible, use {safeIncreaseAllowance} and {safeDecreaseAllowance} instead./ safeApprove should only be called when setting an initial allowance, or when resetting it to zero. To increase and decrea... | function safeApprove(
IERC20Lib token,
address spender,
uint256 value
) internal {
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(
... | 1,423 |
/**
*Submitted for verification at Etherscan.io on 2022-04-01
*/
pragma solidity 0.8.7;
// SPDX-License-Identifier: MIT
// PIXUL Token Smart Contract for the PIXUL Ecosystem
// Contract using solidity 8 for Pixul
/**
Pixul | Developing Crypto Solutions
Building utilizations for crypto.
We believe the ado... | ---------------------------------------------------------------------------- ERC Token Standard 20 Interface https:github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md ---------------------------------------------------------------------------- | interface ERC20Interface {
function totalSupply() external view returns (uint);
function balanceOf(address tokenOwner) external view returns (uint balance);
function allowance(address tokenOwner, address spender) external view returns (uint remaining);
function transfer(address to, uint tokens) external... | 2,048,406 |
./full_match/1/0xfffE32106A68aA3eD39CcCE673B646423EEaB62a/sources/contracts/protocol/lendingpool/DefaultReserveInterestRateStrategy.sol | Calculates the interest rates depending on the reserve's state and configurations reserve The address of the reserve availableLiquidity The liquidity available in the reserve totalStableDebt The total borrowed from the reserve a stable rate totalVariableDebt The total borrowed from the reserve at a variable rate a... | function calculateInterestRates(
address reserve,
uint256 availableLiquidity,
uint256 totalStableDebt,
uint256 totalVariableDebt,
uint256 averageStableBorrowRate,
uint256 reserveFactor
)
external
view
override
returns (
uint256,
uint256,
uint256
)
{
... | 3,092,247 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "./BudLightERC721.sol";
//
// (((((((((((((((((((((((* (((((((((((((((((((((((
// (((((,,,,,,*%%%%%%%#((( (((*,,,,,,*%%%%%%%%((((
// ((((( @@@@@@@#((( ((( @@@@@@@@((((
// ((((((((((((((((... | Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings./ Whitelist OpenSea proxy contract for easy trading. | function isApprovedForAll(address owner, address operator)
override
public
view
returns (bool)
{
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator && isOSProxyActive == true) {
retu... | 6,201,755 |
pragma solidity >=0.5.4 <0.6.0;
import './SafeMath.sol';
import './TAOController.sol';
import './ITAOPool.sol';
import './ITAOFactory.sol';
import './TAOCurrency.sol';
import './Logos.sol';
import './TAO.sol';
/**
* @title TAOPool
*
* This contract acts as the bookkeeper of TAO Currencies that are staked on TAO
*... | The AO set the Ethos Address _ethosAddress The address of Ethos/ | function setEthosAddress(address _ethosAddress) public onlyTheAO {
require (_ethosAddress != address(0));
ethosAddress = _ethosAddress;
_ethos = TAOCurrency(_ethosAddress);
}
| 12,935,868 |
./full_match/3/0x2a9c9beB311c50c64c23FE435685489C51996d6F/sources/contracts/MasterChef.sol | Safe classy transfer function, just in case if rounding error causes pool to not have enough CLSYs. | function safeClassyTransfer(address _to, uint256 _amount) internal {
uint256 classyBal = classy.balanceOf(address(this));
if (_amount > classyBal) {
classy.transfer(_to, classyBal);
classy.transfer(_to, _amount);
}
}
| 8,094,732 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "./Proxy.sol";
interface ERC165 {
function supportsInterface(bytes4 id) external view returns (bool);
}
contract SemiTransparentProxy is Proxy {
// ////////////////////////// EVENTS ////////////////////////////////////////////////////////////////... | TO FULFILL EIP-173 this function is not transparent a clash would only have for consequences that a owner-clashing function in the implementation would have no effect except returning the owner address while this could cause problem, it is unlikely to be caught by a test Plus this contract is part of a tooling process ... | function owner() external view returns (address) {
return _owner();
}
| 7,270,968 |
// SPDX-License-Identifier: MIT
pragma experimental ABIEncoderV2;
pragma solidity ^0.7.1;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../../interfaces/ILendingLogic.sol";
import "../../interfaces/IDecimalWrapper.sol";
import "./LendingRegistry.sol";
contract DepositLogicDecimalWrapper is ILendin... | / unlend token _amount or actual balance, whatever is lessUnlend token if needed add underlying if needed remove wrapped | function unlend(address _wrapped, uint256 _amount) public onlyOwner nonReentrant {
uint256 amount = _amount.min(IERC20(_wrapped).balanceOf(address(basket)));
(
address[] memory _targets,
bytes[] memory _data
) = lendingRegistry.getUnlendTXData(_wrapped, amount);
... | 1,693,008 |
pragma solidity ^0.8.0;
import "../../utils/Context.sol";
import "./extensions/IERC721Rental.sol";
import "../../utils/introspection/ERC165.sol";
/// @title ERC721 simple rental agreement.
/// Define a simple rental agreement following the principles:
/// - The rental is valid for a fixed period. The rental period ... | @inheritdoc IERC721RentalAgreement | function afterRentalStarted(address from, uint256) public view override {
require(from == address(this));
}
| 12,872,407 |
pragma solidity ^0.5.10;
import "./UnitFactory.sol";
/**
* @title Track a single unit with associated operations (setup, maintainance, repair, ...)
* @author E. Guyonnet
* @notice Created by the UnitFactory
* This contract doesn't need to be upgradable
*/
contract Unit {
address private parentFa... | Updates the control status of an operation to KO (must be completed by a certification body) _index Index of the operation controlled | function controlOperationKo(uint256 _index) external {
_controlOperation(_index, 3);
emit OperationControlledKo(_index);
}
| 943,447 |
./partial_match/1/0xdc7300622948a7AdaF339783F6991F9cdDD79776/sources/AllowedRecipientsRegistry.sol | Checks if _payoutAmount is less or equal than the may be spent _payoutAmount Motion total amount _motionDuration Motion duration - minimal time required to pass before enacting of motion return True if _payoutAmount is less or equal than may be spent note that upfront check is used to compare _paymentSum with total ... | function isUnderSpendableBalance(uint256 _payoutAmount, uint256 _motionDuration)
external
view
returns (bool)
{
if (block.timestamp + _motionDuration >= currentPeriodEndTimestamp) {
return _payoutAmount <= limit;
return _payoutAmount <= _spendableBalance(l... | 2,704,316 |
./full_match/43113/0x6b9c8c5ac8161a932FF63308D0dF500a76c069AF/sources/src/RToken/RToken.sol | User redeems RTokens in exchange for the underlying asset Assumes interest has already been accrued up to the current block redeemer The address of the account which is redeeming the tokens redeemTokensIn The number of RTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be non-zero) ... | function redeemFresh(address payable redeemer, uint redeemTokensIn, uint redeemAmountIn) internal returns (uint) {
require(redeemTokensIn == 0 || redeemAmountIn == 0, "one of redeemTokensIn or redeemAmountIn must be zero");
RedeemLocalVars memory vars;
(vars.mathErr, vars.exchangeRateManti... | 7,112,784 |
pragma solidity ^0.4.2;
contract Token {
uint256 public totalSupply;
function balanceOf(address _owner) public constant returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public retur... | Change pixel or 10x1 costs 7 | 3 | 0 | function setRowColors(uint24 propertyID, uint8 row, uint24 newColorData) public validPropertyID(propertyID) returns(bool) {
Property storage property = map[propertyID];
require(row >= 0 && row <= 9);
uint256 cost = property.owner != 0 ? 1 : 2;
if (property.... | 2,569,763 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.