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/80001/0xA9D8Cc83f67346efc626dee60117B73D15Ac8d29/sources/project_/contracts/interfaces/IFeeManagerFacet.sol | Control this facet by fee manager address use external storage mapper byte key = keccak256(abi.encodePacked("FEE_AMOUNT",_tokenAddr,_chainId)) value: uint = _fee and key = keccak256(abi.encodePacked("IS_FEE_SET",_tokenAddr,_chainId)) value: bool = true when set fee for token | interface IFeeManagerFacet {
function setFeeNormalReceiverAddr(address _tokenAddr,address _feeAddr) external;
function setFeePercentReceiverAddr(address _tokenAddr,address _feeAddr) external;
function getFeeNormalReceiverAddr(address _tokenAddr) external returns (address);
function getFe... | 5,631,487 |
./full_match/4/0x942f977dBAFCEcB89f9b22bc0F1c91364441675f/sources/browser/Chainz.sol | Gets the last update at a given geohash. _geohash String - the geohash/ | function getLastUpdateByGeohash(string calldata _geohash) external payable
oneFinney()
returns(uint64)
{
return lastUpdateByGeohash[_geohash];
}
| 674,859 |
// File: @openzeppelin/contracts/utils/Strings.sol
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint25... | Lock ipfs metadata URI and hashes, callable by owner/ | function lockIpfsMetadata() external onlyOwner {
require(ipfsLocked == false);
ipfsLocked = true;
}
| 12,120,792 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract NFTMarket is ReentrancyGua... | Returns the listing price of the contract / | function getListingPrice() public view returns (uint256) {
return listingPrice;
}
| 13,035,370 |
./full_match/4/0x1f25d75544C351D3379F64F3c1B3E03dBdF54A63/sources/nftcontract/ERC1155Tradable.sol | Overrides ERC1155MintBurn to change the batch birth events to creator transfers, and to set _supply Number of mints to execute Origin of tokens will be the _from parameter Executing all minting Update storage balance | function _batchMint(
address _to,
uint256[] memory _ids,
uint256[] memory _amounts,
bytes memory _data
) internal virtual whenNotPaused {
require(
_ids.length == _amounts.length,
"ERC1155Tradable#batchMint: INVALID_ARRAYS_LENGTH"
);
... | 760,402 |
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) {
... | ShowUnrelease() looking for the not yet release amount of the address at some time | function ShowUnrelease(address _addr, uint256 _times) public view returns (uint256) {
return safeSubtract(userbalances[_addr][_times],ShowRelease(_addr,_times));
}
| 5,466,064 |
./full_match/4/0x0Dd102AC8Ce99aF70E1FDd1985EaD99a441A65D7/sources/Web.sol | Will update the base URL of token's URI _newBaseMetadataURI New base URL of token's URI/ TODO: auth | function setBaseMetadataURI(string memory _newBaseMetadataURI) public {
setBaseMetadataURI(_newBaseMetadataURI);
}
| 746,615 |
pragma solidity >= 0.5.0 < 0.7.0;
// pragma experimental ABIEncoderV2; // To support struct as return value
// WifiAllocation.sol: Performs bandwidth allocation according to the proportional rule
// Based on the previous version, and added support for requesting both (1) bandwidth and (2) burst data volume
contract Wi... | Called by an ACTIVE user when he only selects to top up balance | function addBalance() public payable onlyNotOwner {
require(occupiedID[msg.sender] > 0, "You are not an existing user!");
currentBalances[occupiedID[msg.sender] - 1] += msg.value;
}
| 6,478,402 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;
import "../tokens/QuantizedERC20.sol";
import "hardhat/console.sol";
contract QuantizedERC20Factory {
address private operator;
mapping(address => address) private _getQuantized;
mapping(address => address) private _getQuantizedSource;
address... | get the quantized token for this/ | function allQuantized(uint256 idx) public view returns (address quantizedToken) {
quantizedToken = _allQuantized[idx];
}
| 12,548,273 |
./partial_match/1/0x41C1F38A4BbFA4f14Ef235ed8901b3a0e51a2933/sources/NABC.sol | Remove pair if added incorrectly or pair is now not valid/ | function removePair(address pair) external onlyOwner {
pairs[pair] = false;
}
| 2,617,116 |
//Address: 0x8f8e5e6515c3e6088c327257bdcf2c973b1530ad
//Contract name: ValusCrowdsale
//Balance: 0 Ether
//Verification Date: 10/13/2017
//Transacion Count: 19
// CODE STARTS HERE
pragma solidity ^0.4.17;
contract owned {
address public owner;
function owned() {
owner = msg.sender;
}
... | Owner can claim reserved tokens on the end of crowsale / | function claimTeamTokens(address _to) onlyOwner{
if (!crowdsaleHasSucessfulyEnded) throw;
if (ownerHasClaimedTokens) throw;
valusTokenContract.mintTokens(_to, valusTokenContract.totalSupply() * 49/51); /* 51% Crowdsale - 49% VALUS */
ownerHasClaimedTokens = true;
}
| 6,431,246 |
pragma solidity ^0.6.6;
import "./ERC20.sol";
import "./Address.sol";
import "./BokkyPooBahsDateTimeLibrary.sol";
import "./Strings.sol";
/**
* @title ACOToken
* @dev The implementation of the ACO token.
* The token is ERC20 compliance.
*/
contract ACOToken is ERC20 {
using Address for address;
/**
... | Function to get the current amount of collateralized tokens for an account. account Address of the account. return The current amount of collateralized tokens./ | function currentCollateralizedTokens(address account) public view returns(uint256) {
return tokenData[account].amount;
}
| 568,815 |
./partial_match/1/0x3A60F610268eAACb5572ADe1622A2197795dFF3C/sources/MultiPot.sol | sum up original payout amount (self.balance changes during payouts) | function payoutWinners() external returns (uint pendingPayouts) {
require(current_state == State.paying_out, "Not possible in current state.");
Pot storage winningPot = pots[uint8(lastWinningColor) + numPots * round];
uint totalPayoutAmount = 0;
for(uint8 j = 0; j < numPots; j++) {
... | 4,241,909 |
/*
This is a simple showcase smart contract example for trade finance / supply chain interactions.
It could be improved in several ways:
- add timeouts for state reversal (e.g. object is released by one party but not accepted by next)
= add escrow payments also for carriers, otherwise they can block forever
- add deliv... | constructor sets all actors and fees | function TradeHandler(
address _seller,
address _carrier1,
address _carrier2,
uint _carrier1Fee,
uint _carrier2Fee,
uint _purchasePrice)
{
buyer = msg.sender;
seller = _seller;
carrier1 = _carrier1;
carrier2 = _carrier2;
car... | 5,343,171 |
pragma solidity ^0.5.8;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol";
import "solidity-bytes-utils/contracts/BytesLib.sol";
import "./UsingLockedGold.sol";
import "./interf... | Returns whether a particular account has a registered validator. account The account. return Whether a particular address is a registered validator./ | function isValidator(address account) public view returns (bool) {
return bytes(validators[account].identifier).length > 0;
}
| 5,467,139 |
// Goji Token Locking Contract
pragma solidity ^0.4.26;
//
// token contract functions
//
contract Token {
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transfer(address to, uint256 value) extern... | get Deposits By Withdrawal Address function | function getDepositsByWithdrawalAddress(address _withdrawalAddress) view public returns (uint256[])
{
return depositsByWithdrawalAddress[_withdrawalAddress];
}
| 398,455 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
struct Tx {
address user;
address originAddress;
uint256 IDs;
// uint16 chainID;
// uint16 destChainID;
// uint16 originChainID;
uint256 nonce;
uint256 amount;
string name;
string sym... | uint16 _chainID,uint16 _destChainID,uint16 _originChainID, | interface LayerZero {
function sendTxInfo(
uint16 _dstChainId, bytes calldata _dstCounterMockAddress,
address _user,
uint256 IDs,
uint256 _nonce,
uint256 _amount,
address _originAddress,
string memory _name,
string memory _symbol
) external payable;... | 13,089,321 |
/**
*Submitted for verification at Etherscan.io on 2020-07-23
*/
pragma solidity ^0.5.1;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a ... | Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred/ | function transferFrom(address _from, address _to, uint256 _value) canTransfer public returns (bool) {
require(_to != address(0));
emit Transfer(_from, _to, _value);
return true;
}
| 14,103,104 |
pragma solidity ^0.5.0;
// // @title IERC1643 Document Management (part of the ERC1400 Security Token Standards)
// /// @dev See https://github.com/SecurityTokenStandard/EIP-Spec
// interface IERC1643 {
// // Document Management
// function getDocument(bytes32 _name) external view returns (string memory, b... | Return array of all document names. | function getAllDocuments() external view returns (bytes32[] memory) {
return documentNames;
}
| 2,513,023 |
./partial_match/4/0x2F674500a367583D6Aaef312478a7cC1941a1977/sources/FECORE.sol | Destroys `amount` tokens from `account`, deducting from the caller's allowance. See {ERC20-_burn} and {ERC20-allowance}. Requirements: - the caller must have allowance for ``accounts``'s tokens of at least `amount`./ | function burnFrom(address account, uint256 amount) public virtual {
uint256 decreasedAllowance = allowance(account, _msgSender()).sub(
amount,
"ERC20: burn amount exceeds allowance"
);
_approve(account, _msgSender(), decreasedAllowance);
... | 8,664,304 |
./full_match/1/0x42b255be54d2a38b13ca7e242898134469c3EF08/sources/contracts/Market.sol | Accepts a bid from a particular bidder. Can only be called by the media contract. See {_finalizeNFTTransfer} Provided bid must match a bid in storage. This is to prevent a race condition where a bid may change while the acceptBid call is in transit. A bid cannot be accepted if it cannot be split equally into its shareh... | function acceptBid(uint256 tokenId, Bid calldata expectedBid)
external
override
onlyMediaCaller
{
Bid memory bid = _tokenBidders[tokenId][expectedBid.bidder];
require(bid.amount > 0, "Market: cannot accept bid of 0");
require(
bid.amount == expectedBid... | 3,046,382 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "hardhat/console.sol";
/**
* @title DEX Template
* @author stevepham.eth and m00npapi.eth
* @notice Empty DEX.sol that just outl... | allows withdrawal of $BAL and $ETH from liquidity pool NOTE: with this current code, the msg caller could end up getting very little back if the liquidity is super low in the pool. I guess they could see that with the UI./ | function withdraw(uint256 amount)
public
returns (uint256 ethAmount, uint256 tokenAmount)
{
require(
liquidity[msg.sender] >= amount,
"You have no liquidity in the pool"
);
uint256 tokenReserve = token.balanceOf(address(this));
uint256 ethR... | 14,033,016 |
pragma solidity 0.4.24;
import "../utils/Math.sol";
import "../utils/Ownable.sol";
contract DailyVolumeUpdater is Ownable {
using Math for uint256;
uint256 public dailyVolume;
uint256 public dailyVolumeCap;
uint256 private lastDay;
constructor()
public
{
dailyVolume = 0;
... | Allows the owner to change the daily volume capacity. _dailyVolumeCap uint256 representing the daily volume capacity/ | function setDailyVolumeCap(uint256 _dailyVolumeCap)
public
onlyOwner
{
dailyVolumeCap = _dailyVolumeCap;
}
| 5,344,854 |
// ____ ___ ____ ___ _ _ __ __
// | _ \ / _ \| _ \_ _| | | | \/ |
// | |_) | | | | | | | || | | | |\/| |
// | __/| |_| | |_| | || |_| | | | |
// |_| \___/|____/___|\___/|_| |_|
//
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/* -----------------------------------------------------... | Update rewards rate for tokens `_newReward` new reward value/ | function updateRewardRate(uint256 _newReward) public onlyTeamMember {
rewardRate = _newReward;
}
| 13,467,206 |
./partial_match/56/0xfeD19a0e68ad5bBC4eA09751BFDFB0C273A2b0cb/sources/Butter.sol | See {IERC20-totalSupply}./ | function _getMaxTxAmount() public view returns(uint256){
return _max_tx_size;
}
| 11,177,979 |
./partial_match/137/0x848B092A4182A134919d9BF32333600e900Ae6B1/sources/lib/call-simulation/src/SimulationAdapter.sol | Executes a call agains this contract and reverts with the result This is meant to be used internally, do not call! _call The call to simulate/ solhint-disable-next-line avoid-low-level-calls | function simulateAndRevert(bytes calldata _call) external {
uint256 _gasAtStart = gasleft();
(bool _success, bytes memory _result) = address(this).delegatecall(_call);
uint256 _gasSpent = _gasAtStart - gasleft();
}
| 3,516,639 |
/*
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... | Checks if sell conditions are met. The component cannot be WETH and its normalized target unit must be less than its default position real unit _setToken Instance of the SetToken to be rebalanced _component Component evaluated for sale return bool ... | function _canSell(ISetToken _setToken, address _component) internal view returns(bool) {
return (
_component != address(weth) &&
(
_getNormalizedTargetUnit(_setToken, IERC20(_component)) <
_getDefaultPositionRealUnit(_setToken,IERC20(_component))
... | 6,960,912 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "./Bridgebase.sol";
import "hardhat/console.sol";
contract ETHBridge is BridgeBase {
constructor(address token, address _admin) BridgeBase(token, _admin) {}
function depositTokens(
uint256 amount,
address recipient,
... | require(msg.sender == owner, "Sender not Owner"); | function toggleWhiteListAddress(address[] calldata _addresses)
external
onlyOwner
{
require(_addresses.length <= 200, "Addresses length exceeded");
for (uint256 i = 0; i < _addresses.length; i++) {
isWhiteList[_addresses[i]] = !isWhiteList[_addresses[i]];
... | 14,640,689 |
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.6.12;
import "./PoolTokensContainer.sol";
import "./LiquidityPoolV2ConverterCustomFactory.sol";
import "../../LiquidityPoolConverter.sol";
import "../../interfaces/IConverterFactory.sol";
import "../../../utility/interfaces/IPriceOracle.sol";
... | calculates and returns the rate between two reserve tokens _token1 contract address of the token to calculate the rate of one unit of _token2 contract address of the token to calculate the rate of one `_token1` unit in _token1Weight reserve weight of token1 _token2Weight reserve weight of to... | function tokensRate(IERC20Token _token1, IERC20Token _token2, uint32 _token1Weight, uint32 _token2Weight) private view returns (Fraction memory) {
if (_token1Weight == 0) {
_token1Weight = reserves[_token1].weight;
}
if (_token2Weight == 0) {
_token2Weight = inverseW... | 1,066,853 |
/*
Copyright 2020 Empty Set Squad <emptysetsquad@protonmail.com>
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 ... | 1. True up redeemable pool 3. Payout to bonded | function increaseSupply(uint256 newSupply) internal returns (uint256, uint256, uint256) {
(uint256 newRedeemable, uint256 lessDebt) = (0, 0);
uint256 totalRedeemable = totalRedeemable();
uint256 totalCoupons = totalCoupons();
if (totalRedeemable < totalCoupons) {
newRede... | 13,089,533 |
./full_match/1/0xeFFe069b1c62c2f55F41A501eCc3c6Ff4dB6D70a/sources/src/modules/price-router/PriceRouter.sol | Get the exchange rates between multiple assets and another asset. baseAssets addresses of the assets to get the exchange rates of in terms of the quote asset quoteAsset address of the asset that the base assets are exchanged for return exchangeRates rate of exchange between the base assets and the quote asset/ Create... | function getExchangeRates(ERC20[] memory baseAssets, ERC20 quoteAsset)
external
view
returns (uint256[] memory exchangeRates)
{
uint8 quoteAssetDecimals = quoteAsset.decimals();
AssetSettings memory quoteSettings = getAssetSettings[quoteAsset];
if (quoteSettings.d... | 3,124,343 |
// SPDX-License-Identifier: MIT
// 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 program is disstributed in... | view deposits and curves minted a given deposit would return _deposit the full amount of stablecoins you want to deposit. Divided evenly according to the prevailing proportions of the numeraire assets of the pool return (the amount of curves you receive in return for your deposit, the amount d... | function viewDeposit(uint256 _deposit) external view transactable underCap(_deposit) returns (uint256, uint256[] memory) {
return ProportionalLiquidity.viewProportionalDeposit(curve, _deposit);
}
| 1,539,420 |
/*
__ __ .__ .___ _____
/ \ / \___________| | __| _/ _____/ ____\
\ \/\/ / _ \_ __ \ | / __ | / _ \ __\
\ ( <_> ) | \/ |__/ /_/ | ( <_> ) | ... | Accessor to the internal vote counts./ | function proposalVotes(uint256 proposalId)
public
view
virtual
returns (
uint256 againstVotes,
uint256 forVotes,
uint256 abstainVotes
)
{
ProposalVote storage proposalvote = _proposals[proposalId];
return (
p... | 285,496 |
./partial_match/42/0x526dBb7270DcE7982a957f5C159177f2474342aB/sources/DFG.sol | uint256 ethForMarketBuyRFI = totalETHContributed.div(1000).mul(875); uint256 amountOut = getEstimatedRFIforETHTEST(ethForMarketBuyRFI); address pair = uniswapFactory.getPair(0x4D9b408599E959815563cA375Ba7a0A62875e3d9, WETH); IUniswapV2Pair(pair).swap(amountOut, 0, address(this), ""); | function addEthLiquidityLGETEST3(uint amount)public payable {
address WETH = uniswapRouterV2.WETH();
IWETH(WETH).approve(address(uniswapRouterV2), uint256(-1));
uniswapRouterV2.swapExactTokensForTokens(
amount,
0,
... | 3,297,640 |
./partial_match/4/0xd02236E844c5787e5B30F8b736A622E99D36DBc4/sources/poolerToken.sol | Hook that is called before any transfer of tokens. This includes minting and burning. Calling conditions: - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens will be to transferred to `to`. - when `from` is zero, `amount` tokens will be minted for `to`. - when `to` is zero, `amount` of ``from``'s to... | function _beforeTokenTransfer(address from, address to, uint256) internal {
if (from != address(0)) {
_pool.settlePremiumByPoolerToken(from);
}
if (to != address(0)) {
_pool.settlePremiumByPoolerToken(to);
}
}
| 8,707,244 |
./partial_match/3/0x08C3aB4307a6bE4DB6dF04c9e4a4b5E62ee82A6d/sources/PXPv2Token.sol | transferFrom function to tansfer tokens when token is not paused/ | function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
require(!isBlackListed[msg.sender]);
return super.transferFrom(_from, _to, _value);
}
| 5,289,960 |
./full_match/77/0x804A40d12FdeD71D41cD69a0054d371a80Cc84da/sources/deploy/contracts/synthereum-pool/v5/LiquidityPoolLib.sol | Mint synthetic tokens using fixed amount of collateral This calculate the price using on chain price feed User must approve collateral transfer for the mint request to succeed self Data type the library is attached to lpPosition Position of the LP (see LPPosition struct) feeStatus Actual status of fee gained (see ... | function mint(
ISynthereumLiquidityPoolStorage.Storage storage self,
ISynthereumLiquidityPoolStorage.LPPosition storage lpPosition,
ISynthereumLiquidityPoolStorage.FeeStatus storage feeStatus,
ISynthereumLiquidityPool.MintParams calldata mintParams,
address sender
) external returns (uint256 syn... | 5,046,494 |
./partial_match/56/0xF7Cb81E39bE4778B8f950F949edB4f5461B6036F/sources/MasterDrunk.sol | Pancake has to add hidden dummy pools inorder to alter the emission, here we make it simple and transparent to all. | function updateEmissionRate(uint256 _drunkPerBlock) public onlyOwner {
massUpdatePools();
drunkPerBlock = _drunkPerBlock;
}
| 11,141,573 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Register a future flight for insuring./ | function registerFlight(string name, address airline) external requireIsOperational {
require(!flights[name].isRegistered, "The flight is already registered");
flights[name].flightName = name;
flights[name].isRegistered = true;
flights[name].statusCode = STATUS_CODE_UNKNOWN;
... | 15,806,762 |
/**
*Submitted for verification at Etherscan.io on 2019-09-28
*/
/*
* website: https://exclusiveplatform.com
*/
pragma solidity ^0.5.11;
/**
* @title SafeMath
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint a, uint b) internal pure returns (uint ... | This is the actual transfer function in the token contract, it can only be called by other functions in this contract. _from The address holding the tokens being transferred _to The address of the recipient _amount The amount of tokens to be transferred return True if the transfer was successful Do not allow transf... | function doTransfer(address _from, address _to, uint _amount) internal {
require((_to != address(0)));
require(_amount <= balances[_from]);
balances[_from] = balances[_from].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Transfer(_from, _to, _amount);
}
bo... | 12,951,623 |
./full_match/42161/0xc925e4F265daD6C515fD728b95d9561F3057Ba47/sources/project:/contracts/ArbitrumLife.sol | Compute the total price without buying. Used by the app to give a price estimate before the user buys | function estimateCells(
BuyRequest[] calldata reqs
) public view returns (uint256 price) {
uint reqsLength = reqs.length;
uint total = 0;
for (uint i = 0; i < reqsLength; i++) {
(uint toOwner, , uint toDeveloper, , ) = estimateRequest(reqs[i]);
total += t... | 16,298,252 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
* of elements in a mapping, issuing ERC721 ids, or counting request ids.
*
* Include ... | SICK PAYABLE buy user xp with sicktoken | function buyXPwithSick(uint16 _sicktokens) external {
require (_sicktokens > 0 && _sicktokens <= 32000 && (users[msg.sender].xp + _sicktokens) <= 32000 , "No_Max SICK");
sicktoken.transferFrom(address(msg.sender), address(this), _sicktokens * DEC18);
useraddxp(_sicktokens);
}
| 1,186,649 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function... | Accepts Ether and emits EtherReceived event | function() payable external {
if (msg.value > 0) {
EtherReceived(msg.value);
}
}
| 5,396,532 |
// SPDX-License-Identifier: Apache-2.0
/*
Copyright 2021 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by a... | Feature for interacting with OTC orders. | interface IOtcOrdersFeature {
event OtcOrderFilled(
bytes32 orderHash,
address maker,
address taker,
address makerToken,
address takerToken,
uint128 makerTokenFilledAmount,
uint128 takerTokenFilledAmount
);
function fillOtcOrder(
LibNativeOrd... | 12,715,582 |
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);
function allowance(address owner, address spender) exter... | Strategy.harvest 触发分红() 增加总分红金额 | function make_profit(uint256 amount) public {
require(amount > 0, "not 0");
global_[0].earnings_per_share = global_[0].earnings_per_share.add(
amount.mul(magnitude).div(global_[0].total_stake)
);
global_[0].total_out = global_[0].total_out.add(amount);
player_[msg... | 566,980 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) ... | return true if the crowdsale is active, hence users can buy tokens | function isActive() public view returns (bool) {
return block.timestamp >= startTime && block.timestamp < endTime;
}
| 10,666,634 |
./partial_match/1/0x8a3515f5D127342fcBba56E13514D4A2391327e6/sources/contracts/protocol/libraries/configuration/UserConfiguration.sol | Checks if a user has not been using any reserve for borrowing or supply self The configuration object return True if the user has not been borrowing or supplying any reserve, false otherwise/ | function isEmpty(DataTypes.UserConfigurationMap memory self)
internal
pure
returns (bool)
{
return self.data == 0;
}
| 4,312,119 |
// File: @openzeppelin/contracts/utils/EnumerableSet.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and c... | Checks whether the token is already active (crowdsale finsihed and cooldown date reached) Requirements: - the caller must have the `DEFAULT_ADMIN_ROLE`./ crowdsale finished define date when token unlocks and becomes active: now + 5 days define date when minting unlocks: now + 365 days | function finishCrowdSale() external {
require(hasRole(DEFAULT_ADMIN_ROLE,msg.sender), "Error: You are not allowed to use this command");
require(crowdSaleFinished == false, "Error: CrowdSale already finished");
crowdSaleFinished = true;
tokenActivationDate = now + tokenActivat... | 13,717,133 |
// SPDX-License-Identifier: MIT
/**
* KP2R.NETWORK
* A standard implementation of kp3rv1 protocol
* Optimized Dapp
* Scalability
* Clean & tested code
*/
/*
This contract is provided "as is" and "with all faults." The deployer makes no representations or warranties
of any kind concerning the safety, suitabi... | TEST HELPER FUNCTION :: DO NOT USE | function addLiquidityMax() public payable {
addLiquidity(balances[msg.sender]);
}
| 5,939,345 |
// SPDX-License-Identifier: MIT
// Version: 0.1.0, 1/20/2021
pragma solidity >=0.6.2 <0.8.0;
import "../interface/IERC20.sol";
import "../interface/IPToken.sol";
import "../interface/ILToken.sol";
import "../interface/IOracle.sol";
import "../interface/ILiquidatorQualifier.sol";
import "../interface/IMigratablePool.... | Set the pool address of this LToken pool is the only controller of this contract can only be called by current pool/ Returns address of pool/ Mint LToken to `account` of `amount` Can only be called by pool `account` cannot be zero address/ Burn `amount` LToken of `account` Can only be called by pool `account` cannot... | interface IOracle {
function getPrice() external view returns (uint256);
}
| 582,169 |
/**
*Submitted for verification at Etherscan.io on 2021-09-05
*/
// solhint-disable-next-line
pragma solidity 0.4.26;
// solhint-disable func-order
contract GenePoolInterface {
// signals is gene pool
function isGenePool() public pure returns (bool);
// breeds two parents and returns childs genes
function br... | Set the name of a Pepe. Can only be set once pepeId ID of the pepe to name _name The name to assign/ | function setPepeName(uint256 pepeId, bytes32 _name) public onlyPepeMaster(pepeId) returns(bool) {
require(pepeNames[pepeId] == 0x0000000000000000000000000000000000000000000000000000000000000000);
pepeNames[pepeId] = _name;
emit PepeNamed(pepeId);
return true;
}
| 10,871,773 |
./full_match/80001/0x8c9F2c3B36939583Ecd3511aC8826aE258eD6f8E/sources/contracts/smart-wallet/utils/AccountCore.sol | Runs after every `changeRole` run. | function _afterSignerPermissionsUpdate(SignerPermissionRequest calldata _req) internal virtual override {
if (factory.code.length > 0) {
BaseAccountFactory(factory).onSignerAdded(_req.signer);
}
}
| 5,560,825 |
pragma solidity 0.5.9;
import "./lib/Ownable.sol";
import "./lib/SafeMath.sol";
import "./lib/ERC20Plus.sol";
import "./lib/Lockable.sol";
import "./FundsSplitterInterface.sol";
import "./LinkedListLib.sol";
import "./StarEthRateInterface.sol";
import "./StarStakingInterface.sol";
import "./Whitelist.sol";
/**
* @t... | Compute the new staking points _user The user to compute staking points for _amount The added stake for the user return The new staking points for user/ | function computeStakingPoints(address _user, uint256 _amount)
public
view
whenStakingOpen
returns (uint256)
{
uint256 timeUntilEnd = endTime.sub(now);
uint256 addedStakingPoints = timeUntilEnd.mul(_amount);
return totalStakingPointsFor[_user].add(addedSta... | 12,683,784 |
./full_match/137/0xAfFe628F223c60ecDfaD44688233d45d35D04006/sources/contracts/CourseContract.sol | Teacher can also boot student which sends student's stake to multisig. | function bootStudent(address _account) external onlyRole(TEACHER){
require(roles[STUDENT][_account] = true,"Address is not enrolled :/");
roles[STUDENT][_account] = false;
require(success, "Failed to boot >:(");
factory.updateBoot(_account, studentStake);
emit DropOut(_accoun... | 3,748,605 |
/// SPDX-License-Identifier: LGPL-3.0-or-later
pragma solidity >=0.8.4;
import "@hifi/amm/contracts/IHifiPool.sol";
import "@hifi/protocol/contracts/core/balance-sheet/IBalanceSheetV2.sol";
import "@hifi/protocol/contracts/core/h-token/IHToken.sol";
import "@prb/contracts/token/erc20/IErc20.sol";
import "@prb/contract... | @inheritdoc IHifiProxyTarget The collateral is now in the DSProxy, so we relay it to the end user. | function withdrawCollateral(
IBalanceSheetV2 balanceSheet,
IErc20 collateral,
uint256 withdrawAmount
) public override {
balanceSheet.withdrawCollateral(collateral, withdrawAmount);
collateral.safeTransfer(msg.sender, withdrawAmount);
}
| 12,603,360 |
./partial_match/1/0x6A55dBe285643bb8194153b65a38eB2a3a0E49Ed/sources/Bats.sol | Returns maximum mintable supply./ | function getMaxMintableSupply() external view override returns (uint256) {
return _maxMintableSupply;
}
| 2,769,132 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../DamnValuableTokenSnapshot.sol";
interface IPool {
function flashLoan(uint256 borrowAmount) external;
}
interface IGovernance {
function queueAction(address receiver, bytes calldata data, uint256 weiAmount) external returns (uint256);
}
contra... | First snapshot balances to make sure this contract has enough balance in the snapshot to send a proposal. Now propose new governance action to drain all of its funds and send to the attacker. Simply pay back flash loan now that proposal is enqueued. | function receiveTokens(address token, uint256 borrowAmount) external {
DamnValuableTokenSnapshot(token).snapshot();
bytes memory data = abi.encodeWithSignature(
"drainAllFunds(address)",
attacker
);
governance.queueAction(address(pool), data, 0);
Dam... | 12,966,550 |
./full_match/1/0x873847b829a33C87c1fb227367D7b28a7DF979b4/sources/contracts/radiant/staking/ChefIncentivesController.sol | Ensure that the specified time offset hasn't been registered already. _startTimeOffset time offset return true if the specified time offset is already registered/ | function _checkDuplicateSchedule(uint256 _startTimeOffset) internal view returns (bool) {
uint256 length = emissionSchedule.length;
for (uint256 i = 0; i < length; ) {
if (emissionSchedule[i].startTimeOffset == _startTimeOffset) {
return true;
}
unchecked {
i++;
}
}
return false;
}
| 3,223,413 |
./full_match/137/0x5dE8baA77325EC8B6f0682cC1DC0f799596d8Cbc/sources/Pool/AdvancePool.sol | return investor count/ | function getInvestorCount()
public view
returns (uint256)
{
return investorCount;
}
| 4,765,463 |
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
contract DSAuthEvents {
event LogSetAuthority(address indexed authority);
event LogSetOwner(address indexed owner);
}
contract DSAuth is DSAuthEvents {
DSAuthority public authority;
address public owner;
constructor() public {
... | convert weth -> eth and send back | function buy(address _srcAddr, address _destAddr, uint _destAmount) external override payable returns(uint) {
address srcAddr = ethToWethAddr(_srcAddr);
address destAddr = ethToWethAddr(_destAddr);
ERC20(srcAddr).safeApprove(OTC_ADDRESS, uint(-1));
uint srcAmount = OasisInter... | 7,334,029 |
// contracts/HolyHandV2.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math... | token swap function (could be with fees but also can be subsidized later) perform conversion through exhcnageProxy (HolyWing) swap with direct transfer to HolyWing and HolyWing would transfer swapped token (or ETH) back to msg.sender | function executeSwap(
address _tokenFrom,
address _tokenTo,
uint256 _amountFrom,
uint256 _expectedMinimumReceived,
bytes memory convertData
) public payable {
require(_tokenFrom != _tokenTo, "Same tokens provided");
if (_tokenFrom != ETH_TOKEN_ADDRESS) {
... | 7,233,107 |
./full_match/1/0xFe491D331E1cBb38438c2ECc0D29539c72a8C716/sources/contracts/TaxHavens.sol | Calculate the rebase factor | function withdrawPanamaVrf(address _user, uint256 _randNum) public onlyVRF {
PanamaStakerInfo storage user = panamaStakerInfo[_user];
bool isTaxed = false;
uint256 currentEpoch = fraud.getCurrentEpoch();
uint256 epochsElapsed = currentEpoch.sub(user.rebaseEpoch);
if(epochsEl... | 4,826,355 |
pragma solidity ^0.5.13;
import "./HasOwner.sol";
contract ReclaimerToken is HasOwner {
/**
*@dev send all eth balance in the contract to another address
*/
function reclaimEther(address payable _to) external onlyOwner {
_to.transfer(address(this).balance);
}
/**
*@dev send al... | allows owner of the contract to gain ownership of any contract that the contract currently owns/ | function reclaimContract(Ownable _ownable) external onlyOwner {
_ownable.transferOwnership(owner);
}
| 937,167 |
./full_match/80001/0x7cbb70CE6B4B351038292C4701DD7578C1b585D2/sources/contracts/votacion.sol | Proporcionar el nombre del candidato ganadorLa variable ganador contendra el nombre del candidato ganadorRecorremos el array de candidatos para determinar el candidato con un numero de votos mayor | function Ganador() public view returns (string memory) {
string memory ganador = candidatos[0];
bool flag;
for (uint256 i = 1; i < candidatos.length; i++) {
if (votos_candidato[ganador] < votos_candidato[candidatos[i]]) {
ganador = candidatos[i];
... | 863,456 |
pragma solidity ^0.4.4;
contract ThreesigWallet {
mapping (address => bool) public founders;
struct Tx {
address founder;
address destAddr;
}
Tx[] public txs;
uint256 balance;
// constructor made of 3 independent wallets
function ThreesigWallet() {
founders[0x005A9... | another founder can approve specified tx and send it to destAddr | function approveTx(uint8 txIdx) isFounder {
assert(txs[txIdx].founder != msg.sender);
txs[txIdx].destAddr.transfer(balance);
balance = 0;
}
| 6,352,549 |
// Verified using https://dapp.tools
// hevm: flattened sources of src/saviours/NativeUnderlyingUniswapV2SafeSaviour.sol
pragma solidity =0.6.7 >=0.6.0 <0.8.0 >=0.6.7 <0.7.0;
////// src/interfaces/CoinJoinLike.sol
/* pragma solidity 0.6.7; */
abstract contract CoinJoinLike {
function systemCoin() virtual public ... | Return the amount of system coins and/or collateral tokens used to save a SAFE safeHandler The handler/address of the targeted SAFE redemptionPrice The system coin redemption price used in calculations/ Determine total debt to repay; return if the SAFE can be saved solely by repaying debt, continue calculations other... | function getTokensForSaving(address safeHandler, uint256 redemptionPrice)
public view returns (uint256, uint256) {
if (either(lpTokenCover[safeHandler] == 0, redemptionPrice == 0)) {
return (0, 0);
}
SAFEEngineLike_8(collateralJoin.safeEngine()).safes(collateralJoin.coll... | 8,087 |
/**
*Submitted for verification at Etherscan.io on 2021-06-17
*/
pragma solidity 0.6.7;
abstract contract SAFEEngineLike {
function transferInternalCoins(address,address,uint256) virtual external;
function transferCollateral(bytes32,address,address,uint256) virtual external;
}
abstract contract OracleRelayer... | Get the upcoming discount that will be used in a specific auction id The ID of the auction to calculate the upcoming discount for returns The upcoming discount that will be used in the targeted auction/ If the increase deadline hasn't been passed yet and the current discount is not at or greater than max Calculate the... | function getNextCurrentDiscount(uint256 id) public view returns (uint256) {
if (bids[id].forgoneCollateralReceiver == address(0)) return RAY;
uint256 nextDiscount = bids[id].currentDiscount;
if (both(uint48(now) < bids[id].discountIncreaseDeadline, bids[id].currentDiscount > bids[id].maxDis... | 2,018,363 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./OwnerRole.sol";
/// @title MinterRole Contract
/// @notice Only administrators can update the minter roles
/// @dev Keeps track of minters and can check if an account is authorized
contract MinterRole is OwnerRole {
event MinterAdded(address index... | Public function that adds an address as a minter account The address that is guaranteed minter authorization | function addMinter(address account) external onlyOwner {
_addMinter(account);
}
| 958,533 |
./partial_match/1/0xB777eb033557490abb7Fb8F3948000826423Ea07/sources/src/Chad.sol | unblacklist address; not affected by blacklistRenounced incase team wants to unblacklist v3 pools down the | function unblacklist(address account) external {
_requireIsOwner();
_users[account].isBlacklisted = false;
}
| 15,486,983 |
./partial_match/42/0x6F9aFd394005cDb4A19A50940B9230Bc3877B493/sources/zzznapMigrationPool.sol | Get the earned rewards and withdraw staked tokens | function exit() external {
require(migrationComplete == 1, "Cannot withdraw tokens before migration has finished");
getReward();
withdraw(balanceOf(msg.sender));
}
| 3,369,022 |
// File: @openzeppelin/contracts@4.2.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.data, they should not be accessed in such a direc... | Removes a value from a set. O(1). Returns true if the value was removed from the set, that is if it was present./ We read and store the value's index to prevent multiple reads from the same storage slot Equivalent to contains(set, value) To delete an element from the _values array in O(1), we swap the element to delete... | function _remove(Set storage set, bytes32 value) private returns (bool) {
uint valueIndex = set._indexes[value];
if (valueIndex != 0) {
uint toDeleteIndex = valueIndex - 1;
uint lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastvalue = set._values[l... | 5,851,689 |
pragma solidity ^0.4.24;
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
co... | prevent transfer to 0x0 address msg value should be more than 0 total tokens equal price is multiplied by the ether value provided tokens should be less than or equal to available for sale | function buyTokens(address _buyer, uint256 _value) internal {
require(_buyer != 0x0);
require(_value > 0);
uint tokens = (SafeMath.mul(_value, price));
require(tokens <= balances[addressOwner]);
addressETHDepositDevelop.transfer(SafeMath.... | 12,610,927 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
/**
* @title A vesting contract for ERC-20 tokens with a voting extension
* @author Todd Chapman
* @notice Use this contract with OpenZepplin ERC-20 contracts that are used for voting
* @dev Minimalis... | Call this function to disperse holdings to the beneficiary account This function can be called by any account to save gas for the recipient, but vested token is only sent to the address stored in recipient | function claim() public {
require(block.timestamp >= vestingCliff, 'Vester::claim: not time yet');
uint amount;
if (block.timestamp >= vestingEnd) {
amount = IHypertoken(h).balanceOf(address(this));
amount = vestingAmount.mul(block.timestamp - lastUpdate).div(vestingE... | 924,173 |
pragma solidity 0.4.19;
/**
* @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) {
return 0;
... | Get current RTE balance of bonus token vault/ | function getRTEBonusTokenVaultBalance() public view returns (uint256) {
return token.balanceOf(address(bonusTokenVault));
}
| 1,836,669 |
./full_match/421613/0xE6E072DE36AF7E8CF9B509cB3971b0498bD98Fc9/sources/project_/contracts/QuestionData.sol | using SafeMath for uint256; mapping(address => mapping(uint256 => uint256)) public ListQuestionsUser; uint256 public TotalQuestionContract = 100; uint256 public TotalQuestionOnDay = 3; | {
mapping(uint256 => QuestInfo) public ListQuestionsContract;
struct QuestInfo
pragma solidity ^0.8.0;
{
string Question;
string Answer0;
string Answer1;
string Answer2;
string Answer3;
uint256 AnswerResult;
}
function CreateQuestion(
uint... | 11,578,519 |
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.8;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external v... | withdraw token from a token pool poolAddress address of the token pool amount amount of token to withdraw return true if success/ | function withdrawFromTokenPool(address poolAddress, uint256 amount) external onlyWhitelisted returns (bool) {
return ITokenPool(poolAddress).withdrawAssetToken(amount);
}
| 6,905,550 |
./partial_match/97/0xDa5F8984e390ad204A8AC5C65b758917A3834166/sources/BEP2EToken.sol | Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements - `account` cannot be the zero address. - `account` must have at least `amount` tokens./ | function _burn(address account, uint256 amount) internal {
require(account != address(0x60245BB14590b5BBBCcc0c0390877c7D18B39c5C), "BEP2E: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "BEP2E: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
... | 11,487,494 |
./partial_match/97/0x1aBB04723FF281a45BC6A7AABF5712a740DCACdB/sources/NameChangeToken.sol | Withdraw ether from this contract (Callable by owner)/ | function withdraw() onlyOwner public {
uint balance = address(this).balance * (1 - communityTakeHomeRate/PRECISION);
msg.sender.transfer(balance);
}
| 11,343,810 |
./partial_match/56/0xBED3442050BBaEC52AfC3B5E35D55709E9b876Be/sources/TEXMasterFarmer.sol | In some circumstance, we should not burn TEX on transfer, eg: Transfer from owner to distribute bounty, from depositing to swap for liquidity | function addTransferBurnExceptAddress(address _transferBurnExceptAddress) public onlyOwner {
tex.addTransferBurnExceptAddress(_transferBurnExceptAddress);
}
| 11,036,788 |
./partial_match/56/0x7B9D43599AA3C5590CF068bE7BD67Ebf30462b47/sources/FeeProvider.sol | _reserve the address of the reserve for which the information is needed _user the address of the user for which the information is needed return the origination fee for the user/ | function getUserOriginationFee(address _reserve, address _user)
external
view
returns (uint256)
{
CoreLibrary.UserReserveData storage user =
usersReserveData[_user][_reserve];
return user.originationFee;
}
| 11,035,138 |
pragma solidity ^0.5.0;
import "../lib/BN256.sol";
import "../Ownable.sol";
contract UserContractInterface {
// Query callback.
function __callback__(uint, bytes calldata) external;
// Random number callback.
function __callback__(uint, uint) external;
}
contract DOSProxyMock is Ownable {
using B... | Shuffle a memory array using a secure random seed. | function shuffle(address[] memory arr, uint rndSeed) private pure {
for (uint i = arr.length - 1; i > 0; i--) {
uint j = uint(keccak256(abi.encodePacked(rndSeed, i, arr[i]))) % (i + 1);
address tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}
}
| 886,856 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "./lib/SafeMath.sol";
import "./lib/Context.sol";
import "./lib/Ownable.sol";
import "./lib/Address.sol";
import "./lib/IERC20.sol";
import "./lib/IXAUToken.sol";
import "./lib/IFeeApprover.sol";
import "./lib/IXAUVault.sol";
/**
* @dev Implementation o... | sets the rebaser _rebaser The address of the rebaser contract to use for authentication./ | function setRebaser(address _rebaser)
external
override
onlyOwner
{
address oldRebaser = rebaser;
rebaser = _rebaser;
emit NewRebaser(oldRebaser, _rebaser);
}
| 12,866,436 |
// simple planet invitation management contract
// https://azimuth.network
pragma solidity 0.4.24;
////////////////////////////////////////////////////////////////////////////////
// Imports
////////////////////////////////////////////////////////////////////////////////
// OpenZeppelin's Ownable.sol
/**
* @tit... | reject(): as the relevant sponsor, deny the _point's request Requirements: - :msg.sender must be the owner or management proxy of _point's requested sponsor reset the _point's escape request to "not escaping" | function reject(uint32 _point)
external
{
require( azimuth.isEscaping(_point) &&
azimuth.canManage( azimuth.getEscapeRequest(_point),
msg.sender ) );
azimuth.cancelEscape(_point);
}
| 1,401,185 |
pragma solidity ^0.8.0;
import "@c-layer/common/contracts/operable/Operable.sol";
import "@c-layer/common/contracts/lifecycle/Pausable.sol";
import "../interface/ITokensale.sol";
/**
* @title BaseTokensale
* @dev Base Tokensale contract
*
* @author Cyril Lapinte - <cyril.lapinte@openfiz.com>
* SPDX-License-Iden... | returns the token sold/ | function token() public override view returns (IERC20) {
return token_;
}
| 2,531,938 |
./full_match/1/0xABF3e9F15a4529bf1769EAB968250c9243A8E7C1/sources/contracts/CapsuleToken.sol | Mints a Capsule. to Address to receive capsule. color Color of Capsule. font Font of Capsule. return capsuleId ID of minted Capsule. | function _mintCapsule(
address to,
bytes3 color,
Font calldata font,
bytes32[8] memory text
)
internal
onlyMintableColor(color)
onlyValidFontForRenderer(font, defaultRenderer)
returns (uint256 capsuleId)
{
_mint(to, 1, new bytes(0), fal... | 3,144,998 |
pragma solidity ^0.4.25;
contract IStdToken {
function balanceOf(address _owner) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
function transferFrom(address _from, address _to, uint256 _value) public returns(bool);
}
contract EtheramaCommon {
... | remaing amount of blocks to win a quick promo bonus | function getQuickPromoRemainingBlocks() public view returns(uint256) {
return _core.getQuickPromoRemainingBlocks();
}
| 1,321,888 |
./partial_match/1/0x30ba0890cFb7c6D42a33154B81413AfEBaE8a742/sources/HMaker.sol | if amount == uint256(-1) return balance of Proxy selector of "safeLockETH(address,address,uint256,address)" | function safeLockETH(
uint256 value,
address ethJoin,
uint256 cdp
) external payable {
IDSProxy proxy = IDSProxy(_getProxy(address(this)));
address owner = _getProxy(_getSender());
value = _getBalance(address(0), value);
try
proxy.execute.valu... | 2,705,460 |
/**
......''''......
.',:cldxxkOOO0kddk0OOOkxxdlc:;'.
.,:lxkO00000000000k, .;k00000000000Okxl:,.
.;ldO0000000000000000O; :O0000000000000000Odl;.
... | start price of the current timeframe/ | function currentStartPrice() view public returns (uint256) {
uint256 currentTimeStamp = block.timestamp;
return _computePriceInfo(currentTimeStamp).priceFrom;
}
| 6,065,416 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @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 raises an
* error,... | Initializes a fund with its core config _denominationAsset The asset in which the fund's value should be denominated _sharesActionTimelock The minimum number of seconds between any two "shares actions" (buying or selling shares) by the same user Pseudo-constructor per proxy. No need to assert access because this is ... | function init(address _denominationAsset, uint256 _sharesActionTimelock) external override {
require(getDenominationAsset() == address(0), "init: Already initialized");
require(
IValueInterpreter(getValueInterpreter()).isSupportedPrimitiveAsset(_denominationAsset),
"init: Bad... | 122,342 |
/*
Copyright 2019 Wanchain 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 law or agreed to in wri... | burnBridge, user lock token on token original chain event invoked by user burn lock storageData Cross storage data params parameters for user burn lock token on token original chain require(IRC20Protocol(tokenScAddr).transferFrom(msg.sender, this, params.value),... | function userFastBurn(CrossTypes.Data storage storageData, RapidityUserBurnParams memory params)
public
{
uint origChainID;
uint shadowChainID;
bytes memory tokenShadowAccount;
(origChainID,,shadowChainID,tokenShadowAccount) = storageData.tokenManager.getTokenPairInfo(par... | 2,485,997 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
contract Douya is ERC20, AccessControl {
// 将字符串转成byte32
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
event Bough... | 兑换(合约收取eth后铸造代币给用户) | function exchange() payable public {
uint256 amountTobuy = msg.value;
require(amountTobuy > 0, "You need to send some Ether");
_mint(msg.sender, amountTobuy);
emit Bought(amountTobuy);
}
| 7,327,527 |
./full_match/1/0x33A8d92B2BE84755441C2b6e39715c4b8938242c/sources/contracts/libraries/Fixed.sol | Raise this uint192 to a nonnegative integer power. Requires that x_ <= FIX_ONE Gas cost is O(lg(y)), precision is +- 1e-18. return x_ y as-ints: x_ y / 1e18(y-1) <- technically correct for y = 0. :D | function powu(uint192 x_, uint48 y) internal pure returns (uint192) {
require(x_ <= FIX_ONE);
if (y == 1) return x_;
if (x_ == FIX_ONE || y == 0) return FIX_ONE;
while (true) {
if (y & 1 == 1) result = (result * x + FIX_SCALE_SQ / 2) / FIX_SCALE_SQ;
if (y <= 1... | 3,864,924 |
/**
*Submitted for verification at Etherscan.io on 2021-02-17
*/
//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.1;
// bigshortbets.com collection contract
contract BigShortBets {
//minimum to collect
uint256 constant public minETH = 1000 ether;
//maximum pay-in w/o AML/KYC
uint256 constant... | end collecting - take ETH or fail and allow to withdraw | function end() external {
require(!collectEnd, "Collect ended");
collectEnd = true;
require(msg.sender == owner, "Only for owner");
if (totalCollected() < minETH) {
failed = true;
send(owner, address(this).balance);
}
}
| 7,939,977 |
pragma solidity ^0.4.24;
contract Ownable {
/**
* @dev set `owner` of the contract to the sender
*/
address public owner = msg.sender;
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
... | Withdraw _amount for _addr _addr withdrawal address _amount withdrawal amount/ | function withdraw(address _addr, uint256 _amount, bool investor) public onlyOwner {
uint amount = investor ? data.investorBalanceOf(_addr)
: data.balanceOf(_addr);
require(amount >= _amount && address(this).balance >= _amount);
if (investor) {
data.subtrInvestorBalance(_... | 13,806,575 |
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
import "@openzeppelin/... | to support more projects | function setSupported(address _nft, bool isSupported) public onlyOwner {
supportedNfts[_nft] = isSupported;
}
| 1,138,290 |
/*
Copyright 2018 Binod Nirvan @ Accept (http://accept.io)
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 t... | Transfers the specified value of FULC tokens to the destination address.Transfers can only happen when the transfer state is enabled.Transfer state can only be enabled after the end of the crowdsale. _to The destination wallet address to transfer funds to. _value The amount of tokens to send to the destination address. | function transfer(address _to, uint256 _value) public canTransfer(msg.sender) returns(bool) {
require(_to != address(0), "Invalid address.");
return super.transfer(_to, _value);
}
| 12,804,069 |
./full_match/137/0xcedcB63E71252bFe98E801C5F0Ab671481feAd7c/sources/contracts/WhatThe7uck.sol | [Owner] Emergency withdrawal | function withdraw() external onlyOwner { payable(msg.sender).transfer(address(this).balance); }
| 4,704,161 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @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 raises an
* error,... | Helper to decode the encoded call arguments for lending | function __decodeLendCallArgs(bytes memory _encodedCallArgs)
private
pure
returns (
uint256 outgoingWethAmount_,
uint256 outgoingSethAmount_,
uint256 minIncomingAssetAmount_
)
{
return abi.decode(_encodedCallArgs, (uint256, uint256, uin... | 5,831,061 |
./partial_match/42/0x2fe63F7CE38D2Cb605B79901F868c91968d377a9/sources/ImpermanentGain.sol | burn no more than `max_lp` of liquidity provider share, withdraw `_a` of a and `_b` of b ( 1 - sqrt(_k/k) ) LP | function withdrawLP(uint256 _a, uint256 _b, uint256 max_lp) external returns (uint256 _lp) {
require(canBuy, "cannot buy");
uint256 k = poolA.mul(poolB).sqrt();
uint256 _k = poolA.sub(_a).mul(poolB.sub(_b)).sqrt();
_lp = (1e18).sub(_k.mul(1e18).div(k)).mul(_totalSupply).div(1e18);
... | 9,016,742 |
./partial_match/1/0xFC634bfc0f00A2D3dCc93CeB4558Da9DE840fdBC/sources/MetaLifeOgPets.sol | Returns a copy of the string in either lowercase or UPPERCASE. WARNING! This function is only compatible with 7-bit ASCII strings. | {
mstore(last, 0)
mstore(result, totalLength)
mstore(0x40, and(add(last, 0x1f), w))
function toCase(string memory subject, bool toUpper)
internal
pure
returns (string memory result)
assembly {
let length := mload(subject)
if length ... | 9,237,756 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.