file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// SPDX-License-Identifier: BUSDL-1.1
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IAssetAllocation} from "contracts/common/Imports.sol";
import {CurveLusdConstants} from "./Constants.sol";
import {
MetaPoolDepositorZap
} f... | The address registry has two important purposes, one which is fairly concrete and another abstract. 1. The registry enables components of the APY.Finance system and external systems to retrieve core addresses reliably even when the functionality may move to a different address. 2. The registry also makes explicit which... | interface IAddressRegistryV2 {
event AddressRegistered(bytes32 id, address _address);
event AddressDeleted(bytes32 id, address _address);
function registerAddress(bytes32 id, address address_) external;
function registerMultipleAddresses(
bytes32[] calldata ids,
address[] calldata add... | 53,156 |
./full_match/5/0x6F33c38298a1D50fdae35af410Bba2D6eF1CFead/sources/lib/revenue-distribution-token/contracts/RevenueDistributionToken.sol | As per https:eips.ethereum.org/EIPS/eip-4626security-considerations, it should round DOWN if it’s calculating the amount of assets to send to a user, given amount of shares returned. | function previewRedeem(uint256 shares_) public view virtual override returns (uint256 assets_) {
assets_ = convertToAssets(shares_);
}
| 7,053,929 |
./full_match/5/0x8D7cB3572B2719cf8e7F383D186DDf93c06b23Aa/sources/src/MembraneRegistry.sol | checks if a given id_ belongs to an instantiated membrane | function isMembrane(uint256 id_) external view returns (bool) {
return (getMembraneById[id_].tokens.length > 0);
}
| 1,933,276 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
//Truffle Imports
import "@chainlink/contracts/src/v0.6/ChainlinkClient.sol";
import "@chainlink/contracts/src/v0.6/vendor/Ownable.sol";
import "@chainlink/contracts/src/v0.6/vendor/SafeMathChainlink.sol";
import "@chainl... | Return All Details about a Influencer Agreement Returns (addess brand, address influencer, int endDate, int budget, int payPerView, enum agreementStatus, int viewCount, int accumulatedPay, enum tokenOption, string mediaLink, string fileHash)/ | function getAgreementDetails() external view returns(address, address, uint256, uint256, uint256, Status,
uint256, uint256, TokenOption, string memory, string memory) {
return (brand, influencer, endDateTime, budget, payPerView, agreementStatus, viewCount, accumulatedPay, tokenVars.tokenOption, medi... | 6,399,076 |
./full_match/1/0xd7C0f19C4dB13F076802AEc732956eedBBafc370/sources/contracts/Dependencies/LiquityMath.sol | _decPow: Exponentiation function for 18-digit decimal base, and integer exponent n. Uses the efficient "exponentiation by squaring" algorithm. O(log(n)) complexity. Called by one function that represent time in units of minutes: 1) TroveManager._calcDecayedBaseRate The exponent is capped to avoid reverting due to overf... | function _decPow(uint256 _base, uint256 _minutes) internal pure returns (uint) {
uint256 y = DECIMAL_PRECISION;
uint256 x = _base;
uint256 n = _minutes;
while (n > 1) {
if (n % 2 == 0) {
x = decMul(x, x);
n = n / 2;
y = ... | 4,892,501 |
/**
*Submitted for verification at Etherscan.io on 2021-05-25
*/
// File: @openzeppelin/contracts/math/SafeMath.sol
pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in... | LastCumulativeHoldersRewardPricePerProperty | function setStorageLastCumulativeHoldersRewardPricePerProperty(
address _property,
uint256 _price
) internal {
eternalStorage().setUint(
getStorageLastCumulativeHoldersRewardPricePerPropertyKey(_property),
_price
);
}
| 2,011,242 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma abicoder v2;
interface IERC677Receiver {
function onTokenTransfer(address _sender, uint _value, bytes calldata _data) external;
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma abicoder v2;
interface ISideToken {
function mint(add... | See {IERC20-transferFrom}. Note that operator and allowance concepts are orthogonal: operators cannot call `transferFrom` (unless they have allowance), and accounts with allowance cannot call `operatorSend` (unless they are operators). Emits {Sent}, {Transfer} and {Approval} events./ | function transferFrom(address holder, address recipient, uint256 amount)
external override(IERC20) returns (bool) {
require(recipient != address(0), "ERC777: transfer to zero address");
require(holder != address(0), "ERC777: transfer from zero address");
address spender = _msgSender();
... | 1,423,177 |
./full_match/5/0x3B95c63382b0C6b0eC49395cCe59DE5d6fd1276F/sources/project_/contracts/erc721a/contracts/ERC721A.sol | Returns the number of tokens burned by or on behalf of `owner`./ | function _numberBurned(address owner) internal view returns (uint256) {
return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY;
}
| 7,080,149 |
/**
*Submitted for verification at Etherscan.io on 2021-08-17
*/
/**
* 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 Wrappers over Solidity's arithmetic oper... | Deposit to sushi masterchef | function stake(
address[] memory tokens,
uint256[] memory values
)
public
checkPause
updateRewards(msg.sender)
{
require(tokens.length == values.length, "count mismatch");
address token;
uint256 stakeAmount;
for (uint256 i = 0; i < t... | 2,254,156 |
pragma solidity ^0.5.0;
/**
* The contractName contract does this and that...
*/
contract rekam_medis_pasien {
//data yang tersimpan
struct riwayat_1{
uint tinggi_badan;
uint berat_badan;
string waktu;
string penunjang;
string diagnosis;
}
struct riwayat_2{
string tatalaksana;
str... | total transaksi bertambahjumlah riwayat addrs bertambah | function tambahRekamMedis(
address _addrs,
uint _tinggi_badan,
uint _berat_badan,
string memory _waktu,
string memory _penunjang,
string memory _diagnosis,
string memory _tatalaksana,
string memory _tindakan,
string memory _pelayanan_lain,
string memory _odontogram,
string memory _persetujuan
)... | 955,886 |
./full_match/4/0xa0c032e28e06f772845B4E753aE115395c848E68/sources/contracts/ERC721Lending.sol | one NFT several times lending is available, while prev lending is ended, thus tokenId is needed. this tokenId is index for offers of collection. tokenAddress is NFTMarketplace Contract address for NFT(ERC721) assuming token transfer is approvedaddress fromOwner = tokenAddress; IERC721(tokenAddress).ownerOf(tokenI... | function offerLoaningNft(address tokenAddress, uint256 tokenId, uint256 durationHours, uint256 initialWorth, uint256 earningGoal) public returns(uint256){
require(initialWorth > 0, 'Lending: Initial token worth must be above 0');
require(earningGoal > 0, 'Lending: Earning goal must be above 0');
require(d... | 12,435,039 |
//SPDX-License-Identifier: UNLICENSED
pragma solidity >0.6.0;
import "../link/link.sol";
import "../IERC20/IERC20.sol";
contract tokenpeg is link {
event Refund(uint256 id, address recipient, uint256 amount, bytes reason);
event Failure(bytes reason);
event Receipt(address recipient, uint256 amount, bytes ... | allows msg.sender to send tokens to another chain amount message recipient message/ | function mintTokens(
uint256 amount,
address recipient,
uint256 id,
bytes memory message
) internal {
bytes memory receipt = message;
try tokenContract.mint(recipient, amount) {
receipt[0] = 0x01;
receipt[0] = 0x00;
emit Failure... | 12,832,546 |
// SPDX-License-Identifier: None
pragma solidity >=0.7.5;
pragma abicoder v2;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./Adminable.sol";
import "./lib/Strings.sol";
import "./ModuleRe... | Executes multi-hop trades to get the best result fromToken Start token address toToken Target token address fromAmount The initial amount of fromToken to start trading with trades Array of encoded trades that are atomically executed finalAmountMin The minimum expected output after all trades have been executed re... | function executeTrades(
address fromToken,
address toToken,
uint fromAmount,
TradeFormat[] calldata trades,
uint finalAmountMin,
address recipient
) public payable {
uint initialBalance = _getTokenBalance(toToken);
_transferFromOrWrap(fromToken, _m... | 5,464,467 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./OwnerRole.sol";
/// @title BurnerRole Contract
/// @notice Only administrators can update the burner roles
/// @dev Keeps track of burners and can check if an account is authorized
contract BurnerRole is OwnerRole {
event BurnerAdded(address index... | Only administrators should be allowed to update this Adds an address as a burner account The address that is guaranteed burner authorization | function _addBurner(address account) internal {
_add(_burners, account);
emit BurnerAdded(account, msg.sender);
}
| 5,361,958 |
./full_match/80001/0xd6dA095745B22232BE1a8c7a35B7e29247421826/sources/contracts/OreSmelting.sol | First, burn the access keys from the user's wallet here we can add other conditions to the amount that can be claimed Use the rest of the inherited claim function logic | function _transferTokensOnClaim(
address _receiver,
uint256 _tokenId,
uint256 _quantity
) internal override {
oreNftCollection.burn(
);
super._transferTokensOnClaim(_receiver, _tokenId, _quantity);
}
| 5,650,067 |
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.11;
import "./Common.sol";
import "./Merkle.sol";
import {IMessageRecipient} from "../interfaces/IMessageRecipient.sol";
import "@summa-tx/memview-sol/contracts/TypedMemView.sol";
/**
* @title Replica
* @author Celo Labs Inc.
* @notice Contract r... | Attempts to prove the validity of message given its leaf, the merkle proof of inclusion for the leaf, and the index of the leaf. Reverts if message's MessageStatus != None (i.e. if message was already proven or processed) _leaf Leaf of message to prove _proof Merkle proof of inclusion for leaf _index Index of leaf ... | function prove(
bytes32 _leaf,
bytes32[32] calldata _proof,
uint256 _index
) public returns (bool) {
require(messages[_leaf] == MessageStatus.None, "!MessageStatus.None");
bytes32 _actual = MerkleLib.branchRoot(_leaf, _proof, _index);
if (acceptableRoot(_actual))... | 1,038,389 |
pragma solidity ^0.4.23;
contract ERC20Interface {
function totalSupply() public view returns (uint);
function balanceOf(address _owner) public view returns (uint balance);
function transfer(address _to, uint _value) public returns (bool success);
function transferFrom(address _from, address _to, uint ... | Transfer token to a specified address | function transfer(address _to, uint _value) public returns (bool success) {
require(balances[msg.sender] >= _value);
return transferMain(msg.sender, _to, _value);
}
| 7,952,846 |
pragma solidity 0.6.6;
import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts-ethereum-package/cont... | Update critical strategy smart contracts. EMERGENCY ONLY. Bad strategies can steal funds. _addStrat The new add strategy contract. _liqStrat The new liquidate strategy contract. | function setCriticalStrategies(IStrategy _addStrat, IStrategy _liqStrat) external onlyOwner {
addStrat = _addStrat;
liqStrat = _liqStrat;
}
| 1,803,110 |
./full_match/137/0xBC225699c4899CF85894902CD947BDc02b42d610/sources/UExchangeRouter02.sol | SWAP requires the initial amount to have already been sent to the first pair | function _swap(uint[] memory amounts, address[] memory path, address _to) internal virtual {
for (uint i; i < path.length - 1; i++) {
(address input, address output) = (path[i], path[i + 1]);
(address token0,) = UExchangeLibrary.sortTokens(input, output);
uint amountOut =... | 4,758,423 |
./full_match/1/0x1bB602b7a2ef2aECBA8FE3Df4b501C4C567B697d/sources/lib/ERC721A/contracts/ERC721A.sol | Returns the packed ownership data of `tokenId`./ If not burned. Invariant: There will always be an initialized ownership slot (i.e. `ownership.addr != address(0) && ownership.burned == false`) before an unintialized ownership slot (i.e. `ownership.addr == address(0) && ownership.burned == false`) Hence, `curr` will not... | function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) {
uint256 curr = tokenId;
unchecked {
if (_startTokenId() <= curr) {
if (curr < _currentIndex) {
uint256 packed = _packedOwnerships[curr];
if (packed & _BI... | 2,948,497 |
./partial_match/1/0x0cC7981b0D2c3578C4C6Fb6B8312f40104953769/sources/MUSKTRIPS.sol | Declare the customMin function | function customMin(uint256 a, uint256 b) private pure returns (uint256) {
return a < b ? a : b;
}
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address... | 9,262,552 |
./partial_match/1/0x0160fB79E65bEC0f16D750098951C26950ADc5Ed/sources/OpenZeppelinOwnableAndERC721.sol | Initializes the contract setting the deployer as the initial owner./ | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
}
pragma solidity ^0.8.0;
constructor() {
_transferOwnership(_msgSender());
}
| 2,744,491 |
./full_match/4/0x12f20E573d11Acad3bFdc95d84Ce15c58575685d/sources/browser/Potato.sol | Return amount of tokens that {account} gets during potato yields Used both internally and externally to calculate the potato yield amount account is an address of token holder to calculate for return amount of tokens that player could get/ The potato yield is not a part of total supply, since it was moved out of bala... | function potatoYieldOwing (address account) public view returns(uint256) {
Account memory _account = _accounts[account];
uint256 newpotatoYield = totalPotatoYield.sub(_account.lastPotatoYield);
uint256 proportion = _account.balance.mul(newpotatoYield);
uint256 supply = _totalSupply... | 13,366,777 |
./full_match/5/0x58a44849E4bA7B5273ad8D790ff92aa57BE305D7/sources/contracts/CrowdFunding.sol | create an array of allCampaignsloop and populate campign var above | function getCampaigns() public view returns (Campaign[] memory){
Campaign[] memory allCampaigns = new Campaign[](numberOfCampaigns);
for(uint i = 0; i < numberOfCampaigns; i++){
Campaign storage item = campaigns[i];
allCampaigns[i] = item;
}
return allCam... | 1,918,599 |
./partial_match/1/0x3656c1a7f1c05900f03E279358C7141617d4473a/sources/BULLKING.sol | / Dependency file: @openzeppelin/contracts/token/ERC20/IERC20.sol SPDX-License-Identifier: MIT pragma solidity ^0.8.0; Interface of the ERC20 standard as defined in the EIP./ | interface BEP20 {
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 (uint25... | 9,320,260 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract InkersHKCollection is ERC1155, Ow... | reserve the next two slots for copies and printed copies | function generateNewOriginal() payable public whenNotPaused returns (uint256) {
uint256 nextOriginalPrice = this.getNextOriginalPrice();
require(
msg.value == nextOriginalPrice,
append("Must pay enought to mint a new original: ", uint2str(nextOriginalPrice))
);
... | 12,052,247 |
./full_match/3/0xc9Ee84d508b6d038a9f66b29b86cfe1F4DE1ae39/sources/contracts/Alloy.sol | Mint a token redeemable only by a user who own the specified array of token Ids. | function mintAlloy(uint256[] memory ids, string memory URI)
public
onlyOwner
returns (uint256)
{
_tokenIds.increment();
uint256 newId = _tokenIds.current();
_safeMint(msg.sender, newId);
_setTokenURI(newId, URI);
_setRequirements(newId, ids);
... | 8,160,550 |
./full_match/1/0x82a7b5842085f434c6584A8c44b6A1C15c25a512/sources/contracts/Pool.sol | Get redemption account Account tick Tick redemptionId Redemption ID return Redemption/ | function redemptions(
address account,
uint128 tick,
uint128 redemptionId
) external view returns (Redemption memory) {
return _deposits[account][tick].redemptions[redemptionId];
}
| 9,659,154 |
/**
*Submitted for verification at Etherscan.io on 2022-01-30
*/
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.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 an... | 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 {ERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address./ | function increaseAllowance(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(amount));
return true;
}
| 10,692,411 |
pragma solidity ^0.5.0;
import "./StarToken.sol";
import "./DaiToken.sol";
contract TokenFarm {
//All code goes here...
string public name = "Star Token Farm";
StarToken public starToken;
DaiToken public daiToken;
address owner;
address[] public stakers;
mapping(address => uint... | Require amount greater than 0 Transfer Mock Dai tokens to this contract for staking Update staking balance Add user to stakers array only if they haven't staked already | function stakeTokens(uint _amount) public {
require(_amount >0, "amount cannot be 0");
daiToken.transferFrom(msg.sender, address(this), _amount);
stakingBalance[msg.sender] += _amount;
if(!hasStaked[msg.sender]){
stakers.push(msg.sender);
}
has... | 12,710,580 |
./full_match/44787/0x7DE829829E8cC51dDD8e15D77DbC3f406fFA1bcC/sources/_aave/core-v3/contracts/interfaces/ICreditDelegationToken.sol | ICreditDelegationToken Aave Defines the basic interface for a token supporting credit delegation./ | interface ICreditDelegationToken {
event BorrowAllowanceDelegated(
address indexed fromUser,
address indexed toUser,
address indexed asset,
uint256 amount
);
function approveDelegation(address delegatee, uint256 amount) external;
function borrowAllowance(address fromUser, address toUser) exter... | 13,274,813 |
./full_match/1/0xcE9b49b0d4FE456aD6E4a1b7e4bBdD0699400Ef9/sources/src/vaults/borrowing/BorrowingVaultUpgradeable.sol | @inheritdoc IVaultUpgradeable | function previewMintDebt(uint256 shares) public view override returns (uint256 debt) {
return _convertToDebt(shares, Math.Rounding.Down);
}
| 2,939,920 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@o... | make sure voucher redemption period is active make sure signature is valid and get the address of the signer make sure caller is the redeemer make sure voucher has not expired. make sure that the signer is the designated signer make sure that the redeemer is paying enough to cover the buyer's cost make sure voucher has... | function redeemVoucher(uint256 amount, BlankNFTVoucher calldata voucher)
public
payable
returns (uint256[] memory)
{
require(active, "Voucher redemption is not currently active");
address signer = _verify(voucher);
require(msg.sender == voucher.redeemerAddress, "V... | 11,899,092 |
./full_match/4/0x8436267B8b0f3051641d4ec453307e94165991AB/sources/browser/1155-clone-factory.sol | Creates `amount` new tokens for `to`, of token type `id`. See {ERC1155-_mint}. Requirements: - the caller must have the `MINTER_ROLE`./ | function mint(address to, uint256 id, uint256 amount, bytes memory data) public virtual {
require(hasRole(MINTER_ROLE, _msgSender()), "ERC1155License: must have minter role to mint");
_mint(to, id, amount, data);
}
| 807,670 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.0;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceO... | DEPRECATED but still backwards compatible -------------------------------------------- -------------------------------------------- | interface ISavingsContractV4 is IERC4626Vault {
function redeem(uint256 _amount) external returns (uint256 massetReturned);
function depositSavings(uint256 _amount, address _beneficiary)
external
function redeemAndUnwrap(
uint256 _amount,
bool _isCreditAmt,
uint2... | 11,800,722 |
./partial_match/56/0x9D7fc625957e42f2095437111dAa42b2244B997F/sources/VSafeVaultController.sol | forward to vault and then call earnExtra() by its governance | function earn(address _token, uint _amount) external override onlyAuthorized {
address _strategy = getBestStrategy();
if (_strategy == address(0) || IStrategy(_strategy).baseToken() != _token) {
IERC20(_token).safeTransfer(address(vault), _amount);
IERC20(_token).safeTransfer... | 11,211,118 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.9;
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
import "../interfaces/IStrategy.sol";
import "../interfaces/IVaultStrategyDataStore.sol";
import "../interfaces/IVault.sol";
import "./role... | returns the maximum value that the strategy can borrow from the vault per harvest. _vault the address of the vault _strategy the address of the strategy return maximum value the strategy should borrow from the vault per harvest | function strategyMaxDebtPerHarvest(address _vault, address _strategy) external view returns (uint256) {
require(_vault != address(0) && _strategy != address(0), "invalid address");
if (_strategyExists(_vault, _strategy)) {
return strategies[_vault][_strategy].maxDebtPerHarvest;
return type(uint256... | 12,031,986 |
pragma solidity 0.5.16;
// INTERFACE
interface IERC20Mintable {
function transfer(address _to, uint256 _value) external returns (bool);
function transferFrom(
address _from,
address _to,
uint256 _value
) external returns (bool);
function mint(address _to, uint256 _value) exter... | return Returns current liquidity providers reward address./ | function liquidityProviderAddress() public view returns (address) {
AddressParam memory param = liquidityProviderAddressParam;
return param.newValue;
}
| 6,261,591 |
./full_match/1/0xE344921ec4A8a9E3B41F7BCD678F4bcB77922bFB/sources/contracts/OnChainBunnies.sol | Creates the tokenURI which contains the name, description, generated SVG image and token traits/ | function tokenURI(uint256 tokenId)
public
view
override
returns (string memory)
{
require(_exists(tokenId), "Non-Existing");
string memory svgData = renderTokenById(tokenId);
string memory traits = getTraits(tokenId);
string memory json = Base64.en... | 2,959,982 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
pragma abicoder v2;
import "./TradingAction.sol";
import "./ActionGuards.sol";
import "./nTokenMintAction.sol";
import "./nTokenRedeemAction.sol";
import "../SettleAssetsExternal.sol";
import "../FreeCollateralExternal.sol";
import "../../math/SafeInt256... | Returns the next settle time for the nToken which is 1 quarter away | function getNextSettleTime(nTokenPortfolio memory nToken) internal pure returns (uint256) {
if (nToken.lastInitializedTime == 0) return 0;
return DateTime.getReferenceTime(nToken.lastInitializedTime) + Constants.QUARTER;
}
| 12,680 |
./full_match/1/0xc0163F657b48Cd5058b256334c002e4D02Fdc3C4/sources/EsusuAdapter.sol | set _isActive to false Send yDai shares to the new contract and halt operations of this contract | function DepricateContract(
address newEsusuAdapterContract,
string calldata reason
) external onlyOwner {
_isActive = false;
uint256 yDaiSharesBalance = _yDai.balanceOf(address(this));
_yDai.safeTransfer(newEsusuAdapterContract, yDaiSharesBalance);
... | 8,304,127 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import "./libs/SafeBEP20.sol";
import "./libs/BEP20.sol";
// MarsToken with Governance.
contract MarsToken is BEP20('Mars', 'XMS') {
using SafeMath for uint256;
address public minter;
constructor () public {
uint256 initAmout = 13000000;... | Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). | function mint(address _to, uint256 _amount) public {
require(_to != address(0), "zero address");
require(msg.sender == minter, "not minter");
_mint(_to, _amount);
}
| 5,353,001 |
./partial_match/1/0x891696CCa87aa2f175124b412198c23D54680E31/sources/NFTWinner.sol | Returns the account approved for `tokenId` token. Requirements: - `tokenId` must exist./ | function getApproved(uint256 tokenId)
public
view
virtual
override
returns (address)
{
if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
return _tokenApprovals[tokenId].value;
}
| 3,585,520 |
contract Multiowned {
// TYPES
// struct for the status of a pending operation.
struct PendingState {
uint yetNeeded;
uint ownersDone;
uint index;
}
// EVENT
// this contract only has five types of events: it can accept a confirmation, in which case
... | when the voting is complate, hasConfirmed return falseif the voteing is ongoing, it returns whether _owner has voted the _operation make sure they're an owner determine the bit to set for this owner. | function hasConfirmed(bytes32 _operation, address _owner) view public returns (bool) {
var pending = m_pending[_operation];
uint ownerIndex = m_ownerIndex[uint(_owner)];
if (ownerIndex == 0) return false;
uint ownerIndexBit = 2**ownerIndex;
return !(pending.ownersDone & own... | 13,041,480 |
./full_match/1/0x81E11c4701C5189b0122ef42DaF1fF3d453D968E/sources/contracts/wallet/base/ModuleManager.sol | Allows to remove a module from the whitelist. This can only be done via a Safe transaction. Disables the module `module` for the Safe. prevModule Module that pointed to the module to be removed in the linked list module Module to be removed. Validate module address and check that it corresponds to module index. | function disableModule(
address prevModule,
address module
) public authorized {
require(module != address(0) && module != SENTINEL_MODULES, "GS101");
require(modules[prevModule] == module, "GS103");
modules[prevModule] = modules[module];
modules[module] = address... | 8,301,812 |
pragma solidity 0.4.19;
import "./utils/Secured.sol";
contract Store is Secured
{
/**** Storage Types *******/
mapping(bytes32 => uint256) private uintStorage;
mapping(bytes32 => string) private stringStorage;
mapping(bytes32 => address) private addressStorage;
mapping(bytes32 => bytes)... | _key The key for the record | function setInt(bytes32 _key, int _value) onlyAuthorized external
{
intStorage[_key] = _value;
}
| 12,567,421 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { Lib_PredeployAddresses } from "../libraries/Lib_PredeployAddresses.sol";
import { L1Block } from "../L2/L1Block.sol";
/**
* @custom:proxied
* @custom:predeploy 0x420000000000000000... | Retrieves the latest known L1 base fee. return Latest known L1 base fee./ | function l1BaseFee() public view returns (uint256) {
return L1Block(Lib_PredeployAddresses.L1_BLOCK_ATTRIBUTES).basefee();
}
| 12,904,083 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import "sol-temple/src/tokens/ERC721.sol";
import "sol-temple/src/utils/Auth.sol";
import "sol-temple/src/utils/Pausable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
/**
* @titl... | Claim one or more tokens for whitelisted user. | function claimWhitelist(uint256 amount_, bytes32[] memory proof_)
external
payable
{
uint256 supply = totalSupply();
require(supply + amount_ <= MAX_SUPPLY, "Max supply exceeded");
if (msg.sender != owner()) {
require(saleState == 1, "Whitelist sale is not open");
require(
am... | 5,470,632 |
./partial_match/42/0x3AC1B1628913631C03710de0cFbCFD7cea1A8b4a/sources/ICO.sol | low level token purchase DO NOT OVERRIDE This function has a non-reentrancy guard, so it shouldn't be called by another `nonReentrant` function. beneficiary Recipient of the token purchase/ nonReentrant payable view returns(uint256) calculate token amount to be created update state _processPurchase not working emit... | function buyTokens(address beneficiary) public nonReentrant payable{
uint256 weiAmount = 1;
_preValidatePurchase(beneficiary, weiAmount);
uint256 tokens = _getTokenAmount(weiAmount);
_weiRaised = _weiRaised.add(weiAmount);
_token.safeTransfer(beneficiary, tokens);
}
| 8,958,753 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
/// On Tupac's Soul
import "./ERC721A.sol";
import "./Payable.sol";
contract FoodlesClubToken is ERC721A, Payable {
using Strings for uint256;
// Token values incremented for gas efficiency
uint256 private maxSalePlusOne = 5001;
uint256 privat... | Update maximum number of tokens for sale/ | function setMaxSale(uint256 maxSale) external onlyOwner {
require(maxSale + 1 < maxSalePlusOne, "FoodlesClubToken: Can only reduce supply");
maxSalePlusOne = maxSale + 1;
}
| 12,229,520 |
./full_match/4/0xBb3150D53953d616f895EAcea29C6E304E12461B/sources/browser/kp8r.sol | safely begin the governance transfer process. The new governance address, must accept the transfer. / | function transferGovernance(address _governance) public {
require(msg.sender == governance, "!governance");
governancePending = _governance;
}
| 659,396 |
pragma solidity 0.5.9;
/**
* https://rekt.fyi
*
* Mock the performance of your friend's ETH stack by sending them a REKT token, and add a bounty to it.
*
* REKT tokens are non-transferrable. Holders can only burn the token and collect the bounty once their
* ETH balance is m times higher or their ETH i... | Sets a new Medianizer address in case of MakerDAO upgrades. _addr The new address. | function setNewMedianizer(address _addr) external onlyOwner {
require(address(_addr) != address(0), "Invalid address");
medianizerAddress = _addr;
oracle = Medianizer(medianizerAddress);
bytes32 price;
bool ok;
(price, ok) = oracle.peek();
require(ok, "Pricefe... | 1,033,125 |
// File: openzeppelin\contracts\utils\introspection\IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of con... | Sets Taxes, is limited by MaxTax(49%) to make it impossible to create honeypot | function TeamSetTaxes(uint8 distributedTaxes, uint8 liquidityTaxes,uint8 buyTax, uint8 sellTax, uint8 transferTax) public onlyTeam{
uint8 totalTax=liquidityTaxes+distributedTaxes;
require(totalTax==100, "liq+distributed needs to equal 100%");
require(buyTax<=MaxTax&&sellTax<=MaxTax&&transfer... | 11,949,426 |
./full_match/97/0xAFF60E6d6119D7807247809B4D39995dA2E0eF92/sources/project:/contracts/tokens/CELLIT.sol | Moves amount tokens from the caller's account to recipient. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event. recipient address of user amount amount of token that you want to send/ | function transfer(address recipient, uint amount) external override whenNotPaused returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
| 3,274,483 |
./full_match/5/0x06775aB363873FcCf9f4E5Bb15f6216235Adb10F/sources/_openzeppelin/contracts-upgradeable/utils/CheckpointsUpgradeable.sol | Pushes a value onto a History, by updating the latest value using binary operation `op`. The new value will be set to `op(latest, delta)`. Returns previous value and new value./ | function push(
History storage self,
function(uint256, uint256) view returns (uint256) op,
uint256 delta
) internal returns (uint256, uint256) {
return push(self, op(latest(self), delta));
}
| 1,855,181 |
./full_match/43113/0xE2bB15cC65dADC1Ca22540cC5024f87EE980edb6/sources/contracts/minita_yak.sol | YAK_token.approve(address(joeRouter), YAK_token.balanceOf(address(this))); otherToken.transfer(tx.origin, amountReceived.sub(amountRequired)); | function joeCall(
address _sender,
uint _amount1,
bytes calldata _data
) external {
msg.sender == 0x85e355d284082D2E8C5BDb88a3D9D1c1d0347bB5;
address[] memory pathMiniYakWavax = new address[](2);
uint256 amountRequired = JoeLibrary.getAmountsIn(joeFactory, amountTok... | 13,199,003 |
pragma solidity ^0.4.10;
/**
* Hodld DAO and ERC20 token
* Author: CurrencyTycoon on GitHub
* License: MIT
* Date: 2017
*
* Deploy with the following args:
* 0, "Hodl DAO", 18, "HODL"
*
*/
contract HodlDAO {
/* ERC20 Public variables of the token */
string public version = 'HDAO 0.2';
string p... | Reward is based on the amount held, relative to total supply of tokens./ | function calculateReward(uint256 v) constant returns (uint256) {
uint256 reward = 0;
if (feePot > 0) {
reward = v / totalSupply * feePot;
}
return reward;
}
| 7,273,971 |
// 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 amount o... | WithdrawAll sends 'want' to 'vault' | function withdrawAll(address _strategy) external {
require(msg.sender == strategist || msg.sender == governance, "!strategist");
IMultiVaultStrategy(_strategy).withdrawAll();
}
| 5,715,475 |
./full_match/80001/0xc217357dB83Edb0E6ECc45D59B8ebd4A11cb0Dec/sources/project_/contracts/Amberfi/Market.sol | Get auction IDs in an offset with index `offset_` for `length_` length offset_ (uint256) Offset index length_ (uint256) Length of an offset return auctionIds (uint256[] memory) Auction IDs return nextOffset (uint256) Next offset index/ | function getAuctions(uint256 offset_, uint256 length_)
external
view
returns (uint256[] memory auctionIds, uint256 nextOffset)
{
uint256 length = getAuctionsCount();
if (length_ > length - offset_) {
length_ = length - offset_;
}
auctionIds =... | 848,017 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <=0.7.3;
import { Lib_MerkleTrie } from "./Lib_MerkleTrie.sol";
import { Lib_BytesUtils } from "./Lib_BytesUtils.sol";
import { Lib_RLPReader } from "./Lib_RLPReader.sol";
contract Optimistic_Rollups {
bytes32 public stateRoot;
bytes32 public prev_... | Deposits funds so they can be used in layer2we must verity stateRoot is valid | function deposit() external payable can_exit_optimism() {
last_deposits[msg.sender][stateRoot] += msg.value;
emit New_Deposit(msg.sender, stateRoot, msg.value);
}
| 1,767,023 |
./full_match/56/0x1C5C0E1B96E7ADDC14AED3688E547A6103A244d9/sources/project_/contracts/Router1.sol | Set whether anti-whale is enabled. e Whether anti-whale is enabled./ Update whether anti-whale is enabled. | function setAntiWhaleEnabled(bool e) external onlyOwner {
_isAntiWhaleEnabled = e;
}
| 3,227,267 |
pragma solidity 0.4.24;
import "./Authorizable.sol";
import "./EightExToken.sol";
import "./base/math/SafeMath.sol";
/** @title Stake Contract - Processors stake tokens to claim transactions */
/** @author Kerman Kohli - <kerman@8xprotocol.com> */
contract StakeContract is Authorizable {
using SafeMath for uint... | Check how many tokens the processor has in total at this moment. _staker is the processor address. _tokenAddress token for which to stake for./ | function getTotalStake(address _staker, address _tokenAddress)
public
view
returns (uint total)
{
return userStakes[_staker][_tokenAddress].total;
}
| 7,328,121 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
import "@openzeppelin/contracts/access/Ownable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there are a number of accounts (the admins) that can be granted exclusive access to
* specific functions.
*
* B... | Returns the address of the current owner./ | function isAdmin(address addressForTesting)
public
view
virtual
onlyAdmin
returns (bool admin)
{
return _admins[addressForTesting];
}
| 5,517,981 |
./partial_match/56/0xDD99f4e7a32B9e289352D9f20C5a0e8c0c4edbFB/sources/uTradeCompounder.sol | 0x0e430629 <- add liq0x48ccbc2e | interface uTrade {
function Buy(address who) payable external;
function Sell(uint256 _tokensSold) external;
function balanceOf(address account) external view returns (uint256);
function transferFrom(address _from, address _to, uint256 _value) external returns(bool);
function allowance(address o... | 11,228,865 |
./partial_match/80001/0xD37583FC57dA40A5fA8d33Ce9ab13C430E39DBBA/sources/ERC721CollectionV2.sol | Set whether the collection can be editable or not. This property is used off-chain to check whether the items of the collection can be updated or not _value - Value to set/ | function setEditable(bool _value) external onlyOwner {
require(isEditable != _value, "BCV2#setEditable: VALUE_IS_THE_SAME");
emit SetEditable(isEditable, _value);
isEditable = _value;
}
| 8,819,550 |
./full_match/3/0xdd827aBd4d6312EF53d98cc159F8A34C5B480A07/sources/contracts/Pinu.sol | Returns the final amount for the tax.important This function only works with values based on token supply and NOT reflection supply./ | function _calculateTax(uint256 amount) private view returns (uint256) {
return _calculateFee(amount, taxFee);
}
| 14,201,101 |
./full_match/11155111/0x0E025D35eD0E243B8939924E7805f345495B9dF4/sources/project:/contracts/tokenLogic/TokenLogic.sol | Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens./ Calculate the burning fees Overflow not possible: amount <= accountBalance <= totalSupply... | function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amo... | 3,807,985 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma abicoder v2;
import "@chainlink/contracts@0.2.2/src/v0.8/interfaces/LinkTokenInterface.sol";
import "@chainlink/contracts@0.2.2/src/v0.8/VRFRequestIDBase.sol";
import "@chainlink/contracts@0.2.2/src/v0.8/VRFConsumerBase.sol";
import "@openzeppelin/contrac... | Change the token's image URI | function setImageURI(uint _tokenId, string memory _imageURI) public {
require(ownerOf(_tokenId) == msg.sender, "You do not own this token.");
tokens[_tokenId].imageURI = _imageURI;
}
| 938,738 |
// SPDX-License-Identifier: MIT
// Telegram : https://t.me/sydnova_eth
pragma solidity 0.8.9;
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure re... | exclude from paying fees or having max transaction amount | constructor() ERC20("SYDNOVA", "SYD") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_unisw... | 6,284,297 |
pragma solidity ^0.4.23;
contract ToadFarmer {
uint256 public EGGS_TO_HATCH_1TOAD = 43200; // Half a day's worth of seconds to hatch
uint256 TADPOLE = 10000;
uint256 PSNHTOAD = 5000;
bool public initialized = false;
address public ceoAddress;
mapping (address => uint256) public hatcheryToad... | Trade balancing algorithm (TADPOLEbigship) / (PSNHTOAD+((TADPOLEstarboards+PSNHTOADriggert)/riggert)); | function calculateTrade(uint256 riggert, uint256 starboards, uint256 bigship) public view returns(uint256) {
return SafeMath.div(SafeMath.mul(TADPOLE, bigship),
SafeMath.add(PSNHTOAD, SafeMath.div(SafeMath.add(SafeMath.mul(TADPOLE, starboards),SafeMath.mul(PSNHTOAD, riggert)), riggert)));
}
| 2,429,932 |
pragma solidity ^0.5.0;
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint25... | File: contracts/assettoken/interfaces/IGlobalIndex.sol | interface IGlobalIndex {
function getControllerAddress() external view returns (address);
function setControllerAddress(address _newControllerAddress) external;
}
| 6,461,926 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
// -------------
// FANCY BEE DAO
//
// This DAO esponsible for managing the treasury and all other contracts including:
// - BeeNFT, HiveNFT, OutfitNFT and FancyBsGov (ERC20)
//
// All operations that involve a royalty toe the DAO must be mediated
// thought t... | Added from Marco's repo | function mintToken(address owner, string memory metadataURI)
public
returns (uint256)
{
require( balanceOf(msg.sender) == 0, "Sorry, only one bee per person." );
require( totalSupply() < totalBeeSupply, "Sorry only 5 are available at this time. ");
_tokenIds.increment();
... | 12,826,130 |
pragma solidity ^0.4.13;
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function mul(uint ... | Returns total supply of issued tokens / | function totalSupply() constant returns (uint256) {
return supply;
}
| 12,730,365 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma abicoder v2;
interface IERC677Receiver {
function onTokenTransfer(address _sender, uint _value, bytes calldata _data) external;
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma abicoder v2;
interface ISideToken {
function mint(add... | See {IERC20-allowance}. Note that operator and allowance concepts are orthogonal: operators may not have allowance, and accounts with allowance may not be operators themselves./ | function allowance(address holder, address spender)
public view override(IERC20) returns (uint256) {
return _allowances[holder][spender];
}
| 1,423,175 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "./UniswapV2/UniswapV2Router02.sol";
import '../vendors/interfaces/IPactSwapRouter.sol';
import '../vendors/interfaces/IPactSwapFactory.sol';
import '../vendors/interfaces/IWETH.sol';
import '../vendors/libraries/UniswapV2Library.sol';
import '../vendors/... | SPDX-License-Identifier: MIT | interface IUniswapV2Router01 {
function factory() external view returns (address);
function WETH() external view returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBM... | 1,345,200 |
pragma solidity 0.8.0;
// SPDX-License-Identifier: MIT
import "./InscribeInterface.sol";
import "./InscribeMetaDataInterface.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
contract In... | Verifies if the base URI at the specified Id exists/ | function _baseURIExists(BaseURI memory uri) internal pure returns (bool) {
return uri.owner != address(0);
}
| 4,800,492 |
// SPDX-License-Identifier: MIT
/*
..:---========--::..
.-=======================-:.
:===============================-:
.=======================-=============-.
:===========-:. :======: .:-=... | The airdrop function which will be permanently disabled once all tokens have been airdropped./ | function airdrop(address[] memory _to, uint256[][] memory _tokenIds)
public
onlyOwner
{
require(
!airdropPermanentlyDisabled,
"Once the airdrop is disabled, the function can never be called again."
);
for (uint256 i = 0; i < _to.length; i++) {
... | 11,942,754 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import "../interfaces/AggregatorValidatorInterface.sol";
import "../interfaces/TypeAndVersionInterface.sol";
import "../interfaces/AccessControllerInterface.sol";
import "../SimpleWriteAccessController.sol";
/* dev dependencies - to be re/moved after audit */
im... | withdraws all funds availbale in this contract to the address specified only owner can call this to address where to send the funds/ | function withdrawFundsTo(
address payable to
)
external
onlyOwner()
{
to.transfer(address(this).balance);
}
| 6,451,171 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
// This is only kept for backward compatability / upgrading
import {OwnableUpgradeable} from "../oz/access/OwnableUpgradeable.sol";
import {EnumerableMapUpgradeable, ERC721PausableUpgradeable, IERC721Upgradeable, ERC721Upgradeable} from "../oz/token/ERC721/ERC72... | See {IERC721-setApprovalForAll}./ | function setApprovalForAll(address operator, bool approved)
public
virtual
override
{
require(operator != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
| 143,831 |
./full_match/80001/0xdBAf7190865A37E0E92e1554807CeA075eec3174/sources/contracts/Edition.sol | Updates the external_url field in the metadata can be updated by the owner regardless of the grace period log the current external url | function setExternalUrl(string calldata _externalUrl) public onlyOwner {
emit ExternalUrlUpdated(externalUrl, _externalUrl);
externalUrl = _externalUrl;
}
| 873,673 |
./full_match/80001/0xc04e87bCd09B1821db562fc2f5748DD193713a67/sources/_superfluid-finance/ethereum-contracts/contracts/apps/CFAv1Library.sol | Create/update/delete flow with context cfaLibrary The cfaLibrary storage variable ctx Context bytes (see ISuperfluid.sol for Context struct) receiver The receiver of the flow token The token to flow flowRate The desired flowRate/ | function flowWithCtx(
InitData storage cfaLibrary,
bytes memory ctx,
address receiver,
ISuperfluidToken token,
int96 flowRate
) internal returns (bytes memory newCtx) {
if ( flowRate == int96(0) ) {
return deleteFlowWithCtx(cfaLibrary, ctx, address(thi... | 9,464,115 |
./partial_match/1/0x2101b79baE6B9BA590Aa5960F0ecBA2320968a60/sources/HalfPepe.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Half Pepe", "PEPE0.5") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uni... | 9,400,820 |
./full_match/1/0xb867dF3efF1B234CA08B7D0d85Fb51Fd25C2c2d0/sources/contracts/v2/strategies/RamosStrategy.sol | The latest checkpoint of each asset balance this strategy holds, and the current debt. This will be used to report equity performance: `sum(asset value in STABLE) - debt` The conversion of each asset price into the stable token (eg DAI) will be done off-chain The asset value may be stale at any point in time, dependin... | function latestAssetBalances() public override view returns (
AssetBalance[] memory assetBalances
) {
(,, uint256 quoteTokenBalance) = ramos.positions();
assetBalances = new AssetBalance[](1);
assetBalances[0] = AssetBalance({
asset: address(quoteToken),
... | 3,120,043 |
./full_match/11155111/0x518D3f7281d8686512Fa680696922Ad3394D1d82/sources/contracts/EHealth.sol | Function for doctors to access patient data and provide suggestions | function provideMedicalSuggestion(
address _patientAddress,
address _doctorAddress,
string memory _suggestion
) public {
require(bytes(_suggestion).length > 0, "Suggestion is required");
require(
_containsPatient(_doctorAddress, _patientAddress),
"You are not authorized to access thi... | 3,794,711 |
pragma solidity ^0.4.13;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
require(c / a == b);
return c;
}
... | require(token.totalSupply >= value && value > 0);get user approve the contract quotado transferFromrecord the amount of local platform turn out require(token.totalSupply >= lockBalance);trigger Lock | function lock(bytes32 toPlatform, address toAccount, uint value) external payable {
require(admin.status == 2 || admin.status == 3);
require(xcPlugin.getStatus());
require(xcPlugin.existPlatform(toPlatform));
require(toAccount != address(0));
require(value > 0);
... | 14,619,498 |
./partial_match/1/0xFFFD3327d030160cddBe99c1b3447EcC3b413856/sources/EthSmart.sol | RECOMMENDED GAS LIMIT: 300 000 (90755 calculated by myetherwallet)/ Admins wallets adresses:/ deposit and withdrew counter for website:/ fee split:/ investors dividends:investors referrer program | function() payable external {
uint256 referralPercent = msg.value.mul(10).div(100);
uint256 advertisementPercent = msg.value.mul(7).div(100);
uint256 developerPercent = msg.value.mul(3).div(100);
referralAddress.transfer(referralPercent);
advertisementAddress.transfer(advertisementPercent);
dev... | 3,944,582 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
interface IUniswap {
// To convert DAI to ETH
function SWAPEXACTTOKENSFORETH436(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[]... | inject NONSTANDARD NAMING | function MINT570 ( uint256 mintAmount ) external returns ( uint256 ); | 977,143 |
pragma solidity ^0.4.0;
contract Marketplace {
bool completed;
uint256 priceTag;
address sellerAddress;
address ownerAddress;
event Transfer(address _address, uint256 _sent);
event Refund(address _address, uint256 _overpaidAmt);
event Status(bool _completed, uint256 _remainingAmt);
... | buyer initiate contract to buy from seller. | function Marketplace(address addr, uint256 price) public {
require(price > 0);
completed = false;
ownerAddress = msg.sender;
priceTag = price;
sellerAddress = addr;
}
| 6,444,075 |
./partial_match/1/0x7119e8fe4a050CC267d5830F99adb309430F8a85/sources/Mogladys.sol | See {IERC721Enumerable-tokenByIndex}./ | function tokenByIndex(
uint256 index
) public view virtual override returns (uint256) {
(uint256 tokenId, ) = _tokenOwners.at(index);
return tokenId;
}
| 3,717,335 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.7.0;
pragma experimental ABIEncoderV2;
// File: witnet-ethereum-block-relay/contracts/BlockRelayInterface.sol
/**
* @title Block Relay Interface
* @notice Interface of a Block Relay to a Witnet network
* It defines how to interact with the Block Relay in o... | Read and consume the next 32 bytes from the buffer as an `uint256`. return The `uint256` value of the next 32 bytes in the buffer counting from the cursor position. _buffer An instance of `BufferLib.Buffer`./ | function readUint256(Buffer memory _buffer) internal pure notOutOfBounds(_buffer.cursor + 31, _buffer.data.length) returns (uint256) {
bytes memory bytesValue = _buffer.data;
uint32 offset = _buffer.cursor;
uint256 value;
assembly {
value := mload(add(add(bytesValue, 32), offset))
}
_buf... | 901,207 |
// SPDX-License-Identifier: UNLICENSED
// ANCHOR: all
pragma solidity 0.8.10;
// ANCHOR: import
import "forge-std/Test.sol";
// ANCHOR_END: import
contract ContractBTest is Test {
uint256 testNumber;
// ANCHOR: setUp
function setUp() public {
testNumber = 42;
}
// ANCHOR_END: setUp
/... | ANCHOR: testFailSubtract43 | function testFailSubtract43() public {
testNumber -= 43;
}
| 13,043,061 |
./full_match/3/0x3f4b235e4e83D75D0938Fc83dafA4033412A6fD1/sources/TestSelf.sol | You can send ether and specify a custom gas amount | function testCallFoo(address payable _addr) public payable {
abi.encodeWithSignature("foo(string,uint256)", "call foo", 123)
);
emit Response(success, data);
}
| 8,128,454 |
/**
* Geostellar, Inc.
* All rights reserved.
* The Dividend contract is a bit what it sounds like: it allows payments to
* be made to a contract and for them to be withdrawn. The trick of it is that
* one can only withdraw the latest payment.
*/
pragma solidity ^0.4.13;
import 'zeppelin-solidity/contracts/token... | Check how much a dividend payment for the period would be./ | function checkDividend () public constant returns(uint256) {
if (msg.sender == owner) {
return 0;
}
uint256 senderBalance = balances[msg.sender];
uint256 periodDividiend = paidIn[currentPeriod];
uint256 portion = periodDividiend.mul(senderBalance).div(totalSupply.sub(balances[owner]).sub(exc... | 941,818 |
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/lib/ConsiderationDecoder.sol | Converts a function taking a calldata pointer and returning a memory pointer into a function taking that calldata pointer and returning an OrderParameters type. inFn The input function, taking an arbitrary calldata pointer and returning an arbitrary memory pointer. return outFn The output functio... | function _toOrderParametersReturnType(
function(CalldataPointer) internal pure returns (MemoryPointer) inFn
)
internal
pure
returns (
function(CalldataPointer)
internal
pure
returns (OrderParameters memory) outFn
... | 4,301,700 |
./full_match/1/0x5de58BF4ef40e923797aFF1767F8ed4143e6c032/sources/contracts/utils/WadRayMath.sol | Scales a value in RAY down to a value in WAD a RAY value return a, scaled down to a value in WAD (rounded up to the nearest WAD)/ | function rayToWad(uint256 a) internal pure returns (uint256) {
uint256 result = a / WAD_RAY_RATIO;
if (a % WAD_RAY_RATIO >= HALF_RATIO) {
result += 1;
}
return result;
}
| 16,410,621 |
// Sources flattened with hardhat v2.6.1 https://hardhat.org
// File @openzeppelin/contracts/utils/Context.sol@v4.3.2
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these ar... | Converts bytes to a reference to memory position and length. _in Input bytes to convert. return Output memory reference./ | function toRLPItem(bytes memory _in) internal pure returns (RLPItem memory) {
uint256 ptr;
assembly {
ptr := add(_in, 32)
}
}
| 366,068 |
// Sources flattened with hardhat v2.1.1 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/IERC20.sol@v3.4.1
// SPDX-License-Identifier: MIT
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 ... | Sets the address of the sentinel _sentinel address of the new sentinel | function setSentinel(address _sentinel) external onlyGovernance {
require(_sentinel != address(0), "StakingPoolsV4: sentinel address cannot be 0x0.");
sentinel = _sentinel;
emit SentinelUpdated(_sentinel);
}
| 7,216,449 |
./full_match/5/0xaF58A878F9D9E4580476936EEB1Cb7D5Dd18cA7d/sources/contracts/ERC721A.sol | Equivalent to `_safeMint(to, quantity, '')`./ | function _safeMint(address to, uint256 tokenId) internal {
_safeMint(to, tokenId, "");
}
| 11,592,016 |
./full_match/11155111/0x5D6B8d8d7715b8Bf8eBe76f75BC55Cb1d6b24Ce1/sources/contracts/LotteryFactory.sol | Create a new subscription when the contract is initially deployed. Add this contract as a consumer of its own subscription. | function createNewSubscription() private onlyOwner {
chainlinkSubscriptionId = COORDINATOR.createSubscription();
COORDINATOR.addConsumer(chainlinkSubscriptionId, address(this));
}
| 3,794,269 |
pragma solidity ^0.5.8;
import "./IERC20.sol";
import "./SoraToken.sol";
/**
* Provides functionality of master contract
*/
contract Master {
bool internal initialized_;
address public owner_;
mapping(address => bool) public isPeer;
uint public peersCount;
/** Iroha tx hashes used */
mapping... | Recovers address from a given single signature hash unsigned data v v-component of signature from hash r r-component of signature from hash s s-component of signature from hash return address recovered from signature/ | function recoverAddress(bytes32 hash, uint8 v, bytes32 r, bytes32 s) private pure returns (address) {
bytes32 simple_hash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
address res = ecrecover(simple_hash, v, r, s);
return res;
}
| 15,831,182 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.