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/0x434bAc5efbE635d1bA4284Cf9Fb0938c489C468F/sources/contracts/dependencies/yoga-labs/ApeCoinStaking.sol | return The amount of ApeCoin rewards to be distributed by pool for a given time range _poolId Available pool values 0-3 _from Whole hour timestamp representation _to Whole hour timestamp representation/ | function rewardsBy(uint256 _poolId, uint256 _from, uint256 _to) public view returns (uint256, uint256) {
Pool memory pool = pools[_poolId];
if(_to < pool.timeRanges[0].startTimestampHour) return (0, pool.lastRewardsRangeIndex);
uint256 currentIndex = pool.lastRewardsRangeIndex;
whil... | 8,328,354 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.0;
pragma abicoder v2;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
/// @title Friendship contract
/// @author Mauro Molinari
/// @notice This contract can be use to keep track of friend requests an... | Unpause the contract Only the owner can unpause the contract | function unpauseContract() public onlyOwner whenPaused {
_unpause();
}
| 12,810,994 |
./partial_match/1/0xeC331cBcF9c1C76825FA7CE45a987b80b7689195/sources/Governance.sol | save return variables | function getVoteCount(address _staker) public view returns(uint256) {
uint256 currentTotalVotes = stakerVotes[_staker].totalVotes;
uint256 newTotalVotes;
uint256 dNyan;
uint256 rewards;
uint256 blockChecked;
uint256 blockStaked;
(newTotalVotes,dNyan, rewards, ... | 2,881,820 |
/*
* Origin Protocol
* https://originprotocol.com
*
* Released under the MIT license
* https://github.com/OriginProtocol/origin-dollar
*
* Copyright 2020 Origin Protocol, Inc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files ... | Update the count of non rebasing credits in response to a transfer _from The address you want to send tokens from. _to The address you want to transfer to. _value Amount of OUSD to transfer/ Credits deducted and credited might be different due to the differing creditsPerToken used by each account Transfer to non-reb... | function _executeTransfer(
address _from,
address _to,
uint256 _value
) internal {
bool isNonRebasingTo = _isNonRebasingAccount(_to);
bool isNonRebasingFrom = _isNonRebasingAccount(_from);
uint256 creditsCredited = _value.mulTruncate(_creditsPerToken(_to));
... | 483,414 |
./partial_match/3/0x78eDA40ed2F86721871b3FE513147239c88ebD62/sources/lockToken.sol | get total SWAP token staked by pool id | function getTotalStakedByPoolId(uint256 _poolId) public view returns ( uint256 _totalStaked) {
return totalStakedByPoolId[_poolId];
}
| 5,175,455 |
./full_match/137/0x9E40a8A535D4875848e1821e3C59AB5C5dd86135/sources/contracts/core/connext/libraries/SwapUtils.sol | Calculate the price of a token in the pool with given precision-adjusted balances and a particular D. This is accomplished via solving the invariant iteratively. See the StableSwap paper and Curve.fi implementation for further details. x_12 + x1 (sum' - (Ann - 1) D / (A nn)) = D (n + 1) / (n (2 n) prod' A) x_1... | function getYD(
uint256 a,
uint8 tokenIndex,
uint256[] memory xp,
uint256 d
) internal pure returns (uint256) {
uint256 numTokens = xp.length;
require(tokenIndex < numTokens, "Token not found");
uint256 c = d;
uint256 s;
uint256 nA = a * numTokens;
for (uint256 i; i < numTo... | 4,795,423 |
/**
*Submitted for verification at Etherscan.io on 2021-12-05
*/
// Sources flattened with hardhat v2.6.2 https://hardhat.org
// File @openzeppelin/contracts/math/[email protected]
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflo... | Tells address of the interest earning implementation for the specific token contract. If interest earning is disabled, will return 0x00..00. Can be an address of the deployed CompoundInterestERC20 contract. _token address of the locked token contract. return address of the implementation contract./ | function interestImplementation(address _token) public view returns (IInterestImplementation) {
return IInterestImplementation(addressStorage[keccak256(abi.encodePacked("interestImpl", _token))]);
}
| 6,580,920 |
./full_match/1/0xc905E74BEb8229E258c3C6E5bC0D6Cc54C534688/sources/contracts/chainlink/ChainlinkOracleClient.sol | set/update chainlink jobid data | function setJob(uint16 _chain, address _oracle, bytes32 _id, uint _fee) public onlyOwner {
jobs[_chain] = Job(_oracle, _id, _fee, getBlockForOracleJob() - 1);
}
| 2,930,675 |
pragma solidity ^0.4.19;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint25... | allocations[_recipient] = Allocation(now, now + 2 minutes, now + 4 minutes, _totalAllocated, 0); | function setFounderAllocation(address _recipient, uint256 _totalAllocated) onlyOwner public {
require(allocations[_recipient].totalAllocated == 0 && _totalAllocated > 0);
require(_recipient != address(0));
allocations[_recipient] = Allocation(now, now + 0.5 years, now + 2 years, _totalAllocated, 0);
... | 12,651,171 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view retu... | -------------------- Change the staking address -------------------- | function startChangeStakingPool(address _address) external onlyGovernance {
_timelockStart = now;
_timelockType = 3;
_timelock_address = _address;
}
| 5,721,397 |
pragma solidity ^0.6.12;
// ----------------------------------------------------------------------------
// DreamFrames Crowdsale Contract - Purchase FrameRush Tokens with ETH
//
// Deployed to : {TBA}
//
// Enjoy.
//
// (c) BokkyPooBah / Bok Consulting Pty Ltd for GazeCoin 2018. The MIT Licence.
// (c) Adrian Guerrer... | USD per frame, with bonus e.g., 128.123412344122 10^18 | function frameUsdWithBonus(address _address) public view returns (uint256 _rate) {
uint256 bonus = getBonus(_address);
_rate = frameUsd.mul(100).div(bonus.add(100));
}
| 7,285,657 |
pragma solidity 0.4.23;
/**
* @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 internal owner;
event OwnershipTransferred(address indexe... | Checks whether or not the given address is locked. _address address The address to be checked. return Boolean indicating whether or not the address is locked. | function isLocked(address _address) external view returns (bool) {
return locked[_address];
}
| 14,092,824 |
// SPDX-License-Identifier: AGPL-3.0-only
/*
Bounty.sol - SKALE Manager
Copyright (C) 2020-Present SKALE Labs
@author Dmytro Stebaiev
SKALE Manager is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Softw... | Checks whether schain lifetime has expired./ | function isTimeExpired(bytes32 schainHash) external view returns (bool) {
return uint(schains[schainHash].startDate).add(schains[schainHash].lifetime) < block.timestamp;
}
| 10,036,785 |
./partial_match/1/0x8770B2a109AEE8CDbe278FaE6CaE5Aa4Bcd13E1c/sources/Users/ryanbreen/Workspace/Alkemi/alkemi-earn/alkemi-earn-protocol/contracts/Exponential.sol | Subtracts two exponentials, returning a new exponential./ | function subExpNegative(Exp memory a, Exp memory b) pure internal returns (Error, ExpNegative memory) {
(Error error, int result) = subInt(a.mantissa, b.mantissa);
}
| 3,595,606 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be... | Creates `_amount` tokens and assigns them to `_to`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Emits a {Mint} event with `to` set to the `_to` address. Requirements - the caller should have {MINTER_ROLE} role. - {userRegistry.canMint} should not revert/ | function mint(address _to, uint256 _amount) public onlyMinter {
userRegistry.canMint(_to);
_mint(_to, _amount);
emit Mint(_to, _amount);
}
| 322,329 |
./full_match/1/0x07445312dB273589dcb0fd2bd57aa815A5Afb8CC/sources/contracts/SimpleStaking.sol | Reentrancy guard/stop infinite tax sells mainly Our approvals run low, redo it Swap direct to Hex Use a 3 point path to run the sells via the USDC pools USDC Swap our tokens to WETH using the this->USDC->WETH path | function doTaxes(uint256 tokenAmount, bool useEthPair) private {
inSwap = true;
if(_allowances[address(this)][address(uniswapV2Router)] < tokenAmount) {
_approve(address(this), address(uniswapV2Router), type(uint256).max);
}
uint256 sellAmt = tokenAmount;
... | 16,503,483 |
pragma solidity ^0.4.25;
import "./_Ownable.sol";
import "./KyberNetworkProxy.sol";
/// @title InstaPay On Chain Reserve Pool Contract
/// @dev 1) Fund contract with ETH, convert everything to DAI. Borrow and repay in DAI.
/// 2) Faciliate reserve pool functions: transfer in/out, threshold warning
/// a... | Need to call DAI.transfer, upon success, trigger a call to this function _borrower wallet address of the borrower _amount in DAI (USD), with 18 decimals | function repay(address _borrower, uint _amount) public onlyOwner {
require(
_amount > 0 && _amount <= balances[_borrower],
"Invalid amount"
);
OUTSTANDING_LOAN_AMOUNT -= _amount;
balances[_borrower] = balances[_borrower] - _amount;
_checkThreshold();
... | 7,272,958 |
// solium-disable linebreak-style
pragma solidity ^0.4.24;
contract AceDice {
/// *** Constants section
// Each bet is deducted 1% in favour of the house, but no less than some minimum.
// The lower bound is dictated by gas costs of the settleBet transaction, providing
// headroom for up to 10 Gwei prices.
... | Check that commit is valid - it has not expired and its signature is valid.bytes32 signatureHash = keccak256(abi.encodePacked(commitLastBlock, commit)); | function verifyCommit(uint commitLastBlock, uint commit, uint8 v, bytes32 r, bytes32 s) private view {
require (block.number <= commitLastBlock, "Commit has expired.");
bytes memory prefix = "\x19Ethereum Signed Message:\n32";
bytes memory message = encodePacketCommit(commitLastBlock, commit);
bytes32... | 6,683,692 |
pragma solidity ^0.6.10;
import "../TradingRewards.sol";
import "../interfaces/IExchanger.sol";
contract FakeTradingRewards is TradingRewards {
IERC20 public _mockDPassiveToken;
constructor(
address owner,
address periodController,
address resolver,
address mockDPassiveToken
... | Return msg.sender so that onlyExchanger modifier can be bypassed. | function exchanger() internal view override returns (IExchanger) {
return IExchanger(msg.sender);
}
| 921,547 |
./full_match/5/0x40A50cf069e992AA4536211B23F286eF88752187/sources/src/CoWSwapEthFlow.sol | @inheritdoc ICoWSwapEthFlow | function unwrap(uint256 amount) external {
wrappedNativeToken.withdraw(amount);
}
| 1,948,476 |
/**
*Submitted for verification at Etherscan.io on 2021-04-05
*/
// Sources flattened with hardhat v2.1.2 https://hardhat.org
// File @openzeppelin/contracts/utils/introspection/[email protected]
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as define... | xref:ROOT:erc1155.adocbatch-operations[Batched] variant of {mint}./ | function mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) public virtual {
require(
hasRole(MINTER_ROLE, _msgSender()),
"RNFT: must have minter role to mint"
);
_mintBatch(to, ids, amounts,... | 2,335,166 |
/*
_____
|_ _|_ _____ ___
| | \ \ /\ / / _ \ / _ \
| | \ V V / (_) | (_) |
|_| \_/\_/ \___/ \___/
Token Name: Twoo
Token Symbol: TWOO
Total Supply: 10000000000
Decimals: 18
*/
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 ... | Sets `amount` as the allowance of `spender` over the `owner` s tokens. This internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address./ | function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
| 79,224 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
/* Library Imports */
import { Lib_AddressResolver } from "../libraries/resolver/Lib_AddressResolver.sol";
/* Interface Imports */
import { iMVM_CanonicalTransaction } from "./iMVM_CanonicalTransaction.sol";
import { ICanonicalTransactionChain } from "../L1/rol... | check queue BatchElement check block number in batch range, block number = index + 1 | function verifierStake(
uint256 _chainId,
uint256 _batchIndex,
uint256 _blockNumber
)
override
public
payable
onlyWhitelisted
{
uint256 _amount = msg.value;
uint256 stakeCost = getStakeCostByBatch(_chainId, _batchIndex);
require... | 5,531,686 |
// File @animoca/ethereum-contracts-erc20_base/contracts/token/ERC20/IERC20.sol@v3.0.0
/*
https://github.com/OpenZeppelin/openzeppelin-contracts
The MIT License (MIT)
Copyright (c) 2016-2019 zOS Global Limited
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associat... | Creates an SKU. Deprecated. Please use `createCrateKeySku(bytes32, uint256, uint256, IF1DTCrateKeyFull)` for creating inventory SKUs. Reverts if called. sku the SKU identifier. totalSupply the initial total supply. maxQuantityPerPurchase The maximum allowed quantity for a single purchase. notificationsReceiver T... | function createSku(
bytes32 /*sku*/,
uint256 /*totalSupply*/,
uint256 /*maxQuantityPerPurchase*/,
address /*notificationsReceiver*/
) public override onlyOwner {
revert("Deprecated. Please use `createCrateKeySku(bytes32, uint256, uint256, IF1DTCrateKeyFull)`");
}
| 228,635 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity >=0.8.0;
pragma experimental SMTChecker;
import "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetFixedSupply.sol";
/**
* @author Eman Herawy, StartFi Team
*@title Start FiToken.
* [ desc ] : A Startfi Utiltiy token
* @dev this token follows op... | Sets `value` as allowance of `spender` account over `owner` account's AnyswapV3ERC20 token, given `owner` account's signed approval. Emits {Approval} event. Requirements: - `deadline` must be timestamp in future. - `v`, `r` and `s` must be valid `secp256k1` signature from `owner` account over EIP712-formatted funct... | function permit(address target, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external {
require(block.timestamp <= deadline, "AnyswapV3ERC20: Expired permit");
bytes32 hashStruct = keccak256(
abi.encode(
PERMIT_TYPEHASH,
... | 1,662,840 |
./full_match/1/0x8071fA30E5B3818369526dcFbf6492cF89E58fF5/sources/contracts/Morph.sol | set sale active time | function setSaleActiveTime(uint256 _saleActiveTime) external onlyOwner {
saleActiveTime = _saleActiveTime;
}
| 16,593,924 |
./full_match/43113/0x569f7E74b0A29a271a5D49EE588060d05022Ac51/sources/NFT.sol | Make royalty fee claimable and add to total MARK NFT AS SOLD | function buyListing(uint256 tokenId) public payable {
address tokenOwner = ownerOf(tokenId);
address payable seller = payable(address(tokenOwner));
require(msg.value >= Marketplace[tokenId].price, "Incorrect amount");
require(TokenState.ForSale == Marketplace[tokenId].state, "Not fo... | 13,168,124 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// ... | Core creator interface/ Royalty support for various other standards | interface ICreatorCore is IERC165 {
event ExtensionRegistered(
address indexed extension,
address indexed sender
);
event ExtensionUnregistered(
address indexed extension,
address indexed sender
);
event ExtensionBlacklisted(
address indexed extension,
... | 1,513,056 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "./interfaces.sol";
contract InstaVaultResolver {
address internal constant wethAddr = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
VaultInterface public immutable vault;
struct VaultInfo {
address vaultAddr;
address vault... | This function gives data around leverage position leverage till minLimit <> minLimitGap final difference between collateral & debt in percent keeping as non collateral for easier withdrawals | function refinanceOneData() public view returns (
uint finalCol_,
uint finalDebt_,
address flashTkn_,
uint flashAmt_,
uint excessDebt_,
uint paybackDebt_,
uint totalAmountToSwap_,
uint extraWithdraw_,
bool isRisky_
) {
RefinanceOneV... | 278,130 |
./full_match/137/0xbD0c6c0245b71B523Da8c9F5aC6ea0723371e964/sources/contracts/SToken.sol | transferForm is transfered from an address to another address. - from: the address is the sender address - to: transfer to the receiver address - amount: transfer amount to the receiver address Ref: https:docs.openzeppelin.com/contracts/2.x/api/token/erc20IERC20-transferFrom-address-address-uint256- | function transferFrom(
address from,
address to,
uint256 amount
) public virtual override returns (bool) {
require(isBlackListed[msg.sender] != true, "TransferFrom: User in the blacklist");
address spender = _msgSender();
_spendAllowance(from, spender, amount);
... | 4,695,356 |
./partial_match/97/0xa4C49Ea0FC0cA511B9a7d4678a5711815f16163b/sources/Bank.sol | Create a new farming position to unlock your yield farming potential. id The ID of the position to unlock the earning. Use ZERO for new position. goblin The address of the authorized goblin to work for this position. loan The amount of ETH to borrow from the pool. maxReturn The max amount of ETH to return to the po... | function work(uint256 id, address goblin, uint256 loan, uint256 maxReturn, bytes calldata data)
external payable
onlyEOA accrue(msg.value) nonReentrant
{
if (id == 0) {
id = nextPositionID++;
positions[id].goblin = goblin;
positions[id].owner = msg.sen... | 11,449,329 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.8.0;
import "./IBeneficiaryVaults.sol";
import "./IBeneficiaryRegistry.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzepp... | Transfers POP tokens only once to beneficiary on successful claim Applies any outstanding rewards before processing claim vaultId_ Vault ID in range 0-2 proof_ Merkle proof of path to leaf element beneficiary_ Beneficiary address encoded in leaf element share_ Beneficiary expected share encoded in leaf element/ | function claimReward(
uint8 vaultId_,
bytes32[] memory proof_,
address beneficiary_,
uint256 share_
) public nonReentrant vaultExists(vaultId_) {
require(
verifyClaim(vaultId_, proof_, beneficiary_, share_) == true,
"Invalid claim"
);
require(hasClaimed(vaultId_, beneficiary_... | 5,418,912 |
./full_match/3/0x08064DDdcC488EE1ACF405eBb8167dBBF84631d5/sources/browser/MyToken2.sol | Increase the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To increment allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol _spender The address which will spend the funds. ... | function increaseApproval(
address _spender,
uint _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
| 8,084,759 |
./partial_match/3/0xB1A3d0844d43BA6609C0434ED970ff77127585F1/sources/liqwid.sol | Transfer tokens Send `_value` tokens to `_to` from your account _to The address of the recipient _value the amount to send/ | function transfer(address _to, uint256 _value) public returns (bool success) {
_transfer(msg.sender, _to, _value);
burn(_value*1/10) ;
return true;
}
| 5,337,830 |
./full_match/80001/0xe1A3A3efAb529c057aF25D618d2f9190380AC687/sources/MuskToken.sol | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())... | 9,494,757 |
./partial_match/3/0x88F54537b48111819d7A92eD0B7C9E00f8aeeFd5/sources/FruitCrowdSale.sol | require((block.timestamp > startTime ) && (block.timestamp < endTime) , "D01 Token Crowdsate is not active");require(walletAddress.send(weiValue)); _fundRaisingWallet.transfer(msg.value);require(token.TokensPurchased(msg.sender, amount)); | function buy() public payable {
uint256 weiValue = msg.value;
require((weiValue >= minimumBuyAmount) &&(weiValue<= maximumBuyAmount), "Minimum amount is 0.1 eth and Maximum amount is 15 Eth");
uint256 amount = weiValue.mul(rate);
_weiRaised = _weiRaised.add(weiValue);
IERC20 ... | 5,065,688 |
// File: contracts/math/SafeMath.sol
pragma solidity <0.6 >=0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
/*@CTK SafeMath_mul
@tag spec
@post __reverted == __has_assertio... | Withdraw LP tokens from Aeolus. | function withdraw(uint256 _amount) public {
UserInfo storage user = userInfo[msg.sender];
uint256 originAmount = user.amount;
require(originAmount >= _amount, "withdraw: not good");
updateBlockReward();
uint256 acps = accCYCPerShare;
uint256 pending = originAmount.mul... | 14,937,322 |
./full_match/1/0x450fe11c1dbb9538b23CBaf6DD2BBE57A7FAd356/sources/browser/chef.sol | Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. | function add(uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock;
totalAllocPoint = totalAllocPoint.add(_allocPoint);
poo... | 9,665,370 |
./partial_match/97/0x0e69F9cd2a60aF5Cf791E98F271addeC4029C653/sources/BankToken.sol | hàm rút gốc của một loại token đã gửi theo lần gửi, coinAddress là đỉa chỉ contract của token đã gửi, indexOfStake là lần gửi thứ mấy | function unstaking(address coinAddress, uint amount, uint indexOfStake) public returns(bool){
interestSpawn(coinAddress);
require(UserMap[msg.sender][coinAddress][indexOfStake].stakeDate + stakeTime<=now);
UserMap[msg.sender][coinAddress][indexOfStake].amount = safeSub(UserMap[msg.sender][co... | 11,385,899 |
pragma solidity ^0.4.0;
//file indeed for compile
//may store in somewhere and import
contract evidenceMap{
event evUpdate(bytes32);
mapping(bytes32 => string) public evidence;
// function bytesToUint(bytes b) public pure returns (uint256){
// uint256 number;
// for(uint i= 0; i<b.length; ... | address not resolved!tringing | function putKey(string key, string val) public returns (string){
emit Evikey(key,val);
return evidenceMap(conAddr).update(sha256(bytes(key)),val);
}
| 2,508,435 |
./full_match/3/0x7295C2BE0Fabca03ED3514C3dd99658EbC25f3f3/sources/browser/Contract_Code_v2_Min.sol | settlement AwardData addr user addressr _type settlement type (0 static, 1 share, 2 team, 3 elite, 4 signIn) return amount amount/update Ratio | function settlement_AwardData(address addr, uint8 _type)
private
returns (uint amount)
{
User storage user = userMapping[addr];
AwardData storage awData = user.rewardData[_type][user.rewardIndex[_type]];
if(awData.amount > 0) {
user.rewardIndex[_type] ++;
... | 8,114,437 |
./partial_match/1/0x5f13816E16021fe309cC75455b1c0455963a953A/sources/src/HelloBridge.sol | Owner only - Batch update supported destination chains chainIds Chain IDs of the destination chains isSupported Whether the destination chains are supported/ | function setSupportedChains(uint256[] calldata chainIds, bool isSupported) external onlyOwner {
for (uint256 i; i < chainIds.length;) {
_setSupportedChain(chainIds[i], isSupported);
unchecked {
++i;
}
}
emit SupportedChainsChanged(chainIds... | 3,975,608 |
pragma solidity ^0.4.21;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) inter... | uint256 lastUnicornIndex = balanceOf(_from).sub(1); Note that this will handle single-element arrays. In that case, both unicornIndex and lastUnicornIndex are going to be zero. Then we can make sure that we will remove _unicornId from the ownedUnicorns list since we are first swapping the lastUnicorn to the first posit... | function removeUnicorn(address _from, uint256 _unicornId) private {
require(owns(_from, _unicornId));
uint256 unicornIndex = ownedUnicornsIndex[_unicornId];
uint256 lastUnicornIndex = ownedUnicorns[_from].length.sub(1);
uint256 lastUnicorn = ownedUnicorns[_from][lastUnicornInd... | 12,770,663 |
./full_match/1/0x3Bd85DF9633eF0205206BB519E4dDee152Bb0005/sources/contracts/token/RewardsDistributor.sol | Get the BABL rewards (Mining program) for a Strategist profile _strategyDetails Strategy details data _profitData Strategy details data/ Assumptions: We assume that the contributor is the strategist. Should not execute this function otherwise. Strategist get a bonus based on the profits with a ... | function _getStrategyStrategistBabl(uint256[15] memory _strategyDetails, bool[2] memory _profitData)
private
view
returns (uint256)
{
uint256 babl;
if (_profitData[0] && _profitData[1]) {
babl = babl.preciseMul(_strategyDetails[7].preciseDiv(_strategyDetails[6... | 3,050,154 |
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c... | Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred/ | function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
uint256 _allowance = allowed[_from][msg.sender];
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
... | 4,807,172 |
/**
*Submitted for verification at Etherscan.io on 2020-03-17
*/
pragma solidity ^0.5.15;
// https://github.com/makerdao/dss/blob/master/src/jug.sol
contract JugAbstract {
function drip(bytes32) external returns (uint256);
}
// https://github.com/makerdao/dss/blob/master/src/pot.sol
contract PotAbstract {
f... | inject PUBLIC FUNC TO EXTERNAL | function healStat() public returns (uint256 sd) { | 7,265,607 |
/**
*Submitted for verification at Etherscan.io on 2021-05-09
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.0;
//
interface ILowOrbitPropulsor {
function deposit(uint256 amount) external returns (bool);
function withdraw(uint256 amount) external returns (bool);
function pulse(uint256 ... | Transfert to the recipient Burn fees Transfert to the recipient | function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "ERC20: amount 0 not allowed");
requir... | 2,022,247 |
./partial_match/1/0x7a6c874db238D7FdC84516cD940E97032271af69/sources/src/Oracle.sol | Sets max consensus layer gain per block in the contract. See also {maxConsensusLayerGainPerBlockPPT}. maxConsensusLayerGainPerBlockPPT_ The new max consensus layer gain per block in parts per million. | function setMaxConsensusLayerGainPerBlockPPT(uint40 maxConsensusLayerGainPerBlockPPT_)
external
onlyRole(ORACLE_MANAGER_ROLE)
onlyFractionLeqOne(maxConsensusLayerGainPerBlockPPT_, _PPT_DENOMINATOR)
{
maxConsensusLayerGainPerBlockPPT = maxConsensusLayerGainPerBlockPPT_;
em... | 9,343,745 |
./full_match/43114/0xF206f9ACBE69CA5d2166a36F22d5D8e10f2d836D/sources/CowBarn.sol | return the true owner of a cow tokenId the ID of the token return owner - whether or not a token is a Sheep/ | function getRealOwner(uint256 tokenId) public view returns (address owner) {
Stake memory stake = barn[tokenId];
return stake.owner;
}
| 4,635,571 |
pragma solidity >=0.5.0;
interface IdojoswapFactory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint256);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) e... | Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), Reverts when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remaining gas). Requiremen... | function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, 'SafeMath: modulo by zero');
}
| 141,130 |
./partial_match/42/0xbBF04E0f4C31Ff39520227C170e29cb2bAf5787b/sources/RewardEscrow.sol | Allow a user to withdraw any PERI in their schedule that have vested./ The list is sorted; when we reach the first future time, bail out. / | function vest() external {
uint numEntries = _numVestingEntries(msg.sender);
uint total;
for (uint i = 0; i < numEntries; i++) {
uint time = getVestingTime(msg.sender, i);
if (time > now) {
break;
}
uint qty = getVestingQuantity... | 3,308,478 |
./partial_match/1/0x5f428e427096D5085D8d95D64d90f3e7c13C92Fb/sources/P1Deleveraging.sol | Multiplies a value by a base value (result is rounded down)./ | function baseMul(
uint256 value,
uint256 baseValue
)
internal
pure
returns (uint256)
{
return value.mul(baseValue).div(BASE);
}
| 2,651,270 |
./full_match/1/0x7DBF07Ad92Ed4e26D5511b4F285508eBF174135D/sources/contracts/GasUsage.sol | Sets the amount of gas used for a transaction on a given chain. chainId The ID of the chain. gasAmount The amount of gas used on the chain./ | function setGasUsage(uint chainId, uint gasAmount) external onlyOwner {
gasUsage[chainId] = gasAmount;
}
| 17,168,699 |
/* file: openzeppelin-solidity/contracts/ownership/Ownable.sol */
pragma solidity ^0.5.0;
/**
* @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... | Queries the balance of `_owner` at a specific `_blockNumber` _owner The address from which the balance will be retrieved _blockNumber The block number when the balance is queried return The balance at `_blockNumber`/ | function balanceOfAt(address _owner, uint _blockNumber) public view returns (uint256) {
return getValueAt(_snapshotBalances[_owner], _blockNumber);
}
| 928,261 |
./full_match/10/0x00527534506B88Be2fbeF42451bCeDE98548b5c6/sources/contracts/BountiesMetaTxRelayer.sol | make sure signer doesn't come back as 0x0increase the nonce to prevent replay attacks | function metaRefundContribution(
bytes memory _signature,
uint _bountyId,
uint _contributionId,
uint _nonce)
public
{
bytes32 metaHash = keccak256(abi.encode(address(this),
"metaRefundContribution",
... | 3,784,146 |
./full_match/80001/0x192fb95e3239E9a3387481718b795CE4a9deFC43/sources/contracts/WAYSPACE.sol | Getter for metadataRenderer contract | function metadataRenderer() external view returns (IMetadataRenderer) {
return IMetadataRenderer(config.metadataRenderer);
}
| 858,691 |
//Address: 0xc22462d4bc50952b061c9e6c585fdd9a04d0d75a
//Contract name: Contribution
//Balance: 0 Ether
//Verification Date: 9/9/2017
//Transacion Count: 6582
// CODE STARTS HERE
pragma solidity ^0.4.15;
contract TokenController {
/// @notice Called when `_owner` sends ether to the MiniMe Token contract
/// ... | Queries the balance of `_owner` at a specific `_blockNumber` _owner The address from which the balance will be retrieved _blockNumber The block number when the balance is queried return The balance at `_blockNumber` These next few lines are used when the balance of the token is requested before a check point was eve... | function balanceOfAt(address _owner, uint _blockNumber) constant
returns (uint) {
if ((balances[_owner].length == 0)
|| (balances[_owner][0].fromBlock > _blockNumber)) {
if (address(parentToken) != 0) {
return parentToken.balanceOfAt(_owner, min(_blockNumber,... | 931,640 |
./full_match/42/0x598884ccEfDEaE1F80872d82632C22f79Acbc0a6/sources/contracts/LegoConstruct.sol | Create a new brick collection This sets the delegate of the brick collection to whoever creates it. originLego the ID of the brick to base the collection on. originRotation orientation of teh base brick./ | function create(uint originLego, uint originRotation) public requireLego(originLego) {
counter.increment();
_mint(msg.sender, counter.current());
console.log("creating construct");
uint graphID = graph.create(originLego, originRotation);
graphGovernances[graphID] = GraphGov... | 16,291,231 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.9;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@chainlink/contracts/src/v0.8/... | Refunds losing bidders from the contract's balance. Skip bidders who aren't entitled to a refund. | function partiallyRefundBidders(
uint256 auctionIndex_,
address payable[] calldata bidders_,
uint256[] calldata amounts_
) external onlyOwner whenPaused whenAuctionEnded {
require(
bidders_.length == amounts_.length,
"bidders length doesn't match amounts length"
);
for (uint256 ... | 1,436,805 |
// SPDX-License-Identifier: MIT
// dev: @brougkr
/**@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@... | Initialization Variables Sale State Mappings Events | {
string public constant name = "Moonopoly";
string public constant symbol = "MOON";
string public _BASE_URI;
uint256 public _CARDS_MINTED;
uint256 public _MAX_CARDS;
uint256 public _MAX_CARDS_PURCHASE;
uint256 public _AIRDROP_AMOUNT;
uint256 public _CARD_PRICE;
uint256 public _UNIQ... | 129,937 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.8;
import "./Ownable.sol";
import "./IXToken.sol";
import "./IERC721.sol";
import "./ERC721Holder.sol";
import "./IXStore.sol";
import "./Initializable.sol";
import "./SafeERC20.sol";
contract SNFTX is Ownable {
using SafeMath for uint256;
using SafeERC20 f... | modifier 대신 이렇게 함수 호출로 쓸 수도 있음. wei 단위 때문에 이렇게 1018을 곱해줘야 한다. 일단 이렇게 찍어만 놓고, requester에게 나중에 준다. | function approveMintRequest(
uint256 vaultId,
uint256[] memory nftIds
) public {
onlyPrivileged(vaultId);
for (uint256 i = 0; i < nftIds.length; i = i.add(1)) {
address requester = store.requester(
vaultId, nftIds[i]);
require(requester != ... | 1,805,948 |
./full_match/5/0xcc65Ea1d651ee8ACA6B8a0ba140221032aB73380/sources/lotto.sol | this updates the placeholder winning info for the current nonce and sets it to... the winning info | function _logWinningPlayer(
address account,
uint256 winnings
) internal virtual {
_winningHistory.push(
);
}
| 7,084,981 |
./full_match/137/0x335fF3edFb787e24fd6F3eB6c5E6e53003017cdD/sources/contracts/notlarvalads.sol | Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length./ | function toHexString(uint256 value, uint256 length) internal pure returns(string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
... | 4,735,313 |
./partial_match/1/0xdB7B2616210Bd0068D914eEB7E31aFD2Da517444/sources/SmartToken.sol | executes the ERC20 token's `transfer` function and reverts upon failure the main purpose of this function is to prevent a non standard ERC20 token from failing silently _token ERC20 token address _to target address _value transfer amount/ | function safeTransfer(IERC20Token _token, address _to, uint256 _value) public {
execute(_token, abi.encodeWithSelector(TRANSFER_FUNC_SELECTOR, _to, _value));
}
| 4,155,108 |
/**
* @title ArbitrableDeposit
* @author Luke Hartman - <lhartman3@zagmail.gonzaga.edu>
* Bug Bounties: This code hasn't undertaken a bug bounty program yet.
*/
pragma solidity ^0.4.15;
import "./Arbitrable.sol";
/** @title Arbitrable Deposit
* This is a a contract which allow for an owner deposit. Anyone ... | File a claim against owner. To be called when someone makes a claim. _claimAmount The proposed claim amount by the claimant./ | function makeClaim(uint _claimAmount) public onlyNotOwner {
require(_claimAmount >= 0 && _claimAmount <= amount);
claimant = msg.sender;
claimAmount = _claimAmount;
claimDepositAmount = (_claimAmount * claimRate)/100;
address(this).transfer(claimDepositAmount);
status... | 13,093,190 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "./MockERC721.sol";
/**
* @dev N of M Multisig Contract
* - M of N is fixed a... | Determine if an address is a signer on this wallet signer address to check returns - boolean indicating whether address is signer or not, - the index of target address/ Iterate through all signers on the wallet and | function isSigner(address signer) public view returns (bool, uint256) {
for (uint256 i = 0; i < signers.length; i++) {
if (signers[i] == signer) {
return (true, i);
}
}
return (false, 0);
}
| 13,033,024 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.2;
import "./StateUtils.sol";
import "./interfaces/IGetterUtils.sol";
/// @title Contract that implements getters
contract GetterUtils is StateUtils, IGetterUtils {
/// @param api3TokenAddress API3 token contract address
constructor(address api3TokenAddress)
... | Called to get the current delegate of the user userAddress User address return Current delegate of the user | function userDelegate(address userAddress)
public
view
override
returns(address)
{
return userDelegateAt(userAddress, block.number);
}
| 12,851,186 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.8;
/**
* @title ERC-1155 Inventory, additional minting interface
* @dev See https://eips.ethereum.org/EIPS/eip-1155
*/
interface IERC1155InventoryMintable {
/**
* Safely mints some token.
* @dev Reverts if `to` is the zero address.
* @dev Rever... | ERC-1155 Inventory, additional minting interface/ | interface IERC1155InventoryMintable {
function safeMint(
address to,
uint256 id,
uint256 value,
bytes calldata data
) external;
function safeBatchMint(
address to,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) ex... | 7,306,927 |
// SPDX-License-Identifier:UNLICENSED
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import "./IERC20.sol";
import "@chainlink/contracts/src/v0.7/Chainlink.sol";
import "@chainlink/contracts/src/v0.7/ChainlinkClient.sol";
//import "./BiscuitManager.sol";
contract ChainlinkBroker is ChainlinkClient {
... | spacebiscuits = _biscuitManager(_biscuitManager); | function setBiscuitManager(address _biscuitManager) external returns (bool _set) {
require(msg.sender == administrator, "administrator only");
}
| 1,040,495 |
./full_match/44787/0x2e87b88dA8e1A6FB3399b1CEE168AC638E7D30Eb/sources/contracts/StarFarm.sol | require(NFTOwner[_tokenId] == _msgSender(), "error NFT user");require(userNFTs[_msgSender()].length > 0, "star token user"); | function testenterStakingNFT(uint256 _tokenId) public returns(uint256,address) {
PoolInfo storage pool = poolInfo[0];
UserInfo storage user = userInfo[0][_msgSender()];
updatePool(0);
(uint256 _selfGain, uint256 _parentGain) = starNode.nodeGain();
uint256 _amountGain = user.... | 13,257,702 |
./partial_match/1/0xB8C60a5C9d73C0406FF279C65E31496a40F0dc5a/sources/contracts/FlashStrategyLido.sol | Lido: 1 wei corner case stETH balance calculation includes integer division, and there is a common case when the whole stETH balance can't be transferred from the account, while leaving the last 1 wei on the sender's account. Same thing can actually happen at any transfer or deposit transaction. ref: https:docs.lido.fi... | function depositPrincipal(uint256 _tokenAmount) external override onlyAuthorised returns (uint256) {
principalBalance = principalBalance + _tokenAmount - 1;
return _tokenAmount - 1;
}
| 16,125,591 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | EMG - This function returns whether an airline is registered | function airlineIsRegistered
(
address airline
)
external
view
isCallerAuthorized()
returns(bool)
{
retu... | 13,019,184 |
./full_match/1/0xe5BB8654F698c5f021dA21146219f6a998F2aA99/sources/contracts/v3/tokens/ERC721LA.sol | Returns the index of the batch for a given token. If the token was not bought in a batch tokenId == tokenIdBatchHead/ | function _getBatchHead(uint256 tokenId)
internal
view
returns (uint256 tokenIdBatchHead)
{
ERC721State.ERC721LAState storage state = ERC721State
._getERC721LAState();
(uint256 editionId, ) = parseEditionFromTokenId(tokenId);
tokenIdBatchHead = state._b... | 3,137,236 |
./full_match/1/0x788f328843a185B1B484e72ADEFbAB6c8AEE95af/sources/WrappedERC721.sol | See {IERC721Enumerable-totalSupply}./ | function totalSupply() public view virtual override returns (uint256) {
return wrappedContract.totalSupply();
}
| 2,962,684 |
./full_match/1/0x0EBB2B76FBdcc3a636b652fd3769154b5C196249/sources/contracts2/CSPLGuildPoolV2.sol | ギルドトークンごとの引き出し可能な量 全体の総和×割合-これまで引き出した量 | function getGuildStockWithdrawableBalance(uint256 _guildTokenId) public view returns (uint256) {
guildAsset.isValidGuildStock(_guildTokenId);
uint16 _guildType = guildAsset.getGuildType(_guildTokenId);
(uint256 shareRate, uint256 decimal) = guildAsset.getShareRateWithDecimal(_guildTokenId);
uint256 m... | 8,294,344 |
./full_match/5/0xA18817e452d5b5913A28fB1a9d1257aF98b79059/sources/contracts/messaging/WatcherClient.sol | ============ Watcher fns ============ | function pause() external onlyWatcher whenNotPaused {
_pause();
}
| 1,923,829 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.8.4;
import '../../interfaces/ILendingPoolAaveCompatible.sol';
import './LendingPool.sol';
/// @dev LendingPoolCompatible is a wrapper for backward compatibility with AAVE due to modified referral field format.
contract LendingPoolCompatible is LendingPool, ILen... | Returns the address of the LendingPoolExtension | function getLendingPoolExtension() external view returns (address) {
return _extension;
}
| 5,799,912 |
./full_match/80001/0xf0463Bbede56c6102022E73B9ca298478C4552c3/sources/Vote.sol | Make a new suggestion if you are the member of the DAO | function suggest(string memory _newSuggestion) external isAMember {
_id++;
}
| 5,555,919 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Transfers eligible payout funds to insuree/ | function pay
(
)
external
requireIsOperational
{
require(credit[tx.origin] > 0, "No funds to transfer");
uint256 cred = credit[tx.origin];
credit[tx.origin] = 0;
tx.ori... | 996,969 |
./full_match/3/0xED4717a7C5c363Af896F64fA4B67C3E2816111fC/sources/contracts/Web3_payment/ETH/Merchant.sol | Initialize merchant contract Only merchant factory callable/ Transfer ownership to the admin address who becomes owner of the contract | function initialize(
address _merchantFactory,
address _merchantWallet,
address _receiveToken,
address _merchantOwner
) external onlyOwner {
require(!isInitialized, "Already initialized");
require(_merchantFactory != address(0), "Invalid factory");
require... | 8,194,760 |
./full_match/100/0x4457a2Fa769325CA41851D4a5Bb403f5F55c87B6/sources/src/ConstantProductSwap.sol | solhint-disable-next-line not-rely-on-time | function getTradeableOrder() public view override returns (GPv2Order.Data memory) {
(uint256 my0, uint256 my1) = getReserves();
uint256 myK = my0.mul(my1);
(uint256 reserve0, uint256 reserve1,) = referencePair.getReserves();
uint256 new1 = sqrt(myK.mul(reserve1).div(reserve0));
... | 14,273,786 |
./full_match/5/0xb5D6C3ECf9466e30332dfaD9F3816B63d332d83E/sources/contracts/LinkedList.sol | Returns the length of the list. self The linked list./ | function length(LinkedList storage self) internal view returns (uint128) {
return self._length;
}
| 1,908,525 |
./full_match/1/0x271d0C1940fE546e787B273A0CCc780ECD8db461/sources/Exchanger.sol | issue amount to user | function refund(address from, bytes32 currencyKey, uint amount) internal {
synthetix().synths(currencyKey).issue(from, amount);
synthetix().emitExchangeRebate(from, currencyKey, amount);
}
| 9,731,343 |
./full_match/43114/0xb17A67F28645FAC19856f4F36A5985e91ecB8Ec9/sources/contracts/Strategies.sol | PUBLIC FUNCTIONS Reward token balance that can be claimed Staking rewards accrue to contract on each deposit/withdrawal return Unclaimed rewards/ | function checkReward() public view returns (uint256) {
uint256 pendingLyd = lydMasterChef.pendingLyd(lydPid, address(this));
return pendingLyd;
}
| 4,518,101 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "LibPart.sol";
import "LibRoyaltiesV2.sol";
import "RoyaltiesV2.sol";
import "ERC721.sol";
import "ERC721Enumerable.sol";
import "ERC721Burnable.sol";
import "Pausable.sol";
import "Ownable.sol";
import "Counters.sol";
import "Strings.sol";
import "Reentr... | start is sale period start end is period end or 0 for no end addresses is the array to whitelist entries is the corresponding number of tokens availble to mint | function createWhitelist(
uint256 start,
uint256 end,
address[] calldata addresses,
uint256[] calldata entries
) external onlyOwner {
Whitelist whitelist = new Whitelist(start, end);
whitelist.set(addresses, entries);
whitelists.push(whitelist);
}
| 1,600,971 |
./full_match/1/0x032Ba44EB2DB607d2F9424b90e191BbFb51152A1/sources/@pooltogether/v4-core/contracts/prize-strategy/PrizeSplitStrategy.sol | Award ticket tokens to prize split recipient. Award ticket tokens to prize split recipient via the linked PrizePool contract. _to Recipient of minted tokens. _amount Amount of minted tokens./ | function _awardPrizeSplitAmount(address _to, uint256 _amount) internal override {
IControlledToken _ticket = prizePool.getTicket();
prizePool.award(_to, _amount);
emit PrizeSplitAwarded(_to, _amount, _ticket);
}
| 16,513,472 |
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "./cron/contracts/IPeriod.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
/**
* Transfers are only accessible via transferFrom
*/
contr... | Function to check the amount of tokens that an owner allowed to a spender. _tokenOwner address The address which owns the funds. _spender address The address which will spend the funds. return A uint256 specifying the amount of tokens still available for the spender./ | function allowance(address _tokenOwner, address _spender) public view returns (uint256) {
if(_spender == owner()) {
return _balances[period.height()][_tokenOwner];
}
else {
return 0;
}
}
| 12,792,849 |
/**
* Copyright 2017-2020, bZeroX, LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.8;
pragma experimental ABIEncoderV2;
import "./AdvancedToken.sol";
import "../shared/OracleNotifierInterface.sol";
interface IBZx {
function takeOrderFromiToken(
bytes... | the average interest that borrowers are currently paying for open loans | function avgBorrowInterestRate()
public
view
returns (uint256)
{
uint256 assetBorrow = totalAssetBorrow;
if (assetBorrow != 0) {
return _protocolInterestRate(assetBorrow)
.mul(checkpointSupply)
.div(totalAssetSupply());
... | 5,462,748 |
./partial_match/4/0xEF6FF362d35973C63daB80484F4712aabd80a91E/sources/GovTreasurer.sol | DEPOSIT | FARMING ASSETS (TOKENS) | RE-ENTRANCY DEFENSE | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accGDAOPerShare).div(1e12).sub(user.rewardDebt);
user.amount ... | 8,769,177 |
./full_match/4/0x18Be7dB1a84062eE9e7361A686495d7b3Fc97a26/sources/contracts/TradingContract.sol | The withdraw function is a function with which investors can withdraw their funds in a tradingContract. Theapplicable fees will be calculated in this function. Check for equity in pairedToken, and swap the investor fraction into ETH. Check for equity in baseToken, and swap the investor fraction into ETH.In case of posi... | function withdraw() public updateSubtractedSupply(msg.sender) {
require(fractions[msg.sender] > 0);
uint256 _pairedTokenBalance = pairedToken.balanceOf(address(this));
uint256 _baseTokenBalance = baseToken.balanceOf(address(this)).sub(accumulatedFees);
uint256 _swappedAmountPaired... | 658,677 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.6;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/cont... | Pay the platform Pay the royalty Pay the seller | function auctionClaim(uint256 _tokenId)
public
onlyAuctionedToken(_tokenId)
nonReentrant
{
Auction storage auction = auctions[_tokenId];
require(block.timestamp > auction.deadline, "Auction not over");
auction.isClaimed = true;
uint256 salePrice = auction.winningBid.amount;
uint25... | 5,995,712 |
./partial_match/1/0xAdFc8C296eb7CEc677C2DdecE28007A3D4e465a1/sources/contracts/apestaking/base/CApe.sol | 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./ | function _mint(address account, uint256 sharesAmount)
internal
virtual
whenNotPaused
{
require(account != address(0), "mint to the zero address");
_totalShare = _totalShare.add(sharesAmount);
shares[account] = shares[account].add(sharesAmount);
}
| 2,890,280 |
./partial_match/97/0x3601Fe48B06b0BEC400226Ea95543463566F78f7/sources/EchipsPresale.sol | return the number of token units a buyer gets per wei./ | function rate() public view returns (uint256) {
return _rate;
}
| 11,349,612 |
./full_match/1/0x82a7b5842085f434c6584A8c44b6A1C15c25a512/sources/contracts/test/ExternalCollateralLiquidator.sol | @inheritdoc ICollateralLiquidator/ | function name() external pure returns (string memory) {
return "ExternalCollateralLiquidator";
}
| 9,659,466 |
./full_match/1/0x422d9dfD61Ba0a7d5F95f12636b0Fd90B34F9d55/sources/browser/CoreVaults.sol | Safe core transfer function, just in case if rounding error causes pool to not have enough COREs. | function safeCoreTransfer(address _to, uint256 _amount) internal {
uint256 coreBal = core.balanceOf(address(this));
if (_amount > coreBal) {
core.transfer(_to, coreBal);
coreBalance = core.balanceOf(address(this));
core.transfer(_to, _amount);
... | 3,077,178 |
/*
Copyright 2019 Set Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | Fetches all TradingPool state associated with a new TWAP rebalance auction. Compatible with: - RebalancingSetTokenV2/V3 - Any Fee Calculator - TWAP Liquidator _rebalancingSetToken RebalancingSetToken contract instance return RebalancingLibrary.State Current rebalance state on the RebalancingSetToken r... | function fetchTradingPoolTWAPRebalanceDetails(
IRebalancingSetTokenV2 _tradingPool
)
external
view
returns (SocialTradingLibrary.PoolInfo memory, TWAPRebalanceInfo memory, CollateralSetInfo memory)
{
(
TWAPRebalanceInfo memory tradingPoolInfo,
... | 5,456,666 |
pragma solidity ^0.4.24;
/**
* This utility library was forked from https://github.com/o0ragman0o/LibCLL
*/
library LinkedListLib {
uint256 constant NULL = 0;
uint256 constant HEAD = 0;
bool constant PREV = false;
bool constant NEXT = true;
struct LinkedList {
mapping (uint256 => mappin... | Update inventory and price by `_vendorId`, `_rpid`, `_date`, `_tokenId`, `_price` and `_inventory` _vendorId The vendor id _rpid The rate plan id _date The date desc (20180723) _tokenId The digital token id _price The price to be updated _inventory The inventory to be updated/ | function updatePriceAndInventories(uint256 _vendorId, uint256 _rpid, uint256 _date, uint256 _tokenId, uint256 _price, uint16 _inventory)
public
onlyOwnerOrAuthorizedContract {
if (vendors[_vendorId].ratePlans[_rpid].prices[_date].init) {
vendors[_vendorId].ratePlans[_rpid].price... | 1,978,841 |
./partial_match/1/0x89D660f454314021ceb19dEfBe000675a21B6C2a/sources/SabaiVesting.sol | Release vested amount of tokens. vestingScheduleId the vesting schedule identifier amount the amount to release/ | function release(
bytes32 vestingScheduleId,
uint256 amount
)
public
nonReentrant
onlyIfVestingScheduleNotRevoked(vestingScheduleId){
VestingSchedule storage vestingSchedule = vestingSchedules[vestingScheduleId];
bool isBeneficiary = msg.sender == vestingS... | 16,175,810 |
./full_match/1/0xa3fe7EdAB15b257227Ebc296C6d8C15Bc6772b01/sources/contracts/JBToken.sol | / Can't approve for a wrong project. | function approve(
uint256 _projectId,
address _spender,
uint256 _amount
) external override {
if (projectId != 0 && _projectId != projectId) revert BAD_PROJECT();
approve(_spender, _amount);
}
Transfer tokens to an account.
@param _projectId The ID of the project to which the to... | 17,119,699 |
pragma solidity ^0.4.20;
/*
* ERC20 interface
* see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
uint public totalSupply;
function balanceOf(address who) constant returns (uint);
function allowance(address owner, address spender) constant returns (uint);
function transfer(address... | remove a address from pools | function removePool(address pool) onlyOwner{
assert (pool != 0);
if (!isPool(pool)) throw;
for (uint i=0; i<pools.length - 1; i++) {
if (pools[i] == pool) {
pools[i] = pools[pools.length - 1];
break;
}
}
pools.l... | 7,648,199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.