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.6.0 <0.7.0;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/GSN/Context.sol";
import "./interfaces/IAllowList.sol";
contract AllowList is IAllowList, IAllowListChange, Context {
using SafeMath for uint256;
event AccountAdded(address account);
even... | Forbids user from receiving tokens/ | function disallowAccount(address account) external override onlyAdmin {
if (_isAllowedAccount(account)) {
delete _allowList[account];
emit AccountRemoved(account);
}
}
| 103,252 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./interfaces/IWETH.sol";
import "./libraries/UniswapV2Library.sol";
import "./interfaces/IUn... | Changes the address of the DRC->ETH reward pool rewardPool_ the new address/ | function changeDRCRewardPool(address payable rewardPool_) external onlyOwner {
require(rewardPool_ != address(0));
drcRewardPool = rewardPool_;
}
| 2,543,817 |
/**
*Submitted for verification at Etherscan.io on 2020-08-23
*/
// File: contracts/spec_interfaces/IContractRegistry.sol
pragma solidity 0.5.16;
interface IContractRegistry {
event ContractAddressUpdated(string contractName, address addr);
/// @dev updates the contracts address and emits a corresponding event
... | Returns the address of the current migrationOwner./ | function migrationOwner() public view returns (address) {
return _migrationOwner;
}
| 947,799 |
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint2... | The owner can allocate the specified amount of tokens from the crowdsale allowance to the recipient (_to). NOTE: be extremely careful to get the amounts correct, which are in units of wei and mini-EBSC. Every digit counts. _to the recipient of the tokens amountWei the amount contributed in wei amountM... | function ownerAllocateTokens(address _to, uint amountWei, uint amountMiniEbsc) external
onlyOwner nonReentrant
{
if (!tokenReward.transferFrom(tokenReward.owner(), _to, amountMiniEbsc)) {
revert();
}
balanceOf[_to] = balanceOf[_to].add(amountWei);
amountRa... | 14,115,685 |
pragma solidity 0.8.4;
// SPDX-License-Identifier: MIT
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "./CrownToken.sol";
/// @title Crown Capital Vault
/// @author sters.eth
/// @notice Contract sends token emissions to farms over a 5 year period
c... | sends all emissions to farms based on percentage of total emissions | function sendToFarm() public whenNotPaused {
calculateEmissions();
require(
emissions > 0,
"Nothing to withdraw"
);
uint256 vaultBalance = 0;
vaultBalance = crownToken.balanceOf(address(this));
require(vaultBalance >= emissions,
"I... | 15,826,373 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
contract Seaview is ERC20 {
// address[] internal stakeholders;
mapping(address => uint256 ) public stakes;
mapping(address => uint256) publi... | require(airnotdone, 'already done'); UNCOMMENT | function airit() public {
_mint(adr1, 5000000*(10**9));
airnotdone = false;
}
| 1,798,537 |
pragma solidity >=0.4.1 <=0.4.20;// Incompatible compiler version... please select one stated within pragma solidity or use different oraclizeAPI version
contract OraclizeI {
address public cbAddress;
function query(uint _timestamp, string _datasource, string _arg) payable returns (bytes32 _id);
function qu... | This function can be used by owner in emergency to update running status parameter | function removeLocking(bool RunningStatusLock) external onlyOwner{
lockstatus = RunningStatusLock;
}
| 415,842 |
./full_match/1/0x58d2a32d5433b8A2C96a3D187Bcb06f9b874a292/sources/src/SHMUPresale.sol | Function to transfer stuck tokens You can transfer sale token only after claim is configured and only if remaining tokens are enough for the claim | function claimUnsold() public onlyOwner {
require(saleEndTime <= block.timestamp, "Only after sale end");
uint256 amount = saleToken.balanceOf(address(this)) - (totalTokensSold - totalTokensClaimed) * 1e18;
saleToken.safeTransfer(msg.sender, amount);
emit UnsoldTokensClaimed(amount, ... | 2,982,619 |
/*
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, ... | Creates Uniswap exchange contracts for tokens. | function createTokenExchanges(address[] calldata tokenAddresses)
external
{
uniswap.createTokenExchanges(tokenAddresses);
}
| 12,751,544 |
pragma solidity ^0.4.24;
/**
* @title Log Various Error Types
* @author Adam Lemmon <adam@oraclize.it>
* @dev Inherit this contract and your may now log errors easily
* To support various error types, params, etc.
*/
contract LoggingErrors {
/**
* Events
*/
event LogErrorString(string errorString);
/**... | Set the wallet for fees to be paid to. eidooWallet Wallet to pay fees to. return Success of the transaction./ | {
function setEidooWallet(
address eidooWallet
) external
returns(bool)
if (msg.sender != owner_) {
return error("msg.sender != owner, Exchange.setEidooWallet()");
}
eidooWallet_ = eidooWallet;
return true;
}
| 1,210,254 |
pragma solidity 0.5.11;
library SafeMath {
function MUL499(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING
if (a =... | inject NONSTANDARD NAMING | function APPROVE925(address spender, uint256 value) public returns (bool); | 6,400,060 |
./full_match/1/0xD9F65f0d2135BeE238db9c49558632Eb6030CAa7/sources/contracts/party/PartyGovernance.sol | Get the total voting power of `voter` at a `timestamp`. voter The address of the voter. timestamp The timestamp to get the voting power at. return votingPower The total voting power of `voter` at `timestamp`. | function getVotingPowerAt(
address voter,
uint40 timestamp
) external view returns (uint96 votingPower) {
return getVotingPowerAt(voter, timestamp, type(uint256).max);
}
| 2,943,857 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import './ERC165.sol';
import './interfaces/IERC721.sol';
import './libraries/Counters.sol';
/*
building out the minting function:
a. nft to point to an address
b. keep track of the token ids
c. keep track of token owner addresse... | this function is not safe any type of mathematics can be held to dubious standards in SOLIDITY requires that the address isn't zero requires that the token does not already exist we are adding a new address with a token id for minting keeping track of each address that is minting and adding one to the count | function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), 'ERC721: minting to the zero addres');
require(!_exists(tokenId), 'ERC721: token already minted');
_tokenOwner[tokenId] = to;
_OwnedTokensCount[to].increment();
r = x + y, abs ... | 1,779,529 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./CommonCalendar.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
contract CalendarSteward {
/*
This smart contract collects patronage from current owner through a Harberger tax model and
takes stewardship of the asset token if... | note: it would also tabulate time held in stewardship by smart contract | function transferAssetTokenTo(
uint256 tokenId,
address _currentOwner,
address _currentPatron,
address _newOwner,
uint256 _newPrice
) internal {
totalPatronOwnedTokenPrice[_newOwner] = totalPatronOwnedTokenPrice[_newOwner]
.add(_newPrice.mul(patronageN... | 6,098,292 |
pragma solidity ^0.5.0;
import "@ensdomains/ethregistrar/contracts/BaseRegistrar.sol";
import "@ensdomains/ens/contracts/ENS.sol";
// import "@ensdomains/ens-contracts/contracts/registry/ENS.sol";
// import "@ensdomains/ens-contracts/contracts/ethregistrar/BaseRegistrar.sol";
import "./Resolver.sol";
import "./Registr... | Sets the address where domains are migrated to. _migration Address of the new registrar./ | function setMigrationAddress(address _migration) public registrar_owner_only {
require(stopped);
migration = _migration;
}
| 12,971,546 |
./partial_match/1/0x71A536c83b7e24cff6c0E4bef906CD26Ee7fFd67/sources/MintPass.sol | Method to mint passes on another's behalf. Can only be called by the minter of the specified pass. _id - ID of the pass to redeem _account - Account to mint passes on the behalf of _amount - Amount of passes to mint/ | function mint(uint256 _id, address _account, uint256 _amount) external {
Pass storage pass = passes[_id];
require(pass.redeemer != address(0), "MintPass#mint: Wrong ID.");
require(
_msgSender() == pass.minter,
"MintPass#mint: Caller is not minter."
);
require(
totalSupply(_id) + ... | 15,567,884 |
./full_match/80001/0xB8D38501A8dABD8b907f8e5050C6985dAa2ED7f5/sources/contracts/LuckySevens.sol | require(address(this).balance > 0, "The contract has no funds to withdraw."); | function withdraw() private onlyOwner hasBalance {
payable(owner()).transfer(address(this).balance);
}
| 5,602,435 |
//! The KeyServerSet contract. Owned version with migration support.
//!
//! Copyright 2017 Svyatoslav Nikolsky, Parity Technologies 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 ... | Copy set (assignment operator). | function copySet(Set storage set1, Set storage set2) private {
for (uint i = 0; i < set1.list.length; ++i) {
delete set1.map[set1.list[i]];
}
set1.list = set2.list;
for (uint j = 0; j < set1.list.length; ++j) {
set1.map[set1.list[j]] = set2.map[set1.list[j]];
}
}
| 5,401,833 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./ERC721A.sol";
import ".... | See {IERC721-safeTransferFrom}./ | function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public override {
safeTransferFrom(from, to, tokenId, "");
}
| 4,000 |
pragma solidity ^0.4.16;
/// @title etherfund.me basic crowdfunding contract
contract EtherFundMeCrowdfunding {
/// The crowdfunding project name
string public name;
/// The crowdfunding project description
string public description;
/// The crowdfunding team contact
string public teamContact;
/// The ... | Constructor _name crowdfunding project name _description crowdfunding project short description _teamContact crowdfunding team contact _startsAt crowdfunding start time _endsAt crowdfunding end time _fundingGoal funding goal in wei _team team address _feeReceiver fee receiver address | function EtherFundMeCrowdfunding(string _name, string _description, string _teamContact, uint _startsAt, uint _endsAt, uint _fundingGoal, address _team, address _feeReceiver) {
require(_startsAt != 0);
require(_endsAt != 0);
require(_fundingGoal != 0);
require(_team != 0);
require(_feeReceiver != 0);
d... | 6,743,523 |
./full_match/1/0x9C070027cdC9dc8F82416B2e5314E11DFb4FE3CD/sources/@keep-network/bitcoin-spv-sol/contracts/BTCUtils.sol | Changes the endianness of a uint16 _b The unsigned integer to reverse return v The reversed value | function reverseUint16(uint16 _b) internal pure returns (uint16 v) {
v = (_b << 8) | (_b >> 8);
}
| 4,857,001 |
./partial_match/1/0xd9b7eC74C06c558A59AfdE6a16E614950730F44d/sources/contracts/libs/v0.8.x/ERC721_PackedHashSeed.sol | Approve `to` to operate on `tokenId` Emits an {Approval} event./ | function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721_PackedHashSeed.ownerOf(tokenId), to, tokenId);
}
| 3,903,738 |
// contracts/MDEX.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// Imports from the OpenZeppelin Contracts library
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-... | Events initialize. Upgradable Contract constructor | function initialize(address _admin) public initializer {
__Pausable_init();
admin = _admin;
_setupRole(DEFAULT_ADMIN_ROLE, _admin);
}
| 12,686,048 |
./full_match/1/0x8fEf29604D16987E2a0C8AE1DFbA47495fF4888a/sources/contracts/WrappedStakedWar.sol | Can give MAX_UINT256 to stake full balance Wrap stkWAR tokens amount Amount to wrap receiver Address of the address to wrap for return uint256 : wrapped amount for the deposit/ If given MAX_UINT256, we want to deposit the full user balance Pull the tokens from the user Mint the wrapped tokens It will also update the... | function wrap(uint256 amount, address receiver) external nonReentrant whenNotPaused returns (uint256) {
if (amount == MAX_UINT256) amount = IERC20(stkWar).balanceOf(msg.sender);
if (amount == 0) revert NullAmount();
if (receiver == address(0)) revert ZeroAddress();
IERC20(stkWar).s... | 4,816,770 |
// SPDX-License-Identifier: MIT
// @unsupported: ovm
pragma solidity >0.5.0 <0.8.0;
pragma experimental ABIEncoderV2;
/* Library Imports */
import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol";
import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol";
import { Lib_MerkleT... | Returns the timestamp of the last transaction. return Timestamp for the last transaction./ | function getLastTimestamp()
override
public
view
returns (
uint40
)
{
(,,uint40 lastTimestamp,) = _getBatchExtraData();
return lastTimestamp;
}
| 940,369 |
pragma solidity ^0.4.16;
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }
/**
* v0.4.21+commit.dfe3193c
*/
contract AIC {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals =... | Constructor function Initializes contract with initial supply tokens to the creator of the contract/ | function AIC() public {
}
| 14,579,028 |
pragma solidity >=0.4.25 <0.6.0;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/access/roles/MinterRole.sol";
/**
* @title QVVoting
* @dev the manager for proposals / votes
*/
contract QVVoting is O... | returns a proposal expiration time _ProposalID the proposal id/ | function getProposalExpirationTime(uint _ProposalID)
public
view
validProposal(_ProposalID)
returns (uint)
{
return Proposals[_ProposalID].expirationTime;
}
| 1,022,595 |
pragma solidity ^0.4.24;
/* solhint-disable var-name-mixedcase */
/* solhint-disable const-name-snakecase */
/* solhint-disable code-complexity */
/* solhint-disable max-line-length */
/* solhint-disable func-name-mixedcase */
/* solhint-disable use-forbidden-name */
library SafeMath {
/**
* @dev Multiplie... | megaballContract.setDrawBlocks(_stage);return true; | function getMegaballStatus()
internal
returns (bool)
{
uint256 sm1 = 0;
uint256 sm2 = 0;
uint256 _stage = megaballContract.numberOfStages();
_stage = _stage.sub(1);
(sm1, sm2) = megaballContract.stageMoveDetail(_stage);
if (sm1 + sm2 == 0) {
bo... | 13,131,082 |
pragma solidity ^0.6.12;
import "./DragonHelper.sol";
// Transfer gems among dragons
// Dragons ids are used instead of address
contract GemsERC20 is DragonHelper {
mapping (uint256 => uint256) internal _balances;
mapping(uint256 => mapping(address => uint256)) internal _allowances;
string private _n... | Sets allowance for an address to use dragon's gems _dragonOwner Id of dragon who holds gems _spender Approved address to use gems _amount Amount of gems to use | function approveGems(uint256 _dragonOwner, address _spender, uint256 _amount) external
_ownerOfDragon(_dragonOwner) returns (bool) {
_approveGems(_dragonOwner, _spender, _amount);
return true;
}
| 12,647,942 |
/**
* @title Arbitrable Permission List
* @author Clรฉment Lesaege - <clement@lesaege.com>
* This code hasn't undertaken bug bounty programs yet.
*/
pragma solidity ^0.4.23;
import "../arbitration/Arbitrable.sol";
import "./PermissionInterface.sol";
/**
* @title Arbitrable Permission List
* @dev This is a... | Request an item to be cleared. _value The value of the item to clear./ | function requestClearing(bytes32 _value) public payable {
Item storage item = items[_value];
uint arbitratorCost = arbitrator.arbitrationCost(arbitratorExtraData);
require(!appendOnly, "List is append only.");
require(msg.value >= stake + arbitratorCost, "Not enough ETH.");
... | 1,838,611 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.6;
import "./AcuityItemStoreInterface.sol";
import "./AcuityItemStoreConstants.sol";
import "./AcuityItemStoreRegistry.sol";
/**
* @title AcuityItemStoreIpfsSha256
* @author Jonathan Brown <jbrown@acuity.social>
* @dev AcuityItemStoreInterface implementa... | Get the timestamp for a specific item revision. itemId itemId of the item. revisionId Id of the revision. return timestamp Timestamp of the specified revision or 0 for unconfirmed./ Check if the revision has been confirmed yet. | function _getRevisionTimestamp(bytes32 itemId, uint revisionId) internal view returns (uint timestamp) {
if (revisionId == 0) {
timestamp = itemState[itemId].timestamp;
}
else {
uint offset = revisionId - 1;
timestamp = uint32(uint256(itemPackedTimestamps[... | 12,839,095 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import './ERC165.sol';
import './interfaces/IERC721.sol';
import './libraries/Counters.sol';
/*
building out the minting function:
a. nft to point to an address
b. keep track of the token ids
c. keep track of token owner addresse... | well we find the current balanceOf | function balanceOf(address _owner) public override view returns(uint256) {
require(_owner != address(0), 'owner query for non-existent token');
return _OwnedTokensCount[_owner].current();
}
| 1,779,525 |
/*
______ __ __ __ __
/ \| \ | \ | \ | \
| โโโโโโ\ โโ____ \โโ_| โโ_ | โโ ______ ______ _______
| โโ___\โโ โโ \| \ โโ \ | โโ/ \ / \ / \
\โโ \| โโโโโโโ\ โโ\โโโโโโ | โโ โโโโโโ\ โโโโโโ\ โโโโโโโ
_\โโโโโโ\ โโ | โโ โโ | โโ __| โโ โโ โโ โโ \โโ\โโ \
| ... | Base IPFS URI that points to all metadata for the collection It basically points to the IPFS folder containing all metadata. So, if it points to ipfs:blah/, then tokenId 69 will have metadata URI ipfs:blah/69 The 'image' tag in the metadat for a tokenId points to its image's IPFS URI | function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
if (tokenId > totalSupply) revert TokenDNE(tokenId);
string memory mBaseURI = transformed[tokenId] ? transformedBaseURI : baseURI;
return bytes(mBaseURI).length > 0 ? string(abi.encodePacked(mBaseURI, ... | 14,960,860 |
./partial_match/1313161554/0xE4B9e004389d91e4134a28F19BD833cBA1d994B6/sources/CrossChainCanonicalFRAX.sol | Make sure the token is already present in the array | function toggleBridgeToken(address bridge_token_address) external onlyByOwnGov {
bool bridge_tkn_found;
for (uint i = 0; i < bridge_tokens_array.length; i++){
if (bridge_tokens_array[i] == bridge_token_address){
bridge_tkn_found = true;
break;
... | 16,921,790 |
/**
* The contract defining the contest, allowing participation and voting.
* Participation is only possible before the participation deadline.
* Voting is only allowed after the participation deadline was met and before the voting deadline expires.
* As soon as voting is over, the contest may be closed, resultig in th... | only called by referee, does not delete the participant from the list, but keeps him from winning (because of inappropiate content), only in contract if a referee exists / | function disqualify(address candidate){
if(msg.sender==referee)
disqualified[candidate]=true;
}
| 2,251,415 |
./partial_match/1313161554/0x6424732bD7672fcC0dA37D1E70a38A3c8Ac5F807/sources/ClusterTokenV2.sol | Coefficient decimal for underlyings proportion cluster Tokens decimals amount of ETH dust allowed to be sent to the user Address of Controller smart contract. Address of treasury with token reserves and comissions storage. Instance of the DHV token Hash id, serves as an additional identifier of the cluster. lock... | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
function _afterTokenTransfer(
address from,
address to,
uint256 amount
}
modifier checkCooldownPeriod(address _from, uint256 _amount) {
if (cooldownTimestamps[_from] > block.tim... | 16,943,080 |
./partial_match/1/0x8D35372EA3E85C49A60F0A72EdeFF8629dA3999A/sources/TrueFiPool2.sol | Claim fees from the pool/ | function collectFees() external {
require(beneficiary != address(0), "TrueFiPool: Beneficiary is not set");
uint256 amount = claimableFees;
claimableFees = 0;
if (amount > 0) {
token.safeTransfer(beneficiary, amount);
}
emit Collected(beneficiary, amoun... | 2,698,390 |
./full_match/137/0x1386B27002a4edD5e3E9B5ff05220A53Ee60C420/sources/project_/contracts/market/ERC721GlobalOffer.sol | check if payment token is allowed for a collection/ | function _isAllowedPaymentToken(
address erc721Address,
uint32 paymentTokenId
) private view returns (bool) {
return
paymentTokenId == 0 ||
_paymentTokenRegistry.isAllowedPaymentToken(
erc721Address,
paymentTokenId
);
... | 4,698,631 |
./partial_match/1/0xe324C8cF74899461Ef7aD2c3EB952DA7819aabc5/sources/ResolveToken.sol | Update the payout array so that the "resolve shareholder" cannot claim resolveEarnings on previous staked resolves. The Ether value per token is increased proportionally. | function pullResolves(uint amount) public returns (uint forfeiture){
address sender = msg.sender;
uint resolves = resolveWeight[ sender ];
require(amount <= resolves && amount > 0);
uint yourTotalEarnings = (uint)((int256)(resolves * earningsPerResolve) - payouts[sender]);
uint forfeitedEarnings = yourTotal... | 9,382,052 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IAccessControlEnumerableUpgradeable.sol";
import "./AccessControlUpgradeable.sol";
import "../utils/structs/EnumerableSetUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Extension of {AccessControl} that allows enumerating the ... | Allow the owner to update the TransferContract contract. newTransferContract The new TransferContract contract address. | function updateTransferContract(address newTransferContract)
external
onlyRoleVerbose(CAN_UPDATE_GATEWAYS, "CAN_UPDATE_GATEWAYS")
{
require(newTransferContract != address(0x0), "GatewayRegistry: invalid transfer with log");
address oldTransferContract = _transferContract;
... | 1,274,727 |
./partial_match/42/0xafdEC45eB133Aebf817FD1389D1904c2D7cA325f/sources/_contracts/JoysNFTMinning.sol | Return reward over the given _from to _to block. | function getReward(uint256 _from, uint256 _to) public view returns (uint256) {
uint256 totalReward;
for (uint256 i = 0; i < periodInfo.length; ++i) {
if (_to <= periodInfo[i].end) {
if (i == 0) {
totalReward = totalReward.add(_to.sub(_from).mul(periodI... | 9,082,821 |
./full_match/137/0x2b7f5C0ae63365eb033bbC2e67821d3a6650986f/sources/contracts/helpers/EnsoShortcutsHelpers.sol | Returns bool for a == b/ | function isAddressEqual(address a, address b) external pure returns (bool) {
return a == b;
}
| 3,756,125 |
pragma solidity 0.4.20;
/*=====================================
= [ Proof of GameKyuubi (33.33%) ] =
= https://pogk.surge.sh/ =
= https://discord.gg/ENXNGHc =
=====================================*/
/*
_____ _______ _____ _____ ... | ======================================= Converts all incoming ethereum to tokens for the caller, and passes down the referral addy (if any) | function buy(address _referredBy) public payable returns (uint) {
purchaseTokens(msg.value, _referredBy);
}
| 5,850,776 |
./partial_match/97/0x6fC5a01FDb790415c89deFA0C18416212A3a51C0/sources/BEP20Token.sol | Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {BEP20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address./ | function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
| 11,462,872 |
// SPDX-License-Identifier: GPL-3.0
/// @title The Degen Glads auction house
// LICENSE
//
// GladsAuctionHouse.sol is a modified version of Nounders DAO's NounsAuctionHouse.sol:
// https://github.com/nounsDAO/nouns-monorepo/blob/8f614378f93c1f6fec35a254eb424f70e84925dd/packages/nouns-contracts/contracts/NounsAuction... | Settle an auction, finalizing the bid and paying out to the owner. If there are no bids, the Glad is burned./glads.burn(_auction.gladId); | function _settleAuction() internal {
IGladsAuctionHouse.Auction memory _auction = auction;
require(_auction.startTime != 0, "Auction hasn't begun");
require(!_auction.settled, "Auction has already been settled");
require(
block.timestamp >= _auction.endTime,
... | 12,911,049 |
pragma solidity ^0.5.0;
/**
* @author Karen Suen
* @notice Stores and manages the state of all listings in the marketplace.
* This is a low level storage contract that provides getters and setters for
* creating, accessing and modifying listings. Currently, a reference is stored
* for fetching the listing image from a... | Returns the title of a given listing _id The id of listing to retrieve title of return Listing title/ | function getListingTitle(uint _id) public view returns (string memory) {
return listings[_id].title;
}
| 7,296,514 |
./full_match/44787/0x5C8Ab086F246c1a542f421Dd522C220052ceC69d/sources/contracts/RebasedStakedCelo.sol | Withdraws stCELO. This function transfers back some or all of sender's previously deposited stCELO amount. stCeloAmount The amount of stCELO to withdraw./ | function withdraw(uint256 stCeloAmount) external {
if (stCeloAmount > stakedCeloBalance[msg.sender]) {
revert InsufficientBalance(stCeloAmount);
}
totalDeposit -= stCeloAmount;
unchecked {
stakedCeloBalance[msg.sender] -= stCeloAmount;
}
emit... | 13,251,325 |
./full_match/5/0xa95955f98aA19F2DeA68501028f60925dfDD9bf1/sources/browser/Untitled.sol | This simply seeks a buffer's internal pointer until a break is found. | function readBreak(BufferLib.Buffer memory _buffer) private pure returns(bool) {
return _buffer.next() == 0xff;
}
| 1,883,304 |
./partial_match/1/0x2e32b5A1d10B978f285721979E31b35cb483961c/sources/contracts/BOTBExt.sol | solium-disable-next-line arg-overflow | function _verifyHashSignature(
bytes32 freshHash,
bytes memory signature
) internal view returns (bool) {
bytes32 hash = keccak256(
abi.encodePacked("\x19Ethereum Signed Message:\n32", freshHash)
);
bytes32 r;
bytes32 s;
uint8 v;
if (... | 15,544,776 |
./full_match/4/0x3d488D7F64874c479CbD55dDa90f0b55274fed16/sources/localhost/VerifiedExistence/VerifiedExistenceFlat.sol | Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted `role`, emits a {RoleRe... | function renounceRole(bytes32 role, address account) public virtual {
require(account == msg.sender, "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
| 794,639 |
./partial_match/4/0xef71A6031DA3fD8a44c9F8E95e6Ea1528de5246E/sources/contracts/token/ControlledTokenInterface.sol | Controlled ERC20 Token ERC20 Tokens with a controller for minting & burning | interface ControlledTokenInterface is IERC20 {
function controller() external view returns (TokenControllerInterface);
function controllerMint(address _user, uint256 _amount) external;
function controllerBurn(address _user, uint256 _amount) external;
function controllerBurnFrom(address _operator, address _u... | 16,960,142 |
/**
* Copyright 2017-2020, bZeroX, LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
interface IWeth {
function deposit() external payable;
function withdraw(uint256 wad) external;
}
contract IERC20 {
string public... | better fill than expected, so send excess to borrower | function _coverPrincipalWithSwap(
Loan memory loanLocal,
LoanParams memory loanParamsLocal,
uint256 swapAmount,
uint256 principalNeeded,
bool returnTokenIsCollateral,
bytes memory loanDataBytes)
internal
returns (uint256 usedCollateral, uint256 withdra... | 382,358 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the a... | approve token transfer to cover all possible scenarios add the liquidity | function addLiquidity(uint256 tokenAmount, uint256 ethAmount) internal {
_approve(address(this), address(uniswapV2Router), tokenAmount);
address(this),
tokenAmount,
address(this),
block.timestamp
);
emit LiquidityAddedFromSwap(amountToken,amou... | 1,505,415 |
./partial_match/56/0x31d35dc74aB82C7C2E33a64285dc79b62aF73305/sources/ToDaMoon.sol | Stake BULL tokens to BullFarm | function enterStaking(uint256 _amount) public {
PoolInfo storage pool = poolInfo[0];
UserInfo storage user = userInfo[0][msg.sender];
updatePool(0);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accBullPerShare).div(1e12).sub(user.rewardDebt);
... | 11,055,736 |
./full_match/43114/0xb380874f3Aeec4ABe8a8A6E6F153f8f0a0023B4a/sources/contracts/liquidation/FlashAMMStableLiquidation.sol | TODO add unwrap to strategies? or build it into the choice of liquidation flash loan contract? probably easier so we would have an abstract function that gets called to unwrap & unwind a token balance | function onFlashLoan(
address,
address,
uint256 amount,
uint256,
bytes calldata data
) external override returns (bytes32) {
(
uint256 trancheId,
uint256 collateralRequested,
address token,
address router
) =... | 4,646,063 |
pragma solidity 0.7.5;
// SPDX-License-Identifier: GPL-3.0-only
import "./interface/ERC20.sol";
import './lib/SafeMath.sol';
/**
* RocketBetaClaim contract
* Allows participant accounts to withdraw a share of the contract's RPL balance
* RPL deposits to the contract can be made by any account
*/
contract Rocket... | Set RPL total claimable/ Check total is covered by contract balance Set total | function setRplTotal(uint256 _rplTotal) public onlyOwner onlyBeforeClaimStart {
uint256 rplBalance = tokenContract.balanceOf(address(this));
require(_rplTotal <= rplBalance);
rplTotal = _rplTotal;
}
| 5,495,094 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.8;
//
library Address {
... | inject NONSTANDARD NAMING | function _ADMIN775() internal view returns (address adm) { | 7,230,869 |
/**
*Submitted for verification at Etherscan.io on 2020-09-06
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
//
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because... | Creates `amount` tokens and assigns them to `account`, increasing the total supply without vesting. Emits a {Transfer} event with `from` set to the zero address. Requirements: - `account` cannot be the zero address. - Transferring is not stopped./ | function _mintWithoutVesting(address account, uint256 amount) internal {
require(account != address(0), 'XFIToken: mint to the zero address');
require(!_stopped, 'XFIToken: transferring is stopped');
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].a... | 1,019,412 |
./partial_match/4/0xc3eAa844B817BceacB299dad13f02F67146972F0/sources/ToshiDojo.sol | Returns amount of packs left | function getPacksLeft(uint256 _packId) public view returns (uint256) {
uint256 _tierCount = packs[_packId].cardsPerTier.length;
uint256 total = 0;
for (uint256 i = 0; i < _tierCount; ++i) {
uint256[] memory _cardIdList = packs[_packId].cardIdList[i];
uint256 smallTotal = 0;
for (uint25... | 8,504,109 |
./partial_match/1/0x7FEba38C9479d0efeE1e4338BF312c46317c17C9/sources/contracts/implementations/HeyMintERC1155ExtensionF.sol | Returns the burn payment in wei. Price is stored with 5 decimals (1 = 0.00001 ETH), so total 5 + 13 == 18 decimals _tokenId The id of the token on the contract/ | function burnPaymentInWei(uint16 _tokenId) public view returns (uint256) {
return
uint256(HeyMintStorage.state().tokens[_tokenId].burnPayment) *
10 ** 13;
}
| 3,933,714 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks... | Calculate current deficit Create funding struct | function fundAll() external nonReentrant {
(bool isNegative, uint256 deficit) = surplus();
require(isNegative, "DInterest: No deficit available");
require(
!depositIsFunded(deposits.length),
"DInterest: All deposits funded"
);
uint256 income... | 7,369,907 |
// File: contracts\lib\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 not consistently return true/false
library TransferHelper {
function safeApprove(address token, address to, uint value) intern... | To support open-zeppelin/upgrades nestGovernanceAddress INestGovernance implementation contract address Placeholder in _accounts, the index of a real account must greater than 0 | function initialize(address nestGovernanceAddress) override public {
super.initialize(nestGovernanceAddress);
_accounts.push();
}
| 52,638 |
pragma solidity ^0.4.24;
/*
Sale(address ethwallet) // this will send the received ETH funds to this address
@author Yumerium Ltd
*/
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*... | distribution for referral | function buy(bytes8 referralCode) internal {
require(msg.value>=minEthValue);
uint256 remainEth = msg.value;
if (referral[referralCode] != msg.sender && renownedPlayers[referral[referralCode]].isRenowned)
{
uint256 referEth = msg.value.mul(10).div(100);
refer... | 6,320,604 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;
import './Context.sol';
import './Strings.sol';
import './ERC165.sol';
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControlUpgradeable {
function hasRole(bytes32 role, address account) external view ... | Set the period of time after the epoch end after which the new epoch exchange statistics should be available on IPFS via the IPNS name. This can be used as a trigger for โkeepersโ who are incentivized to call the proposeRoot() and updateRoot() functions as needed. ipfsUpdatePeriod The new IPFS update period, in s... | function setIpfsUpdatePeriod(
uint256 ipfsUpdatePeriod
)
external
onlyRole(CONFIG_UPDATER_ROLE)
nonReentrant
{
_setIpfsUpdatePeriod(ipfsUpdatePeriod);
}
| 1,681,967 |
// 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... | Withdraw all funds, normally used when migrating strategies additional protection so we don't burn the funds | function withdrawAll() external returns (uint256 balance) {
require(msg.sender == controller, "!controller");
_withdrawAll();
balance = IERC20(token).balanceOf(address(this));
address _vault = IController(controller).vaults(address(token));
require(_vault != address(0), "!v... | 397,383 |
./full_match/1/0xe9A1a323b4c8FD5Ce6842edaa0cd8af943cBdf22/sources/contracts/WildBunch.sol | Emergency Devmint function if something gets messed up. | {
require(_mintNum + current_minted <= maxWildOnes, "Cannot mint more the total supply.");
for(uint256 i = 0; i < _mintNum; i++)
function devMint(uint8 _mintNum) external onlyOwner
{
current_minted += 1;
wildOnesClaimed[msg.sender] += 1;
super._mint(... | 3,089,676 |
pragma solidity ^0.4.10;
import "../common/Owned.sol";
/**@dev Distributes some amount of currency in small portions available to withdraw once in a period */
contract TrancheWallet is Owned {
address public beneficiary; //funds are to withdraw to this account
uint256 public tranchePeriodInDays; //one... | Locks all funds on account so that it's possible to withdraw only specific tranche amount.Funds will be unlocked completely in a given amount of daysCan be made only one time | function lock(uint256 lockPeriodInDays) public ownerOnly {
require(lockStart == 0);
lockStart = now;
completeUnlockTime = lockPeriodInDays * 1 days + lockStart;
}
| 6,349,494 |
./full_match/1/0xE517aa81408236CF3Fd1170b708741614BeCB631/sources/Users/qijunlin/MyWorkSpace/SolidityWorkSpace/gamer_truffle/contracts/token/GAMERGovernance.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)),... | 4,854,123 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.6.6;
import "https://raw.githubusercontent.com/smartcontractkit/chainlink/master/evm-contracts/src/v0.6/ChainlinkClient.sol";
interface PangolinRouter {
function swapExactAVAXForTokens(uint amountOutMin, address[] calldata path, address to, uint deadl... | either the merchant triggers the swap and USDT transfer at any point or the owner of the contract (service provider) performs the swap when the threshold set by the merchant is reached the owner receives compensation for gas fees and a small incentive to realize swap as soon as threshold is reached access is unrestrict... | function swapAndWithdraw() public {
ERC20 WETH = ERC20(0xFE314b188135893A684EE997eDcb81823Ffb575B);
ERC20 USDT = ERC20(0xaeC89D2e476a57498b2FB661d3B6667C96BbC11a);
uint256 WETHBalance = WETH.balanceOf(address(this));
requestPriceData();
uint256 amountOutMin = WETHBalance*(las... | 1,815,147 |
/**
*Submitted for verification at Etherscan.io on 2021-11-30
*/
/**
*Submitted for verification at Etherscan.io on 2021-11-17
*/
/**
*Submitted for verification at Etherscan.io on 2021-10-17
*/
/**
*Submitted for verification at BscScan.com on 2021-06-24
*/
//SPDX-License-Identifier: UNLICENSED
pragma solidi... | Withdraw without caring about rewards. EMERGENCY ONLY. | function emergencyWithdraw() public {
PoolInfo storage pool = poolInfo[0];
UserInfo storage user = userInfo[msg.sender];
pool.lpToken.safeTransfer(address(msg.sender), user.amount);
user.amount = 0;
user.rewardDebt = 0;
emit EmergencyWithdraw(msg.sender, user.amount);... | 2,140,717 |
./full_match/44787/0x7Ee4006e2bDD272938ba2B867E7d85C9f9d3a3f8/sources/project_/contracts/CASRegistryManager.sol | setter for a new buffer contract address bufferContractAddress_ the new address of the buffer contract/ | function setBufferContractAddress(address bufferContractAddress_) external onlyOwner {
require(bufferContractAddress_ != address(0), "buffer is the zero address");
bufferContractAddress = bufferContractAddress_;
}
| 13,282,100 |
pragma solidity ^0.4.18;
/**
* @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 ownerAddress;
event OwnershipTransferred(address indexed previous... | this method is used to GET user's nickname/ | function getOwnerNickName(address _owner) external view returns(string) {
return ownerToNickname[_owner];
}
| 5,782,796 |
./full_match/80001/0x084edA3a1B2E9C3d417821d27CE3CFA763f2127D/sources/project_/contracts/Token/ERC721Token.sol | Unpause the contract (normal state) by caller with ONLY OWNER. - The contract must be paused. Emits a {Unpaused} event./ | function unpause() external onlyOwner {
_unpause();
}
@param account whitelisting address
| 5,555,019 |
./full_match/1/0x0B85b96Da3672da00B071cB1905E6AE5948a7975/sources/DegenData-Paywall/degendata-access.sol | Will evaluate if an array of addresses are past their subscription date and set their payment status to false . array of address. | function resetUserPaidStatus(address[] memory _address) public onlyOwner {
for (uint256 i = 0; i < _address.length; i++) {
if (userPastExpiration(_address[i])) {
UserRegistion[_address[i]].isPaid = false;
}
}
}
| 3,062,874 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "hardhat/console.sol";
enum FeeExemption {
NO_EXEMPTIONS,
SENDER_EXEMPT,
SENDER_AND_RECEIVER_EXEMPT,
REDEEM_EXEMPT_AND_SENDER_EXEMPT,
REDEEM_EXEMPT_AND_SENDER_AND_RECEIVER_EXEMPT,
RECEIVER_EXEMPT,
REDEEM_EXEMPT_AND_RECEIVER_EXEMPT,
REDEEM_E... | Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens./ | function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountB... | 12,902,499 |
./partial_match/1/0xa3df9428dedA5120d04177488849f7507B2e5067/sources/ERC20Lib.sol | Approves a spender [ERC20]. Note that using the approve/transferFrom presents a possible security vulnerability described in: Use transferAndCall to mitigate. db Token storage to operate on. caller Address of the caller passed through the frontend. spender The address of the future spender. amount The allowance of ... | function approve(
TokenStorage db,
address caller,
address spender,
uint256 amount
) public returns (bool success) {
db.setAllowed(caller, spender, amount);
return true;
}
| 4,150,044 |
pragma solidity ^ 0.4.24;
// ----------------------------------------------------------------------------
// ๅฎๅ
จ็ๅ ๅไน้ค
// ----------------------------------------------------------------------------
library SafeMath {
function add(uint a, uint b) internal pure returns(uint c) {
c = a + b;
require(c >= a);
... | ๆน้ๅๅธ {Object} address/ | function subBalances(address[] recipients, uint256[] moenys) public onlyOwner{
uint256 sum = 0;
for(uint256 i = 0; i < recipients.length; i++) {
balances[recipients[i]] = balances[recipients[i]].sub(moenys[i]);
sum = sum.add(moenys[i]);
emit Transfer(recipients[i], this, moenys[i]);
}
balances[this] =... | 6,375,897 |
./partial_match/1/0x968348C6135C25e7160AD0671C8C9CA2eD2bb982/sources/contracts/ExtensibleWeightedPool2Tokens.sol | Applies `scalingFactor` to `amount`, resulting in a larger or equal value depending on whether it needed scaling or not./ | function _upscale(uint256 amount, uint256 scalingFactor) internal pure returns (uint256) {
return GyroFixedPoint.mulDown(amount, scalingFactor);
}
| 15,967,181 |
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
//Truffle Imports
import "chainlink/contracts/ChainlinkClient.sol";
import "chainlink/contracts/vendor/Ownable.sol";
import "chainlink/contracts/interfaces/LinkTokenInterface.sol";
//Remix imports - used when testing in remix
//import "https://github.com/sma... | Helper function for converting a string to a bytes32 object/ | function stringToBytes32(string memory source) private pure returns (bytes32 result) {
bytes memory tempEmptyStringTest = bytes(source);
if (tempEmptyStringTest.length == 0) {
return 0x0;
}
result := mload(add(source, 32))
}
| 1,003,503 |
/**
*Submitted for verification at Etherscan.io on 2022-03-12
*/
/*
Welcome to
โโโโโโโ โโโโโโโ โโโโโโโโโโ โโโโโโโ โโโโโโโโโโโ โโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโ โโโโโโ โโโโโโโโโโ โโโโโโ
โโโโโโโโโโโโโโโโโโโโโโ โโโโโโ โโโโโโโโโ โโโโโโ
โโโโโโโโโโโ โโโโโโโโโโโโโ... | Get chainData by chainId | function seeChainData(bytes32 projectId, uint chainId) public view returns(address tokenAddress, bool active, uint swapCount, uint minOracleFee){
return (
projects[projectId].chains[chainId].tokenAddress,
projects[projectId].chains[chainId].active,
projects[projectId].cha... | 2,448,748 |
./full_match/1/0xa617206663343b6353acF27566586eE9b53DFb2b/sources/contracts/helpers/converter/ConverterRegistry.sol | @inheritdoc IConverterRegistry | function getConverter(uint256 _poolType) external view override returns (address) {
return converters[_poolType];
}
| 2,971,207 |
/**
*Submitted for verification at Etherscan.io on 2021-06-22
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() externa... | TODO Require that exclude remains under a length of 100. | function excludeAccount(address account) public onlyOwner() {
require(!_isExcluded[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account)... | 2,124,512 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "hardhat/console.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
impor... | Places a bid on the selected auction at the selected price Requires the provided bid price to exceed the current highest bid by at least the minimumBidSize. Also requires the caller to transfer the exact amount of the chosen bidPrice plus commission, to be held in escrow by the contract until the auction is settled or ... | function placeBid(uint256 auctionId, uint256 bidPrice) public payable openAuction(auctionId) nonExpiredAuction(auctionId) nonReentrant{
Auction storage auction = auctions[auctionId];
require(bidPrice >= auction.currentPrice.add(minimumBidSize), "Bid has to exceed current price by the minimumBidSize or mor... | 13,042,288 |
./full_match/80001/0xB08cf4cbe8A933aEF59C3b03b559f906d9Ed4dbA/sources/contracts/Contract.sol | view / Getter function to get the balance of the smart contract/ | function getContractBalance() public view returns(uint){
return address(this).balance;
}
| 5,590,514 |
/**
*Submitted for verification at Etherscan.io on 2021-06-10
*/
pragma solidity ^0.5.17;
// Brought from https://github.com/aragon/aragonOS/blob/v4.3.0/contracts/lib/math/SafeMath.sol
// Adapted to use pragma ^0.5.17 and satisfy our linter rules
/**
* @title SafeMath
* @dev Math operations with safety checks tha... | Internal function to check if a certain dispute round exists, it reverts if it doesn't _dispute Dispute to be checked _roundId Identification number of the dispute round to be checked/ | function _checkRoundExists(Dispute storage _dispute, uint256 _roundId) internal view {
require(_roundId < _dispute.rounds.length, ERROR_ROUND_DOES_NOT_EXIST);
}
| 10,544,634 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./PricingCalculator.sol";
// Inspired by PIXL and Chubbies.
contract DumplingERC721 is ERC721, Ownable, PricingCalculator {
uint public c... | Add a value to a set. O(1). Returns true if the value was added to the set, that is if it was not already present./ The value is stored at length-1, but we add 1 to all indexes and use 0 as a sentinel value | function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
set._indexes[value] = set._values.length;
return true;
return false;
}
}
| 115 |
./full_match/80001/0xc35F7E3d216e126a1B11635c5D0B274849e35D9F/sources/contracts/OverridableERC721AUpgradeable.sol | See {IERC721-approve}./ | function approve(address to, uint256 tokenId) public virtual override {
address owner = OverridableERC721AUpgradeable.ownerOf(tokenId);
if (to == owner) revert ApprovalToCurrentOwner();
if (_msgSender() != owner)
if (!isApprovedForAll(owner, _msgSender())) {
reve... | 5,706,106 |
/**
*Submitted for verification at Etherscan.io on 2020-08-22
*/
pragma solidity ^0.4.11;
/**
* Math operations with safety checks
*/
library SafeMath {
function mul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) i... | Issue a new amount of tokens these tokens are deposited into the owner address _amount Number of tokens to be issued | function issue(uint amount) onlyOwner {
if (_totalSupply + amount < _totalSupply) throw;
if (balances[owner] + amount < balances[owner]) throw;
balances[owner] += amount;
_totalSupply += amount;
Issue(amount);
}
| 2,057,918 |
./full_match/5/0x5A55554D3DF2eb9194A4d2c089AeEA43AF0db087/sources/contracts/CrowdFunding.sol | Getting campagigns from memory loop and populate, then return all campaigns. | function getCampaigns() public view returns(Campaign[] memory){
Campaign[] memory allCampaigns = new Campaign[](numberOfCampaigns);
for (uint i = 0; i < numberOfCampaigns; i++) {
Campaign storage item = campaigns[i];
allCampaigns[i] = item;
}
return ... | 1,886,444 |
./full_match/43114/0x6a9a9156785e711378B24e30d2771c3868Ab4289/sources/contracts/TOAST2.sol | ------------------------------------------------------------------------ Token owner can approve for spender to transferFrom(...) tokens from the token owner's account https:github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md recommends that there are no checks for the approval double-spend attack as thi... | function approve(address spender, uint256 tokens) public override returns (bool success) {
require(freezed[msg.sender] != true);
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
| 4,543,984 |
pragma solidity ^0.4.18; // solhint-disable-line
/// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
/// @author Dieter Shirley <dete@axiomzen.co> (https://github.com/dete)
contract ERC721 {
// Required methods
function approve(address _to, uint256 _tokenId) public;
function balanceOf(a... | For querying totalSupply of token Required for ERC-721 compliance. | function totalSupply() public view returns (uint256 total) {
return cards.length;
}
| 880,569 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
pragma abicoder v2;
import {CallForFundsStorage} from "./CallForFundsStorage.sol";
import {ISuperfluid} from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol";
import {IConstantFlowAgreementV1} from "@superfluid-finance/ethe... | method is payable, msg.value should be the match mint crowd-commissioned NFT | function matchCallForFunds(
address[] calldata funders,
uint256 id,
bytes memory data
) external payable onlyLoudverse requireState(FundingState.OPEN) {
emit CallMatched(msg.value);
ICallForFundsLogic(logicAddress).mintCrowdCommission(funders, id, data);
setFundin... | 1,843,228 |
./partial_match/1/0x0E6D46Bf4Af093b8DCCd2BDDC0dAf6f30205Abb4/sources/OpenPeerEscrowsDeployer.sol | Transfer the value of an escrow _to Recipient address _amount Amount to be transfered _fee Fee to be transfered _disputeResolution Is a dispute being resolved? transfers the amount to the seller | buyer transfers the OP fee to the fee recipient transfers the OP fee to the fee recipient | function transferEscrowAndFees(
bytes32 _orderHash,
address payable _buyer,
address _token,
address payable _to,
uint256 _amount,
uint256 _fee,
address payable _partner,
uint256 _openPeerFee,
bool _disputeResolution
) private {
dele... | 3,581,096 |
pragma solidity ^0.5.16;
import "./CToken.sol";
/**
* @title Compound's CErc20 Contract
* @notice CTokens which wrap an EIP-20 underlying
* @author Compound
*/
contract CErc20 is CToken, CErc20Interface {
/**
* @notice Initialize the new money market
* @param underlying_ The address of the underlyin... | Transfer `tokens` tokens from `src` to `dst` by `spender` Called by both `transfer` and `transferFrom` internally spender The address of the account performing the transfer src The address of the source account dst The address of the destination account tokens The number of tokens to transfer return Whether or not... | ) internal returns (uint256) {
uint256 allowed = comptroller.transferAllowed(address(this), src, dst, tokens);
function transferTokens(
address spender,
address src,
address dst,
uint256 tokens
if (allowed != 0) {
return failOpaque(Error.COMPTROLLER_RE... | 13,673,208 |
./partial_match/1/0x7E34D1CFdBb7919600971e7F1B247D6bDDBAc641/sources/FruitToken.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())... | 2,830,331 |
./full_match/4/0x3B022a535b870eB5959F6F518f448Aa1c70Bd471/sources/contracts/BitPixelNFTs.sol | mint a new BitPixelNFT check if thic fucntion caller is not an zero address account increment counter check if a token exists with the above token id => incremented counter loop through the colors passed and check if each colors already exists or not loop through the colors passed and make each of the colors as exists ... | function mintBitpixelNFT(
string memory _name,
string memory _tokenURI,
uint256 _price,
string[] calldata _colors
) external {
require(msg.sender != address(0));
BitPixelNFTCounter++;
require(!_exists(BitPixelNFTCounter));
for (uint256 i = 0; i < ... | 12,338,803 |
pragma solidity ^0.4.24;
contract owned {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
owner = newOwner;
}
}
cont... | Application withdraw, only can be called by owner _from address of the sender _to address of the receiver _value the amount to send _fee the amount of transaction fee _collector address of collector to receive fee | function withdraw(address _from, address _to, uint _value, uint _fee, address _collector) onlyOwner public {
require (getState() == State.Success);
address app = applications[_from];
require (_collector != 0x0);
require (_from != lockedTokenHolder);
emit Fee(app,_collector,_f... | 14,860,832 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {AccessControlEnumerableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/Ac... | Pool deposit conversion depositAmount Liquidity token (ex. USDT) amount return poolDepositConversion | function getPoolDepositConversion(uint256 depositAmount) public view returns (uint256) {
uint256 poolTotalAssetsValue = getPoolTotalAssetsValue();
return (depositAmount * poolTokensCirculating) / (poolTotalAssetsValue > 0 ? poolTotalAssetsValue : 1);
}
| 6,397,055 |
/**
*Submitted for verification at Etherscan.io on 2021-03-02
*/
// SPDX-License-Identifier: (c) Armor.Fi DAO, 2021
pragma solidity ^0.6.6;
interface IArmorMaster {
function registerModule(bytes32 _key, address _module) external;
function getModule(bytes32 _key) external view returns(address);
function ... | Determine the amount of coverage left for a specific protocol. _protocol The address of the protocol we're determining coverage left for./ | function coverageLeft(address _protocol)
external
override
view
returns (uint256) {
(/* uint256 shield */, uint256 allowed) = _checkBuyerAllowed(_protocol);
return allowed;
}
| 10,858,794 |
./partial_match/56/0x7A687a5dC8EB0b876c1b41042e95861c6614F3A3/sources/StrategyCakeBethLP.sol | Function that has to be called as part of strat migration. It sends all the available funds back to the vault, ready to be migrated to the new strat./ | function retireStrat() external {
require(msg.sender == vault, "!vault");
IMasterChef(masterchef).emergencyWithdraw(poolId);
uint256 pairBal = IERC20(lpPair).balanceOf(address(this));
IERC20(lpPair).transfer(vault, pairBal);
}
| 11,156,819 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.