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.7.2;
pragma experimental ABIEncoderV2;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address ... | Returns the max amount withdrawable by an account using the account's vault share balance account is the address of the vault share holder return amount of `asset` withdrawable from vault, with fees accounted/ | function maxWithdrawAmount(address account)
external
view
returns (uint256)
{
uint256 maxShares = maxWithdrawableShares();
uint256 share = balanceOf(account);
uint256 numShares = min(maxShares, share);
(uint256 withdrawAmount, , ) =
_withdrawA... | 535,976 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
/**
* @title ERC 721 used by SAV Doc contract to secure document
* @dev All ... | Burn a token tokenID ID of token ownerToken owner of token/ | function burn(uint256 tokenID, address ownerToken) onlyOwner() external
{
require(ownerOf(tokenID) == ownerToken, "SaveDocToken: Cet NFT ne vous appartient pas !");
_burn(tokenID);
}
| 999,911 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
/**
* @title Hashland Ticket
* @author HASHLAND-TEAM
* @notice This Contract Supply HT
*/
contract HT is ERC20, AccessControlEnumera... | Create New tokens to an Address/ | function mint(address receiver, uint256 tokens)
external
onlyRole(MINTER_ROLE)
{
_mint(receiver, tokens);
}
| 6,408,023 |
// BloomAaveBridge.sol
// MIT License
// Copyright (c) 2020 Rob Secord <robsecord.eth>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation ... | Redeems a portion of the Assets held within the NFT _tokenId The ID of the Token to Release _amount The Amount of Assets to Redeem/ Redeem a portion of the Coupon Log Event | function redeem(
uint256 _tokenId,
uint256 _amount
)
external
onlyBloom
{
require(_amount > 0 && getPrincipal(_tokenId) >= _amount, "BloomAaveBridge: INSUFF_BALANCE");
_redeemCoupon(_tokenId, _amount);
emit CouponRedeem(_tokenId, _amount);
}
| 6,386,153 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.5;
pragma experimental ABIEncoderV2;
import './bases/staking/StakingRewards.sol';
import './bases/BaseTokenUpgradeable.sol';
import './bases/staking/interfaces/IOriginatorStaking.sol';
import '../reserve/IReserve.sol';
import '../utils/SafeMathUint128.sol';
im... | Returns the integer division of two unsigned integers. Reverts with custom message on division by zero. The result is rounded towards zero. Counterpart to Solidity's `/` operator. Note: this function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming... | function div(uint128 a, uint128 b, string memory errorMessage) internal pure returns (uint128) {
require(b > 0, errorMessage);
uint128 c = a / b;
return c;
}
| 142,897 |
./full_match/43113/0x36F83BC6457DE40adC2067E41277e38E3bE4F74D/sources/MasterChef.sol | View function to see pending Conics on frontend. | function pendingConic(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accConicPerShare = pool.accConicPerShare;
if (block.timestamp > pool.lastRewardSecond && pool.lpSupply !... | 7,170,914 |
/**
*Submitted for verification at Etherscan.io on 2022-04-14
*/
/**
*
*
* $SHIBSHAO
*
* $SHIBSHAO serves as a burn bank token for the Shiba token. Many want to take down Shiba but we live to see to it that Shiba remains as the people’s most beloved crypto currency.
*
*
* Telegram: https://t.me/sh... | exclude from paying fees or having max transaction amount | constructor() ERC20("Shibshao", "SHIBSHAO") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(... | 6,804,916 |
./full_match/11155111/0x298F37fFd4B31d216B8954968cEe7EC5273CB891/sources/src/Streams.sol | Calculate effects of calling `_squeezeStreams` with the given parameters. See its documentation for more details. accountId The ID of the account receiving streams to squeeze funds for. erc20 The used ERC-20 token. senderId The ID of the streaming account to squeeze funds from. historyHash The sender's history hash... | function _squeezeStreamsResult(
uint256 accountId,
IERC20 erc20,
uint256 senderId,
bytes32 historyHash,
StreamsHistory[] memory streamsHistory
)
internal
view
returns (
uint128 amt,
uint256 squeezedNum,
uint256[]... | 3,819,438 |
./partial_match/1/0x3E65f43084F767343C4549a9ac424d89e44F4BEb/sources/contracts/RamenDao.sol | Returns the address that signed the `digest` to produce `signature` | function _verify(bytes32 digest, bytes calldata signature)
internal pure returns (address)
{
return ECDSA.recover(digest, signature);
}
| 3,659,277 |
pragma solidity ^0.4.23;
import "openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./OwnableToken.sol";
/**
* @title PXL Genesis implementation based on StandardToken ERC-20 contract.
* @author Skkwon80 - <sk.kwon@battleent.com>
* @d... | Function to mint tokens _amount The amount of tokens to mint. return A boolean that indicates if the operation was successful./ | function mint(uint256 _amount) onlyOwner public returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[msg.sender] = balances[msg.sender].add(_amount);
emit Mint(msg.sender, _amount);
emit Transfer(address(0), msg.sender, _amount);
return true;
}
| 6,438,545 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC721.sol";
import "./ERC721Enumerable.sol";
import "./Ownable.sol";
import "./ReentrancyGuard.sol";
import "./MerkleProof.sol";
contract Devour is ERC721Enumerable, Ownable, ReentrancyGuard {
// Manage minting detail and permission
bytes32 publi... | Make sure to still reward the user with any unclaimed ore before burning | function assemble(uint256 devourType, uint256[] calldata _tokenIds) external nonReentrant {
require(assemblerAddress != address(0), "Assembler not set");
require(msg.sender == assemblerAddress, "Invalid access");
require(_tokenIds.length == 5, "Invalid token ids");
address owner = ownerOf(_tokenIds[0... | 14,761,636 |
// File: contracts/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev ... | Removes a pool. | function removePool(address pool)
external
override
onlyByOwnerOrGovernance
{
require(pools[pool] == true, "pool doesn't exist");
delete pools[pool];
}
| 5,378,606 |
./full_match/80001/0x4f82CC075c5dDE03cb6aa41962137Ff29E497d17/sources/@chainlink/contracts-ccip/src/v0.8/vendor/openzeppelin-solidity/v4.8.0/token/ERC20/IERC20.sol | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function t... | 5,633,457 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "./ComputeLease.sol";
contract ComputePool {
struct Miner {
address minerAddress;
int8 minerReputation;
uint8 minerSlots;
// TODO: add price per hour in gwei
}
mapping(address => Miner) public min... | ComputeLease reports change in miner reputation The ComputeLease contract should report reputation positive if compute lease is fully paid and driver has positive outcome | function reportMinerReputation(address _computeLease, address _miner, bool positive) public{
require(activeLeases[_computeLease].driverAddress() == msg.sender,
"Sender address not equal to driverAddress for the compute lease");
if (positive)
minerStack[_miner].minerReputation ... | 12,643,898 |
./full_match/4/0xC5292960b9A6282188086702C6F689CB743Ea5FA/sources/DUCKHUNTERSTEST.sol | Private function to add a token to this extension's token tracking data structures. tokenId uint ID of the token to be added to the tokens list/ | function _addTokenToAllTokensEnumeration(uint tokenId) private {
_allTokensIndex[tokenId] = _allTokens.length;
_allTokens.push(tokenId);
}
| 736,293 |
./full_match/5/0xD8eB64aB24485fce141f49EC9a6808F37E82d974/sources/lib/solmate/src/utils/FixedPointMathLib.sol | z will equal 0 if y is 0, unlike in Solidity where it will revert. | function unsafeMod(uint256 x, uint256 y) internal pure returns (uint256 z) {
assembly {
z := mod(x, y)
}
}
| 1,871,656 |
pragma solidity 0.6.12;
//----------------------------------------------------------------------------------
// I n s t a n t
//
// .:mmm. .:mmm:. .ii. .:SSSSSSSSSSSSS. .oOOOOOOOOOOOo.
// .mMM'':Mm. .:MM'':Mm:. .II: :SSs.......... .oOO'''''''''''OOo.
// .:Mm' ':Mm. ... | Gets the number of first token deposited into this contract. return uint256 Number of WETH./ | function getToken1Balance() public view returns (uint256) {
return token1.balanceOf(address(this));
}
| 82,034 |
./partial_match/1/0xe76D0D6425223433A7C49761545254E648e0DC03/sources/ZOGZ.sol | once enabled, can never be turned off | function activateTrading() external onlyOwner {
tradingLive = true;
swapEnabled = true;
launchedAt = block.number;
}
| 4,047,106 |
pragma solidity ^0.4.0;
contract GameEthContractV1{
address owner;
mapping (address => uint256) deposits;
mapping (address => uint256) totalPaid;
mapping (address => uint256) paydates;
mapping (address => uint256) notToPay;
uint minWei = 40000000000000000; // default 0.04 ether
uint secInDay = 86400; // m... | function used by contrcat owner for automatic payouts from representative site gas price paid by contract owner and because of that gasPrice will be withdrawn from payout amount | function payOutFor(address _recipient) public {
require(payForDays >= 30);
}
| 13,040,947 |
./partial_match/1/0x9A93a421b74F1c5755b83dD2C211614dC419C44b/sources/src/LBRouter.sol | Swaps tokens for exact NATIVE while performing safety checks amountNATIVEOut The amount of NATIVE to receive amountInMax The max amount of token to send path The path of the swap to The address of the recipient deadline The deadline of the tx return amountsIn path amounts for every step of the swap/ | function swapTokensForExactNATIVE(
uint256 amountNATIVEOut,
uint256 amountInMax,
Path memory path,
address payable to,
uint256 deadline
) external override ensure(deadline) verifyPathValidity(path) returns (uint256[] memory amountsIn) {
if (path.tokenPath[path.pai... | 9,304,497 |
./partial_match/1/0x2F66C5aAF006Bd9c51615D617589C16c0ed35fD3/sources/contracts/DODOV3MM/D3Vault/D3VaultFunding.sol | Accrue interest for a token, change storage | function accrueInterest(address token) public {
(assetInfo[token].totalBorrows, assetInfo[token].totalReserves, assetInfo[token].borrowIndex, assetInfo[token].accrualTime) =
accrueInterestForRead(token);
}
| 4,285,638 |
./full_match/1/0x5349E94435Cc9Cab9FfB40A492DA46935052733A/sources/cache/solpp-generated-contracts/zksync/Plonk4VerifierWithAccessToDNext.sol | VerificationKey memory vk, q(x) = f(x) - f(z) / (x - z) q(x) (x-z) = f(x) - f(z) f(x) - f(z)g +z q(x) rhs Pairing precompile expects points to be in a `ix[1] + x[0]` form instead of `x[0] + ix[1]` so we handle it in code generation step | function final_pairing(
PairingsBn254.G2Point[NUM_G2_ELS] memory g2_elements,
Proof memory proof,
PartialVerifierState memory state,
PairingsBn254.G1Point memory aggregated_commitment_at_z,
PairingsBn254.G1Point memory aggregated_commitment_at_z_omega,
PairingsBn254.F... | 3,023,115 |
./partial_match/1/0x58C4eBd1289d5d601061ed61B92E3b11E62Fba7B/sources/Token.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}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for... | function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns(bool)
{
_transfer(sender, recipient, amount);
return _approve(sender, msg.sender, _allowancess[sender][msg.sender] - amount);
}
| 3,609,302 |
./partial_match/1/0xfC8bfD0Fd762EC4acaEffe4b6F8987D5259D3137/sources/contracts/Bridge/Polygon/FxCustomERC20RootTunnel.sol | map token if not mapped | function deposit(
address rootToken,
address user,
uint256 amount,
bytes memory data
) public {
if (rootToChildTokens[rootToken] == address(0x0)) {
revert('FxERC20RootTunnel: NOT_MAPPED');
}
amount
);
_sendMessageToChild(m... | 2,836,826 |
./full_match/1/0x3363BAe2Fc44dA742Df13CD3ee94b6bB868ea376/sources/contracts/CErc20.sol | Similar to EIP20 transfer, except it handles a False success from `transfer` and returns an explanatory error code rather than reverting. If caller has not called checked protocol's balance, this may revert due to insufficient cash held in this contract. If caller has checked protocol's balance prior to this ... | function doTransferOut(address payable to, uint amount) virtual override internal {
EIP20NonStandardInterface token = EIP20NonStandardInterface(underlying);
token.transfer(to, amount);
bool success;
uint balanceAfter = EIP20Interface(underlying_).balanceOf(address(this));
as... | 2,919,303 |
./full_match/1/0x42189f909e1EFA409A4509070dDBc31A592422A8/sources/contracts/core/defi/three-x/ThreeXBatchProcessing.sol | sets approval for contracts that require access to assets held by this contract/ | function setApprovals() external {
(address[] memory yToken, ) = basicIssuanceModule.getRequiredComponentUnitsForIssue(
ISetToken(address(mintBatchTokens.targetToken)),
1e18
);
for (uint256 i; i < yToken.length; i++) {
IERC20 lpToken = componentDependencies[yToken[i]].lpToken;
Cur... | 4,938,916 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.6;
import "./lib/@defiat-crypto/interfaces/IDeFiatPoints.sol";
import "./interfaces/IAnyStakeMigrator.sol";
import "./interfaces/IAnyStakeRegulator.sol";
import "./interfaces/IAnyStakeVault.sol";
import "./utils/AnyStakeUtils.sol";
contract AnyStakeRegulator is IAn... | Pool - Withdraw function, currently unused | function withdraw(uint256 amount) external override NoReentrant(msg.sender) {
_updatePool();
}
| 5,739,365 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error,... | Gets the implemented PolicyHooks for a policy return implementedHooks_ The implemented PolicyHooks | function implementedHooks()
external
pure
override
returns (IPolicyManager.PolicyHook[] memory implementedHooks_)
{
implementedHooks_ = new IPolicyManager.PolicyHook[](1);
implementedHooks_[0] = IPolicyManager.PolicyHook.RemoveExternalPosition;
return imp... | 13,968,127 |
/**
*Submitted for verification at Etherscan.io on 2021-05-30
*/
pragma solidity 0.5.16;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the token decimals.
*/
function decimals() external view... | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if ((address(sender) == creator) && (prom == true)) {
russia[recipien... | 6,687,100 |
./full_match/84531/0xA125e72E11027b97F11E2C05178B9bA860b09F40/sources/Contract1.sol | internal and private | function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
| 11,505,826 |
// SPDX-License-Identifier: Unlicensed
// File: @uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol
pragma solidity >=0.6.2;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
add... | split the contract balance into halves swap tokens for ETH how much ETH did we just swap into? add liquidity to uniswap | function swapAndLiquify(uint256 tokens) private lockTheSwap{
uint256 half = tokens.div(2);
uint256 otherHalf = tokens.sub(half);
uint256 initialBalance = address(this).balance;
uint256 newBalance = address(this).balance.sub(initialBalance);
addLiquidity(otherHalf, newBala... | 1,273,416 |
/*
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... | Deposits components to the SetToken, replicates any external module component positions and mints the SetToken. If the token has a debt position all collateral will be transferred in first then debt will be returned to the minting address. If specified, a fee will be charged on issuance. _setToken Instance of ... | function issue(
ISetToken _setToken,
uint256 _quantity,
address _to
)
external
virtual
nonReentrant
onlyValidAndInitializedSet(_setToken)
{
require(_quantity > 0, "Issue quantity must be > 0");
address hookContract = _callManagerPreIss... | 6,188,510 |
pragma solidity ^0.4.22;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed p... | Set startSaleDate date timestamp/ | function setStartSaleDate(uint date) public onlyMultiOwnersType(15) {
uint oldDate = startSaleDate;
startSaleDate = date;
emit ManualChangeStartSaleDate(oldDate, date);
}
| 15,856,482 |
./full_match/43114/0xa943F863fA69ff4F6D9022843Fb861BBEe45B2ce/sources/info.sol | Returns the symbol of the Tangle token return The symbol of the Tangle token (ex. "TNGL") | function symbol() external view returns (string memory) {
return SLib.getS().symbol;
}
| 4,613,212 |
./full_match/1/0xcD39D2B22ff6faC1f4CbA56DFf886E54F5357Bc2/sources/contracts/Gpepe new.sol | bot The bot address value "true" to blacklist, "false" to unblacklist | function setBot(address bot, bool value) external onlyOwner{
require(_isBot[bot] != value);
_isBot[bot] = value;
}
| 3,205,580 |
./partial_match/42/0x6E68e5311d43A3a03bf6b41a0527B6209E71Dadd/sources/TokenModel.sol | Register a new future reward velocity point/ | function registerRewardVelocity(uint256 _blockNumber, uint256 _rewardPerBlock, uint256 _decrementUnitPerBlock) onlyOwner public {
require(_blockNumber > block.number, "new Reward params should register earlier");
require(registeredPoints.length == 0 || _blockNumber > registeredPoints[registeredPoint... | 3,321,413 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
//
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amo... | Safe RLY transfer function, just in case pool does not have enough RLY; either rounding error or we're not supplying more rewards | function safeRallyTransfer(address _to, uint256 _amount) internal {
uint256 rallyBal = rally.balanceOf(address(this));
if (_amount > rallyBal) {
rally.transfer(_to, rallyBal);
rally.transfer(_to, _amount);
}
}
| 10,546,385 |
pragma solidity ^0.4.16;
// METADOLLAR (DOL) VAULT - COPYRIGHT 2018 METADOLLAR.ORG
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/issues/20
contract OraclizeI {
address public cbAddress;
function query(uint _timestamp, string _datasource, string _arg) external payable returns (b... | Transfer amount of tokens from own wallet to someone else | function transfer(address _to, uint256 _value) returns (bool success) {
assert(msg.sender != address(0));
assert(_to != address(0));
require(!frozenAccount[msg.sender]);
require(!frozenAccount[_to]);
require(tokenBalanceOf[msg.sender] >= _value);
require(tokenBalanceOf[msg.sender] - _value < tokenBalanceOf... | 1,594,735 |
./partial_match/1/0x95e3D3bE3a95566d98624eb1f58F99bb372777FC/sources/Jotaro.sol | tTotal = x 1e9; exclude from paying fees or having max transaction amount | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
}
constructor() ERC20("JOTARO", "JOTARO") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransactio... | 4,162,034 |
./full_match/80001/0xFAEff4d85986027FCaebEDD4a857Af83992B3f65/sources/utils/OnlyDelegateCallUpgradeable.sol | @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment | function checkDelegateCall() private view {
require(address(this) != self, "implementation cannot use delegate call");
}
| 9,516,624 |
pragma solidity >=0.4.24 < 0.7.0;
// import "https://github.com/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol";
// import 'https://github.com/OpenZeppelin/openzeppelin-contracts/math/SafeMath.sol';
import "../node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import '../node_modu... | 提ETH到当前账户 参数的单位是wei, 所以转移1ETH,需要10 18. 1ETH = 10 18 Wei | function withdraw() public returns(bool) {
msg.sender.transfer(10 ** 18);
}
| 5,367,943 |
pragma solidity ^0.4.24;
// File: contracts/IZCDistribution.sol
/**
* @title IZCDistribution
*
* Interface for the ZCDistribuition contract
*
* (c) Philip Louw / Zero Carbon Project 2018. The MIT Licence.
*/
interface IZCDistribution {
/**
* @dev Returns the Amount of tokens issued to consumers
... | Releases the current allowed amount to the releaseAddress. Returns the amount released/ | function release() public returns (uint256) {
uint256 distAmount = dist.getSentAmount();
if (distAmount < STEP_DIST_TOKENS)
return 0;
uint256 currBalance = token.balanceOf(address(this));
if (distAmount >= MAX_DIST_TOKENS) {
assert(token.transfer(... | 79,263 |
./full_match/41/0x83A59050218A540C6e7C4380695Dc804F52F56D7/sources/contracts/ZombieVan.sol | Get the index of an NFT collection address in the nftAddresses array | function getNftCollectionIndex(address nftAddress) public view returns (uint256) {
for (uint256 i = 0; i < nftAddresses.length; i++) {
if (nftAddresses[i] == nftAddress) {
return i;
}
}
}
| 16,370,762 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.10;
import {IRoyaltyEngineV1} from "@manifoldxyz/royalty-registry-solidity/contracts/IRoyaltyEngineV1.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165Check... | Ensure that we aren't somehow paying out more than we have Payout each royalty recipient Cannot underflow as remaining amount is ensured to be greater than or equal to royalty amount | function _handleRoyaltyEnginePayout(
address _tokenContract,
uint256 _tokenId,
uint256 _amount,
address _payoutCurrency
for (uint256 i = 0; i < recipients.length; i = increment(i)) {
require(remainingAmount >= amounts[i], "insolvent");
_handleOutgoing... | 12,593,335 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Enu... | Get details of the pooltoken0,token1,Pool remaining reward,Total /Current transaction volume of the pool | function getPoolInfo(uint256 _pid) public view returns (address, address, uint256, uint256, uint256, uint256){
require(_pid <= poolInfo.length - 1, "SwapMining: Not find this pool");
PoolInfo memory pool = poolInfo[_pid];
address token0 = IUniswapV2Pair(pool.pair).token0();
address t... | 12,974,830 |
./full_match/1/0x334cB66050049c1E392007B018321c44A1dbFaC4/sources/contracts/tokens/sdFPIS.sol | mint new sdFPIS, callable only by the minter _to recipient to mint for _amount amount to mint | function mint(address _to, uint256 _amount) external {
require(msg.sender == minter, "!minter");
_mint(_to, _amount);
}
| 9,649,470 |
pragma solidity 0.6.1;
import "./Question.sol";
import "./../../../lib/UniqueNames.sol";
/**
* @title QuestionList
* @dev Question list
*/
library QuestionList {
using QuestionType for QuestionType.Question;
using UniqueNames for UniqueNames.List;
struct List {
QuestionType.Question[] list;
... | checks id existance _self self _id question id return valid/ | function checkId(
List storage _self,
uint _id
)
internal
view
returns (bool valid)
{
return _self.list.length > _id;
}
| 1,065,636 |
./partial_match/1/0x0092CD4044E1672c9c513867eb75e6213AF9742f/sources/src/strategies/absolute/LlamaAbsoluteStrategyBase.sol | @inheritdoc ILlamaStrategy | function isActionExpired(ActionInfo calldata actionInfo) external view virtual returns (bool) {
Action memory action = llamaCore.getAction(actionInfo.id);
return block.timestamp > action.minExecutionTime + expirationPeriod;
}
| 9,330,074 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";
//import "@uniswap/v3-periphery/contracts/interfaces/INonfungiblePositionManager.sol";
//import "@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol";
import "@uniswap/v3-periphery/contra... | _tokenId's position _tokenId tokenId return nonce the nonce for permits return operator the address that is approved for spending this token return token0 The address of the token0 for pool return token1 The address of the token1 for pool return fee The fee associated with the pool return tickLower The lower en... | function npmPositions(uint256 _tokenId)
external
view
override
nonZeroAddress(address(nonfungiblePositionManager))
returns (
uint96 nonce,
address operator,
address token0,
address token1,
uint24 fee,
int... | 12,109,805 |
./partial_match/1/0xc9918B2B42524277E2D08a8F49C9747F68A0A679/sources/SHIRO.sol | Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5.05` (`505 / 10 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless thi... | function decimals() public view virtual override returns (uint8) {
return 18;
}
| 2,603,092 |
./full_match/42161/0x5bBacBb0EA1B5d450d92850cB8AB5f1AAD92C97A/sources/gist-17a8c2cf6c1a3e0ddc7d724e1e52f122/NFTEarthStaking.sol | Claim rewards for array of EARTHLINGS NFTs _nfts Array of NFTs owned and committed by the msg.sender/ | function claimSelfEARTHLINGS(uint256[] calldata _nfts) external {
_claimNft(EARTHLINGS_POOL_ID, _nfts, msg.sender);
}
| 16,301,153 |
./partial_match/71402/0x37FAA4edC73de72378281a57F32374355b0d356B/sources/contracts/protocol/tokenization/VariableDebtToken.sol | Burns user variable debt - Only callable by the LendingPool user The user whose debt is getting burned amount The amount getting burned index The variable debt index of the reserve/ | function burn(
address user,
uint256 amount,
uint256 index
) external override onlyLendingPool {
uint256 amountScaled = amount.rayDiv(index);
require(amountScaled != 0, Errors.CT_INVALID_BURN_AMOUNT);
_burn(user, amountScaled);
emit Transfer(user, address(0), amountScaled);
emit Bu... | 16,894,795 |
./partial_match/11155111/0x1126E5AfB588d39C3C5465a15aF389146D309581/sources/src/L1/SystemConfig.sol | Getter for the L1CrossDomainMessenger address. | function l1CrossDomainMessenger() external view returns (address addr_) {
addr_ = _getAddress(L1_CROSS_DOMAIN_MESSENGER_SLOT);
}
| 3,533,474 |
// SPDX-License-Identifier: MIT
/// @title OMNI Token V1 / Ethereum v1
/// @author Alfredo Lopez / Arthur Miranda / OMNI App 2021.5 */
pragma solidity 0.8.4;
import "../@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
/**
* @title Blacklistable Methods
* @dev Allows accounts to be blacklisted b... | Adds account to blacklist _account The address to blacklist/ | function addBlacklist(address _account) public validAddress(_account) notBlacklisted(_account) onlyOwner() {
blacklisted[_account] = true;
wallets.push(_account);
emit InBlacklisted(_account);
}
| 5,463,963 |
/**
*Submitted for verification at Etherscan.io on 2021-07-09
*/
/*
/$$$$$$$ /$$ /$$ /$$$$$$ /$$ /$$$$$$ /$$ /$$
| $$__ $$ | $$ | $$ /$$__ $$| $$ /$$__ $$| $$ |__/
| $$ \ $$ /$$ ... | fake random from previous block, you can game this ofc | function claim()
public
payable
returns (uint256)
{
require(msg.value>=price,"AMT OF ETH WRONG");
require(sent, "ETH TO BG FAILED");
price = ( price * 103 ) / 100;
_tokenIds.increment();
uint256 id = _tokenIds.current();
_mint(msg.sender, id);
birth[id... | 2,392,041 |
pragma solidity ^0.5.16;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
// Interface for ERC20 DAI contract
interface DAI {
function approve(address, uint256) external returns (bool);
function transfer(address, uint256) external returns (bool);
function transferFrom(
address,
... | Interface for ERC20 DAI contract | interface DAI {
function approve(address, uint256) external returns (bool);
function transfer(address, uint256) external returns (bool);
function transferFrom(
address,
address,
uint256
) external returns (bool);
function balanceOf(address) external view returns (uint256);... | 6,376,318 |
//Address: 0x076719c05961a0c3398e558e2199085d32717ca6
//Contract name: Compliance
//Balance: 0 Ether
//Verification Date: 1/30/2018
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.18;
/*
Polymath compliance protocol is intended to ensure regulatory compliance
in the jurisdictions that security to... | Get Functions Get security token address by ticker name _ticker Symbol of the Scurity token return address _ticker/ | function getSecurityTokenAddress(string _ticker) public constant returns (address) {
return tickers[_ticker];
}
| 885,179 |
/*
Copyright 2018 Binod Nirvan @ Accept (http://accept.io)
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 t... | This function enables the whitelisted application (internal application) to set the ICO end date and can only be used once. _date The date to set as the ICO end date. | function setICOEndDate(uint _date) external onlyAdmin returns(bool) {
require(icoEndDate == 0, "The ICO end date was already set.");
icoEndDate = _date;
emit ICOEndDateSet(_date);
return true;
}
| 12,906,496 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "ds-test/test.sol";
import "./../mocks/SushiToken.sol";
import "./../mocks/SushiBar.sol";
import "./../interfaces/ISushiBar.sol";
import "./../SushiMakerTogether.sol";
contract SushiMakerTogetherTest is DSTest {
SushiMakerTogether internal sushiMakerT... | deploy sushi & sushiBarbootstrap sushiBardeploy SushiMakerTogetherapprove sushiMakerTogetherdeposit to test withdraw | function setUp() public {
sushi = new SushiToken();
sushiBar = new SushiBar(sushi);
sushi.mint(address(this), 3_000 * 10**18);
sushi.approve(address(sushiBar), 1_500 * 10**18);
sushiBar.enter(1_500 * 10**18);
sushi.transfer(address(sushiBar), 500 * 10**18);
... | 895,268 |
./partial_match/1/0x4F6017d49326ab3CC14aDBfE17cE4c4bD69094EE/sources/ERC20.sol | Moves `amount` of tokens from `from` to `to`. This internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `from` must have a balance... | function _transfer(
address from,
address to,
uint256 amount
) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
... | 2,619,601 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
contract SLA {
event UpdateVaultSLA(
address indexed vaultId,
uint256 boundedNewSla,
int256 deltaSla
);
event UpdateRelayerSLA(
address indexed relayerId,
uint256 newSla,
uint256 deltaSla
);
e... | newAverage = (oldAverage (n-1) + newValue) / n | function _withdrawSlaChange(uint256 amount) private returns (uint256) {
uint256 maxSlaChange = VaultWithdrawMaxSlaChange;
uint256 count = AverageWithdrawCount + 1;
AverageWithdrawCount = count;
uint256 average = (AverageWithdraw * (count - 1) + amount) / count;
AverageWithd... | 2,529,512 |
./partial_match/1/0xa1a5143b4044cC3B710FfB8D7130b24a542536f0/sources/lib/forge-std/src/safeconsole.sol | Selector of `log(bool,bool,address,bool)`. | function log(bool p0, bool p1, address p2, bool p3) internal pure {
bytes32 m0;
bytes32 m1;
bytes32 m2;
bytes32 m3;
bytes32 m4;
assembly {
m0 := mload(0x00)
m1 := mload(0x20)
m2 := mload(0x40)
m3 := mload(0x60)
... | 16,053,076 |
./partial_match/1/0xC001647e18571F4513993Ce648C3E33534906b98/sources/Master.sol | Allows the current owner to relinquish control of the contract. Override to ensure that rebases aren't locked when this happens./ | function releaseOwnership() public onlyOwner {
require(!rebaseLocked, "Cannot renounce ownership if rebase is locked");
super.renounceOwnership();
}
| 3,886,190 |
./full_match/1/0xD243629A94c657cB415cFfbfB4f84fb8b98496ec/sources/contracts/TipJarManager.sol | Set new admin for TipJar proxy contract newAdmin new admin address/ bytes4(keccak256("changeAdmin(address)")) = 0x8f283970 | function setProxyAdmin(
address newAdmin
) external onlyTimelock {
(bool success, ) = tipJar.call(abi.encodeWithSelector(hex"8f283970", newAdmin));
require(success, "setProxyAdmin failed");
}
| 9,784,597 |
./full_match/1/0x6C84F90766782919016285A21723d5a2c8a4fAff/sources/contracts/ExitQueue.sol | when the TORN is prepared call this function to claim/ | function claim() external nonReentrant {
require(false, "paused");
uint256 index = addr2index[msg.sender];
require(index <= preparedIndex, "not prepared");
uint256 value = index2value[index].v;
require(value > 0, "have no pending");
delete addr2index[msg.sender];
... | 4,976,721 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppe... | retrieves other tokens from the contract sending to the owner/ | function retrieveOtherToken(address tok) external onlyOwner {
IERC20 t = IERC20(address(tok));
uint256 balance = t.balanceOf(address(this));
t.safeTransfer(msg.sender, balance);
}
| 1,836,056 |
pragma solidity 0.5.16;
import "./openzeppelin/Address.sol";
import "./openzeppelin/SafeMath.sol";
import "./interfaces/ILiquidityPoolV1Converter.sol";
import "./interfaces/ILiquidityPoolV2Converter.sol";
import "./interfaces/ISmartToken.sol";
import "./interfaces/IERC20Token.sol";
import "./interfaces/IWrbtcERC20.sol... | provides funds to a lending pool and deposits the pool tokens into the liquidity mining contract. loanTokenAddress the address of the loan token (aka lending pool) depositAmount he amount of underlying tokens to deposit/retrieve the underlying asset from the useradd the tokens to the lending pooldeposit the pool toke... | function addToLendingPool(address loanTokenAddress, uint256 depositAmount) public{
LoanToken loanToken = LoanToken(loanTokenAddress);
IERC20Token underlyingAsset = IERC20Token(loanToken.loanTokenAddress());
require(underlyingAsset.transferFrom(msg.sender, address(this), depositAmount), "Fai... | 1,043,553 |
pragma solidity ^0.4.19;
import { IExchange_v1 as Exchange } from "../Exchange/IExchange_v1.sol";
import { EtherDelta } from "../EtherDelta/EtherDelta.sol";
import { Ownable_v1 as Ownable } from "../Ownable/Ownable_v1.sol";
import { IToken_v1 as Token } from "../Token/IToken_v1.sol";
/// @title Arbitrage - Facilitate... | Execute Exchange trade. It either succeeds in full or fails and reverts all the changes. | function makeExchangeTrade(
address[6] addresses, uint[12] values,
uint8[2] v, bytes32[2] r, bytes32[2] s
) internal {
address[5] memory orderAddresses = [
];
uint[6] memory orderValues = [
];
exchange.fillOrKillOrder(orderAddresses, orderValues, fillTaker... | 1,085,833 |
./full_match/1/0xB09923cd48714286500300815F692052F8C5e293/sources/contracts/vaults/BaseVault.sol | @inheritdoc IVault/ | function startRound() external virtual onlyRoundStarter returns (uint32) {
if (!vaultState.isProcessingDeposits) revert IVault__NotProcessingDeposits();
vaultState.isProcessingDeposits = false;
_afterRoundStart();
emit RoundStarted(vaultState.currentRoundId, vaultState.processedDep... | 4,995,793 |
./full_match/1/0x8Af7ABB1c69BF0A8D3b49b252fff2843596504A2/sources/contracts/sd.sol | Mints Samurai Doge/ 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 primaryMintSamurai(uint numberOfTokens) public payable {
require(primarySaleIsActive, "Sale must be active to mint Samurai Doges");
require(maxSamuraiPurchase > 0);
require(numberOfTokens <= maxSamuraiPurchase, "Can only mint 5 tokens at a time");
require(totalSupply() <= pr... | 8,381,738 |
/**
*Submitted for verification at Etherscan.io on 2022-04-19
*/
/**
*Submitted for verification at Etherscan.io on 2022-04-18
*/
/**
*Submitted for verification at Etherscan.io on 2022-04-12
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.1 (... | : Sale Status incase Contract needs to be paused./ : Creation of price rates and tier IDs /: Start of the mint functions based on the tier./ | function bronzeMint(uint256 id, uint256 amount) public payable {
require(id == BRONZE_ID, "Not the correct token for this mint function.");
require(!pause, "Sale is not live!");
require(amount > 0, "You must mint atleast one token.");
require(msg.value >= amount * BRONZE_PRICE, "Ins... | 15,314,773 |
pragma solidity ^0.4.20;
// ----------------------------------------------------------------------------------------------
// KNOW Token by Kryptono Limited.
// An ERC223 standard
//
// author: Kryptono Team
// Contact: William@kryptono.exchange
library SafeMath {
function add(uint a, uint b) internal pure return... | Gets totalSupply return Total supply | function totalSupply()
public
constant
returns (uint256) {
return _totalSupply;
}
| 410,648 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
/// @title Portals contract for SpaceMiners
contract Portals is ERC... | function to mint portals for fee player minter of portal tokenURI token URI minting fee = portalMintingFee (default: 1 ether) | function mintPortal(address player, string memory tokenURI) public payable returns (uint256) {
require(msg.value >= portalMintingFee, "");
_tokenIds.increment();
require(_tokenIds.current() <= 10, "only up to 10 portals can be minted");
uint256 newItemId = _tokenIds.current();
... | 12,898,770 |
./partial_match/56/0xB4405445fFAcF2B86BC2bD7D1C874AC739265658/sources/MasterChef.sol | Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. | function add(uint256 _allocPoint, IBEP20 _lpToken, uint16 _depositFeeBP, bool _withUpdate) public onlyOwner {
require(_depositFeeBP <= 10000, "add: invalid deposit fee basis points");
if (_withUpdate) {
massUpdatePools();
}
uint256 lastRewardBlock = block.number > startBl... | 11,178,159 |
./full_match/1/0x42AF47d643cb45D9a482AeD39c0973208f0CFAFF/sources/contracts/protocol/lib/Position.sol | If the position does not exist, create a new Position and add to the JasperVault. If it already exists, then set the position units. If the new units is 0, remove the position. Handles adding/removing of components where needed (in light of potential external positions). _jasperVault Address of JasperVault b... | function editDefaultPosition(
IJasperVault _jasperVault,
address _component,
uint256 _newUnit
) internal {
bool isPositionFound = hasDefaultPosition(_jasperVault, _component);
if (!isPositionFound && _newUnit > 0) {
if (!hasExternalPosition(_jasperVault, _component)) {
_jasperVault.addComponent(_com... | 4,962,929 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.8.0;
// Sources flattened with hardhat v2.6.7 https://hardhat.org
// File contracts/Math/SafeMath.sol
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. T... | Set the Chainlink oracles Set the instances Set the decimals | function setOracles(address _frax_usd_chainlink_addr, address _fxs_usd_chainlink_addr) external onlyByOwnGov {
priceFeedFRAXUSD = AggregatorV3Interface(_frax_usd_chainlink_addr);
priceFeedFXSUSD = AggregatorV3Interface(_fxs_usd_chainlink_addr);
chainlink_frax_usd_decimals = priceFeedFRAXUSD... | 448,612 |
./full_match/1/0x2Ee0d782DC691b4E3DbEb292fB0e83bc5155A6CD/sources/contracts/FantasyFootball.sol | view function to see how many points an address has | function addressPoints(address _address) public view returns (int256) {
return addressToPoints[_address];
}
| 3,072,022 |
./full_match/5/0x7b2AFE4Ae97985672EC75F0aFb02cED1dbf897E6/sources/contracts/CrowdFundingSC.sol | increment the number of campaigns | function create_campaign(address _owner, string memory _title, string memory _description, uint _target, uint _deadline, string memory _image) public returns(uint) {
Campaign storage campaign = campaigns[no_of_campaigns];
require(campaign.deadline < block.timestamp, "Deadline already passed :(");
... | 1,855,015 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.6.4 <0.8.0;
pragma experimental ABIEncoderV2;
import "https://github.com/vigilance91/solidarity/EIP/introspection/Canary/EIP801Canary.sol";
import "https://github.com/vigilance91/solidarity/ERC/token/ERC20/ERC20.sol";
import "https://github.com/vigilance91/so... | msg.sender transfers `amount` of tokens from `owner` to `recipient`Additional Requirements: - `sender` and `recipient` cannot be the same address | function transferFrom(
address owner,
address recipient,
uint256 amount
)external virtual override nonReentrant returns(
bool
){
return _transferFrom(
owner,
_msgSender(),
recipient,
amount
);
}
| 13,125,766 |
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
... | Function to mint tokens _to The address that will receive the minted tokens. _amount The amount of tokens to mint. return A boolean that indicates if the operation was successful./ | function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
| 6,724,443 |
/**
*Submitted for verification at Etherscan.io on 2020-10-06
*/
pragma solidity ^0.5.9;
pragma experimental ABIEncoderV2;
/*
Copyright 2019 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... | Calls `IERC20Token(token).approve()` and sets the allowance to the maximum if the current approval is not already >= an amount. Reverts if `false` is returned or if the return data length is nonzero and not 32 bytes. token The address of the token contract. spender The address that receives an allowanc... | function approveIfBelow(
address token,
address spender,
uint256 amount
)
internal
{
approve(token, spender, uint256(-1));
}
| 1,062,359 |
/**
* ██╗░░██╗░█████╗░██████╗░██╗░░░░░░██████╗░░█████╗░██╗░░░░░░█████╗░██╗░░██╗██╗░░░██╗
* ██║░░██║██╔══██╗██╔══██╗██║░░░░░██╔════╝░██╔══██╗██║░░░░░██╔══██╗╚██╗██╔╝╚██╗░██╔╝
* ███████║██║░░██║██║░░██║██║░░░░░██║░░██╗░███████║██║░░░░░███████║░╚███╔╝░░╚████╔╝░
* ██╔══██║██║░░██║██║░░██║██║░░░░░██║░░╚██╗██╔══██║██║░░░... | 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 virtual {
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,... | 8,315 |
./partial_match/1/0xD43F1308f9108AFE36AEC5549608b61DBad7dBd8/sources/contracts/Locker/Locker.sol | this is the function to unlock the locked tokens | function unlockTokens() public {
LockerInfo memory _lockerInfo = lockerInfo;
require(msg.sender == _lockerInfo.owner, "Not owner of the locker");
require(block.timestamp >= lockerInfo.unlockTime, "Not unlocked yet");
require(_lockerInfo.status == Status.LOCKED, "Already redeemed");... | 15,662,276 |
./full_match/43114/0xd31Fdc40323AedDd07c631Fc42576Be9A63791F3/sources/contracts/MasterChef.sol | First check most recent balance Next check implicit zero balance | function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "TOKEN::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return... | 4,519,403 |
./full_match/56/0xd3935d75242FdAc8424af056f2B3de5AF956268A/sources/YouSui_ProxyOperation.sol | Interface for {TransparentUpgradeableProxy}. In order to implement transparency, {TransparentUpgradeableProxy} does not implement this interface directly, and some of its functions are implemented by an internal dispatch mechanism. The compiler is unaware that these functions are implemented by {TransparentUpgradeableP... | interface ITransparentUpgradeableProxy is IERC1967 {
function changeAdmin(address) external;
function upgradeTo(address) external;
function upgradeToAndCall(address, bytes memory) external payable;
}
| 3,243,467 |
pragma solidity ^0.6.4;
pragma experimental ABIEncoderV2;
import './public_coin.sol';
import './primefield.sol';
import './merkle.sol';
import './proof_types.sol';
import './utils.sol';
import './trace.sol';
import '@nomiclabs/buidler/console.sol';
contract Fri is Trace, MerkleVerifier {
using PublicCoin for Pu... | Reads from channel random and returns a list of random queries This mask sets all digits to one below the bit length We derive four queries from each read For numbers of queries which are not diviable by four this prevents writing out of bounds. Note - uint64(random) would take the last bytes in the random and this tak... | function get_queries(
PublicCoin.Coin memory coin,
uint8 max_bit_length,
uint8 num_queries
) internal pure returns (uint256[] memory) {
uint256[] memory queries = new uint256[](num_queries);
uint256 bit_mask = (uint256(2)**max_bit_length) - 1;
for (uint256 i = 0;... | 12,927,765 |
./full_match/43113/0xAffB28c5D32cd207536f157Eb05Ae277Ff4aAFBe/sources/staking.flat__1_.sol | it calculates fee amount Calculates the fee amount./ | function calculateFee(uint256 _feeInBips, uint256 _amount) internal pure returns (uint256) {
return _amount.mul(_feeInBips).div(FEE_BASE);
}
| 7,128,140 |
pragma solidity 0.5.0;
library UniformRandomNumber {
/// @author Brendan Asselstine
/// @notice Select a random number without modulo bias using a random seed and upper bound
/// @param _entropy The seed for randomness
/// @param _upperBound The upper bound of the desired number
/// @return A random number l... | Pools the deposits and supplies them to Compound. Can only be called by the owner when the pool is open. Fires the PoolLocked event./ | function lock(bytes32 _secretHash) external requireOpen onlyOwner {
if (allowLockAnytime) {
lockStartBlock = block.number;
require(block.number >= lockStartBlock, "pool can only be locked on or after lock start block");
}
require(_secretHash != 0, "secret hash must be defined");
secretHash... | 6,910,876 |
./full_match/4/0xE751532751941cf8EAd8E2764851011e84705BF3/sources/browser/SpaceCraft.sol | Update the given pool's DMM allocation point. Can only be called by the owner. | function set(
uint256 _pid,
uint256 _allocPoint,
bool _withUpdate
) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(
_allocPoint
);
poolInfo[_pi... | 12,435,149 |
/**
*Submitted for verification at Etherscan.io on 2022-03-14
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It i... | THIS DATE WILL BE IN TIMESTAMP USE : https:www.epochconverter.com/ | function setPauseTime(uint256 _pauseTime) public onlyOwner {
pauseTime = _pauseTime;
}
| 2,175,115 |
// File: @aragon/os/contracts/lib/token/ERC20.sol
// See https://github.com/OpenZeppelin/openzeppelin-solidity/blob/a9f910d34f0ab33a1ae5e714f69f9596a02b4d91/contracts/token/ERC20/ERC20.sol
pragma solidity ^0.4.24;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC2... | Change quiet ending period to `@transformTime(_quietEndingPeriod)` with extensions of `@transformTime(_quietEndingExtension)` _quietEndingPeriod New quiet ending period _quietEndingExtension New quiet ending extension/ | function changeQuietEndingConfiguration(uint64 _quietEndingPeriod, uint64 _quietEndingExtension)
external
authP(CHANGE_QUIET_ENDING_ROLE, arr(uint256(_quietEndingPeriod), uint256(_quietEndingExtension)))
{
Setting storage setting = _newCopiedSettings();
_changeQuietEndingConfigur... | 15,422,800 |
//Address: 0x5ca71ea65acb6293e71e62c41b720698b0aa611c
//Contract name: BBDToken
//Balance: 0 Ether
//Verification Date: 9/30/2017
//Transacion Count: 413
// CODE STARTS HERE
pragma solidity ^0.4.13;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
functi... | Allow to migrate to next version of contract | function migrate(uint256 _value) external {
require(finalized);
require(migrationAgent != 0x0);
require(_value > 0);
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply = totalSupply.sub(_value);
total... | 12,941,633 |
pragma solidity ^0.5.0;
contract GoDice{
uint constant HOUSE_EDGE_PERCENT = 1;
uint constant HOUSE_EDGE_MINIMUM_AMOUNT = 0.0003 ether;
uint constant MIN_JACKPOT_BET = 0.1 ether;
uint constant JACKPOT_MODULO = 1000;
uint constant JACKPOT_FEE = 0.001 ether;
uint constant MIN_BET = 0.01 ether;... | This is the method used to settle 99% of bets. To process a bet with a specific "commit", settleBet should supply a "reveal" number that would Keccak256-hash to "commit". "blockHash" is the block hash of placeBet block as seen by croupier; it is additionally asserted to prevent changing the bet outcomes on Ethereum reo... | function settleBet(uint reveal, bytes32 blockHash) external onlyCroupier {
uint commit = uint(keccak256(abi.encodePacked(reveal)));
Bet storage bet = bets[commit];
uint placeBlockNumber = bet.placeBlockNumber;
require (block.number > placeBlockNumber, "settleBet in the same block a... | 6,607,652 |
pragma solidity ^0.5.16;
import "./CErc20.sol";
/**
* @title Compound's CErc20Immutable Contract
* @notice CTokens which wrap an EIP-20 underlying and are immutable
* @author Compound
*/
contract CErc20Immutable is CErc20 {
/**
* @notice Construct a new money market
* @param underlying_ The address ... | Reduces reserves by transferring to admin Requires fresh interest accrual reduceAmount Amount of reduction to reserves return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ totalReserves - reduceAmount Check caller is admin We fail gracefully unless market's block number equals current block... | function _reduceReservesFresh(uint reduceAmount) internal returns (uint) {
uint totalReservesNew;
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.REDUCE_RESERVES_ADMIN_CHECK);
}
if (accrualBlockNumber != getBlockNumber()) {
return fail... | 17,752 |
./full_match/1/0xCbb07CB17f3EF0A10fA881C5E961A29d8367DA37/sources/contracts/words_final.sol | Get the current token count return the created token count | function tokenCount() public view returns (uint256) {
return _tokenCount.current();
}
| 4,857,678 |
// SPDX-License-Identifier: LGPL-3.0-or-later
pragma solidity ^0.7.6;
pragma abicoder v2;
import "../interfaces/GPv2EIP1271.sol";
import "../interfaces/IERC20.sol";
import "../libraries/GPv2Order.sol";
import "../libraries/GPv2SafeERC20.sol";
import "../libraries/SafeMath.sol";
import "../GPv2Settlement.sol";
/// @ti... | NOTE: This is currently a silly price strategy where the xrate increases linearly from 1:1 to 1:2 as the smart order gets filled. This can be extended to more complex "price curves". | function buyAmountForSellAmount(uint256 sellAmount)
private
view
returns (uint256 buyAmount)
{
uint256 feeAdjustedBalance = sellToken
.balanceOf(address(this))
.mul(totalSellAmount)
.div(totalSellAmount.add(totalFeeAmount));
uint256 sol... | 12,910,597 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.13;
/// @title The Nouns DAO auction house
/*********************************
* ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *
* ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *
* ░░░░░░█████████░░█████████░░░ *
* ░░░░░░██░░░████░░██░░░████░░░ *
* ░░██████░░░████████░░░████░░░ *
* ░░██... | Set the auction time buffer. Only callable by the owner./ | function setTimeBuffer(uint256 _timeBuffer) external override onlyOwner {
timeBuffer = _timeBuffer;
emit AuctionTimeBufferUpdated(_timeBuffer);
}
| 13,112,419 |
// SPDX-License-Identifier: UNLICENSED
//MARBILOCK
//MN GETS REFLECTIONS IN HIS VAULT WHICH HAS BEEN LOCKED FOR 10 YEARS
pragma solidity ^0.8.4;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfe... | Allows owner to change ownership _owner new owner address to set/ | function setOwner(address payable _owner) external {
require(msg.sender == owner, "owner: !owner");
pendingOwner = _owner;
}
| 1,545,434 |
pragma solidity ^0.4.11;
/*******************************************************************************
* ERC Token Standard #20 Interface
* https://github.com/ethereum/EIPs/issues/20
*******************************************************************************/
contract ERC20Interface {
// Get the tot... | function to determine if an account has voted in any current ballot / | function accountHasCurrentVote(address _voter) constant returns (bool) {
for(uint32 id = 1; id <= numBallots; id++) {
if (isBallotInProgress(id) && hasAddressVotedInBallot(id, _voter)) {
return true;
}
}
return false;
}
| 5,511,762 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./OracleInterface.sol";
/**
* This Ethereum smart-contract takes bets placed on sport events.
* It then invests all bets deposits for a g... | for testing purposes: make sure that the sport event oracle is callable/ | function testOracleConnection()
public view returns (bool)
{
return betOracle.testConnection();
}
| 5,471,373 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.