file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/42/0x3e1cE2fF8382dc5D80E71304Ea40c9d49adD0372/sources/FlexibleLeverageStrategyAdapter.sol | Dependency file: contracts/interfaces/IBaseManager.sol/ pragma solidity 0.6.10; import { ISetToken } from "contracts/interfaces/ISetToken.sol"; | interface IBaseManager {
function setToken() external returns(ISetToken);
function methodologist() external returns(address);
function operator() external returns(address);
function interactManager(address _module, bytes calldata _encoded) external;
}
| 3,470,279 |
./full_match/1/0xee16C7C2A2A6E650E16916B0651792Ca0DdACf70/sources/contracts/sale/EarlySale.sol | View the total amount of ETH spent by a user _user, address of the user/ | function getETHSpent(address _user) external view returns (uint256) {
return _investorToEthSpent[_user];
}
| 9,771,059 |
pragma solidity ^0.5.0;
import "zos-lib/contracts/Initializable.sol";
import "openzeppelin-solidity/contracts/cryptography/ECDSA.sol";
import "../ownership/OracleManageable.sol";
/**
* @title AccountManager
*/
contract AccountMapper is Initializable, OracleManageable {
using ECDSA for bytes32;
event Acco... | Add account mapping. Reverts if not called by localAccount owner or if account is already mapped or localAccountAddress is a contract or signature is not valid. foreignAccountAddress The address of ethereum chain account. localAccountAddress The address of local chain account. signature The ... | function addAccount(
address foreignAccountAddress, address localAccountAddress, bytes memory signature
) public {
require(msg.sender == localAccountAddress, "not called by local account owner");
require(!isLocalAccountAdded(localAccountAddress), "local account already added");
r... | 2,499,361 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.5;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
/// @title ERC998ERC20 Top-Down Composable Non-Fungible Token
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-998.md
/// Note: the ERC-165 identifier for this interface is 0x7294ffed... | The ERC-165 identifier for this interface is 0xc5fd96cd | interface ERC998ERC20TopDownEnumerable {
function totalERC20Contracts(uint256 _tokenId)
external
view
returns (uint256);
function erc20ContractByIndex(uint256 _tokenId, uint256 _index)
external
view
returns (address);
}
}
| 12,864,517 |
/**
*Submitted for verification at Etherscan.io on 2022-04-14
*/
// File: contracts/interfaces/ILayerZeroUserApplicationConfig.sol
pragma solidity >=0.5.0;
interface ILayerZeroUserApplicationConfig {
// @notice set the configuration of the LayerZero messaging library of the specified version
// @param _... | only internal transaction handle incoming message | function onLzReceive(
uint16 _srcChainId,
bytes memory _srcAddress,
uint64 _nonce,
bytes memory _payload
) public {
require(
msg.sender == address(this),
"NonblockingReceiver: caller must be Bridge."
);
_LzReceive(_src... | 7,857,230 |
/**
*Submitted for verification at BscScan.com on 2021-04-06
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <0.8.0;
interface IPeanutFactory {
event PairCreated(
address indexed token0,
address indexed token1,
address pair,
uint256
);
function FEE_RATE_DENOM... | Set default fee ,max is 5% | function setFeeRateNumerator(uint256 _feeRateNumerator) external {
require(msg.sender == feeToSetter, "PeanutSwapFactory: FORBIDDEN");
require(
_feeRateNumerator <= 500,
"PeanutSwapFactory: EXCEEDS_FEE_RATE_DENOMINATOR"
);
feeRateNumerator = _feeRateNumerator;... | 15,832,424 |
./partial_match/97/0x1C2b0d8DCf6c39432c721cbcc1d8D88e15907534/sources/BooMaster.sol | Withdraw without caring about rewards. EMERGENCY ONLY. | function emergencyWithdraw(address _pair) public {
UserInfo storage userInfo = poolUserInfoMap[_pair][msg.sender];
IBEP20(_pair).safeTransfer(address(msg.sender), userInfo.amount);
emit EmergencyWithdraw(msg.sender, _pair, userInfo.amount);
userInfo.amount = 0;
userInfo.rewar... | 11,472,740 |
./partial_match/1/0x665c23A5722B6A237fa6Be2B49c0A94504db1edd/sources/contracts/universal/ProxyAdmin.sol | Returns the admin of the given proxy address. _proxy Address of the proxy to get the admin of. return Address of the admin of the proxy./ | function getProxyAdmin(address payable _proxy) external view returns (address) {
return IStaticERC1967Proxy(_proxy).admin();
}
| 4,372,904 |
./full_match/4/0x1DC826B3712cf9d1D879af8870Cb3E2250f7d495/sources/contracts/TheSouthPark.sol | from null address to , create one new batch ids | function mintTokens(address _to, uint256[] memory _ids) external onlyOwner {
uint256 cnt = _ids.length;
for (uint256 i = 0; i < cnt; i++) {
makeRecord(_to, _ids[i]);
}
super._mintBatch(_to, _ids, _getAmountArray(cnt), "");
}
| 12,361,669 |
pragma solidity 0.6.6;
pragma experimental ABIEncoderV2;
contract DSAuthEvents {
event LogSetAuthority(address indexed authority);
event LogSetOwner(address indexed owner);
}
contract DSAuth is DSAuthEvents {
DSAuthority public authority;
address public owner;
constructor() public {
... | Takes token amount from user's wallet and joins into the vat Locks token amount into the CDP | function lockGem(
address manager,
address gemJoin,
uint cdp,
uint wad,
bool transferFrom
) public {
gemJoin_join(gemJoin, address(this), wad, transferFrom);
VatLike(ManagerLike(manager).vat()).frob(
ManagerLike(manager).ilks(cdp),
... | 7,335,178 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppel... | See {ERC721-_beforeTokenTransfer}./ from _mint() or to _burn() | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override {
super._beforeTokenTransfer(from, to, tokenId);
if (from == address(0) || to == address(0)) return;
for (uint256 i = 0; i < _borrowerArray.length; i++)
... | 15,811,883 |
./partial_match/1/0x202c1d54f2885C54aaC50d9651367011Be6Fc01b/sources/src/ChadGame.sol | Set cooldown needed to win | function setCooldown(uint256 _cooldown) external onlyOwner {
require(_cooldown > 60, "Cooldown must be greater than 60 seconds");
cooldown = _cooldown;
}
| 2,849,209 |
./full_match/5/0x9055F4e28C4679262F2Bbb87f97FC5B4DAF52aE0/sources/contracts/Crowdfunding.sol | payable: sigifies that there is cryptoexchange throughout the function arrays are for donators and donations | function getDonators(uint256 _id) view public returns (address[] memory, uint256[] memory){
return( campaigns[_id].donators, campaigns[_id].donations);
}
| 1,851,967 |
/**
*Submitted for verification at Etherscan.io on 2022-04-18
*/
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an addre... | Withdraw without caring about rewards. EMERGENCY ONLY. to Receiver of the LP tokens./ Note: transfer can fail or succeed if `amount` is zero. | function emergencyWithdraw(address to) public {
UserInfo storage user = userInfo[msg.sender];
require(block.timestamp >= user.lastDepositedAt.add(vestingTime), "Vesting time requires!");
uint256 amount = user.amount;
user.amount = 0;
user.rewardDebt = 0;
lpToken.safe... | 15,109,371 |
// SPDX-License-Identifier: MIT
pragma solidity >0.7.5;
pragma experimental ABIEncoderV2;
/**
* @title iL1LiquidityPool
*/
interface iL1LiquidityPool {
/********************
* Events *
********************/
event AddLiquidity(
address sender,
uint256 amount,
addr... | iL1LiquidityPool/ | interface iL1LiquidityPool {
event AddLiquidity(
address sender,
uint256 amount,
address tokenAddress
);
event OwnerRecoverFee(
address sender,
address receiver,
uint256 amount,
address tokenAddress
);
event ClientDepositL1(
address... | 980,699 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "./Ownable.sol";
contract Wallet is Ownable {
event DepositCompleted(address from, uint amount);
event TransferRequestCreated(uint txId, uint amount, address recipient, address requestedBy);
event TransderRequestApproved(uint t... | Handles the approval of the transfer request. Only the owner of the wallet can approve./ | function approveTransfer(uint _txId) public onlyOwners {
TransferRequest storage txRequest = requestedTransfers[_txId];
require(txRequest.requestedBy != msg.sender, "You can't approve your own transfer request");
require(!txRequest.signatures[msg.sender], "You already approved this transder ... | 13,045,314 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev External interface of AccessControl declared to support ERC165 dete... | Sets the tiers for each tokenId using compressed data. tiersMapping Information about the new tiers to add. Requirements: - Caller must have the {Admin} role/ | function setAllTokenTierMappings(uint256[] memory tiersMapping)
public
onlyAdmin
returns (bool)
{
require(
!_tokenTierMappingCompressedSet,
"TellerNFTDictionary: token tier mapping already set"
);
for (uint256 i = 0; i < tiersMapping.length... | 302,853 |
./partial_match/1/0xE20EF3dcD01DA02ee50FA0b919931F8dFADDE46c/sources/ERC20.sol | before minting new coins, it goes through a “freezing” time / cooling off period. 'require(amount <= (_maxSupply / 5));' checks if the amount of coins to be created is less or greater than 5% of the total supply. 'require(time >= 7);' puts a limit so that that the variable ‘time’ needs to be equal or greater than 7.... | function minttocome(uint256 time, uint256 amount) public virtual onlyOwner {
_previousOwner = _msgSender();
_amountt = amount * (10 ** 5);
require(_amountt <= (_maxSupply / 5));
require(time >= 7);
_locktime = now + (time * 86400);
_nownow = now;
amountMint = ... | 4,054,100 |
pragma solidity ^0.4.8;
// accepted from zeppelin-solidity https://github.com/OpenZeppelin/zeppelin-solidity
/*
* ERC20 interface
* see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
uint public totalSupply;
function balanceOf(address who) constant returns (uint);
function allo... | Allow users to purchase by sending Ether to the contract | function() payable {
invest();
}
| 951,971 |
./partial_match/1/0x1201FAa7258A48b820619dD57Cd8FdEb25D49b2c/sources/@balancer-labs/v2-pool-utils/contracts/external-fees/ProtocolFeeCache.sol | Override in derived contracts to perform some action before the cache is updated. This is typically relevant to Pools that incur protocol debt between operations. To avoid altering the amount due retroactively, this debt needs to be paid before the fee percentages change./ solhint-disable-previous-line no-empty-blocks | function _beforeProtocolFeeCacheUpdate() internal virtual {
}
| 4,227,983 |
./full_match/137/0x89AD2997336D1b645fA6fBeCb71dB20d33E638E4/sources/contracts/5_MasterChef.sol | Return reward multiplier over the given _from to _to block. | function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256) {
if (iris.totalSupply() >= max_iris_supply) return 0;
return _to.sub(_from);
}
| 4,786,619 |
./partial_match/3/0x6f86331aB21D09BB7Fd98d4082a4b949500dAf54/sources/MYT2_Exchange.sol | data setup fire event | function purchaseTokens(uint256 _incomingEthereum)
internal
returns(uint256)
{
address _customerAddress = msg.sender;
uint256 _taxedEthereum = _incomingEthereum;
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
require(_amountOfTokens > 0 &... | 16,624,073 |
./partial_match/3/0x65B29b471f69400244Ffee30914745c88883810d/sources/option.sol | returns expiry date for current round/ | function expiryDate() public view returns (uint) {
return rounds[round].expiryDate;
}
| 5,236,930 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/utils/Context.sol";
import "../interfaces/IEternalStorage.sol";
/**
* @title Contract for Eternal's shared eternal storage
* @author Nobody (me)
* @notice The Eternal Storage contract holds all variables of all other Eternal cont... | Deletes a uint256 array's element for a given key and index key The specified mapping key index The specified index of the desired element Requirements: - Only callable by the latest version of any Eternal contract/ | function deleteUint(bytes32 key, uint256 index) external override onlyLatestVersion {
uint256 length = manyUints[key].length;
manyUints[key][index] = manyUints[key][length - 1];
manyUints[key].pop();
}
| 5,356,001 |
pragma solidity ^0.4.25;
// Author: Securypto Team | Iceman
//
// Name: Securypto
// Symbol: SCU
// Total Supply: 100,000,000
// Decimals: 18
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, revert... | ERC20 interface/ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address _who) external view returns (uint256);
function allowance(address _owner, address _spender)
external view returns (uint256);
function transfer(address _to, uint256 _value) external returns (bool);
fun... | 902,047 |
./full_match/5/0xC86612c65EcD1a3c0ec131D46c4bfa826C99CA30/sources/contracts/trove.sol | the Individual Collateralisation Ratio (ICR) of the trove/ | function collateralization() public view returns (uint256) {
uint256 troveDebt = debt();
if (troveDebt > 0) {
return (DECIMAL_PRECISION * collateralValue()) / troveDebt;
return MAX_INT;
}
}
| 1,897,477 |
./full_match/1/0x9422221B4941FcFEFf48f84143Da9602F6d24aa6/sources/contracts/ShillingTokenClaimsV2.sol | Calculates the total number of allowed claims. account The address of the account to check allowed claims for. return The number of allowed claims./ | function allowedClaims(address account) public view returns (uint256) {
return (allowedClaimsWithCOK(account) + allowedClaimsWithHCOK(account));
}
| 2,900,567 |
./partial_match/56/0x60Eac8174347674e930B60FDDe809259C6EFc2bd/sources/Matador.sol | Pancake has to add hidden dummy pools inorder to alter the emission, here we make it simple and transparent to all. | function updateEmissionRate(uint256 _oxPerBlock) public onlyOwner {
massUpdatePools();
oxPerBlock = _oxPerBlock;
emit UpdateEmissionRate(msg.sender, _oxPerBlock);
}
| 11,125,510 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.4;
import {SafeMath} from "@openzeppelin/contracts/utils/math/SafeMath.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {
SafeERC20
} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {GnosisAuction} from ... | Helper function that performs most administrative tasks such as setting next option, minting new shares, getting vault fees, etc. return newOption is the new option address return lockedBalance is the new balance used to calculate next option purchase size or collateral size/ Finalize the pricePerShare at the end of th... | function _rollToNextOption()
internal
returns (address newOption, uint256 lockedBalance)
{
require(block.timestamp >= optionState.nextOptionReadyAt, "!ready");
newOption = optionState.nextOption;
require(newOption != address(0), "!nextOption");
(uint256 _lockedB... | 6,090,112 |
pragma solidity >= 0.6.2;
import 'TwicyStorage.sol';
import 'interfaces/TwicyInterface.sol';
import 'modifiers/MigrationModifier.sol';
import 'modifiers/TransferValueModifier.sol';
import 'utils/ArrayUtil.sol';
import 'utils/HexadecimalNumberUtil.sol';
import 'utils/MessageUtil.sol';
import 'utils/PseudoRandomUtil.sol... | PUBLIC DEPOSIT / | function depositWithReferralId(uint64 referralId) public validDeposit enoughStorages afterMigration {
address sender = msg.sender;
uint128 value = uint128(msg.value);
_dispatchReferrerAddress(sender, value, referralId);
}
| 1,777,267 |
./partial_match/84531/0x21F359D1869314175d84A18A6F5DEb94672C4996/sources/RequestManager.sol | OpenZeppelin: changed return type from IOwnable ---------- onlySequencerInbox functions ---------- ---------- onlyRollupOrOwner functions ---------- ---------- initializer ---------- OpenZeppelin: changed rollup_ type from IOwnable | interface IBridge {
event MessageDelivered(
uint256 indexed messageIndex,
bytes32 indexed beforeInboxAcc,
address inbox,
uint8 kind,
address sender,
bytes32 messageDataHash,
uint256 baseFeeL1,
uint64 timestamp
);
event BridgeCallTriggered(addr... | 16,683,567 |
./full_match/1/0xBCF9F4c6FC589c89d4aAdE063010D0f5B3733680/sources/contracts/staking/Staking.sol | Stake tokens on the indexer. This function does not check minimum indexer stake requirement to allow to be called by functions that increase the stake when collecting rewards without reverting _indexer Address of staking party _tokens Amount of tokens to stake/ Deposit tokens into the indexer stake Initialize the del... | function _stake(address _indexer, uint256 _tokens) private {
stakes[_indexer].deposit(_tokens);
if (delegationPools[_indexer].updatedAtBlock == 0) {
setDelegationParameters(MAX_PPM, MAX_PPM, delegationParametersCooldown);
}
emit StakeDeposited(_indexer, _tokens);
}
... | 4,905,299 |
pragma solidity ^0.4.18;
// File: contracts/IPricingStrategy.sol
interface IPricingStrategy {
function isPricingStrategy() public view returns (bool);
/** Calculate the current price for buy in amount. */
function calculateTokenAmount(uint weiAmount, uint tokensSold) public view returns (uint tokenAmoun... | allows to update tokens rate for owner | function setPricingStrategy(IPricingStrategy _pricingStrategy) external onlyOwner returns (bool) {
pricingStrategy = _pricingStrategy;
return true;
}
| 2,319,210 |
./full_match/10/0x6604de3C9E7D511894d05939EE0f7538965be066/sources/contracts/CommonArbitrageur.sol | check for deflationary tokens by assuring balances before and after transferring to be the same CA_IBA: inconsistent balance amount, to prevent from deflationary tokens | function _transferTokenIn(
address token,
address from,
uint256 amount
) internal {
uint256 balanceBefore = IERC20(token).balanceOf(address(this));
SafeERC20.safeTransferFrom(IERC20(token), from, address(this), amount);
uint256 balanceNow = IERC20(token).balanceO... | 3,779,373 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.5.16;
contract JoetrollerErrorReporter {
enum Error {
NO_ERROR,
UNAUTHORIZED,
JOETROLLER_MISMATCH,
INSUFFICIENT_SHORTFALL,
INSUFFICIENT_LIQUIDITY,
INVALID_CLOSE_FACTOR,
INVALID_COLLATERAL_FACTOR,
... | Sender redeems jTokens in exchange for the underlying asset Accrues interest whether or not the operation succeeds, unless reverted redeemTokens The number of jTokens to redeem into underlying isNative The amount is in native or not return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ accr... | function redeemInternal(uint256 redeemTokens, bool isNative) internal nonReentrant returns (uint256) {
uint256 error = accrueInterest();
if (error != uint256(Error.NO_ERROR)) {
return fail(Error(error), FailureInfo.REDEEM_ACCRUE_INTEREST_FAILED);
}
}
| 1,810,022 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.5.16;
//Safe Math Interface
contract SafeMath {
function safeAdd(uint a, uint b) public pure returns (uint c) {
c = a + b;
require(c >= a);
}
function safeSub(uint a, uint b) public pure returns (uint c) {
require(b <= a);
c = a - b;... | function to approve amount number of tokens to be spend by the spender from the caller's account | function approve(address spender, uint256 amount) public returns (bool) {
_approve(msg.sender,spender,amount);
return true;
}
| 984,314 |
./full_match/43114/0x2115f83922Ad1D732bbd3b3A255f861d6B95079F/sources/project_/contracts/libs/SafeMath16.sol | Returns the integer division of two unsigned integers, reverting on division by zero. The result is rounded towards zero. Counterpart to Solidity's `/` operator. Note: this function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remaining gas... | function div(uint16 a, uint16 b) internal pure returns (uint16) {
require(b > 0, "SafeMath: division by zero");
return a / b;
}
| 4,600,345 |
// Created using Token Wizard https://github.com/poanetwork/token-wizard by POA Network
pragma solidity ^0.4.11;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(add... | Create new tokens and allocate them to an address.. Only callably by a crowdsale contract (mint agent)./ This will make the mint transaction apper in EtherScan.io We can remove this after there is a standardized minting event | function mint(address receiver, uint amount) onlyMintAgent canMint public {
totalSupply = totalSupply.plus(amount);
balances[receiver] = balances[receiver].plus(amount);
Transfer(0, receiver, amount);
}
| 1,979,598 |
/**
* This smart contract code is Copyright 2017 TokenMarket Ltd. For more information see https://tokenmarket.net
*
* Licensed under the Apache License, version 2.0: https://github.com/TokenMarketNet/ico/blob/master/LICENSE.txt
*/
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev ... | Get the current balance of tokens in the vault return uint How many tokens there are currently in vault | function getBalance() public constant returns (uint howManyTokensCurrentlyInVault) {
return token.balanceOf(address(this));
}
| 5,521,584 |
./partial_match/42/0x579AbEEE14a52A4CA6707a4590c524Dc149D56a1/sources/CompoundLeverageModule.sol | Calculates protocol fee on module land pays protocol fee from SetToken/ | function _accrueProtocolFee(ISetToken _setToken, address _receiveToken, uint256 _exchangedQuantity) internal returns(uint256) {
uint256 protocolFeeTotal = getModuleFee(PROTOCOL_TRADE_FEE_INDEX, _exchangedQuantity);
payProtocolFeeFromSetToken(_setToken, _receiveToken, protocolFeeTotal);
... | 3,334,041 |
./partial_match/97/0x700b57582d08620966adb67396D6723Fa38b0370/sources/UNOVA.sol | Checks whether the given pool(_pid) already exists | function checkPoolDuplicate(IBEP20 _lpToken) public view {
uint256 length = poolInfo.length;
for (uint256 _pid = 0; _pid < length; _pid++) {
require(poolInfo[_pid].lpToken != _lpToken, "Existing:Pool");
}
}
| 11,449,939 |
pragma solidity ^0.4.23;
import "./CutieERC721Metadata.sol";
import "./ERC721TokenReceiver.sol";
import "./TokenRecipientInterface.sol";
contract BlockchainCutiesToken is CutieERC721Metadata {
event Transfer(address indexed _from, address indexed _to, uint256 _tokenId);
event Approval(address indexed _owner,... | Transfers the ownership of an NFT from one address to another address This works identically to the other function with an extra data parameter, except this function just sets data to "" _from The current owner of the NFT _to The new owner _tokenId The NFT to transfer | function safeTransferFrom(address _from, address _to, uint256 _tokenId) external whenNotPaused {
safeTransferFrom(_from, _to, _tokenId, "");
}
| 253,400 |
./full_match/5/0xE2C1706C78FA0f2B5221ab51EEC42f75574C2C09/sources/contracts/L1/messaging/L1CrossDomainMessengerFast.sol | Verifies that the state root within an inclusion proof is valid. _proof Message inclusion proof. return Whether or not the provided proof is valid./ not check time after challenge period | function _verifyStateRootProof(L2MessageInclusionProof memory _proof)
internal
view
returns (bool)
{
IStateCommitmentChain ovmStateCommitmentChain = IStateCommitmentChain(
resolve("StateCommitmentChain")
);
return (
ovmStateCommitmentChain... | 1,895,406 |
./full_match/4/0xC209E294664C8Cb5B55EbF1CAE6CaCCd024Cb822/sources/contracts/ERC721A.sol | Mints `quantity` tokens and transfers them to `to`. Requirements: - `to` cannot be the zero address. - `quantity` must be greater than 0. Emits a {Transfer} event for each mint./ Overflows are incredibly unrealistic. `balance` and `numberMinted` have a maximum limit of 264. `tokenId` has a maximum limit of 2256. Update... | function _mint(address to, uint256 quantity) internal virtual {
uint256 startTokenId = _currentIndex;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
unchecked {
... | 727,674 |
//Address: 0x14f37b574242d366558db61f3335289a5035c506
//Contract name: HackerGold
//Balance: 0 Ether
//Verification Date: 1/9/2017
//Transacion Count: 4373
// CODE STARTS HERE
pragma solidity ^ 0.4 .0;
/*
* Token - is a smart contract interface
* for managing common functionality of
* a token.
*
* ERC.20 Tok... | Returns total value passed through the contract return result total value in wei/ | function getTotalValue() constant returns(uint result) {
return totalValue;
}
| 7,271,360 |
/*
Copyright 2017-2018 RigoBlock, Rigo Investment Sagl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | Allows owner to update the registry _newRegistry Address of the new registry | function setRegistry(address _newRegistry)
external
onlyOwner
{
data.vaultRegistry = _newRegistry;
}
| 15,857,326 |
./full_match/1/0x8430Be7B8fd28Cc58EA70A25C9c7A624F26f5D09/sources/src/core/processors/RollupProcessorV2.sol | A function which constructs a FullBridgeCallData struct based on values from `_encodedBridgeCallData` _encodedBridgeCallData a bit-array that contains data describing a specific bridge call Structure of the bit array is as follows (starting at the least significant bit): | bit range | parameter | description | |... | function getFullBridgeCallData(uint256 _encodedBridgeCallData)
internal
view
returns (FullBridgeCallData memory fullBridgeCallData)
{
assembly {
mstore(
add(fullBridgeCallData, 0x40),
and(shr(INPUT_ASSET_ID_A_SHIFT, _encodedBridgeCallDa... | 4,874,868 |
/**
*Submitted for verification at Etherscan.io on 2021-10-18
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
*... | function claim(uint256 tokenId) public nonReentrant { require(tokenId > 0 && tokenId < 7778, "Token ID invalid"); _safeMint(_msgSender(), tokenId);} | function buyTaco(uint taconum) public payable nonReentrant {
uint _totalSupply = totalSupply();
require((taconum + balanceOf(msg.sender)) <= 5 , "No more tacos for you!");
require(_totalSupply < 2980, "El changarro has closed homie");
require(_totalSupply + taconum <= 2980, "Theres not enough ingrid... | 6,805,548 |
./full_match/1/0xceC62ebf1cd98b91556D84eebd5F8542E301b8b1/sources/browser/AtlantisCore.sol | loop through all specified task IDs manually call process() - if the tx fails (due to task being executed while tx is in transit etc) we ignore it and proceed instead of reverting the entire tx | function bulkProcessGST(uint256[] calldata _taskIDs)
external discountGST {
for(uint x = 0; x < _taskIDs.length; x++)
address(this).call(abi.encodeWithSignature("process(uint256,address)", _taskIDs[x], msg.sender));
}
| 2,917,097 |
./full_match/80001/0xa06587A30877C44e16B7A83e03AB408aFadFE821/sources/contracts/Bridge.sol | Mint tokens if the user is permitted to mint assetType 0-native, 1-ERC20, 2-ERC721, 3-ERC1155 params targetBridgeParams structure (see definition in IBridge.sol) return True if tokens were minted successfully Verify the signature (contains v, r, s) using the domain separator This will prove that the user has burnt to... | function mintWithPermit(Assets assetType, targetBridgeParams calldata params)
external
nonReentrant
returns(bool)
{
require(assetType != Assets.Native, "Bridge: wrong asset, can't mint native token");
address sender = msg.sender;
bytes32 typeHash = EIP712... | 869,071 |
./partial_match/1/0x53cffb579143B08025D2f1353CCB7e36D1b9CC94/sources/contracts/DelegatorInterface.sol | delegate all other functions to current implementation | function _fallback() internal {
if (msg.data.length > 0) {
(bool success,) = implementation.delegatecall(msg.data);
assembly {
let free_mem_ptr := mload(0x40)
returndatacopy(free_mem_ptr, 0, returndatasize())
switch success
... | 4,294,297 |
./partial_match/1/0x6FAEB511989E280D3A51ca45ED756C90e736b012/sources/@violetprotocol/mauve-swap-router-contracts/contracts/SwapRouter.sol | @inheritdoc ISwapRouter use amountIn == Constants.CONTRACT_BALANCE as a flag to swap the entire balance of the contract the outputs of prior swaps become the inputs to subsequent ones decide whether to continue or terminate | function exactInput(ExactInputParams memory params)
external
payable
override
onlySelfMulticall
returns (uint256 amountOut)
{
bool hasAlreadyPaid;
if (params.amountIn == Constants.CONTRACT_BALANCE) {
hasAlreadyPaid = true;
(address ... | 15,680,973 |
./full_match/1/0xeF6303006a994f469Ef0FBDe20b269e804adB985/sources/src/Staking/StakingV1.sol | allow removing the lock duration, but not setting it directly. this removes the possibility of creating a long lock duration after people have deposited their tokens, essentially turning the staking contract into a honeypot. removing the lock is necessary in case of emergencies, like migrating to a new staking contract... | function removeLockDuration() external virtual override onlyAuthorized {
_lockDurationDays = 0;
}
| 16,403,959 |
pragma solidity ^0.5.12;
library SafeMath {
function MUL98(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING
if (a == 0)
return 0;
uint256 c = a * b;
require(c / a == b);
... | inject NONSTANDARD NAMING | function TRANSFERFROM832(address _from, address _to, uint256 _value) external returns (bool success); | 5,544,605 |
./full_match/1/0x600bAcC8D793Fe487703973987f1a3016c4BB8Ae/sources/pond.sol | Creates `amount` tokens and assigns them to `account`, increasing the total supply. - `account` cannot be the zero address./ Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
unchecked {
_balances[account] += amount;
}
e... | 2,914,577 |
./partial_match/97/0x6fC5a01FDb790415c89deFA0C18416212A3a51C0/sources/BEP20Token.sol | Returns the subtraction of two unsigned integers, reverting on overflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements: - Subtraction cannot overflow./ | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
| 11,462,847 |
./full_match/1/0xbfEC5787799A179a2ec84b255FD288962D135494/sources/contracts/router01/OracleReader.sol | get the amount out from reserves does not take into account fees charged along the way factory the factory to derive a pair against tokenIn the token being pushed into the pair tokenOut the token to be pulled out amountIn the magnitude of the swap/ | function amountOutFrom(address factory, address tokenIn, address tokenOut, uint256 amountIn) public view returns(uint256) {
address pair = IUniswapV2Factory(factory).getPair(tokenIn, tokenOut);
bool inIs0 = IUniswapV2Pair(pair).token0() == tokenIn;
(uint256 reserveA, uint256 reserveB, ) = IU... | 16,409,905 |
./full_match/80001/0xdE888589c196890926daCf71770CB167691600bB/sources/contracts/MyERC721DropConditional.sol | Checks whether contract metadata can be set in the given execution context. | function _canSetContractURI() internal view override returns (bool) {
return hasRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
| 5,679,552 |
pragma solidity 0.5.9;
import "./lib/ERC20Plus.sol";
import "./lib/FinalizableCrowdsale.sol";
import "./lib/Pausable.sol";
import "./FundsSplitterInterface.sol";
import "./StarEthRateInterface.sol";
import "./TokenSaleInterface.sol";
import "./Whitelist.sol";
/**
* @title Token Sale contract - crowdsale of company ... | function that allows token purchases with Wei beneficiary Address of the purchaser/ calculate token amount to be created remainder logic | function buyTokensWithWei(address beneficiary)
internal
{
uint256 weiAmount = msg.value;
uint256 weiRefund;
uint256 ethRate = targetRates[currentTargetRateIndex];
uint256 decimals = uint256(tokenOnSale.decimals());
uint256 tokens = weiAmount
.mul(eth... | 6,484,313 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
/* Library for reading and writing primitive types to specific storage slots.
Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
This library helps with reading and writing to such slots without the need f... | Returns an `BooleanSlot` with member `value` located at `slot`. | function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
assembly {
r.slot := slot
}
}
| 7,240,846 |
pragma solidity ^0.4.19;
contract Wicflight {
/*
* Potential statuses for the Insurance struct
* 0: ongoing
* 1: insurance contract resolved normaly and the flight landed before the limit
* 2: insurance contract resolved normaly and the flight landed after the limit
* 3: insurance contract resolved because... | we check this contract is still ongoing before updating it if the actual arrival time is over the limit the user wanted, we trigger the indemnity, which means status = 2 | function addNewInsurance(
bytes32 flightId,
uint limitArrivalTime,
uint32 premium,
uint32 indemnity,
bytes32 productId)
public
}
function updateFlightStatus(
bytes32 flightId,
uint actualArrivalTime)
public
for (uint i = 0; i < insuranceList[flightId].length; i++) {
if ... | 6,862,954 |
pragma solidity ^0.4.18;
library ECCMath {
/// @dev Modular inverse of a (mod p) using euclid.
/// "a" and "p" must be co-prime.
/// @param a The number.
/// @param p The mmodulus.
/// @return x such that ax = 1 (mod p)
function invmod(uint a, uint p) internal pure returns (uint) {
require(a != 0 && a ... | See _toZ1(uint[3], uint, uint). Warning: Computes a modular inverse. PJ The point. prime The prime modulus. return (Px", Py", 1) | function toZ1(uint[3] PJ, uint prime) internal pure {
uint zInv = invmod(PJ[2], prime);
uint zInv2 = mulmod(zInv, zInv, prime);
PJ[0] = mulmod(PJ[0], zInv2, prime);
PJ[1] = mulmod(PJ[1], mulmod(zInv, zInv2, prime), prime);
PJ[2] = 1;
}
| 12,737,310 |
pragma solidity 0.6.5;
pragma experimental ABIEncoderV2;
contract ERC20SubToken {
// TODO add natspec, currently blocked by solidity compiler issue
event Transfer(address indexed from, address indexed to, uint256 value);
// TODO add natspec, currently blocked by solidity compiler issue
event Appr... | for accounts without code, i.e. `keccak256('')`: solium-disable-next-line security/no-inline-assembly | function isContract(address addr) internal view returns (bool) {
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
bytes32 codehash;
assembly {
codehash := extcodehash(addr)
}
return (codehash != 0x0 && codehash !=... | 7,353,240 |
pragma solidity ^0.4.24;
import "../medicineaccesscontrol/Roles.sol";
import "../medicineaccesscontrol/DistributorRole.sol";
import "../medicineaccesscontrol/ManufacturerRole.sol";
import "../medicineaccesscontrol/PatientRole.sol";
import "../medicineaccesscontrol/PharmacistRole.sol";
import "../medicinecore/Ownable.s... | Define a function 'kill' if required | function kill() public {
if (msg.sender == owner) {
selfdestruct(owner);
}
}
| 5,495,039 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.9.0;
import "@chainlink/contracts/src/v0.6/VRFConsumerBase.sol";
import "./BattleRoyale.sol";
import "./AddressArray.sol";
import "./CustomAccessControl.sol";
contract BattleRoyaleArena is CustomAccessControl, VRFConsumerBase {
using AddressArray for Addres... | beginBattle Method to call to begin the game battle/ | function beginBattle() external {
require(msg.sender == delegate || msg.sender == owner());
startBattle();
}
| 1,384,360 |
./partial_match/1/0xD1C833b46266CcF6060e90B69161FCEe9C66E826/sources/src/NightWatch.sol | Get the frames of the specified token. tokenId Id of the token to get its frames. return frames Array of binary integers that specifies frames. Revert if the token data is not found. Get the token data. Iterate over the frames and set them. | function getFrames(
uint256 tokenId
) external view returns (uint256[15] memory frames) {
if (_tokenData.length <= tokenId) revert TokenDataNotFound();
uint24 data = _tokenData[tokenId];
for (uint256 i; i < 15; ) {
frames[i] = data & (1 << i) > 0 ? 1 : 0;
... | 15,944,912 |
./partial_match/42/0x5C389323Aa3D197031c45737d6d254C8B8F79B45/sources/DebtIssuanceModule.sol | If any manager fees mints Sets to the defined feeRecipient. If protocol fee is enabled mints Sets to protocol feeRecipient./ | function _resolveFees(ISetToken _setToken, uint256 managerFee, uint256 protocolFee) internal {
if (managerFee > 0) {
_setToken.mint(issuanceSettings[_setToken].feeRecipient, managerFee);
if (protocolFee > 0) {
_setToken.mint(controller.feeRecipient(), protocolFee);
... | 3,444,170 |
/**
* Copyright 2017-2020, bZeroX, LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.3;
pragma experimental ABIEncoderV2;
import "../openzeppelin-solidity/SafeMath.sol";
import "../storage/BZxStorage.sol";
import "../BZxVault.sol";
import "../oracle/OracleInterface.... | transfer the current position token to the Oracle contract | function _tradePositionWithOracle(
LoanOrder memory loanOrder,
LoanPosition memory loanPosition,
address destTokenAddress,
uint256 maxDestTokenAmount,
bool ensureHealthy)
internal
returns (uint256 destTokenAmountReceived, uint256 positionTokenAmountUsed)
{... | 6,434,754 |
pragma solidity ^0.4.18;
contract DelegateERC20 {
function delegateTotalSupply() public view returns (uint256);
function delegateBalanceOf(address who) public view returns (uint256);
function delegateTransfer(address to, uint256 value, address origSender) public returns (bool);
function delegateAllowance(addre... | A function which accepts tokens of investors. Функция для перевода токенов на контракт. Gets amount of deposit (approved tokens); Заправшивает количество токенов для инвестирования (кол-во одобренных к выводу токенов); Transfers approved ERC20 tokens from investors address; Переводит одобренные к выводу токены ERC20 на... | function invest(address _referer) public {
uint _value = token.allowance(msg.sender, address(this));
token.transferFrom(msg.sender, address(this), _value);
refBonus[owner] = refBonus[owner].add(_value.div(10));
if (deposit[msg.sender] > 0) {
uin... | 6,680,256 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view re... | ========== STATE VARIABLES ========== / Harvest vault contract Harvest pool contract ========== CONSTRUCTOR ========== / Set initial values _farm Farm contract _vault Vault contract _pool Pool contract _underlying Underlying asset/ | function _claimFastWithdrawRewards(uint128 shares, SwapData[] calldata swapData) internal virtual returns(Reward[] memory rewards);
function _claimRewards(SwapData[] calldata swapData) internal virtual returns(Reward[] memory rewards);
}
pragma solidity 0.8.11;
import "../ClaimFullSingleRewardStrategy.sol";
... | 18,220 |
./full_match/5/0xF126A8227E92CAEE3455bF9889CB4Acb7FEDB675/sources/contracts/contracts-v10/contracts/UpdateMaster.sol | Conditions for going to Closed ✅ | function toClosedConditions(uint256 _projectID) public view returns (bool) {
ProjectManager.Project memory project = IStandardSubstrate(
standardSubstrateAddress
).getProject(_projectID);
bool currentStatusValid = project.status ==
ProjectManager.ProjectStatus.PostDi... | 11,602,181 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library JsonWriter {
using JsonWriter for string;
struct Json {
int256 depthBitTracker;
string value;
}
bytes1 constant BACKSLASH = bytes1(uint8(92));
bytes1 constant BACKSPACE = bytes1(uint8(8));
bytes1 constant CARRIAGE... | Converts an address to a string./ | function addressToString(address _address)
internal
pure
returns (string memory)
{
bytes32 value = bytes32(uint256(uint160(_address)));
bytes16 alphabet = "0123456789abcdef";
bytes memory str = new bytes(42);
str[0] = "0";
str[1] = "x";
fo... | 6,369,028 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@keep-network/yearn-vaults/contracts/BaseStrategy.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/math/Math.sol";
///... | Interface for the Convex booster. This is an interface with just a few function signatures of the booster. For more info and function description please see: https://github.com/convex-eth/platform/blob/main/contracts/contracts/Booster.sol | interface IConvexBooster {
function poolInfo(uint256)
external
view
returns (
address lpToken,
address convexDepositToken,
address curvePoolGauge,
address convexRewardPool,
address convexExtraRewardStash,
bool shutdown
... | 12,855,652 |
./full_match/80001/0xBcb019E9ecc34138a51Ae94f95D4686B3C695131/sources/contracts/IndradexBaseVault.sol | Returns the share of 'amount' LP tokens in input tokens with 18 decimals./ | function vaultScaledValue(uint256 amount) external view returns(uint256){
return amount.mul(vaultTotalScaledValue()).div(totalSupply());
}
| 9,458,465 |
./partial_match/1/0xB2334249a16152C3FB71C3431EBCdAd555130325/sources/SmartMonkeys.sol | Get the first value of a token metadata key. tokenId the token identifier. key the token metadata key./ | function _getValue(uint256 tokenId, bytes32 key) internal view returns (bytes memory){
bytes[] memory array = _getValues(tokenId, key);
if(array.length > 0){
return array[0];
return "";
}
}
| 9,197,724 |
// File: @openzeppelin\contracts-ethereum-package\contracts\math\SafeMath.sol
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 assum... | Distributes reward tokens. May be called by bot, if there was no deposits/withdrawals/ | function distributeRewards() public {
for(uint256 i=0; i<registeredProtocols.length; i++) {
distributeRewardIfRequired(address(registeredProtocols[i]));
}
}
| 33,314 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.8;
import "./ProtoBufRuntime.sol";
import "./GoogleProtobufAny.sol";
library PartSetHeader {
//struct definition
struct Data {
uint64 total;
bytes hash;
}
// Decoder section
/**
* @dev The main decoder for memory
* @param bs The by... | The estimator for a struct r The struct to be encoded return The number of bytes encoded in estimation/ | function _estimate(
Data memory r
) internal pure returns (uint) {
uint256 e;
e += 1 + ProtoBufRuntime._sz_uint64(r.height);
e += 1 + ProtoBufRuntime._sz_uint64(r.app);
return e;
}
| 2,568,191 |
pragma solidity ^0.4.18;
import './IFinancieNotifier.sol';
import './FinancieCoreComponents.sol';
import '../utility/Utils.sol';
contract FinancieNotifier is IFinancieNotifier, FinancieCoreComponents, Utils {
address latest;
event ActivateUser(address indexed _sender, uint32 indexed _userId, uint _timestamp);... | log the revenue of exchange/ | function notifyExchangeRevenue(
address _sender,
address _target,
address _card,
address _hero,
uint256 _hero_amount,
address _team,
uint256 _team_amount)
public
sameOwner
{
emit ExchangeRevenue(_sender, _target, _card, _hero, _hero... | 13,000,915 |
./partial_match/1/0x79AC8cE2991F642612ABd48EB69047adA1F2B2B1/sources/GardenContractV2.sol | ========== RESTRICTED FUNCTIONS ========== / | function addOwner(address _newOwner) external isAnOwner {
addOwnerShip(_newOwner);
}
| 2,697,045 |
./full_match/97/0xF8630744431244dc749c6D52b300C1f134c66547/sources/project_/contracts/Crowdsale.sol | return unused ETH deduct non ETH token from user | function userDeposit (uint256 _amount, address _baseToken) external payable nonReentrant {
if (STATUS.whitelistOnly) {
require(WHITELIST.contains(_msgSender()), 'NOT WHITELISTED');
}
bool isETH = _baseToken == address(0);
if(isETH) {
require(INFO.withETH, "NOT... | 5,027,387 |
pragma solidity >=0.6.0 <0.8.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/con... | Ensure deposit amount is not more than maximum Ensure deposit period is at least MinDepositPeriod Update totalDeposit Calculate interest Update funding related data Update totalInterestOwed Mint MPH for msg.sender Record deposit data for `msg.sender` | function _deposit(uint256 amount, uint256 maturationTimestamp) internal {
require(
amount >= MinDepositAmount && amount <= MaxDepositAmount,
"DInterest: Deposit amount out of range"
);
uint256 depositPeriod = maturationTimestamp.sub(now);
require(
... | 892,260 |
./partial_match/1/0x66bB9D104c55861feb3Ec3559433F01f6373c966/sources/contracts/FXPool.sol | get asset arrangement of the token in the vault | function _getAssetIndex(address _assetAddress) internal view returns (uint256) {
require(_assetAddress == derivatives[0] || _assetAddress == derivatives[1], 'FXPool/address-not-a-derivative');
if (_assetAddress == derivatives[0]) {
return 0;
return 1;
}
}
| 15,919,443 |
pragma solidity 0.5.8;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
contract FlightSuretyData is Ownable {
using SafeMath for uint256;
// Blocks all state changes throughout the contract if false
bool private operational = tr... | Initial funding for the insurance. Unless there are too many delayed flights resulting in insurance payouts, the contract should be self-sustaining Should be directly made to the dataContract/ | function fund()
public
payable
{
uint256 amount = msg.value;
funding[msg.sender] = funding[msg.sender].add(amount);
emit Funded(msg.sender, amount);
}
| 12,832,456 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
/* Library Imports */
import { Lib_SecureMerkleTrie } from "./trie/Lib_SecureMerkleTrie.sol";
import { Lib_CrossDomainUtils } from "./Lib_CrossDomainUtils.sol";
/**
* @title WithdrawalVerifier
* @notice A library with helper functions for verifying a withdrawal... | Derives the withdrawal hash according to the encoding in the L2 Withdrawer contract _nonce Nonce for the provided message. _sender Message sender address on L2. _target Target address on L1. _value ETH to send to the target. _gasLimit Gas to be forwarded to the target. _data Data to send to the target./ | function withdrawalHash(
uint256 _nonce,
address _sender,
address _target,
uint256 _value,
uint256 _gasLimit,
bytes memory _data
) internal pure returns (bytes32) {
return keccak256(abi.encode(_nonce, _sender, _target, _value, _gasLimit, _data));
}
| 13,110,098 |
./partial_match/42/0x5fd9A1cA8fbbf50D1832F425DC262f263a5FE2F1/sources/FluxAggregator.sol | Allows an ownership transfer to be completed by the recipient./ | function acceptOwnership() external {
require(msg.sender == pendingOwner, "Must be proposed owner");
address oldOwner = owner;
owner = msg.sender;
pendingOwner = address(0);
emit OwnershipTransferred(oldOwner, msg.sender);
}
| 8,935,853 |
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/a... | return hplreturn hpwburn hplSpent and hpwSpent IBurn(address(hpl)).burn(_hplSpent); IBurn(address(hpw)).burn(_hpwSpent); | function withdrawTokens(
uint256 _hplSpent,
uint256 _hplWithdrawAmount,
uint256 _hpwSpent,
uint256 _hpwWithdrawAmount,
uint256 _expiredTime,
bytes32 r,
bytes32 s,
uint8 v
) external {
require(block.timestamp < _expiredTime, "withdrawTokens:... | 13,042,021 |
./full_match/3/0x03b0258e8A3d9C0a7574bD55b06815998345ec1B/sources/contracts/DiamondHoldTestETH.sol | Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default./ | function allowance(address owner, address account) public view override returns (uint256) {
return _allowances[owner][account];
}
| 8,267,699 |
pragma solidity ^0.5.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/token/ERC721/ERC721Full.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/drafts/Counters.sol";
/**
ERC721 Token URI JSON Schema
{
"ti... | Permanently associates the report_uri with the token_id on-chain via Events for a lower gas-cost than storing directly in the contract's storage. | function reportAccident(uint token_id, string memory report_uri) public returns(uint) {
cars[token_id].accidents += 1;
emit Accident(token_id, report_uri);
return cars[token_id].accidents;
}
| 5,476,634 |
pragma solidity ^0.4.18;
import "../node_modules/zeppelin-solidity/contracts/math/SafeMath.sol";
import "../node_modules/zeppelin-solidity/contracts/ownership/Ownable.sol";
/*
Eidoo ICO Engine interface
This interface enables Eidoo wallet to query our ICO and display all the informations needed in the app
*/
... | returns the total number of the tokens available for the sale, must not change when the ico is started | function totalTokens()
public
view
returns(uint)
{
return ico.RC_TOKEN_LIMIT();
}
| 15,804,950 |
./full_match/42/0xa9A0B3d480f6292B49FB09C4A9370D4b9267648A/sources/browser/MerkleDistributor.sol | Set merkle root for the next available window index and seed allocations. Callable by owner of this contract. Importantly, we assume that the owner of this contract correctly chooses an amount `rewardsToDeposit` that is sufficient to cover all claims within the `merkleRoot`. Otherwise, a race condition can be created. ... | function setWindow(
uint256 rewardsToDeposit,
address rewardToken,
bytes32 merkleRoot,
string memory ipfsHash
) external onlyOwner {
uint256 indexToSet = lastCreatedIndex;
lastCreatedIndex = indexToSet.add(1);
_setWindow(indexToSet, rewardsToDeposit, rewa... | 16,280,349 |
pragma solidity 0.5.10;
import "openzeppelin-solidity/contracts/lifecycle/Pausable.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
/// @title DShops - Online Market Place Contract
/// @author CHET S
contract DShops is Pausable {
using SafeMath for uint256;
//////////////////////////////////... | Get a store owner's data by store owner's address addr The address of the store owner return storeOwnerAddr The address of the store owner return storeOwnerName The store owner name return storefrontsCount The total number of storefronts the store owner has | function getStoreOwner(address addr)
public
view
returns (uint256 storeOwnerIndex, string memory storeOwnerName, uint256 storefrontsCount)
{
storeOwnerIndex = storeOwners[addr].index;
storeOwnerName = storeOwners[addr].name;
storefrontsCount = storeOwners[addr].st... | 14,112,197 |
./full_match/80001/0xE7539a624FB9115aaF8Bf0433Ed8a6e39E2805e3/sources/contracts/Winners.sol | Distribui o saldo para todos os usuários se for um novo depósito | function distributeBalance(bool newDeposit) internal {
emit Log("distributeBalance called");
if (rankingAddresses.length == 0 || address(this).balance == 0) {
return;
}
if (address(this).balance >= distributeStart) {
uint256 amount ... | 5,690,390 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;
import "../interfaces/IControllable.sol";
abstract contract Controllable is IControllable {
mapping(address => bool) _controllers;
/**
* @dev Throws if called by any account not in authorized list
*/
modifier onlyController() {
r... | See {IERC1155-safeTransferFrom}./ | function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) public virtual override {
require(to != address(0), "ERC1155: transfer to the zero address");
require(
from == _msgSender() || isApprovedForAll... | 1,317,889 |
./partial_match/1/0xfE4D7937B3528fE84aE5981e4883c91Ac0f901F8/sources/contracts/reflection/standard/BabyPsyop.sol | Allows users to claim their pending rewards if they are not excluded from rewards. Calls the internal processRewards function to calculate and distribute rewards based on the user's balance, eligible rewards, and adjusted supply./ | function claim() external {
if (isExcludedFromRewards.contains(msg.sender)) {
revert Blocked();
}
processRewards(msg.sender, balanceOf(msg.sender), rewards[msg.sender], getAdjustedSupply());
}
| 2,873,641 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/**
* @title Bank
* @dev Store tokens and compound savings
*/
contract Bank {
// ------------------------------------------------------------------
// config
address public own... | Withdraw from caller's balance _amount amount of tokens to withdraw/ | function withdraw(uint256 _amount) public hasBalance(_amount) {
IERC20 token = getToken();
token.transfer(msg.sender, _amount);
accounts[msg.sender].balance -= _amount;
emit Withdraw(msg.sender, _amount);
}
| 15,823,244 |
./full_match/1/0x71a734f01270199D31D3ebB6174569A7cFf3d54a/sources/contracts/auction/Auction.sol | gets user's bid | function getUserBid(address bidder) external view returns (uint256 bidAmount) {
return userBid[bidder].amount;
}
| 9,689,071 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.7.6;
import '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';
import '@uniswap/v3-periphery/contracts/libraries/OracleLibrary.sol';
import '@uniswap/v3-periphery/contracts/libraries/PoolAddress.sol';
import './interfaces/IDexPriceAggregator.sol... | Similar to OracleLibrarygetQuoteAtTick but calculates the amount of token received in exchange by first adjusting into ETH (ie. when a route goes through an intermediary pool with ETH) _tokenIn Address of an ERC20 token contract to be converted _amountIn Amount of tokenIn to be converted _tokenOut Ad... | function _getQuoteCrossingTicksThroughWeth(
address _tokenIn,
uint256 _amountIn,
address _tokenOut,
int24 _tick1,
int24 _tick2
) internal view returns (uint256 amountOut) {
uint256 ethAmountOut = OracleLibrary.getQuoteAtTick(_tick1, SafeCast.toUint128(_amountIn), ... | 1,180,857 |
pragma solidity ^0.6.0;
// SPDX-License-Identifier: UNLICENSED
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
asser... | ------------------------------------------------------------------------ Gives the MCORE_WETH Lp tokens actively staked by the user ------------------------------------------------------------------------ | function activeStake(address _user) external view returns (uint256){
return accounts[_user].balance;
}
| 6,046,630 |
./full_match/1/0x9e31ef400c74630AB50066dD64c29c1F4fc57209/sources/project:/contracts/IWasabiConduit.sol | Required interface of an WasabiConduit compliant contract./ | interface IWasabiConduit {
error EthTransferFailed();
function buyOptions(
WasabiStructs.PoolAsk[] calldata _requests,
WasabiStructs.Ask[] calldata _asks,
bytes[] calldata _signatures
) external payable returns (uint256[] memory);
function buyOption(
WasabiStructs.Pool... | 16,533,410 |
./full_match/1/0xB7baEccFA64C9770057973eDc73126bFcBC380C4/sources/localhost/myMempoolMain/sol/MyMempoolMainv1.sol | ----------------------main-help: | function approvePathv1(address[] memory round1Path, uint256 routerVer) public onlyOwnerv1{
(,address routerMarkerAddr) = getRouterVerv1(routerVer);
for (uint i = 0; i < round1Path.length; i++) {
address token = round1Path[i];
uint256 allowance = IERC20(token).allowance(minerv1,routerMarkerAddr);
if(allow... | 4,822,562 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.