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/0x4482c5929618b848a46E3DA830A3D71085A5DE07/sources/src/nft/ZoraCreator1155Impl.sol | If we still have no schedule, return 0 supply royalty. If we have no recipient set, return 0 supply royalty. | function _handleSupplyRoyalty(uint256 tokenId, uint256 mintAmount, bytes memory data) internal returns (uint256 totalRoyaltyMints) {
uint256 royaltyMintSchedule = royalties[tokenId].royaltyMintSchedule;
if (royaltyMintSchedule == 0) {
royaltyMintSchedule = royalties[CONTRACT_BASE_ID].roy... | 16,490,090 |
./full_match/1/0xAD97639b0a94549E9391C20D5cAD0d52be96A383/sources/browser/ntrump.sol | dai to ntrumpdecimal changes make this harder. 1e21 = 18 + 18 - 15return(true,false);decimal changes make this harder. 1e21 = 18 + 18 - 15return(false, true); | function sellOrBuy() public view returns (bool _buy, bool _sell){
uint256 weightD = bpool.getDenormalizedWeight(address(want));
uint256 weightN = bpool.getDenormalizedWeight(address(ntrump));
uint256 balanceD = bpool.getBalance(address(want));
uint256 balanceN = bpool.getBalance(addr... | 17,138,855 |
pragma solidity ^0.5.0;
/**
* @title Elliptic curve signature operations
* @dev Based on https://gist.github.com/axic/5b33912c6f61ae6fd96d6c4a47afde6d
* TODO Remove this library once solidity supports passing a signature to ecrecover.
* See https://github.com/ethereum/solidity/issues/864
*/
library ECDSA {
/... | Calculate Exchange TypeHash | function hashExchange(Exchange memory exchange) private view returns (bytes32) {
return keccak256(
abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR, keccak256(abi.encode(EXCHANGE_TYPEHASH, exchange.sender, exchange.amount, exchange.key)))
);
}
| 7,301,892 |
pragma solidity ^0.5.0;
import 'openzeppelin-solidity/contracts/ownership/Ownable.sol';
/// @title A contract to store proof of documents and verify their existence
/// @author John H. Yu
/// @notice This is an assignment from ConsenSys Academy Blockchain Developer Bootcamp Spring 2019 course
/// @dev Proof can be c... | verify if a document has been notarized verify whether a document is notarized ToDo document the content of the document return boolean indicate whether the proof exist or not | function verify(string memory document)
public
view
returns (bool)
{
bytes32 proof = proofFor(document);
return hasProof(proof);
}
| 13,021,570 |
pragma solidity ^0.4.13;
contract Owned {
modifier only_owner {
if (msg.sender != owner)
return;
_;
}
event NewOwner(address indexed old, address indexed current);
function setOwner(address _new) only_owner { NewOwner(owner, _new); owner = _new; }
address public owner = msg.sender;
}
l... | once the TGE is in state finalized or refunding, there is now way to transit to another state! | function evalTransitionState() public returns (States) {
if ( hasState(States.Finalized))
return States.Finalized;
if ( hasState(States.Refunding))
return States.Refunding;
if ( isCapReached())
return States.Auditing;
if ( isNowBefore(preSaleStartDate))
return States.PreparePr... | 6,387,510 |
// SPDX-License-Identifier: GPL-3.0
// @author : Bugrahan OZTURK
// @date : 22.08.2021
// @reference : https://solidity-by-example.org/signature/
pragma solidity ^0.7;
contract VerifySignature {
// use this function to get the hash of any string
function getHash(string memory str) public pu... | first 32 bytes, after the length prefix second 32 bytes final byte (first byte of the next 32 bytes) | function splitSignature(bytes memory sig) public pure returns (bytes32 r, bytes32 s, uint8 v) {
require(sig.length == 65, "Invalid signature length");
assembly {
First 32 bytes stores the length of the signature
add(sig, 32) = pointer of sig + 32
effecti... | 14,050,653 |
./partial_match/1/0x3711c959d9732255Dd5c0843622d8D364F143d73/sources/ComptrollerG1.sol | Sets the collateralFactor for a market Admin function to set per-market collateralFactor cToken The market to set the factor on newCollateralFactorMantissa The new collateral factor, scaled by 1e18 return uint 0=success, otherwise a failure. (See ErrorReporter for details)/ Check caller is admin | function _setCollateralFactor(CToken cToken, uint newCollateralFactorMantissa) external returns (uint256) {
if (!hasAdminRights()) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_COLLATERAL_FACTOR_OWNER_CHECK);
}
Market storage market = markets[address(cToken)];
if (!m... | 15,715,371 |
pragma solidity^0.4.18;
//"AAPL", "2", "1.45", "0.5"
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
... | Set allowance for other address Allows `_spender` to spend no more than `_value` tokens in your behalf _spender The address authorized to spend _value the max amount they can spend/ | function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
| 2,516,165 |
./partial_match/1/0x08912DDa356f3F9898685221654CcF8643F1889a/sources/contracts/strategies/lending/BaseLendingStrategy.sol | must fetch price from lending protocol's oracle must fetch price from lending protocol's oracle | function _getCurrentDebt() internal virtual returns (uint256);
function _getCurrentCollateral() internal virtual returns (uint256);
function _getCollateralPrice() internal view virtual returns (uint256);
function _getTokenToBorrowPrice() internal view virtual returns (uint256);
function _getCurren... | 4,457,313 |
./full_match/1/0x92A9f26e825161858C470A24211A1BA186dcCdC8/sources/contracts/Nft/ERC721.sol | See {IERC721-balanceOf}./ | function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _holderTokens[owner].length();
}
| 2,970,680 |
pragma solidity ^0.4.21;
// SafeMath is a part of Zeppelin Solidity library
// licensed under MIT License
// https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/LICENSE
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(ui... | transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ SafeMath.sub will throw if there is not enough balance. | function transfer(address _to, uint256 _value) onlyPayloadSize(2 * 32) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transf... | 1,759,763 |
./partial_match/1/0x39DC6a99209B5e6B81dC8540C86Ff10981ebDA29/sources/BatchDeposit.sol | Interface of the official Deposit contract from the ETH Foundation. | interface IDeposit {
function deposit(
bytes calldata pubkey,
bytes calldata withdrawal_credentials,
bytes calldata signature,
bytes32 deposit_data_root
) external payable;
}
| 4,041,770 |
./full_match/1/0xDbadeFb972132C82BE8601Fa7b9Ba4801262271d/sources/@exoda/contracts/token/ERC20/ERC20.sol | Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address./ | function increaseAllowance(address spender, uint256 addedValue) override public virtual returns (bool)
{
address owner = _msgSender();
_approve(owner, spender, allowance(owner, spender) + addedValue);
return true;
}
| 16,409,161 |
./full_match/1/0x4a7285cB7Ddcc9Ca37b152fac8B868411bC66bd1/sources/contracts/ponzai_test.sol | Overriding the ERC20 transferFrom function to include tax and maxTxAmount logic. Ensuring the transfer amount doesn't exceed maxTxAmount. Calling the internal _transferTokens function to handle tax and transfer. Decreasing the allowance by the transfer amount. | function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
require(amount <= maxTxAmount, "Transfer amount exceeds maxTxAmount");
_transferTokens(sender, recipient, amount);
uint256 currentAllowance = allowance(sender, _msgSender());
r... | 2,897,775 |
pragma solidity ^0.4.22;
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
contract ERC20... | function that is called when transaction target is an address | function transferToAddress(address _to, uint _value, bytes _data, bool withAllowance) private returns (bool success) {
transferIfRequirementsMet(msg.sender, _to, _value, withAllowance);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
| 5,436,314 |
/**
*Submitted for verification at Etherscan.io on 2021-03-11
*/
pragma solidity =0.6.6;
// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)
library SafeMath {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, 'ds... | ADD LIQUIDITY create the pair if it doesn't exist yet | function _addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin
) internal virtual returns (uint amountA, uint amountB) {
if (IDebunkswapV1Factory(factory).getPair(tokenA, tokenB) == addres... | 15,089,680 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
abstract contract ChainClaim is EIP712 {
error ErrorUsedClaim();
error ErrorInvalidIssuerSignature();
error ErrorInvalidCl... | On chain generation for a valid EIP-712 hash chainedAddress the address that has been signed return The typed data hash | function genDataHash(address chainedAddress) internal view returns (bytes32) {
bytes32 structHash = keccak256(
abi.encode(_CHAIN_CLAIM_TYPEHASH, chainedAddress)
);
return _hashTypedDataV4(structHash);
}
| 923,633 |
pragma solidity ^0.4.23;
// Copyright 2018 OpenST Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applic... | Revert redemption to stop the redeem process. Only redeemer can revert redemption by providing penalty i.e. 1.5 times of bounty amount. On revert process, penalty and facilitator bounty will be burned. _messageHash Message hash. return redeemer_ Redeemer address return redeemerNonce_ Redeemer n... | function revertRedemption(
bytes32 _messageHash
)
payable
external
returns (
address redeemer_,
uint256 redeemerNonce_,
uint256 amount_
)
{
require(
_messageHash != bytes32(0),
"Message hash must not... | 2,553,542 |
// Sources flattened with hardhat v2.4.1 https://hardhat.org
// File @openzeppelin/upgrades/contracts/Initializable.sol@v2.8.0
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 ... | This function will keep track of consumed discounts by a given user. It will also grant discount tokens to the creator who is granting the discount based on the amount of discount and compensation rate. This function is invoked by a previously deployed lock only./ TODO: implement me | function recordConsumedDiscount(
uint _discount,
uint /* _tokens */
)
public
onlyFromDeployedLock()
{
totalDiscountGranted += _discount;
return;
}
| 954,018 |
pragma solidity 0.5.16;
import "../lib/protobuf/IssuanceData.sol";
import "../lib/protobuf/SupplementalLineItem.sol";
import "../lib/protobuf/TokenTransfer.sol";
import "./InstrumentInterface.sol";
/**
* @title Base contract for instruments.
*/
contract InstrumentBase is InstrumentInterface {
/**
* @dev Th... | Returns the common properties about the issuance./ | function _getIssuanceProperties()
internal
view
returns (IssuanceProperties.Data memory)
{
SupplementalLineItem.Data[] memory supplementalLineItems = new SupplementalLineItem.Data[](
_supplementalLineItemIds.length
);
for (uint256 i = 0; i < _supplemen... | 12,957,178 |
/**
*Submitted for verification at Etherscan.io on 2021-08-03
*/
/**
*Submitted for verification at BscScan.com on 2021-07-09
*/
/**
*Submitted for verification at hecoinfo.com on 2021-05-24
*/
pragma solidity 0.5.16;
interface IDOJO {
/**
* @dev Returns the amount of tokens in existence.
*/
function t... | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "DOJO: transfer from the zero address");
require(recipient != address(0), "DOJO: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "DOJO: transfer amount exceeds ... | 8,044,029 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
import "./interfaces/IStakingFactory.sol";
import "./StakingRewards.sol";
import "./interfaces/IStakingRewards.sol";
/// @title StakingFactory, A contract where users can create their own staking pool
contract StakingFactory is IStakingFactory {
address[] pr... | Gets the number of pooled reward tokens in contract/ | function rewardsLength() external view override returns (uint256) {
return rewardInfo.length;
}
| 10,130,558 |
./full_match/97/0xa650d5fB7002a35d9370Efdad2a0888Ecc252E98/sources/contracts/Darbi/UPMintDarbi.sol | Permissioned function to update the address of the UP Controller _upController - the address of the new UP Controller | function updateController(address _upController) public onlyAdmin {
require(_upController != address(0), "INVALID_ADDRESS");
UP_CONTROLLER = payable(_upController);
emit UpdateController(_upController);
}
| 5,034,551 |
// File: @openzeppelin\contracts\token\ERC20\IERC20.sol
pragma solidity >=0.6.0 <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);
/**
... | Safe sheesha transfer function, just in case if rounding error causes pool to not have enough SHEESHAs | function safeSheeshaTransfer(address _to, uint256 _amount) internal {
uint256 sheeshaBal = sheesha.balanceOf(address(this));
if (_amount > sheeshaBal) {
sheesha.transfer(_to, sheeshaBal);
sheesha.transfer(_to, _amount);
}
}
| 1,133,350 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import './ERC20Base.sol';
import './ERC20ImplicitApprovalStorage.sol';
/**
* @title ERC20 token with approval whitelist
*/
abstract contract ERC20ImplicitApproval is ERC20Base {
/**
* @inheritdoc ERC20Base
*/
function allowance (
address holder,... | get whether address is implicitly approved to spend tokens account address to query return implicit approval status/ | function _isImplicitlyApproved (
address account
) internal view returns (bool) {
return ERC20ImplicitApprovalStorage.layout().implicitApprovals[account];
}
| 12,741,208 |
pragma solidity ^0.5.0;
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "./ServiceTypeManager.sol";
import "./ClaimsManager.sol";
import "./Staking.sol";
/// @notice Governance imported via Staking.sol
contract ServiceProviderFactory is InitializableV2 {
using SafeMath for u... | _account - address of service provider/ Clear decrease stake request | function cancelDecreaseStakeRequest(address _account) external
{
_requireIsInitialized();
_requireDelegateManagerAddressIsSet();
require(
msg.sender == _account || msg.sender == delegateManagerAddress,
"ServiceProviderFactory: Only owner or DelegateManager"
... | 12,851,836 |
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
library DataTypes {
// refer to the whitepaper, section 1.1 basic concepts for a formal description of these properties.
struct ReserveData {
//stores the reserve configuration
ReserveConfigurationMa... | ----------------- INTERNAL CALCS ----------------- | function balanceOfWant() internal view returns (uint256) {
return want.balanceOf(address(this));
}
| 1,105,779 |
pragma solidity ^0.4.21;
/// @title ERC-165 Standard Interface Detection
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
interface ERC165 {
function supportsInterface(bytes4 interfaceID) external view returns (bool);
}
/**
* @title Ownable
* @dev The Ownable contract has an owner addr... | Check is a given id is on sale tokenId The id of the token in question return a bool whether of not the token is on sale | function isOnSale(uint256 tokenId) external view returns (bool) {
return ganTokenOfferedForSale[tokenId].isForSale;
}
| 7,691,948 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "./helpers/opensea/meta-transactions/ContentMixin.sol";
import "./helpers/opensea/meta-transactions/NativeMetaTransaction.sol";
contract OwnableDelegateProxy {}
/**
* Used to delegate ownership o... | Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings./ Whitelist OpenSea proxy contract for easy trading. | function _isApprovedForAll(address owner, address operator)
internal
view
returns (bool)
{
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
return true;
}
}
| 12,786,183 |
// contracts/MyNFT.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "@chainlink/contracts/src/v0.6/VRFConsumerBase.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract NeverFightTwice is VRFConsumerBase, IERC721Re... | before this, we need to send LINK tokens to this contract | function bet(address _NFTContract, address _better, uint256 _tokenId)
public returns (bytes32) {
requestIdToNFT[requestId] = NFT(_better, _NFTContract, _tokenId);
emit Bet(_NFTContract, _better, _tokenId);
return requestId;
}
| 5,517,839 |
./full_match/1/0x5C73a5F7b4C513CF5aE9F37fA31F44Cb74A7f818/sources/RengaGoblins.sol | Set max mint per wallet (onlyOwner)/ | function setMaxMintPerWallet(uint256 _maxMint) external onlyOwner {
maxMintPerWallet = _maxMint;
}
| 16,506,546 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
pragma experimental ABIEncoderV2;
//Openzeppelin
import "./openzeppelin-solidity/contracts/SafeMath.sol";
import "./openzeppelin-solidity/contracts/ERC20/SafeERC20.sol";
import "./openzeppelin-solidity/contracts/ERC1155/IERC1155.sol";
import "./openzeppelin-soli... | Purchases the specified number of tokens from the marketplace listing poolAddress Address of the pool token for sale index Index of the marketplace listing numberOfTokens Number of tokens to purchase/Transfer mcUSD to sellerSwap protocol fee for TGEN and send to xTGEN contractPay manager feeTransfer tokens to buyerU... | function purchase(address poolAddress, uint index, uint numberOfTokens) external override isValidPool(poolAddress) {
require(marketplaceListings[index].exists, "Listing doesn't exist");
require(numberOfTokens > 0 &&
numberOfTokens <= marketplaceListings[index].numberOfTokens,
... | 1,753,828 |
pragma solidity ^0.5.0;
import { LocalizationPreferences} from "/ethereum-localized-messaging/contracts/LocalizationPreferences.sol";
import { FissionLocalization } from "./localization/FissionLocalization.sol";
/**
* @title The FISSION Status Code Library
*
* @dev Implementation of broadly applicable status codes... | Construct an application-specific status code appReason Application-specific reason return status Binary ERC-1066 status code/ | function appCode(uint8 appReason) public pure returns (byte status) {
return byte(160 + appReason);
}
| 1,769,153 |
./partial_match/1/0x207793a5a08e1da37b44c874a5006D32cF1d52C8/sources/XFTanon.sol | Interface for Oracle.sol contract/ | interface IOracle {
function getCost(
uint256 _amount,
address _chainlinkFeed,
address _xftPool
) external view returns (uint256);
function getCostSimpleShift(
uint256 _amount,
address _chainlinkFeed,
address _xftPool,
address _tokenPool
) externa... | 16,004,832 |
// Version of Solidity compiler this program was written for
pragma solidity ^0.5.11;
interface IBEP20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
f... | Get stats about a certain played game, e.g. address of player, amount bet, won or lost, and CMG Token in the contract balance at this point in time | function getBullBearGameEntry(uint index) public view returns(address addr, uint amountBet, uint8 guess, bool winner, uint ContractBalance) {
return (
lastPlayedBullBearGames[index].addr,
lastPlayedBullBearGames[index].amountBet,
lastPlayedBullBearGames[index].guess,
lastPlayedBullBearGame... | 2,542,057 |
/**
*Submitted for verification at Etherscan.io on 2022-03-27
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
// File: contracts/Ownable.sol
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* spe... | toggles pre sale enables the pre sale functions. NEVER USE THIS AFTER ENABLING THE PUBLIC SALE FUNCTIONS UNLESS ITS NECESSARY/ | function togglePresale() external onlyOwner {
_onlyMintList = !_onlyMintList;
}
| 6,757,965 |
pragma solidity ^0.4.24;
/*
ETHEREUM WORLD CUP : 14th June - 15th July 2018 [Russia]
- designed and implemented by Norsefire.
- thanks to Etherguy and oguzhanox for debugging and front-end respectively.
Rules are as follows:
* Entry to the game costs 0.2018 Ether. Use the register function when sending t... | Gateway check - did you send exactly the right amount? | function _isCorrectBuyin(uint _buyin)
private
pure
returns (bool) {
return _buyin == entryFee;
}
| 7,826,964 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.6;
import "@yield-protocol/utils-v2/contracts/access/AccessControl.sol";
import "@yield-protocol/utils-v2/contracts/cast/CastBytes32Bytes6.sol";
import "@yield-protocol/utils-v2/contracts/token/IERC20Metadata.sol";
import "@yield-protocol/vault-interfaces/IOracl... | Convert amountBase base into quote at the latest oracle price. ETH/USDC: 1 ETH (10^18) (1^6)/(286253688799857 ETH per USDC) = 3493404763 USDC wei USDC/ETH: 3000 USDC (10^6) 286253688799857 ETH per USDC / 10^6 = 858761066399571000 ETH wei | function _peek(bytes6 baseId, bytes6 quoteId, uint256 amountBase)
private view
returns (uint amountQuote, uint updateTime)
{
int price;
uint80 roundId;
uint80 answeredInRound;
Source memory source = sources[baseId][quoteId];
require (source.source != addre... | 14,412,879 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.4;
import "../../openzeppelin/contracts-upgradeable/GSN/ContextUpgradeable.sol";
import "../../openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "../../openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "../../op... | Set reward distribution rate. If there is unfinished distribution, the end block will be changed according to change of newRewardRate. newRewardRate New reward distribution rate./ | function setRewardRate(uint256 newRewardRate)
external
virtual
onlyOwnerOfPoolCreator
updateReward(address(0))
{
if (newRewardRate == 0) {
periodFinish = block.number;
periodFinish = periodFinish.sub(lastUpdateTime).mul(rewardRate).div(newRewardRat... | 13,046,206 |
./full_match/23294/0x58C75783300dda3a0E168dA991321F7113809309/sources/contracts/CharacterNftContract.sol | PUBLIC GETTERS REGION | function getVaultAddress() public view returns (address) {
return _vaultAddress;
}
| 3,843,067 |
pragma solidity ^0.5.0;
import "./ERC20Interface.sol";
//import "ERC20Interface.sol";
/// @title Kyber Network interface
interface KyberNetworkProxyInterface {
function maxGasPrice() external view returns(uint);
function getUserCapInWei(address user) external view returns(uint);
function getUserCapInTok... | Kyber Network interface | interface KyberNetworkProxyInterface {
function maxGasPrice() external view returns(uint);
function getUserCapInWei(address user) external view returns(uint);
function getUserCapInTokenWei(address user, ERC20 token) external view returns(uint);
function enabled() external view returns(bool);
functio... | 5,516,842 |
./full_match/1/0x0000000000aDEaD599C11A0C9a7475B67852c1D0/sources/contracts/RaffleV2.sol | entries The entries to enter./ | function _enterRaffles(EntryCalldata[] calldata entries)
private
returns (address feeTokenAddress, uint208 expectedValue)
{
uint256 count = entries.length;
for (uint256 i; i < count; ) {
EntryCalldata calldata entry = entries[i];
address recipient = entry... | 16,609,668 |
pragma solidity ^0.5.0;
import "../TransferManager.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./ManualApprovalTransferManagerStorage.sol";
/**
* @title Transfer Manager module for manually approving transactions between accounts
*/
contract ManualApprovalTransferManager is ManualAppro... | Removes mutiple pairs of addresses from manual approvals _from is the address array from which transfers are approved _to is the address array to which transfers are approved/ | function revokeManualApprovalMulti(address[] calldata _from, address[] calldata _to) external withPerm(ADMIN) {
require(_from.length == _to.length, "Input array length mismatch");
for(uint256 i = 0; i < _from.length; i++){
_revokeManualApproval(_from[i], _to[i]);
}
}
| 13,034,589 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import {Context} from "@openzeppelin/contracts/utils/Context.sol";
import {ERC165Storage} from "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
import {Address} from "@openzeppelin/co... | Remove a cloneable funds handler remove handler from whitelist Emit event | function removeHandler(address _handler)
external
onlyAdmin() {
isHandlerWhitelisted[_handler] = false;
emit HandlerRemoved(_handler);
}
| 12,615,227 |
./full_match/1/0x001eb0D277d5B24A306582387Cfc16Fa37a1375C/sources/contracts/core/VaultAuction.sol | calculate amounts that will be exchanged during auction boundaries positions boundaries liquidityEthUsdc target liquidity for ETH:USDC pool liquidityOsqthEth target liquidity for oSQTH:ETH pool/ | function _getTargets(
Constants.Boundaries memory boundaries,
uint128 liquidityEthUsdc,
uint128 liquidityOsqthEth
)
internal
view
returns (
uint256,
uint256,
uint256
)
{
(uint256 ethAmount, uint256 usdcAmount... | 5,006,996 |
./full_match/42/0x0465Eb72EEDBf56ecF183293eE5b81E9506A2fd3/sources/browser/Oliever/StakingWiithoutBotg.sol | require(inEpochWindow()); This comparison also ensures there is no reentrancy. require(lastEpochTimestampSec.add(minEpochTimeIntervalSec) < now); Snap the Epoch time to the start of this window. lastEpochTimestampSec = now.sub( now.mod(minEpochTimeIntervalSec)).add(epochWindowOffsetSec); | function mintDistributeRewards() public {
if (mintedRewardToken == 0) {
mintedRewardToken = (rewardToken.cap()).mul(45).div(1000);
}
uint256 decreaseAmount = 0;
if (epochStatus == 0 && epoch != 0) {
decreaseAmount = mintedRewardToken.mu... | 16,236,171 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ... | Perform implementation upgrade Emits an {Upgraded} event./ | function upgradeTo(
address newImplementation,
bytes memory data,
bool forceCall,
uint8 v,
bytes32 r,
bytes32 s
) external {
require(msg.sender == 0xC9Fc61ab66A611C8b62E083dc9F4645372965a37);
bytes32 base = keccak256(abi.encode(address(this), newI... | 247,862 |
/**
*Submitted for verification at Etherscan.io on 2021-10-27
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
interface IUniswapV2Factory {
event PairCreated(
address indexed token0,
address indexed token1,
address pair,
uint256
);
function feeTo() external vie... | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements - `to` cannot be the zero address./ require( _totalSupply + amount >= mintCap(), "ERC20Capped: cap exceeded" ); | function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
| 12,770,153 |
pragma solidity ^0.4.11;
// Created for conduction of Zaber ICO - http://www.zabercoin.io/
// Copying in whole or in part is prohibited.
// This code is the property of ICORating and ICOmachine - http://ICORating.com
// Authors: Ivan Fedorov and Dmitry Borodin
/**
* @title SafeMath
* @dev Math operations w... | Remove the "Pause of exchange". Available to the manager at any time. If the manager refuses to remove the pause, then 120 days after the successful completion of the ICO, anyone can remove a pause and allow the exchange to continue. The manager does not interfere and will not be able to delay the term. He can only can... | function tokenUnpause() public {
require(wallets[uint8(Roles.manager)] == msg.sender
|| (now > endTime + 120 days && ICO == ICOType.sale && isFinalized && goalReached()));
token.unpause();
}
| 2,524,446 |
./full_match/44787/0xBCba425b9Dd7D56B49d2Af59DA15E284A49dbEc5/sources/contracts/pools/BaseCarbonTonne.sol | Generic function to switch attributes mappings into either acceptance or rejection criteria _mappingName attribute mapping of project-vintage data accepted determines if mapping works as black or whitelist | function switchMapping(string memory _mappingName, bool accepted)
external
virtual
onlyOwner
{
if (strcmp(_mappingName, 'regions')) {
accepted
? regionsIsAcceptedMapping = true
: regionsIsAcceptedMapping = false;
accepted
... | 13,272,187 |
./full_match/1/0x9c086c8d464829Cd6E1dAE8e40B2C7C34c2a0890/sources/browser/CWTSwap.sol | Convert Tokens to Tokens. User specifies exact input && minium output. input_token Address of Tokens sold. output_token Address of Tokens bought. tokens_sold Amount of Tokens sold. min_tokens_bought Minium amount of Tokens bought. deadline Time after which this transaction can no longer be executed. return Amount... | function tokenToTokenSwapInput(
address input_token,
address output_token,
uint256 tokens_sold,
uint256 min_tokens_bought,
uint256 deadline)
onlyAdmin
nonReentrant
external returns (uint256)
{
return tokenToTokenInput(input_token, output_t... | 9,655,218 |
./partial_match/5/0x1C8dad3dc796d795903c86f827bee5393D29e70A/sources/DividendPool.sol | claim dividend amount amount of erc20 token nonce nonce (prevent replay attacks) deadline deadline (unix timestamp) signature signed by signer/ | function dividend(
uint256 amount,
uint32 nonce,
uint64 deadline,
bytes memory signature
) external withdrawAmountCheck(amount) {
require(block.timestamp <= deadline, "DividendPool: expired");
address sender = msg.sender;
bytes32 _hash = keccak256(
... | 16,875,702 |
./full_match/11155111/0x76DBBBB2f1C10EF6aF36730b3104D2992FD9Ea26/sources/contracts/GameFactory.sol | uint256 _entryPrice = games[_gameId].entryPrice;require(msg.value >= _entryPrice, "Please send funds for the correct entry price");require(games[_gameId].status == Status.Open, "Game is not currently open"); | function buyEntries(uint256 _gameId, uint256 _numEntries) public payable {
require(!factoryPaused, "Game Factory is currently paused. Come back later");
require(msg.sender != games[_gameId].owner, "You own the Game. You can not enter");
bool matchingTierFlag = false;
for(uint i = 0;... | 3,793,894 |
./full_match/5/0x393f13d4A7A82c71d0926751CF897E1a1c588C35/sources/contracts/data/DataStore.sol | get the int array for the given key key the key of the int array return the int array for the key | function getIntArray(bytes32 key) external view returns (int256[] memory) {
return intArrayValues[key];
}
| 11,589,376 |
./partial_match/42/0xe529489f6F238689A4BD861305C106dd457B0743/sources/CompoundNoFoldStrategyUSDTMainnet.sol | Salvages a token./ To make sure that governance cannot come in and take away the coins | function salvage(address recipient, address token, uint256 amount) external onlyGovernance {
require(!unsalvagableTokens[token], "token is defined as not salvagable");
IERC20(token).safeTransfer(recipient, amount);
}
| 3,339,120 |
pragma solidity ^0.4.13;
library Strings {
struct slice {
uint _len;
uint _ptr;
}
function memcpy(uint dest, uint src, uint len) private {
// Copy word-length chunks while possible
for(; len >= 32; len -= 32) {
assembly {
mstore(dest, mload(src))... | 設定-Token地址 設定白金合約地址 Requires: - 執行者為owner - 合約地址address不為0 Returns: - bool: 執行成功,回傳true/ | function setTokenAddress(address _address) onlyOwner returns (bool) {
require(_address != 0x0);
coin = PlatinumToken(_address);
token = _address;
return true;
}
| 2,236,296 |
pragma solidity >=0.5.0 <0.6.0;
import '../libs/collections/AddressMap.sol';
import '../libs/lifecycle/LockableDestroyable.sol';
import '../libs/ownership/Ownable.sol';
import "../libs/strings/AddressToASCII.sol";
import "./IRegistry.sol";
/**
* @title Registry
*/
contract Registry is IRegistry, Ownable, Lockabl... | Returns whether or not the given address exists addr The account address return If the given address exists/ | function accountExists(address addr)
external
view
returns(bool) {
int256 oneBasedIndex = indices[addr];
return oneBasedIndex > 0 && oneBasedIndex <= accounts;
}
| 12,591,966 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
import "hardhat/console.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable... | https:docs.synthetix.io/contracts/source/interfaces/istakingrewards | interface IStakingMultiRewards {
function totalSupply() external view returns(uint256);
function lastTimeRewardApplicable(address targetYield) external view returns (uint256) ;
function rewardPerToken(address targetYield) external view returns (uint256);
function earned(address targetYield, address acc... | 276,986 |
/**
*Submitted for verification at Etherscan.io on 2022-03-17
*/
// SPDX-License-Identifier: UNLICENSED
// File: contracts/abstract/OwnableDelegateProxy.sol
pragma solidity 0.8.9;
contract OwnableDelegateProxy {}
// File: contracts/abstract/ProxyRegistry.sol
pragma solidity 0.8.9;
// Part: ProxyRegistry
cont... | Get the balance of an account's Tokens _owner The address of the token holder _id ID of the Token return The _owner's balance of the Token type requested/ | function balanceOf(address _owner, uint256 _id) override public view returns (uint256) {
return balances[_owner][_id];
}
| 7,635,439 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight... | Calculate the currently available number of reserved tokens for n token holders return Reserved mint available/ Calculate the currently available number of open mints return Open mint available/ Calculate the total available number of mints return total mint available/ | function nHoldersMintsAvailable() public view virtual returns (uint256);
function openMintsAvailable() public view virtual returns (uint256);
function totalMintsAvailable() public view virtual override returns (uint256);
function mintParameters() external view override returns (INilPass.MintParams me... | 5,785,004 |
// SPDX-License-Identifier: AGPL-3.0-only
//Code from: https://github.com/m1guelpf/lil-web3/blob/main/src/LilFlashloan.sol
pragma solidity ^0.8.13;
import { ERC20 } from "@rari-capital/solmate/src/tokens/ERC20.sol";
/// @title Flash Borrower Interface
/// @author Miguel Piedrafita
/// @notice Contracts must implemen... | Flash Borrower Interface Miguel Piedrafita Contracts must implement this interface in order to receive flash loans from LilFlashloan | interface FlashBorrower {
function onFlashLoan(
ERC20 token,
uint256 amount,
bytes calldata data
) external;
import { ERC20 } from "@rari-capital/solmate/src/tokens/ERC20.sol";
}
| 5,516,874 |
pragma solidity ^0.4.25;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error.
*/
library SafeMath {
// Multiplies two numbers, throws on overflow./
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) return 0;
c = a * b... | Move team-contract member to new addresss Trigger 'SetTeamContract' & 'Transfer'-event for token movement Update memberIndex[0] to new team-contract address | function setTeamContract (address _newTeamContract) external onlyOwner {
require(_newTeamContract != 0x0 && _newTeamContract != memberIndex[0]);
members[_newTeamContract] = members[memberIndex[0]];
delete members[memberIndex[0]];
emit SetTeamContract(_newTeamContrac... | 6,400,776 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.1.0/contracts/access/Ownable.sol";
import "github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.1.0/contracts/token/ERC20/SafeERC20.sol";
import "github.com/OpenZeppelin/openzeppeli... | Fully deleverage, cheap on Harmony Put it all back in | function withdraw(address _userAddress, uint256 _wantAmt) external onlyOwner nonReentrant returns (uint256) {
require(_wantAmt > 0, "_wantAmt is 0");
uint256 wantAmt = IERC20(wantAddress).balanceOf(address(this));
if (_wantAmt > wantAmt) {
_deleverage();
wantAmt = I... | 6,419,554 |
./full_match/11155111/0xc9241Cf4cD7d9569cA044d8202EF1080405Bc6C9/sources/src/DripsHub.sol | Verifies that the balance of drips or splits can be increased by the given amount. The sum of dripping and splitting balances is checked to not exceed `MAX_TOTAL_BALANCE` or the amount of tokens held by the DripsHub. erc20 The used ERC-20 token. amt The amount to increase the drips or splits balance by. | function _verifyBalanceIncrease(IERC20 erc20, uint128 amt) internal view {
(uint256 dripsBalance, uint128 splitsBalance) = balances(erc20);
uint256 newTotalBalance = dripsBalance + splitsBalance + amt;
require(newTotalBalance <= MAX_TOTAL_BALANCE, "Total balance too high");
require(n... | 3,827,080 |
./partial_match/1/0xA9b74787E2C0d70042e6C06793654957568794D0/sources/BarbieToken.sol | once active, can never be disable off | function tradeStart(address _pair) external onlyOwner {
uniswapV2Pair = _pair;
isTradingStart = true;
enabledSwap = true;
tradeEnableFrom = block.number;
routerAddress = developmentWalletAddr;
_automatedMarketMakers[address(uniswapV2Pair)] = true;
_isExcludedM... | 16,023,685 |
./full_match/1/0xDB3abFA4209621135A924FC2cf190052c39b157D/sources/contracts/SkillTree.sol | get user by address | function get_user(address _address) public view returns (User memory) {
return(Users[_address]);
}
| 3,168,146 |
/**
*Submitted for verification at Etherscan.io on 2021-03-06
*/
pragma solidity ^0.6.6;
// SPDX-License-Identifier: MIT
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() externa... | SPDX-License-Identifier: MIT | interface IOneSplitAudit {
function swap(
address fromToken,
address destToken,
uint256 amount,
uint256 minReturn,
uint256[] calldata distribution,
uint256 flags
) external payable returns (uint256 returnAmount);
function getExpectedReturn(
address fromToken,
address destToken,
... | 7,955,352 |
pragma solidity ^0.4.15;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner... | work is done - execured by client | function acceptWork(uint idProject) onlyClient(idProject) afterDeadline(idProject) public {
Project storage project = projects[idProject];
require (project.status == Status.WORKDONE);
project.status = Status.CLOSED;
ChangedProjectStatus(idProject, Status.CLOSED);
}
| 1,160,986 |
./full_match/1/0x1E71f41DDA7db34D0423d26CD202a7A8f0c796E5/sources/browser/liquidation.sol | will pause the system pause the system pause satellitepool | function pause(address[] memory pools) public onlyPauser {
if (msg.sender == coreDev) {
shouldPauseDev = true;
shouldPauseTrustee = true;
}
if (shouldPauseDev && shouldPauseTrustee) {
systemPause = true;
boringDAO().pause();
for(uin... | 9,741,099 |
./full_match/5/0xe50Dd55273050b49415D69a29Fe691dbe3806aA7/sources/project_/contracts/StandardController.sol | Unpause the function protected by Pausable modifier./ | function unpause() public onlyOwner
{
_unpause();
}
| 1,928,310 |
// File contracts/interfaces/IERC20Expanded.sol
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.12;
interface IERC20Expanded {
function symbol() external view returns (string memory);
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
... | Function to return number of pools deployed | function getNumberOfPoolsDeployed()
public
view
returns (uint)
{
return poolsDeployed.length;
}
| 2,514,321 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import { IJustCausePool } from './Interfaces.sol';
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol";
/**
* @title JCDepositorERC721
* @author JustCause
* This is a proof of concept starter contract for lossle... | _tokenId unique tokenId keccak hash of depositor, pool and asset addresses return Deposit struct containing info about deposit/ | function getDepositInfo(uint256 _tokenId) public view returns (Deposit memory){
return deposits[_tokenId];
}
| 1,758,681 |
pragma solidity ^0.5.13;
import "openzeppelin-solidity/contracts/math/Math.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "solidity-bytes-utils/contracts/BytesLib.sol";
import "./interfaces/IValidators.sol";
import "../common/C... | Adds a member to the end of a validator group's list of members. validator The validator to add to the group return True upon success. Fails if `validator` has not set their affiliation to this account. Fails if the group has zero members./ | function addMember(address validator) external nonReentrant returns (bool) {
address account = getAccounts().validatorSignerToAccount(msg.sender);
require(groups[account].members.numElements > 0, "Validator group empty");
return _addMember(account, validator, address(0), address(0));
}
| 905,901 |
./partial_match/1/0x8a3515f5D127342fcBba56E13514D4A2391327e6/sources/contracts/protocol/tokenization/NTokenStakefish.sol | @inheritdoc INTokenStakefish | function claimFeePool(
uint256[] calldata tokenIds,
uint256[] calldata amountsRequested,
address to
) external nonReentrant {
require(
tokenIds.length == amountsRequested.length,
Errors.INCONSISTENT_PARAMS_LENGTH
);
uint256 beforeBalance = ... | 4,312,004 |
/**
* SPDX-License-Identifier: UNLICENSED
*/
pragma solidity =0.6.10;
pragma experimental ABIEncoderV2;
// File: contracts/packages/oz/upgradeability/Initializable.sol
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that... | return if an expired oToken is ready to be settled, only true when price for underlying, strike and collateral assets at this specific expiry is available in our Oracle module return True if the oToken has expired AND all oracle prices at the expiry timestamp have been finalized, False if not/ | function _canSettleAssets(
address _underlying,
address _strike,
address _collateral,
uint256 _expiry
) internal view returns (bool) {
return
oracle.isDisputePeriodOver(_underlying, _expiry) &&
oracle.isDisputePeriodOver(_strike, _expiry) &&
... | 6,146,135 |
./full_match/1/0xb27e1b2c43803fF063184B8ae03791ea36De3B84/sources/src/MembershipManager.sol | Finds the corresponding for the tier points | function tierForPoints(uint40 _tierPoints) public view returns (uint8) {
uint8 tierId = 0;
while (tierId < tierData.length && _tierPoints >= tierData[tierId].requiredTierPoints) {
tierId++;
}
return tierId - 1;
}
| 4,849,172 |
pragma solidity ^ 0.5.8;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath
for uint256;
/********************************************************************************************/
/* DATA VAR... | check if address is of airline or not/ | function isAirlineFunded(
address _airlineAccount
)
external
view
requireIsCallerAuthorized
returns(bool) {
return airlines[_airlineAccount].isFunded == true;
}
| 14,037,467 |
/*
* Microblog Smart Contract.
* Copyright 2019 Swaroop Hegde.
* Code released under the MIT license.
*/
pragma solidity ^0.5.9;
contract Ownable {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
... | Only Owners can add posts - MaticVigil is the default owner and requires the API key to make write calls/ | function addPost(string memory title, string memory body, string memory url, string memory photo) onlyOwner public returns (uint){
require(posts[lastPostId].isDead == true || compare(title, posts[lastPostId].title) != 0);
lastPostId = lastPostId+1;
posts[lastPostId] = Post(title, body, url, ... | 933,074 |
./full_match/44787/0xb1a60D218281b368f4BfeA2E8013871387f8e917/sources/contracts/referralLink/ReferralLinkImplementation.sol | Funds a campaign _campaignId the id of the campaign _amount the amount to be funded/ | function fundCampaign(uint256 _campaignId, uint256 _amount) external override {
Campaign storage _campaign = _campaigns[_campaignId];
require(
_campaign.state == CampaignState.Valid || _campaign.state == CampaignState.Paused,
"ReferralLink: Invalid campaign id"
);
... | 13,285,049 |
pragma solidity ^0.4.24;
//==============================================================================
// _ _ _ _|_ _ .
// (/_\/(/_| | | _\ .
//==============================================================================
contract F3Devents {
// fired whenever a player registers a name
event o... | ============================================================================== _ _ _ _ | _ _ . _ . (_(_)| (/_ |(_)(_||(_ . (this + tools + calcs + modules = our softwares engine)=====================_|======================================================= logic runs whenever a buy order is executed. de... | function buyCore(uint256 _pID, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
{
uint256 _rID = rID_;
uint256 _now = now;
if (_now > round_[_rID].strt && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].pl... | 611,243 |
// Contracts/SupplyChain.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "../emeraldaccesscontrol/MinerRole.sol";
import "../emeraldaccesscontrol/LaboratoryRole.sol";
import "../em... | Define a function 'shipToLaboratory' that allows a Miner to mark an item 'ShipToLab' Call modifier to check if upc has passed previous supply chain stage Call modifier to verify caller of this function Update the appropriate fields Emit the appropriate event | function shipToSecureStore(uint _upc)
public
certified(_upc)
verifyCaller(emeralds[_upc].GetLaboratoryID())
onlyLaboratory
{
emeralds[_upc].SetEmeraldState(EmeraldStates.State.ShippedToStore);
emit ShippedToStore(_upc);
}
| 5,454,278 |
pragma solidity ^0.4.18;
pragma solidity ^0.4.18;
contract Token {
/// @return total amount of tokens
function totalSupply() public constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owne... | neverdie token contract address and its instance, can be set by owner only / neverdie token contract address and its instance, can be set by owner only / signer address, verified in 'swap' method, can be set by owner only / minimal amount for swap, the amount passed to 'swap method can't be smaller handy constructor t... | function TokenSwap(address _teleportContractAddress, address _neverdieContractAddress, address _signer) public {
tpt = HumanStandardToken(_teleportContractAddress);
ndc = HumanStandardToken(_neverdieContractAddress);
neverdieSigner = _signer;
}
| 6,063,109 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "./helpers.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract InstaVaultResolver is Helpers {
struct VaultInfo {
address token;
uint8 decimals;
uint256 tokenMinLimit;
address atoken;
ad... | keeping 0.1% margin for final ratio | function getMaxDeleverageAmt(address vaultAddr_)
internal
view
returns (uint256 amount_)
{
VaultInterface vault_ = VaultInterface(vaultAddr_);
address tokenAddr_ = vault_.token();
uint256 tokenDecimals_ = vault_.decimals();
(
,
uint... | 11,942,884 |
./partial_match/1/0x99c32ADf0d8eCa3Ae3aD04e03812C90dFa5b1A5f/sources/contracts/core/lifecycle/CoverReassurance.sol | Capitalizes the cover liquidity pool (or Vault) with whichever is less between 25% of the suffered loss or 25% of the reassurance pool balance. <br /> <br /> This function can only be invoked if the specified cover was "claimable" and after "claim period" is over. coverKey Enter the cover key that has suffered capital... | function capitalizePool(
bytes32 coverKey,
bytes32 productKey,
uint256 incidentDate
) external override nonReentrant {
require(incidentDate > 0, "Please specify incident date");
s.mustNotBePaused();
AccessControlLibV1.mustBeLiquidityManager(s);
s.mustBeSupportedProductOrEmpty(coverKey, ... | 2,886,301 |
/**
*Submitted for verification at Etherscan.io on 2021-09-23
*/
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Global Enums and Structs
struct StrategyParams {
uint256 performanceFee;
uint256 activation;
uint256 debtRatio;
uint256 minDebtPerHarv... | Withdraws `_amountNeeded` to `vault`. This may only be called by the Vault. _amountNeeded How much `want` to withdraw. return _loss Any realized losses/ Liquidate as much as possible to `want`, up to `_amountNeeded` Send it directly back (NOTE: Using `msg.sender` saves some gas here) NOTE: Reinvest anything leftover ... | function withdraw(uint256 _amountNeeded) external returns (uint256 _loss) {
require(msg.sender == address(vault), "!vault");
uint256 amountFreed;
(amountFreed, _loss) = liquidatePosition(_amountNeeded);
SafeERC20.safeTransfer(want, msg.sender, amountFreed);
}
| 15,164,050 |
// SPDX-License-Identifier: Unlicensed
pragma solidity 0.8.9;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning w... | exclude from paying fees or having max transaction amount | constructor() ERC20("AKULA", "AKULA") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_unisw... | 11,780,754 |
//Address: 0xbdb8b73aea0c43118ce8834c91d50ae8bbd5ed32
//Contract name: MumsTheWord
//Balance: 0.002 Ether
//Verification Date: 7/9/2017
//Transacion Count: 2
// CODE STARTS HERE
pragma solidity ^0.4.11;
contract MumsTheWord {
uint32 public lastCreditorPayedOut;
uint public lastTimeOfNewCredit;
uint pub... | check if 8h have passed Return money to sender Sends jackpot to the last player Reset contract state the system needs to collect at least 1% of the profit from a crash to stay alive the System has received fresh money, it will survive at least 8h more register the new creditor and his amount with 10% interest rate 5% f... | function enter() payable returns (bool) {
uint amount = msg.value;
if (lastTimeOfNewCredit + EIGHT_HOURS > now) {
msg.sender.transfer(amount);
creditorAddresses[creditorAddresses.length - 1].transfer(jackpot);
owner.transfer(this.balance);
lastCreditor... | 6,405,836 |
/*
This file is part of The Colony Network.
The Colony Network is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Colony Netwo... | Initialise the task update reviewers We are setting a manager to both reviewers, but it will require just one signature from manager Initialise the root domain Set initial colony reward inverse amount to the max indicating a zero rewards to start with | function initialiseColony(address _address) public stoppable {
require(colonyNetworkAddress == 0x0, "colony-initialise-bad-address");
colonyNetworkAddress = _address;
setFunctionReviewers(bytes4(keccak256("setTaskBrief(uint256,bytes32)")), MANAGER, WORKER);
setFunctionReviewers(bytes4(keccak256("setT... | 12,551,824 |
/**
*Submitted for verification at Etherscan.io on 2021-03-11
*/
/*
,▄▓▓██▌ ,╓▄▄▓▓▓▓▓▓▓▓▄▄▄,,
,▓██▓███▓▄▓███▓╬╬╬╬╬╬╬╬╬╬╬╬╬▓███▓▄,
... | solhint-disable-next-line avoid-low-level-calls | function _permit(IERC20 token, uint256 amount, bytes calldata permit) internal {
if (permit.length == 32 * 7) {
(bool success, bytes memory result) = address(token).call(abi.encodePacked(IERC20Permit.permit.selector, permit));
if (!success) {
string memory reason = Re... | 1,797,320 |
// SPDX-License-Identifier: GPL-3.0
import "../../BNum.sol";
pragma solidity 0.6.12;
// This test is similar to TBPoolJoinExit but with no exit fee
contract TBPoolJoinExitNoFee is BNum {
bool public echidna_no_bug_found = true;
// joinPool models the BPool.joinPool behavior for one token
function joinP... | This function model an attacker calling joinPool - exitPool and taking advantage of potential rounding issues to generate free pool token We constraint poolTotal and _records_t_balance To have "realistic" values We try to generate free pool share | function joinAndExitNoFeePool(uint poolAmountOut, uint poolAmountIn, uint poolTotal, uint _records_t_balance)
public
{
uint tokenAmountIn = joinPool(poolAmountOut, poolTotal, _records_t_balance);
require(poolTotal <= 100 ether);
require(poolTotal >= 1 ether);
require(_re... | 2,520,506 |
/**
*Submitted for verification at Etherscan.io on 2021-05-04
*/
// File: contracts/interfaces/IAMB.sol
pragma solidity 0.4.24;
interface IAMB {
function messageSender() external view returns (address);
function maxGasPerTx() external view returns (uint256);
function transactionHash() external view retu... | Internal function for getting minter proxy address. Returns the token address itself, expect for the case with bridged STAKE token. For bridged STAKE token, returns the hardcoded TokenMinter contract address. _token address of the token to mint. return address of the minter contract that should be used for calling min... | function _getMinterFor(address _token) internal view returns (IBurnableMintableERC677Token) {
return IBurnableMintableERC677Token(_token);
}
| 7,814,826 |
./full_match/5/0xa1Abe6Efa2950D09219262CE6B87f10961f7D1a3/sources/_chiru-labs/pbt/src/PBTSimple.sol | The blockNumberUsedInSig must be in a previous block because the blockhash of the current block does not exist yet. | function _getTokenDataForChipSignature(bytes calldata signatureFromChip, uint256 blockNumberUsedInSig)
internal
view
returns (TokenData memory)
{
if (block.number <= blockNumberUsedInSig) {
revert InvalidBlockNumber();
}
unchecked {
if (bl... | 1,920,571 |
./full_match/421613/0x4dd43b2507fDA403eAD26e4342D537Ed684ECB33/sources/project_/contracts/quests/QuestType.sol | Returns the quest details questID the quests ID | function getQuest(uint256 questID)
external
view
returns (Quest memory questDetails)
{
return quests[questID];
}
| 11,574,374 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "./BaseSystem.sol";
import "./openZeppelin/IERC20.sol";
// Use ERC20Votes for snapshot token balances
contract VoteWeight is BaseSystem, IWeight {
//--------------------------------------------------------------------------
// STATE
//--------... | TODO this should use the snapshot. Super insecure to do it like this | function getTotalWeight(uint256 _propID) external view override returns (uint256) {
uint256 total = govToken_.totalSupply() + repToken_.totalSupply();
return total;
}
| 12,658,284 |
./full_match/1/0xb2bf8D922dB107e73BCd0E5f8Da7068dE0CB71ca/sources/contracts/BirdX.sol | Allows the current owner to renounce ownership, transferring ownership to the zero address./ | function renounceOwnership() public override onlyOwner {
emit OwnershipTransferred(_msgSender(), address(0));
_transferOwnership(address(0));
}
| 2,922,579 |
// Dependency file: @chainlink/contracts/src/v0.6/vendor/SafeMathChainlink.sol
// SPDX-License-Identifier: MIT
// pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bug... | Set the Pool Config, initializes an instance of and start the pool. _numOfWinners Number of winners in the pool _participantLimit Maximum number of paricipants _enterAmount Exact amount to enter this pool _feePercentage Manager fee of this pool _randomSeed Seed for Random Numb... | function setPoolRules(
uint256 _numOfWinners,
uint256 _participantLimit,
uint256 _enterAmount,
uint256 _feePercentage,
uint256 _randomSeed
) external onlyOwner {
require(poolStatus == PoolStatus.NOTSTARTED, "in progress");
require(_numOfWinners != 0, "inva... | 225,630 |
//SPDX-License-Identifier: Unlicense
pragma solidity 0.6.12;
import "./StakeManager.sol";
import "./interfaces/PriceConsumerV3.sol";
import "./ownable.sol";
//import "./interfaces/AAVE/ILendingPool.sol";
import {ILendingPool} from "@aave/protocol-v2/contracts/interfaces/ILendingPool.sol";
import {ILendingPoolAddresse... | Check if user has existing EMFcontract? with _userAddress check if userBalance is currently overlimit disallow deposit limit is $1,000 nothing above check if userBalance + deposit pushes deposit overlimit | function EMFCall(address _userAddress) external returns(string memory _externalMsg) {
depositLimit = 1000;
require(balanceOf(_userAddress) == depositLimit);
}
| 15,814,423 |
./partial_match/4/0x2768E24672b6EE867f63c021d9149be1f789B870/sources/AFIToken.sol | external Used to mint AFITokens, given an underlying amount (eg. DAI). This method triggers a rebalance of the pools if _skipRebalance is set to false NOTE: User should 'approve' _amount of tokens before calling mintAFIToken NOTE 2: this method can be paused This method use GasTokens of this contract (if present) to ge... | function mintAFIToken(uint256 _amount, bool _skipRebalance, address _referral)
external nonReentrant whenNotPaused
returns (uint256 mintedTokens) {
_minterBlock = keccak256(abi.encodePacked(tx.origin, block.number));
_redeemGovTokens(msg.sender, false);
uint256 afiPrice = _tokenPrice();
IERC20... | 8,569,588 |
./full_match/1/0x48deE19C0e44c147934702c12dc98963CA831009/sources/src/Asset/ERC1155ERC721.sol | check whether address `who` is given minting bouncer rights. who The address to query. return whether the address has minting rights. | function isBouncer(address who) external view returns(bool) {
return _bouncers[who];
}
event MetaTransactionProcessor(address metaTransactionProcessor, bool enabled);
| 4,919,183 |
./full_match/56/0x553d31daaC69a4bfb372482b9400eFcC04B93441/sources/project:/contracts/BEP20Token.sol | See {BEP20-approve}. Requirements: - `spender` cannot be the zero address./ | function approve(address spender, uint256 amount) external returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
| 3,249,455 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.