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/11111/0x1f41dBA8Ac45eB8226410A38f519667eeE5BBD08/sources/contracts/WelcomeNFTv1.sol | super._burn(tokenId); | function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage) {
}
| 16,361,840 |
pragma solidity ^ 0.5.1;
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 const... | Sells your bonds for Ether. This Ether is assigned to the callers entry in the holdings array, and therefore is shown as a dividend. A second call to withdraw() must be made to invoke the transfer of Ether back to your address. | function sellAllBonds() public {
sell( balanceOf(msg.sender) );
}
| 12,893,702 |
pragma solidity ^0.5.6;
contract Election {
// Model a Candidate
struct Candidate {
uint256 id;
string name;
uint256 voteCount;
}
// Store accounts that have voted
mapping(address => bool) public votedOrNot;
// Read/write candidates
mapping(uint256 => Candidate) pub... | show resultsvoted?if then, voted to whom? | function getMyVoteResult() public view returns (uint256 seeMyVoteResult) {
require(
votedOrNot[msg.sender] == true,
"No result : the user hasn't voted yet."
);
return whoVotedToWhom[msg.sender];
}
| 15,827,713 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "./BaseToken.sol";
/**
* @notice This is ERC20 token with snapshots. A snapshot is all balances at a given point of time.
* Typically, the contract should be inherited and snapshot(), mint() and/or burn() functions should be provided.
* A snapshot is t... | See {ERC20-_transfer} Creating snapshots is added./ | function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual override {
require(sender != address(0), "SnapshotToken: transfer from the zero address");
require(recipient != address(0), "SnapshotToken: transfer to the zero address");
_b... | 2,572,525 |
./full_match/5/0xC89511CFB3e8cbAA9470a9fE50184EAF7204c175/sources/contracts/TFOP.sol | Update the available token supply/ | function setAvailableSupply(uint256 _supply) public onlyOwner {
require(
_supply > _availablesupply,
"Supply cannot be lesser than or equal to the existing supply!"
);
_availablesupply = _supply;
}
| 1,899,954 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./SafeMath96.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./spec_interfaces/ICommittee.sol";
import "./spec_interfaces/IProtoco... | Returns the certified committee annual bootstrap reward return certifiedCommitteeAnnualBootstrap is the certified committee additional annual bootstrap | function getCertifiedCommitteeAnnualBootstrap() external override view returns (uint256) {
return settings.certifiedCommitteeAnnualBootstrap;
}
| 6,441,203 |
./full_match/5/0x8FE95431D113732c3a4C8C5A46B70FB54e391C30/sources/contracts/MvM.sol | second mint function - They own an NFT from the OBYC Labs contract burning obyc lab token - They own an NFT from the OBYC Labs contract require( isCorrectLabTokenForL2Mint(_obycLabTokenId, _mvmL1TokenId), "You Selected the Wrong Lab Token ID" ); burning obyc lab token - They own an NFT from the OBYC Labs cont... | function smint(
uint256 _obycTokenId,
uint256 _obycLabTokenId,
uint256 _mvmL1TokenId,
uint256 _mvmL2TokenId,
uint256 _level,
string memory _text
) public payable {
require(_level > 0, "Level Not Within Range");
require(_level < 5, "Level Not Within... | 1,895,776 |
pragma solidity ^0.4.11;
/**
* @title Owned contract with safe ownership pass.
*
* Note: all the non constant functions return false instead of throwing in case if state change
* didn't happen yet.
*/
contract Owned {
/**
* Contract owner address
*/
address public contractOwner;
... | Sets EventsHstory contract address. Can be set only once, and only by contract owner. _eventsHistory MultiEventsHistory contract address. return success./ | function setupEventsHistory(address _eventsHistory) returns(uint errorCode) {
errorCode = checkOnlyContractOwner();
if (errorCode != OK) {
return errorCode;
}
if (eventsHistory != 0x0 && eventsHistory != _eventsHistory) {
return TIME_LOCK_INVALID_INVOCATION;
... | 1,778,330 |
./full_match/80001/0x2B566C319d73602D8AA1B05B713d7e1BAB3D3f5C/sources/IERC20.sol | https:github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.0.0/contracts/token/ERC20/IERC20.sol | interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint);
fu... | 5,605,251 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import {PercentageMath} from '../protocol/libraries/math/PercentageMath.sol';
import {SafeMath} from '../dependencies/openzeppelin/contracts/SafeMath.sol';
import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.... | Updates the address of the interest rate strategy contract - Only callable by the LendingPoolConfigurator contract asset The address of the underlying asset of the reserve rateStrategyAddress The address of the interest rate strategy contract/ | function setReserveInterestRateStrategyAddress(address asset, address rateStrategyAddress)
external
override
onlyLendingPoolConfigurator
{
_reserves[asset].interestRateStrategyAddress = rateStrategyAddress;
}
| 68,754 |
./full_match/1/0x0C58579eCeDa5bFb87448da1F8bD6c99175640eb/sources/contracts/Adapter.sol | Allows multisig to swap ETH for USDC using UniswapV2/ | function swapETHforUSDC(
uint256 _amount,
uint256 _minAmountOut
)
external
onlyMultiSig
returns (
uint256 amountIn,
uint256 amountOut
)
{
address[] memory path = new address[](2);
path[0] = WETH_ADDRESS;
path[1]... | 9,701,602 |
./partial_match/1/0xD3B55Ba131CE66c1F4299917e1347533Ad16E06c/sources/CloversController.sol | Challenge a Clover for being invalid. tokenId The board being challenged. return A boolean representing whether or not the challenge was successful./ | function challengeClover(uint256 tokenId) public returns (bool) {
require(clovers.exists(tokenId), "Clover must exist to be challenged");
bool valid = true;
bytes28[2] memory moves = clovers.getCloverMoves(tokenId);
address payable _owner = address(uint160(owner()));
if (msg.... | 4,139,391 |
./partial_match/1/0xF1224a696E0e726eb34Ac10a6CC2c4aDBfF13102/sources/HccCoin.sol | Stop presales with setting state variable | function stopPreSales() onlyOwner public {
isPreSales = false;
}
| 16,020,859 |
pragma solidity ^0.5.0;
import "../../Config.sol";
import "../../lib/libCache.sol";
import "../../Cache.sol";
import "../../lib/libCache.sol";
import "./IUniswapV2Pair.sol";
import "./IUniswapV2Router02.sol";
import "./libraries/UniswapV2Library.sol";
import "../HandlerBase.sol";
import "@openzeppelin/contracts/utils... | Get uniswapV2 router Approve token Add liquidity Approve token 0 Update involved token | function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin
)
external
payable
returns (
uint256 amountA,
uint256 amountB,
... | 5,546,954 |
./full_match/43113/0xE9Cc97730a4e951BbfF27bbE998282cE73579C72/sources/contracts/Chain.sol | return address of current leader | function getLeaderAddress() external view returns (address) {
return getLeaderAddressAtTime(block.timestamp);
}
| 7,206,306 |
./partial_match/3/0x178b33308d98D4FF91a4d06972E616335CB2895A/sources/Nexon.sol | Funtion to set _purchaseableTokensAddress add Address for token pool that manages purchase for stakes./ | function setpurchaseableTokensAddress(address add) public onlyOwner returns(bool){
require(add != address(0),"Invalid Address");
_purchaseableTokensAddress = add;
return true;
}
| 5,081,993 |
./full_match/5/0x14121433AC6709dFd023a7f90cCC81eA7ba64F5C/sources/src/contracts/interfaces/IServiceManager.sol | Interface for a `ServiceManager`-type contract. Layr Labs, Inc./ TODO: provide more functions for this spec | interface IServiceManager {
function taskNumber() external view returns (uint32);
function eigenLayrDelegation() external view returns (IEigenLayrDelegation);
function latestTime() external view returns (uint32);
function owner() external view returns (address);
pragma solidity ^0.8.9;
}
| 1,903,886 |
./full_match/3/0x8f449Cdf6249E608c661c37eeA40420A117501DE/sources/KickstarterDepFee.sol | return the number of token units a buyer gets per wei./ | function rate() public view returns (uint256) {
return _rate;
}
| 8,266,780 |
./full_match/5/0xe5e10Cf6d86876dAd1811514ADb3c6Ad345f0D66/sources/contracts/Contract.sol | Creates a new battle | function createBattle(string memory _name, uint256 _betAmount, address _tokenAddress, NFTInfo memory _nftInfo, string memory _password) external nonReentrant returns (Battle memory) {
_receiveBattleReward(_tokenAddress, _betAmount);
bytes32 battleHash = keccak256(abi.encode(_name));
bytes... | 1,954,070 |
/**
*Submitted for verification at Etherscan.io on 2022-02-01
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS ... | Returns whether `tokenId` exists. Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. Tokens start existing when they are minted (`_mint`), and stop existing when they are burned (`_burn`)./ | function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
| 2,096,816 |
./full_match/3/0x46083F857Ee574FBA1a37D30dFC484b155E77dA8/sources/cipher.sol | setMintable(): set the isMintable public variable. When set to `false`, no new beats are allowed to be minted or cloned. However, all of already existing beats will remain unchanged. _isMintable flag for the mintable function modifier. | function setMintable(bool _isMintable) public onlyAdmin {
isMintable = _isMintable;
}
| 14,142,216 |
./full_match/77/0xcA47f86f29Ab274257792a2Cf24B7299d449cF06/sources/deploy/contracts/synthereum-pool/v5/LiquidityPool.sol | Get Synthereum version return poolVersion Returns the version of the Synthereum pool/ | function version() external view override returns (uint8 poolVersion) {
poolVersion = poolStorage.version;
}
| 5,047,238 |
./partial_match/1/0x8515fF8687eaE9A11BE5b0A6dC0dE91A6EFb13f0/sources/Implementation.sol | Reward committer Dev rewards Cut the debt to 40% to ease any potential premium shock uint256 decreaseAmount = totalDebt().mul(3).div(5); decreaseDebt(decreaseAmount); | function initialize() initializer public {
incentivize(msg.sender, Constants.getAdvanceIncentive());
incentivize(msg.sender, 100000e18);
}
| 16,128,166 |
./partial_match/7700/0xdc0aa5ae2867F5FD41Ba6FDfea072998291Ee742/sources/src/ERC20.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(0), "ERC20: burn from the zero address");
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - ... | 3,505,572 |
./full_match/5/0x5256308608B6865F486b59136e7826ACF648a2a1/sources/contracts/prebuilts/account/utils/AccountCore.sol | Returns whether a signer is authorized to perform transactions using the wallet. First, check if the signer is an admin. Account: no active permissions. Extract the `target` and `value` arguments from the calldata for `execute`. Check if the value is within the allowed range and if the target is approved. Account: valu... | function isValidSigner(address _signer, UserOperation calldata _userOp) public view virtual returns (bool) {
if (_accountPermissionsStorage().isAdmin[_signer]) {
return true;
}
SignerPermissionsStatic memory permissions = _accountPermissionsStorage().signerPermissions[_signer];
... | 1,960,705 |
/// tub.sol -- simplified CDP engine (baby brother of `vat')
// Copyright (C) 2017 Nikolai Mushegian <nikolai@dapphub.com>
// Copyright (C) 2017 Daniel Brockman <daniel@dapphub.com>
// Copyright (C) 2017 Rain Break <rainbreak@riseup.net>
// This program is free software: you can redistribute it and/or modify
// it... | Join price (gem per skr) | function ask(uint wad) public view returns (uint) {
return rmul(wad, wmul(per(), gap));
}
| 966,631 |
./full_match/80001/0x337BFE735BF05148A4E125d35F2aA5AA74BecfB3/sources/contracts/WrappedERC1155.sol | Upgrades an "empty" template. Initializes internal variables. bridge_ The address of the bridge of the tokens | function initialize(
string memory tokensUri_,
address bridge_
) external initializer {
require(bytes(tokensUri_).length > 0, "ERC1155: initial token URI can not be empty!");
require(bridge_ != address(0), "ERC1155: initial bridge address can not be a zero address!");
_br... | 5,673,250 |
pragma solidity ^0.4.24;
import "./interfaces/IRightsArtist.sol";
import "./modules/MasterDataModule.sol";
/// @title RightsArtist
/// @dev ERC721 based master data of artists.
contract RightsArtist is IRightsArtist, MasterDataModule {
/*** DATA TYPES ***/
struct Artist {
string name; // artist name... | Updates the artist of the specified id _artistId artist id _name aritst mname _mediaId media id _isValid Whether the artist is valid | function updateArtist(
uint256 _artistId,
string _name,
string _mediaId,
bool _isValid
) external whenNotPaused {
require(ownerOf(_artistId) == msg.sender);
Artist storage artist = artists[_artistId];
artist.name = _name;
artist.mediaId = _mediaId... | 12,896,772 |
/**
*Submitted for verification at Etherscan.io on 2021-05-18
*/
// File: contracts/lib/Types.sol
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
library Types {
enum RStatus {ONE, ABOVE_ONE, BELOW_ONE}
}
// File: contracts/... | charge fee from user receive amount case 1: R=1 case 2: R>1 case 3: R<1 complex case, R status may change case 3.1: R status do not change no need to check payQuote because spare base token must be greater than zero case 3.2: R status changes to ONE case 3.3: R status changes to ABOVE_ONE | function _queryBuyBaseToken(uint256 amount)
internal
view
returns (
uint256 payQuote,
uint256 lpFeeBase,
uint256 mtFeeBase,
Types.RStatus newRStatus,
uint256 newQuoteTarget,
uint256 newBaseTarget
)
{
... | 2,176,754 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import "ds-test/test.sol";
import "../ZangNFT.sol";
import "../Marketplace.sol";
import {StringUtils} from "../StringUtils.sol";
interface Hevm {
function prank(address) external;
function expectRevert(bytes calldata) external;
function deal(address,... | Requesting an increase to 100 (i.e. 1%) Increase finally succeeds Request a new increase, this time to 200 (i.e. 2%) Increase finally succeeds | function test_set_platform_fee_percentage() public {
uint16 currentFee = zangNFT.platformFeePercentage();
assertEq(currentFee, 500);
hevm.expectRevert("ZangNFTCommissions: _lowerFeePercentage must be lower than the current platform fee percentage");
zangNFT.decreasePlatformFeePercen... | 12,739,813 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.9;
import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol';
import '@openzeppelin/contracts/access/AccessControlEnumerable.sol';
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/utils/Strings.... | View function to get information about a lock This uses universal numbering so you'll need to get information about a product first to know what are the locks associated index Index in the lock array to be returned | function getLockedRange(uint index) public view returns (uint startingToken, uint endingToken, uint countToUnlock, uint productIndex) {
lockedRange memory currentLock = _lockedRange[index];
product memory currentProduct = _products[currentLock.productIndex];
return (
currentLock.startingToken - currentProduct... | 5,810,565 |
pragma solidity ^0.5.0;
import "@openzeppelin/contracts/ownership/Ownable.sol";
import "../interfaces/IFantomMintAddressProvider.sol";
/**
* This provides addresses to deployed FMint modules
* and related contracts cooperating on the FMint protocol.
* It's used to connects different modules to make the whole
* FMint ... | setFeeToken modifies the address of the ERC20 token used for fees./ make the change inform listeners and seekers about the change | function setFeeToken(address _addr) external onlyOwner {
setAddress(MOD_ERC20_FEE_TOKEN, _addr);
emit FeeTokenChanged(_addr);
}
| 13,118,229 |
// SPDX-License-Identifier: Apache license 2.0
pragma solidity ^0.7.0;
import "./ERC20Pausable.sol";
import "./ERC20Burnable.sol";
import "./ERC20Mintable.sol";
import "./ERC20Lockable.sol";
import "../interfaces/IBurning.sol";
import "../interfaces/IStaking.sol";
import "../libraries/SafeMathUint.sol";
/**
* @dev ... | See {ERC20-_beforeTokenTransfer}, {ERC20Pausable-_beforeTokenTransfer}, {ERC20Lockable-_beforeTokenTransfer}./ | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual override(ERC20, ERC20Pausable, ERC20Lockable) {
super._beforeTokenTransfer(from, to, amount);
}
| 12,893,933 |
pragma solidity ^0.5.0;
// Copyright 2018 OpenST Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applica... | This will make the call to the target with the call data primed in the fallback function. return `true` if the call was successful and did not revert, `false` if it reverted./ solium-disable-next-line security/no-low-level-calls | function execute() external returns (bool, bytes memory) {
return target.call(data);
}
| 1,759,564 |
// File: @openzeppelin/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.1 (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... | Triggers the tax handling functionality/ | function triggerTax() public onlyOwner {
handleTax(address(0), address(uniswapV2Pair), 0);
}
| 575,761 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "../../common/implementation/FixedPoint.sol";
// Simple contract used to withdraw liquidations using a DSProxy from legacy contracts (1.2.2 and below).
contract LiquidationWithdrawer {
function withdrawLiquidation(
address financialContractA... | Raises an `Signed` to the power of an unscaled uint256, reverting on overflow. E.g., `b=2` squares `a`. This will "floor" the result. a a FixedPoint.Signed. b a uint256 (negative exponents are not allowed). return output is `a` to the power of `b`./ | function pow(Signed memory a, uint256 b) internal pure returns (Signed memory output) {
output = fromUnscaledInt(1);
for (uint256 i = 0; i < b; i = i.add(1)) {
output = mul(output, a);
}
}
| 98,918 |
/**
Copyright (c) 2018, ZSC Dev Team
2018-10-19: v0.00.01
*/
pragma solidity ^0.4.25;
// pragma experimental ABIEncoderV2;
import "../utillib/LibString.sol";
import "../common/hashmap.sol";
import "../common/delegate.sol";
contract InsurancePolicy {
function size() external view returns (uint);
function... | [desc] Get contract related address. [return] contract related address./ | function getAddr() external view _onlyOwner returns (address) {
return policyAddr_;
}
| 15,853,149 |
pragma solidity >=0.8.4;
import "./PriceOracle.sol";
import "./BaseRegistrarImplementation.sol";
import "./StringUtils.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "../resolvers/Resolver.sol";
/**
* @dev A registrar controller for registering and renewing names at fixed cost.
*/
contract BTCReg... | Set this contract as the (temporary) owner, giving it permission to set up the resolver. The nodehash of this label Set the resolver Configure the resolver Refund any extra payment | function registerWithConfig(string memory name, address owner, uint duration, bytes32 secret, address resolver, address addr) public payable {
bytes32 commitment = makeCommitmentWithConfig(name, owner, secret, resolver, addr);
uint cost = _consumeCommitment(name, duration, commitment);
byte... | 10,176,171 |
./full_match/80001/0x16b5A161a24E8D33F09159E47c35fe0e7ADB5909/sources/nftk.sol | Modifica el precio que el owner desea cobrar, los fees se mantienen intactos. | function setPrice(string memory _cid, uint256 _price) external {
require( !pause && (msg.sender == indexOfCid[_cid].owner),"NFT not access");
indexOfCid[_cid].price=_price;
emit priceChanged(_cid,_price);
}
| 866,806 |
pragma solidity ^0.4.24;
import "kleros-interaction/contracts/standard/arbitration/Arbitrator.sol";
import "kleros-interaction/contracts/standard/arbitration/Arbitrable.sol";
import "kleros-interaction/contracts/standard/rng/RNG.sol";
import "kleros-interaction/contracts/standard/rng/ConstantNG.sol"; // Compile for te... | Changes the `minStake` property value of the specified subcourt. _subcourtID The ID of the subcourt. _minStake The new value for the `minStake` property value./ | function changeSubcourtMinStake(uint _subcourtID, uint _minStake) external onlyByGovernor {
courts[_subcourtID].minStake = _minStake;
}
| 13,108,134 |
./partial_match/1/0x4fD4499867144c1878A8882483896ED937C7fe10/sources/StakingRewards.sol | If the period expired, renew it Ensure the provided reward amount is not more than the balance in the contract. This keeps the reward rate in the right range, preventing overflows due to very high values of rewardRate in the earned and rewardsPerToken functions; Reward + leftover must be less than 2^256 / 10^18 to avoi... | function retroCatchUp() internal {
uint balance = rewardsToken.balanceOf(address(this));
require(rewardRate.mul(rewardsDuration).mul(1e6).mul(num_periods_elapsed + 1).div(PRICE_PRECISION) <= balance, "Not enough STS available for rewards!");
periodFinish = periodFinish.add((num_periods_ela... | 2,640,537 |
./full_match/137/0x742F2c5D96c0858d00860039c22D2805bed420E8/sources/contracts/helpers/MathHelpers.sol | Returns the addition of two unsigned integers, reverting on overflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow./ | function add(uint256 a, uint256 b) external pure returns (uint256) {
return a + b;
}
| 4,699,079 |
pragma solidity ^0.4.23;
contract God {
/*=================================
= MODIFIERS =
=================================*/
// only people with tokens
modifier onlyTokenHolders() {
require(myTokens() > 0);
_;
}
// only people with profits
modifie... | Withdraws all of the callers earnings./ setup data get ref. bonus later in the code update dividend tracker add ref. bonus lambo delivery service fire event | function withdraw()
onlyProfitsHolders()
public
{
address _customerAddress = msg.sender;
uint256 _dividends = myDividends(false);
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
_dividends += referralBalance_[_customerAddress];
referralBalance... | 6,305,736 |
./full_match/84531/0xbA061F9828B389268c8Bc79Fd42f98bBAA062096/sources/contracts/DCNTSeries.sol | Withdraws the balance of the contract to the payout address or the contract owner./ | function withdraw() external {
if ( splitWallet != address(0) ) {
revert SplitsAreActive();
}
address to = payoutAddress != address(0) ? payoutAddress : owner();
if ( ! success ) {
revert WithdrawFailed();
}
}
| 11,499,026 |
./full_match/11155111/0xb693ae5F2CF753463fb02aa07806649AB5eFa0cA/sources/src/tokens/ERC5484Upgradeable.sol | function for mint new SBT token allow to mint only once per user if _mintOnce is true mint token set permission to burn token | function safeMint(address to, string memory uri) public onlyRole(MINTER_ROLE) {
require(!_mintOnce || balanceOf(to) == 0,"ERC5484: User already has token");
uint256 tokenId = _tokenIdCounter.current();
_tokenIdCounter.increment();
_safeMint(to, tokenId);
_setTokenURI(tokenId... | 3,814,782 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
pragma abicoder v2;
import "./ActionGuards.sol";
import "../FreeCollateralExternal.sol";
import "../../global/StorageLayoutV1.sol";
import "../../math/SafeInt256.sol";
import "../../internal/AccountContextHandler.sol";
import "../../internal/portfolio/Tr... | Checks post transfer events which will either be initiating one of the batch trading events or a free collateral check if required. Method signature is not abi encoded so decode to bytes32 first and take the first 4 bytes. This works because all the methods we want to call below require more than 32 bytes in the callda... | function _checkPostTransferEvent(
address from,
address to,
AccountContext memory fromContext,
AccountContext memory toContext,
bytes calldata data,
bool toTransferNegative
) internal {
bytes4 sig = 0;
address transactedAccount = address(0);
... | 1,675,602 |
// SPDX-License-Identifier: GPL-3.0
/// @title Wizards ERC-721 token
pragma solidity ^0.8.6;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {IDescriptor} from "./descriptor/IDescriptor.sol";
import {ISeeder} from "./seeder/ISeeder.sol";
import {ERC721} from "../base/ERC721.sol";
import {I... | Lock the minter. This cannot be reversed and is only callable by the owner when not locked./ | function lockMinter() external override onlyOwner whenMinterNotLocked {
isMinterLocked = true;
emit MinterLocked();
}
| 5,996,930 |
./partial_match/56/0xf5128928f85F16bD67C1E02DdD1b47A71d17aDF5/sources/BSC.sol | Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as... | function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "BSC::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0... | 11,337,113 |
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.10;
import {RolesAuthority} from "solmate/auth/authorities/RolesAuthority.sol";
import {SSTORE2} from "solmate/utils/SSTORE2.sol";
// Radicle DripsHub imports
import {ERC20Reserve} from "radicle-drips-hub/ERC20Reserve.sol";
import {ERC20DripsHub} from "radicle... | Internal function that is used to break up fundWorkstreamDai and bypass the 'stack too deep' error. For the parameters read the fundWorkstreamDai function. | function _internalFundDai(
address workstreamId,
int128 amount,
IDripsHub.DripsReceiver[] memory newReceivers,
IDripsHub.PermitArgs calldata permitArgs
) internal {
IDripsHub.DripsReceiver[] memory oldReceivers;
uint64 lastTimestamp;
uint128 balance;
... | 15,802,322 |
// SPDX-License-Identifier: LGPL-3.0-or-later
pragma solidity 0.7.6;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./interfaces/ITokenRegistry.sol";
/**
* @title Contract for managing maximum allowed funds to be escrowed.
* The purpose is to limit the total funds locked in escrow in the initial stage... | Get the address of the token wrapper contract for the specified token _tokenAddress Address of the token which will be updated. return Address of the token wrapper contract/ | function getTokenWrapperAddress(address _tokenAddress)
external
view
override
returns (address)
{
return tokenWrappers[_tokenAddress];
}
| 7,174 |
./full_match/1/0xdc2F3feD14a87ccE44440ceF069B3F17a868d929/sources/browser/Unibase.sol | returns lp staking reward in UBASE, early and continuous stakers get 3x rewards | function calcStakingRewards(address _user)
public
view
returns(uint)
{
uint8 multipler;
if(daysPastDeployment().sub(daysSinceInitialDeposit(_user)) <= 30)
{
multipler = 3;
}
else
{
multipler = 0;
}... | 2,908,775 |
./partial_match/4/0xe3EA563d642c747869ba968BBDf9eE5461Cac8D4/sources/HHHmainnet.sol | Atomically recovers stolen funds that are still in pending deposits. In case of law enforcements notifying Himalaya Group about a theft, Himalaya Group is able to freeze the account and recover funds from pendingDeposit. It calls {_transfer} function to move `amount` from theif's `from` address to victim's `to` address... | function recoverFrozenFunds(address from, address to, uint256 amount) external virtual onlyAdmin {
require(managementContract.isFrozen(from), "Need to be frozen first");
if (!managementContract.isWhitelisted(from)) {
removeAllPendingDeposits(from);
}
_transfer(from, to, ... | 8,733,826 |
./full_match/1313161554/0x85B70E933Fe6d0e5FBe83B8D93141499E4C556aa/sources/contracts/RewardDistributor.sol | Claim all JOE/AVAX accrued by the holders rewardType 0 = JOE, 1 = AVAX holders The addresses to claim JOE/AVAX for cTokens The list of markets to claim JOE/AVAX in borrowers Whether or not to claim JOE/AVAX earned by borrowing suppliers Whether or not to claim JOE/AVAX earned by supplying/ | function claimReward(
uint8 rewardType,
address payable[] memory holders,
CToken[] memory cTokens,
bool borrowers,
bool suppliers
) public payable {
require(rewardType < rewardAddresses.length, "rewardType is invalid");
for (uint256 i = 0; i < cTokens.leng... | 13,231,528 |
// File: @openzeppelin/contracts/utils/cryptography/ECDSA.sol
pragma solidity ^0.8.0;
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum... | Get elapsed sale time | function getElapsedSaleTime() public view returns (uint256) {
return
publicSaleStartTime > 0
? block.timestamp.sub(publicSaleStartTime)
: 0;
}
| 10,175,895 |
./full_match/42161/0x79bE5964789B5EaC1d09cb7c99f59b155950AEAb/sources/contracts/GaurStrategyLendingOptimizerImpermax.sol | Withdraws all funds/ | function reclaimWant() public {
_onlyKeeper();
_reclaimWant();
}
| 16,297,909 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
//
interface IERC20 {
function TOTALSUPPLY709()... | inject NONSTANDARD NAMING | function ADDYDV918(address _ydv) external ONLYOWNER378 { | 12,852,174 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
contract Eul is ERC20Votes, AccessControl {
/// @notice The role assigned to users who can call admin/restricted functions
... | Update the treasury address to receive minted tokens. Only callable by admins. newTreasury The address to set as the new Treasury/ | function updateTreasury(address newTreasury) external onlyAdmin {
require(newTreasury != address(0), "cannot set or mint to zero treasury address");
treasury = newTreasury;
emit TreasuryUpdated(treasury);
}
| 14,849,312 |
pragma solidity ^0.4.0;
/**
* DOCUMENTATION
*
* Most of the interface of NotebookMarketplace is similar to DatasetMarketplace.
* This is because they are based on same concept of sharing.
* On the other hand, there is some change caused by the payment utility in both contracts.
* Since datasets can be a paid ser... | add key from previous notebook (if it is a versioned notebook) | function AddUniqueKeyFromLastNotebook(address _previousNotebookKey){
previousNotebookKey = _previousNotebookKey;
}
| 12,753,687 |
pragma solidity ^0.4.25;
/*******************************************************************************
*
* Copyright (c) 2018 Decentralization Authority MDAO.
* Released under the MIT License.
*
* Nametag - Canonical Profile Manager for Zer0net
*
* Designed to support the needs of the growing Zeron... | Set (Nametag) Data (by Relayer)/ Make sure the signature has not expired. / Validate signature. / | function setData(
string _nametag,
string _field,
bytes _data,
uint _expires,
uint _nonce,
bytes _signature
) external returns (bool success) {
if (block.number > _expires) {
revert('Oops! That signature has already EXPIRED.');
}
... | 13,094,274 |
./full_match/40/0x3A66f025be16B29de5AB543e36f3887965f64551/sources/contracts/libraries/PancakeLibrary.sol | fetches and sorts the reserves for a pair | function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {
(address token0,) = sortTokens(tokenA, tokenB);
pairFor(factory, tokenA, tokenB);
(uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).ge... | 9,549,303 |
pragma solidity ^0.5.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, which is the standard behavior in high l... | Send WRAP to withdraw DAI tokens, recieving the corresponding interest for that part of the user's deposited amount in DAI. | function withdraw(
uint _value,
uint8 v,
bytes32 r,
bytes32 s,
uint signatureValidUntilBlock
)
public
returns
(bool success)
{
if (now > depositLock[msg.sender]) {
require(block.number < signatureValidUntilBlock);
... | 12,718,148 |
pragma solidity ^0.4.18;
import 'zeppelin-solidity/contracts/math/SafeMath.sol';
import 'zeppelin-solidity/contracts/lifecycle/Destructible.sol';
import 'zeppelin-solidity/contracts/ownership/HasNoEther.sol';
import 'zeppelin-solidity/contracts/ownership/Ownable.sol';
import './IVideoBase.sol';
import './VideoBaseAcce... | get extraForceSellPriceRatio. | function getExtraForceSellPriceRatio()
public view onlyVideoBaseOwner returns(uint256) {
return extraForceSellPriceRatio;
}
| 14,033,410 |
// SPDX-License-Identifier: GPL-3.0-or-later
// 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 dis... | Deposits capital into idleFinance amount - the amount of tokens being deposited return the amount deposited/ | function _invest(uint256 amount, uint256) internal override returns (uint256) {
token.approve(address(idleTokenInstance), amount);
uint256 idleBalance = idleTokenInstance.mintIdleToken(amount, false, address(this));
return amount;
}
| 13,100,732 |
./partial_match/42220/0x553a2a1B70725C1042A0D76e16f4f5a683648dEB/sources/src/outbox/Outbox.sol | Send a message to the the target address on the target chain. Alias for `sendExt` when sending to EVM chains specifically. targetChain The target chain. targetAddress The target address on the target chain. contents The message contents. relaySignal Meant to signal to off-chain relayers what type of ExtendedMessag... | function sendExt(uint16 targetChain, address targetAddress, bytes calldata contents, bytes calldata relaySignal)
external
returns (uint64 index, uint64 sequence)
{
return sendExt(pack(targetChain, abi.encodePacked(targetAddress), contents, relaySignal));
}
| 3,498,008 |
./full_match/1/0xc824e1715aBC59b4F03AF0F60e3A9f0996822840/sources/R2S-Collection.sol | Sets tokenURI for individual token No base URI; each token set individually | function setURI(string memory _uri, uint256 tokenId) external onlyManagers {
tokenURI[tokenId] = _uri;
}
| 9,613,364 |
pragma solidity ^0.4.18;
import "../node_modules/openzeppelin-solidity/contracts/payment/PullPayment.sol";
//function asyncTransfer(address dest, uint256 amount) internal;
//function withdrawPayments() public;
contract ConnectFour is PullPayment {
enum BoardPiece {NONE, RED, BLACK}
//Encapsulates total game lea... | If the move is valid, make a move on the board | function makeMove(uint gameId, uint8 position)
public
onlyActivePlayer(gameId)
onlyWhilePlaying(gameId)
{
BoardPiece player = games[gameId].whoseTurn;
require(position >= 0 && position <= 41);
require(games[gameId].board[position] == BoardPiece.NONE);
if (position >= 7){
require(... | 15,871,316 |
pragma solidity ^0.4.10;
// title Migration Agent interface
contract MigrationAgent {
function migrateFrom(address _from, uint256 _value);
}
// title preICO honestis networkToken (H.N Token) - crowdfunding code for preICO honestis networkToken PreICO
contract HonestisNetworkETHpreICO {
string publi... | Abort if not in Operational Migration state. Validate input value. | function migrate(uint256 _value) external {
if (migratestate) throw;
if (_value == 0) throw;
if (_value > balances[msg.sender]) throw;
balances[msg.sender] -= _value;
totalTokens -= _value;
totalMigrated += _value;
MigrationAgent(migrationAgent).migrateFrom... | 12,619,804 |
pragma solidity ^0.5.8;
library SafeMath {
function MUL38(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
... | inject NONSTANDARD NAMING | function TRANSFEROWNERSHIP193(address newOwner) public ONLYOWNER510 { | 14,049,138 |
./full_match/1/0xcB0900D9307Da7FD4e000A9093f24Ce25D937D42/sources/contracts/Protocol.sol | enact accepted claim, all covers are to be paid out - increment claimNonce - delete activeCovers list - only COVER claim manager can call this function Emit ClaimAccepted/ | function enactClaim(
uint16 _payoutNumerator,
uint16 _payoutDenominator,
uint48 _incidentTimestamp,
uint256 _protocolNonce
)
external override returns (bool)
{
require(_protocolNonce == claimNonce, "COVER: nonces do not match");
require(_payoutNumerator <= _payoutDenominator && _payoutN... | 9,760,435 |
//Address: 0xbac2dc4fe58f1f3382f036b1cb8d92591e0c135f
//Contract name: MiningToken
//Balance: 8 wei
//Verification Date: 3/2/2018
//Transacion Count: 19
// CODE STARTS HERE
pragma solidity ^0.4.16;
// The following is the Ethereum Mining Manager Contract, Version Two.
// It assumes that each graphics card draws 80... | set card $/watt/month | function setCentsPerMonth(uint256 amount) onlyOwner public {
centsPerMonth=amount;
}
| 5,521,401 |
// SPDX-License-Identifier: MIT
pragma solidity >= 0.8.7 < 0.9.0;
//import "../utils/Context.sol";
/**
* @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 acces... | --------------------------------------------------- [external] ステーキング状況の確認--------------------------------------------------- | function stakeSuspended() external view returns (bool) { return( _stake_suspended ); }
| 13,522,698 |
./partial_match/97/0x1E69B75a6037Ee4e7a6a0F17E3d4527B90da4811/sources/Proxy.sol | Fallback function allowing to perform a delegatecall to the given implementation. This function will return whatever the implementation call returns/ | function () payable external {
address impl = implementation;
require(impl != address(0));
assembly {
let ptr := mload(0x40)
calldatacopy(ptr, 0, calldatasize)
let result := delegatecall(gas, impl, ptr, calldatasize, 0, 0)
let size := returndat... | 11,350,569 |
./full_match/137/0x134D1355Fd55877ad8686790C3A94f524603bB35/sources/project:/contracts/StakingContract.sol | Allows users to select to unstake their tokens during the unstaking phase. Users can only select to unstake when the unstaking phase is active and they have staked tokens. Users can only select to unstake once. This function is called by users when they want to initiate the unstaking process./ | function selectUnstake() external {
StakingData storage staker = stakingInfo[msg.sender];
require(!staker.canUnstake, "StakingContract: Already selected unstaking");
require(isUnstakingPhaseActive, "StakingContract: Unstake phase is not active yet!");
require(staker.stakedB... | 4,701,824 |
./full_match/5/0x9B40F8166A63c64eC74d8975BD12D843772DF455/sources/contracts/sidechain/FuelMessagePortal.sol | Executes a message in the given header message The message to execute blockHeader The block containing the message messageInBlockProof Proof that message exists in blockverify message validity solhint-disable-next-line not-rely-on-timeverify message in blockmake sure we have enough gas to finish after functionTODO: ... | function _executeMessageInHeader(
Message calldata message,
SidechainBlockHeader calldata blockHeader,
MerkleProof calldata messageInBlockProof
) private nonReentrant {
bytes32 messageId = CryptographyLib.hash(
abi.encodePacked(message.sender, message.recipient, messa... | 11,636,567 |
pragma solidity ^0.5.16;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzepp... | Rewards are harvested for the current block before withdrawal | function withdraw(uint256 _shares) public {
require(_shares <= balanceOf(msg.sender), "ERC20: burn amount exceeds balance");
harvestRewards(depositToken, balanceLastHarvest, address(referralToken));
uint256 r = (balance().mul(_shares)).div(totalSupply());
_burn(msg.sender, _shares)... | 13,006,181 |
./partial_match/56/0x789de910f335957723a9Bf1947b02c8f1bc93329/sources/MasterShepherd.sol | Add a new lp to the pool. Can only be called by the owner. XXX Adding the same LP token more than once is not allowed. | function add(uint256 _allocPoint, IBEP20 _lpToken, uint16 _depositFeeBP, bool _withUpdate) public onlyOwner {
require(_depositFeeBP <= MAX_DEPOSIT_FEE, "add: invalid deposit fee basis points");
if (_withUpdate) {
massUpdatePools();
}
checkPoolDuplicate(_lpToken);
... | 11,286,675 |
./full_match/1/0x44D39e215C112c5AEC6a733d691B464aa62b3F85/sources/src/ERC721SeaDrop.sol | Update the allowed fee recipient for this nft contract on SeaDrop. Only the owner can set the allowed fee recipient. seaDropImpl The allowed SeaDrop contract. feeRecipient The new fee recipient. allowed If the fee recipient is allowed./ Update the allowed fee recipient. | function updateAllowedFeeRecipient(
address seaDropImpl,
address feeRecipient,
bool allowed
) external virtual onlyOwner onlyAllowedSeaDrop(seaDropImpl) {
ISeaDrop(seaDropImpl).updateAllowedFeeRecipient(feeRecipient, allowed);
}
| 16,441,188 |
./full_match/42/0x0a082fd73DA9765D0679c7e33942857bfc47e9b8/sources/LotteryContract_flat.sol | Sets the Lottery Config, initializes an instance of ERC20 contract that the lottery is based on and starts the lottery. Emits an {LotteryStarted} event indicating the Admin has started the Lottery. Requirements: - Cannot be called if the lottery is in progress. - Only the address set at `adminAddress` can call this fun... | function setLotteryRules(
uint256 numOfWinners,
uint256 playersLimit,
uint256 registrationAmount,
uint256 adminFeePercentage,
uint256 randomSeed
) public {
require(
msg.sender == adminAddress,
"Starting the Lottery requires Admin Access"
... | 9,587,240 |
pragma solidity 0.4.24;
contract ExecutionTarget {
uint256 public counter;
function execute() public {
counter += 1;
emit Executed(counter);
}
function setCounter(uint256 x) public {
counter = x;
}
event Executed(uint256 x);
}
pragma solidity 0.4.24;
import "@arago... | Internal function to cast a vote. It assumes the queried vote exists./ | function _vote(uint256 _voteId, bool _supports, address _voter) internal {
Vote storage vote_ = votes[_voteId];
uint256 voterStake = _voterStake(vote_, _voter);
if (_supports) {
vote_.yea = vote_.yea.add(voterStake);
if (latestYeaVoteId[_voter] < _voteId) {
... | 13,453,905 |
pragma solidity 0.4.24;
import "./InterestReceiverBase.sol";
/**
* @title InterestReceiverStakeBuyback
* @dev This contract is intended to be used together with InterestConnector module of the erc-to-native bridge.
* Contract receives DAI and COMP tokens. All received tokens are swapped to STAKE token and burnt.
... | Callback function for notifying this contract about received interest. _token address of the token contract. Should be COMP or DAI token address./ (min received %) (amount / 1 DAI) (STAKE per 1 DAI) | function onInterestReceived(address _token) external {
address[] memory path = new address[](3);
path[0] = _token;
path[1] = wethToken;
path[2] = address(stakeToken);
uint256 amount = ERC20(_token).balanceOf(address(this));
uint256 minAmount = (minReceivedFraction * ... | 15,883,173 |
./partial_match/2222/0xf082344DA54A8aB24f13495a5598a0CB763bF7b2/sources/contracts/concentrator/contracts/MultiStrategy.sol | PositionInfo memory position; | function getPositionsFromStrategy()
external
view
returns (Slot0Data[] memory slots, PositionInfo[] memory positions)
{
uint256 positionsNum = currentStrategy.length;
ErrLib.requirement(positionsNum > 0, ErrLib.ErrorCode.STRATEGY_DOES_NOT_EXIST);
slots = new Slot... | 16,904,819 |
pragma solidity ^0.5.0;
import "./libraries/SafeMathM.sol";
import "./libraries/ZapStorage.sol";
import "./libraries/ZapDispute.sol";
import "./libraries/ZapStake.sol";
import "./libraries/ZapLibrary.sol";
import "./ZapToken.sol";
/**
* @title Zap Oracle System
* @dev Oracle contract where miners can sub... | Allows for a transfer of tokens to _to _to The address to send tokens to _amount The amount of tokens to send return true if transfer is successful/ return zap.transfer(_to,_amount); | function transfer(address _to, uint256 _amount) public returns (bool) {
uint256 previousBalance = balanceOf(msg.sender);
updateBalanceAtNow(msg.sender, previousBalance - _amount);
previousBalance = balanceOf(_to);
updateBalanceAtNow(_to, previousBalance + _amount);
return tok... | 12,682,912 |
./full_match/42220/0x928aA9B52A0025D4e91a586F5a09d2f45E4AC2F4/sources/CelofarmsRouter.sol | SWAP requires the initial amount to have already been sent to the first pair | function _swap(uint[] memory amounts, address[] memory path, address _to) internal virtual {
for (uint i; i < path.length - 1; i++) {
(address input, address output) = (path[i], path[i + 1]);
(address token0,) = CelofarmsLibrary.sortTokens(input, output);
uint amountOut =... | 16,337,175 |
./full_match/137/0xeDe5663b1682392927b45b3d9a660Ff6193eC7aB/sources/contracts/extension/plugin/PluginMap.sol | View all funtionality as list of function signatures. | function getAllFunctionsOfPlugin(address _pluginAddress) external view returns (bytes4[] memory registered) {
uint256 len = selectorsForPlugin[_pluginAddress].length();
registered = new bytes4[](len);
for (uint256 i = 0; i < len; i += 1) {
registered[i] = bytes4(selectorsForPlug... | 3,749,301 |
// 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 function to parse spend assets for lend() and lendAndStake() calls | function __parseSpendAssetsForLendingCalls(
uint256[3] memory _orderedOutgoingAssetAmounts,
bool _useUnderlyings
) private view returns (address[] memory spendAssets_, uint256[] memory spendAssetAmounts_) {
uint256 spendAssetsCount;
for (uint256 i; i < _orderedOutgoingAssetAmount... | 1,412,503 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the on... | Mint token with ID exceeding max supply | function specialMint(
address recevier,
uint tokenId
) external onlyOwner {
require(
tokenId > settings.maxSupply,
"special mint error"
);
_safeMint(recevier, tokenId);
}
| 1,453,794 |
/// SPDX-License-Identifier: MIT
pragma solidity =0.8.4;
import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
contract AccessControlToken is AccessControlEnumerable {
bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
... | Overload {grantRole} to track enumerable memberships./ | function grantRole(bytes32 _role, address _account)
public
override(AccessControlEnumerable)
onlyRole(ADMIN_ROLE)
{
super.grantRole(_role, _account);
}
| 916,532 |
./partial_match/1/0x2EB234cdEFb70bE178BcCF50De005e85fe56861e/sources/CocoTWO.sol | Maximum tx size and wallet size exclude from paying fees or having max transaction amount | constructor() ERC20("0xCoco2.0", "COCO2.0") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair... | 9,251,247 |
pragma solidity ^0.5.17;
// solhint-disable-next-line compiler-version
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
* externa... | update roots current tree root | function _insert(bytes32 _leaf) internal returns (uint32 index) {
uint32 currentIndex = nextIndex;
require(
currentIndex != uint32(2)**levels,
"Merkle tree is full. No more leafs can be added"
);
nextIndex += 1;
bytes32 currentLevelHash = _leaf;
... | 6,781,955 |
/**
*Submitted for verification at Etherscan.io on 2021-09-30
*/
pragma solidity ^0.8.0;
/*
_____ _ _ _ _
/ ____| | | | | | | (_)
| | _ __ _ _ _ __ | |_ ___ __| |_ _ ___| | ___ ___ ___
| | |... | Wraps NFTs/require that the tokenId is in the tokenIdArray that was merkle hashedif this legacy token had never been wrapped, assign it to the register with a new id | function wrapWithProof(uint256 legacyTokenId, bytes32[] memory merkleProof ) public returns (bool){
require( MerkleProof.verify(merkleProof, _tokenIdArrayMerkleRoot, keccak256( abi.encode(legacyTokenId)) ) , 'proof failure');
IERC1155(_wrappableContract).safeTransferFrom(msg.sender, address(this... | 15,251,257 |
./full_match/4/0xf8B28d642A68243A58e510Cc7FD9EF41b4AeF50D/sources/contracts/CNFT1155.sol | See {ERC1155-_beforeTokenTransfer}./it updates the list of tokenId and its count for the user. bool[] memory isAvailable = new bool[](ids.length);it updates the list of tokenId and its count for the user. bool[] memory isAvailable = new bool[](ids.length); it will remove tokens from the 'from' address | function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual override {
super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
if (from... | 12,494,316 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.10;
import "./ERC721.sol";
import "./Ownable.sol";
import "./Strings.sol";
/**
__ _
/ /| | __ _ _ __ ___ __ _/\ /\___ _ __ ___ ___
/ / | |/ _` | '_ ` _ \ / _` \ \ / / _ \ '__/ __|/ _ \
/ /__| | (_| | | | |... | Mints all static llamas allocated to the sender, for use by free minters in the first phase, and WL minters post-auction. | function mintStaticLlama() public payable {
uint256 count = staticWhitelist[msg.sender];
if (staticSupply + count > staticSupplyCap) revert MintedOut();
if (msg.value < staticPrice * count) revert NotEnoughEther();
unchecked {
delete staticWhitelist[msg.sender];
... | 11,861,606 |
pragma solidity 0.5.10;
pragma experimental ABIEncoderV2;
import "ROOT/libraries/math/SafeMathUint256.sol";
import "ROOT/libraries/ContractExists.sol";
import "ROOT/libraries/token/IERC20.sol";
import "ROOT/external/IExchange.sol";
import "ROOT/trading/ICreateOrder.sol";
import "ROOT/trading/IFillOrder.sol";
import "R... | Perform Augur Trades using 0x signed orders _requestedFillAmount Share amount to fill _affiliateAddress Address of affiliate to be paid fees if any _tradeGroupId Random id to correlate these fills as one trade action _orders Array of encoded Order struct data _signatures A... | function trade(
uint256 _requestedFillAmount,
address _affiliateAddress,
bytes32 _tradeGroupId,
IExchange.Order[] memory _orders,
bytes[] memory _signatures
)
public
returns (uint256)
{
uint256 _fillAmountRemaining = _requestedFillAmount;
... | 12,830,209 |
// SPDX-License-Identifier: BUSL-1.1
//
// 8888888888 888
// 888 888
// 888 888
// 8888888 8888b. .d8888b 888888 .d88b. 888d888 888 888
// 888 "88b d88P" 888 d88""88b 888P" 888 888
// 888 .d888888 888 888 888 888 888 888 88... | Sets the auxillary data for `owner`. (e.g. number of whitelist mint slots used). If there are multiple variables, please pack them into a uint64./ | function _setAux(address owner, uint64 aux) internal {
_addressData[owner].aux = aux;
}
| 527,784 |
// SPDX-License-Identifier: Unlicensed
pragma solidity >=0.8.4;
import '@openzeppelin/contracts/utils/math/SafeMath.sol';
import "./DetfReflect.sol";
/// @title Detf smart contract
/// @author D-ETF.com
/// @notice DETF ERC20 token contract
/// @dev Deployable smart contract, which includes the governance logic (vot... | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name())), block.chainid, address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, de... | 12,146,211 |
./partial_match/42/0x28a2773237015362eE4fde9A837D22b4F7D93576/sources/Issuer.sol | What will the new total after taking out the withdrawn amount What will the debt delta be if there is any debt left? Set delta to 0 if no more debt left in system after user What is the percentage of the withdrawn debt (as a high precision int) of the total debt after? And what effect does this percentage change have o... | function _removeFromDebtRegister(
address from,
uint debtToRemove,
uint existingDebt,
uint totalDebtIssued
) internal {
IPynthetixState state = pynthetixState();
uint newTotalDebtIssued = totalDebtIssued.sub(debtToRemove);
uint delta = 0;
if (ne... | 3,436,592 |
./partial_match/4/0x48f1fE976a0B7520433572aFdF3C52369CA5E8A0/sources/Option.sol | use this function to sell existing callspays from new owner to current ownersets new long ownershipwe have two cases, one for a new long, and one where the buyer is actually the short which is effectively the same as closing out their position | function buyOpenCall(uint _c, uint _price) public {
require(call.expiry >= now, "This call is already expired");
require(call.exercised == false, "This has already been exercised!");
require(IERC20(pymtCurrency).balanceOf(msg.sender) >= _price, "you dont have enough to buy this call");
... | 8,631,352 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC20Snapshot.sol";
contract Myobu is ERC20Snapshot {
address public override DAO; // solhint-disable-line
address public override myobuSwap;
bool private antiLiqBot;
constructor(address payable addr1) MyobuBase(addr1) {
setFe... | router refunds to this address, refund all back to sender | function noFeeAddLiquidity(AddLiquidityParams calldata params)
external
override
onlySupportedPair(params.pair)
checkDeadline(params.deadline)
onlyMyobuswapOnAntiLiq
lockTheSwap
returns (
uint256 amountMyobu,
uint256 amountToken,
... | 9,932,054 |
./full_match/1/0xF5abAdec1bcb7d79D0E972981F13D731D5d06aA8/sources/contracts/factory/GenArtCollectionFactory.sol | Add an ERC721 implementation contract and map by index/ | function addErc721Implementation(uint8 index, address implementation)
external
onlyAdmin
{
erc721Implementations[index] = implementation;
}
| 4,883,637 |
./full_match/1/0x549a5Cf3557D92a8B0fAD549499Eba4d41836c10/sources/contracts/Treasure.sol | Unlock locked funds commission will charged farmingPool address of farming poll related/ | function unlock(address farmingPool) external override {
require(!isDistributedLockedFunds[msg.sender][farmingPool], 'Already distributed');
require(contributions[msg.sender][farmingPool] > 0, 'Not contributed');
uint256 lockAmount = contributions[msg.sender][farmingPool];
uint256 fe... | 4,923,631 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.