file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/1/0x3F72e21F54811Ff15bd26AdC0021DaE7512820Eb/sources/src/ProtocolRegistry.sol | setSignerAddress _signer address of the webacy signer return address of signer/ | function setSignerAddress(address _signer) external onlyOwner returns (address) {
_addresses[SIGNER_ADDRESS] = _signer;
return _signer;
}
| 16,450,917 |
/*
Copyright 2019-2020 eMobilify GmbH
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | the oracle can transfer tokens to any address sender is the address in the child chain for which the tokens were burned recipient is the address which will get the tokens on the parent chain/ compute the hash of the parameters to avoid double execution | function transfer(address from, address to, uint256 amount, address token, uint256 nonce, uint8 v, bytes32 r, bytes32 s)
public {
bytes32 paramHash = keccak256(abi.encodePacked(from, to, amount, token, nonce));
verifySignature(paramHash, v, r, s, oracle);
IERC20(token).transfer(to, amou... | 12,999,446 |
pragma solidity ^0.4.16;
/*
* Abstract Token Smart Contract. Copyright © 2017 by ABDK Consulting.
* Author: Mikhail Vladimirov <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="573a3e3c3f363e3b79213b36333e3a3e25382117303a363e3b7934383a">[email protected]</a>>
*/
pragma solidity ^0... | Address of the owner of this smart contract./ Total number of tokens in circulation./ True if tokens transfers are currently frozen, false otherwise./ Create new Social Media Market token smart contract, with given number of tokens issued and given to msg.sender, and make msg.sender the owner of this smart contract. _... | function SocialMediaMarketToken (uint256 _tokenCount) public {
owner = msg.sender;
tokenCount = _tokenCount;
accounts [msg.sender] = _tokenCount;
}
| 6,681,488 |
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.11;
pragma experimental ABIEncoderV2;
// ============ External Imports ============
import {TypedMemView} from "@summa-tx/memview-sol/contracts/TypedMemView.sol";
library GovernanceMessage {
using TypedMemView for bytes;
using TypedMemView fo... | Types.TransferGovernor | function governor(bytes29 _view) internal pure returns (bytes32) {
return _view.index(5, 32);
}
| 5,393,940 |
pragma solidity ^0.4.24;
/// @title ERC-721 Non-Fungible Token Standard
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
/// Note: the ERC-165 identifier for this interface is 0x80ac58cd.
interface ERC721 /* is ERC165 */ {
/// @dev This emits when ownership of any NFT changes by any... | Add an link to the update the recipient had made recipientId The issuer of the update updateId unique id of the update/ | function addRecipientUpdate(bytes32 recipientId, bytes32 updateId)
onlyWhenNotPaused
recipientExists(recipientId)
onlyByWeTrustOrRecipient(recipientId)
public
{
recipientUpdates[recipientId].push(Update(updateId, now));
emit RecipientUpdate(recipientId, updateId);... | 2,559,329 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
// Openzeppelin.
import "./openzeppelin-solidity/contracts/SafeMath.sol";
import "./openzeppelin-solidity/contracts/Ownable.sol";
import "./openzeppelin-solidity/contracts/ReentrancyGuard.sol";
import "./openzeppelin-solidity/contracts/ERC20/SafeERC20.sol";
// ... | Updates the max fee increase. Only the KeeperRegistry's owner can call this function. _newLimit The new max fee increase (in TGEN)./ | function updateMaxFeeIncrease(uint256 _newLimit) external onlyOwner {
MAX_FEE_INCREASE = _newLimit;
emit UpdatedMaxFeeIncrease(_newLimit);
}
| 12,595,863 |
./full_match/7701/0x2C1d33c95FB44dCc01764A19fE318309309EE261/sources/contracts/callpaths/MicroPaths.sol | Mints liquidity from an ambient liquidity position on a single curve. price The price of the curve. Represented as the square root of the exchange rate in Q64.64 fixed point seed The ambient liquidity seeds in the current curve. conc The active in-range concentrated liquidity in the current curve. seed... | function mintAmbient (uint128 price, uint128 seed, uint128 conc,
uint64 seedGrowth, uint64 concGrowth,
uint128 liq, bytes32 poolHash)
public payable returns (int128 baseFlow, int128 quoteFlow, uint128 seedOut) {
CurveMath.CurveState memory curve;
... | 13,213,503 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../interfaces/IERC20WrappedGem.sol";
import "../interfaces/INFTGemMultiToken.sol";
import "../interfaces/INFTComplexGemPoolData.sol";
... | get pool balance (number of minted claims or gems) for given token pool, token type, for account/ | function getPoolTypeBalance(
address erc1155token,
address tokenPool,
INFTGemMultiToken.TokenType tokenType,
address account
) public view returns (uint256 tq) {
uint256[] memory ht = INFTGemMultiToken(erc1155token).heldTokens(
account
);
for (... | 5,506,571 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
import "./extensions/IERC1155MetadataURI.sol";
import "../utils/Address.sol";
import "../utils/Context.sol";
import "../utils/introspection/ERC165.sol";
/**
* @dev Implementation of the basic standard m... | Burns Volts voltsBurned The quantity of Volts being burned/ | function burnVolts(uint256 voltsBurned) external pausable {
_burnVolts(voltsBurned);
emit BurnVolts(msg.sender, voltsBurned);
}
| 1,217,819 |
./full_match/40/0x5680b3059b860d07A33B7A43d03D2E4dEdb226BB/sources/contracts/interfaces/IERC721Metadata.sol | ERC-721 Non-Fungible Token Standard, optional metadata extension/ | interface IERC721Metadata is IERC721 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function tokenURI(uint tokenId) external view returns (string memory);
pragma solidity 0.8.11;
} | 9,546,694 |
/**
*Submitted for verification at Etherscan.io on 2021-06-15
*/
// File: @openzeppelin/upgrades/contracts/Initializable.sol
pragma solidity >=0.4.24 <0.7.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `... | Allows owner (or permissioned user) of a control token to update its lever values Optionally accept a payment to increase speed of rendering priority check if sender is owner/approved of token OR if they're a permissioned controller for the token owner check if control exists get the control token reference check that ... | function useControlToken(
uint256 controlTokenId,
uint256[] calldata leverIds,
int256[] calldata newValues
) external payable {
require(
_isApprovedOrOwner(msg.sender, controlTokenId) ||
(permissionedControllers[ownerOf(controlTokenId)][
... | 2,041,808 |
pragma solidity ^0.5.0;
import "./AddressStorage.sol";
import "../interfaces/ILendingPoolAddressesProvider.sol";
contract LendingPoolAddressesProvider is ILendingPoolAddressesProvider, AddressStorage {
//events
event LendingPoolUpdated(address indexed newAddress);
event LendingPoolCoreUpdated(address ind... | TODO: add access control rules under DAO | function setLendingPoolConfigurator(address _configurator) public {
_setAddress(LENDING_POOL_CONFIGURATOR, _configurator);
emit LendingPoolConfiguratorUpdated(_configurator);
}
| 1,793,133 |
/**
*Submitted for verification at Etherscan.io on 2021-04-21
*/
// Sources flattened with hardhat v2.2.0 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/[email protected]
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
... | not external to allow bytes memory parameters | function approveAndCall(ITokenRecipient _spender,
uint256 _value,
bytes memory _extraData
) public returns (bool) {
if (approve(address(_spender), _value)) {
_spender.receiveApproval(msg.sender, _value, address(this), ... | 6,695,883 |
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';
import "@openzeppelin/contracts/security/Pausable.sol";
import "./Lioon.sol";
import "./STRIPES.sol";
import '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';
contract Safari i... | adds Zebra and Lions to the Safari and Pack account the address of the staker tokenIds the IDs of the Zebra and Lions to stake/ | function addManyToSafariAndPack(address account, uint16[] calldata tokenIds) external {
require(account == _msgSender() || _msgSender() == address(lioon), "DONT GIVE YOUR TOKENS AWAY");
for (uint i = 0; i < tokenIds.length; i++) {
require(lioon.ownerOf(tokenIds[i]) == _msgSender(), "AINT YO TOKEN");
... | 1,107,270 |
./full_match/137/0xCaE9155706073f2B952b0D695464A12847a03aE7/sources/to.sol | Calculate deposit tokens for a given amount of receipt tokens amount receipt tokens return deposit tokens/ | function getDepositTokensForShares(uint amount) public view returns (uint) {
if ((totalSupply() * totalDeposits) == 0) {
return 0;
}
return (amount * totalDeposits) / totalSupply();
}
| 3,752,826 |
//Address: 0x0b6f6e073a08ab8fd458527c47ed83982ff26851
//Contract name: VoteFactory
//Balance: 0 Ether
//Verification Date: 6/1/2017
//Transacion Count: 2
// CODE STARTS HERE
pragma solidity ^0.4.10;
contract VoteFactory {
address public owner;
uint public numPolls;
uint public nextEndTime;
Vote publ... | do not allow to start new vote if there's still something ongoing | function startNewVote(uint duration, string description) internal {
if (now <= nextEndTime)
throw;
nextEndTime = now + duration;
voteDescription[numPolls] = description;
startedNewVote(msg.sender, duration, description, ++numPolls);
}
| 13,139,237 |
pragma solidity 0.5.12;
import { Context } from "@openzeppelin/contracts/GSN/Context.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { IERC777 } from "@openzeppelin/contracts/token/ERC777/IERC777.sol";
import { IERC777Recipient } from "@openzeppelin/contracts/token/ERC777/IERC777R... | Call from.tokensToSend() if the interface is registered operator address operator requesting the transfer from address token holder address to address recipient address amount uint256 amount of tokens to transfer userData bytes extra information provided by the token holder (if any) operatorData bytes extra infor... | function _callTokensToSend(address operator, address from, address to, uint256 amount, bytes memory userData, bytes memory operatorData) private {
address implementer = _erc1820.getInterfaceImplementer(from, TOKENS_SENDER_INTERFACE_HASH);
if (implementer != address(0)) {
IERC777Sender(implementer).tokensToSend(... | 2,521,567 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.10;
import {IDepositZap} from "../../interfaces/curve/IDepositZap.sol";
import {IERC20Detailed} from "../../interfaces/IERC20Detailed.sol";
import {ICurveDeposit_4token} from "../../interfaces/curve/ICurveDeposit_4token.sol";
import {ConvexFactoryMetaPoolStrat... | curve N_COINS for the pool curve sBTC deposit zap return size of the curve deposit array | function _curveUnderlyingsSize() internal pure override returns (uint256) {
return CURVE_UNDERLYINGS_SIZE;
}
| 532,813 |
pragma solidity =0.5.16;
pragma experimental ABIEncoderV2;
/**
* ______ ____ __ ______
* / ____/____ _ ____ ___ ___ / __ \ ___ ____ _ ____/ /___ _____ / ____/____ _____
* / / __ / __ `// __ `__ \ / _ \ / /_/ // _ \ / __ `// __ // _ \... | Returns player info @ `playerSerial`./ | function playerAt(uint256 playerSerial)
public
view
returns (
bytes memory name,
bytes memory adviserName,
address payable account,
address payable adviser,
uint256 messageCounter,
uint256 cookieCounter,
uint... | 12,693,102 |
/**
*Submitted for verification at Etherscan.io on 2021-12-07
*/
// Sources flattened with hardhat v2.1.1 https://hardhat.org
// File contracts/Dependencies/CheckContract.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
contract CheckContract {
/**
* Check that the account is an already deplo... | Otherwise, standard transfer functionality | function transfer(address recipient, uint256 amount) external override returns (bool) {
_requireValidRecipient(recipient);
_transfer(msg.sender, recipient, amount);
return true;
}
| 10,627,607 |
/**
*Submitted for verification at Etherscan.io on 2021-04-17
*/
// File: contracts\interfaces\ISaffronBase.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.1;
interface ISaffronBase {
enum Tranche {S, AA, A}
enum LPTokenType {dsec, principal}
// Store values (balances, dsec, vdsec) with TrancheUint... | LP user adds liquidity to the pool Pre-requisite (front-end): have user approve transfer on front-end to base asset using our contract address if (tranche == Tranche.AA) {} v1: AA tranche disabled (S tranche is effectively AA) Find capacity for S tranche to facilitate a deposit into A. Deposit is min(principal, capaci... | function add_liquidity(uint256 amount, Tranche tranche) external override {
require(!_shutdown, "pool shutdown");
require(tranche == Tranche.S || tranche == Tranche.A, "v1: can't add_liquidity into AA tranche");
uint256 epoch = get_current_epoch();
require(amount != 0, "can't add 0");
require(epoc... | 8,057,062 |
./full_match/80001/0xaE4f334860d10B1893D7E66aA60b2f6Ab1361c55/sources/project_/contracts/auction/base/AuctionBase.sol | @inheritdoc IAuctionBase | function setUniverseAuctionConfig(
uint256 universeId,
uint256 minIncreasePercentage,
uint256 time2Extend,
uint256 extendableBy
) external onlyOwner {
AuctionConfig memory oldConfig = _universeAuctionConfig[universeId];
_universeAuctionConfig[universeId] = _creat... | 5,662,990 |
pragma solidity ^0.4.23;
import "./EthStoreAdministrator.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
/** @title The EthStore store-owner-related functions */
contract EthStoreStoreOwner is EthStoreAdministrator {
/** @dev Check if the address has an enabled store.
*/
modifier onlyStoreO... | Add a product to the store of msg.sender. _name The name of the product. _description The description of the product. _imageUrl The image url of the product. _price The price of the product. _count The number of inventory./ | function addProduct(string _name, string _description, string _imageUrl, uint256 _price, uint256 _count) public onlyStoreOwner {
uint256 storeId = storeOwnerToStoreId[msg.sender];
Store storage store = stores[storeId.sub(1)];
uint256 productId = productCount.add(1);
storeIdToProductIds[store.id].push(... | 5,538,818 |
./full_match/1/0x66600c4f55527C410D4067b21474c0fa1fe1331D/sources/contracts/Collection.sol | @inheritdoc IERC165 ERC165 checks return true for: ERC165, ERC721, and ERC2981. | function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC721, IERC165)
returns (bool)
{
return
interfaceId == type(IERC2981).interfaceId ||
super.supportsInterface(interfaceId);
}
| 4,932,332 |
./full_match/1/0x249846ee9acfdCd7685EC7fd7AB02d536d343e3D/sources/contracts/dao/logic/GnarsDAOLogicV2.sol | Vetoes a proposal only if sender is the vetoer and the proposal has not been executed. proposalId The id of the proposal to veto/ | function veto(uint256 proposalId) external {
if (vetoer == address(0)) {
revert VetoerBurned();
}
if (msg.sender != vetoer) {
revert VetoerOnly();
}
if (state(proposalId) == ProposalState.Executed) {
revert CantVetoExecutedProposal();
... | 9,673,244 |
// This file is MIT Licensed.
//
// Copyright 2017 Christian Reitwiessner
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, cop... | Convenience method for a pairing check for two pairs. | function pairingProd2(G1Point a1, G2Point a2, G1Point b1, G2Point b2) internal returns (bool) {
G1Point[] memory p1 = new G1Point[](2);
G2Point[] memory p2 = new G2Point[](2);
p1[0] = a1;
p1[1] = b1;
p2[0] = a2;
p2[1] = b2;
return pairing(p1, p2);
}
| 940,246 |
./full_match/97/0x7A108372A2573c43C0Ccc14A47d15eE04A9AF12F/sources/project_/contracts/diamond/facets/TradingCheckerFacet.sol | price qty 10^18 / 10^(8+10) = price qty The notional value must be greater than or equal to the minimum notional value allowed The notional value of the position must be less than or equal to the maximum notional value allowed by pair marginUsd = amountInUsd - openFeeUsd - executionFeeUsd leverage = notionalUsd / ma... | function openMarketTradeCheck(IBook.OpenDataInput calldata data) external view override {
_checkParameters(data);
IVault.MarginToken memory token = IVault(address(this)).getTokenForTrading(data.tokenIn);
require(token.token != address(0) && token.asMargin, "TradingCheckerFacet: This token i... | 3,290,994 |
/**
*Submitted for verification at Etherscan.io on 2021-08-27
*/
// 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
... | Mints `ennemyId` and transfers it to `to`. WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible Requirements: - `ennemyId` must not exist. - `to` cannot be the zero address. Emits a {Transfer} event./ | function _mint(address to, uint256 ennemyId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(ennemyId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, ennemyId);
_balances[to] += 1;
_owners[ennemyId]... | 1,204,837 |
/**
* Copyright 2017-2020, bZeroX, LLC <https://bzx.network/>. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its... | excludes staking by way of iBZRX | function stakeableByAsset(
address token,
address account)
public
view
returns (uint256)
{
uint256 walletBalance = IERC20(token).balanceOf(account);
uint256 stakedBalance = _balancesPerToken[token][account];
return walletBalance > stakedBalance ?... | 294,378 |
pragma solidity ^0.4.23;
contract LetsBreakThings {
address public creator;
address public creatorproxy;
// Fallback function
function deposit() public payable {
}
// constructor
constructor(address _proxy) public {
creator = msg.sender;
cr... | Emits details about the origin of a transaction. This includes sender and tx origin | function logSenderDetails() public view {
emit txSenderDetails(msg.sender, tx.origin);
}
| 6,473,534 |
./full_match/137/0x3ec2F4C46940BEf35af23C5951103197D2e7Ef1D/sources/mochi.sol | Minimal BentoBox vault interface. `token` is aliased as `address` from `IERC20` for simplicity. | interface IBentoBoxMinimal {
function registerProtocol() external;
function deposit(
address token_,
address from,
address to,
uint256 amount,
uint256 share
) external payable returns (uint256 amountOut, uint256 shareOut);
function withdraw(
address ... | 4,691,287 |
./full_match/80001/0x18E1B64AE7911f9E007A114D04aB85F24c1D3Af7/sources/contracts/Hospital.sol | Function to add a new hospital with name and address | function addHospital(string memory _name, address _hospitalAddress) public {
hospitals.push(HospitalInfo({
name: _name,
hospitalAddress: _hospitalAddress
}));
}
| 5,656,001 |
// /$$$$$$$$ /$$ /$$
// | $$_____/| $$ |__/
// | $$ | $$ /$$ /$$ /$$$$$$$ /$$ /$$ /$$ /$$$$$$/$$$$
// | $$$$$ | $$| $$ | $$ /$$_____/| $$| $$ | $$| $$_ $$_ $$
// | $$__/ | $$| $$ | $$| $$$$$$ | $$| $$ | $$| $$ ... | Public mint function to mint one token/ | function mintToken() external payable returns (uint256) {
require(publicBuyEnabled, "Public buy is not enabled yet");
require(_userMints[msg.sender] <= maxUserMints, "Already minted maximum");
uint256 mintPrice = isCollabPartner[_msgSender()] ? _collabPrice : _price;
require(msg.va... | 6,442,718 |
pragma solidity =0.6.12;
// SPDX-License-Identifier: MIT
interface YFIoneV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() ... | SWAP requires the initial amount to have already been sent to the first pair | function _swap(uint[] memory amounts, address[] memory path, address _to) internal virtual {
for (uint i; i < path.length - 1; i++) {
(address input, address output) = (path[i], path[i + 1]);
(address token0,) = YFIoneV2Library.sortTokens(input, output);
uint amountOut = ... | 14,651,080 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "./erc1363.sol";
import "./pausable.sol";
import "./managable.sol";
import "./vendorregistry.sol";
import "./imigratablewrappedasset.sol";
import "./imigratablevendorregistry.sol";
/// An ERC1363 (also ERC20) for wrapping MRX on the ethereum or BSC chai... | Get the maximum amount of tokens in satoshi that can currently be minted without exceeding the maximum supply. return The number of satoshi available before reaching the maximum supply. | function unusedSupply() public view virtual returns (uint256)
{
return maxSupply - totalSupply();
}
| 7,309,017 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.4.11;
contract SmartSwitch{
//用於紀錄開關訊息的結構(struct)
struct Switch{
address addr; //使用者的位址
uint endTime; //使用結束時間(UnixTime)
bool status; //當值為true時,可以使用服務
}
address public owner; //服務擁有者(owner)的位址
address public iot; /... | 變更status的函數到達使用結束時間就會被呼叫出來引數是switches的key值如果對應於目標index的Switch尚未設定的話,就停止處理若尚未到達使用結束時間的話,就停止處理更新status | function updateStatus(uint _index) public onlyIoT{
require(switches[_index].addr != 0);
require(now > switches[_index].endTime);
switches[_index].status = false;
}
| 12,576,961 |
./full_match/137/0xABBB4d0074C0361fBf7e07FD3d4d4e9cCCB9128f/sources/contracts/PrimexDNS/PrimexDNS.sol | @inheritdoc IPrimexDNS/ | function freezeBucket(string memory _bucket) external override onlyRole(EMERGENCY_ADMIN) {
_require(buckets[_bucket].currentStatus == Status.Active, Errors.BUCKET_ALREADY_FROZEN.selector);
buckets[_bucket].currentStatus = Status.Inactive;
emit BucketFrozen(buckets[_bucket].bucketAddress);
... | 4,668,684 |
pragma solidity >=0.4.22 <0.6.0;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) interna... | allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); | function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
... | 12,906,552 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "@paulrberg/contracts/math/PRBMath.sol";
import "./interfaces/IFundingCycles.sol";
import "./interfaces/IPrices.sol";
import "./abstract/TerminalUtility.sol";
/**
@notice Manage funding cycle configurations, accounting, and scheduling.
*/
contract Fu... | / Get a reference to the project's latest funding cycle. If there isn't one, theres also no standy funding cycle. Get the necessary properties for the latest funding cycle. There is no upcoming funding cycle if the latest funding cycle has already started. | function _standby(uint256 _projectId)
private
view
returns (uint256 fundingCycleId)
{
fundingCycleId = latestIdOf[_projectId];
if (fundingCycleId == 0) return 0;
FundingCycle memory _fundingCycle = _getStruct(fundingCycleId);
if (block.timestamp >= _fun... | 12,806,863 |
./partial_match/42220/0xfa532d5a8EEfE8cff823d1Dc86660a7EBBf3Ced0/sources/contracts/CarbonCreditRakeback.sol | Swaps a given GCO2 token between bundles targetBundle_ - The bundle where the GCO2 token should be bundled into token_ - The GCO2 token to swap amount_ - The amount of tokens to swap return The amount of tokens arriving in the bundle (after fee) | function swapBundle(CarbonCreditBundleToken targetBundle_, CarbonCreditToken token_, uint256 amount_) external returns (uint256) {
uint receivedAmount = _bundleAndTransfer(
targetBundle_,
token_,
_transferFromAndUnbundle(token_, amount_)
);
emit BundleSwa... | 3,495,353 |
// SPDX-License-Identifier: MIT
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 returns (uint256);
/**
* @dev Returns the amount o... | Anyone can enable trading after the LBP has been deployed and the start time has been reached. Trading must be enabled for the pool to work./ | function enableTrading() external {
require(poolConfig.deployed, "Pool has not been deployed yet");
require(poolConfig.startTime <= block.timestamp, "Trading can not be enabled yet");
lbp.setSwapEnabled(true);
emit SwapEnabled(true);
}
| 10,213,489 |
pragma solidity 0.4.24;
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint2... | Public function that allows users to determine the current price (in wei) per token return Current price per token in wei/ | function currentRate() public view returns (uint256) {
if (block.timestamp < firstBonusEnds)
{
return firstBonusRate;
}
else if (block.timestamp >= firstBonusEnds && block.timestamp < secondBonusEnds)
{
return secondBonusRate;
}
else
{
return normalRate;
}
}
| 98,350 |
./full_match/42/0xC52BaC9468482Ad3e15BEC6f371ebA7D8fC3b986/sources/contracts/factories/RewardFactory.sol | Create a virtual balance reward pool that mimicks the balance of a pool's main reward contract used for extra incentive tokens(ex. snx) as well as vebal fees _token address of the token _mainRewards address of the main reward pool contract _rewardPoolOwner address of the reward pool owner return address of the new ... | function createTokenRewards(
address _token,
address _mainRewards,
address _rewardPoolOwner
) external returns (address) {
if (msg.sender != operator && !rewardAccess[msg.sender]) {
revert Unauthorized();
}
emit VirtualBalanceRewardPoolCreated(address... | 9,587,534 |
pragma solidity ^0.4.21;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
retu... | Addition to StandardToken methods. Decrease the amount of tokens that an owner allowed to a spender and execute a call with the sent data. approve should be called when allowed[_spender] == 0. To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From... | function decreaseApproval(address _spender, uint _subtractedValue, bytes _data) public returns (bool) {
require(_spender != address(this));
super.decreaseApproval(_spender, _subtractedValue);
require(_spender.call(_data));
return true;
}
| 2,001,690 |
// SPDX-License-Identifier: DeFiat and Friends (Zeppelin, MIT...)
pragma solidity ^0.6.2;
import "./AnyStake_Constants.sol";
import "./AnyStake_Libraries.sol";
import "hardhat/console.sol";
//series of pool weighted by token price (using price oracles on chain)
contract AnyStake is AnyStakeBase, IAnyStake {
usin... | update pool total value locked vars calculate updated rewards | function massUpdatePools() public override onlyVault {
uint length = poolInfo.length;
totalValueLocked = 0;
for (uint256 pid = 0; pid < length; ++pid) {
uint256 price = getPrice(pid);
poolInfo[pid].valueLocked = IERC20(poolInfo[pid].stakedToken).balanceOf(address(thi... | 12,956,968 |
./full_match/43114/0xD46f991226ffA6e6eCe124c1bcD78285E1316D1c/sources/AlphaCompounderJoe.sol | function name() external view returns (string memory); | interface IWolfToken is IERC20 {
function mint(address, uint256) external;
function safe32(uint256, string memory errorMessage) external pure returns (uint32);
function getChainId() external pure returns (uint256);
}
| 4,500,337 |
./partial_match/1/0xda18f789a1D9AD33E891253660Fcf1332d236b29/sources/StrategyProxy.sol | Vote on a multiple gauges. Must be called by governance or voter. _gauges List of gauges to vote on. _weights List of weight to vote with. | function vote_many(address[] calldata _gauges, uint256[] calldata _weights) external {
require(msg.sender == governance || voters[msg.sender], "!voter");
require(_gauges.length == _weights.length, "!mismatch");
for(uint256 i = 0; i < _gauges.length; i++) {
_vote(_gauges[i], _weig... | 9,154,760 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "./compound/NftInterfaces.sol";
import "./compound/CToken.sol";
import "./libraries/FullMath.sol";
import "./nftx/INFTXVault.sol";
import "./UniswapV2PriceOracle.sol";
/**
* @title CNftPriceOracle
* @notice Price oracle for cNFT tokens.
* @dev A... | Returns the price of `token` in terms of `baseToken`, scaled up by the units of `baseToken`./ | function price(
address token,
address baseToken,
address factory
) external view returns (uint256) {
address pair = IUniswapV2Factory(factory).getPair(token, baseToken);
uint256 baseUnit = 10**uint256(ERC20(token).decimals());
return FullMath.mulDiv(token < baseT... | 1,141,771 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC20/SafeERC20.sol";
import "./ClaimConfig.sol";
import "./interfaces/ICoverPool.sol";
import "./interfaces/ICoverPoolFactory.sol";
import "./interfaces/IClaimManagement.sol";
/**
* @title Claim Management for claims filed for a COVER supported cover... | The times passed since the claim was filed has to be less than the max claim decision window | function _isDecisionWindowPassed(Claim memory claim) private view returns (bool) {
return block.timestamp - claim.filedTimestamp > maxClaimDecisionWindow;
}
| 11,690,126 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to th... | Withdraws all underlying assets belonging to the user | function withdrawAll() external {
withdraw(deposits[msg.sender]);
}
| 1,455 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
//
/**
* @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 returns (uint256);
/**
* @dev Returns the am... | Withdraw partial funds, normally used with a vault withdrawal | function withdraw(uint256 _amount) external {
require(msg.sender == controller, "!controller");
uint256 _balance = IERC20(want).balanceOf(address(this));
if (_balance < _amount) {
_amount = _withdrawSome(_amount.sub(_balance));
_amount = _amount.add(_balance);
... | 1,516,862 |
pragma solidity ^0.5.16;
// Inheritance
import "./PerpsV2MarketBase.sol";
/**
Mixin that implements NextPrice orders mechanism for the perps market.
The purpose of the mechanism is to allow reduced fees for trades that commit to next price instead
of current price. Specifically, this should serve funding rate arbi... | convenience view to access exchangeRates contract for methods that are not exposed via _exchangeCircuitBreaker() contract | function _exchangeRates() internal view returns (IExchangeRates) {
return IExchangeRates(_exchangeCircuitBreaker().exchangeRates());
}
| 967,634 |
./full_match/97/0x278F790FC5f1A7a438bca43253e02d40f7835e1e/sources/MakaContract.sol | solhint-disable-next-line no-inline-assembly | function isContract(address account) public view returns (bool) {
uint256 size;
return size > 0;
}
| 5,033,355 |
/**
*Submitted for verification at Etherscan.io on 2022-03-22
*/
/**
*Submitted for verification at Etherscan.io on 2021-12-13
*/
/**
Micro-Chain Capital: $MCC
- You buy on Ethereum, we farm on microple chains and return the profits to $MCC holders.
Tokenomics:
5% of each buy/sell goes to existing holders.
5% of e... | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint2... | 15,026,199 |
pragma solidity 0.4.24;
pragma experimental "v0.5.0";
pragma experimental ABIEncoderV2;
contract Transactions {
address owner;
uint256 timestamp;
event logTransaction(
address indexed owner,
uint256 indexed timestamp,
bytes32 indexed participantType,
bytes32 participantFNam... | Gives more detailed information about transaction _participantType Type of participant, e.g. freelancer, bank _participantFName First name of participant _participantLName Last name of participant _coins Amount of coins involved in transaction _cash Amount of cash involved in transaction _service Provided service... | function Transaction(
bytes32 _participantType,
bytes32 _participantFName,
bytes32 _participantLName,
uint256 _coins,
uint256 _cash,
bytes32 _service) external validTransaction returns (TransactionData)
{
TransactionsData[owner].participantType = _parti... | 13,139,652 |
pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the orig... | This function is called when user buy tokens. Only RefundVault contract stores the Ether user sent which forwarded from crowdsale contract. investor address The address who buy the token from crowdsale./ | function deposit(address investor) onlyOwner payable {
require(state == State.Active);
deposited[investor] = add(deposited[investor], msg.value);
}
event Transferred(address _to, uint _value);
| 1,015,754 |
pragma solidity 0.5.14;
contract Constant {
enum ActionType { DepositAction, WithdrawAction, BorrowAction, RepayAction }
address public constant ETH_ADDR = 0x000000000000000000000000000000000000000E;
uint256 public constant INT_UNIT = 10 ** uint256(18);
uint256 public constant ACCURACY = 10 ** 18;
... | If the account has never borrowed the token, return 0 As the last borrow block exists, the block is also a check point on index curve. | function getBorrowInterest(address _accountAddr, address _token) public view returns(uint256) {
AccountTokenLib.TokenInfo storage tokenInfo = accounts[_accountAddr].tokenInfos[_token];
uint256 lastBorrowBlock = tokenInfo.getLastBorrowBlock();
if (lastBorrowBlock == 0)
return 0;
... | 5,774,188 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;
import '@openzeppelin/contracts/math/Math.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import '@openzeppelin/contracts/utils/ReentrancyGuard.sol';
import './interfaces/IUniswapV2Pair.... | ========== Operator ========== / | function setRedemptions(address _treasury, bool isredeemable) external onlyOperator {
_isctrlRedeemable = isredeemable;
treasury = _treasury;
}
| 1,549,945 |
pragma solidity ^0.4.25;
pragma experimental ABIEncoderV2;
import "./Constant.sol";
import "./interface/IAuthCenter.sol";
import "./lib/UtilLib.sol";
import "./govAccount/AccountManager.sol";
import "./govAuth/AuthManager.sol";
import "./Account.sol";
import "./Identity.sol";
import "./storage/BytesMapLib.sol";
impo... | organizationManageraccountInformationUnderTheOrganizationtheEntireProjectGlobalListfungible asset management within the organizationNon-fungible asset management within the organizationassetsManagement | {
using Address2BytesMapLib for Address2BytesMapLib.Map;
using UtilLib for *;
using SignLib for bytes[];
Address2BytesMapLib.Map admins;
address[] accountList;
address project;
address[] fungibleAssetList;
address[] nonFungibleAssetList;
address[] assetPoolAddressList;
IAssetMan... | 12,881,380 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts@3.2.0/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts@3.2.0/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts@3.2.0/math/SafeMath.sol";
import "@openzeppelin/contracts@3.2.0/access/Ownable.sol";
import "./Meshco... | Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. | function add(uint256 _allocPoint, IERC20 _lpToken, uint256 _pooltype) external onlyOwner {
uint256 _len = poolInfo.length;
for(uint256 i = 0; i < _len; i++){
require(_lpToken != poolInfo[i].lpToken, "LPToken already exists");
}
massUpdatePools();
uint256 lastRew... | 13,112,090 |
./full_match/56/0x14Acd1f985446aF554a3AB45e70d7498ee60Ec25/sources/contracts/lib/IMasterApeV2.sol | validatePool(_pid); | function deposit(uint256 _pid, uint256 _amount) external; | 3,260,543 |
./partial_match/1/0x8D602692eE4b5f0ec33A22fe6547822377FDCc4c/sources/DssSpell.sol | Set the global debt ceiling 1,468,750,000 (DC after 11-13 spell executes) + 13 (YFI-A increase) Increase YFI debt ceiling to 20MM Set dust to 500 DAI | function execute() external {
address ILK_REGISTRY = CHANGELOG.getAddress("ILK_REGISTRY");
address MCD_VAT = CHANGELOG.getAddress("MCD_VAT");
VatAbstract(MCD_VAT).file("Line", 1_481_750_000 * RAD);
VatAbstract(MCD_VAT).file("YFI-A", "line", 20 * MILLION * RAD);
bytes3... | 9,274,845 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.10;
pragma experimental ABIEncoderV2; // not experimental anymore
import "@openzeppelin/contracts-ethereum-package/contracts/Initializable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contract... | Get the positions of a trader in a given pool. _pool The MarginLiquidityPool. _trader The trader. return The positions./ | function getPositionsByPoolAndTrader(MarginLiquidityPoolInterface _pool, address _trader) external view returns (Position[] memory) {
return positionsByPoolAndTrader[_pool][_trader];
}
| 7,323,911 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title Auction
*
* @dev This handles creating auctions for sale and siring of kitties.
*/
contract Auction is Breeding {
/**
* @dev Only CEO can sets the reference to the sale auction — for gen0 and p2p sale.
*
* @par... | This compute the next starting price./ This set the average price for gen0 auction based on the average from the past gen0 prices./ Ensure that the average price does not overflow./ This set the next price for gen0 auction to be 150% of the average price./ Ensure that auction price will not be lower than the defaul... | function _computeNextGen0Price() internal view returns (uint256) {
uint256 avePrice = saleAuction.averageGen0SalePrice();
require(avePrice == uint256(uint128(avePrice)));
uint256 nextPrice = (avePrice * 3 / 2);
i... | 5,540,087 |
./full_match/4/0x19F5CF38c2FA40D0CEa22bdD63c4389F78B0cFc5/sources/contracts/ANV_NFT_AUCTION_ADVANCED.sol | Gets the total number of auctions owned by an address _owner address of the owner return uint total number of auctions/ | function getAuctionsCountOfOwner(address _owner) public view returns(uint) {
return auctionOwner[_owner].length;
}
| 12,440,585 |
pragma solidity ^0.4.25;
/**
*
12HourTrains - 3% every 12 hours. Want to get quick ETH? Try our new Dice game.
https://12hourtrains.github.io/
Version 3
*/
contract TwelveHourTrains {
using SafeMath for uint256;
mapping(address => uint256) investments;
mapping(address => uint256) joined;
mapping(addr... | ---------------------------------------------------------------------------------- INTERNAL FUNCTION---------------------------------------------------------------------------------- | function getRandomNumber(address _addr) private returns(uint256 randomNumber)
{
randNonce++;
randomNumber = uint256(keccak256(abi.encodePacked(now, _addr, randNonce, block.coinbase, block.number))) % 3;
}
| 9,916,921 |
./partial_match/42/0xE5Ae4E49bEA485B5E5172EE6b1F99243cB15225c/sources/OracleRelayer.sol | Fetch the safety CRatio of a specific collateral type collateralType The collateral type we want the safety CRatio for/ | function safetyCRatio(bytes32 collateralType) public view returns (uint256) {
return collateralTypes[collateralType].safetyCRatio;
}
| 3,326,222 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
//
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since w... | The risk is determined by how early the ETH is staked and how much ETH. The risk is linearly decaying. Initial multiplier is x4. Get in early and you have a higher reward. | function getRisk(uint256 secondsPassed, uint256 ethAdded) private view returns(uint256) {
uint256 timeLeft = (maxWaitTime - secondsPassed) * 3;
if (secondsPassed > maxWaitTime) {
timeLeft = 0;
}
timeLeft += maxWaitTime;
return timeLeft * ethAdded;
}
| 11,986,557 |
// SPDX-License-Identifier: GPL-2.0-or-later
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Holdings, 2021
pragma solidity ^0.7.4;
pragma abicoder v2;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import {ERC2... | Updates voting power for contributor types _weightA - weight for contributors type A in PERCENTAGE format (1 = 10_000) _weightB - weight for contributors type B in PERCENTAGE format (1 = 10_000) _weightA should be always gte than _weightB and all of them less than 10_000 | function updateVotingWeights(uint256 _weightA, uint256 _weightB)
external
{
}
| 5,894,321 |
pragma solidity ^0.4.24;
import "./../../TransferManager/ITransferManager.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
/**
* @title Transfer Manager for limiting volume of tokens in a single trade
*/
contract SingleTradeVolumeRestrictionTM is ITransferManager {
using SafeMath for uint256;
... | Changes the manager to use transfer limit as Percentages _newGlobalTransferLimitInPercentage uint256 new global Transfer Limit In Percentage. specialTransferLimits set for wallets have to re-configured/ | function changeTransferLimitToPercentage(uint256 _newGlobalTransferLimitInPercentage) public withPerm(ADMIN) {
require(!isTransferLimitInPercentage, "Transfer limit already in percentage");
isTransferLimitInPercentage = true;
changeGlobalLimitInPercentage(_newGlobalTransferLimitInPercentage)... | 14,036,728 |
pragma solidity 0.5.0;
import "./SafeMath.sol";
import "./RewardContract.sol";
import "./Adbank.sol";
contract AdbankRewardClaimContract is RewardContract {
using SafeMath for uint256;
// Stop contract from executing it's main logic
bool public suspended;
// Limit the size of incoming requests (assi... | Change the requests limit | function setBatchLimit(uint8 newLimit) onlyOwner external {
require(newLimit > 0);
batchLimit = newLimit;
}
| 534,310 |
pragma solidity 0.6.0;
import "./Storage.sol";
import "../Safe/SafeMath.sol";
contract Alef is Storage {
using SafeMath for uint256;
constructor (address _daiContractAddress, address _cDaiContractAddress, address _cEthContractAddress) public {
// must set the 3 erc addresses
daiContractAddress = _dai... | enable a sponsor@-> require: _sponsor status == not active@-> emits: address enabled and action as string | function enableSponsor(address _address) public onlyOwner {
require (sponsors[_address].status == false,"already enabled");
sponsors[_address].status = true;
emit SponsorAction(_address, "enabled");
}
| 1,766,924 |
// contracts/StakedToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.10;
import "@openzeppelin/contracts-ethereum-package/contracts/Initializable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/utils/Pausable.... | index Index of transaction. Transaction ordering may have changed since adding. enabled True for enabled, false for disabled./ | function setTransactionEnabled(uint256 index, bool enabled) external onlySupplyController {
downstreamCaller.setTransactionEnabled(index, enabled);
}
| 6,362,938 |
pragma solidity ^0.5.8;
pragma experimental ABIEncoderV2;
contract DappChat {
struct ReplyMessage {
string message;
address sender;
string quotedReply;
uint blockTimestamp;
}
struct Channel {
address channelOwner;
string channelName;
string category... | need to render different css if sender is different than user | function quoteMessage(uint channelNumber, uint messageIndex, string memory message) public {
Channel storage currentChannel = allChannels[channelNumber];
ReplyMessage memory newReplyMessage = ReplyMessage({
message: message,
sender: currentChannel.messages[messageIndex].send... | 1,785,879 |
./full_match/8453/0xa05fAAF51546fB595ad937808DA76fb715F95Bf4/sources/contracts/libraries/Hashing.sol | Hashes a cross domain message based on the V0 (legacy) encoding. _target Address of the target of the message. _sender Address of the sender of the message. _data Data to send with the message. _nonce Message nonce. return Hashed cross domain message. | function hashCrossDomainMessageV0(
address _target,
address _sender,
bytes memory _data,
uint256 _nonce
) internal pure returns (bytes32) {
return keccak256(Encoding.encodeCrossDomainMessageV0(_target, _sender, _data, _nonce));
}
| 11,542,918 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
//
// This contract handles swapping to and from PlatinumNugget, LuckySwap's staking token.
cont... | update Gold Vein fees for this Smelter contract (`feeTo`) convert updated Gold Vein balance to Alp shares convert Alp shares to underlying Gold Vein asset (`token0`) balance (`amount0`) for Smelter | function _convert(IGoldVeinWithdrawFee goldveinPair) private {
goldveinPair.withdrawFees();
uint256 alpShares = goldveinPair.removeAsset(address(this), goldveinPair.balanceOf(address(this)));
address token0 = goldveinPair.asset();
(uint256 amount0, ) = alPine.withdraw(IERC20(token0... | 175,875 |
pragma solidity >=0.5.4 <0.6.0;
import './SafeMath.sol';
import './AOLibrary.sol';
import './TheAO.sol';
import './IAOEarning.sol';
import './IAOSetting.sol';
import './AOIon.sol';
import './INameFactory.sol';
import './Pathos.sol';
import './Ethos.sol';
import './IAOContent.sol';
import './IAOStakedContent.sol';
impo... | The AO sets setting TAO ID _settingTAOId The new setting TAO ID to set/ | function setSettingTAOId(address _settingTAOId) public onlyTheAO {
require (AOLibrary.isTAO(_settingTAOId));
settingTAOId = _settingTAOId;
}
| 927,592 |
pragma solidity ^0.4.2;
contract SpiceMembers {
enum MemberLevel { None, Member, Manager, Director }
struct Member {
uint id;
MemberLevel level;
bytes32 info;
}
mapping (address => Member) member;
address public owner;
mapping (uint => address) public memberAddress;
... | This is the main function implementing IPayoutCalculator | function calculatePayout(bytes32 _info, uint _duration) returns (uint) {
uint8 unpaid = unpaidPercentage(_info);
CalculatePayout(_info, _duration, hourlyRate, unpaid);
uint fullTimeOutput = _duration * hourlyRate / 3600;
return (fullTimeOutput * (100 - unpaid)) / 100;
}
| 12,594,573 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than ... | Allows the owner to set the minter contract. _minterAddr the minter address/ | function setMinter(address _minterAddr) public onlyOwner {
minterContract = Token(_minterAddr);
}
| 10,527,146 |
//Address: 0xda9f43015749056182352e9dc6d3ee0b6293d80a
//Contract name: EtherLambosCore
//Balance: 0 Ether
//Verification Date: 3/11/2018
//Transacion Count: 155
// CODE STARTS HERE
pragma solidity ^0.4.11;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization con... | Returns true if the NFT is on sale. _sale - Sale to check. | function _isOnSale(Sale storage _sale) internal view returns (bool) {
return (_sale.startedAt > 0);
}
| 6,354,652 |
// File: contracts/interfaces/IDelegable.sol
pragma solidity ^0.6.10;
interface IDelegable {
function ADDDELEGATE653(address) external; //inject NONSTANDARD NAMING
function ADDDELEGATEBYSIGNATURE882(address, address, uint, uint8, bytes32, byt... | inject NONSTANDARD NAMING | function UNLOCKED182() external view returns (uint); | 12,707,144 |
// File: contracts/access/IKOAccessControlsLookup.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
interface IKOAccessControlsLookup {
function hasAdminRole(address _address) external view returns (bool);
function isVerifiedArtist(uint256 _index, address _account, bytes32[] calldata _merkleProof) ... | If the reserve has been met, then bidding will end in 24 hours if we are near the end, we have bids, then extend the bidding end if a bid has been placed, then we will have a bidding end timestamp and we need to ensure no one can bid beyond this If bid received with in the extension window, extend bidding end if someon... | function _placeBidOnReserveAuction(uint256 _id, address _bidder) internal {
ReserveAuction storage reserveAuction = editionOrTokenWithReserveAuctions[_id];
require(reserveAuction.reservePrice > 0, "Not set up for reserve auction");
require(block.timestamp >= reserveAuction.startDate, "Not ac... | 1,180,689 |
./partial_match/97/0x8402D48cb879aBAAC4cdc3c59052D88F52B9490F/sources/HorseSwapPair.sol | this low-level function should be called from a contract which performs important safety checks | function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock {
require(amount0Out > 0 || amount1Out > 0, 'HorseSwap: INSUFFICIENT_OUTPUT_AMOUNT');
require(amount0Out < _reserve0 && amount1Out < _reserve1, 'HorseSwap: INSUFFICIENT_LIQUIDITY');
uint balance0;... | 11,385,685 |
./full_match/43113/0x6b3b82f82BC1A5D2c337ec38ACac3Ff6AF0e4013/sources/wtreats.sol | start community voting to set AuthOnly variables | function voteAuthOnly(bool enabled) external onlyOperator {
require(pendingVote == "", "One vote is still running!");
require(_authOnly != enabled, "AuthOnly is already set so!");
if(isOperator[vault]){
setAuthOnly(enabled);
return;
}
string memory vote... | 13,155,032 |
./full_match/1/0x6f9140097Ab6278B41Cf9597a597030207b8D75d/sources/lib/seaport-core/src/lib/GettersAndDerivers.sol | Internal view function to retrieve configuration information for this contract. return The contract version. return The domain separator for this contract. return The conduit Controller set for this contract./ Derive the domain separator. Declare variable as immutables cannot be accessed within assembly. Return th... | {
bytes32 domainSeparator = _domainSeparator();
address conduitController = address(_CONDUIT_CONTROLLER);
function _information()
internal
view
returns (string memory, /* version */ bytes32, /* domainSeparator */ address /* conduitController */ )
assembly {
... | 9,675,561 |
pragma solidity 0.4.24;
import "openzeppelin-solidity/contracts/lifecycle/Pausable.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "../interfaces/IModuleContract.sol";
import "../inheritables/TransferValidator.sol";
import "../interfaces/IERC20.sol";
/**
* @title Transfer Validator that chec... | Returns the maxAmount of the validator return uint/ | function maxAmount()
external
view
returns(uint)
{
return maxAmount_;
}
| 1,009,339 |
pragma solidity ^0.4.24;
import "./ownership/Ownable.sol";
import "./token/TalaoToken.sol";
import "./Foundation.sol";
import "./Workspace.sol";
/**
* @title WorkspaceFactory contract.
* @notice This contract can generate Workspaces and connect them with Foundation.
* @author Talao, Polynomial, Slowsense, Blockcha... | Create a Workspace contract./ Sender must have access to his Vault in the Token. Create contract. Add the email. @see https:github.com/ethereum/EIPs/issues/735issuecomment-450647097 Add an ECDSA ERC 725 key for initial owner with MANAGER purpose Remove this factory ERC 725 MANAGER key. Set initial owner in Foundation t... | function createWorkspace (
uint16 _category,
uint16 _asymetricEncryptionAlgorithm,
uint16 _symetricEncryptionAlgorithm,
bytes _asymetricEncryptionPublicKey,
bytes _symetricEncryptionEncryptedKey,
bytes _encryptedSecret,
bytes _email
)
external
... | 6,435,326 |
// 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... | the claim quantity (count of gems staked) for the given claim id/ | function claimQuantity(uint256 claimHash) external view override returns (uint256) {
return claimQuant[claimHash];
}
| 11,794,179 |
pragma solidity ^0.4.11;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(... | Batch token transfer. Used by contract creator to distribute initial tokens to holders / | function batchTransfer(address[] _recipients, uint[] _values) onlyOwner returns (bool) {
require( _recipients.length > 0 && _recipients.length == _values.length);
uint total = 0;
for(uint i = 0; i < _values.length; i++){
total = total.add(_values[i]);
}
require(t... | 2,029,403 |
pragma solidity ^0.4.18; // solhint-disable-line
/// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
/// @author Dieter Shirley <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="620607160722031a0b0d0f18070c4c010d">[email protected]</a>> (https://github.com/dete)
c... | For creating Scene Require Stars Exists | function _createScene(string _name, uint[] _stars,address _owner, uint256 _price) private {
require(_stars.length > 0);
for (uint i = 0; i < _stars.length; i++) {
address _pornstarOwner;
(_pornstarOwner) = pornstarsContract.ownerOf(_stars[i]);
require(_pornstarOwner != address(0) ... | 10,980,103 |
./full_match/2222/0xa9aF508A15fc3B75763A9e536505FFE1F884D12C/sources/contracts/interfaces/external/IERC1271.sol | Interface for verifying contract-based account signatures Interface that verifies provided signature for the data Interface defined by EIP-1271 | interface IERC1271 {
function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);
pragma solidity >=0.5.0;
} | 7,102,378 |
./partial_match/1/0x82895fE2945A8B19c5E511E5AA90Da3Aa27331eA/sources/CCPCyborgs.sol | Creates a `value` amount of tokens of type `id`, and assigns them to `to`. Emits a {TransferSingle} event. Requirements: - `to` cannot be the zero address. - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the acceptance magic value./ | function _mint(address to, uint256 id, uint256 value, bytes memory data) internal {
if (to == address(0)) {
revert ERC1155InvalidReceiver(address(0));
}
(uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value);
_updateWithAcceptanceCheck(address(0),... | 2,700,751 |
./full_match/80001/0x7F6Df5eC4e5cd460E3BBF354b3EbbceEc2949585/sources/masterchef.sol | Safe cnt transfer function, just in case if rounding error causes pool to not have enough CNTs. | function safeCNTTransfer(address _to, uint256 _amount) internal {
uint256 cntBal = cnt.balanceOf(address(this));
if (_amount > cntBal) {
cnt.transfer(_to, cntBal);
cnt.transfer(_to, _amount);
}
}
| 862,787 |
pragma solidity ^0.4.24;
/*
*__/\\\\____________/\\\\________________/\\\\____________/\\\\________/\\\\\\_____/\\\\\\___________________________________________________
* _\/\\\\\\________/\\\\\\_______________\/\\\\\\________/\\\\\\_______\////\\\____\////\\\___________________________________________________
*... | function for compute resource factory at time wrapper over _resourcesAtTime _factoryId id of factory return count of resources | function resourcesAtTime(uint256 _factoryId) public view returns(uint256) {
Factory storage factory = factories[_factoryId];
return _resourcesAtTime(factory.ftype, factory.level, factory.collected_at);
}
| 1,765,645 |
// to test issue with nodes breaking with large clients over WS
// fixed in web3 with fragmentationThreshold: 8192
pragma solidity ^0.4.17;
contract BigFreakingContract {
event Transfer(address indexed from, address indexed to, uint value);
event Approval( address indexed owner, address indexed spender, uint valu... | TODO: should increase instead | function approve_223(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,453,936 |
./full_match/80001/0x1F3826DE452f8aB78964c434997958Cb72cAb000/sources/_solidstate/contracts/token/ERC721/enumerable/ERC721Enumerable.sol | @inheritdoc IERC721Enumerable/ | function tokenOfOwnerByIndex(
address owner,
uint256 index
) public view returns (uint256) {
return _tokenOfOwnerByIndex(owner, index);
}
| 5,635,059 |
pragma solidity 0.4.25;
pragma experimental ABIEncoderV2;
import "./library/SafeMath.sol";
/**
* @dev validator committee interface
*/
interface Committee {
function startNewRound(address[] validatorAddresses, uint[] plannedBlocks, uint[] actualBlocks) external;
}
/**
* @dev Asimov MainNet runs Satoshi+ conse... | get signup validator addresses before starting new round btcAddresses string format of btc addresses/ signup round vs. mapped round | function getSignupValidators(string[] btcAddresses) public view returns(address[], uint[]) {
uint length = btcAddresses.length;
address[] memory mappedAddresses = new address[](length);
uint[] memory rounds = new uint[](length);
for (uint i = 0; i < length; i++) {
Mapped... | 12,849,475 |
./partial_match/4/0xC3FeaA0309Fd9C86d2aD7D7220D91c37d474C960/sources/VotingContract.sol | Возвращает имя победителя выборов/ | function winnerName() public view isBallotExist returns (string memory winnerName_) {
winnerName_ = ballots[ballots.length - 1].proposalsName[winningProposal()];
}
| 8,657,570 |
./full_match/1/0xcb081c2E32447cbDE6795A03dc4532569c5c2886/sources/contracts/contracts-BatchDepositWithKeyRegistry/BatchDepositWithKeyRegistry.sol | update KeyRegistry contract address, only owner can operator _newKeyRegistry new KeyRegistry contract address | function updateKeyRegistry(address _newKeyRegistry) public onlyOwner {
require(address(_newKeyRegistry) != address(0), "invalid new KeyRegistry address");
require(address(_newKeyRegistry) != address(keyRegistry), "KeyRegistry address repeat");
keyRegistry = _newKeyRegistry;
emit Upda... | 17,141,891 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
abstract contract Context {
function _msgSender() ... | exclude from paying fees or having max transaction amount | constructor() ERC20("BobaTea", "TEA") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUn... | 11,992,120 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.