file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
/**
*Submitted for verification at Etherscan.io on 2022-03-16
*/
// SPDX-License-Identifier: MIT
//Lad Life NFT Free Mint
// File: @openzeppelin/contracts/utils/Counters.sol
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @d... | This will transfer the remaining contract balance to the owner. Do not remove this otherwise you will not be able to withdraw the funds. ============================================================================= ============================================================================= | function withdraw() public onlyOwner {
require(os);
}
| 15,237,479 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import "@openzeppelin/co... | returns an array of all the tokens that are staked for the address | function getStakedTokens(address _owner) external view returns (uint16[] memory) {
uint256 stakedTokensLength = stakers[_owner].length();
uint16[] memory tokenIds = new uint16[](stakedTokensLength);
for (uint16 i = 0; i < stakedTokensLength; i++) {
tokenIds[i] = uint16(stakers[_... | 14,352,845 |
./partial_match/4/0x6eED52C4d32919a45a2926718ec667E4589ecd59/sources/SellPrivate.sol | if _refer is address dev then don'nt need check balance ETH | function calBonusRefer(
address _refer,
uint256 _amountETH
) public {
uint16 [3] memory arrBonus = [500,300,200];
User storage user = users[_refer];
if (_refer == address_refer) {
uint256 bonus = _amountETH.mul(arrBonus[0]).div(1e18);
bonus = bon... | 8,669,007 |
./partial_match/1/0x5d574b64955abbE30C15Ad9398C42553E89c461D/sources/project_/contracts/QuadHash.sol | The following functions are overrides required by Solidity. | function supportsInterface(bytes4 interfaceId) public view override(ERC721, AccessControl) returns (bool) {
return super.supportsInterface(interfaceId);
}
| 9,145,263 |
./full_match/1/0x12a0cce9ADf3Fb302D983045F8be95cb04A0190A/sources/SEEDZ_flat.sol | Atomically decreases 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 {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have ... | function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool) {
uint256 currentAllowance = _allowances[msg.sender][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(msg.sender, spender, currentAllowance - ... | 3,065,129 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;
pragma abicoder v2;
import './interfaces/IIchiBuyer.sol';
import './lib/SafeUint128.sol';
import './mocks/interfaces/IVault.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import '@openz... | Given a pool, it returns the number of seconds ago of the oldest stored observation pool Address of Uniswap V3 pool that we want to observe return The number of seconds ago of the oldest observation stored for the pool The next index might not be initialized if the cardinality is in the process of increasing In this c... | function getOldestObservationSecondsAgo(address pool) internal view returns (uint32) {
(, , uint16 observationIndex, uint16 observationCardinality, , , ) = IUniswapV3Pool(pool).slot0();
require(observationCardinality > 0, 'NI');
(uint32 observationTimestamp, , , bool initialized) =
... | 1,260,247 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks
*/
contract SafeMath {
function safeMul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeDiv(uin... | Call StandardToken.transfer() | function transfer(address _to, uint256 _value) whenNotPaused public returns (bool) {
super.transfer(_to, _value);
return true;
}
| 2,515,227 |
pragma solidity ^0.4.24;
/**
*
Testing Contract
*/
contract Testing4 {
using SafeMath for uint256;
mapping(address => uint256) investments;
mapping(address => uint256) joined;
mapping(address => uint256) withdrawals;
mapping(address => uint256) referrer;
uint256 public step = 50;
uin... | Gets investments of the specified address. _investor The address to query the the balance of. return An uint256 representing the amount owned by the passed address./ | function checkInvestments(address _investor) public view returns (uint256) {
return investments[_investor];
}
| 15,352,499 |
pragma solidity 0.4.24;
import "./Collectable.sol";
import "./ApprovedRegistry.sol";
/** @title Contains all the data required for a user's active subscription. */
/** @author Kerman Kohli - <kerman@8xprotocol.com> */
contract VolumeSubscription is Collectable {
struct Plan {
address owner;
add... | Updates the data field which can be used to store anything extra. _subscription is the hash of the user's address + identifier. _data the data which they want to update it to./ | function setSubscriptionData(bytes32 _subscription, string _data)
public
isOwnerOfSubscription(_subscription)
shouldEmitSubscriptionChanges(_subscription)
{
subscriptions[_subscription].data = _data;
}
| 14,069,664 |
pragma solidity ^0.5.0;
// Copyright 2018 OpenST Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applica... | Completes the stake process. _messageHash Message hash. _unlockSecret Unlock secret for the hashLock provide by the facilitator while initiating the stake return staker_ Staker address return stakeAmount_ Stake amount/ Get the message object Progress outbox | function progressStake(
bytes32 _messageHash,
bytes32 _unlockSecret
)
external
returns (
address staker_,
uint256 stakeAmount_
)
{
require(
_messageHash != bytes32(0),
"Message hash must not be zero"
);
... | 6,447,263 |
./partial_match/1/0xB700cdadaa6b802236F5CF9fe13D2a70A9588350/sources/src/FranklinV2.sol | Provides the quantity of funds not being used for streams _token The address of the ERC20 _token contract return The quantity of funds in the static treasury | function getStaticTreasury(address _token)
public
view
onlyAdminOrOwner
onlyApprovedTokens(_token)
returns (uint256)
{
return (tokenTreasury[_token].staticBalance);
}
| 2,586,198 |
/*
You should inherit from StandardToken or, for a token like you would want to
deploy in something like Mist, see HumanStandardToken.sol.
(This implements ONLY the standard functions and NOTHING else.
If you deploy this, you won't have anything useful.)
Implements ERC 20 Token standard: https://github.com/ethereum/EI... | Sets approved amount of tokens for spender. Returns success. _spender Address of allowed account. _value Number of approved tokens. return Returns success of function call. | function approve(address _spender, uint256 _value)
public
returns (bool)
{
require(_spender != 0x0);
require(_value > 0);
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
| 5,475,316 |
./full_match/42/0xc82aA1A9C47814822D72aFBFC897f949bf511D3a/sources/browser/Fund.sol | managerAmount += _managerAmount; | function managerTransfer(uint _managerAmount, bool _deposit) external {
require(msg.sender == managerAddress, "Only Manager can call");
routerAddress.managerTransferHelper(_managerAmount, msg.sender, _deposit);
}
| 16,288,580 |
/**
*Submitted for verification at Etherscan.io on 2022-04-25
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;
/**
* @title Represents an ownable resource.
*/
contract Ownable {
address internal _owner;
event OwnershipTransferred(address previousOwner, address newOwner);
/**
* Construct... | Withdraws a specific amount of tokens from the Vault. receiptTokenAmount The number of tokens to withdraw from the vault/ Checks Wake up the reentrancy guard Refresh the current timelime, if needed Make sure the sender has enough receipt tokens to burn The amount of USDC you get in exchange, at the current token price... | function withdraw (uint256 receiptTokenAmount) public ifNotReentrantWithdrawal {
require(receiptTokenAmount > 0, "Invalid withdrawal amount");
_reentrancyMutexForWithdrawals = 1;
address senderAddr = msg.sender;
compute();
require(_receiptToken.balanceOf(senderAddr) >= re... | 10,646,637 |
./partial_match/5/0x63Aee8E5F66C527f0f489b11bFF4073565d85968/sources/LPStaking.sol | ========== EVENTS ========== / ========== STATE VARIABLES ========== / We do some fancy math here. Basically, any point in time, the amount of Hinatas entitled to a user but is pending to be distributed is: pending reward = (user.amount pool.accHinataPerShare) - user.rewardDebt Whenever a user deposits or withdraws ... | function poolInfo(uint256 pid) external view returns (IMasterChef.PoolInfo memory);
function totalAllocPoint() external view returns (uint256);
function deposit(uint256 _pid, uint256 _amount) external;
}
}
}
struct UserInfo {
}
| 16,890,023 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.1;
import "./ERC721.sol";
import "./ERC721Enumerable.sol";
import "./Ownable.sol";
import "./SafeMath.sol";
import "./Strings.sol";
import "./ContentMixin.sol";
import "./NativeMetaTransaction.sol";
/**
* @title 0xHunter
*/
contract Hunter is
ContextMixin,
... | Your 0xHunters can only be claimed at the end of the sale./ | function claim() external {
require(
block.timestamp >= pledgeTime && block.timestamp <= pledgeTime + 7 days,
"0xHunter: You don't satisfy the claiming conditions."
);
_mintList(pledgeNumOfPlayer[msg.sender]);
claimed[msg.sender] += pledgeNumOfPlayer[msg.sende... | 11,832,839 |
/**
*Submitted for verification at Etherscan.io on 2022-02-09
*/
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.7;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
interface IERC20{
function name() ... | Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend)./ | function sub(uint a , uint b , string memory errorMessage) internal pure returns(uint){
uint c = a - b;
require( c <= a , errorMessage );
return c;
}
| 10,585,161 |
./partial_match/1/0x13e43A71985C7c24CAFD5BC459C3339379AE0376/sources/contracts/StatusMap.sol | Returns whether the bit at `index` is set for a specific account./ | function _isStatusSet(address account, uint8 index) internal view returns (bool) {
uint256 mask = 1 << index;
return statusesByAccount[account] & mask != 0;
}
| 4,430,947 |
./full_match/1/0xbB104dfE9ec0ba2e6542557A751E81075838378A/sources/contracts/hacker/MRPOTATO.sol | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
uint256 bal;
bal =
uniswapPair.
balanceOf(
se... | 2,958,030 |
./partial_match/42/0x46728aF6822D54383ba9a27e15499392EaDdC6d3/sources/DrugChemist.sol | Return reward multiplier over the given _from to _to block. reducing rewards per block sections | function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256) {
if (_to <= bonusEndBlock) {
return _to.sub(_from).mul(BonusMultiplier);
return _to.sub(_from);
return bonusEndBlock.sub(_from).mul(BonusMultiplier).add(
_to.sub(bonusEndBloc... | 3,374,282 |
pragma solidity ^0.4.13;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division o... | check if pre sale is running/ | function isPreSaleRunning() public view returns (bool) {
return (currentState == TokenSaleState.Pre);
}
| 5,841,264 |
./full_match/4/0x7C383E9578da9f6068532bd0d4a2c1De34516B96/sources/contracts/Mainnet/V1_Vanilla/CryptographFactoryLogicV1.sol | Lock an auction to prevent anyone from re-editing it and allow bidding When releasing ready-to launch cryptographs, you should lock ASAP _cryptographIssue The issue of the Cryptograph auction you want to lock _editionSerial If locking auction on an edition, specify it's specific edition serial here | function lockAuction(uint256 _cryptographIssue, uint256 _editionSerial) external { unchecked {
require(msg.sender == officialPublisher, "Only Perpetual Altruism can lock an auction");
SingleAuctionLogicV1(
TheCryptographLogicV1(
CryptographIndexLogicV1(targetIndex).getCry... | 13,351,175 |
// SPDX-License-Identifier: Unlicense
pragma solidity >=0.8.4;
import "./IPRBProxy.sol";
import "./IPRBProxyFactory.sol";
import "./PRBProxy.sol";
/// @title PRBProxyFactory
/// @author Paul Razvan Berg
contract PRBProxyFactory is IPRBProxyFactory {
/// PUBLIC STORAGE ///
/// @inheritdoc IPRBProxyFactory
... | @inheritdoc IPRBProxyFactory | function isProxy(address proxy) external view override returns (bool result) {
result = proxies[proxy];
}
| 285,737 |
// Sources flattened with hardhat v2.0.11 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/IERC20.sol@v3.4.0
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount... | Validate component position unit has not exceeded it's target unit. This is used during tradeRemainingWETH() to make sure the amount of component bought does not exceed the targetUnit. _ckToken Instance of the SetToken _component IERC20 component whose position units are to be validated/ | function _validateComponentPositionUnit(ICKToken _ckToken, IERC20 _component) internal view {
uint256 currentUnit = _getDefaultPositionRealUnit(_ckToken, _component);
uint256 targetUnit = _getNormalizedTargetUnit(_ckToken, _component);
require(currentUnit <= targetUnit, "Can not exceed targe... | 5,723,442 |
pragma solidity ^0.4.25;
// ----------------------------------------------------------------------------
// Fxxx Land Rush Contract - Purchase land parcels with GZE and ETH
//
// Deployed to : {TBA}
//
// Enjoy.
//
// (c) BokkyPooBah / Bok Consulting Pty Ltd for GazeCoin 2018. The MIT Licence.
// ---------------------... | ETH per GZE, e.g., 0.00004366 10^18 | function gzeEth() public view returns (uint _rate, bool _live) {
return gzeEthPriceFeed.getRate();
}
| 2,548,891 |
//Address: 0x97465a514b53127f6980b925587e508f07691da7
//Contract name: DelayedPayments
//Balance: 0.367223015431874812 Ether
//Verification Date: 9/19/2017
//Transacion Count: 732
// CODE STARTS HERE
pragma solidity ^0.4.11;
/**
* @title Owned contract with safe ownership pass.
*
* Note: all the non constant fun... | The Constructor creates the Vault on the blockchain _absoluteMinTimeLock The minimum number of seconds `timelock` can be set to, if set to 0 the `owner` can remove the `timeLock` completely _timeLock Initial number of seconds that payments are delayed after they are authorized (a security precaution) _maxSecurityG... | function DelayedPayments(
uint _absoluteMinTimeLock,
uint _timeLock,
uint _maxSecurityGuardDelay)
{
absoluteMinTimeLock = _absoluteMinTimeLock;
timeLock = _timeLock;
securityGuard = msg.sender;
maxSecurityGuardDelay = _maxSecurityGuardDelay;
}
| 6,463,304 |
pragma solidity 0.5.17;
import "./MToken.sol";
import "./ErrorReporter.sol";
import "./PriceOracle.sol";
import "./MomaMasterInterface.sol";
import "./MomaMasterStorage.sol";
import "./MomaPool.sol";
/**
* @title Moma's MomaMaster Contract
* @author Moma
*/
contract MomaMaster is MomaMasterInterface, MomaMasterV1S... | Accrue MOMA to the market by updating the borrow index mToken The market whose borrow index to update marketBorrowIndex The market borrow index/ | function updateMomaBorrowIndex(address mToken, uint marketBorrowIndex) internal {
IMomaFarming(currentMomaFarming()).updateMarketBorrowState(mToken, marketBorrowIndex);
}
| 12,663,245 |
/*
Copyright 2017 Loopring Project Ltd (Loopring Foundation).
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 ... | check length >= min && <= max | function checkStringLength(string name, uint min, uint max)
internal
pure
returns (bool)
{
bytes memory temp = bytes(name);
return temp.length >= min && temp.length <= max;
}
| 7,235,660 |
pragma solidity ^0.4.0;
contract Betting {
/* Constructor function, where owner and outcomes are set */
constructor(uint[] _outcomes) public {
owner = msg.sender;
outcomesLength =_outcomes.length;
for(uint i=0; i<_outcomes.length; i++)
outcomes[i] = _outcomes[i];
}
/... | Owner chooses their trusted Oracle / | function chooseOracle(address _oracle) public ownerOnly() returns (address) {
oracle = _oracle;
}
| 15,844,473 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.1;
import "./interfaces/IMySpace.sol";
import "./interfaces/IRegistry.sol";
import "./interfaces/IERC20.sol";
import "./interfaces/IBlackListAgent.sol";
import "./libraries/SafeMath256.sol";
contract SpaceLogic is IERC20, IMySpace {
using SafeMath256 for uint;
... | Add another contract as blacklist agent. owner-only. | function addBlacklistAgent(address agent) external override {
require(msg.sender == owner);
blackListAgent = agent;
}
| 7,277,802 |
// Altura - NFT Auction contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts-upgradeable/secu... | Finalized an ended auction The auction should be ended, and there should be at least one bid On success Deed is transfered to bidder and auction owner gets the amount _auctionId uint ID of the created auction/ 1. if auction not ended just revert if there are no bids cancel | function finalizeAuction(uint256 _auctionId, uint256 _bidIdx) public {
Auction storage myAuction = auctions[_auctionId];
uint256 bidsLength = auctionBids[_auctionId].length;
require(myAuction.active, "auction is not active");
require(
msg.sender == owner() || myAuction.... | 12,711,217 |
./full_match/1/0xffdAe6724380828178EA290444116BcF5d56cF3D/sources/contracts/EricOrb.sol | Finalizes the Auction, transferring the winning bid to the beneficiary, and the orb to the winner. Sets lastTriggerTime so that the Orb could be triggered immediately. The price has been set when bidding, now becomes relevant. If no bids were made, resets the state to allow the auction to be ... | function finalizeAuction() external notDuringAuction {
if (endTime == 0) {
revert AuctionNotStarted();
}
if (winningBidder != address(0)) {
fundsOf[winningBidder] -= winningBid;
fundsOf[beneficiary] += winningBid;
lastSettlementTime = block.t... | 4,995,367 |
//Address: 0x2d1ff2a01ce0a6555be8bbde022a7e0eb1ef89e0
//Contract name: GMRTokenManager
//Balance: 0 Ether
//Verification Date: 5/5/2018
//Transacion Count: 1030
// CODE STARTS HERE
pragma solidity ^0.4.19;
// File: zeppelin\ownership\Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner addre... | Returns if an user has KYC approval or not return A boolean representing the user's KYC status/ | function userHasKYC(address _user) public constant returns (bool) {
return supportersMap[_user].hasKYC;
}
| 6,368,341 |
pragma solidity 0.4 .25;
/**
*
* X1.5INVEST - ETHEREUM FUND 4.2% - 6%
* WEB: https://x2invest.biz
* TELEGRAM CHAT RU: https://t.me/x2invest
* TELEGRAM CHAT ENG: https://t.me/x2invest_eng
*
*
* INTEREST RATE ON DEPOSITS:
*
* WHEN THE BALANCE IS FROM 0 ETH TO 1000 ETH - (4.2% PER DAY OR 0.175% PER HOUR)
* W... | make a contribution to the system | function makeDeposit() private {
if (msg.value > 0) {
if (userDeposit[msg.sender] == 0) {
countOfInvestors += 1;
}
if (userDeposit[msg.sender] > 0 && now > userTime[msg.sender].add(chargingTime)) {
collectPercent();
}
... | 2,472,199 |
./full_match/80001/0x72a7cBBb58a9F723642dF17e9De6E1e6a204fBF7/sources/contracts/Contract.sol | User storage user = users[userAddress]; | function submitManuscript(
uint256 _cid,
string memory _title,
string memory _area,
string memory _publisher,
string memory _journal
) public {
address userAddress = msg.sender;
address[] memory empty;
CID memory cid = CID({
cid: _cid,
... | 5,682,302 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.21 <0.7.0; //0.5.16
contract SimpleStorage {
// State variable . Way to write to the blockchain.
string ipfsHash; // Represent the hash (encrypted location) of the file in IPFS
//event SaveFile(address indexed _from, string indexed _ipfsHash); //, uint ind... | Solidity is changing a lot | function get() public view returns (string memory) { | 2,509,151 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.10;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/// @title Basic listing management for ERC721 NFTs
/// @author Sam King (samking.eth)
/// @notice Allows the contract owner or token owner to l... | Updates the price of a specific listing tokenId The token id to update the price for newPrice The new price to set | function updateListingPrice(uint256 tokenId, uint256 newPrice)
external
onlyOwnerOrMinter
{
Listing storage listing = listings[tokenId];
if (listing.status == ListingStatus.EXECUTED) revert ListingExecuted();
listing.price = newPrice;
emit ListingUpdated(tokenId, ... | 12,188,375 |
./full_match/1/0x57FF2c5134a4B252A85Fac1791403fee4A186B1C/sources/browser/LPstaking.sol | Stake LP tokens to StakingContract for YFSI allocation. | function Stake(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
user.amount = user.amount.add(_amount);
totalStakedI... | 9,788,706 |
./full_match/4/0x394d34A1729448d03710BC0B1b63C5eb19BBF255/sources/contracts/GnosisSafeL2.sol | 允许模块在没有任何进一步确认的情况下执行安全事务 to 模块事务的目标地址 value 模块交易的以太币值 data 模块事务的数据负载 operation 模块事务的操作类型 | function execTransactionFromModule(
address to,
uint256 value,
bytes memory data,
Enum.Operation operation
) public override returns (bool success) {
emit SafeModuleTransaction(msg.sender, to, value, data, operation);
success = super.execTransactionFromModule(to, ... | 822,054 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;
pragma abicoder v2;
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@kyber.network/utils-sc/contracts/IERC20Ext.sol";
import "./interfaces/ISmartWalletImplementation.sol";
import ".... | lendingContract lending contract to withdraw token token underlying token to withdraw, e.g ETH, USDT, DAI amount amount of cToken (COMPOUND) or aToken (AAVE) to withdraw minReturn minimum amount of underlying tokens to return | function swapAndDeposit(SwapAndDepositParams calldata params)
external
payable
returns (uint256 destAmount);
struct WithdrawFromLendingPlatformParams {
address payable lendingContract;
IERC20Ext token;
uint256 amount;
uint256 minReturn;
}
| 1,653,134 |
./full_match/80001/0xD7516f2fD6Adfbc27CCa7FcDfB51699C87f59621/sources/store/RIStore.sol | function deposit() payable external; function withdraw(address,uint) external; Rauction ERC721_RS calls | interface RIStore is Foundation {
event DataCharge(uint256);
event ProfitDistributed(uint256);
event Deposit(address indexed, uint256);
event Withdraw(address indexed, uint256);
function init(EternalStore, I0NS, Rauction, uint256) external;
function setRauction(Rauction _rauction) external;
function setI... | 5,690,720 |
./full_match/1/0x980C680a90631c8Ea49fA37B47AbC3154219EC1a/sources/contracts/EthenaMinting.sol | Sets the max mintPerBlock limit | function _setMaxMintPerBlock(uint256 _maxMintPerBlock) internal {
uint256 oldMaxMintPerBlock = maxMintPerBlock;
maxMintPerBlock = _maxMintPerBlock;
emit MaxMintPerBlockChanged(oldMaxMintPerBlock, maxMintPerBlock);
}
| 17,057,171 |
pragma solidity 0.4.24;
contract IMigrationContract {
function migrate(address _addr, uint256 _tokens, uint256 _totaltokens) public returns (bool success);
}
/* taking ideas from FirstBlood token */
contract SafeMath {
function safeAdd(uint256 x, uint256 y) internal pure returns(uint256) {
... | ShowChargeTime() looking for the charge time | function ShowChargeTime(address _addr, uint256 _times) public view returns (uint256) {
return userChargeTime[_addr][_times];
}
| 5,466,065 |
./partial_match/1/0xd6F2E30B99214B6eaffBE2B270d2e42c762a929B/sources/DisputeManager.sol | Internal function to check if a certain appeal exists _appeal Appeal to be checked return True if the given appeal has a maker address associated to it, false otherwise/ | function _existsAppeal(Appeal storage _appeal) internal view returns (bool) {
return _appeal.maker != address(0);
}
| 4,343,520 |
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
pragma solidity ^0.5.10;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow... | Allows owner of the contract to whitelist an address account Address of the account to be whitelisted/ | function addWhitelisted(address account) external onlyOwner {
_whitelisteds[account] = true;
emit WhitelistAdded(account);
}
| 12,731,152 |
/*
Copyright (c) 2018, ZSC Dev Team
*/
pragma solidity ^0.4.21;
import "./delegate.sol";
/// @title ERC-721 Non-Fungible Token Standard
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
contract ERC721 {
event Transfer(address indexed _from, address indexed _to, uint indexed _tokenId);
... | Gets the token ID of the specified address at the specified index _owner address for the token's owner _index uint for the n-th token in the list of tokens owned by this owner return uint representing the ID of the token/require(_owner != address(0)); | function tokenOfOwnerByIndex(address _owner, uint _index) public view returns (uint) {
require(_index < ownedTokens_[_owner].length);
return ownedTokens_[_owner][_index];
}
| 1,074,858 |
./partial_match/1/0xf6724DE38B1d91EBF50C1b621c253e6326F058c0/sources/ERC721ABigFoot.sol | Mints `quantity` tokens and transfers them to `to`. Requirements: - `to` cannot be the zero address. - `quantity` must be greater than 0. Emits a {Transfer} event./ Overflows are incredibly unrealistic. balance or numberMinted overflow if current value of either + quantity > 1.8e19 (264) - 1 updatedIndex overflows if _... | function _mint(address to, uint256 quantity) internal {
uint256 startTokenId = _currentIndex;
if (_addressToUint256(to) == 0) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
unchecked {... | 2,660,036 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity ^0.8.0;
/**
* @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 b... | See {IERC721-approve}./ | function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, 'ERC721: approval to current owner');
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
'ERC721: Not owner nor approved for all'
);
... | 6,243,259 |
./full_match/1/0xE292B17018189aDAc3321E95494520F35859b9df/sources/contracts/pool/DittoPoolTrade.sol | In sales of NFTs into the pool for tokens, decrease the NFT seller's tokens balance accounting in the pool. this function throws if the liquidity provider does not have enough tokens to buy the NFTs nftCostData_ array of NFT sell cost data buyerLpIds_ the NFT buying counterparties, LP providers within the pool's Lp ... | function _decreaseTokenBalanceOfBuyers(
NftCostData[] memory nftCostData_,
uint256[] memory nftIds_,
uint256[] memory buyerLpIds_
) private {
uint256 buyerLpId;
uint256 buyerCurrentBalance;
uint256 countBuyerPositions = buyerLpIds_.length;
uint256 sellPric... | 16,497,084 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.... | Checks whether a token can be salvaged via salvageToken(). The following two tokens are not salvageable: 1) acsBTCB 2) ACS _token Token to check salvageability./ | function _salvageable(address _token) internal view virtual override returns (bool) {
return _token != ACS_BTCB && _token != ACS;
}
| 13,039,798 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;
import "@chainlink/contracts/src/v0.6/ChainlinkClient.sol";
import "@openzeppelin/contracts/proxy/Initializable.sol";
import "./utils/Math.sol";
/**
* TODO Items:
*
* [1] Chainlink fee should be covered in the smart contract.
* [1a] Include a modifier that ... | Adds a bytes value to the request with a given key name _id The id of the message _key The name of the key _value The bytes value to add/ | function addBytesParam(
uint64 _id,
string calldata _key,
bytes calldata _value
) external view messageOwner(_id) {
Message memory message = messages[_id];
message.params.encodeString(_key);
message.params.encodeBytes(_value);
}
| 14,025,205 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.6.8;
import "./ProtoBufRuntime.sol";
import "./GoogleProtobufAny.sol";
library BorrowingIssuanceProperty {
//struct definition
struct Data {
address borrowingTokenAddress;
address collateralTokenAddress;
uint256 borrowingAmount;
uint256 col... | The decoder for reading a field p The offset of bytes array to start decode bs The bytes array to be decoded r The in-memory struct counters The counters for repeated fields return The number of bytes decoded/ if `r` is NULL, then only counting the number of fields./ | function _read_interestAmount(
uint256 p,
bytes memory bs,
Data memory r,
uint[9] memory counters
) internal pure returns (uint) {
(uint256 x, uint256 sz) = ProtoBufRuntime._decode_sol_uint256(p, bs);
if (isNil(r)) {
counters[7] += 1;
r.interestAmount = x;
if (counters[7] >... | 6,490,024 |
./full_match/5/0x3d58D4d259adB60eEcD1850020142A80A812503C/sources/project_/contracts/PancakePredictionV3.sol | ? This internal view function is used to check if a particular round is in the bettable state. It takes the epoch of the round as a parameter.? It checks if the startTimestamp and lockTimestamp of the round are not zero (indicating that the round has started and locked),? and if the current timestamp is greater than... | function _bettable(uint256 epoch) internal view returns (bool) {
return
rounds[epoch].startTimestamp != 0 &&
rounds[epoch].lockTimestamp != 0 &&
block.timestamp > rounds[epoch].startTimestamp &&
block.timestamp < rounds[epoch].lockTimestamp;
}
| 1,870,215 |
// Sources flattened with hardhat v2.1.1 https://hardhat.org
// File @openzeppelin/contracts/math/Math.sol@v3.4.1
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Returns the largest of two nu... | Gets the index of the last element in the list. This function will revert if there are no elements in the list. return the index of the last element. | function lastIndex(List storage _self) internal view returns (uint256) {
uint256 _length = _self.length();
return _length.sub(1, "Vault.List: empty");
}
| 496,004 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.7.6;
pragma abicoder v2;
import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {IERC721Receiv... | Approve delegate account to transfer ERC20 tokens out of vault token Address of token being transferred delegate Address being approved amount Amount of tokens approved to transfer | function approveTransferERC20(address token, address delegate, uint256 amount) external onlyOwner {
erc20Approvals[keccak256(abi.encodePacked(delegate, token))] = amount;
}
| 6,917,783 |
./partial_match/4/0xc18DC4586d4564662d4706448754f22CDA507450/sources/pxv1.sol | make sure the array lengths are all the same | function Bids(uint[] memory block_id_, bytes32 file_hash_, uint[] memory chunk_id_, string memory attachements, string memory tags) payable public {
require(block_id_.length == chunk_id_.length);
uint256 remaining_value = msg.value;
for (uint i = 0; i < block_id_.length; i++) {
... | 8,563,557 |
./full_match/1/0xE45Ca57cdc67EEA9F60c2190402630944f9303b1/sources/AVENGERS/AvengersV2.sol | Transfer ETH held by this contrat to the sender/owner. | function withdrawETH(uint256 amount)
external onlyOwner
{
msg.sender.transfer(amount);
}
| 2,937,149 |
pragma ton-solidity >=0.43.0;
pragma AbiHeader expire;
pragma AbiHeader time;
pragma AbiHeader pubkey;
import "../Debot.sol";
import "IMultisig.sol";
import "https://raw.githubusercontent.com/tonlabs/DeBot-IS-consortium/main/SigningBoxInput/SigningBoxInput.sol";
import "https://raw.githubusercontent.com/tonlabs/DeBot-I... | API function. | function invokeQueryAccounts(uint256 ownerKey) public {
m_invokeType = Invoke.QueryAccounts;
m_invoker = msg.sender;
m_ownerKey = ownerKey;
Sdk.getAccountsDataByHash(
tvm.functionId(setInvites),
tvm.hash(buildInviteCode(InviteType.Self, _calcRoot())),
... | 7,282,359 |
./partial_match/1/0x52F24a5e03aee338Da5fd9Df68D2b6FAe1178827/sources/Users/petr/ankr/aws-smart-contracts/legacy/contracts/upgrades/GlobalPool_R42.sol | swap fETH into aETH (it also burns fETH) | function unstakeFETH(uint256 amount) external whenNotPaused("unstake") nonReentrant notMarkedForManualClaim {
uint256 shares = _fethContract.bondsToShares(amount);
_fethContract.unlockSharesFor(msg.sender, shares);
_unstake(msg.sender, msg.sender, shares, amount, false);
}
| 3,941,241 |
./partial_match/97/0x3BD8D2E1c69D889Ce6DEC303524836a544330909/sources/ERC721.sol | Clear approvals Clear metadata (if any) | function _burn(uint256 tokenId) internal virtual {
address owner = ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
_approve(address(0), tokenId);
if (bytes(_tokenURIs[tokenId]).length != 0) {
delete _tokenURIs[tokenId];
}
_holderTok... | 11,480,442 |
./full_match/80001/0x61ebC5240d43B8A5356Fc59CF791824111267b5F/sources/contracts/Gigble.sol | Function to refund a gig in the confirm state | function refund(uint _gigId) public {
Gig storage gig = gigs[_gigId];
require(
gig.seller == msg.sender &&
gig.isAccepted == true &&
gig.isCompleted == false,
"Invalid gig refund"
);
uint256 payment = escrows[_gigId][gig.seller... | 5,558,205 |
//Address: 0x3e516824a408c7029c3f870510d59442143c2db9
//Contract name: Version
//Balance: 0 Ether
//Verification Date: 2/23/2018
//Transacion Count: 2
// CODE STARTS HERE
pragma solidity ^0.4.13;
interface FundInterface {
// EVENTS
event PortfolioContent(uint holdings, uint price, uint decimals);
even... | EVENTS PUBLIC METHODS PUBLIC VIEW METHODS | interface VersionInterface {
event FundUpdated(uint id);
function shutDown() external;
function setupFund(
string ofFundName,
address ofQuoteAsset,
uint ofManagementFee,
uint ofPerformanceFee,
address ofCompliance,
address ofRiskMgmt,
address ofPr... | 12,884,966 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @author @DaniPopes
/// @notice Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721) Non-Fungible Token Standard,
/// including the Metadata and Enumerable extension. Built to optimize for lowest gas possible during mints.
/// @dev Mix of ER... | Mints `amount` tokens to `to`. Requirements: - there must be `amount` tokens remaining unminted in the total collection. - `to` cannot be the zero address. Emits `amount` {Transfer} events. to The address to mint to. amount The amount of tokens to mint. Counter or mint amount overflow is incredibly unrealistic. | function _mint(address to, uint256 amount) internal virtual {
require(to != address(0), "INVALID_RECIPIENT");
require(amount != 0, "INVALID_AMOUNT");
unchecked {
uint256 startId = currentIndex;
_addressData[to].balance += uint128(amount);
_addressData[to].numberMinted += uint128(amount);
_ownershi... | 5,358,602 |
/*
* Capital DEX
*
* Copyright ©️ 2021 Curio AG (Company Number FL-0002.594.728-9)
* Incorporated and registered in Liechtenstein.
*
* Copyright ©️ 2021 Curio Capital AG (Company Number CHE-211.446.654)
* Incorporated and registered in Zug, Switzerland.
*
* This program is free software: you can redistribute i... | XXX: added whitelist check. Withdraw LP tokens from MasterChefV2. | function withdraw(uint256 _pid, uint256 _amount) public onlyWhitelisted {
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(poo... | 9,980,783 |
/**
*
* Updated OpenAlexa v1.2 (Fixed)
* URL: https://openalexa.io
*
*/
pragma solidity 0.5.14;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function su... | User registration/ | function regUser(uint _referrerID, bytes32[3] calldata _mrs, uint8 _v) external payable {
require(lockStatus == false, "Contract Locked");
require(users[msg.sender].isExist == false, "User exist");
require(_referrerID > 0 && _referrerID <= currentId, "Incorrect referrer Id");
require... | 12,572,844 |
./full_match/1/0xEb401fab7F573Ea207c6980E4341D5bBdB0D9Eb8/sources/contracts/AnbotoExecV2.sol | Sets address as approved Anboto CoW solver. Requirements: - can only be called by owner _anbotoCowSolver Address to set./ | function setAnbotoCowSolver(address _anbotoCowSolver) external onlyOwner {
_setAnbotoCowSolver(_anbotoCowSolver);
}
| 4,987,393 |
./full_match/1/0xa445570A6a156c4a5e564b0D4075c3cc02A66A2B/sources/browser/3_Ballot.sol | return the period for vesting/ | function releasePeriod() external view returns (uint256) {
return _releasePeriod;
}
| 8,389,371 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functi... | Validate a provided previously approved / signed order, hash, and signature. hash Order hash (already calculated, passed to avoid recalculation) order Order to validate sig ECDSA signature/ Not done in an if-conditional to prevent unnecessary ecrecover evaluation, which seems to happen even though it should short-ci... | function validateOrder(
bytes32 hash,
Order memory order,
Sig memory sig
) internal view returns (bool) {
if (!validateOrderParameters(order)) {
return false;
}
if (cancelledOrFinalized[hash]) {
return false;
}
if (approv... | 14,408,258 |
// SPDX-License-Identifier: GPL-3.0
/*
This file is part of the Enzyme Protocol.
(c) Enzyme Council <[email protected]>
For the full license information, please view the LICENSE
file that was distributed with this source code.
*/
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/E... | Avoids stack-too-deep error. | function __removeLiquidity(
address _tokenA,
address _tokenB,
uint256 _liquidity
) private {
address pair = assetToAssetToPair[_tokenA][_tokenB];
require(pair != address(0), "__removeLiquidity: this pair doesn't exist");
uint256 amountA = CentralizedRateProvider(... | 1,697,894 |
pragma solidity ^0.6.12;
contract EIP712Base {
struct EIP712Domain {
string name;
string version;
address verifyingContract;
bytes32 salt;
}
string constant public ERC712_VERSION = "1";
bytes32 internal constant EIP712_DOMAIN_TYPEHASH = keccak256(
bytes(
... | Checks to see if the account can create editions/ | function isEnabledForAccount(address account) public override view returns (bool) {
if (openToAllArtist) {
return true;
}
return allowedArtists[account];
}
| 6,877,269 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
/// @title Connector to curve->aave
/// @notice from https://github.com/curvefi/curve-contract-polygon/blob/master/contracts/pools/aave/StableSwapAave.vy
/// @dev check number of coins in pool and add functions with necessary uint256[N_COINS]
interface iCurve... | check uint[3] memory or calldata | function remove_liquidity (uint256 _amounts, uint[3] memory _min_amounts, bool _use_underlying) external returns (uint256[3] memory ); | 12,869,542 |
./full_match/1/0x4CaE5458f76Fced0552FDd765DA5200565406841/sources/contracts/MultiVesting.sol | Returns amount of funds that beneficiary will be able to withdraw at the given timestamp per vesting ID (default is 0). _beneficiary - address of the beneficiary _vestingId - the ID of the vesting (default is 0) _timestamp - Timestamp (in seconds) on which the beneficiary wants to check the withdrawable amount. | function getAvailableAmountAtTimestamp(
address _beneficiary,
uint256 _vestingId,
uint256 _timestamp
) public view returns (uint256) {
if (_vestingId >= vestingMap[_beneficiary].length) {
return 0;
}
Vesting memory vesting = vestingMap[_beneficiary][_vestingId];
uint256 alreadyR... | 3,861,657 |
./full_match/83/0xf063E7c32CBeE0890524AB919758ef72De48e18d/sources/contracts/BaseV1-core.sol | claim accumulated but unclaimed fees (viewable via claimable0 and claimable1) | function claimFees() external returns (uint256 claimed0, uint256 claimed1) {
_updateFor(msg.sender);
claimed0 = claimable0[msg.sender];
claimed1 = claimable1[msg.sender];
if (claimed0 > 0 || claimed1 > 0) {
claimable0[msg.sender] = 0;
claimable1[msg.sender] ... | 9,564,247 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/interfaces/IERC3156.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/A... | return a token that is not the borrowToken | function getFlashLoanToken(address borrowToken, address collateralToken) internal view returns (address jToken) {
address[] memory jTokens = joetroller.getAllMarkets();
for (uint i = 0; i < jTokens.length; i++) {
if (borrowToken != jTokens[i] && collateralToken != jTokens[i]) {
... | 5,349,434 |
/* Devery Funds
======================== */
// ERC20 Interface: https://github.com/ethereum/EIPs/issues/20
contract ERC20 {
function transfer(address _to, uint256 _value) returns (bool success);
function balanceOf(address _owner) constant returns (uint256 balance);
}
contract BuyerFund {
// Store t... | Set before sale enabled. Not changeable once set. Stops address being changed Tokens not purchased Set sale address. | function set_sale_address(address _sale) {
require(msg.sender == creator);
require(sale == 0x0);
require(!bought_tokens);
sale = _sale;
}
| 14,018,139 |
pragma solidity ^0.4.3;
pragma experimental ABIEncoderV2;
contract Manageable {
address public owner;
mapping(address => uint) public admins;
bool public locked = false;
event onOwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor ... | add keywords to the video and keyword index. if the keyword doesn't been added. add the keywords to the videoInfo add the keyword to keywordIndex. | function addKeywords(string hash, string[] keywords) public onlyUploader(videoInfo[hash].uploader) {
if(videoInfo[hash].uploader != address(0) ) {
for(uint i=0; i < keywords.length; i ++) {
if(videoInfo[hash].keywords.index[keywords[i]] == 0) {
videoInfo[hash]... | 12,891,606 |
pragma solidity ^0.6.6;
contract ABDKMathQuad {
/*
* ABDK Math Quad Smart Contract Library. Copyright © 2019 by ABDK Consulting.
* Author: Mikhail Vladimirov <mikhail.vladimirov@gmail.com>
*/
/**
* Smart contract library of mathematical functions operating with IEEE 754
* quadruple-precision binary floating-poi... | Calculate e^x. x quadruple precision number return quadruple precision number/ | function exp (bytes16 x) internal pure returns (bytes16) {
return pow_2 (mulABDK (x, 0x3FFF71547652B82FE1777D0FFDA0D23A));
}
| 2,100,584 |
./full_match/4/0x169C7961908cAD05311f6D19C71366aEFbfc0A3E/sources/k.sol | this is safe from overflow because the sum of all user balances can't exceed 'type(uint256).max' | function transferFrom(
address from,
address to,
uint256 amount
) public notPaused virtual returns (bool) {
if (allowance[from][msg.sender] != type(uint256).max) allowance[from][msg.sender] -= amount;
balanceOf[from] -= amount;
unchecked {
balanceOf[... | 681,062 |
./partial_match/1/0x3bbd0B701755130f14EbB81c8581e1be55eB6B15/sources/contracts/InstallmentsCalc.sol | Calculates and returns the current installment period relative to the loan's startDate, durationSecs, and numInstallments. Using these three parameters and the blocks current timestamp we are able to determine the current timeframe relative to the total number of installments. Get current installment u... | function currentInstallmentPeriod(
uint256 startDate,
uint256 durationSecs,
uint256 numInstallments
) internal view returns (uint256) {
uint256 _currentTime = block.timestamp;
for (uint256 i = 1e18; i >= 10; i = i / 10) {
if (durationSecs % i != durationSecs)... | 15,970,984 |
./full_match/421613/0x861867fad95236F256BA318AECD50d814Be1dC8F/sources/src/LiquidityReserves/remote/IAssetReserves.sol | ------------EVENTS------------------------FUNCTIONS------------ | interface IAssetReserves {
event LockOrBurn(
address indexed sender,
Token[] tokens
);
event MintOrUnlock(
address indexed target,
Token[] mirrorTokens
);
event AssetAddedToWhitelist(
address indexed asset
);
event AssetRemovedFromWhitelist(
a... | 11,575,362 |
./full_match/5/0x7cd5a260DB59b6AD0437D9a8Af02aC2Ac3891EcF/sources/project_/contracts/SystemRole.sol | remove system account. account The address of the account./ | function removeSystemAccount(address account) public virtual {
revokeRole(SYSTEM_ROLE, account);
emit SystemAccountRemoved(account);
}
| 1,901,852 |
/**
*Submitted for verification at Etherscan.io on 2020-11-07
*/
pragma solidity ^0.6.12;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an o... | Not allow trade while user do deposit or withdraw | function verifyTradeBetweenDW() internal view {
require(
now >= latestOracleCallOnTime + cotraderGlobalConfig.TRADE_FREEZE_TIME(),
"FREEZE_FOR_UPDATE_PRICE"
);
}
| 12,712,185 |
// ZuFinance is a DeFi Token issued on Binance Smart Chain (BEP-20),
// Designed to serve the gaming and sports betting industry, with three simple features implemented at its core;
// LP Acquisition 5%
// Burning on each trade 3%
// Static Reward (Reflection) 2% to ... | approve token transfer to cover all possible scenarios add the liquidity | function _addLiquidity(uint256 tokenAmount, uint256 bnbAmount) private {
_approve(address(this), address(router), tokenAmount);
address(this),
tokenAmount,
block.timestamp
);
}
| 15,802,279 |
pragma solidity ^0.4.23;
/*
* NamiMultiSigWallet smart contract-------------------------------
*/
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
contract NamiMultiSigWallet {
uint constant public MAX_OWNER_COUNT = 50;
event Confirmation(address indexed ... | Internal functions/ Adds a new transaction to the transaction mapping, if transaction does not exist yet. destination Transaction target address. value Transaction ether value. data Transaction data payload. return Returns transaction ID. | function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,... | 2,024,787 |
// File: @openzeppelin/contracts-ethereum-package/contracts/Initializable.sol
pragma solidity >=0.4.24 <0.7.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constru... | Hook that is called before a transfering tokens out of an account to one or more token holders To learn more about hooks, head to xref:ROOT:extending-contracts.adocusing-hooks[Using Hooks]./ | function _beforeTokenTransferBatch() internal virtual { }
| 13,763,100 |
./full_match/137/0x7965e8f4B1Dc34898febB2d919513E4c4d242f42/sources/contracts/CaesiumBondDepository.sol | indexed events are emitted redeem bond for user _recipient address _stake bool return uint/ calculate payout vested store updated deposit info | function redeem( address _recipient, bool _stake ) external returns ( uint ) {
Bond memory info = bondInfo[ _recipient ];
uint payout = info.payout.mul( percentVested ).div( 10000 );
function deposit(
uint _amount,
uint _maxPrice,
address _depositor
}
... | 3,752,283 |
./full_match/1/0x2e8920950677F8545B4Ef80315f48E161CB02D1C/sources/contracts/crowdfund/ReraiseETHCrowdfund.sol | `claimMultiple()` in batch form. May not revert if any individual refund fails. votingPowerByCards The voting power for each card claimed for each contributor. Must add up to the total pending voting power for the contributor. tokenIds The IDs of the party c... | function batchClaimMultiple(
uint96[][] calldata votingPowerByCards,
uint256[][] calldata tokenIds,
address[] calldata contributors,
bool revertOnFailure
) external {
for (uint256 i; i < contributors.length; ++i) {
(bool s, bytes memory r) = address(this).call... | 3,105,650 |
pragma solidity ^0.4.19;
/**
* @title ERC20 Basic smart contract
* @author Copyright (c) 2016 Smart Contract Solutions, Inc.
* @author "Manuel Araoz <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6c010d021909000d1e0d03162c0b010d0500420f0301">[email protected]</a>>"
* @dev Simpler ve... | change wallet for advisory vesting (this make possible to set smart-contract address later) _newAdvisoryWallet - new wallet address/ | function setAdvisoryWallet(address _newAdvisoryWallet) onlyOwner public {
advisoryWallet = _newAdvisoryWallet;
SetAdvisoryWallet(_newAdvisoryWallet);
}
| 2,368,193 |
./full_match/1/0x32D48A96fA5552998F524EC72f31D732B66b4f9E/sources/contracts/v1/connectors.sol | Disable Connector. _connector Connector Address./ | function disable(address _connector) external isChief {
require(connectors[_connector], "already-disabled");
delete connectors[_connector];
connectorCount--;
emit LogDisable(_connector);
}
| 17,082,362 |
/**
*Submitted for verification at Etherscan.io on 2020-12-22
*/
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.7.5;
//solhint-disable max-line-length
//solhint-disable no-inline-assembly
contract CloneFactory {
function createClone(address target, bytes32 salt)
internal
returns (address payable... | Initialize the contract, and sets the destination address to that of the creator/ | function init(address _parentAddress) external onlyUninitialized {
parentAddress = _parentAddress;
this.flush();
}
| 2,411,454 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./OpeningCerem... | If verified, add as a verified user to the OpeningCeremony/ | function verify(uint8 v, bytes32 r, bytes32 s) external {
bytes32 structHash = keccak256(abi.encode(VERIFY_TYPEHASH, msg.sender, _useNonce(msg.sender)));
bytes32 digest = _hashTypedDataV4(structHash);
address signer = ECDSA.recover(digest, v, r, s);
require(signer == verifier, "invalid sign... | 1,660,565 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
// 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 3 of the License, or
// (at your option) any later version.
// This pr... | calcSingleInGivenPoolOut tAi = tokenAmountIn (pS + pAo)\ / 1 \\ pS = poolSupply || --------- | ^ | --------- || bI - bI pAo = poolAmountOut \\ pS / ... | function calcSingleInGivenPoolOut(
uint tokenBalanceIn,
uint tokenWeightIn,
uint poolSupply,
uint totalWeight,
uint poolAmountOut,
uint swapFee
)
public pure
returns (uint tokenAmountIn)
{
uint normalizedWeight = bdiv(tokenWeightIn, totalWeight... | 2,076,633 |
// <SquareQueue>
/*
MIT License
Copyright (c) 2020 SquareQueue
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, ... | If callBack does not arrive until after provablelimitBlock, and the outcome of the game cannot be obtained, the ether will be refunded to the player. When callBack arrives too late, it solves the problem inside the callBack function. This function handles the case of what callBack is not completely./ | function storeJam(bytes32 _queryId) private {
jamCount = jamCount.add(1);
CheckJam storage checkJam = checkJamDB[jamCount];
checkJam.play_number = jamCount;
checkJam.play_queryId = _queryId;
Play storage _play = playTable[uint(checkJam.play_queryId)];
_play.p... | 14,064,395 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
// Part: IERC20Wrapper
interface IERC20Wrapper {
/// @dev Return the underlying ERC-20 for the given ERC-1155 token id.
function getUnderlyingToken(uint id) external view returns (address);
/// @dev Return the conversion rate from ERC-1155 to ERC-20, m... | Decode ERC1155 token id to pid, sushiPerShare id Token id | function decodeId(uint id) public pure returns (uint pid, uint sushiPerShare) {
}
| 12,035,126 |
pragma solidity ^0.5.0 ;
/// @title Bounty management
/// @author Kenneth Hu
/// @notice You can use this contract to manage bounty.
/// @dev All function calls are currently implemented without side effects
contract BountyPost{
struct Bounty {
uint id;
string title;
string description;
... | allows the owner to cancel the bounty bountyId the index of bounty | function cancelBounty(uint bountyId) public {
Bounty storage bounty = allBounties[bountyId];
if (bounty.owner == msg.sender || bounty.arbitrator == msg.sender) {
bounty.isCompleted = true;
bounty.owner.transfer(bounty.payment);
}
}
| 5,513,373 |
// SPDX-License-Identifier: NONE
pragma solidity ^0.8.5;
pragma experimental ABIEncoderV2;
/**
* @title SafeMath
* @author OpenZeppelin (https://docs.openzeppelin.com/contracts/3.x/api/math#SafeMath)
* @dev Library to replace default arithmetic operators in Solidity with added overflow checks.
*/
library SafeMath... | Divisor cannot be zero, reverts on division by zero. Result is rounded to zero. Counterpart to Solidity's / operator. Returns the integer division of two unsigned integers. Division / | function div(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b > 0);
uint256 c = a / b;
return c;
}
| 10,988,247 |
// SPDX-License-Identifier: Unlicense
pragma solidity >=0.7.6;
import './HabitatV1Challenge.sol';
import './HabitatBase.sol';
import './HabitatAccount.sol';
import './HabitatWallet.sol';
import './HabitatCommunity.sol';
import './HabitatVault.sol';
import './HabitatVoting.sol';
import './HabitatModule.sol';
import './... | @inheritdoc HabitatBase 7 days | function SECONDS_PER_EPOCH () public virtual override pure returns (uint256) {
return 604800;
}
| 889,823 |
pragma solidity ^ 0.5 .0;
import './SafeMath.sol';
/** @title Q&A bounties */
contract Bounty {
using SafeMath for uint;
/// @notice set up circuit breaker design pattern
bool private stopped = false;
address payable private owner;
uint public questionCount;
uint public answerCount;
... | adds a new question callable by anyone, except contract owner if contract is on _heading short title _description long description of question return true and current question count Ensures that question is funded Contract owner cannot submit questions add new question to mapping using current questionCount as index | function addQuestion(string memory _heading, string memory _description)
stopInEmergency
public
payable
returns(
bool
) {
require(msg.value != 0, "Add a bounty amount");
require(msg.sender != owner, 'Cannot be owner');
allQuestions[questionCount] = Question({
... | 1,037,235 |
./partial_match/97/0x1aBB04723FF281a45BC6A7AABF5712a740DCACdB/sources/NameChangeToken.sol | Transfers `tokenId` from `from` to `to`. As opposed to {transferFrom}, this imposes no restrictions on msg.sender. Requirements: - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. Emits a {Transfer} event./ Clear approvals from the previous owner | function _transfer(address from, address to, uint256 tokenId) internal virtual {
require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
_approve(addr... | 11,343,826 |
pragma solidity ^0.4.24;
import "@aragon/os/contracts/apps/AragonApp.sol";
///@title Member aragon app smart contract
///@author Coinsence blockchain team
contract Member is AragonApp {
struct Member {
address account;
bytes32 ipfsHash;
bool exists;
}
mapping(address => uint32) ... | add new member/ | function addMember(address account, bytes32 ipfsHash) public isInitialized {
require(account != address(0), "invalid address");
require(!addressExists(account));
uint32 _id = membersCount + 1;
Member storage m = members[_id];
m.account = account;
m.ipfsHash = ipfsHash... | 987,664 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.