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.5.0;
import "./library/EIP20.sol";
import "./library/SafeMath.sol";
import "./library/Division.sol";
import "./library/Ownable.sol";
/**
@title Bonded Curve Implementation of an ERC20 token
@author Team: Jessica Marshall, Ashoka Finley
@notice This contract implements functionality to be controlled... | Unfreezes the hypha token contract and allows existing token holders to withdraw tokens/ | function unfreezeContract() external onlyOwner {
freeze = false;
}
| 12,783,491 |
//Address: 0x2998328a3a0c95b6beb64c694b6b60aba386cf98
//Contract name: YRXCrowdsale
//Balance: 0 Ether
//Verification Date: 1/9/2018
//Transacion Count: 13
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
fun... | ------------------------------------------------- Adds to balance ------------------------------------------------- | function addToBalance(address _address, uint _amount) internal {
balances[_address] = balances[_address].add(_amount);
}
| 14,101,250 |
./full_match/5/0xEf8F1fe8918eB5BB70853F2dF2cAC85626d6FB56/sources/project_/contracts/base/modules/Whitelist.sol | (1) Checks if the address is in the whitelist. _address Address to be checked _merkleProof Merkle proof/ | function isInWhitelist(address _address, bytes32[] calldata _merkleProof)
public
view
returns (bool)
{
bytes32 leaf = keccak256(abi.encode(_address));
return MerkleProof.verifyCalldata(_merkleProof, merkleRoot, leaf);
}
| 7,035,598 |
./partial_match/61/0x59E34EF31049565D041Aec6137F40f518c2D47c1/sources/contracts/MyToken.sol | Return the total supply of NFTReturn the corresponding ‘tokenId’ through ‘_index’Return the ‘tokenId’ corresponding to the index in the NFT list owned by the ‘_owner' | interface IERC721Enumerable {
function totalSupply() external view returns (uint256);
function tokenByIndex(uint256 _index) external view returns (uint256);
function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256);
}
| 16,910,540 |
./partial_match/1/0x9781C4E9B9cc6Ac18405891DF20Ad3566FB6B301/sources/SavingsManager.sol | Calculates unclaimed rewards from the liquidation stream _mAsset mAsset key _previousCollection Time of previous collection return Units of mAsset that have been unlocked for distribution/ | function _unclaimedRewards(address _mAsset, uint256 _previousCollection) internal view returns (uint256) {
Stream memory liq = liqStream[_mAsset];
uint256 unclaimedSeconds_liq = _unclaimedSeconds(_previousCollection, liq.end);
uint256 subtotal_liq = unclaimedSeconds_liq.mul(liq.rate);
... | 16,112,400 |
// File: @openzeppelin/contracts/utils/Counters.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
* of elements in a mapping, issu... | Withdraw ether from contract | function withdraw() public onlyOwner {
require(address(this).balance > 0, "Balance must be positive");
require(success == true, "Failed to withdraw ether");
}
| 553,234 |
// File: contracts/Ownable.sol
pragma solidity >0.4.0 <0.6.0;
contract Ownable {
address payable public owner;
constructor () public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address payable newOwner) external onlyOwne... | this function should be called should we ever want to change the underlying Fulcrum Long ETHContract address | function set_Invest2Fulcrum2xLong_BTCContract (Invest2Fulcrum2xLongBTC _Invest2Fulcrum2xLong_BTCContract) onlyOwner public {
Invest2Fulcrum2xLong_BTCContract = _Invest2Fulcrum2xLong_BTCContract;
}
| 12,846,932 |
pragma solidity 0.5.0;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
/**
* @title Debts Package.
* @notice Package of debts tokens to be sold on a time auction.
* @author Anibal Catalán <anibalcatalanf@gmail.com>.
*/
contract Packag... | Package owner can collect the debt tokens. token Helps to identify the debt token to be collect./ | function collectToken(address token) public {
require(auctionTimeFinished > 0, "auction is not successfully finished");
require(msg.sender == owner, "caller is not the owner");
uint256 amount = IERC20(token).balanceOf(address(this));
tokenAmount[token] = 0;
tokenBalance = t... | 1,070,970 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Global Enums and Structs
struct PoolInfo {
IERC20 lpToken; // Address of LP token contract.
uint256 allocPoint; // How many allocation points assigned to this pool. TOKENs to distribute per bloc... | Sweep all STN to owner | function sweep(uint256 _amount) external onlyOwner {
token.safeTransfer(owner(), _amount);
}
| 5,794,865 |
./full_match/3/0x103E9df0BF772478b0031F57C424CD856B34EDa9/sources/demo2.sol | Safely mints `tokenId` and transfers it to `to`. Requirements: - `tokenId` must not exist. - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event./ | function _safeMint(address to, address brain, uint256 tokenId) internal virtual {
_safeMint(to, brain, tokenId, "");
}
| 14,157,439 |
pragma solidity >=0.4.24 <0.7.0;
import "./SafeMath.sol";
import "../node_modules/@chainlink/contracts/src/v0.5/ChainlinkClient.sol";
contract Ticketh is ChainlinkClient {
using SafeMath for uint256;
uint256 oraclePrice;
bytes32 jobId;
address oracleAddress;
struct Lottery {
uint256 lott... | Ticketh information functions. | function getPlayers(uint256 lotteryId)
public
view
returns (address payable[] memory)
{
return lotteries[lotteryId].participatingPlayers;
}
| 6,449,662 |
./full_match/42/0x9e05606a5c4cdbc38D5468e197A8A7bf47263252/sources/stakingOliver/uniswaprouter.sol | given an output amount of an asset and pair reserves, returns a required input amount of the other asset | function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut, bool status) internal pure returns (uint amountIn) {
require(amountOut > 0, 'UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
uint256 fee... | 16,241,518 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.6;
// Part: CryptoTraderInterface
interface CryptoTraderInterface {
/**
* Returns a uri for CryptTraderI (BTC) tokens
*/
function btcTokenURI() external view returns (string memory);
/**
* Returns a uri for CryptTraderII (ETH) tokens
... | getRoundData and latestRoundData should both raise "No data present" if they do not have data to report, instead of returning unset values which could be misinterpreted as actual reported values. | interface AggregatorV3Interface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
function getRoundData(uint80 _roundId)
external
view
returns (
uint80 roundId,
int256 a... | 5,884,025 |
./partial_match/42/0x4E951A6FB550c0eab2615619253900B2Dbc5F363/sources/STYK_I.sol | To check the user's status | function _checkUserActiveStatus(address _user)internal view returns(bool){
if(balanceOf(_user) > safeMul(10,1e18)){
return true;
}
else{
return false;
}
}
... | 3,304,703 |
pragma solidity ^0.5.0;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimiz... | Pack and hash Check if certificate match expected transactions parameters | payload[i] = functionID[i];
}
}
bytes memory pack = abi.encodePacked(
msg.sender,
this,
amount,
payload,
e,
salt
);
bytes32 hash = keccak256(pack);
if (_certificateSigners[ecrecover(hash, v, r, s)] && !_usedCertificate[sal... | 14,347,707 |
pragma solidity ^0.4.23;
import "./Bytes.sol";
import "../base/math/SafeMath.sol";
import "../base/math/SafeMathInt.sol";
import "../base/math/SafeMathUint8.sol";
/**
* @title Request Signature util library.
* @notice Collection of utility functions to handle Request signatures.
*/
library Signature {
using S... | Calculates the Keccak-256 hash of a BTC request with specified parameters. requestData bytes containing all the data packed payeesPaymentAddress array of payees payment addresses expirationDate timestamp after what the signed request cannot be broadcasted return Keccak-256 hash of (this, requestData, payeesPaymentAd... | function getBtcRequestHash(
bytes requestData,
bytes payeesPaymentAddress,
uint256 expirationDate)
private
view
returns(bytes32)
{
return keccak256(
abi.encodePacked(
this,
requestData,
payees... | 5,449,848 |
./partial_match/42/0x786fdD0A822490D62Db2bA65EEBa8cd684968FF7/sources/BatterseaScriptsV1.sol | Wraps ETH into WETH, deposits and locks collateral into the BalanceSheet contract and draws debt via the FyToken contract. This is a payable function so it can receive ETH transfers. balanceSheet The address of the BalanceSheet contract. fyToken The address of the FyToken contract. collateralAmount The amount of co... | function wrapEthAndDepositAndLockCollateral(
BalanceSheetInterface balanceSheet,
FyTokenInterface fyToken,
uint256 collateralAmount
) public payable {
wrapEthAndDepositCollateral(balanceSheet, fyToken, collateralAmount);
balanceSheet.lockCollateral(fyToken, collateralAmou... | 3,354,877 |
pragma solidity ^0.8.4;
// SPDX-License-Identifier: GPL-3.0-or-later
import "@openzeppelin/contracts/access/Ownable.sol";
import "./TempleERC20Token.sol";
import "./ExitQueue.sol";
import "./TempleStaking.sol";
// import "hardhat/console.sol";
/**
* An accelerated exit queue so we can speed up price discovery whil... | Disable's by resetting the exit queue owner to the owner of this contract/ | function disableAcceleratedExitQueue() external onlyOwner {
exitQueue.transferOwnership(owner());
}
| 6,165,797 |
./full_match/137/0x3E1AF9Ea975cb30aA622E478D96aDB642c2cdf8E/sources/contracts/vault/MultiVault.sol | in case a token is duplicated, only one transfer is required, hence the check | function unlock(bytes memory data) external onlyKeyHolder onlyUnlockable {
require(!isUnlocked, "MultiVault:unlock:ALREADY_OPEN: Vault has already been unlocked");
for (uint256 i = 0; i < fungibleTokenDeposits.length; i++) {
IERC20 token = IERC20(fungibleTokenDeposits[i].tokenAddress);
... | 4,718,237 |
pragma solidity ^0.8.4;
//SPDX-License-Identifier: MIT
import {ERC721, ERC721TokenReceiver} from "@rari-capital/solmate/src/tokens/ERC721.sol";
import {ERC1155, ERC1155TokenReceiver} from "@rari-capital/solmate/src/tokens/ERC1155.sol";
import {SafeTransferLib, ERC20} from "@rari-capital/solmate/src/utils/SafeTransferL... | same as inspired from @openzeppelin/contracts/utils/Strings.sol except that it doesn't add "0x" as prefix. | function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length);
for (uint256 i = 2 * length; i > 0; --i) {
buffer[i - 1] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "... | 1,065,495 |
/**
*Submitted for verification at Etherscan.io on 2021-04-03
*/
// SPDX-License-Identifier: BUSL-1.1
// File: @openzeppelin/contracts/utils/EnumerableSet.sol
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
... | calculate fee from rFactorInPrecision, see section 3.2 in dmmSwap white paper fee in [15, 60] bps return fee percentage in Precision C1 + A (r-U)^3 + b (r -U) | function getFee(uint256 rFactorInPrecision) internal pure returns (uint256) {
if (rFactorInPrecision >= R0) {
return C0;
if (rFactorInPrecision > U) {
uint256 tmp = rFactorInPrecision - U;
uint256 tmp3 = tmp.unsafePowInPrecision(3);
ret... | 2,135,851 |
./partial_match/40/0xc61A42a16C3FCB89bA5fdCC92BF2FB377D00719d/sources/contracts/TelosNFT.sol | toggles the state of mint | function setMintingState(MintState state) external onlyOwner {
mintingState = state;
}
| 8,827,663 |
pragma solidity ^0.4.23;
import "./Authentication.sol";
/// @title A decentralized organization with members, tasks, and voting.
/// @author Dennis Liu
contract DAO is Authentication {
using SafeMath for uint256;
// type for a single task
struct Task {
uint taskId;
address proposer; // addres... | Return voted members for a task after its voting is finished This prevents member's votes being influenced by existing votes taskId index of the task in tasks array return voted member addresses in an array | function getVoted(uint taskId) public view taskExists(taskId) onlyExistingMember returns (address[]) {
require(tasks[taskId].finished, "Voting on this task has not finished");
return votedList[taskId];
}
| 5,433,986 |
pragma solidity 0.6.8;
// This file is MIT Licensed.
//
// Copyright 2017 Christian Reitwiessner
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitati... | return the product of a point on G1 and a scalar/ 0x07 id of precompiled bn256ScalarMul contract 0 since we have an array of fixed length, our input starts in 0 96 size of call parameters, i.e. 96 bytes total (256 bit for x, 256 bit for y, 256 bit for scalar) 64 size of call return value, i.e. 64... | function scalarMult(G1Point memory p, uint256 s) internal view returns (G1Point memory) {
uint256[3] memory input;
input[0] = p.x;
input[1] = p.y;
input[2] = s;
bool success;
G1Point memory result;
assembly {
success := staticcall(not(0), 0x07, inp... | 15,814,033 |
/**
*Submitted for verification at Etherscan.io on 2020-10-21
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.6;
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
/**
* @dev Wrappers over Solidity's arithmetic operations with a... | Unbond liquidity for a pending keeper job liquidity the pair being unbound job the job being unbound from amount the amount of liquidity being removed/ | function unbondLiquidityFromJob(address liquidity, address job, uint amount) external {
require(liquidityAmount[msg.sender][liquidity][job] == 0, "Keep3r::credit: pending credit, settle first");
liquidityUnbonding[msg.sender][liquidity][job] = now.add(UNBOND);
liquidityAmountsUnbonding[msg.s... | 603,480 |
/**
*Submitted for verification at Etherscan.io on 2021-10-08
*/
/**
*Submitted for verification at Etherscan.io on 2020-05-26
*/
pragma solidity ^0.4.24;
// <ORACLIZE_API>
/*
Copyright (c) 2015-2016 Oraclize SRL
Copyright (c) 2016 Oraclize LTD
Permission is hereby granted, free of charge, to any person obtaini... | public function in case of a failed refund or win send/ external call to untrusted contract / | function playerWithdrawPendingTransactions() public
payoutsAreActive
returns (bool)
{
uint withdrawAmount = playerPendingWithdrawals[msg.sender];
playerPendingWithdrawals[msg.sender] = 0;
if (msg.sender.call.value(withdrawAmount)()) {
return true;
... | 6,815,911 |
./full_match/97/0x001079B961fE0873E47c20d704E13Fb2c3Ea7cc7/sources/project_/contracts/UGRTokenFactory.sol | devolver el precio que vale crear el token con BNB | function getDeployPriceBNB() external view returns(uint256){ | 5,045,334 |
pragma solidity ^0.4.11;
contract DoNotDeployThisGetTheRightOneCosParityPutsThisOnTop {
uint256 nothing;
function DoNotDeployThisGetTheRightOneCosParityPutsThisOnTop() {
nothing = 27;
}
}
//*************** Ownable
contract Ownable {
address public owner;
function Ownable(... | Approve the account for operation / | function approve(address user) MustBeCs {
permissions[user].passedKYC = true;
}
| 1,011,406 |
pragma solidity ^0.4.21;
library strings {
struct slice {
uint _len;
uint _ptr;
}
/*
* @dev Returns a slice containing the entire string.
* @param self The string to make a slice from.
* @return A newly allocated slice containing the entire string.
*/
function... | Inc. for next resource | function createNewCSCResource(string _name, string _symbol, uint _initialSupply) public anyOperator {
require(resourceNameToAddress[stringToBytes32(_name)] == 0x0);
address resourceContract = new CSCResource(_name, _symbol, _initialSupply);
resourceIdToAddress[resourceTypeCount] ... | 6,662,301 |
/*
Copyright 2021 Set Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | Return 0xAPI calldata which is already generated from 0xAPI _sourceToken Address of source token to be sold _destinationToken Address of destination token to buy _destinationAddress Address that assets should be transferred to _sourceQuantity Amount of source token to sell ... | function getTradeCalldata(
address _sourceToken,
address _destinationToken,
address _destinationAddress,
uint256 _sourceQuantity,
uint256 _minDestinationQuantity,
bytes calldata _data
)
external
view
returns (address, uint256, bytes memory)... | 180,526 |
/*
What the F is this all about?
We are a clone simple as that.
But we differentiate in the way we pay our divs.
Safe for everybody. Anti Whale Dump.
- Buys - 15% fee goes to all current token holders.
- Sells - 15% fee to all current tokens holders. And it’s lower because you sh... | Retrieve the total token supply./ | function totalSupply()
public
view
returns(uint256)
{
return tokenSupply_;
}
| 4,809,674 |
// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.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... | A contract for managing reward tiers SparkleLoyalty Inc. (c) 2019-2020/ interface ISparkleRewardTiers is Ownable, Pausable, ReentrancyGuard { view onlyOwner whenNotPaused nonReentrant view onlyOwner whenNotPaused nonReentrant view onlyOwner whenNotPaused nonReentrant view whenNotPaused view whenNotPaused view whenNotP... | interface ISparkleRewardTiers {
function addTier(uint256 _index, uint256 _rate, uint256 _price, bool _enabled)
external
returns(bool);
function updateTier(uint256 _index, uint256 _rate, uint256 _price, bool _enabled)
external
returns(bool);
function deleteTier(uint256 _index)
external
returns(bool)... | 6,070,065 |
pragma solidity^0.5.0;
/// @title Thuto smart contract
/// @author Helda Mandlate
/// @dev import contracts from openzeppelin related to ownable and ERC20, ERC721 tokens
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721Metadata.sol";
import "@openzeppelin/co... | return get the lessons per owner _address of the account holder | function getLessonForAddress(address _address) public view returns(uint256[] memory) {
uint256 _userNumber = userAddresses[_address];
return requestOwners[_userNumber];
}
| 5,527,874 |
pragma solidity 0.4.24;
// File: ../../openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external... | Extends lock for a specified reason and time reason The reason to lock tokens time Lock extension time in seconds/ | function extendLock(bytes32 reason, uint256 time)
public
returns (bool)
{
require(tokensLocked(msg.sender, reason) > 0, NOT_LOCKED);
locked[msg.sender][reason].validity = locked[msg.sender][reason].validity.add(time);
emit Locked(msg.sender, reason, locked[msg.sender][r... | 936,972 |
pragma solidity ^0.4.17;
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) public... | Fallback function The function without name is the default function that is called whenever anyone sends funds to a contract/ | function () payable public {
require(!crowdsaleClosed);
uint256 rateAmount = getCurrentRate();
uint256 amount = msg.value;
balanceOf[msg.sender] += amount;
amountRaised += amount;
tokenReward.mint(msg.sender, amount / rateAmount);
tokenReward.mint(beneficiary,... | 1,027,230 |
./full_match/1/0xcafea112Db32436c2390F5EC988f3aDB96870627/sources/contracts/modules/capital/Pool.sol | If balanceOf reverts consider it 0 If the assetBalance is 0 skip the oracle call to save gas | function getAssetValueInEth(address assetAddress) internal view returns (uint) {
uint assetBalance;
if (assetAddress.code.length != 0) {
try IERC20(assetAddress).balanceOf(address(this)) returns (uint balance) {
assetBalance = balance;
}
}
if (assetBalance == 0) {
return 0... | 3,156,070 |
./partial_match/1/0xc6208602889a0A26c74B6e64a4C76Fb8b5d12569/sources/CumRocketV2.sol | generate the uniswap pair path of token -> weth make the swap | function handleTax() internal lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(
address(this),
address(uniswapV2Router),
balanceOf(address(this))
);
uniswa... | 15,710,214 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
import "./OrderMixin.sol";
import "./OrderRFQMixin.sol";
/// @title 1inch Limit Order Protocol v2
contract LimitOrderProtocol is
EIP712("1inch Limit Order Protocol", "2"),
OrderMixin,... | Returns bitmask for double-spend invalidators based on lowest byte of order.info and filled quotes return Result Each bit represents whether corresponding was already invalidated | function invalidatorForOrderRFQ(address maker, uint256 slot) external view returns(uint256) {
return _invalidator[maker][slot];
}
| 1,390,092 |
// solium-disable security/no-inline-assembly
pragma solidity ^0.6.2;
/**
* @title a library to sequentially read memory
* @dev inspired from Andreas Olofsson's RLP
*/
library Memory {
struct Cursor {
uint256 begin;
uint256 end;
}
/**
* @dev returns a new cursor from a memory
* @retu... | checks if the cursor is exactly at the end of the stream return c true if is exactly at the end/ | function eof(Cursor memory c) internal pure returns (bool) {
return c.begin == c.end;
}
| 7,238,702 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "./interfaces/polyg... | Send funds to polygon bridge through hop protocol rootToken address of token to bridge recipient address for receiving tokens chainId number of chain to transfer amount of tokens to bridge amountOutMin minimum tokens received deadline for transfer relayer address of relayer relayerFee fee tha relayer gets tran... | function sendToL2Hop(address rootToken, address recipient, uint256 chainId,uint256 amount,uint256 amountOutMin,uint256 deadline,address relayer,uint256 relayerFee) external whenNotPaused {
_checkBeforeTransfer(amount, recipient);
_transferERC20(amount, rootToken, _hopBridgeErc20, recipient);
... | 498,413 |
pragma solidity ^0.5.12;
library SafeMath {
function MUL98(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING
if (a == 0)
return 0;
uint256 c = a * b;
require(c / a == b);
... | inject NONSTANDARD NAMING | function SETLENDINGPOOLMANAGER882(address _lendingPoolManager) public; | 5,544,565 |
// Sources flattened with hardhat v2.6.0 https://hardhat.org
// File deps/@openzeppelin/contracts-upgradeable/proxy/Initializable.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.24 <0.7.0;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be de... | Returns true if and only if the function is running in the constructor extcodesize checks the size of the code stored in an address, and address returns the current address. Since the code is still not deployed when running a constructor, any checks on its code size will yield zero, making it an effective way to detect... | function _isConstructor() private view returns (bool) {
address self = address(this);
uint256 cs;
return cs == 0;
}
| 7,515 |
/**
*Submitted for verification at Etherscan.io on 2022-04-29
*/
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.4;
// Deployed by @CryptoSamurai031 - Telegram user
interface Fee {
function feeDistribution(uint256 amount, uint256 [9] memory fees, address [7] memory feesAddresses, bool inBNB) external... | date in Unix epoch time | function setAccountSellDate(address account, uint256 date) external onlyOwner {
sellDates[account] = date;
}
| 14,970,878 |
/*
Copyright 2017 ZeroEx Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, s... | Get allowance of token given to Proxy by an address. token Address of token. owner Address of owner. return Allowance of token given to Proxy by owner. | function getAllowance(address token, address owner)
internal
constant
returns (uint allowance)
{
return Token(token).allowance(owner, PROXY);
}
| 1,754,050 |
./partial_match/42/0x1c4daF780a2b00b40781DB41E020816728b56e61/sources/OrbitTrajectory.sol | return A unit amount of terminal inflation supply issued/ rate = (1 + epoch rate) ^ num of epochs return Supply (effectiveRate - 1) for extra supply to issue based on number of epochs | function terminalInflationSupply(uint totalSupply, uint numOfEpochs) public pure returns (uint) {
uint UNIT = SafeMath.unit();
uint effectiveCompoundRate = Math.exp(UNIT.add(TERMINAL_SUPPLY_RATE_ANNUAL.div(52)),numOfEpochs);
return totalSupply.mul(effectiveCompoundRate.sub(UNIT)) / UNIT;
... | 3,417,444 |
// SPDX-License-Identifier: GNU
/// @notice adapted from https://github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/examples/ExampleOracleSimple.sol
pragma solidity 0.7.6;
import "../OracleCommon.sol";
import "../../_openzeppelin/math/SafeMath.sol";
import '../../_uniswap/v2-core/contracts/interfaces/IUni... | / this condition should never be false | function init(address token) external onlyModuleOrFactory override {
require(token != NULL_ADDRESS, "UniswapOracleTWAPCompare: token cannot be null");
IUniswapV2Pair _pair = IUniswapV2Pair(UniswapV2Library.pairFor(uniswapFactory, token, indexToken));
require(address(_pair) != NULL_ADDRESS, "... | 1,106,165 |
pragma solidity ^0.4.24;
import {Ownable} from '../zeppelin/contracts/ownership/Ownable.sol';
import {SafeMath} from '../zeppelin/contracts/math/SafeMath.sol';
import {ReentrancyGuard} from '../zeppelin/contracts/ReentrancyGuard.sol';
contract MediaLicensing is Ownable, ReentrancyGuard {
using SafeMath for uint;
... | admin action to move data from an old contract make sure no other seller offered the same media make sure the offered price is more than zero create the media entry in the repo | function admin_add_offer(bytes32 hash, uint256 price, address publisher) onlyOwner public {
require(repository[hash].seller == address(0x0));
require(price > 0);
repository_size += 1;
emit LogMediaOffer(publisher, hash, price);
}
| 12,544,089 |
./partial_match/1/0x61dC65001A8De4138DAD5167e43FF0FB0AB8D3B3/sources/src/L1ArbitrumMessenger.sol | alternative function entry point when struggling with the stack size | function sendTxToL2(
address _inbox,
address _to,
address _user,
uint256 _l1CallValue,
uint256 _l2CallValue,
L2GasParams memory _l2GasParams,
bytes memory _data
) internal returns (uint256) {
return sendTxToL2(
_inbox,
_to,
... | 16,040,154 |
./full_match/4/0x275DF24D83C40Db61C980Aa940d07c1a288bBB4F/sources/contracts/Atevada.sol | If we haven't set the starting index and this is either 1) the last saleable token or 2) the first token to be sold after the end of pre-sale, set the starting index block | function whitelistSaleMint(uint256 _quantity)
callerIsUser
requireIsWhiteListSale
requireIsOperational
external payable {
require(addressMintedList[msg.sender] == 0, "Error: user has minted");
require(whitelistedList[msg.sender] == 1, "Error: user is not whitelisted");
req... | 13,371,110 |
pragma solidity >=0.5.2;
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./IIdentityRegistry.sol";
contract SecurityTokenDraft is ERC20 {
using SafeMath for uint256;
string public symbol;
string public name;
uint8 public de... | Transfer token for a specified address to The address to transfer to. value The amount to be transferred./ | function transfer(address to, uint256 value) public returns (bool) {
require(_sectransfer(msg.sender, to, value));
return super.transfer(to, value);
}
| 13,002,054 |
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.6;
pragma abicoder v2;
import "hardhat/console.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
contract Token is ERC20{
using SafeMath for uint256;
uint public constant supply = 500;... | DELEGATE/ get current values | function delegate(address _delegatee, uint8 _percentage) public {
require(_percentage <= 100, "Trying to delegate over 100%");
require(_delegatee != msg.sender, "Trying to delegate to self");
uint nowTotalDelegated = _getValueAt(totalDelegated[msg.sender], block.number);
uin... | 12,955,226 |
/*
* ABDK Multisig Wallet Smart Contract.
* Copyright © 2017-2019 by ABDK Consulting (https://abdk.consulting/).
* Author: Mikhail Vladimirov <mikhail.vladimirov@gmail.com>
*/
pragma solidity ^0.5.7;
/**
* ABDK Multisig Wallet smart contract allows multiple (up to 255) parties to
* collectively own an E... | Reveal parameters of suggested transaction with given ID. _id ID of the suggested transaction to reveal parameters of _to destination address of the transaction _value value of the transaction _data data of the transaction _salt salt used to calculate transaction hash/ Only owners may reveal transactions Make sure... | function reveal (
uint256 _id,
address _to, uint256 _value, bytes memory _data, uint256 _salt) public {
require (ownerIndexes [msg.sender] > 0);
require (checkHash (_id, _to, _value, _data, _salt));
emit Revelation (_id, msg.sender, _to, _value, _data, _salt);
}
| 12,854,370 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20Upgradeable {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev R... | prev. accumulativeDividendOf View the amount of funds that an address has earned in total. accumulativeFundsOf(_owner) = withdrawableFundsOf(_owner) + withdrawnFundsOf(_owner) = (pointsPerShare balanceOf(_owner) + pointsCorrection[_owner]) / pointsMultiplier _owner The address of a token holder. return The amount o... | function accumulativeFundsOf(address _owner) public view returns(uint256) {
return pointsPerShare.mul(balanceOf(_owner)).toInt256Safe().add(pointsCorrection[_owner]).toUint256Safe() / pointsMultiplier;
}
| 1,422,251 |
/**
*Submitted for verification at Etherscan.io on 2020-03-18
*/
pragma solidity 0.5.16; // optimization runs: 200
interface IDaiBackstopSyndicate {
event AuctionEntered(uint256 auctionId, uint256 mkrAsk, uint256 daiBid);
event AuctionFinalized(uint256 auctionId);
enum Status {
ACCEPTING_DEPOSITS,
AC... | Return total amount of MKR that is currently in this contract. Determine the MKR currently in this contract. | function getMKRBalance() external view returns (uint256 mkr) {
mkr = _MKR.balanceOf(address(this));
}
| 12,828,947 |
/* Attestation decode and validation */
/* AlphaWallet 2021 - 2022 */
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
contract VerifyTicket {
using ECDSA for bytes32;
address payable owner;
bytes1 c... | in class Ticketecrecover | function recoverTicketSignatureAddress(bytes memory attestation, uint256 hashIndex) public pure returns(address signer, bytes memory ticketId, bytes memory conferenceId, bytes memory commitment2, uint256 resultIndex)
{
uint256 length;
uint256 decodeIndex;
bytes memory sigData;
... | 936,792 |
pragma solidity ^0.6.0;
import "./libraries/Strings.sol";
import "./HToken.sol";
import "./DOL.sol";
/**
* @title Hades' HErc20 Contract
* @notice HTokens which wrap an EIP-20 underlying
* @author Hades
*/
contract HErc20 is HToken, HErc20Interface {
address public underlying;
/**
* @notice Initialize the ne... | Sender redeems hTokens in exchange for the underlying asset Accrues interest whether or not the operation succeeds, unless reverted redeemTokens The number of hTokens to redeem into underlying return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ | function redeem(uint256 redeemTokens) external override returns (uint256) {
return redeemInternal(redeemTokens);
}
| 6,466,372 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @creator: Pak
/// @author: manifold.xyz
import "@manifoldxyz/libraries-solidity/contracts/access/AdminControl.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppeli... | Mint a token/ | function _mintPoet(address recipient) private {
_redemptionCount++;
_mint(recipient, _redemptionCount);
emit Unveil(_redemptionCount);
}
| 1,014,341 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./Signature.sol";
contract TGE is Ownable, Signature {
using SafeERC20 for ... | Sends ETH and reverts if the transfer fails. recipient The transfer recipient. amount The transfer amount./ | function safeSendEth(address recipient, uint256 amount) private {
require(success, "Failed to send ETH");
}
| 9,961,096 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.2;
import "./FixedPoint.sol";
/**
* @dev Originally DeriswapV1Math
* @author Andre Cronje, LevX
*/
library MirinMath {
using FixedPoint for *;
uint256 private constant FIXED_1 = 0x080000000000000000000000000000000;
uint256 private constant FIXED_2 ... | determines if x = 2 ^ c where c >= 1/ | function isPow2(uint256 x) internal pure returns (bool) {
if (x == 1) return false;
while (x > 2) {
if (x % 2 != 0) return false;
x = x >> 1;
}
return true;
}
| 5,438,121 |
./full_match/100/0x87b52eD635DF746cA29651581B4d87517AAa9a9F/sources/src/CoWFallbackHandler.sol | Returns hash of a message that can be signed by owners. This has been copied from solhint-disable-next-line max-line-length / https://github.com/safe-global/safe-contracts/blob/5abc0bb25e7bffce8c9e53de47a392229540acf9/contracts/handler/CompatibilityFallbackHandler.sol however `safe` parameter has been replaced by the `... | function getMessageHashForSafe(bytes32 domainSeparator, bytes memory message) internal pure returns (bytes32) {
return keccak256(
abi.encodePacked(
bytes1(0x19),
bytes1(0x01),
domainSeparator,
keccak256(abi.encode(SAFE_MSG_TYPEHASH,... | 14,289,309 |
pragma solidity 0.7.3;
library AdditionalMath {
using SafeMath for uint256;
function max16(uint16 a, uint16 b) internal pure returns (uint16) {
return a >= b ? a : b;
}
function min16(uint16 a, uint16 b) internal pure returns (uint16) {
return a < b ? a : b;
}
/**
... | A staker can't be a worker for another staker | function batchDeposit(
address[] calldata _stakers,
uint256[] calldata _numberOfSubStakes,
uint256[] calldata _values,
uint16[] calldata _periods
)
external
for (uint256 i = 0; i < _stakers.length; i++) {
address staker = _stakers[i];
... | 7,607,402 |
pragma solidity 0.5.3;
import "./oz/SafeMath.sol";
import "./oz/IERC20.sol";
import "./GuildBank.sol";
contract Moloch {
using SafeMath for uint256;
// ****************
// GLOBAL CONSTANTS
// ****************
uint256 public periodDuration; // default = 17280 = 4.8 hours in seconds (5 periods per ... | burn shares instruct guildBank to transfer fair share of tokens to the ragequitter | function _ragequit(uint256 sharesToBurn, IERC20[] memory approvedTokens) internal {
uint256 initialTotalShares = totalShares;
Member storage member = members[msg.sender];
require(member.shares >= sharesToBurn, "Moloch::ragequit - insufficient shares");
require(canRagequit(member.h... | 12,926,351 |
./full_match/43113/0x891C3eD61c3c039A84D5C4C0c8E40f86dA3202D5/sources/project_/contracts/FoldStaking.sol | Updates reward variables `lastRewardedTimestampHour`, `accumulatedRewardsPerShare` and `lastRewardsRangeIndex` for a given pool./ | function updatePool() public {
Pool storage pool = pools[0];
if (block.timestamp < pool.timeRanges[0].startTimestampHour) return;
if (block.timestamp <= pool.lastRewardedTimestampHour + SECONDS_PER_HOUR) return;
uint48 lastTimestampHour = pool.timeRanges[pool.timeRanges.length-1].e... | 7,119,071 |
./partial_match/1/0x23AaB5275B3C6489eE0Eae1F0CBa93e8A3635C3E/sources/UniRocket.sol | _totalSupply = _totalSupply.sub(tokensToBurn); burns to this address, this address will be the reward address | function transfer(address to, uint256 value) public returns (bool) {
require(value <= _balances[msg.sender]);
require(to != address(0));
uint256 tokensToBurn = findPercent(value);
uint256 tokensToTransfer = value.sub(tokensToBurn);
_balances[msg.sender] = _balances[msg.sender].sub(value);
_b... | 4,170,118 |
pragma solidity ^0.4.13;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value... | Presale not started yet Both presale and public sale have ended Presale Presale cap limit reached Presale cap almost reached Public sale Public sale cap limit reached Public sale cap almost reached Public sale cap is bigger than contribution | function eligible(address contributor, uint amountInWei) constant returns (uint) {
if (now < presaleStartTime) return 0;
if (now >= openSaleEndTime) return 0;
if (now < openSaleStartTime) {
if (remainingPresaleCap <= 0) {
return 0;
}
if (r... | 12,633,517 |
./partial_match/1/0x99B52db75A2C37efA07C3867eC5811B9D878D4e3/sources/VaultStaking.sol | Function for users to extend lock. Staking Duration must be valid. Does not require any token transfer and immediately gives new bonus. | function extendLock(uint48 _stakingDurationInDays) external nonReentrant {
User memory user = users[msg.sender];
require(!user.blacklisted, "Blacklisted");
require(stakingPeriodsInDays.contains(_stakingDurationInDays), "Invalid staking period");
require(user.stakingDuration <= _staki... | 3,734,974 |
// File: contracts/IManager.sol
pragma solidity ^0.5.11;
contract IManager {
event SetController(address controller);
event ParameterUpdate(string param);
function setController(address _controller) external;
}
// File: contracts/zeppelin/Ownable.sol
pragma solidity ^0.5.11;
/**
* @title Ownable
*... | Withdraws fees to the caller/ Tell Minter to transfer fees (ETH) to the delegator | function withdrawFees()
external
whenSystemNotPaused
currentRoundInitialized
autoClaimEarnings
{
uint256 fees = delegators[msg.sender].fees;
require(fees > 0, "no fees to withdraw");
delegators[msg.sender].fees = 0;
minter().trustedWithdrawETH(msg... | 1,112,492 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Addr... | Mint options Mints an amount of options and return to caller option The option contract to mint optionAmount Amount of options to mint/ Transfers back the minted options | function mint(IPodOption option, uint256 optionAmount) external override {
_mint(option, optionAmount);
IERC20(address(option)).safeTransfer(msg.sender, optionAmount);
}
| 14,096,217 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.4;
import "./IUniswapPCVDeposit.sol";
import "../../Constants.sol";
import "../PCVDeposit.sol";
import "../../refs/UniRef.sol";
import "@uniswap/v2-periphery/contracts/interfaces/IWETH.sol";
import "@uniswap/lib/contracts/libraries/Babylonian.sol";
impo... | set the new pair contract _pair the new pair also approves the router for the new pair token and underlying token | function setPair(address _pair) public virtual override onlyGovernor {
_setupPair(_pair);
_approveToken(token);
_approveToken(_pair);
}
| 10,229,783 |
./full_match/5/0x5137ABFf24ad5b7f8079F7f9BfCDB5645e490526/sources/project_/contracts/util/Issuable.sol | Returns true if the caller is one of the current issuer./ | function isIssuer() public view returns (bool) {
for (uint i = 0; i < _issuers.length; i++) {
if (_issuers[i] == msg.sender) {
return true;
}
}
return false;
}
| 11,594,536 |
./full_match/56/0xfC652Ea2E8A373C16f3d8c5BD25E9898b9699ECB/sources/contracts/IFAllocationMaster.sol | get closest PRECEDING user checkpoint get total checkpoint count for user First check most recent checkpoint return closest checkpoint Next check earliest checkpoint If specified timestamp number is earlier than user's first checkpoint, return null checkpoint | function getClosestUserCheckpoint(
uint24 trackId,
address user,
uint80 timestamp
) private view returns (UserCheckpoint memory cp) {
uint32 nCheckpoints = userCheckpointCounts[trackId][user];
if (
userCheckpoints[trackId][user][nCheckpoints - 1].timestamp <=... | 3,247,466 |
// 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... | Transfers protocol fees from the `FeeCollector` pools into the staking contract. poolIds Staking pool IDs | function transferProtocolFeesForPools(bytes32[] calldata poolIds)
external
{
for (uint256 i = 0; i < poolIds.length; ++i) {
_transferFeesForPool(poolIds[i]);
}
}
| 12,969,122 |
./full_match/1/0x9837Ce9825D52672Ca02533B5A160212bf901963/sources/contracts/libraries/Throttle.sol | Reverts if usage amount exceeds available amount supply {qRTok} Total RToken supply beforehand amount {qRTok} Amount of RToken to use. Should be negative for the issuance throttle during redemption and for the redemption throttle during issuance. untestable: amtRate will always be greater > 0 due to previous valida... | function useAvailable(
Throttle storage throttle,
uint256 supply,
int256 amount
) internal {
if (throttle.params.amtRate == 0 && throttle.params.pctRate == 0) return;
uint256 available = currentlyAvailable(throttle, limit);
if (amount > 0) {
require... | 16,407,699 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elem... | Allows a project creator to add early birds in Batch msg.sender must be the projectId creator projectId to add to birds all addresses to add before end registration time and there is still enough available spots | function registerBatchTo(uint256 projectId, address[] memory birds)
external
override
{
Project memory project = projects[projectId];
require(msg.sender == project.creator, 'Not project creator.');
uint256 count = birds.length;
EnumerableSet.AddressSet storage r... | 6,147,981 |
./full_match/4/0x6BE60E29FBb7559A5aF18D1e8F840767dd315359/sources/usingtellor/contracts/UsingTellor.sol | Allows the user to get the latest value for the requestId specified _requestId is the requestId to look up the value for return ifRetrieve bool true if it is able to retreive a value, the value, and the value's timestamp return value the value retrieved return _timestampRetrieved the value's timestamp/ | function getCurrentValue(uint256 _requestId)
public
view
returns (
bool ifRetrieve,
uint256 value,
uint256 _timestampRetrieved
)
{
uint256 _count = tellor.getNewValueCountbyRequestId(_requestId);
uint256 _time = tellor.getTimest... | 817,552 |
./partial_match/1/0x0ace20a35eE382Bda90D1D93CEE65f5970FC01c8/sources/Chip.sol | Returns the symbol of the token, usually a shorter version of the name./ | function symbol() public view returns (string memory) {
return _symbol;
}
| 4,257,943 |
/**
*Submitted for verification at Etherscan.io on 2021-08-28
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
// ----------------------------------------------------------------------------
/// @author Gradi Kayamba
/// @title Bozindo Currency - BOZY
// ---------------------------------------------------... | See {ERC20Interface - approve} MUST trigger a Approval event./ Set spender allowance to the `_amount`. See {event ERC20Interface-Approval} | function _approve( address _owner, address _spender, uint256 _amount, uint256 _initialBalance)
noneZero(_spender)
noneZero(_owner)
internal
virtual
{
require(_initialBalance >= _amount, "Not enough balance.");
require(_amount >= 0, "The value is less than or zero!");
... | 15,392,880 |
./full_match/137/0x97854678E04Ae9c03A109C1184A8Cbf684F6c819/sources/FractalERC1155SignatureMint.sol | Mints tokens according to the provided mint request. _req The payload / mint request. _signature The signature produced by an account signing the mint request./ Set royalties, if applicable. Set URI | function mintWithSignature(MintRequest calldata _req, bytes calldata _signature)
external
payable
virtual
override
returns (address signer)
{
require(_req.quantity > 0, "Minting zero tokens.");
uint256 tokenIdToMint;
uint256 nextIdToMint = nextTok... | 3,761,307 |
pragma solidity ^0.4.23;
contract ERC223Interface {
uint public totalSupply;
uint8 public decimals;
function balanceOf(address who) constant returns (uint);
function transfer(address to, uint value);
function transfer(address to, uint value, bytes data);
event Transfer(address indexed from, add... | Withdraw the amount of token that is remaining in this contract. _address The address of EOA that can receive token from this contract./ | function withdraw(address _address) public onlyOwner {
require(stop || now > endTime);
require(_address != address(0));
uint tokenBalanceOfContract = getRemainingToken();
erc20.transfer(_address, tokenBalanceOfContract);
emit LogWithdrawal(_address, tokenBalanceOfContract);
... | 1,546,649 |
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.7.5;
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol";
import "./presets/O... | See {IOracles-voteForRewards}./ mark vote as submitted, update candidate votes number update only if enough votes accumulated update total rewards update activated validators | function voteForRewards(
uint256 _nonce,
uint256 _totalRewards,
uint256 _activatedValidators
)
external override onlyOracle whenNotPaused
{
require(_nonce == nonce.current(), "Oracles: invalid nonce");
bytes32 candidateId = keccak256(abi.encode(_nonce, _totalR... | 14,633,148 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
// The ATTRToken is the Attrace utility token.
// More info: https://attrace.com
//
// We keep the contrac... | To support listing some addresses can be allowed transfers pre-listing. | function setPreReleaseAddressStatus(address addr, bool status) public {
require(_wlController == msg.sender);
_preListingAddrWL[addr] = status;
}
| 14,486,903 |
pragma solidity ^0.5.0;
// Copyright 2019 OpenST Ltd.
//
// 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 applica... | Transfers EIP20 token to destination address. Function requires: - msg.sender should be owner - EIP20 token address should not be zero - token.transfer() execution should be successful _token EIP20 token address. _to Address to which tokens are transferred. _value Amount of tokens to be t... | function transferToken(
EIP20Interface _token,
address _to,
uint256 _value
)
external
onlyOwner
returns (bool success_)
{
require(
address(_token) != address(0),
"EIP20 token address is zero."
);
require(
... | 1,089,401 |
pragma solidity 0.5.4;
/**
* @title interface of ERC 20 token
*
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 val... | Allows the owner to revoke the vesting. Tokens already vested remain in the contract, the rest are returned to the owner. account address in which the vesting is revoked/ | function revoke(address account) public onlyOwner {
VestedToken storage vested = vestedUser[account];
require(!vested.revoked);
uint256 balance = vested.totalToken;
uint256 unreleased = _releasableAmount(account);
uint256 refund = balance.sub(unreleased);
vested.revok... | 12,543,129 |
pragma solidity ^0.4.18;
import './StudyLog.sol';
contract StudyData {
/* Codes about Authority and SuperUser */
address public SuperUser;
address public Owner;
address public LogContract;
StudyLog log = StudyLog(LogContract);
struct Manager {
uint ManagerID;
address ManagerAddr;
... | currently not used debug function / | function get_cStuIDs(uint _CourseID) public view returns(uint[]) {
uint[] memory result = courses[_CourseID].cStuIDs;
return result;
}
| 5,541,656 |
/**
*Submitted for verification at Etherscan.io on 2019-12-31
*/
// File: contracts/lib/Bytes32Library.sol
/*
Copyright 2018 Set Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the Lic... | Returns whether the liquidator believes the rebalance has failed. return If liquidator thinks rebalance failed/ | function liquidatorBreached()
private
view
returns (bool)
{
return liquidator.hasRebalanceFailed(address(this));
}
| 6,405,745 |
pragma solidity >=0.5.0;
pragma experimental ABIEncoderV2;
/// @title Multicall2 - Aggregate results from multiple read-only function calls. Allow failures
/// @author Michael Elliot <mike@makerdao.com>
/// @author Joshua Levine <joshua@makerdao.com>
/// @author Nick Johnson <arachnid@notdot.net>
/// @author Bryan Sti... | Multiple calls in one! (Replaced by block_and_aggregate and try_block_and_aggregate) Reverts if any call fails. we use low level calls to intionally allow calling arbitrary functions. solium-disable-next-line security/no-low-level-calls | function aggregate(Call[] memory calls)
public
returns (uint256 blockNumber, bytes[] memory returnData)
{
blockNumber = block.number;
returnData = new bytes[](calls.length);
for(uint256 i = 0; i < calls.length; i++) {
(bool success, bytes memory ret) = calls[i... | 7,292,135 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
import "Initiative_Legislative_lib.sol";
import "Register.sol";
import "Citizens_Register.sol";
import "IVote.sol";
import "IDelegation.sol";
*/
import "contracts/Initiative_Legislative_lib.sol";
import "contracts/Register.sol";
import "contracts/Citizens_Reg... | Get the amount of DemoCoin token owned by the Delegation and used by a Delegation member for a specific delegation law project. key Id of law project member Address of delegation member return amount Amount of token used by {member} address for {key} law project/ | function Get_Member_Amount_Consumed(bytes32 key, address member)external view returns(uint amount){
return Delegation_Law_Projects[key].Members_Token_Consumption[member];
}
| 12,618,301 |
pragma solidity >=0.4.22 <0.6.0;
import "./helperFunctions.sol";
import "./SafeMath.sol";
import "./Tier.sol";
import "./layerCounter.sol";
contract GoldLocations is helperFunctions {
// Tier t;
using SafeMath for uint;
uint public TotalGoldLocated; //until t+0
uint public TotalGoldFoun... | for(uint i=0; i < amount; i++) { tier activeTier = new Tier();} | function GenerateNewFields (uint amount, uint tier, uint layer) public returns (uint) {
Tier child = new Tier(tier);
address tierAddress = child.getAddress();
tiersToDate.push(tier);
tiers[tierAddress] = tier;
_tiers[tier]= tierAddress;
... | 12,578,555 |
./full_match/1/0x702860f8fBaCecAbE4Fe21b88BE490D3740276CE/sources/contracts/Credits.sol | Batch function for owner/admin to activate multiple credit buy plans at once. _planIds An array of plan ids to be activated./ Plan id should be valid. Activate the plan id. | function batchActivateCreditBuyPlans(
uint256[] memory _planIds
) external onlyAdminOrOwner {
for (uint256 i = 0; i < _planIds.length; i++) {
uint256 planId = _planIds[i];
require(
planId != 0 && planId <= creditBuyPlansAvailable,
"Invalid ... | 9,737,196 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeCast.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openze... | Update the given pool's reward allocation point. Can only be called by the operators. _pid id of the pool _allocPoint the allocation point of the pool, used when calculating total reward the whole pool will receive each block _delayDuration the time user need to wait when withdraw/ | function allocSetPool(
uint256 _pid,
uint64 _allocPoint,
uint256 _delayDuration,
uint256 _lockDuration
) external onlyOperator allocValidatePoolById(_pid) {
require(
_delayDuration <= ALLOC_MAXIMUM_DELAY_DURATION,
"AllocStakingPool: delay duration ... | 266,571 |
/**
* @author Sushant Kumar
* @title CampaignFactory
* @section DESCRIPTION
* This smart contract is an implementation of Kickstarter using Solidity.
* It is used to create Campaigns to raise funds and then request the backers of
* the Campagin to approve the usage of the raised funds for various purposes.
* Ad... | Filters campaigns based on current block.timestamp into ongoing and completed campaigns List of CampaignStatus from getCampaigns() to filtered upon return ongoingCampaigns List of addresses of Ongoing Campaigns return completedCampaigns List of addresses of Completed Campaigns/ Ongoing Campaigns Completed Campaigns | function filterCampaigns(CampaignStatus[] campaigns) internal view returns(address[] ongoingCampaigns, address[] completedCampaigns) {
uint indexOfOngoing;
uint indexOfCompleted;
uint numberOfCampaigns = campaigns.length;
ongoingCampaigns = new address[](numberOfCampaigns);
... | 12,737,812 |
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal... | Add address to presael list ------------------------------------------------------------------------ | function addToPresaleList(address[] calldata entries) external onlyOwner {
for(uint256 i = 0; i < entries.length; i++) {
address entry = entries[i];
require(entry != address(0), "Null address");
require(!presalerList[entry], "Duplicate entry");
... | 1,685,256 |
./full_match/1/0x2868dD9aBF1A88D5be7025858A55180D59bb1689/sources/contracts/Muppeth.sol | Update the royalty wallet address/ | function setTreasuryAddress(address payable newAddress) public onlyOwner {
if (newAddress == address(0)) revert CannotSetZeroAddress();
treasuryAddress = newAddress;
}
| 9,754,855 |
// SPDX-License-Identifier: GPL-3.0
/// @title The Bitstrays NFT descriptor
/***********************************************************
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@[email protected]@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@%[email protected]@@@@@@@@@@@@
[email protected]@@@@@@... | Lock all Bitstray parts. This cannot be reversed and can only be called by the owner when not locked./ | function lockParts() external override onlyOwner whenPartsNotLocked {
arePartsLocked = true;
emit PartsLocked();
}
| 11,850,179 |
pragma solidity >=0.4.0 <0.7.0;
// Version 1.1
// Date: 08/14/19
/**
* @dev Interace taken from OpenZeppelin template:
* Standard interface that allows any tokens on Ethereum to be re-used by
* other applications: from wallets to decentralized exchanges.
* see link for OpenZeppelin Solidity contract below:
*
*... | Integer division of two numbers truncating the quotient, reverts on division by zero./ assert (a == b c + a % b); There is no case in which this doesn't hold | function div(uint256 a, uint256 b)
internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
| 1,806,716 |
./full_match/56/0x0b0D3e03E7d49F8b82bFeB2Aee3386F5fE274527/sources/project_/contracts/Ownable.sol | Event OwnershipTransferred is used to log that a ownership change of the token has occured/ Modifier We create our own function modifier called onlyOwner, it will Require the current owner to be the same as msg.sender/ This _; is not a TYPO, It is important for the compiler; | modifier onlyOwner() {
require(
_owner == msg.sender,
"Ownable: only owner can call this function"
);
_;
}
| 3,249,672 |
./full_match/1/0x990f58570b4C7b8b7ae3Bc28EFEB2724bE111545/sources/contracts/utils/WadRayMath.sol | Multiplies two ray, rounding half up to the nearest ray. x Ray. y Ray. return z The result of x y, in ray. Let y > 0 Overflow if (x y + HALF_RAY) > type(uint256).max <=> x y > type(uint256).max - HALF_RAY <=> x > (type(uint256).max - HALF_RAY) / y | function rayMul(uint256 x, uint256 y) internal pure returns (uint256 z) {
assembly {
if mul(y, gt(x, div(MAX_UINT256_MINUS_HALF_RAY, y))) {
revert(0, 0)
}
z := div(add(mul(x, y), HALF_RAY), RAY)
}
}
| 17,128,488 |
./partial_match/1/0x08E1451D4f34cD67E9b4647bCcb251483EeeC6D7/sources/MultiSigStub.sol | Web3 call functions/ | function tokenBalances(address tokenAddress)
public
constant
delegated
returns (uint)
{
}
| 9,309,955 |
// 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_180(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,453,893 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "hardhat/console.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
//import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
contract DogCoin is
ERC20
//ERC20Upgradeable
{
event AddedHolder(address indexed a... | holder is new, should subscribe to array | function mint(address account, uint256 amount)
public
onlyOwner
returns (bool)
{
_mint(account, amount);
if (holderIndexes[account] == 0) {
holders.push(account);
holderIndexes[account] = holders.length;
emit AddedHolder(account);
... | 1,000,929 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.