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: BUSL-1.1
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol";
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";
import "./AloePredictions.sol";
import "./IncentiveVault.sol";... | @inheritdoc IAloePredictionsDerivedState It's more gas efficient to read from memory copy Proposal is entirely below the mean Proposal includes the mean Proposal is entirely above the mean Proposal is entirely below the mean b = mean - proposal.lower a = mean - proposal.upper b2 - a2 = (b-a)(b+a) = (proposal.upper - pr... | function aggregate() public view override returns (Bounds memory bounds) {
Accumulators memory accumulators = summaries[epoch].accumulators;
require(accumulators.stakeTotal != 0, "Aloe: No proposals with stake");
uint176 mean = uint176(accumulators.stake1stMomentRaw / accumulators.stakeTot... | 1,313,881 |
./full_match/1/0xA1F18e3E99976AdA8F598458c6c0dc0b5c713Db4/sources/contracts/ERC721ACMUpgradeable.sol | Internal function to invoke {IERC721Receiver-onERC721Received} on a target contract. from address representing the previous owner of the given token ID to target address that will receive the tokens tokenId uint256 ID of the token to be transferred _data bytes optional data to send along with the call return bool w... | function _checkContractOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721ReceiverUpgradeable(to... | 3,075,844 |
/**
*Submitted for verification at Etherscan.io on 2021-11-16
*/
/*
👋 DAY-1 PRODUCT SPEC + ROADMAP
Thank you all for your patience and continued support. We're really proud we can say that we are launching with as much functionality and efficiency as we are. A key factor in a token's cost to transact, regardless o... | While automated and artificial intelligent systems are and will continue to be a major priority for our team and at the core of the technology we develop, we want to stress that for launch, there will always be a human element involved in every step of the process to guarantee no systemic false-positives occur.ofit tak... | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (... | 10,501,604 |
./partial_match/1/0x62498AFF5002705d0eFB2A20533E022Bd6d5D737/sources/BondToken.sol | Record the settlement price at maturity in the form of a fraction and let the bond token expire./ | function expire(uint128 rateNumerator, uint128 rateDenominator)
public
override
onlyDeployer
returns (bool isFirstTime)
{
isFirstTime = !isExpired();
if (isFirstTime) {
_setRate(Frac128x128(rateNumerator, rateDenominator));
}
emit LogE... | 2,732,470 |
pragma solidity ^0.4.19;
pragma experimental ABIEncoderV2;
//David Chen
//Dapp Dechat
contract DappBase {
struct RedeemMapping {
address[] userAddr;
uint[] userAmount;
}
struct Task{
bytes32 hash;
address[] voters;
bool distDone;
}
mapping(uint => Rede... | key is (topic, msg.sender)swap best and secnd bestreplace secnd best | function voteOnTopic(bytes32 topichash) public returns(bytes32) {
require(subTopics[topichash].hash != "");
bytes32 parenthash = subTopics[topichash].parent;
require(parenthash != "" );
bytes32 key = sha3(msg.sender, parenthash);
if (voteinfo[key] >= 1){
return bytes32(0);
}
if(subTopics[topichash... | 7,282,536 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC721.sol";
import "./OwnedRanges.sol";
interface IERC2309 {
event ConsecutiveTransfer(uint indexed fromTokenId, uint toTokenId, address indexed fromAddress, address indexed toAddress);
event TransferForLots(uint fromTokenId, uint toTokenId, ... | Mints `tokenId` and transfers it to `to`, but usage of this method is discouraged, use {_safeMint} whenever possible | function _mint(address to, uint tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_holderTokens[to].add(tokenId);
_tokenOwners.s... | 12,948,066 |
./full_match/3/0x6165744662Ec03C05cA19aCb6a398Ec4309e1258/sources/Kyc.sol | Checks whether the requestor is admin | modifier isAdmin {
require(
admin == msg.sender,
"Only admin is allowed to operate this functionality"
);
_;
}
| 8,244,768 |
pragma solidity ^0.4.24;
import "zeppelin/math/SafeMath.sol";
/**
* @notice Additional math operations
**/
library AdditionalMath {
using SafeMath for uint256;
function max16(uint16 a, uint16 b) internal pure returns (uint16) {
return a >= b ? a : b;
}
function min16(uint16 a, uint16 b) in... | Adds signed value to unsigned value, throws on overflow./ | function add(uint256 a, int256 b) internal pure returns (uint256) {
if (b >= 0) {
return a.add(uint256(b));
return a.sub(uint256(-b));
}
}
| 13,120,596 |
./full_match/4/0x9C6E280f720DE8FeB11A04F5a1c842847520fbCF/sources/npcNFT.sol | OZ HELPERS | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal override(ERC721, ERC721Enumerable) {
_moveDelegates(delegates[from], delegates[to], 1);
super._beforeTokenTransfer(from, to, tokenId);
}
| 766,924 |
pragma solidity 0.4.26;
import "./copied/amm/converter/types/liquidity-pool-v2/LiquidityPoolV2Converter.sol";
/**
* @dev Improved testing version of the liquidity Pool v2 Converter
*
* This builds on top of oracle-based-amm/solidity/contracts/helpers/TestLiquidityPoolV2Converter.sol
* but adds methods for sett... | transfers tokens to/from the contract, increasing/decreasing the reserve balance to the desired balance without affecting staked balance. the sender should approve the contract to spend tokens first, in case tokens are transferred to the contract. _reserveToken reserve token, the reserve balance of which to increa... | function setReserveBalance(IERC20Token _reserveToken, uint256 _balance) public validReserve(_reserveToken) {
uint256 reserveBalance = reserves[_reserveToken].balance;
if(_balance > reserveBalance) {
addToReserveBalance(_reserveToken, _balance.sub(reserveBalance));
subtractFro... | 12,961,615 |
./partial_match/1/0x45eDb535942a8C84D9f4b5D37e1b25F91Ea4804c/sources/RAOToken.sol | Check the allowed value for the spender to withdraw from owner owner The address of the owner spender The address of the spender return the amount which spender is still allowed to withdraw from owner | function allowance(address _owner, address spender) public constant returns (uint256) {
return allowed[_owner][spender];
}
| 4,424,887 |
./full_match/1/0xDbadeFb972132C82BE8601Fa7b9Ba4801262271d/sources/@exoda/contracts/token/ERC20/ERC20.sol | See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address. - `from` mu... | function transferFrom(address from, address to, uint256 amount) override public virtual returns (bool)
{
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, amount);
return true;
}
| 16,409,163 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "./interfaces/IDeFiatPoints.sol";
import "./lib/@openzeppelin/token/ERC20/ERC20.sol";
import "./utils/DeFiatGovernedUtils.sol";
contract DeFiatPoints is ERC20("DeFiat Points v2", "DFTPv2"), IDeFiatPoints, DeFiatGovernedUtils {
using SafeMath for uint... | Points - view redirection address | function viewRedirection(address _address) public override view returns (bool) {
return _redirection[_address];
}
| 974,282 |
/* HTTPS://SYNCBOND.COM HTTPS://APP.SYNCBOND.COM
███████╗██╗░░░██╗███╗░░░██╗░██████╗░░░░██████╗░░██████╗░██╗░░░░██╗███████╗██████╗░███████╗██████╗░
██╔════╝╚██╗░██╔╝████╗░░██║██╔════╝░░░░██╔══██╗██╔═══██╗██║░░░░██║██╔════╝██╔══██╗██╔════╝██╔══██╗
███████╗░╚████╔╝░██╔██╗... | /TODO: add the rest of the variables, separate with appropriate url variable separators for ease of use | function putTogetherMetadataString(uint256 tokenId) public view returns(string memory){
string memory isDivs=gradualDivsById[tokenId]?"true":"false";
return string(abi.encodePacked("/?tokenId=",tokenId.toString(),"&lAddr=",lAddrById[tokenId].toString(),"&syncPrice=", syncPriceById[tokenId].toString(),"&syncAm... | 7,280,277 |
./partial_match/1/0x19c5990E1A04ab4567B29d5822F55CDA44d53D4C/sources/StrategyUwuWeth.sol | Emergency functions call contract in current context throw if delegatecall failed | function _withdrawSome(uint256 _amount) internal virtual returns (uint256);
function harvest() public virtual;
function execute(address _target, bytes memory _data) public payable returns (bytes memory response) {
require(msg.sender == timelock, "!timelock");
require(_target != address(0)... | 2,775,782 |
pragma solidity ^0.4.10;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
library DexLib {
using SafeMath for uint;
uint constant MAXORDER = 2**12;
uint constant MAXTOKEN = 2**7;
uint constant MAXBATCH = 2**7;
enum OrderType {Bid, Ask}
event SettledOrder(string tok... | how to set the settlement price when bid and ask prices are not equal???buy (volume) "tokenTo" with (volume price) "tokenFrom" [tokenFrom][tokenTo] | function firstPriceAuction(Dex storage dex, uint[] sortedBid, uint[] sortedAsk,
for (; i < self.bidBook[cur].numOrder && j < self.askBook[cur].numOrder;) {
if (orderBid.price >= orderAsk.price) {
uint price = (orderBid.price + orderAsk.price) / 2;
uint volume = m... | 6,352,427 |
./full_match/80001/0xa64BE9813EA7B7B0995B51F919a25235006B99cF/sources/sfds.sol | See {IERC721Enumerable-tokenByIndex}./ | function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index < totalSupply(), "ERC721Tradeable: global index out of bounds");
return _allTokens[index];
}
| 9,492,732 |
./full_match/1/0x60Fa954e22c42F52E8C815a9476f339BD38AEEf7/sources/contracts/core/defi/three-x/storage/AbstractBatchStorage.sol | todo `clients` ultimately may withdraw tokens for a batch they create at anytime by calling withdrawSourceTokenFromBatch. tokens may be transfered out of this contract if the given recipient is a registered client or if the client has granted an allowance to a recipient to receive tokens. this means that in order to tr... | function _transfer(
IERC20 token,
address owner,
address recipient,
bytes32 batchId,
uint256 amount
) internal {
if (recipient != address(0)) {
Batch memory batch = batches[batchId];
uint256 allowance = allowances[msg.sender][recipient][batchId][address(token)];
bool hasAll... | 4,889,323 |
./partial_match/3/0x25E2e5D8EcC4fE46a9505079Ed29266779dC7D6f/sources/HoprChannels.sol | redeem ticket preImage bytes32 the value that once hashed produces recipients hashedSecret hashedSecretASecretB bytes32 hash of secretA concatenated with secretB amount uint256 amount 'msg.sender' will receive winProb bytes32 win probability r bytes32 s bytes32 v uint8/ @TODO Uncomment next line to enable salted... | function redeemTicket(
bytes32 preImage,
bytes32 hashedSecretASecretB,
uint256 amount,
bytes32 winProb,
address counterparty,
bytes32 r,
bytes32 s,
uint8 v
) external {
require(amount > 0, "HoprChannels: amount must be strictly greater than... | 5,147,860 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
pragma experimental ABIEncoderV2;
library Internal_Merkle_Library_Sorted_Hash {
// Hashes a and b in the order they are passed
function hash_node(bytes32 a, bytes32 b) internal pure returns (bytes32 hash) {
assembly {
mstore(0x00, a)
... | Get the original Element Merkle Root and derive Append Proof, given an index, a leaf, an update leaf, and a Single Proof | function get_append_proof_from_leaf_and_single_proof_update(
uint256 index,
bytes32 leaf,
bytes32 update_leaf,
bytes32[] calldata proof
) internal pure returns (bytes32 append_hash, bytes32[] memory append_proof) {
uint256 proof_index = proof.length - 1;
uint256 append_node_index = uint256(p... | 12,859,710 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./Signature.sol";
contract TGE is Ownable, Signature {
using SafeERC20 for ... | Sets the minimum and maximum token prices before the TGE starts. Also sets the deposit cap. min The minimum token price in ETH. max The maximum token price in ETH. _depositCap The ETH deposit cap./ | function setMinMaxForexPrices(
uint256 min,
uint256 max,
uint256 _depositCap
) external onlyOwner {
assert(!hasTgeBeenStarted());
require(max > min && _depositCap > max, "Invalid values");
minTokenPrice = min;
maxTokenPrice = max;
depositCap = _dep... | 9,961,095 |
// ________ ________ ___ ________ ___ ___ ___ ___
//|\ ____\|\ __ \|\ \ |\ __ \ |\ \ / /|\ \ / /|
//\ \ \___|\ \ \|\ \ \ \ \ \ \|\ \ \ \ \/ / | \ \/ / /
// \ \ \ __\ \ __ \ \ \ \ \ __ \ \ \ / / \ \ / /
// \ \ \|\ \ \ \ \ \ \ \____\ \ \ \ ... | Return new owner of lost pirate from current salvagers | function getNewOwnerForPirate(uint256 seed, uint256 tokenId) internal{
tokenInfo memory pirate = galaxy[tokenId];
uint256 roll = randomIntInRange(seed, salvagersStaked.length);
tokenInfo memory salvager = galaxy[salvagersStaked[roll]];
emit HammieStolen(pirate.owner, salvager.owner, ... | 1,154,573 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.4;
import {ConfigContract} from "./ConfigContract.sol";
import {
BatcherContract,
BatchConfig,
TransactionType
} from "./BatcherContract.sol";
struct CipherExecutionReceipt {
bool executed;
address executor;
uint64 halfStep;
bytes32 cip... | call target function, ignoring any errors | function executeTransactions(
address targetAddress,
bytes4 targetFunctionSelector,
uint64 gasLimit,
bytes[] calldata transactions
) private returns (bytes32) {
bytes32 batchHash;
for (uint64 i = 0; i < transactions.length; i++) {
bytes memory callData... | 15,856,360 |
/**
*Submitted for verification at Etherscan.io on 2021-04-01
*/
// File: contracts/token/interfaces/IERC20Token.sol
pragma solidity 0.4.26;
/*
ERC20 Standard Token interface
*/
contract IERC20Token {
// these functions aren't abstract since the compiler emits automatically generated getter functions as ext... | ev Integer division of two numbers truncating the quotient, reverts on division by zero. aram _x dividend aram _y divisor eturn quotient/ | function div(uint256 _x, uint256 _y) internal pure returns (uint256) {
require(_y > 0);
uint256 c = _x / _y;
return c;
}
| 2,415,126 |
// File: contracts/interface/IERC165.sol
/**
* @title IERC165
* @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
*/
interface IERC165 {
/**
*
*
* ,,,,,,,, ... | Returns the Name for a given token ID. Throws if the token ID does not exist. May return an empty string. tokenId uint256 ID of the token to query/ | function tokenName(uint256 tokenId) external view returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: Name query for nonexistent token");
uint256 countType = _getTypeId(tokenId);
return _typeName[countType];
}
| 4,812,101 |
pragma solidity ^0.4.24;
// XXX enable returning structs from internal functions
pragma experimental ABIEncoderV2;
import {DSToken as Token} from "contracts/dappsys.sol";
// External interface
interface PreimageManager {
function submitPreimage(bytes32 x) external;
function revealedBefore(bytes32 h, uint T) ... | using memory here reduces gas cost from ~ 300k to 200k can't return from state modifying function | function createChannel(address other, address tokenAddress) public returns (uint) {
uint channelID = channelCounter;
Channel memory channel;
Payment memory payment;
channel.tokenAddress = tokenAddress;
channel.left.addr = msg.sender;
channel.right.addr = other;
channel.b... | 2,560,220 |
./partial_match/1/0x157ED4Dcd657d17Aa2c3dCA31f30043e8Eff4f2E/sources/contracts/libraries/LiquidityHelper.sol | Calculates the liquidity amount using current ranges _pool Instance of the pool _tickLower Lower tick _tickUpper Upper tick _liquidity Liquidity of the pool/ get sqrtRatios required to calculate liquidity calculate liquidity needs to be added | function getAmountsForLiquidity(
IUniswapV3Pool _pool,
int24 _tickLower,
int24 _tickUpper,
uint128 _liquidity
) public view returns (uint256 amount0, uint256 amount1) {
(uint160 sqrtRatioX96, , , , , , ) = _pool.slot0();
(amount0, amount1) = LiquidityAmounts.getA... | 3,598,302 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.11;
import "../Rollup.sol";
import "./IRollupFacets.sol";
import "../../bridge/interfaces/IOutbox.sol";
import "../../bridge/interfaces/ISequencerInbox.sol";
import "../../libraries/Whitelist.sol";
import "@openzeppelin/contracts/proxy/UpgradeableBeacon.sol... | Functions are only to reach this facet if the caller is the owner so there is no need for a redundant onlyOwner check/ Add a contract authorized to put messages into this rollup's inbox _outbox Outbox contract to add/ | function setOutbox(IOutbox _outbox) external override {
outbox = _outbox;
delayedBridge.setOutbox(address(_outbox), true);
emit OwnerFunctionCalled(0);
}
| 12,870,281 |
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Enjinstarter
pragma solidity ^0.7.6;
pragma abicoder v2; // solhint-disable-line
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "... | return wallet_ the address where funds are collected/ | function wallet() external view override returns (address wallet_) {
wallet_ = _wallet;
}
| 6,367,986 |
pragma solidity ^0.5.0;
/* Oh wow, it's finally happening /*
╔══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╗
║ $$$$$$$\ $$\ $$\ $$\ $$\ $$$$$$\ $$$$$$$\ $$$$$$$$\ ║
║ $... | Withdraw outstanding divs to internal balance | function withdrawDivs() public onlyParent {
hourglass.withdraw();
}
| 1,778,953 |
./full_match/1/0xD58868004D5aac1FD0Da76D3b553aB2ed5354385/sources/contracts/PaymentSplitterEP.sol | NOTE: take care of how much accounts you use in case gas consumption goes to infinity/ | function releaseMany(address payable[] memory accounts) public virtual {
for (uint i = 0; i < accounts.length; i++) {
release(accounts[i]);
}
}
| 9,708,788 |
pragma solidity 0.6.12;
import "./ITreasury.sol";
contract Treasury is ITreasury {
/** @dev Constants */
// Minimum value required to be transfered when creating any proposal
uint256 public proposalMinDeposit = 100 ether;
// Percentage (out of 100) of the funds that correspond to gitcoin
uint256 ... | All funds from the contract are burned | function shutdown() public override {
require(withShutdownInProgress(), "No shutdown in progress");
require(shutdownScheduledAt + shutdownGracePeriod < now, "Shutdown grace period not yet over");
selfdestruct(address(0));
}
| 12,997,017 |
./partial_match/1/0x8a3515f5D127342fcBba56E13514D4A2391327e6/sources/contracts/interfaces/IPoolPositionMover.sol | IPool Defines the basic interface for an ParaSpace Pool./ Migration step0. User needs to breakup P2P orders on their own1. Repay Debt 1. if it's cAPE then deposit borrowed APE into old cAPE pool then repay 2. if it's not then just repay with borrowed tokens2. burn old NToken 1. move old NToken to new Pool, if it... | interface IPoolPositionMover {
function movePositionFromBendDAO(uint256[] calldata loanIds) external;
function movePositionFromParaSpace(
DataTypes.ParaSpacePositionMoveInfo calldata moveInfo
) external;
function claimUnderlying(
address[] calldata assets,
uint256[][] calldata ... | 4,311,964 |
// SPDX-License-Identifier: MIT
/* solhint-disable var-name-mixedcase */
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "./interfaces/ISwap.sol";
/**
* @ti... | Atomic ERC20 Swap nonce uint256 Unique and should be sequential expiry uint256 Expiry in seconds since 1 January 1970 signerWallet address Wallet of the signer signerToken address ERC20 token transferred from the signer signerAmount uint256 Amount transferred from the signer senderToken address ERC20 token transf... | function swap(
address recipient,
uint256 nonce,
uint256 expiry,
address signerWallet,
address signerToken,
uint256 signerAmount,
address senderToken,
uint256 senderAmount,
uint8 v,
bytes32 r,
bytes32 s
) external override {
_checkValidOrder(
nonce,
expiry... | 10,367,295 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./Letter.sol";
import "@openzeppelin/contracts/proxy/Clones.sol";
/// @title Letter Factory Contract
/// @author Bernardo A. Rodrigues
/// @notice Defines a Letter Factory, where new Clones of Letter Contract are deployed.
/// @dev Defines a Letter Fact... | Creates a new Letter Contract Clone. Creates a new Letter Contract Clone. _title Title of Letter to be created. Redirected to initLetter(). _firstPage Contents of the 1st Letter Page to be created. Redirected to initLetter(). _author Author Signature of the Letter (as in handwritten signature; NOT as in cryptograph... | function createLetter(string memory _title, string memory _firstPage, string memory _author)
external
returns (address) {
address letterClone = Clones.clone(_letterImplementation);
Letter(letterClone).initLetter(_title, _firstPage, _author, msg.sender);
_letters.push(letterClone);
... | 15,869,882 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
/**
* @title Owner
* @dev Set & change owner
*/
contract Owner {
address private owner;
// event for EVM logging
event OwnerSet(address indexed oldOwner, address indexed newOwner);
// modifier to check if caller is owner
... | owner can query and collect the penalty stored in the contract | function queryCollectedPenalty() external view isOwner returns (uint256) {
return collectedPenalty;
}
| 13,580,188 |
pragma solidity 0.4.13;
/**
* @title Wallet Getter Library
* @author Majoolr.io
*
* version 1.0.0
* Copyright (c) 2017 Majoolr, LLC
* The MIT License (MIT)
* https://github.com/Majoolr/ethereum-libraries/blob/master/LICENSE
*
* The Wallet Library family is inspired by the multisig wallets built by Consensys
... | Get sig requirements for minor tx spends self Wallet in contract storage return uint Number of sigs required | function getRequiredMinor(WalletMainLib.WalletData storage self) constant returns (uint) {
return self.requiredMinor;
}
| 2,063,505 |
./full_match/1/0x4e5B0EE20B5d7c7d01cb7f9313bC93d5dB385C73/sources/contracts/vesting/FundsDistributorFactoryA.sol | Withdraw remaining tokens after the cliff period has ended amount Amount of tokens to withdraw/ | function withdrawTokens(uint amount) external onlyOwner returns(bool){
require(block.timestamp > cliff, "FundsDistributorFactoryA::withdrawTokens: cliff period not complete");
IERC20 pushTokenInstance = IERC20(pushToken);
pushTokenInstance.safeTransfer(msg.sender, amount);
return tru... | 9,795,914 |
pragma solidity ^0.4.24;
contract BasicAccessControl {
address public owner;
// address[] public moderators;
uint16 public totalModerators = 0;
mapping (address => bool) public moderators;
bool public isMaintaining = false;
constructor() public {
owner = msg.sender;
}
... | Acquires the monster from Etheremon using tokens _kyberProxy KyberNetworkProxyInterface address _etheremon EtheremonWorldNFT address _classId Class ID of monster _name Name of the monster token ERC20 token address tokenQty Amount of tokens to be transferred by user maxDestQty Actual amount of ETH needed to purch... | function catchMonster(
KyberNetworkProxyInterface _kyberProxy,
EtheremonWorldNFT _etheremon,
uint32 _classId,
string _name,
ERC20 token,
uint tokenQty,
uint maxDestQty,
uint minRate,
address walletId
)
public
returns (uint m... | 1,045,869 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elem... | SPDX-License-Identifier: MIT | interface IWETH {
function deposit() external payable;
function withdraw(uint) external;
}
| 14,728,137 |
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
contract BTRST {
/// @notice EIP-20 token name for this token
string public constant name = "BTRST";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "BTRST";
/// @notice EIP-20 token decimals for this token
... | Transfer `amount` tokens from `src` to `dst` src The address of the source account dst The address of the destination account rawAmount The number of tokens to transfer return Whether or not the transfer succeeded/ | function transferFrom(address src, address dst, uint rawAmount) external returns (bool) {
address spender = msg.sender;
uint96 spenderAllowance = allowances[src][spender];
uint96 amount = safe96(rawAmount, "BTRST::approve: amount exceeds 96 bits");
if (spender != src && spenderAllow... | 6,694,443 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "../lendingpool/DataTypes.sol";
import "../credit/CreditSystem.sol";
import "./KyokoMath.sol";
import "./PercentageMath.sol";
import "./ReserveLogic.sol";
import "./GenericLogic.sol";
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeabl... | Sets the reserve factor of the reserve self The reserve configuration reserveFactor The reserve factor/ | function setReserveFactor(DataTypes.ReserveData storage self, uint16 reserveFactor)
internal
{
require(reserveFactor <= MAX_VALID_RESERVE_FACTOR, "RC_INVALID_RESERVE_FACTOR");
self.factor = reserveFactor;
}
| 11,804,919 |
pragma solidity >=0.4.24;
import "./Store.sol";
import "../modules/Ownable.sol";
import "../libraries/AddressUtils.sol";
///@title Governance means to govern the protocol well.
contract Governance is Ownable, Store {
using AddressUtils for address;
//relayers of the contract
mapping(address => bool) publ... | modify the block number of withdraw to wait. _number block number to wait/ | function modifyWithdrawBlock(uint256 _number) public onlyOwner {
require(_number >= 1, "block number to wait should be >=1.");
WITHDRAW_BLOCK_NUM = _number;
}
| 13,018,730 |
pragma solidity ^0.4.21;
import "./Ownable.sol";
/**
* Escrow smart contract serves 3 parties.
*
* Judge = is able to move funds to flexiana or customer.
* Customer = Flexiana's client
* Flexiana = we
*
* After creating contract, setAddressesOnce() have to be called.
*
* @author Jiri Knesl <jiri@flexiana... | If client agrees or if judge decides, funds are transfered to flexiana./ | function transferToFlexiana() public {
require(customerStatus == Statuses.ShouldTransferToCustomer || msg.sender == owner);
flexiana.transfer(address(this).balance);
}
| 14,084,722 |
// SPDX-License-Identifier: Unlicense
// solhint-disable var-name-mixedcase
pragma solidity >=0.8.4;
import "./ERC20.sol";
import "./IERC20Permit.sol";
/// @title ERC20Permit
/// @author Paul Razvan Berg
contract ERC20Permit is
IERC20Permit, // one dependency
ERC20 // one dependency
{
/// PUBLIC STORAGE /... | @inheritdoc IERC20Permit | function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public override {
if (owner == address(0)) {
revert ERC20Permit__OwnerZeroAddress();
}
if (spender == addr... | 949,130 |
pragma solidity ^0.4.15;
/**
* @title DirectCrowdsaleLib
* @author Majoolr.io
*
* version 1.0.0
* Copyright (c) 2017 Majoolr, LLC
* The MIT License (MIT)
* https://github.com/Majoolr/ethereum-libraries/blob/master/LICENSE
*
* The DirectCrowdsale Library provides functionality to create a initial coin offering... | Called when an address wants to purchase tokens self Stored crowdsale from crowdsale contract _amount amound of wei that the buyer is sending return true on succesful purchase if the token price increase interval has passed, update the current day and change the token priceprevents going out of bounds on the tokenPri... | function receivePurchase(DirectCrowdsaleStorage storage self, uint256 _amount) returns (bool) {
require(msg.sender != self.base.owner);
require(self.base.validPurchase());
require((self.base.ownerBalance + _amount) <= self.base.capAmount);
if ((self.changeInterval > 0) && (now >= (self.lastPriceChange... | 1,802,735 |
./full_match/80001/0xFF36c08C58f4a931ef7a457c001470d0B8847125/sources/contracts/IPV2.sol | off-chain signing service can then read the pending transaction from thesmart contract using the getPendingTransaction function, sign it, and broadcast it to the blockchain | function getPendingTransaction(address _user, uint256 _transactionId) public view returns (address to, uint256 value, bytes memory data) {
PendingTransaction storage pendingTransaction = _pendingTransactions[_user][_transactionId];
return (pendingTransaction.to, pendingTransaction.value, pendingTran... | 5,552,028 |
// contracts/vaults/BalleMaster.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/Reentrancy... | Function to update reward variables for all vaults. Be careful of gas spending!/ | function massUpdateVaults() internal {
uint256 length = vaultInfo.length;
for (uint256 vid = 0; vid < length; ++vid) {
updateVault(vid);
}
}
| 5,392,879 |
./partial_match/5/0x5De88AF8F75A360B357760B6Bd61786A2C48b326/sources/contracts/3hree.sol | Creates `_amount` token to `_to`. Owner is MasterChef Contract. | function mint(address _to, uint256 _amount) public onlyOwner {
require(ERC20.totalSupply() + _amount <= maxSupply(), "ERC20Capped: max supply reached");
_mint(_to, _amount);
}
| 16,886,538 |
./full_match/1/0x333F0C9dC07686d458C6a171DaBA777485BbE4E3/sources/contracts/Wallet.sol | only owner can withdraw tokens token - token address _amount - amount of tokens to withdraw/ | function withdrawToken(IERC20 token, uint256 _amount) external onlyOwner {
if (IERC20(token).balanceOf(address(this)) < _amount) revert InsufficientBalance();
_safeWithdrawToken(msg.sender, token, _amount);
}
| 2,898,545 |
./partial_match/1/0x31577476950ec86E2D6D99dcc756A35AEa14389a/sources/MultiProductEscrow.sol | Only the seller can execute these functions./ | modifier onlySeller(string calldata transactionId) {
TransactionInfo memory transactionInfo = transactions[transactionId];
require(transactionInfo.created, "Invalid transaction.");
require(!transactionInfo.completed, "Transaction already completed.");
require(
transactionInfo.sellerAddress == msg.sender,
... | 16,070,563 |
./full_match/421611/0x481148ed881807B574548B759141A0F515060d3f/sources/_aave/core-v3/contracts/protocol/libraries/logic/ReserveLogic.sol | Updates the reserve indexes and the timestamp of the update reserve The reserve reserve to be updated reserveCache The cache layer holding the cached protocol data/only cumulating if there is any income being producedas the liquidity rate might come only from stable rate loans, we need to ensurethat there is actual v... | function _updateIndexes(
DataTypes.ReserveData storage reserve,
DataTypes.ReserveCache memory reserveCache
) internal {
reserveCache.nextLiquidityIndex = reserveCache.currLiquidityIndex;
reserveCache.nextVariableBorrowIndex = reserveCache.currVariableBorrowIndex;
if (reserveCache.currLiquidityR... | 13,220,321 |
// @author Unstoppable Domains, Inc.
// @date June 16th, 2021
pragma solidity ^0.8.0;
import '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol';
import './BaseForwarder.sol';
abstract contract EIP712UpgradeableGap {
/* solhint-disable var-name-mixedcase */
bytes32 private _HASHED_NAME;
... | 0xb88d4fde == bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)'))/ | function safeTransferFromFor(
address from,
address to,
uint256 tokenId,
bytes calldata data,
bytes calldata signature
) external {
uint256 gas = gasleft();
_executeFor(abi.encodeWithSelector(0xb88d4fde, from, to, tokenId, data), tokenId, signature, gas);
... | 14,053,458 |
./partial_match/7700/0x156ecfbdd58b9012192b5B36B1164FfA60e605A0/sources/contracts/Flow.sol | Initial mint: total 400m we will handle the creation of the veNFTs ourselves and not use minter 4M for "Genesis" pools 30M for liquid team allocation (40M excl init veNFT) 48M for future partners | function initialMint(address _recipient) external {
require(msg.sender == minter && !initialMinted);
initialMinted = true;
_mint(_recipient, 200 * 1e6 * 1e18);
}
| 3,507,976 |
/*
███████╗ ██████╗ ██╗ ██╗ ██████╗ █████╗ ███╗ ███╗███████╗
██╔════╝██╔═══██╗╚██╗██╔╝ ██╔════╝ ██╔══██╗████╗ ████║██╔════╝
█████╗ ██║ ██║ ╚███╔╝ ██║ ███╗███████║██╔████╔██║█████╗
██╔══╝ ██║ ██║ ██╔██╗ ██║ ██║██╔══██║██║╚██╔╝██║██╔══╝
██║ ╚██████╔╝██╔╝ ██╗ ╚██████╔╝██║ ██║██║ ╚═╝... | the first 20% (ETH purchases) go to the minter the remaining 80% have a 10% chance to be given to a random staked fox seed a random value to select a recipient from elevatedRisk true if the user is at higher risk of losing their mint return the address of the recipient (either the minter or the fox thief's owner)/ | function _selectRecipient(uint256 seed, bool elevatedRisk) internal view returns (address) {
if (((seed >> 245) % (elevatedRisk ? 4 : 10)) != 0) {
}
address thief = foxGame.randomFoxOwner(seed >> 144);
if (thief == address(0x0)) {
return msg.sender;
}
return thief;
}
| 14,591,681 |
// SPDX-License-Identifier: BSD-4-Clause
pragma solidity 0.8.3;
import "./ABDKMath64x64.sol";
library BlackScholes {
/**
* @dev Function to get the option price using the Black-Sholes method.
* @param isCallOption True if the option type is CALL, false for PUT.
* @param strikePrice The strike price... | Private function to calculate the normal cummulative distribution. x The value normalized with `ABDKMath64x64` library to be calculated. return The normal cummulative distribution normalized with `ABDKMath64x64` library./ | function _normalCummulativeDistribution(int128 x) private pure returns (int128) {
int128 z = ABDKMath64x64.div(x, 0x16a09e667f3bcc908);
int128 t =
ABDKMath64x64.div(
0x10000000000000000,
ABDKMath64x64.add(0x10000000000000000, ABDKMath64x64.mul(0x53dd02a4f5... | 927,923 |
./full_match/11155111/0xEcbF5BfAeD62D9862e05F5762A46004CB9ff515B/sources/contracts/CrowdFunding.sol | Comment to a Project | function donateToCampaign(
uint256 _campaignId,
string memory _message
) public payable {
uint256 amount = msg.value;
Donate storage donate = donations[numberOfDonations];
numberOfDonations++;
donate.id = numberOfDonations;
donate.campaignId = _campaignI... | 3,795,993 |
pragma solidity ^0.6.7;
contract Shard {
/// @notice EIP-20 token name for this token
string public constant name = "Shard";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "SHARD";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals ... | Approve `spender` to transfer up to `amount` from `src` This will overwrite the approval amount for `spender` spender The address of the account which may transfer tokens rawAmount The number of tokens that are approved (2^256-1 means infinite) return Whether or not the approval succeeded/ | function approve(address spender, uint rawAmount) external returns (bool) {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
amount = safe96(rawAmount, "Shard::approve: amount exceeds 96 bits");
}
_approve(msg.sender, spender, amount);
... | 5,874,386 |
./full_match/43114/0xD97B4D013b31df04b6917Dc318D3197169c36bFD/sources/contracts/LongShort.sol | Transfers outstanding synth tokens from a next price mint to the user. The outstanding synths should already be reflected for the user due to balanceOf in SyntheticToken.sol, this just does the accounting. marketIndex An uint32 which uniquely identifies a market. user The address of the user for whom to execute the ... | function _executeOutstandingNextPriceMints(
uint32 marketIndex,
address user,
bool isLong
) internal virtual {
uint256 currentPaymentTokenDepositAmount = userNextPrice_paymentToken_depositAmount[
marketIndex
][isLong][user];
if (currentPaymentTokenDepositAmount > 0) {
userNextPri... | 4,519,998 |
./partial_match/1/0x9460b380c57F65e8AFc4bA3518F643A526640F26/sources/contracts/dependencies/uniswapv3-core/UniswapV3Pool.sol | Common checks for valid tick inputs. | function checkTicks(int24 tickLower, int24 tickUpper) private pure {
if (tickLower >= tickUpper) revert TLU();
if (tickLower < TickMath.MIN_TICK) revert TLM();
if (tickUpper > TickMath.MAX_TICK) revert TUM();
}
| 4,203,062 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/... | Function to set pending strategy address _pendingStrategy Address of pending strategy | function setPendingStrategy(address _pendingStrategy) external onlyOwner {
require(canSetPendingStrategy, "Cannot set pending strategy now");
pendingStrategy = _pendingStrategy;
}
| 13,715,949 |
/**
*Submitted for verification at Etherscan.io on 2020-05-29
*/
pragma solidity ^0.5.0;
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transf... | transferFrom function to tansfer tokens when token is not paused/ | function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transferFrom(_from, _to, _value);
}
| 168,744 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external retu... | Computes the return between oldPrice and newPrice. Gets the effective leverage for the return calculator. Note: if this parameter doesn't exist for this calculator, this method should return 1. | interface ReturnCalculatorInterface {
function computeReturn(int oldPrice, int newPrice) external view returns (int assetReturn);
function leverage() external view returns (int _leverage);
}
| 972,235 |
// Sources flattened with hardhat v2.6.7 https://hardhat.org
// File @openzeppelin/contracts/utils/introspection/IERC165.sol@v4.3.2
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implemente... | Get token URI tokenId ID of the token to retrieve/ | function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(
_exists(tokenId),
"URI query for nonexistent token"
);
if(revealed == false)
return baseURI;
... | 6,989,128 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8;
import "./AdminControlled.sol";
import "./INearBridge.sol";
import "./NearDecoder.sol";
// used to sign messages of the validators that approve the block, and thus to also check validity of the signature in the submitted NEAR block header
import "./Ed2... | used to verify whether signature is valid or invalid by challenge Shifting by a number >= 256 returns zero. use Ed25519 contract to check if the signature is invalid | function checkBlockProducerSignatureInHead(uint signatureIndex) public view override returns (bool) {
require((untrustedSignatureSet & (1 << signatureIndex)) != 0, "No such signature");
unchecked {
Epoch storage untrustedEpoch = epochs[untrustedNextEpoch ? (curEpoch + 1) % 3 : curEpoch];... | 12,793,767 |
pragma solidity ^0.5.16;
interface IERC20 {
function TOTALSUPPLY344() external view returns (uint256); //inject NONSTANDARD NAMING
function BALANCEOF995(address account) external view returns (uint256); //inject NONSTANDARD NAMING
function ... | inject NONSTANDARD NAMING | function SAFEAPPROVE493(IERC20 token, address spender, uint256 value) internal { | 5,414,263 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.6;
import "./libraries/IDGenerator.sol";
import "./interfaces/IHologramAccumulator.sol";
import "./interfaces/IPostManager.sol";
import "./accessors/NameAccessor.sol";
import "./token/DonationPost.sol";
import "./token/RefundRequest.sol";
import "./token/Recei... | Gets the cancelable amount. receiptId uint256 of the payment ID | function cancelableAmount(uint256 receiptId) public view returns (uint256) {
uint256 postId = allDonations[receiptId].postId;
return
allPosts[postId].endTime > block.timestamp
? allDonations[receiptId].amount
: 0;
}
| 14,076,537 |
./partial_match/3/0x8e1f2580D4759fFBF7d38Ff319348B5373A7Ee1a/sources/AURA.sol | Dev fee Tax fee Take liquidity fee | function collectFee(address account, uint256 amount, uint256 rate) private returns (uint256) {
uint256 transferAmount = amount;
if(_devFee != 0){
uint256 devFee = amount.mul(_devFee).div(10**(_feeDecimal + 2));
transferAmount = transferAmount.sub(devFee);
... | 5,172,088 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';
import {ChainlinkClient} from '@chainlink/contracts/src/v0.8/ChainlinkClient.sol';
import {Chainlink} from '@chainlink/contracts/src/v0.8/Chainlink.sol';
import {IERC677} from './interfaces/IERC... | Token Info / | function getChainlinkToken() public view override returns (address) {
return chainlinkTokenAddress();
}
| 15,830,257 |
./full_match/5/0x3389289123be1DD020aC09c631d8C68470Bdad2C/sources/browser/Escrow.sol | Abort the purchase and reclaim the ether. Can only be called by the seller before the contract is locked. We use transfer here directly. It is reentrancy-safe, because it is the last call in this function and we already changed the state. | function abort()
public
onlySeller
inState(State.Created)
{
emit Aborted();
state = State.Inactive;
seller.transfer(address(this).balance);
}
| 1,865,603 |
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Pausable.sol";
import "@openzeppelin/contracts/access/Acce... | Unpauses all token transfers. See {ERC721Pausable} and {Pausable-_unpause}. Requirements: - the caller must have the `PAUSER_ROLE`./ | function unpause() external virtual onlyOwner {
_unpause();
}
| 184,663 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import { Chess } from "./Chess.sol";... | Returns the HTML for a particular pillar within the image. _board The board after the player's and engine's move are played. _dim The dimension of the bits within a pillar. _row The row index of the pillar. _col The column index of the pillar. return The HTML for the pillar described by the parameters. | function getPillarHtml(uint256 _board, uint256 _dim, uint256 _row, uint256 _col)
internal pure
returns (string memory)
{
string memory pillar = string(
abi.encodePacked(
'<div class="c r',
_row.toString(),
" c",
... | 454,538 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
pragma abicoder v2;
/**
* @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 R... | this block is equivalent to r = uint256(1) << (BitMath.mostSignificantBit(x) / 2); however that code costs significantly more gas | function sqrt(uint256 x) internal pure returns (uint256) {
if (x == 0) return 0;
uint256 xx = x;
uint256 r = 1;
if (xx >= 0x100000000000000000000000000000000) {
xx >>= 128;
r <<= 64;
}
if (xx >= 0x10000000000000000) {
xx >>= 64;
... | 9,358 |
// SPDX-License-Identifier: MIT
/* solhint-disable var-name-mixedcase */
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./interfaces/ILight.sol";
/**
* @t... | Revoke authorization of a signer Emits a Revoke event/ | function revoke() external override {
address tmp = authorized[msg.sender];
delete authorized[msg.sender];
emit Revoke(tmp, msg.sender);
}
| 996,814 |
./partial_match/1/0xBfCDE0b176D1593edc3cADF4dd5F82770d99aDBE/sources/MoonRabbit.sol | exclude from paying fees or having max transaction amount | constructor() ERC20(unicode"Moon Rabbit",unicode"月の兎") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Route... | 9,335,321 |
/**
*Submitted for verification at Etherscan.io on 2021-10-19
*/
/*
____ __ __ __ _
/ __/__ __ ___ / /_ / / ___ / /_ (_)__ __
_\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
/___/
* Synthetix: DebtCache.sol
*
* Latest source (may be newe... | ========== VIEWS ========== / | function accessControl(bytes32 section, address account) external view returns (bool canSuspend, bool canResume);
function requireSystemActive() external view;
function requireIssuanceActive() external view;
function requireExchangeActive() external view;
function requireExchangeBetweenSynthsAll... | 7,765,369 |
./full_match/3/0xAEF5084e3Aef177Ee8ac09116c87649261074028/sources/CryptoCatsMarketV2.sol | require(etheria.getOwner(col, row) != msg.sender); | function createAuction(uint catIndex) public {
cryptocats.buyCat(catIndex);
}
| 8,240,736 |
// SPDX-License-Identifier: MIT
/**
* @title BoredMiladys contract
* @dev Extends ERC721A Non-Fungible Token Standard basic implementation
*/
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Inte... | Mints `quantity` tokens and transfers them to `to`. Requirements: - `to` cannot be the zero address. - `quantity` must be greater than 0. Emits a {Transfer} event./ Overflows are incredibly unrealistic. balance or numberMinted overflow if current value of either + quantity > 3.4e38 (2128) - 1 updatedIndex overflows if ... | function _mint(
address to,
uint256 quantity,
bytes memory _data,
bool safe
) internal {
uint256 startTokenId = currentIndex;
require(to != address(0), "ERC721A: mint to the zero address");
require(quantity != 0, "ERC721A: quantity must be greater than 0")... | 251,647 |
./full_match/11155111/0x7c045ecB589D4fF5c06B712C2d6BB1e855f4a719/sources/contracts/NFT.sol | ============================================================ Finance Management ============================================================ | function withdraw() external onlyRole(DEFAULT_ADMIN_ROLE) {
require(os, "Withdraw not successful");
}
| 3,800,199 |
// Sources flattened with hardhat v2.6.1 https://hardhat.org
// File @openzeppelin/contracts/utils/Context.sol@v4.3.0
// 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 are... | Returns the URI for a given token ID. May return an empty string. If the token's URI is non-empty and a base URI was set (via {_setBaseURI}), it will be added to the token ID's URI as a prefix. Reverts if the token ID does not exist. tokenIndex uint256 ID of the token/ | function tokenURI(uint tokenIndex) external view returns (string memory) {
require(_exists(tokenIndex), "Token does not exist");
return bytes(_baseURI).length != 0 ? string(abi.encodePacked(_baseURI, tokenIndex.toString())) : "";
}
| 1,335,358 |
// File: contracts/libraries/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.6;
// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)
library SafeMath {
function ADD545(uint x,... | inject NONSTANDARD NAMING | function GETREMAINPERCENT819() public override view returns (uint) { | 7,324,470 |
/*
.'''''''''''.. ..''''''''''''''''.. ..'''''''''''''''..
.;;;;;;;;;;;'. .';;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;,.
.;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;,.
.;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;;,. .;;;;;;;;;;;;;;;;;;;;,.
';;;;;;;;'. .';;;;;;;;;;;;;;;;;;... | calculate overall value of the pools distribute a basket of tokens for exiting user | interface ITrueLender2 {
function value(ITrueFiPool2 pool) external view returns (uint256);
function distribute(
address recipient,
uint256 numerator,
uint256 denominator
) external;
function transferAllLoanTokens(ILoanToken2 loan, address recipient) external;
}
| 1,201,410 |
./partial_match/1/0xA83D81113F57d63AF7EFDC4a12350365c7871266/sources/ShareTokenSale.sol | End current round after validating all requirements/Call db contract to endemit event | function _end(uint round, uint time) internal {
require(_dbContract.end(round, time), "ShareTokenSaleFactory._end: Can not end current round");
emit EndTokenSale(round, time);
}
| 3,643,392 |
// SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-version
pragma solidity ^0.8.0;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contract can't have a constructor, it's common to move con... | Computes the maximum amount of liquidity received for a given amount of token0, token1, the current pool prices and the prices at the tick boundaries | function getLiquidityForAmounts(
uint160 sqrtRatioX96,
uint160 sqrtRatioAX96,
uint160 sqrtRatioBX96,
uint256 amount0,
uint256 amount1
) internal pure returns (uint128 liquidity) {
if (sqrtRatioAX96 > sqrtRatioBX96)
(sqrtRatioAX96, sqrtRatioBX96) = (sqr... | 454,118 |
./full_match/137/0x11d455366ba5D590e7838c4CEcE9aCC95C567e46/sources/contracts/trove-factory.sol | function to be called from trove to change totalDebt _borrow indicates if it is borrow or repay/liquidatin/ | function updateTotalDebt(uint256 _amount, bool _borrow) public override {
ITrove trove = ITrove(msg.sender);
address token = address(trove.token());
require(containsTrove(token, msg.sender), "fbfd5 not a valid trove");
if (_borrow) {
totalDebt += _amount;
_troves[token].totalDebt += _amoun... | 4,722,890 |
./full_match/420/0x5597F952E9aB06D914CFf34f6E26f3D0C0cc5e51/sources/contracts/core/promise/PromiseRouter.sol | Process stored callback function transferId The transferId to process/ parse out the return data and callback address from message enforce relayer is whitelisted by calling local connext contract remove message remove callback fees execute callback Should transfer the stored relayer fee to the msg.sender | function process(bytes32 transferId, bytes calldata _message) public nonReentrant {
bytes32 messageHash = messageHashes[transferId];
if (messageHash == bytes32(0)) revert PromiseRouter__process_invalidTransferId();
bytes29 _msg = _message.ref(0).mustBePromiseCallback();
if (messageHash != _msg.keccak... | 13,226,983 |
pragma solidity >= 0.5.0;
import "./Ownable.sol";
import "./IF_EAS.sol";
import "./IF_EAS_artworks.sol";
import "./IF_EAS_platform.sol";
contract EAS_mission is Ownable{
uint16 public recentRangeOffset = 30;
mapping(uint => address[]) public winners1; // [stageNo] => Mission Winners
ma... | need to add some protection here | function SetStageRewards(uint _stageNo, uint _reward1, uint _reward2, uint _reward3) public platform{
stageRewards[_stageNo].push(_reward1);
stageRewards[_stageNo].push(_reward2);
stageRewards[_stageNo].push(_reward3);
}
| 982,055 |
pragma solidity 0.4.23;
// File: mixbytes-solidity/contracts/security/ArgumentsChecker.sol
// Copyright (C) 2017 MixBytes, LLC
// Licensed under the Apache License, Version 2.0 (the "License").
// You may not use this file except in compliance with the License.
// Unless required by applicable law or agreed to in ... | dont mark as external! | function buy() public payable { | 1,727,601 |
./partial_match/42/0x4cd9C6D56568c6D3Aa80003a54f9267ea8FF805a/sources/ibDFD.sol | This is also used for initializing the proxy/ | function setParams(
IDFDComptroller _comptroller,
uint _redeemFactor
)
external
onlyOwner
{
require(
address(_comptroller) != address(0),
"_comptroller == 0"
);
require(
_redeemFactor <= FEE_PRECISION,
"I... | 3,313,167 |
./partial_match/1/0x089e14961f6E99b93e3972b3119a78d822B8D04a/sources/src/extensions/ERC721SeaDropRedemptionMintable.sol | Overrides the `tokenURI()` function to return baseURI + 1, 2, or 3/ | function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
string memory baseURI = _baseURI();
uint256 tokenURINumber = tokenURINumbers[tokenId];
... | 4,364,935 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.5;
import "./MultiSig.sol";
import "./LoanContract.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
contract LoanRequest {
struct LoanStatus {
uint256 safeId;
ad... | Remove lender signature Return funds to lender | function setLoanParam(
uint256 _loanId,
string memory _param,
uint256 _value
) external {
onlyHasLoan(msg.sender);
onlyNotConfirmed(msg.sender, _loanId);
LoanStatus storage _loanRequest = loanRequests[msg.sender][_loanId];
uint256 _safeId = loanRequests[m... | 13,103,803 |
/**
* ██╗░░██╗░█████╗░██████╗░██╗░░░░░░██████╗░░█████╗░██╗░░░░░░█████╗░██╗░░██╗██╗░░░██╗
* ██║░░██║██╔══██╗██╔══██╗██║░░░░░██╔════╝░██╔══██╗██║░░░░░██╔══██╗╚██╗██╔╝╚██╗░██╔╝
* ███████║██║░░██║██║░░██║██║░░░░░██║░░██╗░███████║██║░░░░░███████║░╚███╔╝░░╚████╔╝░
* ██╔══██║██║░░██║██║░░██║██║░░░░░██║░░╚██╗██╔══██║██║░░░... | See {IERC20-totalSupply}./ | function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
| 8,304 |
/**
*Submitted for verification at Etherscan.io on 2022-02-27
*/
// File: @openzeppelin/contracts/utils/cryptography/MerkleProof.sol
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Trees proof... | whitelist mintNormal WL VerificationsEND WL VerificationsMint | function mintWhitelist(
bytes32[] calldata proof,
uint256 _mintAmount
) public payable {
require(
_verify(_leaf(msg.sender), proof),
"Invalid proof"
);
require(
(whitelistedMints[msg.se... | 2,390,792 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../interfaces/IPinataPrizePool.sol";
import "../interfaces/IPinataStrategy.sol";
import "../interfaces/IPinataVault.sol";
/**
* @dev Implementation of a manager for each pool of Pinata Financ... | get timekeeper status of address provided. _timeKeeper is address want to know status of./ | function getIsTimekeeper(address _timeKeeper) external view returns (bool) {
return _timeKeeper == timeKeeper;
}
| 991,949 |
/**
Fuck these SCAMS, Fuck these TAX coins and most importantly FUCK THESE HOES. It's time to make a real fking coin to celebrate Saint Patricks Day!
0 Tax or Dev fee, only 2% of buys/sells go back to the liquidity pool, aka HODLERS!
- 2% TX limit.
*/
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10 >=0.8.10 ... | exclude from paying fees or having max transaction amount | constructor() ERC20("St Patricks Ape", "STAPE") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pai... | 14,726,938 |
// SPDX-License-Identifier: MIT
... | inject NONSTANDARD NAMING | function SLASH754(address bonded, address keeper, uint amount) external; | 12,851,101 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.7.0 <0.9.0;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "@openzeppelin/contracts/token/ERC2... | TODO add rule: only Client can call/ | function burn(address clientAddr, uint256 tokenId, uint256 amount) public {
require(clientAddr == msg.sender, "Sender must match the clientAddr");
_burn(msg.sender, tokenId, amount);
}
| 15,859,737 |
./full_match/1/0xD05ca8f5B9fd7fa84D1c92b2e64feA8259EeC1ae/sources/browser/CompMiner_flat.sol | File: localhost/contracts/interfaces/ILendingPoolAddressesProvider.sol/ | interface ILendingPoolAddressesProvider {
function getLendingPool() external view returns (address);
function setLendingPoolImpl(address _pool) external;
function getLendingPoolCore() external view returns (address payable);
function setLendingPoolCoreImpl(address _lendingPoolCore) external;
func... | 9,805,924 |
./full_match/80001/0xd74B1EbE3f9bB0045d58d6Fe4B6380733a8656E9/sources/contracts/v1/SwylClub.sol | Lets an account start a new Club Start a new Club struct/ stop a club's owner to create a second club grant CLUB_OWNER_ROLE to the caller handle clubId and `totalNumberClubs` start a new Club Tier[] memory tiers; | function startClub(address _currency) external override {
require(!hasRole(CLUB_OWNER_ROLE, _msgSender()), "!NOT ALOOWED - account already has a club");
_setupRole(CLUB_OWNER_ROLE, _msgSender());
uint256 currentId = totalNumberClubs;
Club memory newClub = Club({
clubId... | 850,821 |
pragma solidity ^0.5.0;
/**
* @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(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimiz... | Token extension (hooks triggered by the contract) / Set validator contract address. The validator contract needs to verify "ERC1400TokensValidator" interface. Once setup, the validator will be called everytime a transfer is executed. validatorAddress Address of the validator contract. interfaceLabel Interface label ... | function _setHookContract(address validatorAddress, string memory interfaceLabel) internal {
address oldValidatorAddress = interfaceAddr(address(this), interfaceLabel);
_setCertificateSigner(oldValidatorAddress, false);
ERC1400._setHookContract(validatorAddress, interfaceLabel);
_setCertificateSi... | 14,347,730 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.