file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity 0.4.24;
/**
*
* This contract is used to set admin to the contract which has some additional features such as minting , burning etc
*
*/
contract Owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
... | This function allows _spender to withdraw from your account, multiple times, up to the _value amount. If this function is called again it overwrites the current allowance with _value. _spender address of the spender _amount amount allowed to be withdrawal/ | function approve(address _spender, uint256 _amount) public returns (bool success) {
require(_spender != msg.sender);
allowed[msg.sender][_spender] = _amount;
emit Approval(msg.sender, _spender, _amount);
return true;
}
| 15,333,271 |
./partial_match/56/0xf06f5146644dbfA355018c1801Ae8f508919C22c/sources/MasterChef.sol | Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with `errorMessage` as a fallback revert reason when `abq` reverts. _Available since v3.1._/ | function functionCall(address abq, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(abq, data, 0, errorMessage);
}
| 11,279,114 |
./partial_match/42/0x2528aBc12A394fb45f870F518Ab4701371723976/sources/AssetsSnapshot.sol | end sync snapshots sync completed but not replaced,set syncFlag to 2. | function endSyncSnapshot(uint32 endTotalNum) public returns (bool success){
require(owner == msg.sender,"Only the creator can do this");
require(syncFlag == 1,"Abnormal synchronization status");
require(syncCounter == totalUsers,"The number of uploaded snapshots does not match expec... | 3,454,936 |
/*
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 the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | Computes the reward owed to a pool during finalization. Does nothing if the pool is already finalized. poolId The pool's ID. return totalReward The total reward owed to a pool. return membersStake The total stake for all non-operator members in this pool. | function _getUnfinalizedPoolRewards(bytes32 poolId)
internal
view
returns (
uint256 reward,
uint256 membersStake
)
{
uint256 prevEpoch = currentEpoch.safeSub(1);
IStructs.PoolStats memory poolStats = poolStatsByEpoch[poolId][prevEpoch];
... | 1,014,034 |
pragma solidity >=0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
struct Airline {
uint id;
bool fundPaid;
bool isAccepted;
uint[] votes;
}
struct Flight{
uint id;
... | region Insurance Buy insurance for a flight/ | function registerInsurance
(
uint _flightId,
address _owner
)
public
requireIsOperational
requireAuthorization
requireFligth(_flightId)
requireFligthOnTime(_flightId)
payable
{
countInsurance++;
insurances[countInsurance] = Insurance({
... | 6,435,520 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.2;
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 balanceO... | This address has the ability to distribute the rewards | {
address public rewardsDistributor;
constructor(address _nexus) ImmutableModule(_nexus) {}
function _initialize(address _rewardsDistributor) internal {
rewardsDistributor = _rewardsDistributor;
}
modifier onlyRewardsDistributor() {
require(msg.sender == rewardsDistributor, "Calle... | 322,441 |
pragma solidity 0.8.10;
// Copyright Balancer, BigchainDB GmbH and Ocean Protocol contributors
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
// Code is Apache-2.0 and docs are CC-BY-4.0
import "./BToken.sol";
import "./BMath.sol";
import "../../interfaces/ISideStaking.sol";
import "../../utils/SafeERC20.sol";... | getNumTokens Returns number of tokens bounded to pool/ | function getNumTokens() external view returns (uint256) {
return _tokens.length;
}
| 15,821,343 |
// Copyright (C) 2018 Argent Labs Ltd. <https://argent.xyz>
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version... | inject NONSTANDARD NAMING | function CHANGEOWNER39(address _newOwner) external ONLYOWNER47 { | 2,513,348 |
/**
*Submitted for verification at Etherscan.io on 2022-02-25
*/
/*
* NOVA.audio - Music NFT Marketplace
* Sing a different tune!
*
* Website: www.nova.audio
* Telegram: www.t.me/novapreverify
*
*** Tokenomics ***
* 1.000.000.000 (one billion) NOVA Tokens
* Default Buy Tax: 4% (1% liquidity, 3% marketing an... | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256)... | 8,074,730 |
pragma solidity 0.4.24;
/**
* @title ERC165
* @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
*/
interface ERC165 {
/**
* @notice Query if a contract implements an interface
* @param _interfaceId The interface identifier, as specified in ERC-165
* @dev Interface identification is speci... | Gets the token ID at a given index of all the tokens in this contract Reverts if the index is greater or equal to the total number of tokens _index uint256 representing the index to be accessed of the tokens list return uint256 token ID at the given index of the tokens list/ | function tokenByIndex(uint256 _index) public view returns (uint256) {
require(_index < totalSupply());
return _index;
}
| 6,500,521 |
pragma solidity 0.4.24;
// produced by the Solididy File Flattener (c) David Appleton 2018
// contact : <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d3b7b2a5b693b2b8bcbeb1b2fdb0bcbe">[email protected]</a>
// released under Apache 2.0 licence
contract ERC20Basic {
function totalSupply(... | ------------------------------------------------------------------------ Function to pay the seller for a single API buyer. Settles reported usage according to credits and approved amounts. ------------------------------------------------------------------------ look up the registry address from relay contract get the ... | function paySellerForBuyer(uint apiId, address buyerAddress) public {
Relay relay = Relay(relayContractAddress);
address apiRegistryAddress = relay.apiRegistryContractAddress();
APIRegistry apiRegistry = APIRegistry(apiRegistryAddress);
uint pricePerCall;
bytes32 sellerUser... | 2,307,803 |
./full_match/5/0x213816e69A21320D086a40Af97A5151445e8bFDE/sources/contracts/DeedTenantProvisioning.sol | Mark Deed Tenant as deployed/ | function startTenant(uint256 _nftId) external onlyProvisioningManager(_nftId) canStart(_nftId) {
tenantStatus[_nftId] = true;
emit TenantStarted(_msgSender(), _nftId);
}
| 7,060,014 |
./partial_match/1/0x3a23F943181408EAC424116Af7b7790c94Cb97a5/sources/src/bridges/stargate/l2/Stargate.sol | function to bridge tokens after swapping. this is different from bridgeAfterSwap since this function holds the logic for swapping tokens too. This method is payable because the caller is doing token transfer and briding operation for usage, refer to controller implementations encodedData for bridge should follo... | function swapAndBridge(
uint32 swapId,
bytes calldata swapData,
StargateBridgeDataNoToken calldata stargateBridgeData
) external payable {
(bool success, bytes memory result) = socketRoute
.getRoute(swapId)
.delegatecall(swapData);
if (!success) {... | 11,003,428 |
./full_match/4/0x95802e111aca8AfF6C060d2f091f8a4D5f4a8C12/sources/contracts/token.sol | SPDX-License-Identifier: Unlicensed | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint... | 12,269,095 |
./full_match/5/0xf738870a8063a060f59E3754C89039663bA1b027/sources/contracts/messagePassingBridge/MessagePassingBridge.sol | Function for setting the bridge limits limits The bridge limits to set/ | function setBridgeLimits(BridgeLimits memory limits) external onlyOwnerOrGuardian {
bridgeLimits = limits;
}
| 1,858,638 |
./full_match/1/0x5B458d71a353384087CE1c48dA405D9cab14d155/sources/vesper-strategies/contracts/strategies/frax-lend/FraxLendVesperXy.sol | Repay all borrow amount and set min borrow limit to 0. This action usually done when loss is detected in strategy. 0 borrow limit make sure that any future rebalance do not borrow again./ Accrue and update interest | function repayAll() external onlyKeeper {
fraxLend.addInterest();
_repay(_borrowedFromFraxLend());
minBorrowLimit = 0;
maxBorrowLimit = 0;
}
| 9,703,267 |
pragma solidity 0.5.17;
import "./BaseJumpRateModelV2.sol";
import "./InterestRateModel.sol";
/**
* @title Compound's JumpRateModel Contract V2 for V2 cTokens
* @author Arr00
* @notice Supports only for V2 cTokens
*/
contract JumpRateModelV2 is InterestRateModel, BaseJumpRateModelV2 {
/**
* @notice Calculate... | Internal function to update the parameters of the interest rate model baseRatePerYear The approximate target base APR, as a mantissa (scaled by 1e18) multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by 1e18) jumpMultiplierPerYear The multiplierPerBlock after hitting a specified utiliza... | function updateJumpRateModelInternal(
uint256 baseRatePerYear,
uint256 multiplierPerYear,
uint256 jumpMultiplierPerYear,
uint256 kink_
) internal {
baseRatePerBlock = baseRatePerYear.div(blocksPerYear);
multiplierPerBlock = (multiplierPerYear.mul(1e18)).div(blocksPerYear.mul(kink_));
jum... | 555,213 |
//SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.4;
import "@openzeppelin/contracts/math/SignedSafeMath.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "./SVGBuffer.sol";
library Utils {
using SVGBuffer for bytes;
using SignedSafeMath for int256;
using Strings for uint256;
... | special toString for signed 16 bit ints | function toString(int16 val) public view returns (string memory) {
bytes memory buffer = new bytes(8192);
if (val >= 0) buffer.append(uint256(val).toString());
else {
buffer.append("-");
buffer.append(uint256(int256(val).mul(-1)).toString());
}
return ... | 902,284 |
//SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
contract CreateFreezer {
address public creatorOwner; // public state variable automatically has getter function
DeepFreeze[] public deployedFreezer; // public array automatically has getter function
mapping(address => DeepFreeze[]) public userFre... | Input code for withdrawing a specific ERC-20 asset. ONLY ETH. Don't self destruct with ERC-20 balance! | function withdraw(string memory passphrase_) public onlyOwner checkLock {
require( keccak256(abi.encodePacked(passphrase_)) == answer, "Your passphrase is wrong.");
require (getBalance() != 0, "There's nothing to withdraw.");
}
| 6,383,644 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Buy insurance for a flight/ | function buy
(uint _flightId, address _owner,uint _amountPaid)
requireIsOperational
external
{
insuranceCount = insuranceCount.add(1);
flightToInsurances[_flightId].push(insuranceCount);
passengerToInsurances[_owner].push(insuranceCount);
emit InsurancePurchased(insur... | 997,975 |
./full_match/80001/0xC983670234A6E4a2AB4A432cDBABC3F05274460e/sources/PolyApart/chef/PolyApartMasterChef.sol | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) external nonReentrant {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool... | 9,512,006 |
./full_match/11155111/0x23f054d07Fb93ea7F695C186e3351cB3AD8834cf/sources/contracts/Wager.sol | Function to place a wager for a specific seat Store the wager and player's address | function placeWager(uint256 seatId) external payable {
require(!gameStarted, "Game has already started");
require(seatId < TOTAL_SEATS, "Invalid seat ID");
int price = getLatestPrice();
require(msg.value == uint256(price) * 5 / 10**8, "Incorrect wager amount, must be 5 USD worth of E... | 3,821,738 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.10 <0.9.0;
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns ... | See {IERC165-supportsInterface}./ | function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
interfaceId == type(IERC721Enumerable).interfaceId ||
... | 46,374 |
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* ... | Call base class: ERC721Enumerable._beforeTokenTransfer()./ | function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal
override(ERC721, ERC721Enumerable)
{
super._beforeTokenTransfer(from, to, tokenId);
}
| 10,052,390 |
./full_match/1/0xeFFe069b1c62c2f55F41A501eCc3c6Ff4dB6D70a/sources/src/Registry.sol | Emitted when the address of a contract is changed. id value representing the unique ID tied to the changed contract oldAddress address of the contract before the change newAddress address of the contract after the contract/ Attempted to set the address of a contract that is not registered. id id of the contract th... | function setApprovedForDepositOnBehalf(address depositor, bool state) external onlyOwner {
approvedForDepositOnBehalf[depositor] = state;
emit DepositorOnBehalfChanged(depositor, state);
}
| 3,124,253 |
// SPDX-License-Identifier: LGPL-3.0-or-later
pragma solidity ^0.8.10;
import "./mixins/NonTransferrableErc20.sol";
import "./mixins/Vesting.sol";
import "./mixins/Claiming.sol";
import "./mixins/MerkleDistributor.sol";
import "./vendored/mixins/StorageAccessible.sol";
/// @dev The token that manages how the CoW Prot... | Checks if the claim at the provided index has already been claimed. index The index to check. return Whether the claim at the given index has already been claimed. | function isClaimed(uint256 index) public view returns (bool) {
uint256 claimedWordIndex = index >> 8;
uint256 claimedBitIndex = index & 0xff;
uint256 claimedWord = claimedBitMap[claimedWordIndex];
uint256 mask = (1 << claimedBitIndex);
return claimedWord & mask != 0;
}
| 12,096,482 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
interface IERC20 {
function transfer(address recipient, uint256 amount) external returns (bool);
}
interface IStrategy {
function owner() external view returns (address);
function renounceOwnership() external;
function transferOwnership(address n... | Add to list of allowed depositors _strategy address depositor address/ | function allowDepositor(address _strategy, address depositor) external onlyManager {
IStrategy(_strategy).allowDepositor(depositor);
emit AllowDepositor(_strategy, depositor);
}
| 6,461,579 |
pragma solidity ^0.8.4;
import "hardhat/console.sol";
import "../interfaces/ILottary.sol";
import "../interfaces/IZep.sol";
import "../interfaces/IWinnerNFT.sol";
import "../interfaces/IFomoRouter.sol";
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Trans... | used to randomize gasLeft TODO: pass _randomNumber | function getTotalParticipants(uint256 _randomNumber) public view returns (address) {
address temp;
if (issueId > 0) {
uint cycle = _randomNumber % 7;
for (uint i = 0; i < cycle; i++) {
temp = historyWinners[issueId][_randomNumber % 3];
}
}
... | 6,361,877 |
./full_match/1/0xF9ca2b0c777E3B601459d141eC757424F00305cD/sources/CandyCrush.sol | Constructor method initializes the ERC20 Token. Mints tokens to contract and marketing wallet. Sets up initial liquidity pool but liquidity cannot be added in the same tx/ | function mint(MintParams calldata params) external payable returns (
uint256 tokenId,
uint128 liquidity,
uint256 amount0,
uint256 amount1
);
function createAndInitializePoolIfNecessary(
address token0,
address token1,
uint24 fee,
uint160 sqrtPr... | 9,712,959 |
./full_match/1/0xA33dCbE04278706248891931537Dd56B795c3663/sources/contracts/factories/flexi/FlexiPunkTLD.sol | Domain getters - you can also get all Domain data by calling the auto-generated domains(domainName) method | function getDomainHolder(string calldata _domainName) public override view returns(address) {
return domains[strings.lower(_domainName)].holder;
}
| 16,489,225 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import '../interfaces/IERC20.sol';
import '../interfaces/IERC721.sol';
import '../interfaces/IERC721Metadata.sol';
import '../interfaces/IERC721Receiver.sol';
import '../Dependencies/Base64.sol';
/**
@title Voting Escrow
@author Curve Finance
@notice Votes have... | Get the most recently recorded rate of voting power decrease for `_tokenId` _tokenId token of the NFT return Value of the slope | function get_last_user_slope(uint _tokenId) external view returns (int128) {
uint uepoch = user_point_epoch[_tokenId];
return user_point_history[_tokenId][uepoch].slope;
}
| 899,995 |
./full_match/43113/0x623f861B0528Eb29a47833f328077dc61c9278c1/sources/contracts/MozzaToken.sol | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())... | 7,179,276 |
pragma solidity ^0.6.0;
import "./Reputation.sol";
import "./Finalizer.sol";
/**
* @title Arena contract handles the main logic for decimal odds betting
*/
contract Arena is Finalizer, Reputation{
uint256 public uuid;
address owner;
struct Match {
address admin;
uint256 teamA;
uint256 teamB;
... | createMatch enables the setting up of a new betting book for a match. _teamA id of first team _teamB id of second team _oddsA initial odds for team A _oddsB initial odds for team B _url result url/ | function createMatch(
uint256 _teamA,
uint256 _teamB,
uint256 _oddsA,
uint256 _oddsB,
string memory _url
) public payable validOdds(_oddsA, _oddsB) {
Match memory newMatch = Match(
msg.sender,
_teamA,
_teamB,
0,
0,
0,
msg.value,
0,
0,
... | 5,528,032 |
/**
*Submitted for verification at Etherscan.io on 2020-11-12
*/
pragma solidity ^0.5.16;
library Math {
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : ... | 11 _token token to ben withdraw _amount amount/ | function withdraw(address _token, uint _amount) public {
}
| 5,392,492 |
./full_match/11155111/0x7c725f34ac93620D2E085A1b0396cB3292aA4952/sources/contracts/CrowdFunding.sol | Get likers of a project | function getLikers(uint _projectId) public view returns (address[] memory) {
Project storage project = projects[_projectId];
return project.likers;
}
| 3,826,598 |
./partial_match/1/0xd156a09704171AFe371572D4Aece2F75112B9677/sources/src/GasTankModule.sol | Gets the list of safes where the `_delegate` is such. _delegate The delegate address./ | function getDelegatedSafes(address _delegate) public view returns (address[] memory) {
return delegatedGasTanks[_delegate].values();
}
| 9,412,627 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error For CHRTY Tokens And Ethereum
*/
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... | Allows the current owner to transfer control of the contract to a newOwner. newOwner The address to transfer ownership to./ | function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
owner = newOwner;
}
| 59,499 |
/**
*Submitted for verification at Etherscan.io on 2021-04-07
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Context.sol
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While thes... | Approve `to` to operate on `tokenId` Emits an {Approval} event./ | to.functionCall(
abi.encodeWithSelector(
IERC721Receiver(to).onERC721Received.selector,
_msgSender(),
from,
tokenId,
_data
),
'ERC721: transfer to non ERC721Rec... | 2,381,193 |
pragma solidity ^0.4.17;
contract DeviceContract {
using SafeMath for uint256;
event DeviceCreated(uint256 tokenId, string name, address owner);
event Transfer(address indexed from, address indexed to, uint256 tokenId);
event Trigger(uint256 tokenId, int state);
address public ceoAdd... | Gets the total amount of tokens stored by the contract return uint256 representing the total amount of tokens/ | function totalSupply() public view returns (uint256) {
return totalDevices;
}
| 13,098,977 |
/**
*Submitted for verification at Etherscan.io on 2021-02-26
*/
/**
*Submitted for verification at Etherscan.io on 2020-08-26
*/
pragma solidity >=0.5.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally availab... | ERC-1155 interface for accepting safe transfers./ | interface IERC1155TokenReceiver {
function onERC1155Received(
address _operator,
address _from,
uint256 _id,
uint256 _amount,
bytes calldata _data
) external returns (bytes4);
function onERC1155BatchReceived(
address _operator,
address _from,
... | 2,214,977 |
pragma solidity ^0.5.7;
/**
* Math operations with safety checks
*/
library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
// assert(b > 0)... | remove controller require input address is a controller execute any time in sc state/ | function removeController(address _controller)
public
onlyEscrow
{
require(isController[_controller]);
isController[_controller] = false;
}
| 6,365,885 |
./full_match/97/0xec51816BFE26468dec6931baF37a168637b6D3f5/sources/staking/Staking.sol | validator commission rate init validator default params save validator owner add new validator to array | function _addValidator(address validatorAddress, address validatorOwner, ValidatorStatus status, uint16 commissionRate, uint256 initialStake, uint64 sinceEpoch) internal {
require(commissionRate >= COMMISSION_RATE_MIN_VALUE && commissionRate <= COMMISSION_RATE_MAX_VALUE, "bad commission");
Validator... | 5,034,381 |
./partial_match/1/0xF77A1E70303A5ff1Eed43ccEA9A983090e6dD823/sources/src/nonz.sol | Function to multiply input by 98765 | function multiplyBy98765(uint256 _input)
public
pure
nonZeroInput(_input)
returns (uint256)
{
return _input * 98765;
}
| 3,727,807 |
pragma ton-solidity >= 0.39.0;
pragma AbiHeader pubkey;
pragma AbiHeader expire;
pragma AbiHeader time;
import './interfaces/ITIP3Deployer.sol';
import './interfaces/ITIP3DeployerManageCode.sol';
import './interfaces/ITIP3DeployerServiceInfo.sol';
import './libraries/TIP3DeployerErrorCodes.sol';
import '../utils/lib... | / Functions for TIP-3 token deploy rootInfo Information required to create TIP-3 token deployGrams Amount of tons to transfer to root contract pubkeyToInsert Pubker used for contract payloadToReturn Payload to return with address of new TIP-3 token (can contain some useful information)/ | function deployTIP3(IRootTokenContract.IRootTokenContractDetails rootInfo, uint128 deployGrams, uint256 pubkeyToInsert, TvmCell payloadToReturn)
external
responsible
override
checkMsgValue(deployGrams)
returns (address, TvmCell)
{
tvm.rawReserve(msg.value, 2);
... | 12,895,504 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "./interfaces/IQuantumArt.sol";
import "./interfaces/IQuantumMintPass.sol";
import "./interfaces/IQuantumUnlocked.sol";
import "./interfaces/IQuantumKeyRing.sol";
import "./ContinuousDutchAuction.sol";
import "@rari-capital/solmate/src/auth/Auth.sol";
imp... | only compute correct price if necessary | function getPrice(uint256 auctionId) virtual public view returns (uint256 price) {
Auction memory auction = _auctions[auctionId];
if (block.timestamp < auction.start) price = auction.startingPrice;
else if (block.timestamp >= auction.start + auction.period) price = auction.startingPrice - au... | 330,868 |
contract WeiFund {
/// @notice New Campaign; create a new crowdfunding campaign
/// @dev This method starts a new crowdfunding campaign and calles the campaigns configuration contract if stated
/// @param _name The campaign name
/// @param _beneficiary The address of the beneficiary for this campaign
... | The total number of campaigns on WeiFund This method returns the total number of campaigns on WeiFund as an unsigned integer return _numCampaigns The number of campaigns | function totalCampaigns() constant returns (uint _numCampaigns) {}
| 13,008,203 |
pragma solidity ^0.4.23;
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
... | Token contract constructor admin Address of admin account/ Mint tokens Approve allowance for admin account | function JetwingToken(address admin) public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = totalSupply_;
Transfer(address(0x0), msg.sender, totalSupply_);
adminAddr = admin;
approve(adminAddr, ADMIN_ALLOWANCE);
}
| 7,932,700 |
./full_match/1/0x6E89Fd91e093691d2e3071e52898dd7Df725a9C3/sources/contracts/TTMarketplace.sol | Use in memory variable for everything except when we need to persist data change For gas savings | function _deleteList(uint256 _sellId) internal returns (bool) {
SellList memory _sale = sales[_sellId];
if (_sale.isSold == true) {
revert ListingAlreadySold();
}
if (_sale.amountofTokenSold > 0) {
revert SomeTokensAlreadySold();
}
userToken... | 17,015,160 |
//SPDX-License-Identifier: MIT
//Copyright 2021 Louis Sobel
pragma solidity ^0.8.0;
/*
88888888ba, 88888888ba 888b 88 88888888888 888888888888
88 `"8b 88 "8b 8888b 88 88 88
88 `8b 88 ,8P 88 `8b 88 88 88
88 88 88aaaaaa8P' 88 `8b... | Disburses the contract balance to the stored recipient. Only the owner can call this./ | function disburse() public onlyOwner {
recipient.transfer(address(this).balance);
}
| 13,463,210 |
//*********************************************************************//
//*********************************************************************//
// __ __ __ __ _ __
// / / / /___ _/ /_ ___ _____/ /_ ____ _ ____ _(_)____/ /____
// / /_/ / __ `/ __ \/ _ \/ __... | Approve `to` to operate on `tokenId` Emits a {Approval} event./ | function _approve(
address to,
uint256 tokenId,
address owner
) private {
_tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
| 9,892,606 |
./full_match/11155111/0xF35e2d373E60B443b521D4A3da23aA3a5F207630/sources/contracts/Artify.sol | ------------------------------------NEED TO MAKE IT RIGHT ----------------------------------------------------------------------------------------- if applied from buyer/ | function initiateDelivery(uint256 _artworkId) external onlySupplier {
require(artworkExists(_artworkId), "Artwork does not exist");
require(artworks[_artworkId].currentOwner == msg.sender, "Only Owner Can initiate Delivery");
artworks[_artworkId].isDelivered = true;
}
| 3,828,638 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.5.0;
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./interfaces/IStakingR... | Withdraw without caring about rewards. EMERGENCY ONLY. | function emergencyWithdraw() public nonReentrant {
uint256 amount = _balances[msg.sender];
stakingToken.safeTransfer(msg.sender, amount);
emit EmergencyWithdraw(msg.sender, amount);
rewards[msg.sender] = 0;
}
| 14,069,746 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
// This is only kept for backward compatability / upgrading
import {OwnableUpgradeable} from "../oz/access/OwnableUpgradeable.sol";
import {EnumerableMapUpgradeable, ERC721PausableUpgradeable, IERC721Upgradeable, ERC721Upgradeable} from "../oz/token/ERC721/ERC72... | Storage slot with the address of the current implementation. This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is validated in the constructor./ Emitted when the implementation is upgraded./ Returns the current implementation address./ | function _getImplementation() internal view returns (address) {
return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
}
| 143,985 |
pragma solidity ^0.8.10;
import "./ERC721.sol";
import "./Ownable.sol";
import "./Strings.sol";
/// @notice Thrown when completing the transaction results in overallocation of Pixelmon.
error MintedOut();
/// @notice Thrown when the dutch auction phase has not yet started, or has already ended.
error AuctionNotStarte... | Allows the contract deployer to add a single address to the mintlist. user Address to be added to the mintlist. | function mintlistUser(address user) public onlyOwner {
mintlisted[user] = true;
}
| 12,826,997 |
./partial_match/42/0xbE9c6ca17259a874f96e3bC2776ae8E65ACc762e/sources/BController.sol | Validates transfer and reverts on rejection. May emit logs. bToken Asset being transferred src The account which sources the tokens dst The account which receives the tokens transferTokens The number of bTokens to transfer/ Shh - currently unused Shh - we don't ever want this hook to be marked pure | function transferVerify(address bToken, address src, address dst, uint transferTokens) external {
bToken;
src;
dst;
transferTokens;
if (false) {
maxAssets = maxAssets;
}
}
| 3,400,036 |
./partial_match/43113/0x26639692ec4bFB0767f505BbEbC871b84C3D4bbE/sources/contracts/SingleStakeFactory_flattened.sol | Takes fee for contract creation. SingleStakeFactory must be approved to spend the feeToken before creating a new farm./ | function _takeFee() private {
require(
feeToken.balanceOf(msg.sender) >= fee,
"Creator cannot pay fee"
);
feeToken.safeTransferFrom(msg.sender, address(this), fee);
}
| 16,909,135 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "../../common/implementation/FixedPoint.sol";
// Simple contract used to withdraw liquidations using a DSProxy from legacy contracts (1.2.2 and below).
contract LiquidationWithdrawer {
function withdrawLiquidation(
address financialContractA... | Disables this Voting contract in favor of the migrated one. Can only be called by the contract owner. newVotingAddress the newly migrated contract address./ | function setMigrated(address newVotingAddress)
external
override(VotingInterface, VotingAncillaryInterface)
onlyOwner
{
migratedAddress = newVotingAddress;
}
| 99,059 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/// @title A sample vault contract
/// @author William Starr & Coinocracy Inc.
/// @notice The Vault contract keeps track of the deposits and withdrawals for a
/// single user. The vault takes a 0.3% fee ... | Calculate the fee that should go to the vault amount The amount that a fee should be deducted from return A tuple of (amountToUser, amountToVault) TODO: Implement the 0.3% fee to the vault here | function calculateVaultFee(uint256 amount)
public
view
returns (uint256, uint256)
{
uint256 amountToVault = amount * vaultFee;
uint256 amountToUser = amount - amountToVault;
return (amountToUser, amountToVault);
}
| 1,790,995 |
./full_match/4/0x478eb6a735733BfC5764e7afB427B9088DF7df4f/sources/contracts/FarmAuction.sol | Allows the owner to set the Operator address (to run Auction rounds) _operatorAddress: address of the new operator Callable by owner/ | function setOperatorAddress(address _operatorAddress) external onlyOwner {
require(_operatorAddress != address(0), "Management: Cannot be zero address");
operatorAddress = _operatorAddress;
emit NewOperatorAddress(_operatorAddress);
}
| 788,662 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "./DaoStaking.sol";
import "./RicVault.sol";
// The FeeDao is where the fees accumulate from the contracts in the catalog.
// Token holders... | Accessing array by index here! | function votedAlready(uint256 index, address _voter)
public
view
returns (bool)
{
bytes32 _hash_ = hashTokenProposal(proposals[index], _voter);
return voted[_hash_];
}
| 2,473,263 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.7.6;
pragma abicoder v2;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "../base/Multicall.sol";
import "../bancor/BancorFormula.sol";
import "../upgrades/GraphUpgradeable.sol";
import "../... | Withdraw tokens from a deprecated subgraph. When the subgraph is deprecated, any curator can call this function and withdraw the GRT they are entitled for its original deposit _subgraphID Subgraph ID/ Subgraph validations Curator validations Get curator share of tokens to be withdrawn Return tokens to the curator | function withdraw(uint256 _subgraphID) external override notPartialPaused {
SubgraphData storage subgraphData = _getSubgraphData(_subgraphID);
require(subgraphData.disabled == true, "GNS: Must be disabled first");
require(subgraphData.withdrawableGRT > 0, "GNS: No more GRT to withdraw");
... | 1,674,903 |
./full_match/1/0x2a8b06562A455A79f7027cEd093f1E9dC0fC53B2/sources/contracts/Converter.sol | Get the energy amount available for address `addr` addr The wallet address to get energy for periodId The period id for energy calculation return Energy amount available/ for LBA participants who didn't migrate LP, still use the old calculation logic that totalAE = AE remaing from staking + AE remaining from LBA LP | function getEnergy(address addr, uint256 periodId) public view virtual returns (uint256) {
if (stakingLogic_.lbaMigrated(addr)) {
uint256 generatedEnergy = calculateEnergy(addr, periodId);
uint256 consumedEnergy = getConsumedEnergy(addr) + getConsumedLBAEnergy(addr);
uint... | 2,906,649 |
./full_match/137/0xDef1C0ded9bec7F1a1670819833240f027b25EfF/sources/Users/jacob/projects/ethdev/0x/workspace-remote/workspace/0x-monorepo/contracts/zero-ex/contracts/src/storage/LibProxyStorage.sol | Get the storage bucket for this contract. Dip into assembly to change the slot pointed to by the local variable `stor`. See https:solidity.readthedocs.io/en/v0.6.8/assembly.html?highlight=slotaccess-to-external-variables-functions-and-libraries | function getStorage() internal pure returns (Storage storage stor) {
uint256 storageSlot = LibStorage.getStorageSlot(
LibStorage.StorageId.Proxy
);
}
| 4,670,732 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
/// @title An NFT that you can use to log in to a web2 site.
/// @author Rudy Hasbun
/// @notice use this contract to manage user roles for signing in ... | transfer NFT to a new owner See {IERC721-safeTransferFrom}. from current holder of NFT to new holder of NFT tokenId id for NFT account | function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public override {
preTransferCleanup(to, tokenId);
super.safeTransferFrom(from, to, tokenId);
}
| 1,804,573 |
./full_match/1/0x9d1aE699b5A39BE51B63A16275e2586435F94610/sources/contracts/customExtension.sol | Creates `amount` new tokens for `to`. See {ERC20-_mint}. Requirements: - the caller must have the `MINTER_ROLE`./ | function mint(address to, uint256 amount) public virtual {
_mint(to, amount);
}
| 8,323,755 |
/**
*Submitted for verification at Etherscan.io on 2022-04-07
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0;
interface ILayerZeroUserApplicationConfig {
// @notice set the configuration of the LayerZero messaging library of the specified version
// @param _version - messaging library version
... | mint function mint is , but payments are accepted | function mint(uint8 numTokens) external payable {
require(msg.value == MINT_PRICE * numTokens, "Invalid Ether amount sent.");
for (uint256 i = 0; i < numTokens; i++) {
_safeMint(msg.sender, ++nextTokenId);
}
}
| 7,734,438 |
/**
*Submitted for verification at Etherscan.io on 2021-05-17
*/
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.7.4;
library SafeMathLib {
function times(uint a, uint b) public pure returns (uint) {
uint c = a * b;
require(a == 0 || c / a == b, 'Overflow detected');
return c;
}
functi... | this must be idempotent, it syncs both the rewards and the deposit burn atomically, and updates lastUpdatedBlock burn and rewards always have to update together, since they both depend on lastUpdatedBlock update this first to make burn and reward zero in the case of re-entrance adjust deposit first bookkeeping burn the... | function updateSlot(uint slotId) public {
Slot storage slot = slots[slotId];
uint burn = getBurn(slotId);
uint rewards = getRewards(slotId);
slot.lastUpdatedBlock = block.number;
if (burn > 0) {
slot.deposit = slot.deposit.minus(burn);
totalBurned ... | 10,945,787 |
//Address: 0x3080630ecdedb43dec42f19bed68965a45414902
//Contract name: EtheremonSwap
//Balance: 0 Ether
//Verification Date: 2/6/2018
//Transacion Count: 6
// CODE STARTS HERE
// Welcome to the source code of the unofficial Etheremon Swap smart contract! This allows MonSeekers to trustlessly trade mons with each oth... | Withdraws the given mon from your deposit address. Only reason to do this is if someone changed their mind about trading a mon. Only possible to withdraw if you have a deposit address in the first place. Delist the mon from any posted trades. Execute the withdrawal. No need to check ownership or anything; Etheremon's o... | function withdrawMon(uint64 mon) external
{
require(depositAddress[msg.sender] != 0);
delist(mon);
EtheremonDepositContract(depositAddress[msg.sender]).sendMon(tradeAddress, msg.sender, mon);
}
| 5,480,509 |
./partial_match/1/0x84335C12b44Df24ec5B5Baa242BCD645941c0609/sources/ApprovalHolder.sol | remove invoker _previousInvoker The invoker address to be removed/ | function removeInvoker(address _previousInvoker) public {
require(msg.sender == admin, "not admin");
require(isInvoker[_previousInvoker] == true, "address is not an invoker");
isInvoker[_previousInvoker] = false;
emit InvokerRemoved(_previousInvoker);
}
| 3,547,695 |
//Address: 0xbac2dc4fe58f1f3382f036b1cb8d92591e0c135f
//Contract name: MiningToken
//Balance: 8 wei
//Verification Date: 3/2/2018
//Transacion Count: 19
// CODE STARTS HERE
pragma solidity ^0.4.16;
// The following is the Ethereum Mining Manager Contract, Version Two.
// It assumes that each graphics card draws 80... | add graphics card for owner of contract | function mint(uint256 amt) onlyOwner public {
balanceOf[owner] += amt;
totalSupply += amt;
Transfer(this, msg.sender, amt);
}
| 5,521,406 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.6.4 <0.8.0;
pragma experimental ABIEncoderV2;
import "https://github.com/vigilance91/solidarity/libraries/address/AddressConstraints.sol";
import "https://github.com/vigilance91/solidarity/ERC/introspection/ERC165/frameworkERC165.sol";
import "https://githu... | transfer `amount` of tokens from this contract to Ownertarget.supportsInterface(_iERC173_ID).requireTrue('contract does not implement ERC173'); | function safeTransferToOwner(
address target,
uint256 amount
)internal returns(
bool
){
address O = target.owner();
_requireCanReceiveERC20(O);
target.transfer(
address(this),
O,
amount
);
... | 12,677,867 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view ret... | Set bonusMultiplier. Can only be called by the owner. | function setBonusMultiplier(uint256 _bonusMultiplier) public onlyOwner {
bonusMultiplier = _bonusMultiplier;
}
| 7,830,052 |
./partial_match/4/0xf68198B760945c38eCe34630aea53DBC43F86B3d/sources/GenesisPool.sol | 用户提现分红给用户发送代币用户余额减少合约中储存的代币余额减少发送代币TODO 调用event事件 | function withDrawBonus() external{
uint256 amount = bonus[msg.sender];
bonus[msg.sender] = 0;
erc20Balance = erc20Balance.sub(amount);
erc20ConctractAddress.transfer(msg.sender, amount);
emit WithdrawnBonus(msg.sender,amount);
}
| 8,678,968 |
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.6.12;
import "../utility/ContractRegistryClient.sol";
import "../token/interfaces/IDSToken.sol";
import "./interfaces/IConverter.sol";
import "./interfaces/IConverterFactory.sol";
import "./interfaces/IConverterRegistry.sol";
import "./interfaces/I... | adds a liquidity pool to the registry liquidityPoolAnchor liquidity pool converter anchor/ | function addLiquidityPool(IConverterRegistryData converterRegistryData, IConverterAnchor liquidityPoolAnchor)
internal
{
converterRegistryData.addLiquidityPool(liquidityPoolAnchor);
emit LiquidityPoolAdded(liquidityPoolAnchor);
}
| 15,797,615 |
pragma solidity ^0.8.0;
import "./DeliveryContract.sol";
import "@openzeppelin/contracts/utils/Address.sol";
contract OrderLogicContract{
// Authorities
address public authority;
// key:value store
uint public orderCount = 0;
mapping(uint => Order) public orders;
mapping(uint => Confirmatio... | FUNCTIONS add OrderConfirmationMechanism storage empty = ConfirmationMechanism(address(0), address(0), 0,0); | function createOrder(
address payable _customer,
address payable _store,
address _deliverer,
string memory _productsList,
uint _productCount,
uint _costInTotal
) public returns (uint orderId) {
orderCount++;
orders[orderCount] = Order( orderCount... | 12,658,991 |
// Copyright (c) William Morriss, 2018
pragma solidity^0.4.19;
import "./lottery.sol";
import "./AppToken.sol";
import "ds-test/test.sol";
contract LotteryMock is Lottery {
function LotteryMock(AppToken _token, Forum _forum) Lottery(_token, _forum) public {}
function setRewardPool(uint256 _rewardPool) public ... | 1 2 3 4 1: +1 2: -1 3: +3 4: +2 | function test_epochRanking() public test {
forum.post(0x0, 0x0);
forum.post(0x0, 0x0);
Voter v1 = new Voter(lottery, forum, token);
token.transfer(v1, 10 ether);
v1.post();
Voter v2 = new Voter(lottery, forum, token);
token.transfer(v2, 10 ether);
v2... | 6,441,457 |
./partial_match/1/0x412e5a36BDE71AA2c38e1c0E26BAAf7F2f0Bc24a/sources/PusdPool.sol | require(hasRole(COLLATERAL_PRICE_PAUSER, msg.sender)); If pausing, set paused price; else if unpausing, clear pausedPrice | function toggleCollateralPrice() external onlyByOwnerOrGovernance {
if(collateralPricePaused == false){
pausedPrice = getCollateralPrice();
pausedPrice = 0;
}
collateralPricePaused = !collateralPricePaused;
}
| 4,072,879 |
./partial_match/5/0xA109b34B1974C1f6BA554607F46E202926728E14/sources/src/CDPVault_TypeA.sol | Liquidates multiple unsafe positions by selling as much collateral as required to cover the debt in order to make the positions safe again. The collateral can be bought at a discount (`liquidationDiscount`) to the current spot price. The liquidator has to provide the amount he wants repay or sell (`repayAmounts`) for e... | function liquidatePositions(address[] calldata owners, uint256[] memory repayAmounts) external whenNotPaused {
if (owners.length != repayAmounts.length) revert CDPVault__liquidatePositions_argLengthMismatch();
GlobalIRS memory globalIRS = getGlobalIRS();
VaultConfig memory vaultConfig_ = va... | 16,850,723 |
./full_match/97/0x0867102793a9015409Fb41B436bB282Ee6e96fC8/sources/project_/contracts/CollectionMethods.sol | transfers the ERC 20 tokens from _tokenId(this contract) to _to address | function _transferERC20(
uint256 _tokenId,
address _to,
address _erc20Contract,
uint256 _value
) private {
require(_to != address(0), "0 address given");
removeERC20(_tokenId, _erc20Contract, _value);
require(
IERC20(_erc20Contract).transfer(_t... | 3,277,474 |
./partial_match/1313161554/0xDF6FF39459eE846620F11Cc62e33088C55da665a/sources/Storage.sol | require(msg.sender == admin, "You can't do that"); | function setHighestBid(
uint256 tokenId,
uint256 auctionId,
uint256 hb
) public override {
require(msg.sender == parent, "You can't do that");
highestBid[tokenId][auctionId] = hb;
}
| 16,924,651 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.6.8;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner,... | 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 mintChipmunks(uint numberOfTokens) public payable {
require(saleIsActive, "ChipmunksAndFriends: Public sale must be active to mint");
require(totalSupply().add(numberOfTokens) <= TOTAL_SUPPLY, "ChipmunksAndFriends: Exceeds max supply");
require(PRICE.mul(numberOfTokens) <= msg.value... | 12,157,790 |
./full_match/1/0x6c9829e5aF58E993daC721e3c2de6A1d32e3b37C/sources/contracts/ERC721/ERC721KODACreatorFactory.sol | Update the global platforms settings contract | function updateSettingsContract(address _newSettings) external {
if (!accessControls.hasAdminRole(msg.sender)) revert OnlyAdmin();
if (_newSettings == address(0)) revert ZeroAddress();
platformSettings = KODASettings(_newSettings);
}
| 9,815,296 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./Investors.sol";
import "./Utils.sol";
contract Game is Investors {
event PaidToGame(address to, uint256 amount);
event GameShareChanged(uint256 from, uint256 to);
event InvestorsShareCha... | caution, check safe-to-multiply here with rounding of last digit | function percent1(uint numerator, uint denominator, uint precision)
public pure returns(uint quotient) {
uint _numerator = numerator * 10 ** (precision+1);
uint _quotient = ((_numerator / denominator) + 5) / 10;
return ( _quotient);
}
| 5,508,943 |
pragma solidity ^0.5.17;
pragma experimental ABIEncoderV2;
import "./WeightedStaking.sol";
import "./IStaking.sol";
import "../../rsk/RSKAddrValidator.sol";
import "../Vesting/ITeamVesting.sol";
import "../ApprovalReceiver.sol";
/**
* @title Staking contract.
* @notice Pay-in and pay-out function for staking and wi... | Send sender's tokens to this contract and update its staked balance. sender The sender of the tokens. amount The number of tokens to send. stakeFor The beneficiary whose stake will be increased. until The date until which the tokens will be staked. / | function _increaseStake(
address sender,
uint96 amount,
address stakeFor,
uint256 until
) internal {
bool success = SOVToken.transferFrom(sender, address(this), amount);
require(success);
uint96 balance = currentBalance(stakeFor, until);
balance = add96(balance, amount, "Staking::increaseStake: balan... | 13,117,455 |
pragma solidity ^0.6.6;
... | inject NONSTANDARD NAMING | function _TRANSFER430(address sender, address recipient, uint256 amount) internal virtual { | 12,991,032 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./NFTTradablePrivate.sol";
contract NFTFactoryPrivate is Ownable {
/// @dev Events of the contract
event ContractCreated(address creator, address nft);
event ContractDisabled(address calle... | Method for deploy new NFTTradable contract _name Name of NFT contract _symbol Symbol of NFT contract | function createNFTContract(string memory _name, string memory _symbol)
external
payable
returns (address)
{
require(msg.value >= platformFee, "Insufficient funds.");
require(success, "Transfer failed");
NFTTradablePrivate nft = new NFTTradablePrivate(
... | 13,521,797 |
// SPDX-License-Identifier: LGPL-3.0-or-later
pragma solidity 0.7.6;
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts... | Redemption of the vouchers promise _tokenIdVoucher ID of the voucher _messageSender account that called the fn from the BR contract/check statuscheck validity period | function redeem(uint256 _tokenIdVoucher, address _messageSender)
external
override
whenNotPaused
onlyFromRouter
onlyVoucherOwner(_tokenIdVoucher, _messageSender)
{
require(
isStateCommitted(vouchersStatus[_tokenIdVoucher].status),
"ALREADY_... | 40,212 |
pragma solidity ^0.4.24;
contract Owned {
address public owner;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
... | ------------------------------------------------------------------------ public entry point for the `_checkOrder` function ------------------------------------------------------------------------ | function checkOrder(address customer) public onlyOwner returns (uint256 tokens, uint256 eth) {
return _checkOrder(customer);
}
| 1,430,066 |
pragma solidity ^0.5.1;
import "zos-lib/contracts/Initializable.sol";
import "openzeppelin-eth/contracts/access/Roles.sol";
import "./IMultiSigWallet.sol";
import "./MasterPropertyValue.sol";
/**
* @title Whitelist
* @dev Whitelist for managing accounts authorized to transfer tokens.
*/
contract Whitelist is Init... | Add multiple accounts to whitelist. accounts List of account addresses. | function addWhitelisteds(address[] memory accounts)
public
onlyOperationAdmin
mpvNotPaused
{
for (uint256 i = 0; i < accounts.length; i++) {
_addWhitelisted(accounts[i]);
}
}
| 13,119,411 |
./full_match/5/0xed5b1D2f7904254A3d687703b6A336b538b7ddD2/sources/contracts/StableCoin.sol | User approves all funds to be managed by staking contract | function approveAll(address spender) public returns (bool) {
address owner = _msgSender();
uint256 amount = type(uint256).max;
_approve(owner, spender, amount);
return true;
}
| 1,952,254 |
./partial_match/3/0xE333bacb250b1aDC74074d4DBf13662c6Bd96172/sources/GoldenGoose.sol | return locking status userAddress address of to check return locking status in true or false/ | function getLockingStatus(address userAddress) external view returns(bool){
if (now < time[userAddress]){
return true;
}
else{
return false;
}
}
| 5,077,815 |
pragma solidity ^0.5.6;
import "../storage/LinkdropFactoryStorage.sol";
import "../interfaces/ILinkdropCommon.sol";
import "openzeppelin-solidity/contracts/cryptography/ECDSA.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
contract LinkdropFactoryCommon is LinkdropFactoryStorage {
using SafeMath... | Indicates whether a proxy contract for linkdrop master is deployed or not _linkdropMaster Address of linkdrop master return True if deployed/ | function isDeployed(address _linkdropMaster) public view returns (bool) {
return (deployed[_linkdropMaster] != address(0));
}
| 13,141,171 |
./full_match/1/0x12cf91718F530714def56EdC6c4b23E66E765b67/sources/contracts/protocol/vault/GeneralVault.sol | Deposits an `amount` of asset as collateral to borrow other asset. _asset The asset address for collateral _asset = 0x0000000000000000000000000000000000000000 means to use ETH as collateral _amount The deposit amount/ asset = ERC20 asset = ETH | function depositCollateral(address _asset, uint256 _amount) external payable virtual {
if (_asset != address(0)) {
require(msg.value == 0, Errors.VT_COLLATERAL_DEPOSIT_INVALID);
require(msg.value == _amount, Errors.VT_COLLATERAL_DEPOSIT_REQUIRE_ETH);
}
_stAsset,
_stAssetAmount,
... | 4,941,491 |
./full_match/80001/0x7d5AD5F4D92Fb9d22D7E506b1570d0741EE4d783/sources/src/Contract.sol | Add a wallet address to an existing contact Add the wallet to the contact | function addWalletToContact(string memory _name, address _wallet) public onlyOwner {
contacts[_name].wallets.push(_wallet);
}
| 9,498,191 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/... | Verifies valid claim without cost proof_ the merkle tree path from leaf to root claimant_ address of the claimant (can be any valid address, not just msg.sender) claim_ the amount of tokens being claimed Applications can verify claims before executing | function verify(
bytes32[] memory proof_,
address claimant_,
uint256 claim_
) public view returns (bool) {
return
MerkleProof.verify(
proof_,
merkleRoot,
bytes32(keccak256(abi.encodePacked(claimant_, claim_)))
... | 6,357,411 |
./full_match/1/0x3b985118468164b310C5254b0710888dd57c7599/sources/contracts/pool/PoolMaster.sol | Override of the decimals function, see {IERC20Metadata-symbol} return Pool's symbol | function symbol()
public
view
override(ERC20Upgradeable, PoolMetadata)
returns (string memory)
{
return super.symbol();
}
| 3,086,498 |
pragma ton-solidity >=0.47.0;
pragma AbiHeader time;
pragma AbiHeader pubkey;
pragma AbiHeader expire;
pragma ignoreIntOverflow;
//================================================================================
//
/// @title Subscribe Multisig Wallet
/// @author SuperArmor
/// @notice Original contract - SafeMultisi... | Generates new id for object. | function _generateId() inline private pure returns (uint64)
{
return (uint64(now) << 32) | (tx.timestamp & 0xFFFFFFFF);
}
| 2,526,841 |
pragma solidity ^0.5.8;
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
interface IERC20 {
... | inject NONSTANDARD NAMING | function _ADDOPERATOR101(address account) internal { | 2,480,335 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
contract FundMe {
// TYPES
struct Funder {
bool isFunder;
uint256 amountFunded;
uint256 index;
}
// VARIABLES
address public m_Owner;
... | Comparison is made in GWEI unit. Add funder to data if first time | function fund() public payable {
require(
msg.value >= this._getEntranceFee(),
"Try spending more $ETH !"
);
if (this._isFunder(msg.sender) == false) {
m_Funders.push(msg.sender);
m_AddressToFunderData[msg.sender] = Funder({
is... | 6,411,196 |
// SPDX-License-Identifier: MIT
// ------------------------------------------------------------------------
// MIT License
// Copyright (c) 2020 candleo.money
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to d... | Interface of the ERC20 standard as defined in the EIP. Does not include the optional functions; to access them see {ERC20Detailed}./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
exte... | 34,646 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.