file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity ^0.7.0;
/**
* @title G-Uniswap V3 ERC20 Wrapper.
* @dev G-Uniswap V3 Wrapper to deposit and withdraw.
*/
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import { TokenInterface } from "../../common/interfaces.sol";
import { IGUniPool, IERC20 } from "./interface.sol";
import { Helpers }... | Withdraw Liquidity. Withdraw Liquidity from Gelato Uniswap V3 pool. pool The address of pool. liqAmt Amount0 Max amount minAmtA Min AmountA amount minAmtB Min AmountB amount getId ID to retrieve liqAmt. setIds Array of IDs tp stores the amounts of pools tokens received./ | function withdraw(
address pool,
uint256 liqAmt,
uint256 minAmtA,
uint256 minAmtB,
uint256 getId,
uint256[] calldata setIds
) external payable returns (string memory _eventName, bytes memory _eventParam) {
liqAmt = getUint(getId, liqAmt);
IGUniPo... | 1,771,288 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
import "./ERC1404.sol";
... | Only administrators should be allowed to update this Sets the address that will receive fees of flash mints receiver The account that will receive flash mint fees | function _setFlashMintFeeReceiver(address receiver) internal {
flashMintFeeReceiver = receiver;
}
| 9,906,262 |
./full_match/1/0x9db4694BE49558ba5F3CD4C449988fc0AeBa6E94/sources/contracts/Vault.sol | Lock tokens locker The account that is locking tokens receiver The account that will be able to retrieve unlocked tokens startTime The unix timestamp when the lock period will start amount The amount of tokens being locked lockDurationInDays The lock period in days/ Transfer the tokens under the control of the vau... | function lockTokens(
address token,
address locker,
address receiver,
uint256 startTime,
uint256 amount,
uint16 lockDurationInDays
)
external
{
require(lockDurationInDays > 0, "Vault::lockTokens: duration must be > 0");
require(lockDur... | 3,846,886 |
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.4;
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import {IStandardERC20} from '../../base/interfaces/IStandardERC20.sol';
import {
MintableBurnableIERC20
} from '../../tokens/interfaces/MintableBurnableIERC20.sol';
import {
IDe... | Burns `numTokens` of `tokenCurrency` and sends back the proportional amount of `feePayerData.collateralCurrency`. Can only be called by a token sponsor. Might not redeem the full proportional amount of collateral in order to account for precision loss. This contract must be approved to spend at least `numTokens` of `t... | function redeem(FixedPoint.Unsigned memory numTokens)
external
override
onlyPool()
notEmergencyShutdown()
noPendingWithdrawal(msg.sender)
fees()
nonReentrant()
returns (FixedPoint.Unsigned memory amountWithdrawn)
{
PositionData storage positionData = _getPositionData(msg.sender);... | 2,545,076 |
./partial_match/1/0x6893491CeCF9309e445fE10f49CEd15CBb08652F/sources/Migration_Schedar.sol | ========== VIEWS ========== / | function resolverAddressesRequired() public view returns (bytes32[] memory addresses) {
bytes32[] memory existingAddresses = MixinSystemSettings.resolverAddressesRequired();
bytes32[] memory newAddresses = new bytes32[](14);
newAddresses[0] = CONTRACT_SYSTEMSTATUS;
newAddresses[1] = ... | 4,485,177 |
/**
* @authors: []
* @reviewers: []
* @auditors: []
* @bounties: []
* @deployments: []
*
* SPDX-License-Identifier: MIT
*/
pragma solidity >=0.7;
import "./BinaryArbitrable.sol";
import "../.././interfaces/IAppealEvents.sol";
import "@kleros/erc-792/contracts/IArbitrable.sol";
import "@kleros/erc-792/contracts... | Changes the percentage of arbitration fees that must be paid by parties as a fee stake if there was no winner and loser in the previous round. _sharedStakeMultiplier A new value of the multiplier of the appeal cost in case where there was no winner/loser in previous round. In basis point./ | function changeSharedStakeMultiplier(uint256 _sharedStakeMultiplier) public onlyGovernor {
arbitrableStorage.setMultipliers(
_sharedStakeMultiplier,
arbitrableStorage.winnerStakeMultiplier,
arbitrableStorage.loserStakeMultiplier
);
}
| 913,290 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*******************************************************************************
*
* Copyright (c) 2018-2022 Modenero Corp.
* Released under the MIT License.
*
* ServiceName - Service description.
*
* Version YY.MM.DD
*
* https://modenero.com
* support... | Bytes-to-Address Converts bytes into type address./ b = uint160(_address[i]); NOTE: This line broke in v0.5.0 | function _bytesToAddress(
bytes memory _address
) private pure returns (address) {
uint160 m = 0;
uint160 b = 0;
for (uint8 i = 0; i < 20; i++) {
m *= 256;
m += (b);
}
return address(m);
}
| 922,248 |
./full_match/11155111/0x96383063Fe5c012fe2C5CF6524f9DE700Cd905de/sources/project_/contracts/Vehicle.sol | The vehicle owner is given the ability to modify the URI with the documentation if there are any errors discovered. | function setNewDocumentationURI(
string calldata newDocumentationURI
) external virtual override onlyVehicleOwner isActive {
require(
keccak256(abi.encodePacked(newDocumentationURI)) != keccak256(abi.encodePacked('')),
'please pass a valid documentation URI'
);
... | 3,788,765 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;
import "../interfaces/IPayment.sol";
import "../libraries/LibDiamond.sol";
import "../libraries/LibPayment.sol";
contract PaymentFacet is IPayment {
/// @notice Adds/removes a payment token
/// @param _token The target token
/// @param _status Whether... | Gets the payment token at a given index _index The token index | function paymentTokenAt(uint256 _index)
external
view
override
returns (address)
{
return LibPayment.tokenAt(_index);
}
| 1,334,777 |
./full_match/3/0x93d137764C7f7C339B7a3F7AeF6f03bfceb725a0/sources/home/mitgen/Private_Projects/DeFi/poolRegistry/contracts/interface/IPool.sol | Deposits Withdrawals GET INFO SET NEW VALUE | interface IPool {
event PoolDeposit(
address indexed _from,
address indexed _tokenAddress,
uint256 _amount,
uint256 lock_period
);
event DepositRequest(
address indexed _lpAddress,
address indexed _tokenAddress,
bytes32 indexed _id,
uint256 _... | 8,094,112 |
./partial_match/3/0x6cc9b43f81C40E3BB3Fe544472F2653EE539E75C/sources/MyLotto.sol | get total sale amount for all sale session/ | function getTotalSaleAmountForAllSale() external view returns(uint256){
return totalSaleAmountForAllSales;
}
| 5,278,813 |
pragma solidity >=0.5.0 <0.6.0;
// this is a rock-paper-scissors tournament
// players join, compete against one another until the tournament winner is declared
// players must commit their answers before revealing them
// there are time limits for each round
// after each tournament, a new one is automatically create... | for finding player's opponent, receives player's address and returns opponent's address same as above: used to determine whether player's position is even or odd even number, opponent's position is 2 y (player's round) less than player's position subtract one for array odd number, opponent's position is 2 y more oppo... | function find(address payable _player) internal view returns (address payable) {
uint x = mPlayers[_player].position;
uint y = mPlayers[_player].round;
uint z = (x - 1) / 2 ** y + 1;
uint opponent;
if (z % 2 == 0) {
opponent = (x - 2 ** y) - 1;
opponent = (x + 2 ** y) - 1;
}
... | 15,871,371 |
./full_match/1/0x85Ff72ef23C559881589Daa5C8Ed9698124eDE72/sources/lib/seaport-types/src/helpers/PointerLibraries.sol | Reads the uint184 at `cdPtr` in calldata. | function readUint184(
CalldataPointer cdPtr
) internal pure returns (uint184 value) {
assembly ("memory-safe") {
value := calldataload(cdPtr)
}
}
| 8,451,715 |
pragma solidity ^0.4.21;
/// @title SafeMath contract - Math operations with safety checks.
/// @author OpenZeppelin: https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
contract SafeMath {
function mulsm(uint256 a, uint256 b) internal pure returns (uint256) {
uint c =... | safe closing invest, checking for complete by date. / | function isFullInvest(address _ms, bytes5 _t) internal returns (uint256) {
uint256 res = countPeriod(_ms, _t);
emit Counted(msg.sender, res);
return res;
}
| 2,369,435 |
./full_match/5/0x81c7a9d494c74F113cCa32d174925352bD3875f1/sources/_connext/nxtp-contracts/contracts/core/shared/Router.sol | Assert that the given domain has a xApp Router registered and return its address _domain The domain of the chain for which to get the xApp Router return _remote The address of the remote xApp Router on _domain/ | function _mustHaveRemote(uint32 _domain) internal view returns (bytes32 _remote) {
_remote = remotes[_domain];
require(_remote != bytes32(0), "!remote");
}
| 1,910,857 |
pragma solidity ^0.4.24;
import "./ISTO.sol";
import "../../interfaces/IST20.sol";
import "../../interfaces/IOracle.sol";
import "../../RegistryUpdater.sol";
import "../../interfaces/ISecurityTokenRegistry.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/Reentra... | This function converts from ETH or POLY to USD _currency Currency key _amount Value to convert to USD return uint256 Value in USD/ | function convertToUSD(bytes32 _currency, uint256 _amount) public view returns(uint256) {
uint256 rate = IOracle(ISecurityTokenRegistry(RegistryUpdater(securityToken).securityTokenRegistry()).getOracle(_currency, bytes32("USD"))).getPrice();
return decimalMul(_amount, rate);
}
| 2,548,323 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract SessionHandler {
// Holds the main data about each session
struct Session {
address player;
uint256 timestamp;
uint256 id;
bool active;
}
struct Crossword {
uint256 hintPrice;
uint256 wordP... | Request an hint TODO: make token payment | function requestHint(uint256 _sessionId) public onlyPlayer(_sessionId) {
emit RequestHint(msg.sender, _sessionId);
}
| 15,832,358 |
/**
*Submitted for verification at Etherscan.io on 2020-11-24
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It ... | Update balances if a token was sold and increase reward by appropriate amount of ETH Find which owners held the token and adjust balances | function updateBalancesAfterTrade(address tokenaddress, uint256 sold, uint256 portionleft, uint256 gainz) internal {
Balance storage balance = balances[depositers[b]];
for (uint t = 0; t < balance.tokendeposited.length; t++) {
if (balance.tokendeposited[t] == tokenaddress && ... | 6,836,788 |
/**
*Submitted for verification at Etherscan.io on 2022-04-02
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
pragma experimental ABIEncoderV2;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available... | for user unbind card and sell | function clearBindMNS() public lock {
bytes32 oldNickName = userBindNickName[msg.sender];
require(oldNickName != 0, "not bind");
uint256 cardId = nickNameCardId[oldNickName];
address owner = ownerOf(cardId);
require(msg.sender == owner, "not owner");
emit ChangeBindMN... | 2,299,882 |
./full_match/3/0xA60d91173c76e8B429a29E9115527b52fD7442A3/sources/contracts/ND.sol | Check that the token exists | function _setContentHash(uint256 tokenId, bytes32 contentHash) internal {
require(hasRole(MINTER_ROLE, _msgSender()), "NotreDameERC721: must have minter role to mint");
require(_exists(tokenId), "NotreDameERC721: token does not exist");
_contentHashes[tokenId] = contentHash;
}
| 8,138,907 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/proxy/Proxy.sol
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
* instruction `delegatecall`. We refer to the second contract as the _implementat... | File: contracts/interfaces/ILiquidVestingToken.sol | interface ILiquidVestingToken {
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
}
pragma solidity =0.7.6;
enum AddType {
MerkleTree,
Airdrop
}
}
| 402,988 |
./full_match/1/0x4d73C0A7161898cb54aD93ae01Cf3987Cd65899F/sources/contracts/WSTFXpresale.sol | convert for USD calculations note for actual must devide by 1 10 18. (usdt) _totalPurchased = _totalPurchased.add(purchaseQty); | function buy_eth() public payable {
require(_active, "Contract Is Not Currently Active ==> Cannot Process");
require(msg.value > 1 * 10 ** 16, "Purchase amount must be greater than 0.01 ETH");
uint256 usdtETHrate = _getETHUSDrate();
uint256 usdt = msg.value * usdtETHrate;
... | 3,147,205 |
pragma solidity ^ 0.5.17;
import "./SafeMath.sol";
import "./Iupgradable.sol";
contract ClaimsData is Iupgradable {
using SafeMath for uint;
struct Claim {
uint coverId;
uint dateUpd;
}
struct Vote {
address voter;
uint tokens;
uint claimId;
int8 verdi... | Gets cover id of a claim./ | function getClaimCoverId(uint _claimId) external view returns(uint claimId, uint coverid) {
return (_claimId, allClaims[_claimId].coverId);
}
| 5,407,155 |
./partial_match/42220/0x00e533B7d6255D05b7f15034B1c989c21F51b91C/sources/project:/contracts/utils/BuyGDClone.sol | Swaps Celo for GD tokens. _minAmount The minimum amount of GD tokens to receive from the swap./ | function swapCelo(
uint256 _minAmount,
address payable refundGas
) public payable {
uint256 gasCosts;
if (refundGas != owner) {
(gasCosts, ) = oracle.quoteAllAvailablePoolsWithTimePeriod(
cusd,
celo,
60
);
}
uint256 amountIn = address(this).balance - gasCosts;
(uint256 minByTwap, ) =... | 3,494,622 |
pragma solidity ^0.4.13;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
require(c / a == b);
return c;
}
... | Admin { status | platformName | tokenSymbol | account} | function init() internal {
admin.status = true;
admin.platformName = "ETH";
admin.tokenSymbol = "INK";
admin.account = msg.sender;
bytes32 platformName = "INK";
platforms[platformName].status = true;
platforms[platformName].weight = 1;
platforms... | 14,619,506 |
./full_match/1/0x724C13E376Aa9b506fA5263463f3c780B36Bd79C/sources/contracts/Splitter.sol | TODO maybe make this onlyOwner or Treasury | function releaseAllFunds() public onlyOwner {
release(IERC20(tgt), treasury);
release(IERC20(usdc), treasury);
release(IERC20(tgt), stakingContract);
release(IERC20(usdc), stakingContract);
}
| 9,646,747 |
// File: https://github.com/RAT-TECHNOLOGIES/evm-contracts/blob/9820f1acbb53d4411ba120fb8af805bf519fb8a3/contracts/misc/opensea/ProxyRegistry.sol
pragma solidity ^0.8.4;
contract OwnableDelegateProxy {}
contract ProxyRegistry {
mapping(address => OwnableDelegateProxy) public proxies;
}
// File: @openzeppelin/... | Useful for when user wants to return tokens to get a refund, or when they want to transfer lots of tokens by paying gas fee only once./ | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
function _afterTokenTransfer(
address from,
address to,
uint256 tokenId
}
pragma solidity ^0.8.4;
) public virtual {
for (uint256 i = 0; i < tokenIds.length; i++) {
... | 1,119,027 |
./full_match/7700/0x468D623e538c4411109cf03d2C9047BF9AdD2299/sources/contracts/cedar/drop/CedarERC1155DropLogic.sol | Checks a request to claim NFTs against the active claim condition's criteria. | function verifyClaim(
DropERC1155DataTypes.ClaimData storage claimData,
uint256 _conditionId,
address _claimer,
uint256 _tokenId,
uint256 _quantity,
address _currency,
uint256 _pricePerToken,
bool verifyMaxQuantityPerTransaction
) public view {
... | 4,657,108 |
./full_match/1/0x113180ecac90987c7EB2757e608ecF2ab943554C/sources/project:/contracts/PurplecoinCrowdsale.sol | creates the token to be sold. override this method to have crowdsale of a specific ERC20Mintable token. | function createTokenContract() internal returns (ERC20Mintable) {
return new Purplecoin();
}
| 4,830,611 |
./partial_match/56/0x836005b4382D8E952dd582DDf133F7C0f2b974c2/sources/MasterChef.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0 || pool.allocPoint == 0) {
pool.lastRew... | 11,150,883 |
./full_match/1/0x38D8FA043913e8Ef6466d01BEF4Af42Cafa3b235/sources/contracts/manager/DelegatedManager.sol | Initializes an added extension from PENDING to INITIALIZED state and adds to extension array. An address can only enter a PENDING state if it is an enabled extension added by the manager. Only callable by the extension itself, hence msg.sender is the subject of update./ | function initializeExtension() external {
require(extensionAllowlist[msg.sender] == ExtensionState.PENDING, "Extension must be pending");
extensionAllowlist[msg.sender] = ExtensionState.INITIALIZED;
extensions.push(msg.sender);
emit ExtensionInitialized(msg.sender);
}
| 3,150,743 |
./full_match/1/0x998d69C79E2b97d398A29E855d9Ef2e301535e5e/sources/contracts/LazyVesting.sol | Returns a hash of the `contribution`, prepared using EIP712 typed data hashing rules./ | function _hash(uint256 id, address contributor, uint256 amount, uint256 start) internal view returns (bytes32) {
return _hashTypedDataV4(keccak256(abi.encode(
CONTRIBUTION_TYPEHASH,
id,
contributor,
amount,
start
)));
}
| 9,606,024 |
pragma solidity 0.4.20;
contract SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
... | Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend)./ | function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
if(_b > _a)throw;
return _a - _b;
}
| 5,451,615 |
pragma solidity 0.5.17;
import "@openzeppelin/contracts/ownership/Ownable.sol";
import "../interfaces/Comptroller.sol";
import "../interfaces/PriceOracle.sol";
import "../interfaces/CERC20.sol";
import "../interfaces/CEther.sol";
import "../Utils.sol";
contract CompoundOrder is Utils(address(0), address(0), address(... | Convert a USDC amount to the amount of a given token that's of equal value | function __usdcToToken(address _cToken, uint256 _usdcAmount) internal view returns (uint256) {
ERC20Detailed t = __underlyingToken(_cToken);
return _usdcAmount.mul(PRECISION).div(10 ** getDecimals(usdc)).mul(10 ** getDecimals(t)).div(ORACLE.getUnderlyingPrice(_cToken).mul(10 ** getDecimals(t)).div(PRECISION))... | 15,851,461 |
./full_match/80001/0xd214185AA42cC815484Ff2552d1A7A89eB7E0e28/sources/Utility/Manager.sol | SECURITY: anyone can register. change to OrgAdmin only | function registerUser(address _newUser, string calldata _name) isOrgAdmin external { | 5,572,830 |
./full_match/1/0x48deE19C0e44c147934702c12dc98963CA831009/sources/src/Asset/ERC1155ERC721.sol | Mint a token type for `creator` on slot `packId`. creator address of the creator of the token. packId unique packId for that token. hash hash of an IPFS cidv1 folder that contains the metadata of the token type in the file 0.json. supply number of tokens minted for that token type. rarity rarity power of the token... | function mint(
address creator,
uint40 packId,
bytes32 hash,
uint256 supply,
uint8 rarity,
address owner,
bytes calldata data
) external returns (uint256 id) {
require(hash != 0, "hash is zero");
require(_bouncers[msg.sender], "only bouncer... | 4,919,186 |
// File: @openzeppelin/contracts/math/Math.sol
pragma solidity ^0.6.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= ... | Creates `fyDaiAmount` tokens and assigns them to `to`, increasing the total supply, up to a limit of 2112. to Wallet to mint the fyDai in. fyDaiAmount Amount of fyDai to mint. | function _mint(address to, uint256 fyDaiAmount) internal override {
super._mint(to, fyDaiAmount);
}
| 1,251,486 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
// OpenZeppelin library for performing math operations without overflows.
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
// OpenZeppelin security library for preventing reentrancy attacks.
import "@openzep... | Allows the admin to transfer any ETH from this contract to the recovery address. Attempt an ETH transfer to the recovery account, and return true if it succeeds. | function recoverETH(uint256 amount)
external
onlyAdminRecovery
returns (bool success)
{
success = attemptETHTransfer(adminRecoveryAddress, amount);
}
| 109,247 |
/**
*Submitted for verification at Etherscan.io on 2021-02-17
*/
// File: @openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in ex... | LP can redeem their LP tokens in exchange for collateral If `sellTokens` is true pro-rata active b/wTokens will be sold to the pool in exchange for collateral All expired wTokens will be claimed LP will get pro-rata collateral and payment assets We return collateralTokenSent in order to give user ability to calculate t... | function withdrawCapital(
uint256 lpTokenAmount,
bool sellTokens,
uint256 collateralMinimum
) public {
require(
!sellTokens || collateralMinimum > 0,
"withdrawCapital: collateralMinimum must be set"
);
uint256 redeemerCollateralBalance =
... | 10,761,772 |
//SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.5.0 <0.9.0;
// ----------------------------------------------------------------------------
// EIP-20: ERC-20 Token Standard
// https://eips.ethereum.org/EIPS/eip-20
// -----------------------------------------
interface ERC20Interface {
function totalSupply()... | ---------------------------------------------------------------------------- EIP-20: ERC-20 Token Standard https:eips.ethereum.org/EIPS/eip-20 ----------------------------------------- | interface ERC20Interface {
function totalSupply() external view returns (uint);
function balanceOf(address tokenOwner) external view returns (uint balance);
function transfer(address to, uint tokens) external returns (bool success);
function allowance(address tokenOwner, address spender) external v... | 6,367,037 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
interface IUniswap {
// To convert DAI to ETH
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts);
// To convert ETH to YELD and burn it
function s... | No rebalance implementation for lower fees and faster swaps Yeld Yeld 98% is the 49% doubled since we already took the 50% Buy and burn only applies up to 50k tokens burned 1% for the Retirement Yield Send to the treasury If we've reached the maximum burn point, send half the profits to the treasury to reward holders S... | function withdraw(uint256 _shares)
external
nonReentrant
{
require(_shares > 0, "withdraw must be greater than 0");
uint256 ibalance = balanceOf(msg.sender);
require(_shares <= ibalance, "insufficient balance");
pool = _calcPoolValueInToken();
uint256 generatedYelds = getGe... | 2,126,555 |
./partial_match/42/0xBe58856D9b40183f63A32f9323771511f41B3694/sources/ExchangeProxy.sol | performs chained getAmountIn calculations on any number of pools | function getAmountsIn(Swap[] memory swaps) internal view returns (uint[] memory amounts) {
require(swaps.length >= 1, 'ExchangeProxy: INVALID_PATH');
amounts = new uint[](swaps.length);
for (uint i = swaps.length - 1; i >= 0; i--) {
Swap memory swap = swaps[i];
amount... | 3,490,297 |
/**
*Submitted for verification at Etherscan.io on 2020-05-25
*/
//Orfeed oracle interest rate aggregator alpha contract
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
... | @todo unroll the loop into increments of 32 and do full 32 byte comparisons | function compare(string memory _a, string memory _b) internal view returns (int) {
bytes memory a = bytes(_a);
bytes memory b = bytes(_b);
uint minLength = a.length;
for (uint i = 0; i < minLength; i ++)
if (a[i] < b[i])
return -1;
else if (a[i] > ... | 1,826,162 |
./partial_match/80001/0x94086f81367Ec9398665D9b66d299510EE3Ce57B/sources/contracts/interfaces/IAlgebraCommunityVault.sol | The interface for the Algebra community fee vault Community fee from pools is sent here, if it is enabled Version: Algebra Integral | interface IAlgebraCommunityVault {
event TokensWithdrawal(address indexed token, address indexed to, uint256 amount);
event AlgebraTokensWithdrawal(address indexed token, address indexed to, uint256 amount);
event AlgebraFeeReceiver(address newAlgebraFeeReceiver);
event PendingAlgebraFeeManager(address pendi... | 8,804,973 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "./GatewayToken.sol";
import "./interfaces/IGatewayToken.sol";
import "./interfaces/IGatewayTokenController.sol";
/**
* @dev Gateway Token Controller contract is responsible for managing I... | Restricts owner's transfers for specified gateway tokens tokens Gateway Token contracts address array/ | function restrictTransfersBatch(address[] memory tokens) public onlyAdmin override {
for (uint256 i = 0; i < tokens.length; ++i) {
address token = tokens[i];
require(gatewayTokens.contains(token), "NOT GATEWAY TOKEN");
IGatewayToken gt = IGatewayToken(token);
... | 6,457,184 |
/**
*Submitted for verification at Etherscan.io on 2022-02-07
*/
// SPDX-License-Identifier: AGPL-3.0-or-later
// File: interfaces/ISinsAuthority.sol
pragma solidity >=0.7.5;
interface ISinsAuthority {
/* ========== EVENTS ========== */
event GovernorPushed(address indexed from, address indexed to, b... | once enabled, can never be turned off | function enableTrading() external onlyGovernor {
tradingActive = true;
swapEnabled = true;
}
| 6,817,924 |
./full_match/3/0xE68d4d60167cB8752D3A915f8E9bfb21DA7A1667/sources/momo.sol | calculate Reward stake list with `_stakeAddress` and '_stakeStartTime','_rewardTime' and calculate stake reward Coefficients for this stake address Requirements: - `_stakeAddress` cannot be the zero address. - `_stakeStartTime` must have at least `time stamp` value. - `_stakeAmount` input stake amount. - `_rewardTime... | function _calculateRewardStakelist(address _stakeAddress,uint256 _stakeStartTime,uint256 _stakeAmount,uint256 _rewardTime) internal virtual
{
require(5<=_stakeAmount , "testContract: less than 5 tokens are not possible.");
uint256 rewardCof=_rewardCoefficients[_stakeAddress][_stakeStartTime][_rewa... | 8,094,818 |
./partial_match/1/0x0Ee60E3eDd8E04dcE059Ab52363eB1936f6fbC95/sources/HlandMaster.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, "HLAND::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return... | 4,055,675 |
./partial_match/56/0xd0367EF92B6fa5C62Ea50BE8C45f0f733D488b51/sources/MasterChef.sol | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) public {
require (_pid != 0, 'withdraw VEGE by unstaking');
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
... | 11,342,017 |
./full_match/80001/0x71Ec519Ffdb5825447836B58C94a5f9649a52940/sources/contracts/Contract.sol | Replace msg.sender with primary sale wallet address Do NOT replace msg.sender here | function withdraw() external onlyOwner {
uint256 withdrawAmount_100 = (address(this).balance * 100) / 100;
payable(msg.sender).transfer(withdrawAmount_100);
payable(msg.sender).transfer(address(this).balance);
}
| 9,536,007 |
pragma solidity 0.4.25;
interface ERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner... | This method will be used by the admin to allocate tokens to multiple contributors in a single shot./ | function saleDistributionMultiAddress(address[] _addresses,uint256[] _values) public onlyOwner returns (bool) {
require( _addresses.length > 0 && _addresses.length == _values.length);
uint256 length = _addresses.length ;
for(uint8 i=0 ; i < length ; i++ )
{
if(_addre... | 1,789,455 |
/**
*Submitted for verification at Etherscan.io on 2021-07-11
*/
/*
⚠⚠⚠ WARNING WARNING WARNING ⚠⚠⚠
This is a TARGET contract - DO NOT CONNECT TO IT DIRECTLY IN YOUR CONTRACTS or DAPPS!
This contract has an associated PROXY that MUST be used for all integrations - this TARGET will be REPLACED in an upcoming Peri F... | Note: use public visibility so that it can be invoked in a subclass | function resolverAddressesRequired() public view returns (bytes32[] memory addresses) {
addresses = new bytes32[](6);
addresses[0] = CONTRACT_PERIFINANCESTATE;
addresses[1] = CONTRACT_SYSTEMSTATUS;
addresses[2] = CONTRACT_EXCHANGER;
addresses[3] = CONTRACT_ISSUER;
add... | 6,499,130 |
./partial_match/1/0x064774df70688825Db7D0CEcc46488A18ca7AE9F/sources/src/ERC1404TokenMinKYCv13.flattened.sol | Transfer tokens from one account to other Also manage current number of token holders Transfer will surely increase currentTotalInvestors if recipient current balance is 0 | function transferSharesBetweenInvestors (
address sender,
address recipient,
uint256 amount,
)
internal {
if( ERC20.balanceOf(recipient) == 0 && recipient != Ownable.owner() ) {
currentTotalInvestors = currentTotalInvestors + 1;
}
if( simpleTransfer == true ) {
ERC20._transfer(... | 2,708,908 |
./full_match/5/0x8207B056ad080730fC048579940fD2217bFc3DC7/sources/src/Evolve.sol | Check if the claimer has the access key | function verifyClaim(
address _claimer,
uint256 _tokenId,
uint256 _quantity
) public view override {
if (_tokenId > 0) {
require(
balanceOf[_claimer][_tokenId] >= _quantity,
"Rejected: You do not own the pre-evolved NFT(s)"
... | 1,876,037 |
./full_match/1/0xa94D1052A1F67F523FCF5E7A512A43e07Cab86D7/sources/src/thirdparty/opensea/seadrop-upgradeable/src/ERC721ContractMetadataUpgradeable.sol | Reverts if the sender is not the owner or the contract itself. This function is inlined instead of being a modifier to save contract space from being inlined N times./ | function _onlyOwnerOrSelf() internal view {
if (_cast(msg.sender == owner()) | _cast(msg.sender == address(this)) == 0) {
revert OnlyOwner();
}
}
| 4,911,994 |
./full_match/42/0x6D2991198C8688261364BBC1F1740a359eBfc761/sources/browser/WETHParty.sol | [sponsored -0 , processed -1, didPass -2, cancelled -3, guildkick -4, spending -5, member -6, governance -7] Make the proposal fail if the new total number of shares and loot exceeds the limit Make the proposal fail if the new total number of shares and loot exceeds the limit | function processProposal(uint256 proposalIndex) public nonReentrant {
_validateProposalForProcessing(proposalIndex);
uint256 proposalId = proposalQueue[proposalIndex];
Proposal storage proposal = proposals[proposalId];
require(!proposal.flags[4] && !proposal.flags[7], "not ... | 9,582,661 |
pragma solidity ^0.5.0;
import "./ERCStaking.sol";
import "./Checkpointing.sol";
import "./res/Autopetrified.sol";
import "./res/IsContract.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol";
import "openzeppelin-solidity/contracts/tok... | Return the maximum stake configuration return max stake/ | function getMaxStakeAmount() external view returns (uint256) {
return maxStakeAmount;
}
| 1,067,069 |
//Address: 0x51c340f52ecbda35f56578fb0571fb4eed064fc1
//Contract name: DragonToken
//Balance: 0 Ether
//Verification Date: 2/21/2018
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* @title ERC721 interface
* @dev see https://github.com/ethereum/eips/issues/721
*/
contract ERC721 {
event ... | Gets the total amount of tokens stored by the contract return uint256 representing the total amount of tokens/ | function totalSupply() public view returns (uint256) {
return totalTokens;
}
| 15,799,297 |
pragma solidity 0.4.21;
/**
* @title DirectCrowdsaleLib
* @author Modular Inc, https://modular.network
*
* version 3.0.0
* Copyright (c) 2017 Modular Inc
* The MIT License (MIT)
* https://github.com/Modular-Network/ethereum-libraries/blob/master/LICENSE
*
* The DirectCrowdsale Library provides functionality t... | Called by a crowdsale contract upon creation. self Stored crowdsale from crowdsale contract _owner Address of crowdsale owner _saleData Array of 2 item sets such that, in each 2 element set, 1 is timestamp, and 2 is price in tokens/ETH at that time _endTime Timestamp of sale end time _percentBurn Percentage of ext... | function init(DirectCrowdsaleStorage storage self,
address _owner,
uint256[] _saleData,
uint256 _endTime,
uint8 _percentBurn,
CrowdsaleToken _token)
public
{
require(self.owner == 0);
require(_saleData.length > 0... | 7,785,704 |
// SPDX-License-Identifier: Unlicense
pragma solidity 0.8.4;
import '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import '@openzeppelin/contracts/utils/math/SafeMath.sol';
import './BlockNoteXACL.sol';
/// @author Blockben
/// @title BlockNoteX
/// @notice BlockNoteX implementation
contract BlockNoteX is ERC20, B... | _spender Spender account _value Value to approve/ | function approve(address _spender, uint256 _value) public override whenNotPaused returns (bool) {
require((_value == 0) || (allowance(_msgSender(), _spender) == 0), 'Approve: zero first');
return super.approve(_spender, _value);
}
| 1,818,390 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzepp... | just in case prov needs to be reset/ | function setProvenance(string memory newProv) public onlyOwner {
require(!locked, "Contract is locked");
provenance = newProv;
}
| 323,737 |
/**
* Copyright (C) 2017-2018 Hashfuture Inc. All rights reserved.
*/
pragma solidity ^0.4.22;
library strings {
struct slice {
uint _len;
uint _ptr;
}
function memcpy(uint dest, uint src, uint len) private pure {
// Copy word-length chunks while possible
for(; len >... | cancel contract Only can be called by holder/ | function cancelContract() public onlyHolder {
isValid = false;
}
| 2,098,175 |
pragma solidity >=0.5.4 <0.6.0;
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external; }
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies ... | PUBLIC METHODS / Get AccountRecovery information given a Name ID _id The ID of the Name return the submit status of the account recovery return submittedTimestamp - Timestamp when this account recovery is submitted return lockedUntilTimestamp - The deadline for the current Speaker of Name to respond and replace the n... | function getAccountRecovery(address _id) public isName(_id) view returns (bool, uint256, uint256) {
AccountRecovery memory _accountRecovery = accountRecoveries[_id];
return (
_accountRecovery.submitted,
_accountRecovery.submittedTimestamp,
_accountRecovery.lockedUntilTimestamp
);
}
| 12,678,642 |
// File: contracts/interfaces/IMarketHandler.sol
pragma solidity 0.6.12;
/**
* @title BiFi's market handler interface
* @author BiFi(seinmyung25, Miller-kk, tlatkdgus1, dongchangYoo)
*/
interface IMarketHandler {
function setCircuitBreaker(bool _emergency) external returns (bool);
function setCircuitBreakWithOwn... | Get the decimal of the underlying token return the decimal of the underlying token/ default: UnderlyingTokenDecimal Function / | function getUnderlyingTokenDecimal() external view returns (uint256)
{
return underlyingTokenDecimal;
}
| 1,420,321 |
./partial_match/1/0xb3877037A0B366f33Eb8BdDb4e0b477417359EcE/sources/contracts/ERC721ATest.sol | An external method for users to purchase and mint NFTs. Requires that the sale is active, that the minted NFTs will not exceed the `MAX_SUPPLY`, and that a sufficient payable value is sent. amount The number of NFTs to mint./ | function mint(uint256 amount) external payable {
uint256 ts = totalSupply();
uint256 minted = _numberMinted(msg.sender);
require(saleIsActive, "Sale must be active to mint tokens");
require(amount + minted <= walletLimit, "Exceeds wallet limit");
require(ts + amount <= MAX_SUPPLY, "Purchase would... | 9,382,004 |
// 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 msg.sender and msg.data, they should not ... | Sets the wallet to which royalties should be sent _royaltyWallet Address that should receive the royalties/ | function setRoyaltyWallet(address _royaltyWallet) external onlyOwners {
_setRoyaltyWallet(_royaltyWallet);
}
| 71,301 |
pragma solidity ^0.4.13;
library SafeMath {
function mul(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal returns (uint256) {
// assert(b > 0); // Solidity automatically throws wh... | Let's immediately adjust the difficulty In case an abnormal period of time has elapsed nobody has been mining etc. Will let us recover the network even if the difficulty spikes to some absurd amount this should only happen on the first attempt on a block/ | function mine() external payable
nonReentrant
isValidAttempt
isMiningActive
initBlock(external_to_internal_block_number(current_external_block()))
blockRedeemed(external_to_internal... | 2,478,592 |
pragma solidity ^0.4.24;
contract Stuff {
struct stuffInfo{
uint code;
string name;
string description;
uint cost;
address owner;
bool isBuy;
}
mapping(uint=> stuffInfo) public stuffArray;
mapping(address=> stuffInfo[]) public personal;
uint public nu... | stuffInfo memory tmp= stuffInfo(num,_name,_description,_cost,_owner,false); | function registerStuff(address _owner, string _name, string _description, uint _cost) public returns(bool success){
stuffArray[num]=stuffInfo(num,_name,_description,_cost,_owner,false);
num+=1;
return true;
}
| 5,440,081 |
pragma solidity ^0.5.0;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/cryptography/ECDSA.sol";
import "./AccountRegistry.sol";
contract ComplianceToken{
using SafeMath for uint256;
using ECDSA for bytes32;
mapping(address => uint256) private _balance;
add... | AccountRegistry address MG and Citi infor Alice and Bob infor | function dump(address mgAddr, address citiAddr, address aliceAddr, address bobAddr) public {
emit DumpAccountRegistry(address(_accountRegistry));
emit DumpTrustedAccount(mgAddr, _accountRegistry.isAccountTrusted(mgAddr));
emit DumpTrustedAccount(citiAddr, _accountRegistry.isAccountTrusted(citiAddr));
... | 1,082,252 |
// 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... | Pack targets as two uint96 values into a single storage slot. This results in targets being capped to 96 bits, but that should be more than enough. | function _setTargets(
IERC20 mainToken,
uint256 lowerTarget,
uint256 upperTarget
) private {
_require(lowerTarget <= upperTarget, Errors.LOWER_GREATER_THAN_UPPER_TARGET);
_require(upperTarget <= _MAX_UPPER_TARGET, Errors.UPPER_TARGET_TOO_HIGH);
_setMiscData(
... | 9,951,923 |
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Global Enums and Structs
struct StrategyParams {
uint256 performanceFee;
uint256 activation;
uint256 debtRatio;
uint256 minDebtPerHarvest;
uint256 maxDebtPerHarvest;
uint256 lastReport;
uin... | this is claiming our rewards | function massHarvest() external returns (uint256); | 1,406,948 |
./full_match/5/0xB78299e5183C7746D825D9f92ABF6368F54f8537/sources/contracts/y00tsAnchorClub.sol | ERC721 token receiver interface Interface for any contract that wants to support safeTransfers from ERC721 asset contracts./ | interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns(bytes4);
}
| 1,879,451 |
./full_match/11155111/0xE46FE78DBfCa5E835667Ba9dCd3F3315E7623F8a/sources/contracts/SignatureDecoder.sol | divides bytes signature into `uint8 v, bytes32 r, bytes32 s`. Make sure to peform a bounds check for pos, to avoid out of bounds access on signatures pos which signature to read. A prior bounds check of this parameter should be performed, to avoid out of bounds access signatures concatenated rsv signatures The sig... | function signatureSplit(bytes memory signatures, uint256 pos) internal pure returns (uint8 v, bytes32 r, bytes32 s) {
assembly {
let signaturePos := mul(0x41, pos)
r := mload(add(signatures, add(signaturePos, 0x20)))
s := mload(add(signatures, add(signaturePos, 0x40)))
... | 3,835,110 |
./partial_match/4/0x5417c147643c6380758c69b7f1aEfb4974E1a34F/sources/ArbOne.sol | 返回我参与第二轮仲裁订单列表 @count 最多返回的数量 | function applDeal(address usr, uint256 count) external view returns (UserInfo[] memory) {
uint length = appl[usr];
if (count < length) length = count;
UserInfo[] memory result = new UserInfo[](length);
uint max = appl[usr];
uint j;
for (uint i = max; i >=1 ; --i) {
... | 16,994,131 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.7.6;
pragma abicoder v2;
import {OwnableUpgradeable} from '@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol';
import {ERC20} from '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.... | Resolves garden votes for this cycle Note: Only keeper can call this _gardens Gardens that are going to receive investment _weights Weight for the investment in each garden normalied to 1e18 precision/ | function resolveGardenVotes(address[] memory _gardens, uint256[] memory _weights) public override {
_onlyKeeper();
_require(_gardens.length == _weights.length, Errors.HEART_VOTES_LENGTH);
delete votedGardens;
delete gardenWeights;
for (uint256 i = 0; i < _gardens.length; i++)... | 217,632 |
./full_match/5/0xd7A541c394f943F73D3267d64Eb8A32D690D0a80/sources/Casino.sol | Generates a number between 1 and 10 that will be the winner | function generateNumberWinner() public {
distributePrizes(numberGenerated);
}
| 1,850,310 |
./full_match/1/0xd15563162301EcD765bFB54eBd0809b21932C506/sources/contracts/lib/SlotsLib.sol | Pushes an address to the array | function push(bytes32 slot, address value) internal {
uint length = arrayLength(slot);
setAt(slot, length, value);
setLength(slot, length + 1);
}
| 3,877,049 |
// SPDX-License-Identifier: GNU-GPL v3.0 or later
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "../../interfaces/IOutputReceiver.sol";
import "../../interfaces/IOutputReceiverV2.sol";
import "../../interfaces/IOutputReceiverV3.sol";
import "../../interfaces/IRevest.sol";
import ... | Will be zero if this is an LP stake | function getOutputDisplayValues(uint fnftId) external view override returns (bytes memory) {
if(fnftId <= previousStakingIDCutoff) {
return IOutputReceiver(oldStakingContract).getOutputDisplayValues(fnftId);
}
bool isRevestToken;
{
uint revestTokenAlloc = IRew... | 1,669,473 |
pragma solidity 0.6.12;
import '@pancakeswap/pancake-swap-lib/contracts/math/SafeMath.sol';
import '@pancakeswap/pancake-swap-lib/contracts/token/BEP20/IBEP20.sol';
import '@pancakeswap/pancake-swap-lib/contracts/token/BEP20/SafeBEP20.sol';
import '@pancakeswap/pancake-swap-lib/contracts/access/Ownable.sol';
import "... | Destroys `amount` tokens from `account`.`amount` is then deducted from the caller's allowance. See {_burn} and {_approve}./ | function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(
account,
_msgSender(),
_allowances[account][_msgSender()].sub(amount, 'BEP20: burn amount exceeds allowance')
);
}
| 250,545 |
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... | Returns the core identifier of the chain that this block store tracks. return coreIdentifier_ The core identifier of the tracked chain./ | function getCoreIdentifier() external view returns (bytes20 coreIdentifier_) {
coreIdentifier_ = coreIdentifier;
}
| 2,529,214 |
./full_match/80001/0x3bbC4Ce3e17e6bDbd25aA142D2537722f63F02b3/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 {
require(isUnstakingPhaseActive, "StakingContract: UnStake Phase is not active yet!");
require(stakedBalances[msg.sender] > 0, "StakingContract: You must have staked tokens to select unstaking");
require(!canUnstake[msg.sender], "StakingContract: A... | 5,630,432 |
pragma solidity ^0.4.11;
import "./clock_auction.sol";
/// @title Clock auction modified for sale of pandas
/// @notice We omit a fallback function to prevent accidental sends to this contract.
contract SaleClockAuction is ClockAuction {
// @dev Sanity check that allows us to ensure that we are pointing to the
... | Sanity check that no inputs overflow how many bits we've allocated to store them in the auction struct. | function createGen0Auction(
uint256 _tokenId,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration,
address _seller
)
external
{
require(_startingPrice == uint256(uint128(_startingPrice)));
require(_endingPrice == uint256(uint128(_en... | 12,697,927 |
./full_match/44787/0x9a7Ad9FBc46535112710f243c3549878Fe828b0f/sources/ToshaFarm_flat.sol | Return reward multiplier over the given _from to _to block. | function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256) {
if (IERC20(TOSHA).totalSupply() >= maxSupply) {
return 0;
}
return _to.sub(_from);
}
| 13,247,267 |
pragma solidity ^0.4.18;
/**
* Math operations with safety checks
*/
contract SafeMath {
function safeMul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
simpleAssert(a == 0 || c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) internal pur... | transfer balance to owner | function withdrawEther(uint256 amount) public {
if(msg.sender != owner) revert();
owner.transfer(amount);
}
| 633 |
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.0 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal... | File: contracts/Mines.sol | interface IGTG {
function ownerOf(uint256 id) external view returns (address);
function burn(uint256 tokenId) external;
function isGoblin(uint16 id) external view returns (bool);
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
function safeTransferFrom(
address from,
add... | 9,924,280 |
./full_match/1/0xc10cF90e627434569fd26c8756B27D4aF20296E6/sources/src/minter/DNAMinter.sol | Set the Cre8orsNFT contract address. This function can only be called by an admin, identified by the "cre8orsNFT" contract address. _dnaNft The new address of the DNA contract to be set. | function setDnaNFT(address _dnaNft) public onlyAdmin(dnaNft) {
dnaNft = _dnaNft;
}
| 3,854,396 |
./full_match/80001/0x799022f326F50e330dCf5cFEbCEeC8356CD0aFa1/sources/contracts/IndradexBaseVault.sol | Returns the current withdrawalTime./ | function getWithdrawalTime() external view returns (uint256) {
return _withdrawalTime;
}
| 861,914 |
./partial_match/100/0x3E8231c631E7Edf9F2Bd153d2B43c64b7D330cca/sources/PriceBettingUserRecord.sol | userAddr -> bets: cleared or not | function getBetterBets(address user, uint256 period, uint256 idxStart, uint256 outLength, uint256 option) public view
returns (IPriceBetting.Bet[] memory betsOut, uint256 cidx3, uint256 uidx3, uint256 idxStart3, uint256 idxLast3)
{
(uint256[] memory indexes, uint256 cidx2, uint256 uidx2, uint256 i... | 16,645,851 |
pragma solidity ^0.4.24;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is al... | Returned total holders/ | function getHoldersQuantity() public view returns(uint256) {
return holdersList.length;
}
| 945,744 |
./full_match/80001/0xc9304257B62C12a31763a3DC945896fb78a0F34D/sources/contracts/extension/DropSinglePhase.sol | Logic borrowed From https://thirdweb.com/nach.eth/DynamicFreeMint thanks to Nacho Iacovino number for updating the numClaimedForFree | function _getTotalPrice(
uint256 _quantityToClaim,
uint256 _quantityForFree,
bool _isActiveOverride,
uint256 _pricePerToken,
uint256 _printPriceTotal
) internal virtual returns (uint256 totalPrice) {
if (_isActiveOverride) {
uint256 freeClaimed = numCl... | 839,940 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
interface IERC20 {
function TOTALSUPPLY267() exte... | inject NONSTANDARD NAMING | function MOD699(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { | 13,085,313 |
./full_match/1/0x904332C09e2161539cd819dA42ac4fe70e3e97d0/sources/contracts/bt.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("BOBATEA", "BT") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswa... | 2,993,836 |
/**
*Submitted for verification at Etherscan.io on 2022-02-16
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;
abstract contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
owner = msg.se... | This would be easier, cheaper, simpler, and result in globally consistent deposit addresses for any salt (all chains, all tokens). return address(uint160(uint256(keccak256(abi.encodePacked(bytes32(0x000000000000000000000000000000000000000000000000000000000000dead), salt))))); | function depositAddress(bytes32 salt) public view returns (address) {
return
address(
uint160(
uint256(
keccak256(
abi.encodePacked(
bytes1(0xff),
... | 10,644,685 |
pragma solidity 0.5.17;
import {BTCUtils} from "@summa-tx/bitcoin-spv-sol/contracts/BTCUtils.sol";
import {BytesLib} from "@summa-tx/bitcoin-spv-sol/contracts/BytesLib.sol";
import {IBondedECDSAKeep} from "@keep-network/keep-ecdsa/contracts/api/IBondedECDSAKeep.sol";
import {SafeMath} from "openzeppelin-solidity/contr... | Notify the contract that the signers are undercollateralized. Calls out to the system for oracle info. _d Deposit storage pointer. | function notifyUndercollateralizedLiquidation(DepositUtils.Deposit storage _d) public {
require(_d.inRedeemableState(), "Deposit not in active or courtesy call");
require(getCollateralizationPercentage(_d) < _d.severelyUndercollateralizedThresholdPercent, "Deposit has sufficient collateral");
... | 1,082,841 |
./full_match/137/0xE869a0D3C1B3B66EBf889b025d13980c39eC5646/sources/project_/contracts/market/ERC721Bids.sol | See {IERC721Bids-numTokenWithBidsOfCollection}./ | function numTokenWithBidsOfCollection(
address erc721Address
) public view returns (uint256) {
return _erc721Bids[erc721Address].tokenIds.length();
}
| 4,773,906 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
//Simple notary contract to save strings and be able to check later
contract NotaryOffice {
//Actuall mapping of notarized strings which will be saved on blockchain
mapping(bytes32 => bool) private docs;
//Setting the owner of the contract
addre... | Public function to check for string if it has been saved require minimum 1 ether for each time checking to be paid | function checkDocument(string memory _docToCheck)
public
payable
returns (bool)
{
require(
msg.value >= 1 ether,
"Notary Office: We require one ether for our services"
);
emit Document_Checked(_docToCheck, msg.sender);
return docs[h... | 7,243,401 |
pragma solidity 0.5.2;
import 'openzeppelin-solidity/contracts/lifecycle/Pausable.sol';
import 'openzeppelin-solidity/contracts/math/SafeMath.sol';
contract Splitter is Pausable {
using SafeMath for uint256;
mapping (address => uint) public funds;
constructor() public {
}
event Log... | emit LogFundsAdded(receiver1, half);emit LogFundsAdded(receiver2, half);uint mod = msg.value %2; | function split(address receiver1, address receiver2) payable public whenNotPaused {
require(receiver1 != address(0), "Receiving address cannot be zero");
require(receiver2 != address(0), "Receiving address cannot be zero");
require(msg.value>0, "Amount splitted cannot be zero");
uint half ... | 911,415 |
./partial_match/56/0x8B881A877a650c0F12e806e88575c40E0026C4Be/sources/MasterChef.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0 || pool.allocPoint == 0) {
pool.lastRew... | 11,058,595 |
pragma solidity ^0.4.24;
// File: contracts/LandBasic.sol
/**
* @title Land interface
*/
contract LandBasic {
function createAndTransfer(address _to, uint32 _world, int64 _x, int64 _y) public;
event Create(uint32 indexed _world, int64 indexed _x, int64 indexed _y);
}
// File: contracts/BidLandBasic.sol
/**
*... | Gets all plots in current auction./ | function getPlots() external view returns (uint8[] xs, uint8[] ys, address[] bidders, uint8[] teams, uint256[] currentBids) {
xs = new uint8[](PLOT_COUNT);
ys = new uint8[](PLOT_COUNT);
bidders = new address[](PLOT_COUNT);
teams = new uint8[](PLOT_COUNT);
currentBids = new uint256[](PLOT_COUNT);
... | 15,833,393 |
./full_match/5/0x5a08edfCC269505A42fd594F7a00288E4E40BF4b/sources/lib/ERC721B/contracts/extensions/ERC721BBurnable.sol | Burns `tokenId`. See {ERC721B-_burn}. Requirements: - The caller must own `tokenId` or be an approved operator./ Clear approvalsthis is the situation when _owners are normalizedthis is the situation when _owners are not normalized | function burn(uint256 tokenId) public virtual {
address owner = ERC721B.ownerOf(tokenId);
if (!_isApprovedOrOwner(_msgSender(), tokenId, owner))
revert InvalidCall();
_beforeTokenTransfers(owner, address(0), tokenId, 1);
_approve(address(0), tokenId, owner);
unchecked {
_balanc... | 1,867,372 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.