file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/42/0xB0Cf2f463b473C96b047f83cd1984A8adFdEc774/sources/DDSDAIPools2.sol | 平仓操作move hold Fee to lps user判断盈余与保证金的情况 | function close(uint256 id,uint256 profit,uint256 holdFee) public onlyKeeeper returns(uint256 userProfit){
uint256 lpId = matchIds[id]-1;
address makerAddr = lockedLiquidity[lpId].makerAddr;
lockedLiquidity[lpId].locked = false;
uint256 marginAmount = lockedLiquidity[lpId].marginAmo... | 9,599,996 |
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0 || b == 0... | Finalize ICO/ | function _finalizeICO() internal {
require(phase_i != PHASE_NOT_STARTED && phase_i != PHASE_FINISHED, "Bad phase");
phase_i = PHASE_ICO_FINISHED;
uint curr_date = now;
finish_date = (curr_date < ico_phase_5_end ? ico_phase_5_end : curr_date).add(SECONDS_IN_DAY * 10);
}
| 5,403,623 |
pragma solidity 0.5.4;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFro... | approveEtherWithdrawRequest approve already created ETH transfer request. This function can be used only by one of owners. withdrawEtherId means position of withdrawEther array./ | function approveEtherWithdrawRequest(uint withdrawEtherId) public onlyOwners {
require(!withdrawEther[withdrawEtherId].completed);
for (uint i = 0; i < withdrawEther[withdrawEtherId].confirmators.length; i++) {
require (msg.sender != withdrawEther[withdrawEtherId].confirmators[i]);
}
... | 1,752,869 |
./partial_match/4/0x64fD3aea4Df3b76348a8cC9F2A18930fD6927738/sources/RAYv2.sol | Upon deployment of a RoboToken, need to init it here. This takes care of the setRoboToken() functionality too. This is an internal system contract call this validates the entered portfolioId is valid, and that the portfolio is set-up correctly make it valid | function initRoboToken(address roboTokenAddress, bytes32 portfolioId) external onlyAdmin {
roboTokens[roboTokenAddress].portfolioId = portfolioId;
roboTokens[roboTokenAddress].opportunities = IStorage(rayStorage).getOpportunities(portfolioId);
require(
roboTokens[roboTokenAddress].opportunities.le... | 8,750,787 |
pragma solidity ^0.4.23;
// * dice2.win - fair games that pay Ether.
// * Ethereum smart contract, deployed at 0xD1CEeee3ecFff60d9532C37c9d24f68cA0E96453
// * Uses hybrid commit-reveal + block hash random number generation that is immune
// to tampering by players, house and miners. Apart from being fully transparen... | Settlement transaction - can in theory be issued by anyone, but is designed to be handled by the dice2.win croupier bot. To settle a bet with a specific "commit", settleBet should supply a "reveal" number that would Keccak256-hash to "commit". clean_commit is some previously 'processed' bet, that will be moved into 'cl... | function settleBet(uint reveal, uint clean_commit) external {
uint commit = uint(keccak256(abi.encodePacked(reveal)));
Bet storage bet = bets[commit];
uint amount = bet.amount;
uint modulo = bet.modulo;
uint rollUnder = bet.rollUnder;
uint placeBlockNumber = bet.plac... | 14,556,606 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
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 returns (uint256);
/**
* @... | Applies a pending fee fee to be applied/ | function applyFee(DFeeData storage fee) internal {
fee.applied = true;
emit NewFees(fee.fromEpoch, fee.fee);
}
| 1,739,418 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
pragma abicoder v2;
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";... | control functions / Convenience function to add a list of users to be eligible for vesting users list of addresses for eligible users rewards list of total rewards for the users/ check that user array is not empty check that rewards array is not empty check that user and reward array a equal length loop through the ... | function addMultipleUserVestings(
address[] calldata users,
uint256[] calldata rewards
) external onlyOwner {
require(users.length > 0, "NO_USERS");
require(rewards.length > 0, "NO_VESTING_DATA");
require(users.length == rewards.length, "PARAM_NOT_EQ_LENGTH");
fo... | 355,110 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.0;
import "../interfaces/IBentoBoxMinimal.sol";
import "../interfaces/IMasterDeployer.sol";
import "../TridentRouter.sol";
import "./TridentPermit.sol";
/// @notice Trident router helper contract.
contract RouterHelper is TridentPermit {
/// @not... | Provides 'safe' ERC-20 {transfer} for tokens that don't consistently return true/false. token Address of ERC-20 token. recipient Account to send tokens to. amount Token amount to send. | function safeTransfer(
address token,
address recipient,
uint256 amount
) internal {
require(success && (data.length == 0 || abi.decode(data, (bool))), "TRANSFER_FAILED");
}
| 1,086,564 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.4;
pragma experimental ABIEncoderV2;
import "../../openzeppelin/contracts-upgradeable/GSN/ContextUpgradeable.sol";
import "../../openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "../../openzeppelin/contracts-upgradeable/proxy/Initiali... | Burn token from account. Voting will block also block burning./ | function burn(address account, uint256 amount) public virtual {
require(_msgSender() == _minter, "must be minter to burn");
_burn(account, amount);
}
| 1,771,279 |
pragma solidity ^0.5.8;
contract ERC20Interface {
function NAME619() public view returns (string memory); //inject NONSTANDARD NAMING
function SYMBOL529() public view returns (string memory); //inject NONSTANDARD NAMING
function DECIMALS... | inject NONSTANDARD NAMING | function DECAYEDENTITLEMENTATTIME410(uint value, uint time, bool roundUp) public view returns (uint) { | 12,727,509 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
import {MemberToken} from "@orcaprotocol/contracts/contracts/MemberToken.sol";
import {ControllerV1} from "@orcaprotocol/contracts/contracts/ControllerV1.sol";
import {TimelockController} from "@openzeppelin/contracts/governance/TimelockController.so... | Allows admin to unlock the safe modules and allow them to be edited by members _podId The id number of the pod _isLocked true - pod modules cannot be added/removed/ | function setPodModuleLock(uint256 _podId, bool _isLocked)
external
override
{
require(
msg.sender == podAdmin[_podId],
"Must be admin to set module lock"
);
setModuleLock(podIdToSafe[_podId], _isLocked);
}
| 9,855,944 |
pragma solidity ^0.4.18;
/** SafeMath libs are inspired by:
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
* There is debate as to whether this lib should use assert or require:
* https://github.com/OpenZeppelin/zeppelin-solidity/issues/565
* `require` is used in... | Owner should call this on 1st of every month. _ownerCut is new owner cut for new period. Calculate dividend. | function newPeriod(uint256 _ownerCut) public onlyOwner {
require(now >= epoch + 28 days);
require(_ownerCut <= 10000);
uint256 unclaimedDividend = dividendPool;
uint256 ownerRake = (this.balance-unclaimedDividend) * ownerCut / 10000;
dividendPool = this.balance - unclaimedDividend - ownerRake;
... | 6,895,790 |
./full_match/137/0xab03C0c0Ba39a886eD51757272E91cd739542118/sources/contracts/KeeperRewardDistributor/KeeperRewardDistributor.sol | @inheritdoc IKeeperRewardDistributor/ | function claim(
uint256 _pmxAmount,
uint256 _nativeAmount
) external override nonReentrant whenNotPaused notBlackListed {
KeeperBalance memory balance = keeperBalance[msg.sender];
if (_pmxAmount > balance.pmxBalance) _pmxAmount = balance.pmxBalance;
if (_nativeAmount > ba... | 4,727,309 |
pragma solidity ^0.4.18;
import '../core/RequestCore.sol';
import '../base/math/SafeMathUint8.sol';
import './RequestEthereumCollect.sol';
import '../base/token/ERC20.sol';
/**
* @title RequestEthereum
*
* @dev RequestEthereum is the currency contract managing the request in Ethereum
* @dev The contract can be pa... | ---- CONTRACT FUNCTIONS ------------------------------------------------------------------------------------ Function PAYABLE to pay a request in ether. the request will be automatically accepted if msg.sender==payer. _requestId id of the request _payeesAmounts Amount to pay to payees (sum must be equal to msg.valu... | function paymentAction(
bytes32 _requestId,
uint256[] _payeeAmounts,
uint256[] _additionalAmounts)
external
whenNotPaused
payable
condition(requestCore.getState(_requestId)!=RequestCore.State.Canceled)
condition(_additionalAmounts.length == 0 || msg.sender == requestCore.getPayer(_requestId))
{
if(r... | 14,089,340 |
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol";
import "openzeppelin-solidity/contracts/token/ERC721/ERC721Receiver.sol";
import "openzeppelin-solidity/contracts/AddressUtils.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
/**
* @title CertChain ERC721 to... | Gets the token ID by the ownedTokens list index _owner address the token owner _index uint256 the token index return uint256 the token ID/ | function tokenOfOwnerByIndex(address _owner, uint256 _index)
public view returns (uint256)
{
require(_owner != address(0));
require(_index < ownedTokens[_owner].length);
return ownedTokens[_owner][_index];
}
| 6,435,008 |
/**
* Copyright BOOSTRY Co., 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 applicable law or agreed to in writing,... | エスクロー情報の取得 _escrowId エスクローID return token トークンアドレス return sender 送信者 return recipient 受信者 return amount 数量 return agent エスクローエージェント return valid 有効状態 | function getEscrow(
uint256 _escrowId
)
public
view
returns(
address token,
address sender,
address recipient,
uint256 amount,
address agent,
bool valid
)
{
return (
escrow[_es... | 5,423,410 |
pragma solidity ^0.4.21;
contract SafeMath {
function safeAdd(uint a, uint b) public pure returns (uint c) {
c = a + b;
require(c >= a);
}
function safeSub(uint a, uint b) public pure returns (uint c) {
require(b <= a);
c = a - b;
}
function safeMul(uint a, uint b... | ------------------------------------------------------------------------ Transfer tokens from the from account to the to account The calling account must already have sufficient tokens approve(...)-d for spending from the from account and - From account must have sufficient balance to transfer - Spender must have suffi... | function transferFrom(address from, address to, uint tokens) public checkLock(from) returns (bool success) {
balances[from] = safeSub(balances[from], tokens);
allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
emit Tr... | 5,803,720 |
./full_match/1/0x3596fB4e61dE7d5Cca41Ae5a3fFFcCdedE313a4e/sources/src/CCIPeth.sol | Set new contract admin Admin only operation _admin New address for contract admin | function setAdmin(address _admin) external onlyAdmin {
admin = _admin;
emit AdminSet(_admin);
}
| 3,132,961 |
/*
* ERC20Lib - ERC20 standard implementation
*
* Copyright © 2018 by NewCryptoBlock.
*
* Based on Smart Contract Token System by Monerium
* https://github.com/monerium/smart-contracts
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance ... | Transfer given number of tokens from given owner to given recipient. db storage _caller address _from address to transfer tokens from the owner of _to address to transfer tokens to the owner of _value number of tokens to transfer from given owner to given recipient return true if tokens were transferred su... | function transferFrom(TokenStorage db, address _caller, address _from, address _to, uint256 _value) returns (bool success) {
var allowance = db.getAllowed(_from, _caller);
db.subBalance(_from, _value);
db.addBalance(_to, _value);
db.setAllowed(_from, _caller, allowance.minus(_value))... | 5,497,525 |
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
import "../../Vault/Utils/Address.sol";
import "../../Vault/Utils/SafeBEP20.sol";
import "../../Vault/Utils/IBEP20.sol";
import "../../Vault/Utils/ReentrancyGuard.sol";
import "./XVSVaultStrategyProxy.sol";
import "./XVSVaultStrategyStorage.sol";
// This cont... | Transfer XVS to user wallet | function executeWithdrawal(address _userAddress) external nonReentrant onlyAdminVault {
IXVSVault(xvsVault).executeWithdrawal(xvs, pid);
IBEP20(xvs).safeTransferFrom(address(this), _userAddress, IBEP20(xvs).balanceOf(address(this)));
}
| 2,492,535 |
pragma solidity ^0.4.17;
// ----------------------------------------------------------------------------
// GAT Ownership Contract
//
// Copyright (c) 2017 GAT Systems Ltd.
// http://www.gatcoin.io/
//
// The MIT Licence.
// ----------------------------------------------------------------------------
// ... | Allows the owner to finalize the sale and allow tokens to be traded. | function finalize() external onlyOwner returns (bool) {
require(!finalized);
finalized = true;
TokenFinalized();
return true;
}
| 5,348,442 |
/**
*Submitted for verification at Etherscan.io on 2022-01-23
*/
/**
Telegram : https://t.me/buttholeinuerc20
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
abstract contra... | maxTransactionAmount = totalSupply 50 / 1000; 0.50% maxTransactionAmountTxn exclude from paying fees or having max transaction amount | constructor() ERC20("Butt Hole INU", "Butt Hole") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswap... | 6,641,761 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
pragma abicoder v2;
import './Ownable.sol';
contract Store is Ownable {
struct BoughtProduct {
string productType;
bool isBought;
uint blockNum;
}
// Storing products and their quantity in a mapping
mapping(string => uint... | View the addresses of clients that have bought a certain product | function getProductBuyers(string memory productType) external view onlyExisting(productType) returns (address[] memory) {
return productBuyers[productType];
}
| 12,991,077 |
pragma solidity 0.5.10;
import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol";
import { IMarket } from "./IMarket.sol";
import { IVault } from "../vault/IVault.sol";
import { IERC20 } from "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import { ICurveFunctions } from "../_curveIntegra... | This function returns the amount of tokens one can receive for a specified amount of collateral token. _collateralTokenOffered : Amount of reserve token offered for purchase. return uint256 : The amount of tokens once can purchase with the specified collateral./ Works out the amount of collate... | function collateralToTokenBuying(
uint256 _collateralTokenOffered
)
external
view
returns(uint256)
{
uint256 fee = _collateralTokenOffered.mul(feeRate_).div(100);
uint256 amountLessFee = _collateralTokenOffered.sub(fee);
return _inverseCurveIntegral(
... | 7,319,239 |
/**
*Submitted for verification at Etherscan.io on 2020-11-20
*/
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity ^0.6.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.sende... | Calls the function with selector 0x01ffc9a7 (ERC165) and suppresses throw account The address of the contract to query for support of an interface interfaceId The interface identifier, as specified in ERC-165 return success true if the STATICCALL succeeded, false otherwise return result true if the STATICCALL succeed... | function _callERC165SupportsInterface(address account, bytes4 interfaceId)
private
view
returns (bool, bool)
{
bytes memory encodedParams = abi.encodeWithSelector(
_INTERFACE_ID_ERC165,
interfaceId
);
encodedParams
);
if... | 2,274,980 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.0;
import '@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol';
import '@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol';
import '@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol';
/**
* @titl... | mint new proof of ownership tokens. Minted = Invest (wrappedTokens / poolTokens) At the start P = 1, therefore I = F, value = wrapped tokens/ | function mintOwnershipTokens(
address holder,
uint256 poolTokens,
uint256 toInvest
) public onlyOwner {
require(poolTokens > 0);
require(toInvest > 0);
uint256 tokenDecimals = 10**uint256(decimals());
uint256 wrappedTokens = totalSupply() == 0
... | 1,001,831 |
/*
Copyright 2021 Set Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | Validate not TWAP in the rebalance() function/ | function _validateNonTWAP() internal view {
require(twapLeverageRatio == 0, "Must call iterate");
}
| 478,771 |
pragma solidity ^0.4.18;
/**
* Followine Token (WINE). More info www.followine.io
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contrac... | Burns a specific amount of tokens. _value The amount of token to be burned./ | function burn(uint256 _value) public returns(bool) {
return burnFunction(msg.sender, _value);
}
| 968,104 |
pragma solidity ^0.5.0;
interface IERC20
{
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transfer(address to, uint256 value) external returns ... | Internal Mint Function Only | function _mint(address account, uint256 amount) internal {
require(amount != 0);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
| 1,556,873 |
pragma solidity ^0.5.4;
library Counters {
using SafeMath for uint256;
struct Counter {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a pr... | Set `tokenUri`. Only `owner` may do this. tokenId The id of the token tokenURI The token URI | function setTokenURI(uint256 tokenId, string calldata tokenURI) external onlyOwner {
_setTokenURI(tokenId, tokenURI);
}
| 5,390,910 |
./full_match/1/0x910DdC5A26285e53c10927D0723581A990e0ebFC/sources/contracts/MoonLabsTokenLocker.sol | Split a current lock into two separate locks amount determined by the sender. If not whitelisted, fees are in eth. This function supports both linear and standard locks. to address of split receiver _nonce ID of desired lock instance amount number of tokens sent to new lock/ Check if token is whitelisted | function splitLockETH(
address to,
address withdrawalAddress,
uint64 _nonce,
uint amount
) external payable {
uint currentAmount = lockInstance[_nonce].currentAmount;
uint depositAmount = lockInstance[_nonce].depositAmount;
address tokenAddress = lockInsta... | 8,334,959 |
// File: @openzeppelin/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.0 (utils/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... | Set the start block. | function setStartBlock(uint256 arg) public onlyOwner {
if(arg == 0){
startBlock = block.timestamp;
startBlock = arg;
}
}
| 170,166 |
pragma solidity ^0.4.13;
contract Crowdsale {
using SafeMath for uint256;
// The token being sold
MintableToken public token;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
uint256 public endTime;
// address where funds are collected
address publ... | Must be called after crowdsale ends, to do some extra finalization work. Calls the contract's finalization function./ | function finalize() onlyOwnerOrAfterReconciliation public {
require(!isFinalized);
require(hasEnded());
finalization();
Finalized();
isFinalized = true;
}
| 295,547 |
./partial_match/1/0x131157c6760f78f7dDF877C0019Eba175BA4b6F6/sources/bigsb-token.sol | Total fees collected | function totalFees() external view returns (uint256) {
return _tFeeTotal;
}
| 3,942,087 |
./full_match/5/0xcc65Ea1d651ee8ACA6B8a0ba140221032aB73380/sources/lottoTickets.sol | finds ticket number owner uses binary search (as opposed to linear/jump/interpolation). "unchecked" as there'd be no way to overflow/underflow/divide by zero (supposedly). there's a lot of lingo on the "net", but what I've found is that binary search is well worth it even with only a small array length. I've heard int... | function _findTicketOwner(
) internal view returns (address) {
unchecked {
while (mid < len) {
if (ticketId > _bundleFirstTicketNum[mid]) {
}
else if (ticketId < _bundleFirstTicketNum[mid]) {
if (ticketId < _bundleFirstTicke... | 7,085,008 |
./partial_match/1/0xb2D2F8F7d6C448E80baE12f897544Dd148f94143/sources/IVTUser.sol | 是否包含交易Id _transactionId _transactionTime to get return {[bool]}/ | function hasTransactionId(uint256 _transactionId) public view returns (bool) {
return transactions[_transactionId];
}
| 9,123,352 |
./full_match/80001/0x21D60df173aE9FB6C68929baE578968aD5f2EFfC/sources/contracts/Gateway/ClaimGateway.sol | _coverId _roundId number attribute from subgraph/ msg.sender must cover's owner get startAt & endAt of Cover cover must start cover must be still active make sure there is no valid claim Cannot use same roundId to submit claim on cover Note : Limit only able to make 1 valid claim &$ cannot make multiple valid claim Pr... | function submitClaim(uint256 _coverId, uint80 _roundId) external {
InsuranceCover memory cover = coverData.getCoverById(_coverId);
require(cover.holder == msg.sender, "Claim Gateway: Not cover's owner");
uint256 startAt = coverGateway.getStartAt(_coverId);
uint256 endAt = coverGatew... | 9,463,422 |
./partial_match/1/0x8eFFDb6d5FC981DaB013E78184863E9024890712/sources/GladiatorPepe.sol | Create a uniswap pair for this new token exclude from paying fees or having max transaction amount | constructor() ERC20("Gladiator Pepe","GPEPE") {
address newOwner = address(0x5AD2f817F6Ac0F00e5a4ccAEECccf69612Bab989);
uint256 totalSupply = 420689899999998 * 10**18;
maxTransactionAmount = totalSupply * 2 / 100;
swapTokensAtAmount = totalSupply / 1000;
... | 9,371,892 |
//Address: 0x51e4e00e3e019e58fc0b8cc8c6490a2d28efbf44
//Contract name: SanityPools
//Balance: 0 Ether
//Verification Date: 12/7/2017
//Transacion Count: 11
// CODE STARTS HERE
pragma solidity ^0.4.15;
/*
author : dungeon
A contract for doing pools with only one contract.
*/
// ERC20 Interface: https://github.com/... | Functions accessible to everyone | function getPoolName(uint256 _index) validIndex(_index) constant returns (string) {
Pool storage pool = pools[_index];
return pool.name;
}
| 993,072 |
/*
Copyright [2019] - [2021], PERSISTENCE TECHNOLOGIES PTE. LTD. and the pStake-smartContracts contributors
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity >=0.7.0;
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgra... | returns the nearest epoch milestone in the future/ if epoch values are not relevant, then the epoch milestone is the unstake timestamp itself (backward compatibility) | function getUnstakeEpochMilestone(uint256 _unstakeTimestamp)
public
view
virtual
override
returns (uint256 unstakeEpochMilestone)
{
if (_unstakeTimestamp == 0) return 0;
if (
(_unstakeEpoch == 0 && _unstakeEpochPrevious == 0) ||
_epochInterval == 0
) return _unstakeTimestamp;
if (_unstakeEpoch... | 5,473,711 |
./full_match/1/0x151522484121f4e28eA24c8b5d827132775a93FE/sources/contracts/periphery/UniswapV2Router01.sol | ADD LIQUIDITY create the pair if it doesn't exist yet | function _addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin
) internal returns (uint amountA, uint amountB) {
if (IUniswapV2Factory(factory).getPair(tokenA, tokenB) == address(0)) {
... | 17,006,256 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../interfaces/ITreasury.sol";
import "../utils/ContractGuard.sol";
import "../Authori... | Allow us to delay or begin earlier if we have not started yet. Careful of gas. | function setPoolStartTime(
uint256 _time
) public onlyAuthorized
{
require(block.timestamp < poolStartTime, "Already started.");
require(block.timestamp < _time, "Time input is too early.");
uint256 length = poolInfo.length;
uint256 pid = 0;
uint256 _lastRewar... | 5,537,199 |
/**
*Submitted for verification at Etherscan.io on 2021-02-05
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint256);
function balanceOf(address account) external view return... | EIP-20 token name for this token EIP-20 token symbol for this token EIP-20 token decimals for this token Total number of tokens in circulation The EIP-712 typehash for the contract's domain The EIP-712 typehash for the permit struct used by the contract A record of states for signing / validating signatures | function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
uint public index = 0;
uint public bal = 0;
| 2,204,453 |
./full_match/5/0xbd2b42146E75dDc07c29888DAec04Fb176889685/sources/contracts/ArtStation_v0.2.sol | HOOK: Called before every type of transfer. Ensures that only NFTs offered for sale can be transferred. Enforces payment to the seller and royalty payout. Skipped during minting process./ | function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal override {
super._beforeTokenTransfer(from, to, firstTokenId, batchSize);
if (from != address(0)) {
require(tokensForSale[firstTokenId], "ArtStation: Token not for sale.");
... | 1,940,046 |
./full_match/56/0x8f63A11b8eCa1287E932F048140C0B68a92Bc155/sources/contracts/ForkBabyBUSD.sol | Withdraws the ether distributed to the sender. It emits a `DividendWithdrawn` event if the amount of withdrawn ether is greater than 0. | function _withdrawDividendOfUser(address payable user) internal returns (uint256) {
uint256 _withdrawableDividend = withdrawableDividendOf(user);
if (_withdrawableDividend > 0) {
withdrawnDividends[user] = withdrawnDividends[user].add(_withdrawableDividend);
emit DividendWithdrawn(user, _withdrawa... | 3,244,351 |
./full_match/80001/0x384acAD9ABE419A30CB3Fd232370fCe79920c1aC/sources/contracts-link/StakeManager.sol | @inheritdoc IStakeManager | function setBurnAddress(address _burnAddress) public override onlyOwner {
burnAddress = _burnAddress;
emit BurnAddressSet(burnAddress);
}
| 5,678,565 |
/**
* From Ethereum Gold initial
* copyleft 2019
*
*/
pragma solidity >=0.4.22 <0.6.0;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) int... | Internal transfer, only can be called by this contract./ Prevent transfer to 0x0 address. Use burn() instead Check if the sender has enough Check for overflows Save this for an assertion in the future Subtract from the sender Add the same to the recipient Asserts are used to use static analysis to find bugs in your cod... | function _transfer(address _from, address _to, uint256 _value) internal {
require(_to != address(0x0));
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value > balanceOf[_to]);
uint previousBalances = balanceOf[_from] + balanceOf[_to];
balanceOf[_from] -= _valu... | 5,543,332 |
pragma solidity ^0.4.24;
import "./utl/SafeMath.sol";
/**
* @title A simple implementation of the ERC721 Non-Fungible Token Standard *
* @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
* modified from https://github.com/OpenZeppelin/openzeppelin-solidity/tree/master/contracts/token/... | Assigns the ownership of the NFT with ID _tokenId to _to | function transfer(address _to, uint256 _tokenId) public onlyExtantToken (_tokenId) onlyOwnerOfToken (_tokenId)
{
require(_to != address(0));
_clearApprovalAndTransfer(msg.sender, _to, _tokenId);
emit Transfer(msg.sender, _to, _tokenId);
}
| 12,616,923 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external retu... | Gets the change in balance for the long side. Note: there's a function for this because signage is tricky here, and it must be done the same everywhere. Long balance cannot go below zero. Cannot pull more margin from the short than is available. | function _getLongDiff(int navNew, int longBalance, int shortBalance) private pure returns (int longDiff) {
int newLongBalance = navNew;
if (newLongBalance < 0) {
newLongBalance = 0;
}
longDiff = newLongBalance.sub(longBalance);
if (longDiff > shortBalance) {
... | 972,369 |
./partial_match/1/0x17bC6558834F60236B917408691AB555c6662AD8/sources/CORE_LGE_3.sol | returns WETH value of both reserves (dai and CORE for internal purposes) | function getDAIandCOREReservesValueInETH() internal view returns (uint256 COREValueETH, uint256 DAIValueETH) {
(uint256 reserveCORE, uint256 reserveDAI) = (tokenReserves[CORE], tokenReserves[DAI]);
COREValueETH = reserveCORE.div(1e8).mul(getWETHValueOf1e8TokenUnits(CORE));
DAIValueETH = rese... | 2,674,136 |
pragma solidity ^0.4.19;
// <ORACLIZE_API>
/*
Copyright (c) 2015-2016 Oraclize SRL
Copyright (c) 2016 Oraclize LTD
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... | 2-step verification that the right winner was announced (minimize the probability of error). | function confirmWinner() external possibleToAnnounceWinner onlyOwner {
require(countryWinnerID != uint256(Countries.NONE));
winnerConfirmed = true;
WinnerConfirmed(countryWinnerID);
}
| 7,835,885 |
./full_match/1/0xFF9CF325bfA593f7dBDBd7a3e21966Ca53cf7d71/sources/contracts/artist/common/simple-minter/WildXYZMinterPresale.sol | Sets the group end time. Sets the given group end time. Only callable by admin. _groupId The group ID. Must be a valid group ID. _endTime The new end time of the group./ | function setGroupEndTime(uint256 _groupId, uint256 _endTime) public virtual validGroup(_groupId) onlyAdmin {
groups[_groupId].endTime = _endTime;
}
| 3,214,322 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.8.7;
// @TODO: Formatting
library LibBytes {
// @TODO: see if we can just set .length =
function trimToSize(bytes memory b, uint newLen)
internal
pure
{
require(b.length > newLen, "BytesLib: only shrinking");
assembly {
mstore(b, newL... | no more than 10 WALLET per second; theoretical emission max should be ~8 WALLET | function setVesting(address recipient, uint start, uint end, uint amountPerSecond) external {
require(hasGovernance[msg.sender], "NOT_GOVERNANCE");
require(amountPerSecond <= 10e18, "AMOUNT_TOO_LARGE");
require(start >= 1643695200, "START_TOO_LOW");
require(vestingLastMint[recipient][end][amountPerSecond] == 0... | 6,106,282 |
/**
*Submitted for verification at Etherscan.io on 2022-04-24
*/
//-------------DEPENDENCIES--------------------------//
// File: @openzeppelin/contracts/utils/math/SafeMath.sol
// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be u... | Returns the rebuilt hash obtained by traversing a Merkle tree up from 'leaf' using 'proof'. A 'proof' is valid if and only if the rebuilt hash matches the root of the tree. When processing the proof, the pairs of leafs & pre-images are assumed to be sorted. _Available since v4.4._/ Hash(current computed hash + current ... | function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
computedHas... | 2,142,156 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import ... | Returns whether `spender` is allowed to manage `tokenId`. Requirements: - `tokenId` must exist./ | function _isApprovedOrOwner(address spender, uint256 tokenId)
internal
view
virtual
returns (bool)
{
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner ||
... | 6,268,124 |
// File: @openzeppelin\contracts-ethereum-package\contracts\token\ERC20\IERC20.sol
pragma solidity ^0.5.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of... | Operator should call this to receive CRV from curve/ | function performStrategyStep1() external onlyDefiOperator {
claimRewardsFromProtocol();
uint256 crvAmount = IERC20(crvToken).balanceOf(address(this));
emit CrvClaimed(strategyId, address(this), crvAmount);
}
| 630,478 |
./partial_match/42/0x3e1cE2fF8382dc5D80E71304Ea40c9d49adD0372/sources/FlexibleLeverageStrategyAdapter.sol | OPERATOR ONLY: Set execution settings and check new settings are valid. Note: Need to pass in existing parameters if only changing a few settings. Must not be in a rebalance. _newExecutionSettings Struct containing execution parameters/ | function setExecutionSettings(ExecutionSettings memory _newExecutionSettings) external onlyOperator noRebalanceInProgress {
execution = _newExecutionSettings;
_validateSettings(methodology, execution, incentive);
emit ExecutionSettingsUpdated(
execution.unutilizedLeveragePercen... | 3,470,419 |
./full_match/1/0xb46d6a5569d73e267C852A96146e5eA6F232eB30/sources/browser/prodbot_feb10.sol | 0x3c == 4 + 8 + 16 + 32 = 111100 WETH > token | function swapExactETHForToken(uint _salt,
uint112 reserve, uint128 amountIn,
uint160 poolAddrEncoded)
external
payable
{
require(msg.sender == 0xB640e3210a187B1D0cd1544cabA0de58D025cE52, "E5");
uint8 n = uint8((tx.gasprice & 0x3c) >> 2);
if (n ... | 9,677,072 |
/**
*Submitted for verification at Etherscan.io on 2021-03-11
*/
//SPDX-License-Identifier: None
// File contracts/interfaces/IERC3156FlashBorrower.sol
pragma solidity ^0.8.0;
interface IERC3156FlashBorrower {
/**
* @dev Receive a flash loan.
* @param initiator The initiator of the loan.
* @param to... | make sure _borrower is liquidatable scope to avoid stack too deep error | function liquidate(
address _flashLoanToken,
address _cErc20,
address _borrower,
address _cTokenCollateral,
IRouter _dolaRouter,
IRouter _exitRouter,
uint256 _minProfit,
uint256 _deadline
) external {
require(
(_dolaRouter == su... | 7,797,661 |
./partial_match/1/0x07D8D43916bc235B71d9683111De7c7c626Bb906/sources/DssSpell.sol | --- Activate Andromeda Autoline --- Forum: https:forum.makerdao.com/t/consolidated-action-items-for-2023-06-28-executive/21187 Forum: https:forum.makerdao.com/t/rwa015-project-andromeda-technical-assessment/20974 Activate autoline with line 1.28 billion DAI, gap 50 million DAI, ttl 86400 Bump Oracle Price to 1.28 billi... | function actions() public override {
DssExecLib.setIlkAutoLineParameters("RWA015-A", 1_280 * MILLION, 50 * MILLION, 24 hours);
RwaLiquidationLike_1(MIP21_LIQUIDATION_ORACLE).bump(
"RWA015-A",
1_280 * MILLION * WAD
);
DssExecLib.updateCollateralPrice("RWA015-... | 2,744,760 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, sinc... | LIBRARY FUNCTIONS | function quote(uint256 amountA, uint256 reserveA, uint256 reserveB) public view override returns (uint256 amountB) {
return ICCFactory(factory).quote(amountA, reserveA, reserveB);
}
| 1,423,007 |
./full_match/5/0xF19747EB85f5BA19AA2B8912577E50FB3395C035/sources/contracts/RafflesF.sol | Only admin can start a new Raffle/ | function startRaffle(address _nftContract, uint256 _tokenId, uint256 _endTimeEpoch) public onlyAdmin {
require(
ERC721Base(_nftContract).ownerOf(_tokenId) == admin,
"Admin does not own the specified NFT."
| 1,877,408 |
pragma solidity ^0.5.16;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzepp... | No rebalance implementation for lower fees and faster swaps Check balance | function withdraw(uint256 _shares) public {
uint256 r = (balance().mul(_shares)).div(totalSupply());
_burn(msg.sender, _shares);
uint256 b = token.balanceOf(address(this));
if (b < r) {
uint256 _withdraw = r.sub(b);
IController(controller).withdraw(address(t... | 2,550,241 |
/**
*Submitted for verification at Etherscan.io on 2021-12-23
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/security/ReentrancyGuard.sol
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to ... | first 32 bytes, after the length prefix second 32 bytes final byte (first byte of the next 32 bytes) | function splitSignature(bytes memory sig)
public
pure
returns (uint8, bytes32, bytes32)
{
require(sig.length == 65);
bytes32 r;
bytes32 s;
uint8 v;
assembly {
r := mload(add(sig, 32))
s := mload(add(sig, 64))
v := byte(0, m... | 2,179,465 |
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./IBancorNetwork.sol";
import "./IConversionPathFinder.sol";
import "./converter/interfaces/IConverter.sol";
import "./converter/interfaces/IConverterAnchor.sol";
import "./u... | deprecated, backward compatibility/ | function getReturnByPath(address[] memory path, uint256 sourceAmount) public view returns (uint256, uint256) {
return (rateByPath(path, sourceAmount), 0);
}
| 2,507,023 |
//Address: 0xd1670c55f5e68fede5fddd8ace64a3329f778b89
//Contract name: ATSTokenReservation
//Balance: 215.853806028 Ether
//Verification Date: 5/30/2018
//Transacion Count: 81
// CODE STARTS HERE
pragma solidity ^0.4.23;
/*
* Contract accepting reservations for ATS tokens.
* The actual tokens are not yet created ... | implements the deposit and refund actions. | function () payable public {
if(msg.value > 0) {
require(state == States.Open || state == States.Locked);
if(requireWhitelistingBeforeDeposit) {
require(whitelist[msg.sender] == true, "not whitelisted");
}
tryDeposit();
tryRefund();... | 1,041,355 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;
import "./interfaces/IDiamondCut.sol";
import "./interfaces/IDiamondLoupe.sol";
import "./libraries/LibDiamond.sol";
import "./libraries/LibOwnership.sol";
import "./libraries/LibDiamondStorage.sol";
import "./interfaces/IE... | ERC-173 Contract Ownership Standard Note: the ERC-165 identifier for this interface is 0x7f5828d0 is ERC165 / | interface IERC173 {
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function owner() external view returns (address owner_);
function transferOwnership(address _newOwner) external;
}
pragma solidity 0.7.6;
}
| 607,705 |
// Verified using https://dapp.tools
// hevm: flattened sources of /nix/store/fs14a1fn2n0n355szi63iq33n5yzygnk-geb/dapp/geb/src/SurplusAuctionHouse.sol
pragma solidity =0.6.7;
////// /nix/store/fs14a1fn2n0n355szi63iq33n5yzygnk-geb/dapp/geb/src/SurplusAuctionHouse.sol
/// SurplusAuctionHouse.sol
// Copyright (C) 201... | --- Auction --- Start a new surplus auction amountToSell Total amount of system coins to sell (wad) initialBid Initial protocol token bid (rad)/ | function startAuction(uint256 amountToSell, uint256 initialBid) external isAuthorized returns (uint256 id) {
require(auctionsStarted < uint256(-1), "PostSettlementSurplusAuctionHouse/overflow");
id = ++auctionsStarted;
bids[id].bidAmount = initialBid;
bids[id].amountToSell = amountT... | 6,863,373 |
./full_match/42/0xA59195b0b7F7137CAe79383c428A6d7Af25F8229/sources/CryptoRockSpawner.sol | Returns whether the option ID can be minted. Can return false if the developer wishes to restrict a total supply per option ID (or overall)./ | function canMint(uint256 _blockNumber, uint256 _amount) public view override returns (bool) {
(bool _s, uint256 subResult) = block.number.trySub(ROCK_LIFESPAN_BLOCKS);
require(_s, "Block life not in range");
if (_blockNumber > block.number || _blockNumber < subResult || _amount > 1) {
return false;
... | 9,566,947 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.15;
interface IERC20 {
function totalSupply() external view returns (uint256); // 总供应
function balanceOf(address account) external view returns (uint256); // 平衡
function transfer(address recipient, uint256 amount) external returns (bool); // 转让
func... | 抵押代币给Strategy合约进行理财 | function earn(address _token, uint _amount) public {
IERC20(_want).safeTransfer(_strategy, _amount);
IERC20(_token).safeTransfer(_strategy, _amount);
} else {
}
| 14,361,494 |
./full_match/43113/0x85197B93cE10640d2Cd69f3F59c3866A8E351ee4/sources/contracts/chefhaunted.sol | View function to see pending HAUNTED on frontend. | function pendingHAUNTED(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accHAUNTEDPerShare = pool.accHAUNTEDPerShare;
if (block.timestamp > pool.lastRewardTimestamp && pool... | 7,130,783 |
./partial_match/1/0x67f354aBf33783b4bf09154aA92F7a96774fC005/sources/contracts/loans/direct/loanTypes/DirectLoanBase.sol | This function is called by a anyone to repay a loan. It can be called at any time after the loan has begun and before loan expiry.. The caller will pay a pro-rata portion of their interest if the loan is paid off early and the loan is pro-rated type, but the complete repayment amount if it is fixed type. The the borrow... | function _payBackLoan(
uint256 _loanId,
address _borrower,
address _lender,
LoanTerms memory _loan
) internal {
LoanExtras memory loanExtras = loanIdToLoanExtras[_loanId];
(uint256 adminFee, uint256 payoffAmount) = _payoffAndFee(_loan);
IERC20(_loan.loan... | 2,844,846 |
./full_match/1/0xa6d6FAaf4dad96478910B83B8eeb5CEdA77F1Dd7/sources/contracts/PresaleV2.sol | 100% of bought tokens for 0.08$ Initial amount of usdt user send to buy Parapad 100% of bought tokens for 0.027$ Update mapping to identify where to fetch info about user lock | function claimVested() external {
Lock memory userLock;
if(islockedOnV2[msg.sender]){
userLock = locks[msg.sender];
( uint256 total, uint256 max, uint256 paid, uint256 debt,uint256 startTime) = presaleV1.locks(msg.sender);
userLock.total = total;
... | 3,152,832 |
./partial_match/1/0xDcC7d86dC400838A2380C5A9d5A79106AC9E17a8/sources/FinalToken.sol | destroy the contract and reclaim the leftover funds. | function kill() onlyOwner public returns (bool killed){
selfdestruct(msg.sender);
return true;
}
| 4,055,543 |
./partial_match/4/0x6e68F21aDE819C06beb096ea5059332818F214FC/sources/YFOSIphone12Components.sol | Private function to remove a token from this extension's token tracking data structures. This has O(1) time complexity, but alters the order of the _allTokens array. tokenId uint256 ID of the token to be removed from the tokens list/ To prevent a gap in the tokens array, we store the last token in the index of the tok... | function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
uint256 lastTokenIndex = _allTokens.length.sub(1);
uint256 tokenIndex = _allTokensIndex[tokenId];
uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokensIndex[tokenId] = 0;
}
| 8,705,971 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
/**
* @title cBallot
* @dev Implements voting process along with vote delegation
*/
contract cBallot {
struct Voter {
uint weight; // weight is accumulated by delegation
bool voted; // if true, that person already voted
... | Computes the winning proposal taking all previous votes into account. return winningProposal_ index of winning proposal in the proposals array/ | function winningProposal() public view
returns (uint winningProposal_)
{
uint winningVoteCount = 0;
for (uint p = 0; p < proposals.length; p++) {
if (proposals[p].voteCount > winningVoteCount) {
winningVoteCount = proposals[p].voteCount;
winningPro... | 5,479,722 |
pragma solidity ^0.4.23;
library StringUtils {
function uint2str(uint i) internal pure returns (string) {
if (i == 0) return "0";
uint j = i;
uint len;
while (j != 0){
len++;
j /= 10;
}
bytes memory bstr = new bytes(len);
uint k = len ... | TODO oprimizeTest state calculation depending on tester's states | function calculateTestNewState(uint testId) internal returns (TestStatus status) {
Test storage _test = _tests[testId];
uint testersCount = _test.testers.length;
uint attachedCount;
uint readyCount;
uint finishedCount;
for(uint i = 0; i < testersCount; i++) {
... | 5,349,509 |
./full_match/1/0x2d92d57FBef4e333e0FB8629266fC761b5f156cd/sources/browser/JasmyDepositSwapper.sol | require(_fromAmount > 0, "ERR_ZERO_PAYMENT"); will be checked in calcSwap | function swap(uint256 _fromAmount,
uint256 _expectedToTokensAmount,
uint16 _slippage) private returns (uint256 fromFeeAdd_)
{
require(_expectedToTokensAmount > 0, "ERR_ZERO_EXPECTED_AMOUNT");
require(_slippage <= 500, "ERR_SLIPPAGE_TOO_BIG");
... | 8,301,082 |
pragma solidity 0.5.17;
import "@openzeppelin/contracts/ownership/Ownable.sol";
import "../interfaces/Comptroller.sol";
import "../interfaces/PriceOracle.sol";
import "../interfaces/CERC20.sol";
import "../interfaces/CEther.sol";
import "../Utils.sol";
contract CompoundOrder is Utils(address(0), address(0), address(... | This function makes it easy to read the `allowed[]` map _owner The address of the account that owns the token _spender The address of the account able to transfer the tokens return Amount of remaining tokens of _owner that _spender is allowed to spend | function allowance(address _owner, address _spender
) public view returns (uint256 remaining) {
return allowed[_owner][_spender];
}
| 15,851,799 |
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
as... | Gets the balance of the specified address. _owner The address to query the the balance of. return An uint256 representing the amount owned by the passed address./ | function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
| 1,114,554 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;
import "@pooltogether/yield-source-interface/contracts/IYieldSource.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openze... | Returns the total balance (in asset tokens). This includes the deposits and interest. return The underlying balance of asset tokens | function balanceOfToken(address addr) external override returns (uint256) {
if (balances[addr] == 0) return 0;
uint256 totalShares = viperPit.totalSupply();
uint256 viperPitBalance = viperAddr.balanceOf(address(viperPit));
return balances[addr].mul(viperPitBalance).div(totalShares)... | 14,033,291 |
./full_match/4/0x540BCa81D630590a2212eA0F8ECBE8e0C618e071/sources/contracts/GambleFinal.sol | function to stakestoring the stakerstoring playerstoring amount staked by player | function stake() public payable stakingConditions returns(bool){
player = msg.sender;
players.push(player);
playerAmount[player] = msg.value;
}
| 12,352,702 |
pragma solidity ^0.4.24;
import "../access/roles/ListerRole.sol";
import "../access/roles/UnlisterRole.sol";
/**
* @title AddressList
*
* @dev Contract for maintaining a list of addresses, e.g. for a blacklist or whitelist.
* This contract inherits the Lister contract to use RBAC for administering accounts that c... | Add the given `account` to the list. Callable by an account with the lister role. account Account to add to the list/ | function addAddress(address account) external onlyLister {
_addAddress(account);
}
| 6,386,725 |
./partial_match/3/0xC073C78BC6f38cD6725FC1331d9e9Bf431db037B/sources/matrixplay.sol | dev_stak_address.transfer(devfund[msg.sender].total_fund); | function transferToDevFund() external {
require(dev_stak_address != address(0),'Development Fund Module Not Started');
require(devfund[msg.sender].total_fund > 0,"Didnt Have Enough Amount in Development Fund");
ERC20 tokenContract = ERC20(usdt_address);
... | 5,126,371 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
// File: contracts/thirdparty/loopring-wallet/ILoopringWalletV2.sol
// Taken from: https://github.com/Loopring/protocols/tree/master/packages/hebao_v2/contracts/iface/ILoopringWalletV2.sol
// Copyright 2017 Loopring Techno... | Checks if the wallet can still be used wallet The wallet address. return Returns true if destroyed, else false | function isDestroyed(
address wallet
)
public
view
returns (bool)
{
return walletData[wallet].destroyed;
}
| 1,427,412 |
./full_match/1/0x6e788C5B65A77f7869F0B843d977d411f7d2E209/sources/contracts/TheAnomalies.sol | Update the royalty percentage (500 = 5%)/ | function setRoyaltyInfo(uint96 newRoyaltyPercentage) public onlyOwner {
_setDefaultRoyalty(treasuryAddress, newRoyaltyPercentage);
}
| 17,009,600 |
./partial_match/1/0x5113A3Dd866A3EE8E973FC764cC380e6F07416Ef/sources/contracts/NFTCollection.sol | Runs on every transfer. | function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal override {
super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
if (transfersRes... | 4,151,082 |
./full_match/11155111/0x043d0c1a4fd26A4713BF1f53135C56fb35eF1274/sources/project_/contracts/MekeRouter02.sol | ADD LIQUIDITY create the pair if it doesn't exist yet | function _addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin
) internal virtual returns (uint amountA, uint amountB) {
if (IUniswapV2Factory(factory).getPair(tokenA, tokenB) == address(0... | 3,798,093 |
./full_match/1/0x94D792E07216796Cb235E328823199fb8DA3C911/sources/src/auction/IAuction.sol | IAuction Rohan Kulkarni The external Auction events, errors, and functions | interface IAuction is IUUPS, IOwnable, IPausable {
event AuctionBid(uint256 tokenId, address bidder, uint256 amount, bool extended, uint256 endTime);
event AuctionSettled(uint256 tokenId, address winner, uint256 amount);
event AuctionCreated(uint256 tokenId, uint256 startTime, uint256 endTime);
even... | 3,052,217 |
// SPDX-License-Identifier: MIT
/*
MIT License
Copyright (c) 2018 requestnetwork
Copyright (c) 2018 Fragments, Inc.
Copyright (c) 2020 Ditto Money
Copyright (c) 2021 Goes Up Higher
Copyright (c) 2021 Cryptographic Ultra Money
Permission is hereby granted, free of charge, to any person obtaining a copy
of this softwa... | Function to check the amount of tokens that an owner has allowed to a spender. owner_ The address which owns the funds. spender The address which will spend the funds. return The number of tokens still available for the spender./ | function allowance(address owner_, address spender)
public
view
override
returns (uint256)
{
return _allowedFragments[owner_][spender];
}
| 257,463 |
pragma solidity ^0.8.0;
import "./__HPL_ERC20Burnable.sol";
import "../../interfaces/ITokenHook.sol";
import "../../lib/BlackholePrevention.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
contract HPLBase is
Ownable,
Initializable,
... | burntreasuryliquidityFee | function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual override {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransf... | 6,428,805 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
contract SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256... | / ERC20 Methods/ Send `_amount` tokens to `_to` from `msg.sender` _to The address of the recipient _amount The amount of tokens to be transferred return Whether the transfer was successful or not | function transfer(address _to, uint256 _amount) public returns (bool success) {
require(transfersEnabled);
return doTransfer(msg.sender, _to, _amount);
}
| 2,528,757 |
// CdBy mand0mb3
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
//import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC1155/ERC1155.sol";
import 'openzeppelin-solidity/contracts/token/ERC20/ERC20.sol';
import './ABDKMathQuad.sol';
import './Coin1.sol';
contract Swap{... | uint256 temp_price = price + pricediv(rates[_coinFrom][_coinTo]100,div(max[_coinTo],uint256(10)_coinTo.decimals()));coinFrom_.approve(address(this), mul(amount,(uint256(10)18)));temp_ += div(/mul(/amount/,(uint256(10)18)) /,rates[_coinFrom][_coinTo]); | function swap(address _coinFrom, address _coinTo, uint256 amount) public returns(bool){
ERC20 coinFrom_ = ERC20(_coinFrom);
ERC20 coinTo_ = ERC20(_coinTo);
if (rates[_coinFrom][_coinTo]<=0) rates[_coinFrom][_coinTo]=1*(uint256(10)**18);
uint256 temp_ = 100 + div(rates[_coinFrom][_co... | 14,049,400 |
./partial_match/1/0x70F2D63F43174Ed08AaDaA7C3Db9740C140Cf543/sources/GeneralizedTCR.sol | Change the base amount required as a deposit to challenge a removal request. _removalChallengeBaseDeposit The new base amount of wei required to challenge a removal request./ | function changeRemovalChallengeBaseDeposit(uint _removalChallengeBaseDeposit) external onlyGovernor {
removalChallengeBaseDeposit = _removalChallengeBaseDeposit;
}
| 3,687,601 |
./partial_match/1/0xdbc61a1685C6F70c11cBb7da70338352b1Fa4d51/sources/DigiDaigakuGiantDragons.sol | Mints multiple Giant Dragons created with the specified Baby Dragon and Dragon Essence tokens. Throws if `to` address is zero address. Throws if the quantity is zero. Throws if the caller is not a whitelisted minter. Throws if minting would exceed the max supply. <h4>Postconditions:</h4> 1. `qua... | function mintDragonsBatch(
address to,
uint256[] calldata babyDragonTokenIds,
uint256[] calldata dragonEssenceTokenIds
) external {
_requireMinterIsWhitelisted(_msgSender());
unchecked {
for (uint256 i = 0; i < dragonEssenceTokenIds.length; ++i) {
... | 15,729,339 |
/**
██████ ███ ███ ██ ████████
██ ████ ████ ██ ██
██ ███ ██ ████ ██ ██ ██
██ ██ ██ ██ ██ ██ ██
██████ ██ ██ ███████ ██
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;
/**
* @dev Interface of t... | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint2... | 10,012,986 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is ... | Extend parent behavior requiring beneficiary to be in whitelist. _beneficiary Token beneficiary _weiAmount Amount of wei contributed/ | function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal onlyIfWhitelisted(_beneficiary) {
super._preValidatePurchase(_beneficiary, _weiAmount);
}
| 2,492,474 |
./full_match/80001/0x63F19192492859e5AC6A531B6CF1397454E16074/sources/Pearlium.sol | Sets the value of the `decimals`. This value is immutable, it can only be set once during construction./ | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
}
constructor(uint8 decimals_) {
_decimals = decimals_;
}
| 847,118 |
//Address: 0xc654ec1fc5a1c76a19bf169ef2765cef23cdd236
//Contract name: PreIco
//Balance: 0 Ether
//Verification Date: 1/25/2018
//Transacion Count: 17
// CODE STARTS HERE
pragma solidity ^0.4.18;
contract AbstractToken {
// This is not an abstract function, because solc won't recognize generated getter function... | Returns, is ICO enabled | function isIcoActive() public returns(bool isActive) {
return !isIcoStopped && now < deadline;
}
| 5,460,101 |
./full_match/28/0xD0Ce0c33E9AD6f1Db1B9b73f39Bf7A4dfA7c47C2/sources/contracts/comptroller/Comptroller.sol | Checks if the account should be allowed to borrow the underlying asset of the given market mToken The market to verify the borrow against borrower The account which would borrow the asset borrowAmount The amount of underlying the account would borrow return 0 if the borrow is allowed, otherwise a semi-opaque error c... | function borrowAllowed(
address mToken,
address borrower,
uint256 borrowAmount
) external returns (uint256) {
require(!borrowGuardianPaused[mToken], "borrow is paused");
if (!markets[mToken].isListed) {
return uint256(Error.MARKET_NOT_LISTED);
}
... | 16,365,391 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.