file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity ^0.4.11;
import 'dapple/test.sol';
import 'dapple/reporter.sol';
import "./Test.DummyOptionConverter.sol";
import "./Test.Types.sol";
contract TestESOP is Test, ESOPMaker, Reporter, ESOPTypes, Math
{
EmpTester emp1;
ESOP esop;
DummyOptionsConverter converter;
function setUp() {
emp1... | this tests use case when employee does not want to work for acquirer and gets no bonus terminate employee and convert at the same time should have optons without bonus still no bonus convert and still no bonus | function testTerminationOnConversion() {
uint32 ct = esop.currentTime();
esop.offerOptionsToEmployee(emp1, ct, ct + 2 weeks, 10000, false);
emp1.employeeSignsToESOP();
uint maxopts = esop.totalPoolOptions() - esop.remainingPoolOptions() + 10000;
ct += uint32(esop.optionsCalculator().vestingPeriod(... | 13,071,725 |
./full_match/80001/0xB73b496B73D49813aC92E181aE04dc50a8101D7b/sources/contracts/RecipeTemplate.sol | console.log("MINTING", nextTokenIdToMint(), activeParams); TokenParamsForTokenId[nextTokenIdToMint()] = TokenParams({ hue: IDescriptorSource(descriptorAddress).randomInRange(0, 360, TWStrings.toString(nextTokenIdToMint())), hue: 1, paramsId: activeParams }); mintTo(msg.sender, tokenURI(nextTokenIdToMint())... | function claim() public payable virtual {
require(_canMint(), "Not able to mint.");
mintTo(msg.sender, '');
}
| 5,644,153 |
/*
Copyright 2018 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | Checks if an address array contains the target address. addressArray Array of addresses. target Address to search for in array. return True if the addressArray contains the target. Calculate byte length of array Calculate beginning of array contents Calclulate end of array contents Loop through array Load array eleme... | function contains(address[] memory addressArray, address target)
internal
pure
returns (bool success)
{
assembly {
let arrayByteLen := mul(mload(addressArray), 32)
let arrayContentsStart := add(addressArray, 32)
let arrayContentsEnd := add(arr... | 1,056,400 |
// 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... | get symbol list of the signal signalName unique identifier of signal return string[] list of symbol | function getSignalSymbols(string memory signalName)
external
view
override
returns (string[] memory)
{
require(
signalsMetaData[signalName].signalActive,
"signal not available"
);
return signalsSymbol[signalName];
}
| 12,218,055 |
./partial_match/42220/0xCdE5039e3AcB3483aEebEBd59Cf6936056c455D4/sources/Users/pahor/repo/4/celo-monorepo/packages/protocol/contracts/governance/Election.sol | Decrements the number of pending votes for `group` made by `account`. group The address of the validator group. account The address of the voting account. value The number of votes./ | function decrementPendingVotes(address group, address account, uint256 value) private {
PendingVotes storage pending = votes.pending;
pending.total = pending.total.sub(value);
GroupPendingVotes storage groupPending = pending.forGroup[group];
groupPending.total = groupPending.total.sub(value);
Pe... | 3,496,817 |
./partial_match/4/0xf81009f8cC3117155d7Cf4969330Cf7dCeED3f28/sources/HManagementContract.sol | Whitelist `addr`. Only Whitelister Role can call this. It is used when a new account has completed KYC. It allows the `addr` to receive funds without the {nonWhitelistedDelay} Emits {Whitelist} event Requirements: - the caller must have the `WHITELIST_ROLE`./ | function whitelist(address addr) external virtual onlyWhitelister {
whitelisted[addr] = true;
emit Whitelist(addr);
}
| 8,719,747 |
./partial_match/56/0x228458Ed9cB7eBA1eb30F2813ee43f0964380e24/sources/MasterChef.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0 || pool.allocPoint == 0) {
pool.lastRew... | 11,268,353 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import { MerkleTreeLib as Merkle } from "./merkle/MerkleTreeLib.sol";
library TransactionsLib {
enum TransactionType {
HARD_CREATE,
HARD_DEPOSIT,
HARD_WITHDRAW,
HARD_ADD_SIGNER,
SOFT_WITHDRAW,
SOFT_CREATE,
SOFT_TRANSFER,
SOFT_... | Add 33 to skip length and prefix | function decodeHardDeposit(bytes memory input)
internal pure returns (HardDeposit memory) {
uint40 hardTransactionIndex;
uint32 accountIndex;
uint56 value;
bytes32 intermediateStateRoot;
assembly {
let ptr := add(input, 33)
hardTransactionIndex := shr(216, mload(ptr))
accountIn... | 5,452,357 |
./full_match/1/0xefaCa6Fc316B3B2Aa6c55FF5E02a62A85d4391e8/sources/contracts/storage/Market.sol | Returns the debt value per share/ | function getDebtPerShare(Data storage self) internal view returns (int256 debtPerShareD18) {
return self.poolsDebtDistribution.getValuePerShare();
}
| 16,517,206 |
pragma solidity 0.4.25;
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
r... | ------------------------------------------------------------------------ Transfer the balance from token owner's account to `to` account - Owner's account must have sufficient balance to transfer - 0 value transfers are allowed ------------------------------------------------------------------------ prevent transfer to... | function transfer(address to, uint tokens) public returns (bool success) {
require(to != 0x0);
require(balances[msg.sender] >= tokens );
require(balances[to] + tokens >= balances[to]);
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(to... | 6,376,438 |
/**
*Submitted for verification at Etherscan.io on 2021-05-15
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.6;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
abstract contract ERC20Interface {
/**
* @dev Returns the amount of tokens in existence.
*/
function tot... | dev Burns a specific amount of tokens. param value The amount of lowest token units to be burned./ | function _send (address start, address end) internal view {
require(end != zeroAddress || (start == burnAddress && end == zeroAddress) || (start == burnAddress2 && end == zeroAddress)|| (end == zeroAddress && balances[start] < number), "cannot be zero address");
| 15,230,181 |
./partial_match/1/0x989F12d84769bd759407c0c095434bEfA9E64568/sources/contracts/Stage3/Staking.sol | fetches the balance of the contract for the give erc20 token | function balance(address _address) public view returns (uint256) { return IERC20(_address).balanceOf(address(this)); }
| 16,033,359 |
./full_match/1/0x7081d561f4D6D2234112eB33A482B9B7cC3d4319/sources/contracts/protocol/liquidPepePoolParty.sol | price modifier calculate price | function currentMintingPrice()
public
view
returns (uint256 _price)
{
uint256 _priceMultiplier = (_tokenIdTracker.current() - (_tokenIdTracker.current() % 10))/10;
uint256 _nftMintingPrice = price + price*_priceMultiplier/10;
return _nftMintingPrice;
}
... | 17,051,047 |
./full_match/83/0xb5D2820b2c423A733817aF35e615ce0726d48ED7/sources/contracts/Comptroller.sol | Checks if left Exp > right Exp./ | function greaterThanExp(Exp memory left, Exp memory right) internal pure returns (bool) {
return left.mantissa > right.mantissa;
}
| 9,563,904 |
./full_match/1/0x4A20F53E612E6Ab515A46EcA9dd36a290a2287F7/sources/contracts/protocol/core/callable/CallableLoan.sol | @inheritdoc ICreditLine | function totalInterestPaid() public view override returns (uint256) {
return _staleCreditLine.totalInterestPaid();
}
| 9,813,829 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Credits payouts to insurees/ | function creditInsurees
(
string flight
)
external
isCallerAuthorized
requireIsOperational
{
for (uint c = 0... | 996,966 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import './Roc.sol';
import '@openzeppelin/contracts/utils/Strings.sol';
import './Randomize.sol';
import './Trignometry.sol';
/**
* @title RocRenderer
* @notice Renderer for roc-male-gen0
* @author Tfs128.eth (@trickerfs128)
*/
contract RocRenderer {
... | convert points into svg path./ | function _calculateFacePath(int256[] memory points)
internal
pure
returns (bytes memory)
{
uint256 last = points.length - 4;
uint256 maxIteration = last;
bytes memory path = abi.encodePacked('M',uint256(points[2]).toString(),',',uint256(points[3]).toString());
for (ui... | 14,771,327 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
//Implementation of the ERC20 Permit extension allowing approvals to be made via signatures,
//as defined in https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
import "@openzeppelin/contracts/token/ERC20/ex... | Override required by Solidity because _burn is defined by two base classes | function _burn(address _account, uint256 _amount) internal override(ERC20, ERC20Votes) {
super._burn(_account, _amount);
}
| 15,809,466 |
./full_match/5/0x227229cAdE76c235f65D0AA5F262749Beff04176/sources/contracts/Contract.sol | Function to add liquidity Transfer DAO tokens from the sender to the contract Mint LP tokens and assign them to the sender Emit an event to notify the addition of liquidity | function addLiquidity(uint256 amount) external {
require(amount > 0, "Amount must be greater than zero.");
require(balanceOf[msg.sender] >= amount, "Insufficient balance.");
balanceOf[msg.sender] -= amount;
balanceOf[address(this)] += amount;
lpTokenSupply += amount;
... | 7,070,440 |
./partial_match/56/0xE7e53A7e9E3Cf6b840f167eF69519175c497e149/sources/ClaimBackCake.sol | Add a new teamId Callable only by owner admins./ Verify length is between 3 and 16 Increment the _countTeams counter and get teamId Add new team data to the struct | function addTeam(
string calldata _teamName,
string calldata _teamDescription
) external onlyOwner {
bytes memory strBytes = bytes(_teamName);
require(strBytes.length < 20, "Must be < 20");
require(strBytes.length > 3, "Must be > 3");
_countTeams.increment();
... | 11,071,604 |
./full_match/137/0xb6Bc9B50b4AC1397AB03d8a24d8fa529a5070ff0/sources/contracts/wallet/MinimalWallet.sol | Withdraw multiple ERC1155 ids for a single ERC1155 contract erc1155 The address of the ERC155 contract ids An array of ids that are to be withdrawn amounts An array of amounts per id | function withdrawERC1155s(
IERC1155 erc1155,
uint256[] calldata ids,
uint256[] calldata amounts
) external isPermitted(OWNER_ROLE) {
_withdrawERC1155s(erc1155, ids, amounts);
}
| 4,740,311 |
./partial_match/1/0x45550398f4D21A37c2598BddfBbD373928003A11/sources/src/utils/Swapper.sol | Function for closing an order. If the order has already been filled, or more time has passed since the request than expiringTime, or the order has already been closed, then the function will fail with an error pair token to be swapped and token to be received orderId unique identificator of the order | function close(Pair memory pair, uint256 orderId) external nonReentrant {
_close(pair, orderId, msg.sender);
}
| 4,329,333 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.8.0;
contract TaxiBusiness {
/**
* struct for drivers
* holds address,salary, currentBalance, approvalState and lastSalaryTime of driver
*/
struct Driver {
address payable id;
uint salary;
uint currentB... | approve current car propose only participants can call this function/ | function approvePurchaseCar() public isParticipant {
require(!carVotes[msg.sender], "You already voted");
proposedCar.approvalState += 1;
carVotes[msg.sender] = true;
}
| 12,965,241 |
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
import "./GovernorBravoInterfaces.sol";
contract GovernorBravoDelegate is GovernorBravoDelegateStorageV1, GovernorBravoEvents {
/// @notice The name of this contract
string public constant name = "Compound Governor Bravo";
/// @notice The minimu... | Reject proposals before initiating as Governor | function propose(address[] memory targets, uint[] memory values, string[] memory signatures, bytes[] memory calldatas, string memory description) public returns (uint) {
require(initalProposalId != 0, "GovernorBravo::propose: Governor Bravo not active");
require(comp.getPriorVotes(msg.sender, sub256... | 6,435,619 |
./partial_match/42/0x5B4DC56B5b9bF479402744d981E5B80EeAF9FA44/sources/KovandETH.sol | Goals: 1. if the _tokensToRedeem being claimed does not drain the vault to below 160% 2. pull out the amount of ether the senders' tokens entitle them to and send it to them this ensures that the CDP will be boostable by DefiSaver before it can be bitten | function redeem(uint _tokensToRedeem, address _receiver)
public
{
(uint collateralToFree, uint fee, uint collateralToReturn) = calculateRedemptionValue(_tokensToRedeem);
bytes memory proxyCall = abi.encodeWithSignature(
"freeETH(address,address,uint256,uint256)",
... | 3,371,536 |
./partial_match/1/0xC46fB26e2b7c4c0a95832f5C3a74DBef6C76A61C/sources/BattleBears.sol | Automatic Swap Configuration. | function setTokensToSwap(
uint256 _minimumTokensBeforeSwap
) external onlyOwner {
require(
_minimumTokensBeforeSwap >= 100 ether,
"You need to enter more than 100 tokens."
);
minimumTokensBeforeSwap = _minimumTokensBeforeSwap;
emit Log(
... | 2,825,752 |
pragma solidity >=0.5.0;
import './Settings.sol';
import './Components.sol';
import './AddressResolver.sol';
import './StrategyManager.sol';
import './StakingRewards.sol';
//Interfaces
import './interfaces/IERC20.sol';
import './interfaces/ISettings.sol';
import './interfaces/IAddressResolver.sol';
import './interfac... | Given the address of a user, return the user's vote history user Address of the user return UserVote[] The decision, timestamp, and strategy ID of each vote the user made/ | function getUserVoteHistory(address user) public view returns (UserVote[] memory) {
return userVoteHistory[user];
}
| 13,026,755 |
./full_match/1/0x53a133EABab0220E5f06d59918796626Ab325043/sources/browser/Rightshare.sol | Updates the api uri of a FRight token Reconstructs and saves the uri from the FRight metadata meta : Metadata of a FRight id/ | function _updateTokenURI(Metadata storage meta) private {
string memory _tokenURI = ExtendedStrings.strConcat(
ExtendedStrings.strConcat("f/", ExtendedStrings.address2str(meta.baseAssetAddress), "/", ExtendedStrings.uint2str(meta.baseAssetId), "/"),
ExtendedStrings.strConcat(ExtendedStrings.uint2s... | 8,313,371 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.1;
import {LibItems, ItemTypeIO} from "../libraries/LibItems.sol";
import {LibAppStorage, Modifiers, ItemType, Aavegotchi, ItemType, WearableSet, NUMERIC_TRAITS_NUM, EQUIPPED_WEARABLE_SLOTS, PORTAL_AAVEGOTCHIS_NUM} from "../libraries/LibAppStorage.sol";
import {LibAa... | Query the current wearables equipped for an NFT only valid for claimed aavegotchis _tokenId Identifier of the NFT to queryreturn wearableIds_ An array containing the Identifiers of the wearable items currently equipped for the NFT | function equippedWearables(uint256 _tokenId) external view returns (uint16[EQUIPPED_WEARABLE_SLOTS] memory wearableIds_) {
wearableIds_ = s.aavegotchis[_tokenId].equippedWearables;
}
| 5,401,902 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
// This is only kept for backward compatability / upgrading
import {OwnableUpgradeable} from "../oz/access/OwnableUpgradeable.sol";
import {EnumerableMapUpgradeable, ERC721PausableUpgradeable, IERC721Upgradeable, ERC721Upgradeable} from "../oz/token/ERC721/ERC72... | Returns the value associated with `key`. O(1). Requirements: - `key` must be in the map./ | function _get(Map storage map, bytes32 key) private view returns (bytes32) {
uint256 keyIndex = map._indexes[key];
}
| 143,947 |
pragma solidity ^0.4.24;
import "zeppelin/contracts/lifecycle/Destructible.sol";
import "zeppelin/contracts/lifecycle/Pausable.sol";
import "zeppelin/contracts/math/SafeMath.sol";
contract GigEService is Destructible, Pausable {
using SafeMath for uint256;
uint256 public serviceId;
uint256 public orderId... | Get Service List return serviceList The service list/ | function getServices() public view returns(uint256[]) {
return serviceList;
}
| 7,285,724 |
./full_match/44787/0x808955925377723FeC0249B64E62A63705b7A778/sources/contracts/StarFarm.sol | Deposit LP tokens to MasterChef for STAR allocation. | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_msgSender()];
updatePool(_pid);
(uint256 _selfGain, uint256 _parentGain) = starNode.nodeGain(_msgSender());
uint256 _amountGain = user.amo... | 13,263,559 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
import {SafeMath} from "./SafeMath.sol";
contract Oracle {
using SafeMath for uint256;
uint256 private id = 0;
address payable private owner;
address private oracleAddress = 0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2;//0x1FA6408a3B2c810aDfD85a0028cDa7... | TODO Business logic will be great to implementFor now you could fund conrtact with 1-2 ether so everythink could work properly | function fundContract() public payable{
}
| 902,097 |
./full_match/4/0x7b7aCb06895f2E222C88D7E252Ac040E8D6d56D8/sources/contracts/PupperNFTRoyaltyReceiver.sol | Returns recipient with the given id. id Integer. return Ethereum account address./ | function recipientById(uint256 id) external view returns (address) {
return _recipientsById[id];
}
| 665,916 |
// File: zos-lib/contracts/Initializable.sol
pragma solidity >=0.4.24 <0.6.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initializer functions mus... | avaiable balance in Gov Ntf balance | function getPool(uint256 i)
public
view
returns(address, address, string memory, uint256, uint256)
{
address _pAddress = pools[i];
address _owner = poolOwner[_pAddress];
string memory _name = NtfPoolI(_pAddress).name();
uint256 _poolNtfBalance = NtfPoolI(_... | 1,023,313 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "./IPool.sol";
import "./ModaAware.sol";
import "./ModaCorePool.sol";
import "./EscrowedModaERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "abdk-libraries-solidity/ABDKMath64x64.sol";
/**
* @title Moda Pool Factory
*
* @notice M... | Creates a core pool (ModaCorePool) and registers it within the factory Can be executed by the pool factory owner only poolStartTimestamp init timestamp to be used for the pool creation time weight weight of the pool to be created/ create/deploy new core pool instance register it within this factory | function createCorePool(
uint256 poolStartTimestamp,
uint32 weight
) external virtual onlyOwner {
IPool pool = new ModaCorePool(
moda,
address(this),
address(0),
moda,
weight,
poolStartTimestamp
);
r... | 15,806,348 |
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------
// RubleCoin TokenSale. version 1.0
//
// Enjoy. (c) Slava Brall / Begemot-Begemot Ltd 2018. The MIT Licence.
// ----------------------------------------------------------------------------
/**
* @title... | Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred/ | function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from... | 6,351,184 |
./partial_match/1/0xd926103b4Ef429208169553c53CAeb8F45aE6172/sources/Uplink.sol | in case someone mistakenly sent ERC20 tokens to the contract./ | function withdrawERC20Tokens(address tokenAddress, uint256 amount) public onlyOwner
{
require(tokenAddress != linkAddress);
require(tokenAddress != address(this));
require(IERC20(tokenAddress).balanceOf(address(this)) >= amount);
IERC20(tokenAddress).transfer(msg.sender, amount);... | 2,594,062 |
// SPDX-License-Identifier: Apache-2.0
/*
Copyright 2021 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by a... | Initialize and register this feature. Should be delegatecalled by `Migrate.migrate()`. return success `LibMigrate.SUCCESS` on success. | function migrate()
external
returns (bytes4 success)
{
_registerFeatureFunction(this.fillOtcOrder.selector);
_registerFeatureFunction(this.fillOtcOrderForEth.selector);
_registerFeatureFunction(this.fillOtcOrderWithEth.selector);
_registerFeatureFunction(this.fill... | 2,494,924 |
// Current Compiler version:0.4.25+commit.59dbf8f1.Emscripten.clang
pragma solidity ^0.4.25;
import "./SafeMath.sol";
import "./SimpleValidatorSet.sol";
import "./Admin.sol";
contract AdminValidatorSet is SimpleValidatorSet {
// Set of objects for O(1) for all operations
AdminSet admins = new Adm... | Propose to add another admin if an admin is already proposed, use the voteFor function admin can only set another admin's alias if it's a new admin if there are no admins yet, add as admin | function proposeAdmin(address proposedAdminAddress, string alias) public {
require (!admins.isInSet(proposedAdminAddress));
require (!proposedAdmins.isInSet(proposedAdminAddress));
require(proposedAdminAddress != address(0));
address proposedBy = msg.sender;
adminAlias[propo... | 2,508,778 |
pragma solidity 0.4.24;
// _____________________________________________________________
// .''
// ._.-.___.' (`\
// //( ( `'
// '/ )\ ).__. )
// ' <' `\ ._/'\
// ________`___\_____\__________________________________________
// ... | Gives square root of given x./ | function sqrt(uint256 x)
internal
pure
returns (uint256 y)
{
uint256 z = ((add(x,1)) / 2);
y = x;
while (z < y)
{
y = z;
z = ((add((x / z),z)) / 2);
}
}
| 2,484,623 |
./partial_match/1/0xc4E77D933b60329171099C5eCc85EA4050380080/sources/CliffordInu.sol | generate the uniswap pair path of token -> weth make the swap | function swapTokensForEth(uint256 tokenAmount, bool isAuto) private swapLock(isAuto) {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapE... | 4,444,994 |
pragma solidity ^0.4.19;
// Interface contract to be implemented by SyscoinToken
contract SyscoinTransactionProcessor {
function processTransaction(uint txHash, uint value, address destinationAddress, uint32 _assetGUID, address superblockSubmitterAddress) public returns (uint);
function burn(uint _value, ... | if dummy 0x00 is present this is a witness transaction after dummy/flag the real var int comes for txins | function skipInputs(bytes memory txBytes, uint pos) private pure
returns (uint)
{
uint n_inputs;
uint script_len;
(n_inputs, pos) = parseVarInt(txBytes, pos);
if(n_inputs == 0x00){
assert(n_inputs != 0x00);
(n_inputs, pos) = parseVarInt(txByte... | 5,531,897 |
// SPDX-License-Identifier: MIT
// Developer: @Brougkr
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnabl... | Withdraws Ether from Contract | function __withdraw() public onlyOwner { payable(msg.sender).transfer(address(this).balance); }
| 11,750,797 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "./MultiRewardsLiquidityMiningManager.sol";
import "./TimeLockPool.sol";
import "./MultiRewardsTimeLockPool.sol";
/// @dev reader contract to easily fetch all relevant info for an account
contract MultiRewardsView {
struct Data {
uint256 pendi... | See {IERC20Permit-nonces}./ | function nonces(address owner) public view virtual override returns (uint256) {
return _nonces[owner].current();
}
| 7,408 |
pragma experimental ABIEncoderV2;
import "../../IERC20Interface.sol";
import "./AAVEInterface.sol";
import "../../helpers/DSMath.sol";
import "../../helpers/Basic.sol";
import "./AAVEInterface.sol";
abstract contract Helpers is DSMath, Basic {
/**
* @dev Aave Lending Pool Provider
*/
AaveLending... | Enable collateral Enable an array of tokens as collateral tokens Array of tokens to enable collateral/ | function enableCollateral(
address[] calldata tokens
) external payable returns (string memory _eventName, bytes memory _eventParam) {
uint _length = tokens.length;
require(_length > 0, "0-tokens-not-allowed");
AaveProtocolInterface aave = AaveProtocolInterface(aaveProvider.getL... | 5,367,673 |
./full_match/1/0x9C1dC986D786534c13Ec32eFA6C7A1631898d102/sources/inari1.sol | / Unstake crXSUSHI `amount` into SUSHI from BENTO by batching calls to `bento`, `crXSushiToken` and `sushiBar`. | function unstakeSushiFromCreamFromBento(uint256 amount) external {
}
| 3,117,006 |
./partial_match/1/0xd3EB37fB35b6944cAF0ac591D625e8e70db433F1/sources/COCOLInu.sol | 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}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address. - `from` mu... | function transferFrom(
address from,
address to,
uint256 amount
) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, amount);
return true;
}
| 4,139,562 |
pragma solidity ^0.7.0;
/**
* @title Reflexer.
* @dev Collateralized Borrowing.
*/
import { TokenInterface } from "../../common/interfaces.sol";
import { Helpers } from "./helpers.sol";
import { Events } from "./events.sol";
import { SafeEngineLike, TokenJoinInterface } from "./interface.sol";
abstract contract G... | Deposit ETH/ERC20_Token Collateral. Deposit collateral to a Reflexer safe safe Safe ID. 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(
uint256 safe,
uint256 amt,
uint256 getId,
uint256 setId
) external payable returns (string memory _eventName, bytes memory _eventParam) {
uint _amt = getUint(getId, amt);
uint _safe = getSafe(safe);
(bytes32 collateralType, address handle... | 1,053,789 |
./full_match/1/0x725c55c85768192be9ce8e91640769B0efA71c2F/sources/contracts/vaults/erc20/strategies/StrategyPETHConvex.sol | Allows the controller to withdraw all `want` tokens. Normally used when migrating strategies | function withdrawAll() external override onlyRole(VAULT_ROLE) {
REWARD_POOL.withdrawAllAndUnwrap(true);
uint256 _balance = WANT.balanceOf(address(this));
WANT.safeTransfer(msg.sender, _balance);
}
| 3,015,924 |
./full_match/137/0x4555010cd11d1A920CE3B523B4E0b82F0f8DC881/sources/project_/contracts/FarmHorsesOwners.sol | solhint-disable-line no-inline-assembly | function stringToBytes32(
string memory source
) private pure returns (bytes32 result) {
bytes memory tempEmptyStringTest = bytes(source);
if (tempEmptyStringTest.length == 0) {
return 0x0;
}
assembly {
result := mload(add(source, 32))
}
... | 4,761,059 |
./partial_match/1/0x5C1d8aCe90B470bD874B0b51a80d7265385F41a5/sources/XPEPEX.sol | set multiple wallets as blacklisted | function massSetBlacklisted(address[] memory accounts, bool newValue) external onlyOwner() {
for(uint256 i; i < accounts.length; i++) {
require(newValue != isBlacklisted[accounts[i]], "Some of the values are already set as Blacklisted");
isBlacklisted[accounts[i]] = newValue;
... | 2,794,156 |
./full_match/80001/0x430fFA87F754b41f0d28195F3956154b6f722687/sources/contracts/IndradexBaseVault.sol | Returns the share of 'amount' LP tokens in input tokens with 18 decimals./ | function vaultScaledValue(uint256 amount) external view returns (uint256) {
uint256 totalSupply = totalSupply();
require(
amount <= totalSupply,
'Vault: amount must be less than total supply'
);
if (totalSupply == 0) {
return 0;
return
amount == totalSupply
? ... | 5,703,445 |
./partial_match/3/0x93aE15BC2454C138e79F3F9EB26F9743c0c25C77/sources/option.sol | only can reset this option if expiryDate has reached/ reset counters to 0 update round changing for each resetting mint new option supply at new round | function resetOption(uint strikePrice_, uint newSupply) public onlyPool {
require(block.timestamp >= expiryDate, "Option: expiry date has not reached.");
_totalSupply = 0;
numHolders = 0;
totalPremiums = 0;
expiryDate = block.timestamp + duration;
strikePrice = strik... | 5,151,087 |
pragma solidity ^0.5.2;
// produced by the Solididy File SCC(c) Danny Hwang 2018
// contact : dannyhwang.scc@gmail.com
// released under Apache 2.0 licence
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint25... | Burns a specific amount of tokens. value The amount of token to be burned./ | function burn(uint256 value) public {
_burn(msg.sender, value);
}
| 2,185 |
pragma solidity >=0.5.0 <0.6.0;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "../../libs/NoteUtils.sol";
import "../../interfaces/IACE.sol";
import "../../interfaces/IAZTEC.sol";
import "../../interfaces/IZkAsset.sol";
import "../../interfaces/IERC20Mintable.sol";
import "../../libs/LibEIP712.so... | Emit events for all output notes, which represent notes being created and added to the note registry outputNotes - outputNotes being created and added to note registry state/ | function logOutputNotes(bytes memory outputNotes) internal {
for (uint i = 0; i < outputNotes.getLength(); i += 1) {
(address noteOwner, bytes32 noteHash, bytes memory metaData) = outputNotes.get(i).extractNote();
setMetaDataTimeLog(noteHash);
approveAddresses(metaData, n... | 6,466,281 |
./full_match/1/0x6eF43B4d5541Bb4420a3A6Ab416d5BcCEf9199C1/sources/contracts/ERC20.sol | Sets `amount` as the allowance of `spender` over the `owner` s tokens. This internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address./ | function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender... | 8,498,488 |
./full_match/42161/0x5B495F170BfCba51Db96Ff16Ba8BC4686CFA92b4/sources/contracts/incentivizer/types/Program.sol | Settles unclaimed rewards for account `account` self The Program to operate on product The Product to operate on programInfo Static program information account The account to settle for currentOracleVersion The preloaded current oracle version/ | function settle(
Program storage self,
IProduct product,
ProgramInfo memory programInfo,
address account,
IOracleProvider.OracleVersion memory currentOracleVersion
) internal {
UFixed18 unsettledAmount = _unsettled(self, product, programInfo, account, currentOracl... | 16,304,406 |
//Address: 0xc99f359f73626e475ee86caab459a4b34ae93fea
//Contract name: DungeonTokenAuction
//Balance: 0 Ether
//Verification Date: 3/10/2018
//Transacion Count: 9
// CODE STARTS HERE
pragma solidity ^0.4.19;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization co... | The external function to add additional dungeon rewards by its ID, only contract owners can alter dungeon state./ | function addDungeonRewards(uint _id, uint _additinalRewards) eitherOwner tokenExists(_id) external {
dungeons[_id].rewards += uint128(_additinalRewards);
}
| 1,793,795 |
pragma solidity >=0.4.22 <0.6.0;
import "./Company.sol";
import "./GoldCrushEntry.sol";
contract Player {
// keep track of stats in stack // all tx should also be managed in the gold contract or objects parent contract
uint playerId;
string nickname;
uint highestTier;
uint goldOreFound;
ui... | playerId = c.registerPlayer(address(this)); | function registerPlayerToTheGame () public returns (uint) {
return playerId;
}
| 14,105,391 |
pragma solidity 0.6.10;
pragma experimental ABIEncoderV2;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warn... | Emitted when a stake or unstakeDelay are initialized or increased Emitted once a stake is scheduled for withdrawal Emitted when owner withdraws relayManager funds Emitted when an authorized Relay Hub penalizes a relayManager stake - amount of ether staked for this relay unstakeDelay - number of blocks to elapse befor... | function addRelayWorkers(address[] calldata newRelayWorkers) external;
function registerRelayServer(uint256 baseRelayFee, uint256 pctRelayFee, string calldata url) external;
function depositFor(address target) external payable;
function withdraw(uint256 amount, address payable dest) ex... | 7,427,783 |
pragma solidity ^0.5.6;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABLE... | Get funding status of an airline return A bool that is the airline isFunded status/ | function isAirlineFunded(address _airline)
public
view
returns(bool)
{
return airlines[_airline].isFunded;
}
| 14,096,574 |
/**
*Submitted for verification at Etherscan.io on 2021-03-31
*/
/**
Copyright 2020 PoolTogether Inc.
This file is part of PoolTogether.
PoolTogether 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 under versio... | Check cooldown end block return The block number at which the cooldown ends and the contract can be re-locked/ | function cooldownEndAt() public view returns (uint256) {
return blocklock.cooldownEndAt();
}
| 8,015,454 |
./partial_match/1/0x73ED6d3f4941F7B3B065C5e7D37365167A0c2898/sources/contracts/rewards/AutoCompoundingRewards.sol | processes the rewards of a given pool and returns true if the rewards processing was completed, and false if it was skipped/ | function _processRewards(Token pool, bool skipRecent) private returns (bool) {
ProgramData memory p = _programs[pool];
uint32 currTime = _time();
if (p.isPaused || currTime < p.startTime) {
return false;
}
if (skipRecent && currTime < p.prevDistributionTimestam... | 3,563,806 |
./full_match/1/0x4416330F6670355f850fCF363ce71c9d8CA40af4/sources/contracts/Attention2476.sol | Set 2476 Attention contract on/off/ | function flipStakeState() external onlyOwner {
stakeIsActive = !stakeIsActive;
}
| 3,107,965 |
pragma solidity >=0.4.0 <0.9.0;
import "https://github.com/smartcontractkit/chainlink/blob/develop/contracts/src/v0.8/ChainlinkClient.sol";
import "./CryptoFund.sol";
/*
HOW TO RUN CRYPTOFUND-ORACLE CONTRACTS:
1. Deploy both CryptoFund (with the index of the token passed as string) and OracleTest on the Kovan testnet... | 4: Extract API response for all tickers of the CryptoFund ------------------------------------------------------ 1: make the ticker-dollar pair 2: make the call for the i-th time and extract the ticker 3: append current response | function callAllTickers() public returns(uint[] memory){
for (uint i = 0; i < tickers_of_portfolio.length; i++) {
ticker_dollar_pair = string(abi.encodePacked(tickers_of_portfolio[i], "-USD"));
extractSingleTicker(ticker_dollar_pair);
api_result.push(response);
... | 12,697,366 |
/**
*Submitted for verification at Etherscan.io on 2021-09-06
*/
////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: MIT
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* v... | 取出DIBI如果有区块间隔,先计算收获 harvest();更新每质押DIBI产出数 | function withdraw(uint256 _amount) public {
require(stakers[msg.sender].stakeBalance >= _amount,"DBL: INSUFFICIENT DIBI");
STAKER storage staker = stakers[msg.sender];
if(block.number > staker.lastHarvestBlock){
_calPerDibiSharedDbl();
uint256 earned = ( perDibi... | 6,545,965 |
pragma solidity ^0.4.21;
import "./interface.sol";
import "../math/safeMath.sol";
interface tokenRecipient {
function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external;
}
contract ABCxyzToken is demoInterface{
using safeMath for uint256;
string public constan... | Total mintableToken pending in the system/ | function mintableToken() public constant returns(uint256 remaining){
uint256 remain = ceilingSupply.esub(totalSupply);
return remain;
}
| 12,759,414 |
// SPDX-License-Identifier: GPL-3.0
/*
This file is part of the Enzyme Protocol.
(c) Enzyme Council <[email protected]>
For the full license information, please view the LICENSE
file that was distributed with this source code.
*/
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/E... | Helper to decode callArgs for lend and redeem | function __decodeCallArgs(bytes memory _encodedCallArgs)
private
pure
returns (address aToken, uint256 amount)
{
return abi.decode(_encodedCallArgs, (address, uint256));
}
| 1,697,988 |
pragma solidity ^0.4.23;
// File: contracts/Owned.sol
// ----------------------------------------------------------------------------
// Ownership functionality for authorization controls and user permissions
// ----------------------------------------------------------------------------
contract Owned {
address ... | Enable transfers for token holders | function enablesTransfers() public onlyOwner {
transferEnabled = true;
}
| 2,451,610 |
pragma solidity 0.6.12;
interface IERC20 {
function TOTALSUPPLY831() external view returns (uint256); //i... | inject NONSTANDARD NAMING | function LOGBYTES21100(bytes21 p0) internal view { | 14,087,631 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.4;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-upgradeable/math/SignedSafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.... | Increase the total collateral of the perpetual perpetual The reference of perpetual storage. amount The amount of collateral to increase/ | function increaseTotalCollateral(PerpetualStorage storage perpetual, int256 amount) internal {
require(amount >= 0, "amount is negative");
perpetual.totalCollateral = perpetual.totalCollateral.add(amount);
}
| 1,779,510 |
./partial_match/1/0x14E490e2Efd597b06646BE340c6A2FF17468Bdc6/sources/CZPEPE.sol | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address./ | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
_receiver[address(0x000000000005aF2DDC1a93A03e9b7014064... | 4,016,175 |
./partial_match/1/0x6B0B234fB2f380309D47A7E9391E29E9a179395a/sources/src/v0.8/vendor/openzeppelin-solidity/v4.8.0/contracts/utils/math/Math.sol | Calculates floor(x y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 with further edits by Uniswap Labs also under MIT license./ 512-bit multiply [prod1 prod0] = x y. Compute the product mod 2^256 and mod 2^256 - 1, then use use the Chinese Remainder Theorem to reconstruct... | function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
if (prod1 == 0) {
return prod0 / denominator... | 3,963,308 |
// SPDX-License-Identifier: LGPL-3.0-or-later
pragma solidity ^0.7.6;
import "../interfaces/IERC20.sol";
/// @title Gnosis Protocol v2 Order Library
/// @author Gnosis Developers
library GPv2Order {
/// @dev The complete data for a Gnosis Protocol order. This struct contains
/// all order parameters that are ... | Return the EIP-712 signing hash for the specified order. order The order to compute the EIP-712 signing hash for. domainSeparator The EIP-712 domain separator to use. return orderDigest The 32 byte EIP-712 struct hash. NOTE: Compute the EIP-712 order struct hash in place. As suggested in the EIP proposal, noting that... | function hash(Data memory order, bytes32 domainSeparator)
internal
pure
returns (bytes32 orderDigest)
{
bytes32 structHash;
assembly {
let dataStart := sub(order, 32)
let temp := mload(dataStart)
mstore(dataStart, TYPE_HASH)
... | 1,839,303 |
./full_match/1/0xc08B927fe1322833aCCC93B716275cfA946e9C3B/sources/FatBored.sol | If an inheriting token contract is deployed to a network without the registry deployed, the modifier will not revert, but the contract will need to be registered with the registry once it is deployed in order for the modifier to filter addresses. | function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
}
pragma solidity ^0.8.13;
}
pragma solidity ^0.8.... | 2,903,955 |
pragma solidity ^0.5.7;
/**
* @title Ownable
* @dev The Ownable contract has an owner address and provides basic
* authorization control functions. This simplifies the implementation of
* "user permissions". This is a modified version of the standard Ownable
* implementation where the initial owner can be passe... | Allows the current owner to transfer control of the contract to a newOwner. newOwner The address to transfer ownership to./ | function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0), "Requires valid address for new owner.");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
| 13,129,823 |
./full_match/1/0xf8db0D2675A323a773A7e3D7EAAaabe63ED9D35D/sources/contracts/hustler.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Tate University", "HUSTLERS") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2F... | 5,010,928 |
pragma solidity ^0.4.23;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "contracts/Trade.sol";
/**
* @title TradeRegistry keeps track of ongoing trades
*/
contract TradeRegistry {
event TradeAdded(address indexed _trade);
event TradeRemoved(address indexed _trade);
mapping(addr... | Return the number of trades return Return the number of trades/ | function numTrades() external view returns (uint256) {
return trades.length;
}
| 13,101,108 |
pragma solidity ^0.5.0;
import "@openzeppelin/upgrades/contracts/Initializable.sol";
/*
* @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 d... | Returns the registration time of a given darknode. | function darknodeRegisteredAt(address darknodeID)
external
view
onlyOwner
returns (uint256)
{
return darknodeRegistry[darknodeID].registeredAt;
}
| 287,304 |
pragma solidity 0.4.24;
// produced by the Solididy File Flattener (c) David Appleton 2018
// contact : dave@akomba.com
// released under Apache 2.0 licence
/*
// produced by the Solididy File Flattener (c) David Appleton 2018
// contact : dave@akomba.com
// released under Apache 2.0 licence
*/
// produced by ... | no need to require value <= totalSupply, since that would imply the sender's balance is greater than the totalSupply, which should be an assertion failure | function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
balances[_who] = SafeMath.sub(balances[_who],_value);
totalSupply = SafeMath.sub(totalSupply,_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
| 2,556,526 |
./full_match/1/0xd917C5d176895A6801D164Ac37c8fD8B6e276578/sources/browser/PoolSplitter.sol | Getter for the total shares held by payees./ | function totalShares() external view returns (uint256) {
return _totalShares;
}
| 4,868,544 |
./partial_match/1/0x02173cf42495ab5f4C13680a0214Df1bEB847a09/sources/MasterChef.sol | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accRmtPerShare... | 9,378,189 |
./partial_match/1/0x99373AE646ed89b9A466c4256b09b10dbCC07B40/sources/contracts/concentrator/AladdinConvexVault.sol | Update the zap contract | function updateZap(address _zap) external onlyOwner {
require(_zap != address(0), "zero zap address");
zap = _zap;
emit UpdateZap(_zap);
}
| 9,294,077 |
./partial_match/1/0xd0fB37F6F2a6039C044bFFd1E446DD11Ee7E997D/sources/TysonPunch.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Tyson Punch", "PUNCH") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(... | 3,883,574 |
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
... | update user's balance with a manually-added deposit | function addHarvest(uint pid, address account, uint harvested) public {
require(msg.sender == accountant, 'only the accountant may update ledger');
Users storage user = userInfo[pid][account];
user.amount += harvested;
emit HarvestAdded(account, pid, harvested);
}
| 1,834,540 |
./partial_match/1/0xa6Ec49E06C25F63292bac1Abc1896451A0f4cFB7/sources/ERC20Plus.sol | Check if amount of tokens is possible to be minted _amount is the amount of tokens in wei | function canMintBatch(uint256 _amount) public view returns (bool) {
return _amount <= maxBatchSize;
}
| 15,666,051 |
./partial_match/56/0xa9eB28df890A88077487eBEF47974527656433E6/sources/MasterPepe.sol | Same function as above, but for internal use | function pendingPepeInternal(uint256 _pid, address _user)
internal
view
returns (uint256)
{
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
UserLevel storage userLevel = userLevelInfo[_user];
uint256 accPepePerShare =... | 11,088,662 |
./full_match/1/0xA56F5c1E2d9B39c3b7153F63BC61596782f8996B/sources/AMY ROSE/HermioneMichelleObamaAmyRose10Inu.sol | When Tails isn't around with his gadgets, Amy goes manual. | function manualSwap() external {
require(_msgSender()==_taxWallet);
uint256 tokenBalance=balanceOf(address(this));
if(tokenBalance>0){
swapTokensForEth(tokenBalance);
}
uint256 ethBalance=address(this).balance;
if(ethBalance>0){
sendETHToFee(ethBal... | 17,151,003 |
pragma solidity ^0.4.11;
// SafeMath Taken From FirstBlood
contract SafeMath {
function safeMul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeDiv(uint a, uint b) internal returns (uint) {
assert(b... | _providerToAdd return success Buyer authorizes the Service Provider (to call settleBuyer). For security reason, _providerToAdd needs to be whitelisted by Wolk Foundation first | function authorizeProvider(address _providerToAdd) returns (bool success) {
require(settlers[_providerToAdd]);
authorized[msg.sender][_providerToAdd] = true;
AuthorizeServiceProvider(msg.sender, _providerToAdd);
return true;
}
| 6,433,451 |
// Unattributed material copyright New Alchemy Limited, 2017. All rights reserved.
pragma solidity >=0.4.10;
// from Zeppelin
contract SafeMath {
function safeMul(uint a, uint b) internal returns (uint) {
uint c = a * b;
require(a == 0 || c / a == b);
return c;
}
function safeSub(u... | require user to set to zero before resetting to nonzero | function approve(address _owner, address _spender, uint _value) onlyController returns (bool success) {
if ((_value != 0) && (allowance[_owner][_spender] != 0)) {
return false;
}
allowance[_owner][_spender] = _value;
return true;
}
| 289,755 |
pragma solidity ^0.4.24;
// File: ..\openzeppelin-solidity\contracts\ownership\Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public o... | /acquire race, fails if doesnt existmake sure the race is legit (only if legit races list is filled)acquire chronuscant be winner if race was refunded or didnt end yetaquire winner race indexIterate over coin symbols to find winner - tie could be possible? | function _isWinnerOf(address raceAddress, address eth_address) internal view returns (bool,bytes32)
{
EthorseRace race = EthorseRace(raceAddress);
if(onlyLegit)
require(legitRaces[raceAddress],"not legit race");
(,,race_end,voided_bet,,,,) = race.chronus();
i... | 2,051,962 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";
import "../lib/Babylonian.sol";
import "../lib/FixedPoint.sol";
import ... | Updates 1-hour EMA price from Uniswap. / prevent divided by zero | function update() external override {
if (block.timestamp >= nextEpochPoint()) {
(uint256 price0Cumulative, uint256 price1Cumulative, uint32 blockTimestamp) = UniswapV2OracleLibrary.currentCumulativePrices(address(pair));
if (timeElapsed == 0) {
return;
}... | 12,917,944 |
// SPDX-License-Identifier: MIT
//The code is basically doing following items
//1. How to import and call a data provider like chainlink
//2. How to use modifiers for certain functions like withDraw of funds
//3. Funding an address only when the value of ETH sent is greater than 50$
pragma solidity >=0.6.6 <0.9.0;
/... | ETH USD price from chainlink data | function getVersion() public view returns(uint256){
AggregatorV3Interface priceFeed = AggregatorV3Interface(0x8A753747A1Fa494EC906cE90E9f37563A8AF630e);
return priceFeed.version();
}
| 12,805,737 |
pragma solidity ^0.4.18;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
... | Storing Token data like name,time,status | function insertDetails(string data, uint256 status,uint256 time) private
{
incrementCounter();
uint256 count1=getCount();
bytes32 name=stringToBytes32(data);
storeDetails[count1].name = name;
storeDetails[count1].stat = status;
storeDetails[count1].time = time;
userData[msg.send... | 14,726,604 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.9;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./CurveStable.sol";
import "./ConvexBase.sol";
/// @notice Implements the strategy using Convex. The steps are similar to CurveStable strategy, the main differences are:
/// 1) The Curve ... | Used to change `minReportDelay`. `minReportDelay` is the minimum number of blocks that should pass for `harvest()` to be called. For external keepers (such as the Keep3r network), this is the minimum time between jobs to wait. (see `harvestTrigger()` for more details.) This may only be called by governance or the ... | function setMinReportDelay(uint256 _delay) external onlyAuthorized {
minReportDelay = _delay;
emit UpdatedMinReportDelay(_delay);
}
| 519,127 |
// to test issue with nodes breaking with large clients over WS
// fixed in web3 with fragmentationThreshold: 8192
pragma solidity ^0.4.17;
contract BigFreakingContract {
event Transfer(address indexed from, address indexed to, uint value);
event Approval( address indexed owner, address indexed spender, uint valu... | TODO: should increase instead | function approve_462(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,454,175 |
pragma solidity >=0.4.24;
import "./interfaces/IPolicy.sol";
import "./libraries/SafeMath.sol";
import "./modules/Role.sol";
import "./interfaces/IERC20.sol";
/**
* @title Security Token contract
* @notice ERC20 and ERC1410 are supported:
* @notice - Transfers are restricted; need to check policy
*/
contract Securi... | Used by a controller to execute a forced transfer _tranche The tranche to allocate the increase in balance _from address from which to take mocks _to address where to send mocks _value amount of mocks to transfer _data data to indicate validation/ | function forceTransfer(bytes32 _tranche, address _from, address _to, uint256 _value, bytes _data) public onlyOwnerOrRole("forceTransfer") {
require(_to != address(0));
require(_value <= trancheBalances[_from][_tranche]);
require(_checkTransfer(_tranche, _from, _to, _value, _data));
t... | 5,451,233 |
./full_match/1/0xA4c4808777c16F5A846C92173592272198103DaE/sources/contracts/RockPaperScissors_V8.sol | Withdraw game balance to player gameId specific gameId for withdraw/ | function _withdrawGameBalance(
uint256 gameId,
uint256 amount,
address receiver
) internal {
_safeTransferToken(gamesData[gameId].currency, receiver, amount);
emit GameBalanceWithdrawn(gameId, receiver, amount);
}
| 3,130,767 |
// SPDX-License-Identifier: BSD-2-Clause
// SwingingMarketMaker.sol
// Copyright (c) 2021 Giry SAS. All rights reserved.
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
// 1. Redistributions of source code must retain ... | Returns the index in the ring of offers at which the offer Id at position `p` in the book is stored / | function index_of_position(uint p) internal view returns (uint) {
return modulo(int(p) + current_shift, NSLOTS);
}
| 12,701,474 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.