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.3;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also teste... | Transfers the ownership of a given token ID to another address Usage of this method is discouraged, use `safeTransferFrom` whenever possible Requires the msg sender to be the owner, approved, or operator from current owner of the token to address to receive the ownership of the given token ID tokenId uint256 ID of t... | function transferFrom(
address from,
address to,
uint256 tokenId
)
public
{
require(_isApprovedOrOwner(msg.sender, tokenId));
require(to != address(0));
_clearApproval(from, tokenId);
_removeTokenFrom(from, tokenId);
_addTokenTo(to, tokenId);
emit Transfer(from, to, token... | 1,012,496 |
/*
* Origin Protocol
* https://originprotocol.com
*
* Released under the MIT license
* https://github.com/OriginProtocol/origin-dollar
*
* Copyright 2020 Origin Protocol, Inc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files ... | Interface for Aaves Lending Pool/ | interface IAaveLendingPool {
function deposit(
address _reserve,
uint256 _amount,
uint16 _referralCode
) external;
}
}
| 2,161,289 |
pragma solidity ^0.5.0;
import "./interface/RegistryInterface.sol";
import "./registry/RegistryContract.sol";
import "./UserFactory.sol";
import "./SigningLogicInitializable.sol";
/** @title Contract for Audius user replica set management */
contract UserReplicaSetManager is SigningLogicInitializable, RegistryContr... | Function used to initialize bootstrap nodes Prior to this function, the contract is effectively disabled/ | function seedBootstrapNodes(
uint[] calldata _bootstrapSPIds,
address[] calldata _bootstrapNodeDelegateWallets,
address[] calldata _bootstrapNodeOwnerWallets
) external
{
require(
msg.sender == userReplicaSetBootstrapAddress,
"Only callable by userRepl... | 7,304,007 |
./partial_match/1/0x6DfACd64037f284Cd4d397f725888291bD96FAF8/sources/contracts/cedar/drop/CedarERC1155Drop.sol | Expose the user specific limits related to the current active claim condition | function getUserClaimConditions(uint256 _tokenId, address _claimer)
external
view
override
returns (
uint256 conditionId,
uint256 walletClaimedCount,
uint256 walletClaimedCountInPhase,
uint256 lastClaimTimestamp,
uint256 nex... | 4,004,645 |
// SPDX-License-Identifier: MIT
/**
∩~~~~∩
ξ ・×・ ξ
ξ ~ ξ
ξ ξ
ξ “~~~~〇
ξ ξ
ξ ξ ξ~~~ξ ξ ξ
ξ_ξξ_ξ ξ_ξξ_ξ
Alpaca Fin Corporation
**/
pragma solidity 0.8.10;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/... | Harvest reward from StakingPool and Feed token to a GrassHouse | function feedGrassHouse() external {
_stakingPoolClaim();
uint256 _feedAmount = token.myBalance();
token.safeApprove(address(grassHouse), _feedAmount);
grassHouse.feed(_feedAmount);
emit LogFeedGrassHouse(_feedAmount);
}
| 892,329 |
./full_match/80001/0xA37e52Ca940A47568A0dDA0D455EDA99daB12F20/sources/contracts/Gigble.sol | Confirm the purchase as buyer. Transaction has to include `2 value` ether. The ether will be locked until confirmReceived is called. | function confirmPurchase()
external
payable
inState(State.Created)
condition(msg.value == (value))
{
emit PurchaseConfirmed();
buyer = payable(msg.sender);
state = State.Locked;
}
| 5,611,631 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
pragma experimental ABIEncoderV2;
library Internal_Merkle_Library_Sorted_Hash {
// Hashes a and b in the order they are passed
function hash_node(bytes32 a, bytes32 b) internal pure returns (bytes32 hash) {
assembly {
mstore(0x00, a)
... | INTERFACE: Try to append a bytes32 element, given a root, bytes32 elements in calldata, and an Existence Multi Proof | function try_append_one_using_many(
bytes32 root,
bytes32[] calldata elements,
bytes32 append_element,
bytes32[] calldata proof
) internal pure returns (bytes32 element_root) {
bytes32 total_element_count = proof[0];
require(root != bytes32(0) || total_element_count == bytes32(0), "EMPTY_TR... | 12,859,790 |
pragma solidity ^0.4.24;
contract SafeMath {
uint256 constant public MAX_UINT256 =
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
function safeAdd(uint256 x, uint256 y) constant internal returns (uint256 z) {
if (x > MAX_UINT256 - y) throw;
return x + y;
}
fu... | function that is called when transaction target is a contract | function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) throw;
balances[msg.sender] = safeSub(balanceOf(msg.sender), _value);
balances[_to] = safeAdd(balanceOf(_to), _value);
ContractReceiver receiver = C... | 574,112 |
// SPDX-License-Identifier: MIT
// File: erc-payable-token/contracts/token/ERC1363/IERC1363Spender.sol
pragma solidity ^0.8.0;
/**
* @title IERC1363Spender Interface
* @author Vittorio Minacori (https://github.com/vittominacori)
* @dev Interface for any contract that wants to support approveAndCall
* from ERC1... | Creates a new stake for a sender stakeholder Who is staking amount Amount of tokens to be staked/ Make sure tokens have been received Mappings in Solidity creates all values, so we can just check the address Check if the stakeholder already has a staked index or if its the first time This stakeholder stakes for the f... | function _stake(address stakeholder, uint256 amount)
internal validAddress(stakeholder) whenNotPaused
{
require(amount > 0,
"ExenoTokenStaking: amount cannot be zero");
require(endDate > block.timestamp,
"ExenoTokenStaking: end-date is expired");
assert(... | 1,685,530 |
/**
*Submitted for verification at Etherscan.io on 2021-12-15
*/
// SPDX-License-Identifier: No License (None)
pragma solidity ^0.8.0;
interface IBEP20TokenCloned {
// initialize cloned token just for BEP20TokenCloned
function initialize(address newOwner, string calldata name, string calldata symbol, uint8 d... | Move tokens through the bridge and call the contract with 'data' parameters on the destination chain | function bridgeToContract(
)
external
payable
notFrozen
{
require(receiver != address(0), "Incorrect receiver address");
address pair_token = _deposit(token, value, toChainId);
emit BridgeToContract(token, receiver, value, toChainId, pair_token, toContract, da... | 2,141,384 |
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
import "./StrategySlot.sol";
import "../../../interfaces/bifi/IMarketManager.sol";
import "../../../interfaces/bifi/IFlashloanReceiver.sol";
import "../../../interfaces/bifi/IManagerFlashloan.sol";
import "../../../int... | Repay action to BiFi reserve The address of token tokenHandlerAddr the address of BiFi's tokenHandler contract decimal the decimal of reserve token/ | function _repay(address reserve, address tokenHandlerAddr, uint256 decimal) internal {
IProxy proxy = IProxy(tokenHandlerAddr);
if (reserve == ETH_ADDRESS) {
IERC20 token = IERC20(reserve);
uint256 balance = token.balanceOf(address(this));
uint256 unifiedAmount = _convertUnderlyingToUnified... | 12,627,482 |
./partial_match/122/0xDBb81131678e5fa75DB773Ff4b58C72212836322/sources/contracts/FreedomWorldAssets.sol | Returns the token type max supply _assetName The name of the token type ? Question 4 : just naming convention -> should `getTypeMaxSupply` instead of `getTypeMaxsupply`? | function getTypeMaxsupply(
string calldata _assetName
) public view returns (uint256) {
uint256 _type = _nameToType[_assetName];
require(_type != 0, "Type does not exist");
return _typeMaxSupply[_type];
}
| 3,502,988 |
pragma solidity ^ 0.5.1;
contract PoWHr{
// scaleFactor is used to convert Ether into bonds and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000;
int constant crr_n = 1;
int constant crr_d = 2;
int const... | Update the payout array so that the "resolve shareholder" cannot claim resolveEarnings on previous staked resolves. Then we update the payouts array for the "resolve shareholder" with this amount And then we finally add it to the variable tracking the total amount spent to maintain invariance. | function tokenFallback(address from, uint value, bytes calldata _data) external{
if(msg.sender == address(resolveToken) ){
resolveWeight[from] += value;
dissolvingResolves += value;
int payoutDiff = (int256) (earningsPerResolve * value);
payouts[from] += payoutDiff;
totalPayouts += payoutDi... | 12,893,729 |
./partial_match/97/0x39BE117ecd63FC38013E05227e3E2Ffca6c3EB91/sources/Pool1.sol | Increase number of tokens locked for a CLA reason _reason The reason to lock tokens, currently restricted to CLA _amount Number of tokens to be increased/ | function increaseLockAmount(bytes32 _reason, uint256 _amount)
public
checkPause
returns (bool)
{
require(_reason == CLA,"Restricted to reason CLA");
require(_tokensLocked(msg.sender, _reason) > 0);
token.operatorTransfer(msg.sender, _amount);
locked[m... | 11,348,054 |
// File: @uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tok... | set the governance address | function start() public {
require(!started, "Already Started");
TOLL.mint(address(this), CAPITAL.add(REWARDS));
TOLL.approve(address(_uniswapRouter), MAX_INT);
endBlock = block.number.add(REWARDS.div(rewardPerBlock));
startBlock = block.number;
started = true;
}
| 12,054,758 |
./full_match/1/0x4599E4F3Eea04BADD41501bF79183e67f6Cf569d/sources/contracts/HighTableVaultETH.sol | @inheritdoc IHighTableVaultETH | function claimOwedFundsETH(address payable _receiver) external override returns (uint256 assets, uint256 shares) {
assets = claimOwedAssetsETH(_receiver);
shares = claimOwedShares(_receiver);
}
| 17,149,120 |
// SPDX-License-Identifier: GPL-2.0-only
// Copyright 2020 Spilsbury Holdings Ltd.
pragma solidity >=0.6.10 <0.8.0;
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';
import {Pausable} from '@openzeppelin/contracts/utils/Pausable.... | Internal utility function to withdraw funds from the contract to a receiver address withdrawValue - value being withdrawn from the contract receiverAddress - address receiving public ERC20 tokens assetId - ID of the asset for which a withdrawl is being performed/ We explicitly do not throw if this call fails, as thi... | function withdraw(
uint256 withdrawValue,
address receiverAddress,
uint256 assetId
) internal {
require(receiverAddress != address(0), 'Rollup Processor: ZERO_ADDRESS');
if (assetId == 0) {
address assetAddress = getSupportedAsset(assetId);
IERC20(... | 2,541,793 |
// File: node_modules\openzeppelin-solidity\contracts\token\ERC20\ERC20Basic.sol
pragma solidity ^0.4.21;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint... | Check if borrower transferred correct amount of token to this contract/ | function checkCollateral() public onlyBorrower atState(States.WaitingForCollateral) {
uint amount = token.balanceOf(address(this));
require(amount >= collateralAmount, "Insufficient collateral amount");
currentState = States.WaitingForLender;
}
| 1,754,996 |
pragma solidity ^0.4.16;
interface token {
function transfer(address receiver, uint amount) public;
}
contract Crowdsale {
address public beneficiary;
uint public price;
bool crowdsaleClosed = false;
token public tokenReward;
mapping(address => uint256) public balanceOf;
event FundTransfe... | Fallback function The function without name is the default function that is called whenever anyone sends funds to a contract/ | function () public payable {
require(!crowdsaleClosed);
uint amount = msg.value;
balanceOf[msg.sender] += amount;
tokenReward.transfer(msg.sender, (amount * 1 ether) / price);
FundTransfer(msg.sender, amount, true);
}
| 2,438,566 |
./full_match/9001/0xCE3CA8DE98865bCCb18B893B6e3952722a401360/sources/contracts/StarFarm.sol | Set nftLogic address | function setNFTLogic(address _addr) external onlyOwner {
require(address(0) != _addr);
nftLogic = INFTLogic(_addr);
}
| 11,534,663 |
./full_match/5/0xd27F16D365915473c7a19D59aE96Ae4F10a3Ff23/sources/contracts/guild-core/Guild.sol | Sets the guild treasury address. guildTreasury The new address for the guild treasury. Only callable by users with DEFAULT_ADMIN_ROLE./ | function setGuildTreasury(address guildTreasury) external onlyRole(DEFAULT_ADMIN_ROLE) {
if (guildTreasury == address(0)) revert InvalidParameters();
_guildTreasury = guildTreasury;
}
| 11,615,812 |
pragma solidity ^0.4.25;
library Math {
function Mul(uint a,uint b) internal pure returns (uint) {
if(a==0) {
return 0;
}
uint res = a*b;
require(res/a == b,"Overflow in Multiply");
return res;
}
function Div(uint a,uint b) inter... | Approver calls this to revoke an earlier approval _tx_id the transaction id/ | function revokeApprovalTx(uint256 _tx_id)
public
onlyByOwners
confirmationStatusCheck(_tx_id,msg.sender,true)
awaitingExecution(_tx_id)
awaitingExpiry(_tx_id)
{
_unconfirmTx(_tx_id);
}
| 5,495,137 |
/**
*Submitted for verification at Etherscan.io on 2022-04-28
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Counters.sol
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that ... | switch for activating the sale state | function flipSaleState() public onlyOwner {
_saleIsActive = !_saleIsActive;
}
| 2,071,248 |
/*
* Copyright 2014-2019 the original author or authors.
*
* 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 ap... | -----------Iterative functions------------------ | function iterate_start(LinkedList storage self) internal view returns (bytes32){
return self.head;
}
| 5,439,842 |
pragma solidity ^0.4.21;
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
import "zeppelin-solidity/contracts/math/SafeMath.sol";
import "zeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "zeppelin-solidity/contracts/ECRecovery.sol";
/**
* @title BookingPoC
* @dev A contract to offer hotel rooms... | Book a room paying with ETH pricePerNight The price per night in wei offerTimestamp The timestamp of when the offer ends offerSignature The signature provided by the offer signer _nights The nights that the guest wants to book/ Check that the offer is still valid Check the eth sent Check if there is at least one ro... | function bookWithEth(
uint256 pricePerNight,
uint256 offerTimestamp,
bytes offerSignature,
uint256[] _nights
) public payable {
require(offerTimestamp < now);
require(pricePerNight.mul(_nights.length) <= msg.value);
uint256[] memory rooms = roomsAvailable(_nights);
require(rooms.le... | 7,326,569 |
//Address: 0x12E29c3d8a8437B1A82aFb07DCa489548E08eBBE
//Contract name: CoinContract
//Balance: 0 Ether
//Verification Date: 10/8/2017
//Transacion Count: 1
// CODE STARTS HERE
contract CoinContract {
bool private workingState = false;
address public owner;
address public proxy;
uint256 public x = 100; //coin... | Contract payment function | function pay(address _client, uint256 _amount) workingFlag returns (bool ret) {
require(x > 0);
etherClients[_client] += _amount;
uint256 value = x * _amount;
FundsGot(_client, etherClients[_client]);
ret = proxy.call(bytes4(sha3("generateTokens(address,uint256)")), _client, value);
}
| 1,057,953 |
./partial_match/1/0x09Fe1D4586b90b6daeA4eBF1Dbb755a439283516/sources/TexasSky.sol | Get time lock info account The address want to know the time lock state. index Time lock index return time lock info/ | function getTimeLock(address account, uint8 index) public view returns (uint256, uint256) {
require(_timeLocks[account].length > index && index >= 0, "TimeLock: invalid index");
return (_timeLocks[account][index].amount, _timeLocks[account][index].expiresAt);
}
| 4,271,382 |
pragma solidity 0.5.17; // optimization runs: 200, evm version: istanbul
// WARNING - `executeActionWithAtomicBatchCalls` has a `bytes[]` argument that
// requires ABIEncoderV2. Exercise caution when calling that specific function.
pragma experimental A... | inject NONSTANDARD NAMING | function MIGRATECSAITODDAI208() external { | 5,492,132 |
pragma solidity ^0.6.0;
import "./interfaces/MarketControllerInterface.sol";
import "./interfaces/HTokenInterface.sol";
import "./interfaces/EIP20Interface.sol";
import "./interfaces/EIP20NonStandardInterface.sol";
import "./interfaces/InterestRateStrategyInterface.sol";
import "./interfaces/DistributorInterface.sol";... | The liquidator liquidates the borrowers collateral. The collateral seized is transferred to the liquidator. borrower The borrower of this hToken to be liquidated liquidator The address repaying the borrow and seizing collateral hTokenCollateral The market in which to seize collateral from the borrower repayAmount ... | function liquidateBorrowFresh(
address liquidator,
address borrower,
uint256 repayAmount,
HTokenInterface hTokenCollateral
) internal returns (uint256, uint256) {
uint256 allowed = controller.liquidateBorrowAllowed(
address(this),
address(hTokenCollateral),
liquidator,
borrower,
repayAmount
... | 6,356,859 |
pragma solidity ^0.4.24;
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is als... | TRC21 interface/ | interface ITRC21 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function issuer() external view returns (address);
function decimals() external view returns (uint8);
function estimateFee(uint256 value) external view retu... | 951,321 |
/**
*Submitted for verification at Etherscan.io on 2021-06-07
*/
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Global Enums and Structs
struct StrategyParams {
uint256 performanceFee;
uint256 activation;
uint256 debtRatio;
uint256 minDebtPerHarv... | Liquidate as many assets as possible to `want`, irregardless of slippage, up to `_amountNeeded`. Any excess should be re-invested here as well./ Note: potential drift by 1 wei, reduce to max balance in the case approx is rounded up _liquidatedAmount min(_amountNeeded, balanceOfWant), otw vault accounting breaks | function liquidatePosition(uint256 _amountNeeded)
internal
override
updateVirtualPrice
returns (uint256 _liquidatedAmount, uint256 _loss)
{
uint256 wantBalance = balanceOfWant();
if (wantBalance < _amountNeeded) {
uint256 amountToRedeem = _amountNeede... | 2,155,292 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
/// https://blockmagazin.de/
contract Bl... | mint token for partner addresses - `_tokenId` edition tokeId./ | function mintForPartnerAddress(uint256 _tokenId) public {
require(editions[_tokenId].tokenId != 0, "Edition not found.");
require(editions[_tokenId].count < editions[_tokenId].maxSupply, "Max token supply reached.");
require(editions[_tokenId].mintEnabled, "Token mint is not enabled.");
... | 14,563,878 |
./full_match/97/0x6Af8af4A32f98836142C324B860C04da93A83587/sources/project:/contracts/Predix.sol | Get latest recorded price from oracle If it falls below allowed buffer or has not updated, it would be invalid./ | function _getPriceFromOracle() internal view returns (uint80, int256) {
uint256 leastAllowedTimestamp = block.timestamp + oracleUpdateAllowance;
(uint80 roundId, int256 price, , uint256 timestamp, ) = oracle.latestRoundData();
require(timestamp <= leastAllowedTimestamp, 'Oracle update exceeded max timesta... | 5,023,606 |
./full_match/42/0x7A37e31FDB5c2C851dBdC9Bd3a67734D4913dB1c/sources/contracts/MyV2FlashLoan.sol | 0 = no debt, 1 = stable, 2 = variable | function myFlashLoanCall() public {
address receiverAddress = address(this);
address[] memory assets = new address[](7);
uint256[] memory amounts = new uint256[](7);
amounts[0] = 1 ether;
uint256[] memory modes = new uint256[](7);
modes[0] = 0;
address onB... | 16,213,055 |
//Address: 0xff77e51f2c6473f72392865e0a0000de19af774a
//Contract name: DisclosureManager
//Balance: 0 Ether
//Verification Date: 11/21/2017
//Transacion Count: 6062
// CODE STARTS HERE
pragma solidity 0.4.18;
// This contract provides the functions necessary to record ("push") & retrieve
// public funding data to t... | First create new entry Push entry to the array Now that we have the newRowNumber (index), set the amended field on the old record Record the event Returns row regardless of whether or not it has been amended First make sure rowNumber passed is within bounds Should not use any gas: | function pullRow(uint rowNumber) public constant returns(bytes32, bytes32, bytes32, bytes16, bytes1, bytes16, bytes32, bytes32, uint) {
Disclosure memory entry = disclosureList[rowNumber];
return (entry.organization, entry.recipient, entry.location, entry.amount, entry.fundingType, entry.date, entry.purpose, entry... | 14,091,372 |
./full_match/1/0x08E7aA68c817030995025853733B9feec3a78DC0/sources/contracts/xlocker.sol | ChecksLaunch new tokenLock symbol/ueth liquidityRegister pair for sweeping | function launchERC20(string calldata name, string calldata symbol, uint wadToken, uint wadXeth) external override returns (address token_, address pair_) {
_preLaunchChecks(wadToken, wadXeth);
token_ = address(new ERC20(name, symbol, wadToken));
pair_ = _lockLiquidity(wadToken, wadXeth, to... | 4,924,550 |
pragma solidity ^0.4.24;
// https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
// @title SafeMath: overflow/underflow checks
// @notice Math operations with safety checks that throw on error
library SafeMath {
// @notice Multiplies two numbers, throws on overflow.
function ... | Calculates how much wei investor is owed. (points + incomeOwed) / 1032 | function getAmountOwed(address _investor)
public
view
returns (uint) {
return (collectLatestPayments(_investor).add(incomeOwed[_investor]).div(scalingFactor));
}
| 1,492,690 |
./full_match/62320/0xdc1513f80929568088d402955559CB7f374494ba/sources/lib/mento-core/contracts/SortedOracles.sol | Sets the report expiry parameter for a token. _token The address of the token to set expiry for. _reportExpirySeconds The number of seconds before a report is considered expired./ | function setTokenReportExpiry(address _token, uint256 _reportExpirySeconds) external onlyOwner {
require(_reportExpirySeconds > 0, "report expiry seconds must be > 0");
require(_reportExpirySeconds != tokenReportExpirySeconds[_token], "token reportExpirySeconds hasn't changed");
tokenReportExpirySeconds[_... | 3,225,417 |
./full_match/137/0x16D66b01664bc834f5db13D01E51E1Fa7C44f03B/sources/browser/NFT721.sol | Returns the remainder of dividing two unsigned integers, with a division by zero flag. _Available since v3.4._/ | function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a % b);
}
| 4,781,903 |
./partial_match/1/0x80bdd80AaeeCc1d5DD9F9366770c517d52C7f8FC/sources/contracts/Token.sol | Burn `_amount` tokens from `_from`. _from address that holds the tokens _amount how many tokens to burn/ | function burn(address _from, uint256 _amount) external onlyRole(BURNER_ROLE) {
_burn(_from, _amount);
}
| 4,298,969 |
pragma solidity ^0.4.24;
/**
* @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 view returns (uint256);
function allowance(address owner, address spender)
... | Let the owner stop the crowdsale close timer, as long as it has not yet expired./ | function clearCrowdsaleCloseTimer() public onlyOwner onlyBeforeClosed {
closeTimer = 0;
}
| 12,811,067 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgrad... | Used to salvage any token deposited into the vault by mistake. The want token cannot be salvaged. Only governance or strategist can salvage token from the vault. The salvaged token is transferred to treasury for futhuer operation. _tokenAddress Token address to salvage./ | function salvageToken(address _tokenAddress) public onlyStrategist {
require(_tokenAddress != token, "cannot salvage");
IERC20Upgradeable target = IERC20Upgradeable(_tokenAddress);
target.safeTransfer(IController(controller).treasury(), target.balanceOf(address(this)));
}
| 2,491,765 |
pragma solidity ^0.4.25;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is ch... | update parent address/Loggersend direct commission | function updatePlayerParent(address[] _address, address[] _parentAddress) public onlyOwner{
for(uint i = 0; i < _address.length; i++) {
require(_address[i] != address(0));
require(_parentAddress[i] != address(0));
require(_address[i] != _parentAddress[i]);
... | 13,076,823 |
/**
*Submitted for verification at Etherscan.io on 2021-12-18
*/
// Sources flattened with hardhat v2.6.5 https://hardhat.org
// File contracts/libs/TransferHelper.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.6;
// helper methods for interacting with ERC20 tokens and sending ETH that do n... | Call the function to buy TOKEN/NTOKEN from a posted price sheet bite TOKEN(NTOKEN) by ETH, (+ethNumBal, -tokenNumBal) channelId 报价通道编号 pairIndex 报价对编号。吃单方向为拿走计价代币时,直接传报价对编号,吃单方向为拿走报价代币时,报价对编号加65536 index The position of the sheet in priceSheetList[token] takeNum The amount of biting (in the unit of ETH), realAmou... | function take(
uint channelId,
uint pairIndex,
uint index,
uint takeNum,
uint newEquivalent
) external payable override {
Config memory config = _config;
require(takeNum > 0, "NM:!takeNum");
require(newEquivalent > 0, "NM:!price");
P... | 6,699,963 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
//Control who can access various functions.
contract AccessControl {
address payable public creatorAddress;
uint16 public totalDirectors = 0;
mapping (address => bool) public directors;
modifier onlyCREAT... | Check that the caller has enough TAC to open a league and charge themCreate the league.Add the player to the leagueAdd the league and increment. | function createLeague(uint64 liveTime, uint64 closeTime, uint256 price, bool isPublic) public {
ITACData TAC = ITACData(TACContract);
require(TAC.balanceOf(msg.sender) >= price, "You must have enough TAC to create that league.");
TAC.transferFrom(msg.sender, address(this), price);
... | 12,721,819 |
./full_match/1/0x5d049786C852F514Ac81b1cAaaD49F2ecEd7753F/sources/contracts/SICK_Sale.sol | this sets contract address of Cryptagion (SICK) | function setCurrency(address _token) public onlyOwner {
sicktoken = ERC20(_token);
}
| 8,378,770 |
./full_match/137/0x622AC39ACbB156069A2FB8D64E34615f4b68dDa6/sources/contracts/RTGasStation.sol | Function to for owner to deduct Gas fees + service fee from a users balance Calculate the service fee amount Transfer the fees to the respective wallets Deduct the total fees from the user's balance | function deductFee(address _user, uint256 gasTotal)
external
payable
onlyOwner
{
uint256 serviceFee = calculateServiceFee(gasTotal);
uint256 totalCost = gasTotal.add(serviceFee);
require(balances[_user].owner != address(0), "Target user is not registered");
... | 4,754,136 |
pragma solidity 0.5.8;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
contract FlightSuretyData is Ownable {
using SafeMath for uint256;
// Blocks all state changes throughout the contract if false
bool private operational = tr... | Buy insurance for a flight/ Prevent buying against invalid flight keys Prevent double purchase attempts | function buyInsurance(
address airline,
string calldata flight,
uint256 timestamp
)
external
payable
requireAuthorizedContract
requireIsOperational
{
bytes32 flightKey = getFlightKey(airline, flight, timestamp);
require(flights[flightKe... | 12,832,443 |
./partial_match/1/0x0F0E1857E310A33F0BA5c18620326b97fb560aDF/sources/DOGEONE.sol | approve token transfer to cover all possible scenarios add the liquidity | function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
_approve(address(this), address(uniswapV2Router), tokenAmount);
address(this),
tokenAmount,
walletAddresses.liquidity,
block.timestamp
);
uniswapV2Router.addLiquidityETH{v... | 3,927,276 |
pragma solidity ^0.4.18; // v0.4.18 was the latest possible version. 0.4.19 and above were not allowed
////////////////////////////////////////////////////////////////////////////////
library SafeMath
{
//--------------------------------------------------------------------------
function mul(uint256 a,... | --------------------------------------------------------------------------Approval(msg.sender, _spender, amount); | function approve(address _spender, uint256 amount) public returns (bool)
{
require((amount == 0) || (allowances[msg.sender][_spender] == 0));
allowances[msg.sender][_spender] = amount;
emit Approval(msg.sender, _spender, amount);
return true;
}
| 10,253,012 |
pragma solidity ^0.5.0;
// File: node_modules/openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spend... | get account release return bool/ | function releaseOf(address account) external onlyOwner view returns(uint256) {
require(account != address(0), "The account address is empty");
return _release[account];
}
| 14,327,633 |
pragma solidity ^0.4.18;
interface token {
function transfer(address receiver, uint amount) external returns (bool);
function balanceOf(address tokenOwner) external returns (uint);
}
contract CucuSale {
address public beneficiary;
uint public amountRaised;
uint public price;
uint pu... | set new globalLocktime | function setGlobalLocktime(uint mins) public onlyOwner{
globalLocktime = now + mins * 1 minutes;
emit NewGlobalLocktime(globalLocktime);
}
| 2,492,272 |
contract StandardTokenProtocol {
function totalSupply() constant returns (uint256 totalSupply) {}
function balanceOf(address _owner) constant returns (uint256 balance) {}
function transfer(address _recipient, uint256 _value) returns (bool success) {}
function transferFrom(address _from, address _r... | Fallback function throws when called. | function() {
throw;
}
| 13,073,453 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-ethereum-package/contracts/math/Math.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/Safe... | Calculate the exchange rate that will be used to convert the original staked token amount to the `baseStakingToken()` amount. The exchange rate is denominated in `MULTIPLIER_DECIMALS`. positionType Type of the staked postion Curve LP tokens are scaled by MULTIPLIER_DECIMALS (1e18), LOW: The Curve LP token virtual p... | function getBaseTokenExchangeRate(StakedPositionType positionType) public view virtual returns (uint256) {
if (positionType == StakedPositionType.CurveLP) {
uint256 curveLPVirtualPrice = config.getFiduUSDCCurveLP().get_virtual_price();
require(curveLPVirtualPrice > MULTIPLIER_DECIMALS.div(2), "LOW");... | 13,058,118 |
./partial_match/1/0x5468441CFCC52d2A2E504d1D6B0068bF7a6F59fC/sources/GrimProtocolAdapter.sol | Gets adapted farm rewards multiplier pick last purchased nft calculate burn reduction for holding token X calculate burn reduction for holding token X | function getRewardsMultiplier(address _user, uint256 _currentRewardsMultiplier) external view override returns (uint256) {
if (userOptOut[_user] || address(nftAddress) == address(0))
return _currentRewardsMultiplier;
uint256[] memory _tokenIds = nftAddress.tokensOfOwner(_user);
... | 3,581,311 |
./partial_match/1/0x0795D136c053eBDD25966a54608309D5ae650afC/sources/PocketwithLoveSBT.sol | See {IERC721Metadata-tokenURI}./ | function tokenURI(
uint256 tokenId
) public view virtual override returns (string memory) {
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
string memory baseURI = _baseURI();
return
bytes(baseURI).length != 0
? string(abi.encodePacked(ba... | 9,280,119 |
./full_match/1/0x4A20F53E612E6Ab515A46EcA9dd36a290a2287F7/sources/contracts/protocol/core/callable/CallableLoan.sol | While owner is the label of the first argument, it is actually the sender of the transaction. | function _withdraw(
IPoolTokens.TokenInfo memory tokenInfo,
uint256 tokenId,
uint256 amount,
CallableCreditLine storage cl
) internal returns (uint256, uint256) {
if (amount == 0) {
revert ZeroWithdrawAmount();
}
IPoolTokens poolTokens = config.getPoolTokens();
if (!poolTokens.... | 9,813,793 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;
import "./IArbitrator.sol";
/** @title Centralized Arbitrator
* @dev This is a centralized arbitrator deciding alone on the result of disputes. It illustrates how IArbitrator interface can be implemented.
* Note that this contract supports appeals. The ruling... | Cost of arbitration. return fee The required amount./ | function arbitrationCost(
bytes calldata /*_extraData*/
) public view override returns (uint256 fee) {
return arbitrationFee;
}
| 1,009,524 |
./full_match/80001/0xBA9436f3679F334de8DE8681aE189d96c9DC7cdF/sources/contracts/SilkRoad.sol | Mints `tokenId` and transfers it to `to`. WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible Requirements: - `tokenId` must not exist. - `to` cannot be the zero address. Emits a {Transfer} event./ here we will give the tokenId which is unique to the buyer when we emit the Transfer we need t... | function _mint(address to, uint256 tokenId, uint256 _nftType) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to,_nftType);
... | 5,579,396 |
pragma solidity ^0.4.25;
// It's important to avoid vulnerabilities due to numeric overflow bugs
// OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs
// More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-insecurity-bad-arithmetic/
impo... | Add an airline to the registration queue/ | function registerAirline(string _name, address _address) external requireIsCompletelyRegistered(msg.sender) returns(bool)
{
approveAirlineRegistration(_address, msg.sender);
return flightSuretyData.registerAirline(_name,_address);
}
| 2,521,703 |
./full_match/80001/0xc0761F2df543E211688190FBcB2C98ca12F77340/sources/project_/contracts/Amberfi/Market.sol | Get all auctions for specific NFT contract and token ID nftContract_ (address) NFT contract address tokenId_ (uint256) NFT contract token ID return auctionIds (uint256[] memory) Auctions/ | function getAuctionsForTokenId(address nftContract_, uint256 tokenId_)
external
view
returns (uint256 auctionIds)
{
uint256 length = getAuctionsCount();
uint256 filtered;
for (uint256 i; i < length; ++i) {
if (
_auctions[i].nftContract ... | 853,969 |
./full_match/1/0x322C1A01Bcb1A1AaA4C4061AB0A8147420aF31fA/sources/contracts/LidoStaking.sol | Allows users to claim their earned rewards | function getReward() external updateReward(msg.sender) {
uint256 reward = rewards[msg.sender];
if (reward > 0) {
rewards[msg.sender] = 0;
_safeTokenTransfer(IERC20Upgradeable(rewardsToken), msg.sender, reward);
}
emit ClaimReward(msg.sender, rewardsToken, rew... | 17,067,961 |
./partial_match/8453/0x3985864664DF3B9a89EC435A5605f710014a254b/sources/BaseAnal.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("BASE ANAL X", "BaseAnal") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x4cf76043B3f97ba06917cBd90F9e3A2AAC1B306e
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair... | 16,702,574 |
/*
Copyright 2019,2020 StarkWare Industries 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
https://www.starkware.co/open-source-license/
Unless required by applicable law or agre... | Call modexp precompile. point = -z. Compute denominators for rows with nonconst mask expression. We compute those first because for the const rows we modify the point variable. Compute denominators for rows with const mask expression. expmods_and_points.points[0] = -z. point = g. expmods_and_points.points[1] = -(g z).... | this function also adds those to the batch inverse in prepartion for the fri that follows.
After this function returns, the batch_inverse_out array holds #queries
chunks of size (2 + N_ROWS_IN_MASK) with the following structure:
0..(N_ROWS_IN_MASK-1): [(x - g^i * z)^(-1) for i in rowsInMask]
... | 1,639,952 |
/*
* source https://github.com/lukso-network/rICO-smart-contracts
* @name rICO
* @package rICO-smart-contracts
* @author Micky Socaci <micky@binarzone.com>, Fabian Vogelsteller <@frozeman>, Marjorie Hernandez <marjorie@lukso.io>
* @license MIT
*/
pragma solidity ^0.5.0;
import "./zeppe... | FALLBACK function: If the amount sent is smaller than `minContribution` it cancels all pending contributions. IF you are a known contributor with at least 1 contribution and you are whitelisted, you can send ETH without calling "commit()" to contribute more./ allow to commit directly if its a known user with at least 1... | function()
external
payable
isInitialized
isNotFrozen
{
Participant storage participantStats = participants[msg.sender];
if (participantStats.whitelisted == true && participantStats.contributions > 0) {
commit();
require(msg.value < minContribution, 'To ... | 6,399,439 |
./full_match/80001/0x6e92365c2B8610bDE6a45F70d351de9C1189bf61/sources/contracts/Farm.sol | 1 minute 5 minutes 1 hour 4 hours 8 hours 1 day 3 days | function getHarvestSeconds(Fruit _fruit) private pure returns (uint) {
if (_fruit == Fruit.Rose) {
return 1 * 60;
return 5 * 60;
return 1 * 60 * 60;
return 4 * 60 * 60;
return 8 * 60 * 60;
return 24 * 60 * 60;
return 3 * 24... | 5,651,214 |
./partial_match/1/0x5094a8f54B12AEc540bF7cCd0Dd7B62f4FecF7f2/sources/Users/Elena/Source/argent-contracts/contracts/modules/common/LimitUtils.sol | Helper method to get the current limit from a Limit struct. _limit The limit struct/ | function currentLimit(ILimitStorage.Limit memory _limit) internal view returns (uint256) {
if (_limit.changeAfter > 0 && _limit.changeAfter < block.timestamp) {
return _limit.pending;
}
return _limit.current;
}
| 9,255,253 |
// SPDX-License-Identifier: GPL-3.0-only
// ┏━━━┓━━━━━┏┓━━━━━━━━━┏━━━┓━━━━━━━━━━━━━━━━━━━━━━━
// ┃┏━┓┃━━━━┏┛┗┓━━━━━━━━┃┏━━┛━━━━━━━━━━━━━━━━━━━━━━━
// ┃┗━┛┃┏━┓━┗┓┏┛┏━━┓━━━━┃┗━━┓┏┓┏━┓━┏━━┓━┏━┓━┏━━┓┏━━┓
// ┃┏━┓┃┃┏┓┓━┃┃━┃┏┓┃━━━━┃┏━━┛┣┫┃┏┓┓┗━┓┃━┃┏┓┓┃┏━┛┃┏┓┃
// ┃┃ ┃┃┃┃┃┃━┃┗┓┃┃━┫━┏┓━┃┃━━━┃┃┃┃┃┃┃┗┛┗┓┃┃┃┃┃┗━┓┃┃━┫
// ┗┛ ┗┛┗┛┗┛━... | test to check if USDT token supply is greater than M2 money supply return true if USDT token supply is over M2 | function checkTestPasses() external view override returns (bool) {
return (usdtToken.totalSupply() <= thresholdSupply);
}
| 13,706,461 |
pragma solidity ^0.4.23;
contract Events {
event onGiveKeys(
address addr,
uint256 keys
);
event onShareOut(
uint256 dividend
);
}
contract Referral is Events {
using SafeMath for *;
//=======================================================================... | ============================================================================== administrator only functions============================================================================== | function setAdministrator(bytes32 _identifier, bool _status)
public
onlyAdministrator()
{
administrators[_identifier] = _status;
}
| 2,545,425 |
// SPDX-License-Identifier: MIT
// File: contracts/true-currencies-new/ProxyStorage.sol
pragma solidity 0.6.10;
/**
* Defines the storage layout of the token implementation contract. Any
* newly declared state variables in future upgrades should be appended
* to the bottom. Never remove state variables from this ... | reclaim gas from legacy gas refund 1 will refund 15,000 amount gas to sender (minus exection cost) If gas pool is empty, refund 39,000 amount gas by calling selfdestruct/ | function refundGas(uint256 amount) external onlyOwner {
if (remainingGasRefundPool() > 0) {
gasRefund15(amount);
gasRefund39(amount.div(3));
}
}
| 59,313 |
pragma solidity ^0.6.0;
import '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
contract BiERC20 is ERC20, Ownable {
mapping (address => bool) public minters;
mapping (address => bool) public feeSetters;
mapping (address => bool) public feeFreeSenders... | ================ GOVERNANCE ==================== | function mint(address recipient_, uint256 amount_)
public
virtual
onlyMinter
{
_mint(recipient_, amount_);
}
| 12,793,917 |
/**
*Submitted for verification at Etherscan.io on 2021-08-26
*/
pragma solidity ^0.5.16;
// Copied from compound/EIP20Interface
/**
* @title ERC 20 Token Standard Interface
* https://eips.ethereum.org/EIPS/eip-20
*/
interface EIP20Interface {
function name() external view returns (string memory);
funct... | Similar to EIP20 transfer, except it handles a False result from `transferFrom` and reverts in that case. This will revert due to insufficient balance or insufficient allowance. This function returns the actual amount received, which may be less than `amount` if there is a fee attached to the transfer. ... | function doTransferIn(address from, uint amount) internal returns (uint) {
EIP20NonStandardInterface token = EIP20NonStandardInterface(property);
uint balanceBefore = EIP20Interface(property).balanceOf(address(this));
token.transferFrom(from, address(this), amount);
bool success;
... | 2,405,864 |
/**
*Submitted for verification at Etherscan.io on 2021-04-19
*/
/**
*Submitted for verification at Etherscan.io on 2021-04-19
*/
pragma solidity 0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function ... | Function to check the amount of tokens that an owner allowed to a spender. _owner address The address which owns the funds. _spender address The address which will spend the funds. return A uint256 specifying the amount of tokens still available for the spender./ | function allowance(address _owner, address _spender) public view returns (uint256) {
require(!blacklist[_owner]);
require(!blacklist[_spender]);
require(!blacklist[msg.sender]);
return allowed[_owner][_spender];
}
| 6,729,640 |
./full_match/1/0x7Cfca39d49023E84499Bd0675C2fB7bC96a2c335/sources/browser/Spoopy.sol | Either sell or remove liq | function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if(bypassChecks == false) {
if(sender == addre... | 3,060,495 |
./full_match/1/0x0C49b7F4cAF503DB1f96867260BdC100F2819994/sources/src/ENSHood.sol | returns name of a domain based on nft id | function idToName(uint256 id) public view returns (string memory) {
bytes memory _id = abi.encodePacked(id);
bytes memory nameBytes = nameWrapper.names(bytes32(_id));
return string(nameBytes);
}
| 9,727,380 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
import "../types/Ownable.sol";
import "../libraries/SafeMath.sol";
import "../libraries/SafeERC20.sol";
import "../libraries/FixedPoint.sol";
import "../interfaces/ITreasury.sol";
import "../interfaces/IERC20.sol";
contract CustomBond is Ownable {
... | determine maximum bond size return uint/ | function maxPayout() public view returns (uint) {
return PAYOUT_TOKEN.totalSupply().mul(terms.maxPayout).div(100000);
}
| 15,789,946 |
// SPDX-License-Identifier: MIT
///////////// //// //// ///////////
//// //// //// ///
//// //// //// ///
//// //////////////// ///
//// //// //// ///
//// //// //// ///
... | Will not work after condition is set | function initialSupplyCreation(address to, uint256 amount) public onlyOwner {
require(bytes(_initialAccessSetter[0]).length == 0, "THC: Access is Disabled Permanently");
_mint(to, amount);
}
| 5,753,598 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.7.6;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./ArvadCrewGenerator.sol";
import "../lib/InfluenceSettings.sol";
import "../lib/Procedural.sol";
/**
* @dev Contract which generates crew features based on the set they're part of
*/
contract... | Generates sex of the crew member 1 = Male, 2 = Female _seed Generator seed to derive from/ | function generateSex(bytes32 _seed) public pure returns (uint) {
bytes32 seed = _seed.derive("sex");
return uint(seed.getIntBetween(1, 3));
}
| 13,401,434 |
/* solhint-disable no-empty-blocks */
pragma solidity 0.5.9;
import "./Land/erc721/LandBaseToken.sol";
contract Land is LandBaseToken {
constructor(
address metaTransactionContract,
address admin
) public LandBaseToken(
metaTransactionContract,
admin
) {
}
/**
... | solium-disable-next-line security/no-assign-params | function uint2str(uint _i) internal pure returns (string memory) {
if (_i == 0) {
return "0";
}
uint j = _i;
uint len;
while (j != 0) {
len++;
j /= 10;
}
bytes memory bstr = new bytes(len);
uint k = len - 1;
... | 5,466,340 |
pragma solidity ^0.4.8;
/**
* @title VNET Token - The Next Generation Value Transfering Network.
* @author Wang Yunxiao - <wyx96922@gmail.com>
*/
contract SafeMath {
function safeMul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b... | Initializes contract with initial supply tokens to the creator of the contract / | function VNET() public {
owner = msg.sender;
}
| 12,827,155 |
pragma solidity ^0.6.6;
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
import "@chainlink/contracts/src/v0.6/vendor/SafeMathChainlink.sol";
import "@chainlink/contracts/src/v0.6/VRFConsumerBase.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title Lottery
* @dev Lotter... | Changes the state of the lottery to: DRAWING Can only be called by the contract owner Function calls the pickWinner function to select a winner/ | function endLottery() public onlyOwner{
require(state == STATE.OPEN, "Cannot end lottery yet!");
state = STATE.DRAWING;
pickWinner();
}
| 1,043,037 |
./partial_match/1/0xc6C99a98bFE1Ba7f9Bd1dbaf0c9A74103e99Af0d/sources/etherManager.sol | Get the handler ID at the index in the handler list index The index of the handler list (array) return The handler ID/ | function getTokenHandlerID(uint256 index) external view override returns (uint256)
{
return dataStorageInstance.getTokenHandlerID(index);
}
| 4,117,961 |
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.1;
contract LockContract {
address contractAdmin;
bool private multiStaking;
uint256 public minimalStake;
uint256 superStakerFreshold;
//List of all users stakes
mapping(address => uint256) stakes;
//Number of blocks for each user... | Only record the first (oldest) staking timeOnly record the first (oldest) staking time | function stake(uint256 _nbBlocks) payable external {
uint256 amount = msg.value;
address currentStaker = msg.sender;
require(amount >= minimalStake, "Stake too low");
if (!multiStaking){
require(stakes[currentStaker] == 0, "This address is already engaged");
}
... | 12,723,627 |
./full_match/80001/0x48Bb9045d4F5D2D43B2f5Bb7d9307fe1889AeE68/sources/project_/contracts/PacificRimPaymentContract.sol | emit preSalePerTransactionMintLimitUpdated(_preSalePerTransactionMintLimit); | function updatePreSalePerTransactionMintLimit(uint256 _preSalePerTransactionMintLimit) public {
require(hasRole(ADMIN_ROLE, _msgSender()),"Dapp: Must have admin role to update.");
require(_preSalePerTransactionMintLimit>0,"Dapp: Invalid value!");
require(_preSalePerTransactionMintLimit!=publ... | 5,702,688 |
pragma solidity ^0.4.2;
import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/ProofOfExistence.sol";
contract TestProofOfExistenct {
function testProofOfExistenceOwner() public {
ProofOfExistence proofofexistence = new ProofOfExistence();
Assert.equal(proofofexistence.ow... | helper function to get image sha256 hash | function testCheckIfRegistered() {
}
| 13,039,621 |
./full_match/5/0xABcaaeBAdb32a03cA7Ec292103b4809fF677B857/sources/contracts/StrategyGenLevCompFarmWETH.sol | maxDeleverage is how much we want to increase by | function _normalLeverage(
uint256 maxLeverage,
uint256 lent,
uint256 borrowed,
uint256 collatRatio
) internal returns (uint256 leveragedAmount) {
uint256 theoreticalBorrow = lent.mul(collatRatio).div(1e18);
leveragedAmount = theoreticalBorrow.sub(borrowed);
... | 1,859,556 |
/**
*Submitted for verification at Etherscan.io on 2022-01-07
*/
/**
*Submitted for verification at Etherscan.io on 2022-01-07
*/
// SPDX-License-Identifier: MIT
// @openzeppelin/contracts/cryptography/MerkleProof.sol
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Trees proo... | Verify the merkle proof | function whitelistedMints(string memory newName, string memory _tokenURI, bytes32[] calldata merkleProof ) payable external {
address user_ = msg.sender;
require(saleIsOpen, "Sale must be active to mint NFT");
require(msg.value == WHITELISTPRICE, "Ether value sent is not correct");
... | 7,808,044 |
./full_match/1/0x19bFC3E2De100908DB81C82fdB28205c3b96A4D4/sources/project_/contracts/ThePirateBay.sol | allows user to stake tokens and NFTs _nftIds ids of the NFTs to stake transfer tokens to contract transfer NFTs to contract | function stake(uint256[] calldata _nftIds) external whenNotPaused whenDepositOn nonReentrant {
require(_nftIds.length > 0, "Cannot stake 0 NFTs");
uint256 totalAmount = amountPerNFT * _nftIds.length;
Stake storage _stake = stakes[_msgSender()];
tokenAddress.transferFrom(_m... | 4,839,210 |
./partial_match/1/0xcB9134cFd5CA21FB5f593E6D891F219Bd9d24117/sources/BDODO.sol | set fee to zero if fees in contract are handled or exemptedcalculate feesend the fee to the contract | function _transfer(
address sender,
address recipient,
uint256 amount
) internal override {
require(amount > 0, "Transfer amount must be greater than zero");
require(!isearlybuyer[sender] && !isearlybuyer[recipient],
"You can't transfer tokens"
);
... | 9,377,018 |
pragma solidity ^0.4.18;
contract owned {
address public owner;
constructor() owned() internal {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwne... | Internal transfer, only can be called by this contract/ Prevent transfer to 0x0 address. Use burn() instead Check if the sender has enough Check for overflows Save this for an assertion in the future Subtract from the sender Add the same to the recipient Asserts are used to use static analysis to find bugs in your code... | function _transfer(address _from, address _to, uint _value) internal {
require(_to != 0x0);
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value > balanceOf[_to]);
uint previousBalances = balanceOf[_from] + balanceOf[_to];
balanceOf[_from] -= _value;
b... | 69,584 |
pragma solidity ^0.4.24;
/*
*
* Jackpot holding contract for Zlots.
*
* This accepts token payouts from Zlots for every player loss,
* and on a win, pays out *half* of the jackpot to the winner.
*
* Jackpot payout should only be called from Zlots.
*
*/
contract ZethrInterface {
function balanceOf(address who) pub... | Callable only by Zlots Pay a winner half of the jackpot Calculate payout & pay out Incremement the vars | function payOutWinner(address winner) onlyZlots {
uint payoutAmount = Zethr.balanceOf(address(this)) / 2;
Zethr.transfer(winner, payoutAmount);
payoutNumber += 1;
totalPaidOut += payoutAmount / 2;
emit JackpotPayout(payoutAmount / 2, winner, payoutNumber);
}
| 2,370,642 |
pragma solidity 0.4.24;
import {Whitelist_v0 as Whitelist} from "./Whitelist_v0.sol";
import "openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol";
import "openzeppelin-solidity/contracts/lifecycle/Pausable.sol";
import "openzeppelin-solidity/contracts/lifecycle/TokenDestructible.sol";
contract AssetTokenv0... | ----------- Whitelisted Methods -----------/ Transfer tokens from sender's address to another _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred/ | function transfer(address _to, uint256 _value)
public
noZeroTransfer(_value)
whenNotPaused()
onlyWhitelist(_to)
allowedByInvestorCap(_to)
returns (bool success)
{
bool toBalanceZero = balanceOf(_to) == 0;
super.transfer(_to, _value);
u... | 15,833,547 |
pragma solidity ^0.4.24;
contract PriceOracleInterface {
/**
* @notice Gets the price of a given asset
* @dev fetches the price of a given asset
* @param asset Asset to get the price of
* @return the price scaled by 10**18, or zero if the price is not available
*/
function assetPr... | discountedBorrowDenominatedCollateral = [supplyCurrent / (1 + liquidationDiscount)] (Oracle price for the collateral / Oracle price for the borrow)/ To avoid rounding issues, we re-order and group the operations so we do 1 division and only at the end [supplyCurrent (Oracle price for the collateral)] / [ (1 + liquida... | function calculateDiscountedBorrowDenominatedCollateral(Exp memory underwaterAssetPrice, Exp memory collateralPrice, uint supplyCurrent_TargetCollateralAsset) view internal returns (Error, uint) {
Error err;
Exp memory rawResult;
if (err != Error.NO_ERROR) {
return (err, 0);
... | 2,476,838 |
./full_match/43113/0xCf4fd60F9e1306027b72499bfD4f183253B44c99/sources/seedRound/seedRound.sol | totalamount[_beneficiary] = contribution; rewardTGE = 5 contribution / 100; _rewardTGE[_beneficiary] = rewardTGE; reward = contribution - rewardTGE ; _reward[_beneficiary] = reward; | function addBeneficiary(address [] memory _beneficiary ,uint[] memory contribution) public onlyOwner {
for(uint i=0; i < _beneficiary.length; i++){
totalamount[_beneficiary[i]] = contribution[i];
rewardTGE = 5 * contribution[i] / 100;
_rewardTGE[_beneficiary[i]] = rewardTGE;
... | 7,185,011 |
./full_match/43113/0x5d30AcB2897F113AB60F9De33cA6d669BbaC94Eb/sources/contracts/rise.sol | View the amount of dividend in wei that an address can withdraw. _owner The address of a token holder. return The amount of dividend in wei that `_owner` can withdraw. | function withdrawableDividendOf(address _owner) public view override returns (uint256) {
return accumulativeDividendOf(_owner).sub(withdrawnDividends[_owner]);
}
| 7,110,033 |
/**
*Submitted for verification at Etherscan.io on 2019-07-09
*/
pragma solidity ^0.4.23;
pragma solidity ^0.4.23;
pragma solidity ^0.4.23;
pragma solidity ^0.4.23;
pragma solidity ^0.4.23;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* func... | first 160 bits - not working on TRON. Cast to address is used instead of it.address seller = address(_parameter % 0x0010000000000000000000000000000000000000000); next 40 bits (shift right by 160 bits) check if auction is endeduint128 fee = _computeFee(uint128(msg.value));uint256 sellerValue = msg.value - fee; take firs... | function runSigned(uint40, uint256 _parameter, address /*_buyer*/)
external
payable
onlyPlugins
{
uint40 endTime = uint40(_parameter/0x0010000000000000000000000000000000000000000);
require(now <= endTime);
uint256 sellerValue = 96*msg.value / 100;
addres... | 10,806,012 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/[email protected]/governance/Governor.sol";
import "@openzeppelin/[email protected]/governance/extensions/GovernorProposalThreshold.sol";
import "@openzeppelin/[email protected]/governance/extensions/GovernorCountingSimple.sol";
import "@ope... | Amount of votes already cast passes the threshold limit./ Is the proposal successful or not./ Register a vote with a given support and voting weight. Note: Support is generic and can represent various things depending on the voting system used./ See {IGovernor-propose}./ | function _quorumReached(uint256 proposalId) internal view virtual returns (bool);
function _voteSucceeded(uint256 proposalId) internal view virtual returns (bool);
function _countVote(
uint256 proposalId,
address account,
uint8 support,
uint256 weight
) internal virtual... | 470,817 |
pragma solidity ^0.4.25;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this i... | Transfers ownership to new Ethereum address. This function can only be called by the owner. _newOwner the address to be granted ownership./ | function transferOwnership(address _newOwner) public onlyOwner {
require(_newOwner != 0x0);
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
| 1,795,269 |
pragma solidity ^0.6.0;
interface TokenInterface {
function approve(address, uint) external;
function transfer(address, uint) external;
function deposit() external payable;
function withdraw(uint) external;
function balanceOf(address) external view returns (uint);
}
interface ManagerLike {
fun... | Return Maker MCD DAI Address./ | function getMcdDai() internal pure returns (address) {
return 0x6B175474E89094C44Da98b954EedeAC495271d0F;
}
| 892,397 |
./full_match/5/0x46C9A4340ca50324010769C3069D1937229e3E80/sources/src/minter/FriendsAndFamilyMinter.sol | Mint Reset discount Lockup (optional) | function mint(
address recipient
) external onlyExistingDiscount(recipient) returns (uint256) {
uint256 pfpTokenId = ICre8ors(cre8orsNFT).adminMint(recipient, 1);
maxClaimedFree[recipient] += 1;
hasDiscount[recipient] = false;
ILockup lockup = ICre8ors(cre8orsNFT).locku... | 1,918,049 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.