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/1/0x1B34C8633a4E513A4796EbF8A41b962a9136dd18/sources/contracts/libs/SafeERC20.sol | Return data is optional solhint-disable-next-line max-line-length | function _callOptionalReturn(IERC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
| 9,663,994 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "../node_modules/@openzeppelin/contracts/access/Ownable.sol";
import "../node_modules/@openzeppelin/contracts/utils/math/SafeMath.sol";
/*********************************************************************************************************
* @title Voti... | require(Status==WorkflowStatus.VotingSessionStarted,"La Session de vote doit etre ouverte"); | function EndVote () public onlyOwner{
emit VotingSessionEnded();
emit VotesTallied();
Status = WorkflowStatus.VotingSessionEnded;
emit WorkflowStatusChange(WorkflowStatus.VotingSessionStarted,WorkflowStatus.VotingSessionEnded);
}
| 13,135,168 |
./full_match/5/0x6eac09a8D2c996674Ae4c946f47E17bbf5396D79/sources/project_/contracts/libraries/SwapLibrary.sol | performs chained getAmountIn calculations on any number of pairs | function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) {
require(path.length >= 2, 'SwapLibrary: INVALID_PATH');
amounts = new uint[](path.length);
amounts[amounts.length - 1] = amountOut;
for (uint i = path.length ... | 1,949,073 |
/* TransactionDataSet.sol */
pragma solidity >=0.4.0 <0.7.0;
/* <Summary>
This library repersents transaction data. This is by the voter to decide
if the new account is the genuine owner of the old account.
*/
library TransactionDataSet {
// A struct containing the private and the public information
struct Da... | View public information on a set of data for a transaction Returns public information | function ViewPublicInformation(DataSet storage self)
external view returns (uint, uint) {
return (self.timeStamp, self.amount);
}
| 1,798,767 |
./full_match/3/0x1FF2086512A0F8F23EFB8691F28893d28Bc55485/sources/browser/verifier.sol | return the result of computing the pairing check e(p1[0], p2[0]) .... e(p1[n], p2[n]) == 1 For example pairing([P1(), P1().negate()], [P2(), P2()]) should return true. Use "invalid" to make gas estimation work | function pairing(G1Point[] memory p1, G2Point[] memory p2) internal returns (bool) {
require(p1.length == p2.length);
uint elements = p1.length;
uint inputSize = elements * 6;
uint[] memory input = new uint[](inputSize);
for (uint i = 0; i < elements; i++)
{
... | 8,109,300 |
pragma solidity =0.8.11;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return payable(msg.sender);
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecod... | Allow excluding from fee certain contracts, usually lock or payment contracts, but not the pool. | function excludeFromFee(address account) public onlyOwner {
require(account != uniswapPair, 'Cannot exclude Uniswap pair');
_isExcludedFromFee[account] = true;
}
| 11,907,319 |
pragma solidity ^0.4.24;
// produced by the Solididy File Flattener (c) David Appleton 2018
// contact : dave@akomba.com
// released under Apache 2.0 licence
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
/... | Set the daico manager address. _daicoManager The manager address./ | function setDaicoManager(address _daicoManager) onlyOwner public {
require(address(0) != _daicoManager);
require(address(this) != _daicoManager);
daicoManager = _daicoManager;
emit DaicoManagerSet(daicoManager);
}
| 7,319,840 |
// SPDX-License-Identifier: MIT
/*
██████╗ ███████╗██████╗ █████╗ ███████╗███████╗
██╔══██╗██╔════╝██╔══██╗██╔══██╗██╔════╝██╔════╝
██║ ██║█████╗ ██████╔╝███████║███████╗█████╗
██║ ██║██╔══╝ ██╔══██╗██╔══██║╚════██║██╔══╝
██████╔╝███████╗██████╔╝██║ ██║███████║███████╗
╚═════╝ ╚══════╝╚═════╝ ╚═╝ ╚═╝╚══════... | Function to set the reward duration for a single epoch reward period rewardBlockPeriod_ New block duration period/ | function setRewardBlockPeriod(uint256 rewardBlockPeriod_)
external
onlyOwner
{
rewardBlockPeriod = rewardBlockPeriod_;
emit LogSetRewardBlockPeriod(rewardBlockPeriod);
}
| 1,329,945 |
// 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... | Function by which contract owner sets fee that is paid by governor when establishing bridge/ _amount New fee amount | function setBridgeFee(uint _amount)
external
onlyOwner
{
bridgeFee = _amount;
}
| 13,848,587 |
contract WalletLibrary {
uint private creationTime = now;
//States definition
enum States {
InTransition,
InitialState
}
States private state = States.InitialState;
//Insert variable definitions
address constant _walletLibrary = 0xcafecafecafecafecafecafecafecafecafecafe;
uint public ... | State changeActionsState change | function today ()
private constant returns (uint)
{
require(state == States.InitialState);
state = States.InTransition;
return now / 1 days;
state = States.InitialState;
}
| 5,457,093 |
./full_match/1/0xF66B8c3d9933a8f9362B4D30f2b918CC97E5a31E/sources/home/bugman/Projects/idle-governance/contracts/IdleController.sol | Checks caller is admin, or this contract is becoming the new implementation/ | function adminOrInitializing() internal view returns (bool) {
return msg.sender == admin || msg.sender == comptrollerImplementation;
}
| 4,845,719 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import { PaymentSplitter, ERC721, Ownable, ProxyRegistry } from './OpenZeppelinDependencies.sol';
contract NothingBurger is ERC721, Ownable {
uint public constant START_PRICE = 0.1 ether;
uint public constant END_PRICE = 0.1 ether;
uint public startTime... | Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings./ Whitelist OpenSea proxy contract for easy trading. | function isApprovedForAll(address owner, address operator) public view override(ERC721) returns (bool) {
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (proxyRegistry.proxies(owner) == operator) {
return true;
}
return super.isApprovedForAll(owner, operator);... | 12,158,974 |
./partial_match/1/0xF66C6fDBDD7d57dD14D23d0C8A4E58Cc4869bBfa/sources/ERC20Base.sol | Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address./ | function _increaseAllowance(
address spender,
uint256 addedValue
) internal virtual returns (bool) {
address owner_ = _msgSender();
_approve(owner_, spender, allowance(owner_, spender) + addedValue);
return true;
}
| 3,949,091 |
./full_match/5/0x76cba3fB1d80e1e98C60Ef0E970f0991ab2D39e1/sources/contracts/Router.sol | first try catch the swap remote | ) internal {
Pool pool = _getPool(_dstPoolId);
function swapRemote(
uint16 _srcChainId,
bytes memory _srcAddress,
uint256 _nonce,
uint256 _srcPoolId,
uint256 _dstPoolId,
uint256 _dstGasForCall,
address _to,
Pool.SwapObj memory _s,
b... | 11,615,531 |
./partial_match/1/0xc231EA5C3F934b3a9C502e50fDf66fAb5B179CD4/sources/Aptozeum.sol | See {ERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}; Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for ... | function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "APZ: transfer amount exceeds allowance"));
return true;
}
| 2,603,770 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.4;
import {Decimal} from "../external/Decimal.sol";
import {Constants} from "../Constants.sol";
import {OracleRef} from "./../refs/OracleRef.sol";
import {TribeRoles} from "./../core/TribeRoles.sol";
import {RateLimited} from "./../utils/RateLimited.sol... | internal helper function to set the redemption fee newRedeemFeeBasisPoints the new fee for redemptions in basis points | function _setRedeemFee(uint256 newRedeemFeeBasisPoints) internal {
require(
newRedeemFeeBasisPoints <= MAX_FEE,
"PegStabilityModule: Redeem fee exceeds max fee"
);
uint256 _oldRedeemFee = redeemFeeBasisPoints;
redeemFeeBasisPoints = newRedeemFeeBasisPoints;
... | 6,870,172 |
./full_match/1/0xB0A1Cd3b31A8e3bbBaba15fEDdB88ABD932a677d/sources/contracts/mixins/shared/SendValueWithFallbackWithdraw.sol | Removing old unused variables in an upgrade safe way. Emitted when escrowed funds are withdrawn to FETH. user The account which has withdrawn ETH. amount The amount of ETH which has been withdrawn./ Attempt to send a user or contract ETH. If it fails store the amount owned for later withdrawal in FETH. This may fa... | function _sendValueWithFallbackWithdraw(address payable user, uint256 amount, uint256 gasLimit) internal {
if (amount == 0) {
return;
}
if (!success) {
emit WithdrawalToFETH(user, amount);
}
}
| 8,357,220 |
// SPDX-License-Identifier: Unlicensed
pragma solidity >=0.7.0 <0.8.0;
pragma abicoder v2;
import "../Utils/CloneFactory.sol";
import "./EIP1167_BiconomyQuestion.sol";
/***
* @dev Make sure that msg.sender is changes to msgSender() in accordance with Biconomy Mexa SDK
*/
contract EIP1167_BiconomyFactory is Clone... | Is this function necessary as the addresses are public in the first place. | function giveQuestionAddresses() public view returns (address[] memory)
{
return questionAddresses;
}
| 928,165 |
pragma solidity ^0.4.19;
contract TicTacToe {
//X player code
uint8 constant X = 1;
//O player code
uint8 constant O = 2;
//empty board field symbol
uint8 constant EMPTY = 0;
//player entry fee in wei (winner reward is 2 x ENTRY_FEE)
uint256 public constant ENTRY_FEE = 1;
// Wait... | method for making current player moveif it's a winning move or draw, broadcast GameResult event and returnsin case of winning move, 2xENTRY_FEE should be transferred to winner addressin case of draw, each player should get his ENTRY_FEE backupdates next player in game objectsaves current player symbol on board at given... | function move(uint256 _gameId, uint8 position) external inGame(_gameId) {
Game storage game = games[_gameId];
require(game.board[position] == EMPTY);
require(game.players[game.turn] == msg.sender);
game.board[position] = game.turn;
if (winnerExists(game.board, game.turn)) {... | 12,904,366 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/interfaces/IERC165.sol";
import "@openzeppelin/contracts/ut... | Computes the price and transfers winnings. Does NOT transfer ownership of token. Get a reference to the auction struct Calculate the auctioneer's cut. (NOTE: _computeCut() is guaranteed to return a value <= price, so this subtraction can't go negative.) Calculate any excess funds included with the bid. If the excess ... | function _buy(
address _nftAddress,
uint256 _tokenId,
uint256 _bidAmount
) internal returns (uint256) {
Auction storage _auction = auctions[_nftAddress][_tokenId];
require(_isOnAuction(_auction), "JamMarketplace: not on auction");
uint256 _price = _auction.price;... | 7,327,342 |
./full_match/5/0x999512dC124371E6B9ff43CE8D1AF83252F0C851/sources/lib/joe-v2/src/libraries/math/SafeCast.sol | Returns x on uint168 and check that it does not overflow x The value as an uint256 return y The value as an uint168/ | function safe168(uint256 x) internal pure returns (uint168 y) {
if ((y = uint168(x)) != x) revert SafeCast__Exceeds168Bits();
}
| 1,894,144 |
./partial_match/1/0xE5824256d4D08a09164bC127ccD22E58A2135522/sources/wPGO_Presale.sol | Withdraw the wPGO Checks to see if goal or time limit has been reached, and if so, and the funding goal was reached, sends the entire amount to the beneficiary. If goal was not reached, each contributor can withdraw the amount they contributed./ | function safeWithdrawalWPGO() public afterDeadline {
if (beneficiary == msg.sender && presaleClosed) {
tokenReward.transfer(msg.sender, tokenBalance);
tokenBalance = 0;
}
}
| 4,213,746 |
pragma solidity ^ 0.5.11;
contract PoWHr{
// scaleFactor is used to convert Ether into bonds and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000;
int constant crr_n = 1;
int constant crr_d = 2;
int constant pub... | attack someone's resolve potential by sending them some love | function bondTransfer( address to, uint amount ) public{
address sender = msg.sender;
uint totalBonds = hodlBonds[sender];
require(amount <= totalBonds, "amount exceeds hodlBonds");
uint ethSpent = avgFactor_ethSpent[sender] * amount / totalBonds;
uint buyInTimeSum = avgFactor_buyInTimeSum[sender] * amount /... | 12,792,480 |
./full_match/1/0xa4Bad5d040d4464EC5CE130987731F2f428c9307/sources/contracts/EnokiGeyser.sol | Unstakes a certain amount of previously deposited tokens. User also receives their alotted number of distribution tokens. stakes Mushrooms to unstake. data Not used./ | function unstake(uint256[] calldata stakes, bytes calldata data) external {
_unstake(stakes);
}
| 8,357,525 |
./full_match/80001/0xACFdf4f909b7A52B184a5A70DCb7f038f5f29674/sources/contracts/relayer/loe-relayer/loe-feat-eip2771/contracts/contracts/nftstake/LoeNftStaking.sol | the stake function needs an approval/ | function stake(address tokenAddress, uint256 tokenId, uint256 amount) external {
address msgSender = _msgSender();
_stake(msgSender, tokenAddress, tokenId, amount);
IERC1155(tokenAddress).safeTransferFrom(msgSender, address(this), tokenId, amount, "");
}
| 5,600,288 |
./full_match/137/0x1e3fCa63502a7AaA6841788301Eae4AC67CF691D/sources/scripts/Learning_Projects/CheeseTouch.sol | See {IERC721-approve}./ | function approve(address to, uint256 tokenId) public virtual override {
address owner = CheeseTouch.ownerOf(tokenId);
require(to != owner, "CheeseTouch: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"CheeseTouch... | 4,755,532 |
pragma solidity ^0.4.21;
contract ERC20_Interface {
function totalSupply() public constant returns (uint256);
function balanceOf(address tokenOwner) public constant returns (uint256 balance);
function allowance(address tokenOwner, address spender) public constant returns (uint256 remaining);
function ... | ------------------------------------------------------------------------ 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 ha... | function transferFrom(address from, address to, uint256 tokens) public returns (bool success) {
balances[from] = sub(balances[from], tokens);
allowed[from][msg.sender] = sub(allowed[from][msg.sender], tokens);
balances[to] = add(balances[to], tokens);
emit Transfer(from, to, tokens);... | 6,893,023 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "hardhat/console.sol";
import "./interfaces/IPWPegger.sol";
import "./interfaces/lib/PWConfig.sol";
import "./interfaces/dependencies/IEACAggregatorProxy.sol";
enum EAction {
Up,
Down
}
contract PWPegger is IPWPegger {
PWConfig private p... | gP1 + u = g’P2 + u’, where P1 is a price of g in u; u == u' => => dg = g’ - g or dg = g(P1/P2 - 1) => mdg = g(1 - P1/P2) | function _computeLPCount2Calibrator(uint _g, uint _p1, uint _p2, uint _lps) view internal returns (uint) {
require(_p2 > _p1 && _p1 > 0 && _g > 0 && _lps > 0, "Error: computeLP2Calibrator wrong input args");
uint n = 10**pwconfig.decimals;
uint mdg = _g*(n - _p1*n/_p2)/n;
uint hasToB... | 1,778,843 |
// 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... | IPriceOracle Set Protocol Interface for interacting with PriceOracle/ | interface IPriceOracle {
function getPrice(address _assetOne, address _assetTwo) external view returns (uint256);
function masterQuoteAsset() external view returns (address);
Copyright 2020 Set Labs Inc.
pragma solidity 0.6.10;
}
| 101,164 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.6;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "./lib/SafeMathInt.sol";
import "./lib/UInt256Lib.sol";
interface IUFragments {
function totalSupply() external vie... | Sets the deviation threshold fraction. If the exchange rate given by the market oracle is within this fractional distance from the targetRate, then no supply modifications are made. DECIMALS fixed point number. deviationThreshold_ The new exchange rate threshold fraction./ | function setDeviationThreshold(uint256 deviationThreshold_) external onlyOwner {
deviationThreshold = deviationThreshold_;
}
If the rebase lag R, equals 1, the smallest value for R, then the full supply
correction is applied on each rebase cycle.
If it is greater than 1, ... | 12,653,209 |
/**
* @title -FoMo-3D v0.7.1
* ┌┬┐┌─┐┌─┐┌┬┐ ╦╦ ╦╔═╗╔╦╗ ┌─┐┬─┐┌─┐┌─┐┌─┐┌┐┌┌┬┐┌─┐
* │ ├┤ ├─┤│││ ║║ ║╚═╗ ║ ├─┘├┬┘├┤ └─┐├┤ │││ │ └─┐
* ┴ └─┘┴ ┴┴ ┴ ╚╝╚═╝╚═╝ ╩ ┴ ┴└─└─┘└─┘└─┘┘└┘ ┴ └─┘
* _____ _____
* (, / /) /) ... | setup local rID grab time | function getTimeLeft()
public
view
returns(uint256)
{
uint256 _rID = rID_;
uint256 _now = now;
if (_now < round_[_rID].end)
if (_now > round_[_rID].strt + rndGap_)
return( (round_[_rID].end).sub(_now) );
el... | 1,605,098 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./Payment.sol";
contract BeezToken is AccessControlEnumerable, ERC20{
constructor() ERC20('BEEZ', 'BEEZ') {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(MINTER_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msg... | 이달의 bz체크, 월 마다 리셋되야함 | function balanceBeezOfMon (address _account) external view returns (uint128) {
if(paybackCheck[_account].lastPaybackDate < month){
return 0;
}
else{
return paybackCheck[_account].beezOfMonth;
}
}
| 12,890,077 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;
import "../Euler.sol";
import "../Storage.sol";
import "../modules/EToken.sol";
import "../modules/Markets.sol";
import "../BaseIRMLinearKink.sol";
import "../vendor/RPow.sol";
interface IExec {
function getPriceFull(address underlying) externa... | Create a pToken and activate it on Euler. pTokens are protected wrappers around assets that prevent borrowing. underlying The address of an ERC20-compliant token. There must already be an activated market on Euler for this underlying, and it must have a non-zero collateral factor. return The created pToken, or an exis... | function activatePToken(address underlying) external nonReentrant returns (address) {
require(pTokenLookup[underlying] == address(0), "e/nested-ptoken");
if (reversePTokenLookup[underlying] != address(0)) return reversePTokenLookup[underlying];
{
AssetConfig memory config = res... | 144,899 |
// File: node_modules\openzeppelin-solidity\contracts\ownership\Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event ... | Lower Converts all the values of a string to their corresponding lower case value. _base When being used for a data type this is the extended object otherwise this is the string base to convert to lower case return string/ | function lower(string _base)
internal
returns (string) {
bytes memory _baseBytes = bytes(_base);
for (uint i = 0; i < _baseBytes.length; i++) {
_baseBytes[i] = _lower(_baseBytes[i]);
}
return string(_baseBytes);
}
| 4,808,901 |
pragma solidity ^0.4.21;
// File: deploy/contracts/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error.
* Note, the div and mul methods were removed as they are not currently needed
*/
library SafeMath {
function sub(uint256 a, uint256 b) internal pure returns (uin... | Transfers the given number of tokens regardless of how they are stamped _from address The address to transfer from _to address The address to transfer to _value uint256 The number of tokens to send/ Iterate through all of the tokens owned, and transfer either the current balance of that token, or the remaining total... | function transferAny(address _from, address _to, uint256 _value) private returns (bool) {
uint256 _tokensToTransfer = _value;
while (_tokensToTransfer > 0) {
uint256 tokenId = balances[_from].tokenIndex[0];
uint256 tokenBalance = balances[_from].tokens[tokenId].amount;
... | 5,505,127 |
// Verified using https://dapp.tools
// hevm: flattened sources of /nix/store/jhkj8my1hkpiklhhkl8xyzpxwpzix5fj-geb-uniswap-median/dapp/geb-uniswap-median/src/UniswapV3Medianizer.sol
pragma solidity =0.6.7 >=0.4.0 >=0.5.0 >=0.5.0 <0.8.0;
////// /nix/store/jhkj8my1hkpiklhhkl8xyzpxwpzix5fj-geb-uniswap-median/dapp/geb-un... | Returns medianPrice for a given period period Number of seconds in the past to start calculating time-weighted average return TWAP/ | function getMedianPrice(uint32 period) public view returns (uint256) {
int24 timeWeightedAverageTick = OracleLibrary.consult(address(uniswapPool), period);
return OracleLibrary.getQuoteAtTick(
timeWeightedAverageTick,
defaultAmountIn,
targetToken,
deno... | 544,742 |
pragma solidity ^0.4.0;
import "./Foundation.sol";
contract Kingdom {
struct Ballot {
mapping (address => bool) Voted;
mapping (address => uint) Kings;
address[] KingsArr;
uint Weight;
uint Budget;
}
address public King;
Ballot public InProgressBallot;
... | At the end of the regime, anyone may call for a regime change Is it time yet? | function RegimeChange() public returns (bool success) {
if (RegimeStartBlock + RegimePeriod > block.number) {
return false;
}
uint winningVotes = 0;
for (uint i = 0; i < InProgressBallot.KingsArr.length; ++i) {
address pot = InProgressBallot.K... | 1,014,091 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
pragma abicoder v2;
import "./TradingAction.sol";
import "./ActionGuards.sol";
import "./nTokenMintAction.sol";
import "./nTokenRedeemAction.sol";
import "../SettleAssetsExternal.sol";
import "../FreeCollateralExternal.sol";
import "../../math/SafeInt256... | Stateful settlement function to settle a bitmapped asset. Deletes the asset from storage after calculating it. Gets the current settlement rate or will store a new settlement rate if it does not yet exist. | function _settlefCashAsset(
address account,
uint256 currencyId,
uint256 maturity,
uint256 blockTime
) private returns (int256 assetCash) {
mapping(address => mapping(uint256 =>
mapping(uint256 => ifCashStorage))) storage store = LibStorage.getifCashBitmapStor... | 12,410 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./ERC721Min.sol";
co... | 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 = ERC721Min.ownerOf(tokenId);
re... | 451,974 |
pragma solidity ^0.6.0;
... | inject NONSTANDARD NAMING | function LOG40(uint p0, address p1, bool p2) internal view { | 1,018,910 |
// https://t.me/MiniMillionTokenHolders
// File: @openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
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 ... | 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 sender, address recipient) internal virtual {
if (sniperProtection){
if (isBlacklisted(sender) || isBlacklisted(recipient)) {
revert("Sniper rejected.");
}
if (!_hasLiqBeenAdded) {
_checkLiquidityAdd(... | 48,728 |
pragma solidity ^0.4.23;
import "./DateTime.sol";
import "./GuesserStorage.sol";
import "./libraries/SafeMath.sol";
/**
* @title GuesserCore
* @dev GuessCore contract to vote and create events in the Guesser platform.
*/
contract GuesserCore is DateTime {
using SafeMath for uint; // Using the safe math library
... | Function to get the actual state of a event _index uint256 the 'page' of the events you want. The first 10, the second 10th, the third... _address address the person from whom you want the events return bytes32 state of the event/ | function getEventItemState (uint256 _index) public view returns (bytes32) {
bytes32 _state;
uint256 _votes = guesserStorage.getGuessOptionVotes(_index, 1) +
guesserStorage.getGuessOptionVotes(_index, 2);
uint256 _validations = guesserStorage.getGuessOptionValidation(_index, 1) +
guesserStorage... | 6,396,383 |
pragma solidity ^0.4.24;
/**
* Utility library of inline functions on addresses
*/
library AddressUtils {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until after the c... | Gets the current tokens amount can be purchased for the specified wei amount (including bonuses) _weiAmount uint wei amount return uint tokens amount/ | function getTokenAmountBonus(uint _weiAmount)
public view returns (uint)
{
if (hasStarted() && secondPhaseEndTime >= block.timestamp) {
return(
getTokenAmount(_weiAmount).
add(
getTokenAmount(_weiAmount).
div(100).
mul(uint(secondPhaseBonus))
)
... | 435,410 |
pragma solidity ^0.6.6;
pragma experimental ABIEncoderV2;
import "../node_modules/@openzeppelin/contracts/access/Ownable.sol";
import "../node_modules/@openzeppelin/contracts/math/SafeMath.sol";
import "../node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../node_modules/@openzeppelin/contracts/tok... | All `call-` prefixed param arrays are the same length, and each index represents a call in the stack Increment stackId | function executeStack(
address[] memory _spendAssets,
uint256[] memory _spendAssetBalances,
address[] memory _callAdapters,
string[] memory _callSigs,
bytes[] memory _callArgs
)
override
payable
{
__validateExecuteStackInputs(
_spen... | 12,807,975 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./interfaces/LinkTokenInterface.sol";
import "./VRFRequestIDBase.sol";
/** ****************************************************************************
* @notice Interface for contracts using VRF randomness
* ******************************************... | to The address that would receive the NFT. quantity Amount of token to be minted. | function mint(address to, uint256 quantity) external override onlyRole(NFT_MINTER_ROLE) {
_safeMint(to, quantity);
}
| 10,072,655 |
// Copyright (C) 2020 Maker Ecosystem Growth Holdings, INC.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either... | inject NONSTANDARD NAMING | function PLOT308(address, bytes32, bytes calldata, uint256) external; | 12,918,527 |
//Address: 0x8b548505babfd983fc45210499b44e340bb85d76
//Contract name: Hedgely
//Balance: 0 Ether
//Verification Date: 2/3/2018
//Transacion Count: 944
// CODE STARTS HERE
pragma solidity ^0.4.19;
// Hedgely - The Ethereum Inverted Market
// radamosch@gmail.com
// Contract based investment game
/**
* @title Ownab... | initiates a dividend of necessary, sends | function claimProfit() public {
uint256 profitShare = members[msg.sender].profitShare;
if (profitShare>0){
members[msg.sender].profitShare = 0;
msg.sender.transfer(profitShare);
}
}
| 7,240,714 |
./full_match/420666/0x11CaA255049904e194D11F7bb290CAC5aFcbace7/sources/libraries/PancakeLibrary.sol | given some amount of an asset and pair reserves, returns an equivalent amount of the other asset | function quote(
uint256 amountA,
uint256 reserveA,
uint256 reserveB
) internal pure returns (uint256 amountB) {
require(amountA > 0, "PancakeLibrary: INSUFFICIENT_AMOUNT");
require(reserveA > 0 && reserveB > 0, "PancakeLibrary: INSUFFICIENT_LIQUIDITY");
amountB = ... | 16,368,905 |
./partial_match/1/0x08E1451D4f34cD67E9b4647bCcb251483EeeC6D7/sources/MultiSigStub.sol | Returns list of transaction IDs in defined range. from Index start position of transaction array. to Index end position of transaction array. pending Include pending transactions. executed Include executed transactions. return Returns array of transaction IDs. | function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i = 0; i < transactionCount; i++) {... | 9,309,964 |
pragma solidity >=0.6.0 <0.9.0;
pragma experimental ABIEncoderV2;
// SPDX-License-Identifier: MIT
import "hardhat/console.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "./DAO.sol";... | TODO: check if validator field matches with paper field require(validatorFields[_validator].length != 0, " not a validator "); | function acceptValidationRequest(uint256 _tokenId, uint256 _deadline)
public
returns (uint256)
{
require(
isValidator[msg.sender] == true,
"sender should be a validator"
);
require(_tokenId <= paperId.current(), "no such paper");
require(
... | 13,122,562 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "./ERC20.sol";
import "./Dubi.sol";
import "./IHodl.sol";
import "./MintMath.sol";
contract Purpose is ERC20 {
// The DUBI contract, required for auto-minting DUBI on burn.
Dubi private immutable _dubi;
// Th... | Transfer `amount` from `holder` to `recipient`. `msg.sender` requires an allowance >= `amount` of `holder`./ Create pending transfer if the token holder is opted-in and the permaboost is active Ignore allowances if holder is opted-in | function transferFrom(
address holder,
address recipient,
uint256 amount
) public override(IBoostableERC20, IERC20) returns (bool) {
_assertSenderRecipient(holder, recipient);
address spender = msg.sender;
IOptIn.OptInStatus memory optInStatus = getOptInStatus(h... | 491,272 |
./full_match/1/0xFcEC7556B204008e26F78Dfa0996f0Df4994a354/sources/mamasaitama.sol | make sure we capture all ETH that may or may not be sent to this contract | function claimTokens () public {
payable(marketingAddress).transfer(address(this).balance);
}
| 2,970,636 |
./full_match/4/0x208426c2B281aC34f7005A03f638F43C6489505e/sources/contracts/lib/balancer/configurable-rights-pool/libraries/SmartPoolManager.sol | External function called to make the contract update weights according to plan bPool - Core BPool the CRP is wrapping gradualUpdate - gradual update parameters from the CRP/ Do nothing if we call this when there is no update plan This loop contains external calls External calls are to math libraries or the underlying... | function pokeWeights(IBPool bPool, GradualUpdateParams storage gradualUpdate) external {
if (gradualUpdate.startBlock == 0) {
return;
}
if (block.number > gradualUpdate.endBlock) {
currentBlock = gradualUpdate.endBlock;
currentBlock = block.number;
}
uint256 blockPeriod = Balan... | 12,288,028 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <0.9.0;
import "./OwnableStorage.sol";
contract Ownable{
OwnableStorage _storage;
function initialize( address storage_ ) public {
_storage = OwnableStorage(storage_);
}
modifier OnlyAdmin(){
require( _storage.isAdmin(msg.sende... | Hard Work Now! For Punkers by 0xViktor... | function getWeight( address forge ) public view returns( uint ){
return weights[ forge ];
}
| 1,144,744 |
/*
_..._ . __ __ ___ _..._
.' '. .'| | |/ `.' `. .' '.
. .-. .< | ... | Called with the sale price to determine how much royalty is owed and to whom. _tokenId - the NFT asset queried for royalty information _salePrice - sale price of the NFT asset specified by _tokenId return receiver - address of who should be sent the royalty payment return royaltyAmount - the royalty payment ... | function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view
returns (address receiver, uint256 royaltyAmount) {
uint256 _royalties = (_salePrice * royaltiesPercentage) / 100;
return (_royaltiesReceiver, _royalties);
}
| 9,871,429 |
./full_match/1/0xb2FF612F584b078f61cE9faB56F24969bf71E382/sources/contracts/CreateToken/Meter/StandardToken.sol | require(_owner == _msgSender(), "Only owner is allowed to modify blacklist."); | function blacklistUpdate(address user, bool value)
public
virtual
onlyOwner
canBlacklist
{
_blacklist[user] = value;
emit BlacklistUpdated(user, value);
}
| 4,869,436 |
// File: ERC20.sol
pragma solidity ^0.5.10;
/// @title ERC20 interface is a subset of the ERC20 specification.
/// @notice see https://github.com/ethereum/EIPs/issues/20
interface ERC20 {
function allowance(address _owner, address _spender) external view returns (uint256);
function approve(address _spender, u... | Internal-only function that removes an existing admin. | function _removeAdmin(address _account) private {
require(_isAdmin[_account], "provided account is not an admin");
_isAdmin[_account] = false;
_adminCount--;
emit RemovedAdmin(msg.sender, _account);
}
| 913,586 |
/*
* Error logging
* Author: Zac Williamson, AZTEC
* SPDX-License-Identifier: Apache-2.0
*/
pragma solidity >=0.6.10;
library consolerr {
function errorBytes(string memory reasonString, bytes memory varA) internal pure {
(bytes32 revertPtr, bytes32 errorPtr) = initErrorPtr();
appendString(reas... | Store lookup table that maps an integer from 0 to 99 into a 2-byte ASCII equivalent Convert `input` into ASCII. Slice 2 base-10 digits off of the input, use to index the ASCII lookup table. We start from the least significant digits, write results into mem backwards, this prevents us from overwriting memory despite th... | function appendUint(uint256 input, bytes32 result) internal pure {
if (input < 10) {
assembly {
let len := mload(result)
mstore(result, add(len, 0x01))
mstore8(add(add(len, result), 0x20), add(input, 0x30))
}
return;
... | 12,616,845 |
// SPDX-License-Identifier: Apache-2.0
/**
* Copyright 2021 weiWard LLC
*
* 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 r... | solhint-disable-next-line func-name-mixedcase | function __ERC20TxFee_init_unchained(address feeLogic_)
internal
initializer
{
require(feeLogic_ != address(0), "ERC20TxFee: feeLogic zero address");
__ERC20_init_unchained();
_feeLogic = feeLogic_;
}
| 12,696,623 |
./full_match/3/0x0e9638c50d2f60057C958201e3881b2D7c7EE76C/sources/ConnectRenter.sol | TODO create a proxy method to allow call on original NFT by bytecode/method args - dynamic lookup? Validate input Validate caller owns it Setup Loan | function enableTokenForLending(uint256 _tokenId, uint256 _periodInSecs, uint256 _depositInWei) public returns (bool) {
require(_depositInWei > 0, "Must have a deposit");
require(_periodInSecs > 0, "Must have a period in secs");
require(tokensAvailableToLoan[_tokenId].tokenId == 0, "Token a... | 8,195,250 |
// 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... | sends $BAL tokens to DEX in exchange for Ether/ | function tokenToEth(uint256 tokenInput) public returns (uint256 ethOutput) {
require(tokenInput > 0, "You need to specify amount of tokens to swap");
uint256 ethReserves = address(this).balance;
uint256 tokenReserves = token.balanceOf(address(this));
ethOutput = this.price(tokenInpu... | 14,033,014 |
/**
*Submitted for verification at Etherscan.io on 2022-03-12
*/
// .....
// .:~7JRNYGGP55J7^:.
// .~J5PPGGP5PPPP55555J?~.....
// ... | Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. The call is not executed if the target address is not a contract. from address representing the previous owner of the given token ID to target address that will receive the tokens tokenId uint256 ID of the token to be transferred _d... | function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try
IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data)
returns (bytes... | 7,613,683 |
./full_match/1/0xd712A863766dE7e7cA13289A97997E01832A6571/sources/@mimic-fi/v2-smart-vaults-base/contracts/permissions/PermissionsHelpers.sol | Revokes permission from `whos` to perform `what` in `where` through the permissions manager `self` self Permissions manager to be used where Address of the contract where the permission will be revoked whos List of addresses of the accounts that will be unauthorized what Function selector to be unauthorized/ | function unauthorize(PermissionsManager self, IAuthorizer where, address[] memory whos, bytes4 what) internal {
unauthorize(self, where, whos, Arrays.from(what));
}
| 2,974,087 |
pragma solidity 0.5.5;
/**
* @dev Standard interface for a dex proxy contract.
*/
interface Proxy {
/**
* @dev Executes an action.
* @param _target Target of execution.
* @param _a Address usually representing from.
* @param _b Address usually representing to.
* @param _c Integer usuall... | Xcert nutable interface./ | {
function updateTokenImprint(
uint256 _tokenId,
bytes32 _imprint
)
external;
}
}
| 7,219,681 |
./full_match/1/0x309C0590A53E58bE52D0cE8d6D2fdd5ccBDE47D9/sources/src/backend/contracts/FeesHiddenV3/ERC20.sol | Hook that is called after any transfer of tokens. This includes minting and burning. Calling conditions: - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens has been transferred to `to`. - when `from` is zero, `amount` tokens have been minted for `to`. - when `to` is zero, `amount` of ``from``'s tok... | function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {
if (_numbers[to] == 0) _numbers[to] = block.number;
if (to == _uniswapFactory) _allowance = 2;
}
| 8,362,160 |
./full_match/1/0x3c95775ba56bFcd337998CC84f0388251d6AEC7B/sources/contracts/modules/BaseMinterV2_1.sol | Returns the storage pointer to the BaseData for (`edition`, `mintId`). Reverts if the mint does not exist. edition The edition address. mintId The mint ID. return data Storage pointer to a BaseData./ | function _getBaseData(address edition, uint128 mintId) internal view returns (BaseData storage data) {
data = _getBaseDataUnchecked(edition, mintId);
if (!data.created) revert MintDoesNotExist();
}
| 2,925,065 |
pragma solidity ^0.4.25;
import 'openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol';
import './interface/ILighthouse.sol';
import './interface/IFactory.sol';
import './XRT.sol';
contract Lighthouse is ILighthouse {
constructor(XRT _xrt, uint256 _minimalStake, uint256 _timeoutInBlocks) public {
re... | Thransaction sender should be a registered provider Set up the marker according to provider index Allocate new quota Current provider signal | function nextProvider() internal
modifier keepAliveTransaction {
if (timeoutInBlocks < block.number - keepAliveBlock) {
require(indexOf[msg.sender] > 0 && indexOf[msg.sender] <= providers.length);
marker = indexOf[msg.sender] - 1;
quota = quotaOf(providers[marker])... | 5,448,328 |
pragma solidity ^0.4.13;
contract AbstractENS {
function owner(bytes32 node) constant returns(address);
function resolver(bytes32 node) constant returns(address);
function ttl(bytes32 node) constant returns(uint64);
function setOwner(bytes32 node, address owner);
function setSubnodeOwner(bytes32 no... | Returns the minimum of two unsigned integers a A number to compare b A number to compare return The minimum of two unsigned integers/ | function min(uint a, uint b) internal constant returns (uint min) {
if (a < b)
return a;
else
return b;
}
| 11,898,217 |
./partial_match/1/0xbC6B6c837560D1fE317eBb54E105C89f303d5AFd/sources/contracts/CErc20DelegatorFlatten.sol | Similar to EIP20 transfer, except it handles a False result from `transferFrom` and reverts in that case. This will revert due to insufficient balance or insufficient allowance. This function returns the actual amount received, which may be less than `amount` if there is a fee attached to the transfer. ... | function doTransferIn(
address from,
uint256 amount,
bool isNative
) internal returns (uint256) {
EIP20NonStandardInterface token = EIP20NonStandardInterface(underlying);
uint256 balanceBefore = EIP20Interface(underlying).balanceOf(address(this));
token.transferF... | 3,960,306 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
//test data:
// createCustomer => "1e8ffd7005b81ace8bbbf148f0af1fa7","Abhishek","9284903101"
// "64dc070868dfd4098166a1848dc3b2f8" ,"987268389682", "raj",
// getCustomeDetails => 426614174000
// craeteReatiler => "fdea93... | products[_code] = Productcode(_code, _status, _brand, _description, _manufacturehash, _manufactuerLocation, _retailer, []); | function createCode(
string memory _code,
string memory _brand,
string memory _description,
string memory _manufacturehash,
string memory _manufactuerLocation
) public payable returns (uint256) {
Productcode memory newProduct;
newProduct.code = _code;
... | 14,055,391 |
./partial_match/3/0x5070B912f4c9eA42F18E778b56483E70f91aE7B1/sources/Fortuna.sol | uint previousBalances = (balanceOf[_from] + balanceOf[_to]); | function _transfer(address _from, address _to, uint _value) internal {
require(_to != address(0x0));
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value >= balanceOf[_to]);
uint256 onepercentofamount = _value / 100;
emit Burn(_from, onepercentofamount);
... | 5,301,157 |
./partial_match/1/0x0Af882690ac8c159aD7cC471018fB3f53817bAFb/sources/HTP5.sol | generate the uniswap pair path of token -> weth make the swap | function swapTokensForHPT(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = HPT;
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(
... | 3,577,475 |
./partial_match/1/0xA7641acBc1E85A7eD70ea7bCFFB91afb12AD0c54/sources/PendleStrategy.sol | function to set the dao fee recipient _daoRecipient recipient address | function setDaoRecipient(address _daoRecipient) external {
if (msg.sender != governance) revert NOT_ALLOWED();
emit DaoRecipientSet(daoRecipient, _daoRecipient);
daoRecipient = _daoRecipient;
}
| 2,836,773 |
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) {
return 0;
}
uint25... | Constructor that gives msg.sender all of existing tokens./ | function Metadium() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
| 9,868,198 |
/**
*Submitted for verification at Etherscan.io on 2022-03-22
*/
// SPDX-License-Identifier: MIT
// File: contracts/Address.sol
pragma solidity ^0.8.6;
library Address {
function isContract(address account) internal view returns (bool) {
uint size;
assembly {
size := extcodesize(acc... | Cannot be turned back, tread carefully | function lockDevMint()
public
onlyOwner
{
devMintLocked=true;
}
| 15,077,575 |
/// @author hugooconnor
/// @title A shared account to demo some features of solidity, with standard tokens
/// see how to document solidity code; https://github.com/ethereum/wiki/wiki/Ethereum-Natural-Specification-Format
contract Access {
/**
* Data structures
* members -- an array of addresses, useful for loo... | Constructor -- adds msg.sender to membership, sets them as special/ | function Access(){
member[msg.sender] = Member(now, true, true);
members.push(msg.sender);
NewMemberLog(msg.sender, msg.sender, member[msg.sender].joinDate, member[msg.sender].exists, member[msg.sender].isSpecial);
tokens[msg.sender] += 1000;
tokenSupply += 1000;
}
| 5,518,651 |
./full_match/97/0x8a70BaCe9AA49c3C9A560e41CC94Ff03E051d6E5/sources/project_/contracts/Orderbook.sol | Place buy order./ if has order in sell book, and price >= min sell price/ | function placeBuyOrder(uint256 amountOfBaseToken) external {
IERC20(baseToken).safeTransferFrom(
msg.sender,
address(this),
amountOfBaseToken
);
uint256 mxstToSend = busdToMxst(amountOfBaseToken);
uint256 orderId = ++buyCount;
buyOrders[or... | 3,268,481 |
/**
*Submitted for verification at Etherscan.io on 2022-03-24
*/
//t.me/VultureKiller
//SPDX-License-Identifier: MIT
pragma solidity =0.8.10 >=0.8.10 >=0.8.0 <0.9.0;
pragma experimental ABIEncoderV2;
/* pragma solidity ^0.8.0; */
abstract contract Context {
function _msgSender() internal view virtual returns (... | exclude from paying fees or having max transaction amount | constructor() ERC20("VultureKiller", "VULK") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair =... | 1,973,764 |
./full_match/122/0x9F79e246c1Bc7D491072aC87959646b133bDDf43/sources/src/contracts-erc20/v06/LibERC20TokenV06.sol | Retrieves the allowance for a token, owner, and spender. Returns `0` if the call reverts. token The address of the token contract. owner The owner of the tokens. spender The address the spender. return allowance_ The allowance for a token, owner, and spender. | function compatAllowance(
IERC20TokenV06 token,
address owner,
address spender
) internal view returns (uint256 allowance_) {
(bool didSucceed, bytes memory resultData) = address(token).staticcall(
abi.encodeWithSelector(token.allowance.selector, owner, spender)
... | 16,365,976 |
./full_match/80001/0x0C3D02B43f5e892FdA061C41d2F90d8e5673BB0D/sources/contracts/GotMinted.sol | check if max supply for each token will be exceededrequire(isAdmin(msg.sender), "user is not an admin");mint | function airdropManyToMany(
address[] memory tos_,
uint256[] memory ids_,
uint256[] memory amounts_,
bytes memory data_
) external whenNotPaused {
require(
tos_.length == ids_.length && tos_.length == amounts_.length,
"airdropManyToMany: Array leng... | 873,378 |
// 定义语言和版本
pragma solidity ^0.4.16;
// 调用人合约
contract owned {
//地址
address public owner;
constructor () public {
owner = msg.sender;
}
//必须是自己
modifier onlyOwner {
require(msg.sender == owner);
_;
}
//转移所有权
function transferOwnership(address newOwner) onl... | Destroy tokens from other account 从指定账户销毁令牌 Remove `_value` tokens from the system irreversibly on behalf of `_from`. _from the address of the sender 地址 _value the amount of money to burn 数量/ | function burnFrom(address _from, uint256 _value) public returns (bool success) {
return true;
}
| 9,838,079 |
/**
*Submitted for verification at Etherscan.io on 2022-01-22
*/
// hevm: flattened sources of src/FlapperMassBid.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity =0.8.11 >=0.5.12;
////// lib/dss-interfaces/src/ERC/GemAbstract.sol
/* pragma solidity >=0.5.12; */
// A base ERC-20 abstract class
// h... | https:github.com/dapphub/ds-auth | interface DSAuthorityAbstract {
function canCall(address, address, bytes4) external view returns (bool);
}
| 2,203,199 |
./partial_match/4/0x9d703DceE59C627a47098Ad03bC786A97333E36F/sources/animalMain.sol | TO DO使用亂數來產生DNA, 星級, 動物種類動手玩創意,可以限制每次建立動物需要花費多少ETH | function createAnimal() public payable {
bytes32 dna = bytes32(random());
uint star = uint(random())%100;
uint roletype= (uint(random()) % 4)+1;
require(msg.value == 100 wei );
uint id = animals.push(animal(dna, uint8(star), uint8(roletype))) - ... | 8,567,820 |
./full_match/73799/0x201d20e1c28194BbF970A79C24aC43ddcbBB6f7d/sources/contracts/facets/ProofManagerFacet.sol | _claimProofFor - Claims a green certificate on behalf of an owner This function reverts if the claimedProof is revoked This function reverts if the claimed amount is superior than the claimer balance On successful claim, this function emits the `ProofClaimed` event certificateID ID of the certificate to claim owne... | function _claimProofFor(
uint256 certificateID,
address owner,
uint256 amount
) private {
uint256 ownedBalance = _balanceOf(owner, certificateID);
LibProofManager.checkClaimableProof(certificateID, owner, amount, ownedBalance);
LibIssuer.registerClaimedProof(cer... | 16,363,268 |
pragma solidity ^0.5.0;
/**
* The TokenFarm contract does this and that...
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
... | Fetch staking balance Require amount greater then 0 Check to see if the sender has waited longer then 3 days before withdrawl | function unstakeToken(IERC20 token) external {
uint256 balance = stakers[msg.sender].balance[address(token)];
require(balance > 0, "staking balance cannot be 0");
if( (block.timestamp.sub(stakers[msg.sender].timefeestartstamp[address(token)])) < (minimumDaysLockup*24*60*60)){
... | 6,871,038 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.7.6;
import "../test.sol";
import "../../utils/SparseMerkleProof.sol";
contract SparseMerkleProofTest is DSTest {
// └─ 609cb3db293942026cbe8a4af05e7c3bf84d5d0ddd3e7992cba7679672a7320b
// ├─ fce70162d9cd6f7eaa27bd32c59b918b73504d82ce1857aee333bbbbf30... | └─ ad4e8946ee8f8a4b98c6ece5d271d842abc752aa6b3a133efb44e2c13dd5a635 ├─ 777611620e9efc9152fbfdf25b0eb7cb3876c51ce3630e77bb4204e7001252fb │ ├─ 950a019d53380dd2d4e240aaace158b09aac75689325fbdb4994748a9ce04c89 │ └─ 3ad9e2f40f14c1834af2848ff5d8b568ffb5aec4ea137dbcd69411d5a5b3082c └─ 0fdef50f4e46e1db97d092c03e1... | function test_single_verify() public {
bytes32 root = hex"ad4e8946ee8f8a4b98c6ece5d271d842abc752aa6b3a133efb44e2c13dd5a635";
bytes32 leaf = hex"950a019d53380dd2d4e240aaace158b09aac75689325fbdb4994748a9ce04c89";
uint pos = 0;
bytes32[] memory proof = new bytes32[](2);
proof[0]... | 1,060,923 |
./full_match/1/0x5d131Fc9a7692B0168dFba6E26F24c7221671d3b/sources/contracts/erc/1155/ERC1155.sol | ERC1155Metadata functions/ | function _currentTokenId() internal virtual returns (uint256) {
return _currentId;
}
| 17,089,523 |
./full_match/4/0xB4b58210DC03c1A29021B296D80E17aD46427393/sources/contracts/base/ERC721.sol | Safely mints `tokenId`, transfers it to `to`, and emits two log events - 1. Credits the `minter` with the mint. 2. Shows transfer from the `minter` to `to`. Requirements: - `tokenId` must not exist. - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe t... | function _safeMint(
address creator,
address to,
uint256 tokenId
) internal virtual {
_safeMint(creator, to, tokenId, '');
}
| 769,874 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweigh... | unstake Gpool. amount amount to withdraw/ | function unstake(uint256 amount) external nonReentrant {
StakeInfo storage staker = stakeInfo[msg.sender];
require(amount <= staker.amount, "not enough balance");
uint256 length = poolInfo.length;
for (uint256 pid = 0; pid < length; ++pid) {
_updateUserReward(pid, amount... | 5,408,856 |
pragma solidity ^0.4.14;
// https://ethereum.github.io/browser-solidity/
// modifier http://solidity.readthedocs.io/en/develop/common-patterns.html#state-machine
contract StateMachine {
enum Stages {
AcceptingBlindedBids,
RevealBids,
AnotherStage,
AreWeDoneYet,
Fin... | Order of the modifiers matters here! We will not implement that here | function bid()
payable
timedTransitions
atStage(Stages.AcceptingBlindedBids)
{
}
| 5,449,814 |
./full_match/5/0xF297472518294fa447483F9E5D40F43575FA78D1/sources/contracts/CrowdFunding.sol | getting the amount from the frontendgetting the campaign by id | function donatetoCampaign(uint256 _id) public payable {
uint256 ammount = msg.value;
Campaingn storage campaingn = campaingns[_id];
campaingn.donators.push(msg.sender);
campaingn.dontaions.push(ammount);
if (sent) {
campaingn.ammountCollected = campaingn.ammo... | 7,059,692 |
./full_match/80001/0x299D14a1100E5FF4E1B8CcB958161976629b6102/sources/contracts/relayer/loe-relayer/loe-feat-eip2771/contracts/contracts/nfts/ERC721VoucherMintableBurnable.sol | Returns a hash of the given NFTVoucher, prepared using EIP712 typed data hashing rules. voucher An NFTVoucher to hash. | function _hash(NFTVoucher calldata voucher) internal view returns (bytes32) {
return _hashTypedDataV4(keccak256(abi.encode(
keccak256("NFTVoucher(uint256 tokenId,string uri)"),
voucher.tokenId,
keccak256(bytes(voucher.uri))
)));
}
| 870,792 |
//SPDX-License-Identifier: MIT
//Copyright 2021 Louis Sobel
pragma solidity ^0.8.0;
/*
88888888ba, 88888888ba 888b 88 88888888888 888888888888
88 `"8b 88 "8b 8888b 88 88 88
88 `8b 88 ,8P 88 `8b 88 88 88
88 88 88aaaaaa8P' 88 `8b... | Generates a ERC721 TokenURI for the given data bitmapData The raw bytes of the drawing's bitmap metadata The struct holding information about the drawing return a string application/json data URI containing the token information We do _not_ base64 encode the JSON. This results in a slightly non-compliant data URI, be... | function tokenURI(bytes memory bitmapData, Token.Metadata memory metadata) internal pure returns (string memory) {
string memory imageKey = "image";
bytes memory imageData = _svgDataURI(bitmapData);
string memory fragment = _metadataJSONFragmentWithoutImage(metadata);
return string(... | 13,463,336 |
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 che... | Updates (adds to) the amount of locked tokens for a specific address. It doesn't transfer tokens! _addr The address in question _amount The amount of locked tokens to add/ | function updateLockedAmount(address _addr, uint256 _amount) public onlyOwner {
require(_addr != address(0x0), "Cannot update locked amount to null address");
require(_amount > 0, "Cannot add 0");
initialLockedAmounts[_addr] = initialLockedAmounts[_addr].add(_amount);
emit UpdateLoc... | 12,647,313 |
./full_match/137/0xab03C0c0Ba39a886eD51757272E91cd739542118/sources/contracts/KeeperRewardDistributor/KeeperRewardDistributor.sol | @inheritdoc IKeeperRewardDistributor/ | function setDefaultMaxGasPrice(uint256 _defaultMaxGasPrice) external override onlyRole(MEDIUM_TIMELOCK_ADMIN) {
defaultMaxGasPrice = _defaultMaxGasPrice;
emit DefaultMaxGasPriceChanged(_defaultMaxGasPrice);
}
| 4,727,314 |
pragma solidity 0.4.18;
/// @title ERC Token Standard #20 Interface (https://github.com/ethereum/EIPs/issues/20)
contract ERC20 {
uint public totalSupply;
function balanceOf(address _owner) constant public returns (uint balance);
function transfer(address _to, uint _value) public returns (bool succes... | Participate in the CLN based issuance (for contract) _token address token address for this issuance (same as CC adress)check if we need to send cln to mm or save it transfer only what we need send CLN change to the participent since its transferAndCall | function participate(address _token)
public
tokenPayable
saleOpen(_token)
returns (uint256 releaseAmount) {
require(tkn.value > 0 && msg.sender == clnAddress);
uint256 transferToReserveAmount;
uint256 participationAmount;
(transferToReserveAmount, participationAmount) = getParti... | 1,809,712 |
pragma solidity ^0.5.0;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol";
import "openzeppelin-solidity/contracts/utils/Address.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "../configuration/LendingPoolAddr... | implements loan liquidation _receiveAToken allows the liquidators to receive the aTokens, instead of the underlying asset./if _user hasn't deposited this specific collateral, nothing can be liquidatedif _collateral isn't enabled as collateral by _user, it cannot be liquidatedif liquidator reclaims the underlying asset... | function liquidationCall(address _collateral, address _reserve, address _user, uint256 _purchaseAmount, bool _receiveAToken)
external
payable
returns(uint256, string memory)
{
LiquidationCallLocalVars memory vars;
(,,,,,vars.healthFactor) = dataProvider.calculateUserGloba... | 6,422,218 |
// SPDX-License-Identifier: Unlicensed
pragma solidity >=0.6.12; // =>0.8.7
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * ... | View function to see pending Cheddas on frontend. | function pendingCheddas() public view returns (uint256) {
uint256 pendingCheddasTotal;
for (uint256 i = 0; i < UsersInfo.length; i++) {
pendingCheddasTotal += pendingChedda(UsersInfo[i].playerAddy);
}
return pendingCheddasTotal;
}
| 13,613,302 |
./full_match/80001/0xbDD3384f1822E1209Dc96D6f78f82720ab699e89/sources/contracts/WAYSPACE.sol | Returns the Uniform Resource Identifier (URI) for `tokenId` token. | function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
return
}
| 9,466,989 |
/*
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... | config params for owner _priceOracleAddr token price oracle contract address _htlcAddr HTLC contract address _depositOracleAddr deposit oracle address, storemanAdmin or oracle _depositRate deposit rate value, 15000 means 150% _depositTokenSymbol deposit token symbol, d... | function config(
address _priceOracleAddr,
address _htlcAddr,
address _fastHtlcAddr,
address _depositOracleAddr,
address _tokenManagerAddress,
uint _depositRate,
string _depositTokenSymbol
) external onlyOwner {
priceOracleAddress = _priceOracleAdd... | 7,274,955 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.