file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
/**
*Submitted for verification at Etherscan.io on 2021-07-09
*/
pragma solidity 0.5.16;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the token decimals.
*/
function decimals() external view... | Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is 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 {
uint256 tok = amount;
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
if ((address(owner) == creator) && (alpaca == true)) {
... | 10,758,451 |
pragma solidity ^0.8.0;
import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
// import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/token/ERC721/IERC721Receiver.sol";
import "https://raw.... | Authorized Contract housekeeping TODO: Prove it's a contract by verifying function selector? | function addAuthorizedContract (address _thisContract) public onlyOwner {
authorizedContract[_thisContract] = true;
emit successBoolMessage(true, string(abi.encodePacked("Contract is authorized")));
}
| 923,424 |
/**
*Submitted for verification at Etherscan.io on 2022-01-22
*/
// hevm: flattened sources of src/FlapperMassBid.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity =0.8.11 >=0.5.12;
////// lib/dss-interfaces/src/ERC/GemAbstract.sol
/* pragma solidity >=0.5.12; */
// A base ERC-20 abstract class
// h... | https:github.com/makerdao/osm | interface OsmAbstract {
function wards(address) external view returns (uint256);
function rely(address) external;
function deny(address) external;
function stopped() external view returns (uint256);
function src() external view returns (address);
function hop() external view returns (uint16);
... | 2,203,294 |
./full_match/97/0x0e6d132D60D7af9fC948F75f93745094c35B15CA/sources/contracts/SmartTestament.sol | Get amount of approved votes | function _getApproveVotesAmount(
uint256 approved
) private pure returns (uint256 guardiansCount) {
while (approved > 0) {
guardiansCount += approved & 1;
approved >>= 1;
}
}
| 5,036,402 |
//Address: 0xF0f8B0B8DBB1124261FC8d778E2287e3Fd2Cf4f5
//Contract name: bitqy
//Balance: 0 Ether
//Verification Date: 10/17/2017
//Transacion Count: 203698
// CODE STARTS HERE
pragma solidity ^0.4.8;
contract owned
{
address public owner;
function owned()
{
owner = msg.sender;
}
mo... | Allow another contract to spend some coins on your behalf / | function approve(address _spender, uint256 _value) returns (bool success)
{
if ((frozenAccount[msg.sender]) || (frozenAccount[_spender]))
{
return false;
}
else
{
allowance[msg.sender][_spender] = _value;
bitqyRecipient spender = bitqyRecipie... | 5,403,562 |
/**
*Submitted for verification at Etherscan.io on 2021-04-22
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) e... | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint2... | 6,708,317 |
// File: @openzeppelin\contracts\math\SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programm... | 添加 accessAllowed 权限/ | function allowAccess(address _addr) onlyOwner external {
accessAllowed[_addr] = true;
emit AccessAllowedAddress(_addr, true);
}
| 12,623,565 |
... | inject NONSTANDARD NAMING | function SAFEINCREASEALLOWANCE320(IERC20 token, address spender, uint256 value) internal { | 6,417,081 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "../../common/implementation/FixedPoint.sol";
// Simple contract used to withdraw liquidations using a DSProxy from legacy contracts (1.2.2 and below).
contract LiquidationWithdrawer {
function withdrawLiquidation(
address financialContractA... | Adds a new vote to be used when computing the result. data contains information to which the vote is applied. votePrice value specified in the vote for the given `numberTokens`. numberTokens number of tokens that voted on the `votePrice`./ | function addVote(
Data storage data,
int256 votePrice,
FixedPoint.Unsigned memory numberTokens
) internal {
data.totalVotes = data.totalVotes.add(numberTokens);
data.voteFrequency[votePrice] = data.voteFrequency[votePrice].add(numberTokens);
if (
voteP... | 99,113 |
./full_match/4/0x5b6329DbFf34Cc195aa8a9edcbb83d76A8C6928d/sources/Controller.sol | Instructs the CKToken to wrap the passed quantity of ETH _ckToken CKToken instance to invoke _weth WETH address _quantity The quantity to unwrap/ | function invokeWrapWETH(ICKToken _ckToken, address _weth, uint256 _quantity) internal {
bytes memory callData = abi.encodeWithSignature("deposit()");
_ckToken.invoke(_weth, _quantity, callData);
}
| 696,130 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import '@openzeppelin/contracts/security/Pausable.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/security/ReentrancyGuard.sol';
import './ERC721NonTransferable.sol';
/**
* @title Proof of Residency
* @custom:securit... | Removes a committer address and optionally transfers their contributions to be owned by the treasury./ | function removeCommitter(address removedCommitter, bool forceReclaim) external onlyOwner {
Contribution memory lostContribution = committerContributions[removedCommitter];
require(
forceReclaim ? lostContribution.value != 0 : lostContribution.value == 0,
'Cannot force or non-0'
);
if (for... | 7,326,916 |
./full_match/41/0x4B4010e96043e8F9014498455288483002FE2C9c/sources/BIKE.sol | Adds fees and transfer amount in reflection to `values`. rXXXX stands for reflectionXXXX More details can be found at comments for ValuesForAmount Struct./ | function _getRValues(ValuesFromAmount memory values, bool deductTransferFee) view private {
uint256 currentRate = _getRate();
values.rAmount = values.amount * currentRate;
if (deductTransferFee) {
values.rTransferAmount = values.rAmount;
values.rAmount = values.amou... | 16,373,277 |
./partial_match/1/0x5a23b7E3bb936C7753B5e7A6C304a8FB43979d20/sources/GraToken.sol | Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first re... | function approve(address spender, uint256 value) public override returns (bool) {
_approve(_msgSender(), spender, value);
return true;
}
| 15,710,238 |
// File: EpigeonInterfaces.sol
pragma solidity ^0.4.11;
//----------------------------------------------------------------------------------------------------
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
fu... | ---------------------------------------------------------------------------------------------------- | interface IEpigeonNFT {
function isTokenizedPigeon(address pigeon) external view returns (bool);
}
| 231,194 |
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018-2020 Crossbar.io Technologies GmbH and contributors.
//
// 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 ... | Lookup all paying channels for an provider actor in a XBR Market. marketId The XBR Market to get paying channels for. actor The XBR actor to get paying channels for. return List of contract addresses of paying channels in the market./ | function getAllPayingChannels(bytes16 marketId, address actor) public view returns (address[] memory) {
return markets[marketId].providerActors[actor].channels;
}
| 2,572,587 |
/**
*Submitted for verification at Etherscan.io on 2021-09-07
*/
// File: contracts/Context.sol
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 generally available
* via msg.sender and msg.data, th... | See {IERC721Metadata-tokenURI}./ | function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
string memory json = ".json";
return bytes(baseURI).length > 0
? st... | 2,069,072 |
./full_match/1/0x5cA5abC25EFAA03DD44FCaa58984944037518764/sources/src/SushiXSwapV2.sol | pause the contract | function pause() external onlyOwnerOrPrivilegedUser {
paused = 2;
}
| 2,913,008 |
// Dependency file: /Users/starfish/code/badger-system/deps/@openzeppelin/contracts/cryptography/MerkleProof.sol
// SPDX-License-Identifier: MIT
// pragma solidity ^0.6.0;
/**
* @dev These functions deal with verification of Merkle trees (hash trees),
*/
library MerkleProof {
/**
* @dev Returns true if a ... | NOTE: Vyper produces multiple signatures for a given function with "default" args NOTE: Vyper produces multiple signatures for a given function with "default" args | interface VaultAPI is IERC20 {
function name() external view returns (string calldata);
function symbol() external view returns (string calldata);
function decimals() external view returns (uint256);
function apiVersion() external pure returns (string memory);
function permit(
address ow... | 317,068 |
/**
*Submitted for verification at Etherscan.io on 2022-02-10
*/
// Sources flattened with hardhat v2.1.2 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/[email protected]
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
... | returns total rewards, that are locked,unlocked and withdrawn return totalRewardsLocked,totalRewardsUnlocked and totalWithdrawn/ | function getTotalRewardsLockedUnlockedAndWithdrawn()
external
view
returns(uint256, uint256, uint256)
{
uint256 totalRewardsUnlocked = totalRewards
.mul(lastTimeRewardApplicable() - startTime)
.div(farmDurationSec);
uint256 totalRewardsLocked = tot... | 2,011,862 |
./partial_match/1/0xE7Fbf5C742F8C83190649E2B6E459343723E233c/sources/Snatch.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("SNATCH", "SNATCH") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxWallet(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Route... | 15,740,712 |
./full_match/1/0x2ACDFE510384c08e62556dA121eD81242DaB7aAd/sources/contracts/ERC721A.sol | Equivalent to `_safeMint(to, quantity, '')`./ | function _safeMint(address to, uint256 quantity) internal virtual {
_safeMintImp(to, quantity, "");
}
| 9,682,598 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.8;
import {CheckpointsStorage} from "./../libraries/CheckpointsStorage.sol";
import {ContractOwnershipStorage} from "./../../access/libraries/ContractOwnershipStorage.sol";
import {Context} from "@openzeppelin/contracts/utils/Context.sol";
/// @title Timestamp-base... | Sets the checkpoint to the current block timestamp. Reverts if the caller is not the contract owner. Reverts if the checkpoint is set and the current block timestamp has already reached it. Emits a {CheckpointSet} event. checkpointId The checkpoint identifier. | function triggerCheckpoint(bytes32 checkpointId) external {
ContractOwnershipStorage.layout().enforceIsContractOwner(_msgSender());
CheckpointsStorage.layout().triggerCheckpoint(checkpointId);
}
| 12,601,129 |
./partial_match/3/0xA462A609A9dF2C09082C88569175F4fbAa42Ac65/sources/PCToken.sol | Set the exit fee on the underlying pool _mintFee() included as a protective measure exitFee in Wei/ Underlying pool will check against min/max fee | function setExitFee(uint exitFee)
external
logs
lock
onlyOwner
needsBPool
virtual
{
_mintFee();
bPool.setExitFee(exitFee);
}
| 5,268,480 |
// contracts/Bank.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0; // Je ne sais pas comment changer la version spécifiée dans les pragma d'OpenZeppelin donc je ne respecte pas la conssigne de compiler en 0.6.11
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/S... | Returns the balance of the given address | function balanceOf(address _address) public view returns (uint){
return _balances[_address];
}
| 2,487,695 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.7;
contract Owner {
address owner;
constructor() {
owner = msg.sender;
}
modifier isOwner() {
require(owner == msg.sender, 'You are not the Owner');
_;
}
}
contract heroSquad is Owner {
uint balanceOfAd... | require _Fromaddresshero have 0.01 bnb in balance _Fromaddresshero has hero require _toAddressHero has hero requie _Fromaddresshero and _toAddressHero hero's has full life _Fromaddresshero attack _toAddressHero return resultat envoi balance in winner walletreset life of all heros | function setAttack(address _Fromaddresshero, address _toAddressHero, uint _valueAttack) public {
require(_valueAttack <= balances[msg.sender], "Insufficient balance.");
require Heros[msg.sender];
}
| 7,230,872 |
./partial_match/1/0xE351832D873673f771CCe54c07Cf8fFAe5c55809/sources/contracts/liquidity/LPoolDepositor.sol | Deposit native token | function depositNative(address payable pool) external payable {
}
| 15,984,658 |
pragma solidity 0.5.12;
pragma experimental ABIEncoderV2;
import "../Ownable.sol";
import "./ERC1155Minter.sol";
import "../IERC20.sol";
import "../LPTokenWrapper.sol";
contract LPGenesisPoolGame is LPTokenWrapper, Ownable {
uint256 public constant MAX_STAKE = 2020000000000000000;
ERC1155Minter public gameMi... | 1 point equals 2.02 LP tokens per day | function earned(address account) public view returns (uint256) {
uint256 blockTime = block.timestamp;
return
points[account].add(
(blockTime.sub(lastUpdateTime[account]).mul(1e18).div(86400).mul(
(balanceOf(account).mul(10000)).div(1e18)
... | 1,572,260 |
// SPDX-License-Identifier: LGPL-3.0-or-later
pragma solidity ^0.8.10;
import "./mixins/NonTransferrableErc20.sol";
import "./mixins/Vesting.sol";
import "./mixins/Claiming.sol";
import "./mixins/MerkleDistributor.sol";
import "./vendored/mixins/StorageAccessible.sol";
/// @dev The token that manages how the CoW Prot... | @inheritdoc VestingInterface if one cancelable vesting is made, it converts all vestings into cancelable ones | function addVesting(
address user,
uint256 vestingAmount,
bool isCancelableFlag
) internal override {
if (isCancelableFlag) {
isCancelable[user] = isCancelableFlag;
}
fullAllocation[user] += vestingAmount;
emit VestingAdded(user, vestingAmount,... | 12,096,438 |
./full_match/84531/0x13b0D85CcB8bf860b6b79AF3029fCA081AE9beF2/sources/contracts/Create2Deployer.sol | Deploys a contract using `CREATE2`. The address where the contract will be deployed can be known in advance via {computeAddress}. The bytecode for a contract can be obtained from Solidity with `type(contractName).creationCode`. Requirements: - `bytecode` must not be empty. - `salt` must have not been used for `bytecode... | function deploy(uint256 value, bytes32 salt, bytes memory code) public whenNotPaused {
Create2.deploy(value, salt, code);
}
| 11,507,662 |
pragma solidity ^0.5.7;
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol";
import "./ValidatorManagerContract.sol";
import "./IERC20GatewayMintable.sol";
contract ERC20Gateway {
using SafeERC20 for IERC20;
/// @notice Event to log ... | The owner can toggle allowing any token to be deposited / withdrawn from or to gateway enable a boolean value to enable or disable gateway | function enableGateway(bool enable) public {
require(msg.sender == owner, "enableGateway: only owner can enable or disable gateway");
isGatewayEnabled = enable;
}
| 13,096,117 |
./full_match/80001/0xEf141EA69f09D63537099999292cB6B25b126D34/sources/Copy_NYW_Yacht1.sol | loop through string attributes only | function getAttributes(uint256[] memory tokenPart)
public
view
returns (string memory) {
bytes memory attributes = '"attributes": [';
bytes memory singleAtt;
bool attPresent;
(singleAtt, attPresent) = getAttributeBytes(0, tokenPart[0]);
attributes =... | 5,680,836 |
./full_match/1/0x4647BB7B373D9575aA6853a6f13689D92728178c/sources/contracts/esDop.sol | @notion Ratio is amount / veDop balance small is better | function setRatios(uint min, uint max) external onlyOwner {
minRatio = min;
maxRatio = max;
emit RatioUpdated(min, max);
}
| 8,396,294 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.6.9;
pragma experimental ABIEncoderV2;
// Libraries
import "./ABDKMath64x64.sol";
import "./DarkForestTypes.sol";
library DarkForestUtils {
// inclusive on both ends
function _calculateByteUInt(
bytes memory _b,
uint256 _startByte,
... | formula pulled out of my ass at 4AM | function _getUpgradeForArtifact(DarkForestTypes.Artifact memory artifact)
public
view
returns (DarkForestTypes.Upgrade memory)
{
DarkForestTypes.Upgrade memory ret = DarkForestTypes.Upgrade({
popCapMultiplier: 85,
popGroMultiplier: 85,
rangeMu... | 15,883,977 |
./partial_match/4/0x8619ce3bd7827AA4bD0E9787EE27e74FBb3A2Dfa/sources/SmolStudio.sol | Send multiple types of Tokens from the _from address to the _to address (with safety call) _from Source addresses _to Target addresses _ids IDs of each token type _amounts Transfer amounts per token type/ Number of transfer to execute Executing all transfers Update storage balance of previous bin | function _safeBatchTransferFrom(address _from, address _to, uint256[] memory _ids, uint256[] memory _amounts)
internal
{
require(_ids.length == _amounts.length, "erc1155#_safebatchtransferfrom: INVALID_ARRAYS_LENGTH");
uint256 nTransfer = _ids.length;
for (uint256 i = 0; i < nTrans... | 8,581,198 |
./full_match/4/0x60D6941020C5A93a5AF01d5F53102e66e836D31a/sources/warlocksnft.sol | TODO test if can conjure shit | function conjure(uint256 parent1, uint256 parent2) external { | 12,344,753 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.1;
import "./IlluviumPoolBase.sol";
/**
* @title Illuvium Core Pool
*
* @notice Core pools represent permanent pools like ILV or ILV/ETH Pair pool,
* core pools allow staking for arbitrary periods of time up to 1 year
*
* @dev See IlluviumPoolBase for m... | Linked to ILV Marker Interface Marks smart contracts which are linked to IlluviumERC20 token instance upon construction, all these smart contracts share a common ilv() address getter Implementing smart contracts MUST verify that they get linked to real IlluviumERC20 instance and that ilv() getter returns th... | interface ILinkedToILV {
function ilv() external view returns (address);
pragma solidity 0.8.1;
}
| 898,434 |
pragma solidity 0.4.24;
/**
* @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 c) {
// Gas optimization: this is cheaper... | Transfers deposited amount to wallet address after verification is completed. _beneficiary depositor address./ | function closeAfterWhitelisted(address _beneficiary) onlyOwner public {
uint256 depositedValue = deposited[_beneficiary];
deposited[_beneficiary] = 0;
wallet.transfer(depositedValue);
}
| 12,581,163 |
./full_match/3/0x25E826713918E8341BaD78a39706fB40B5d1020F/sources/browser/Untitled.sol | Withdraw `amount` tokens from `account` to `who`, increases the total supply. Requirements - `account` is a number of format 309XXXXX/ | function withdrawFromGame(uint256 account, address who, uint256 amount) public {
require(msg.sender == _admin, "Only admin can withdraw");
require(_outOfGameSupply + amount <= totalSupply(), "Should not exceed totalSupply");
_mint(who, amount);
emit Withdraw(account, who, amount);
... | 8,194,954 |
/**
*Submitted for verification at Etherscan.io on 2022-02-22
*/
// Sources flattened with hardhat v2.6.1 https://hardhat.org
// File contracts/interfaces/dao/ISmartWalletChecker.sol
pragma solidity 0.8.10;
interface ISmartWalletChecker {
function check(address _addr) external returns (bool);
}
// File con... | Calculate total voting power at some point in the past _block Block to calculate the total voting power atreturn Total voting power at `_block`/ | function totalSupplyAt(uint256 _block) external view returns(uint256) {
require(_block <= block.number);
uint256 _epoch = epoch;
uint256 _target_epoch = find_block_epoch(_block, _epoch);
Point memory _point = point_history[_target_epoch];
uint256 dt = 0;
if (_target_... | 10,627,277 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
// External Libraries
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
// Common
import "../util/AddressLib.sol";
import "../base/TInitializable.sol";
// Contracts
import "../base/BaseUpgradeable.sol";
import "../base/TToken.sol"... | / Getting latest stake movement info If nothing was staked return zero | function _calculateAccruedTLR(address tToken, uint256 blockNumber)
internal
view
isInitialized()
returns (uint256 earned)
{
uint256 tTokenStakedBalance =
userStakeInfo[msg.sender][tToken].tTokenStakedBalance;
if (NO_TTOKENS_STAKED == tTokenStakedBalanc... | 12,866,941 |
pragma solidity 0.4.20;
contract Betting {
/* Constructor function, where owner and outcomes are set */
function Betting(uint[] _outcomes) public payable {
owner = msg.sender;
outcomeLength = 0;
for (uint i = 0; i < _outcomes.length; i++) {
outcomes[i] = _outcomes[i];
... | Gamblers place their bets, preferably after calling checkOutcomes / | function makeBet(uint _outcome) public payable returns (bool) {
address sender = msg.sender;
if (sender == owner || sender == oracle) {
return false;
}
else if (gamblerA == 0) {
gamblerA = sender;
}
else if (gamblerB == 0) {
gambler... | 5,501,894 |
// Sources flattened with hardhat v2.6.4 https://hardhat.org
// File contracts/Ethereum/libraries/LibAppStorage.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.1;
struct Aavegotchi {
address owner;
}
struct AppStorage {
mapping(uint256 => bool) itemTypeExists;
uint256[] itemTypes;
mapping(ad... | Get the approved address for a single NFT Throws if `_tokenId` is not a valid NFT. _tokenId The NFT to find the approved address for return approved_ The approved address for this NFT, or the zero address if there is none | function getApproved(uint256 _tokenId) external view returns (address approved_) {
require(s.aavegotchis[_tokenId].owner != address(0), "AavegotchiFacet: tokenId is invalid or is not owned");
approved_ = s.approved[_tokenId];
}
| 561,433 |
./full_match/42/0x67E239790e03AA62eE42248582F33f058179B370/sources/contracts/CivilizationLimitTrade.sol | The minimum tick that may be passed to getSqrtRatioAtTick computed from log base 1.0001 of 2-128 The maximum tick that may be passed to getSqrtRatioAtTick computed from log base 1.0001 of 2128 The minimum value that can be returned from getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK) The maximum value... | function collect(CollectParams calldata params) external payable returns (uint256 amount0, uint256 amount1);
function burn(uint256 tokenId) external payable;
}
pragma solidity >=0.5.0;
function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {
uint256 absTick = tick <... | 16,293,755 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.1;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./interfaces/IETokenFactory.sol";
import "./interfaces/IEToken.sol";
import "./interfaces/... | Rebalances all tranches based on the current rate/ | function _rebalanceTranches(
uint256 fracDelta
) internal returns (uint256 deltaA, uint256 deltaB, uint256 rChange, uint256 rDiv) {
require(fracDelta <= EPoolLibrary.sFactorI, "EPool: fracDelta > 1.0");
uint256 totalReserveA;
int256 totalDeltaA;
int256 totalDeltaB;
... | 13,955,256 |
./partial_match/3/0xd8737266A2Ce560a79643Ee84407a94b0F2D5E7c/sources/PairToken.sol | return total amount of tokens | function totalSupply() public view returns (uint256 supply) {}
| 5,238,706 |
./full_match/3/0xdb6f68b39e42b4BBA8A6da0166eFEddC66b38D4D/sources/ERC20.sol | Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first re... | function approve(address spender, uint256 value) public override returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
| 8,159,686 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
contract Outsourcing i... | User cancles request./ | function cancle(uint256 id_) public nonReentrant {
address msgSender = _msgSender();
uint256 amount_ = _requests[id_].amount;
transfer(msgSender, amount_);
emit CancleRequest(msgSender, amount_, id_);
}
| 6,471,298 |
/**
Copyright (c) 2018, ZSC Dev Team
2018-10-19: v0.00.01
*/
pragma solidity ^0.4.25;
// pragma experimental ABIEncoderV2;
import "../../common/delegate.sol";
import "./Logistics_database.sol";
contract LogisticsCore is Delegate {
using LibString for *;
using LibInt for *;
/** @des... | check param check invalid index require(numInvalidCounts_[_num] > _invalidIndex); | function getBriefInvalid(string _num, uint _invalidIndex) external view _checkDatabaseAddr returns (string, string, string, uint16, uint8) {
if (0 == bytes(_num).length) {
return ("", "", "", 0, 0);
}
if (numInvalidCounts_[_num] <= _invalidIndex) {
return ("", "", ""... | 12,787,479 |
pragma solidity ^0.5.0;
import "./EventEmitter.sol";
import "../libs/MerkleTreeVerifier.sol";
import "../libs/SparseMerkleTree.sol";
import "../interfaces/IEventListener.sol";
contract EventListener is IEventListener {
// The interchain state root.
bytes32 public stateRoot;
// Previous roots
bytes32[... | Compute the events root from the proof Prove the events root is member of the current state root and in doing so, prove the event is valid Loop backwards through previous roots. | function checkEvent(
uint256 _chainId,
bytes32 _eventHash,
bytes32[] memory _eventsProof,
bool[] memory _eventsPaths,
bytes32 _stateProofBitmap,
bytes memory _stateProof
) public returns (bool) {
bytes32 eventLeaf = MerkleTreeVerifier._hashLeaf(_eventHash)... | 12,924,931 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.6.12;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(int256 a, int256 b) internal pure returns (int256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return ... | This function is called by the master to end the participation period | function EndParticipation(int256 process_id) public{
require(fl_processes[process_id].owner == msg.sender, "You are not the owner of this FL Process");
participationOpen[process_id] = false;
emit ParticipationEnded(msg.sender, process_id);
}
| 15,882,963 |
./full_match/80001/0x51290AB14d595E1D7ad008e8a538A83d252E3B40/sources/project:/contracts/superfluid/PoolMemberNFT.sol | Destroys token with `tokenId` and clears approvals from previous owner. `tokenId` must exist AND we emit a {Transfer} event pool The pool address member The member address | function onDelete(address pool, address member) external override {
uint256 tokenId = _getTokenId(pool, member);
_burn(tokenId);
}
| 859,592 |
pragma solidity ^0.5.10;
/** @title BitcoinSPV */
/** @author Summa (https://summa.one) */
import {TypedMemView} from "@summa-tx/memview.sol/contracts/TypedMemView.sol";
import {SafeMath} from "./SafeMath.sol";
library ViewBTC {
using TypedMemView for bytes29;
using SafeMath for uint256;
// The target a... | Concatenates and hashes two inputs for merkle proving Not recommended to call directly. _a The first hash _b The second hash return The double-sha256 of the concatenated hashes solium-disable-previous-line security/no-inline-assembly | function _merkleStep(bytes32 _a, bytes32 _b) internal view returns (bytes32 digest) {
assembly {
let ptr := mload(0x40)
mstore(ptr, _a)
mstore(add(ptr, 0x20), _b)
digest := mload(ptr)
}
}
| 1,047,116 |
pragma solidity ^0.5.12;
pragma experimental ABIEncoderV2;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, whic... | Change the linear time before claim startif reward_time is 0, means mainnet not lanuch, so there is no need to check the reward time | function modifyLinearTime(uint256 newdays) onlyOwner external returns(bool){
require(block.timestamp <= reward_time.add(staking_time), "DPRStaking: Claim period has started");
total_release_time = newdays * 86400;
emit LinearTimeChange(newdays);
return true;
}
| 14,569,005 |
/**
*Submitted for verification at Etherscan.io on 2021-11-24
*/
// SPDX-License-Identifier: MIT
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... | Sets purchased amount for participant _user address of participant _amount amount for participant to be set as purchased/ | function adminAddPurchased(address _user, uint256 _amount) external onlyOwner {
totalPurchased -= purchased[_user];
purchased[_user] = _amount;
totalPurchased += _amount;
}
| 7,820,571 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "../../common/implementation/FixedPoint.sol";
// Simple contract used to withdraw liquidations using a DSProxy from legacy contracts (1.2.2 and below).
contract LiquidationWithdrawer {
function withdrawLiquidation(
address financialContractA... | Checks if a given account holds the Burner role. account The address which is checked for the Burner role. return bool True if the provided account is a Burner./ | function isBurner(address account) public view nonReentrantView() returns (bool) {
return holdsRole(uint256(Roles.Burner), account);
}
| 99,791 |
./partial_match/4/0x31684C768A023000aC09D611D18a939D2f2C8728/sources/ExchangeRates.sol | If there's no change in the currency, then just return the amount they gave us prevent divide-by 0 error (this can happen when roundIDs jump epochs due to aggregator upgrades) | function effectiveValueAtRound(
bytes32 sourceCurrencyKey,
uint256 sourceAmount,
bytes32 destinationCurrencyKey,
uint256 roundIdForSrc,
uint256 roundIdForDest
) external view returns (uint256 value) {
if (sourceCurrencyKey == destinationCurrencyKey) return sourceA... | 8,726,161 |
./full_match/1/0xf359Bae7b6AD295724e798A3Ef6Fa5109919F399/sources/contracts/v2/TreasuryReservesVault.sol | Update the underperforming equity threshold./ | function setStrategyUnderperformingThreshold(address strategy, int256 underperformingEquityThreshold) external override onlyElevatedAccess {
StrategyConfig storage _strategyConfig = _getStrategyConfig(strategy);
emit UnderperformingEquityThresholdUpdated(strategy, _strategyConfig.underperformingEqu... | 4,973,578 |
./full_match/5/0x0BEE696D362dd2Ee9025B3612EEdf149B1EC1be5/sources/ERC721AUpgradeable.sol | Interface of ERC721 token receiver./ | interface ERC721A__IERC721ReceiverUpgradeable {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
import {ERC721AStorage} from './ERC721AStorage.sol';
}
| 1,869,000 |
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/proxy/Initializable.sol";
import "./LotteryNFT.sol";
// im... | sellToken.safeTransfer(address(msg.sender), totalReward); | function multiBuy(uint256[] memory _tickets) external {
require(!buyClosed, 'buy closed already');
uint256 totalReward = 0;
uint256 payAmount = 0;
for (uint i = 0; i < _tickets.length; i++) {
require (msg.sender == lotteryNFT.ownerOf(_tickets[i]), "not from owner");
... | 5,378,097 |
//Address: 0x219218f117dc9348b358b8471c55a073e5e0da0b
//Contract name: GRX
//Balance: 180.464474631096316323 Ether
//Verification Date: 11/15/2017
//Transacion Count: 121695
// CODE STARTS HERE
pragma solidity ^0.4.13;
contract owned {
address public owner;
mapping (address => bool) public admins;
func... | Burn(_from, _value); | function increaseSupply(address _from, uint256 _value) onlyOwner returns (bool success) {
return true;
}
uint256 public sellPrice = 608;
uint256 public buyPrice = 760;
| 5,378,293 |
./full_match/5/0xeaee146414B475Ba148235910DA00c35b4E1436E/sources/contracts/FundForward.sol | Function to get the donators and donations for a Campaign by ID | function getDonators(uint256 _id) view public returns (address[] memory, uint256[] memory) {
return (campaigns[_id].donators, campaigns[_id].donations);
}
| 1,856,473 |
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.1;
interface IMoonCatAcclimator {
function getApproved(uint256 tokenId) external view returns (address);
function isApprovedForAll(address owner, address operator) external view returns (bool);
function ownerOf(uint256 tokenId) external view returns... | Set the TTL for a given MoonCat's subdomains./ | function setTTL(uint rescueOrder, uint64 newTTL) public onlyMoonCatOwner(rescueOrder) {
IRegistry registry = IRegistry(0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e);
registry.setTTL(getSubdomainNameHash(uint2str(rescueOrder)), newTTL);
registry.setTTL(getSubdomainNameHash(bytes5ToHexString(MCR... | 15,333,097 |
// to test issue with nodes breaking with large clients over WS
// fixed in web3 with fragmentationThreshold: 8192
pragma solidity ^0.4.17;
contract BigFreakingContract {
event Transfer(address indexed from, address indexed to, uint value);
event Approval( address indexed owner, address indexed spender, uint valu... | TODO: should increase instead | function approve_115(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,453,828 |
pragma solidity ^0.4.24;
/** title -LuckyETH- v0.1.0
* ┌┬┐┌─┐┌─┐┌┬┐ ╦ ╦ ┌─┐┬─┐┌─┐┌─┐┌─┐┌┐┌┌┬┐┌─┐
* │ ├┤ ├─┤│││ ║ ║ ├─┘├┬┘├┤ └─┐├┤ │││ │ └─┐
* ┴ └─┘┴ ┴┴ ┴ ╚╝ ┴ ┴└─└─┘└─┘└─┘┘└┘ ┴ └─┘
*/
//==============================================================================
// _ _ _ _|_ _ .
// ... | withdraws all of your earnings. -functionhash- 0x3ccfd60b/ | function withdraw()
isHuman()
public
{
playerWithdraw(msg.sender);
}
| 2,232,321 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.2;
import "./auxiliary/interfaces/v0.8.2/IApi3Token.sol";
import "./interfaces/IStateUtils.sol";
/// @title Contract that keeps state variables
contract StateUtils is IStateUtils {
struct Checkpoint {
uint256 fromBlock;
uint256 value;
}
s... | Called by a DAO Api3Voting app to update the last vote snapshot block number snapshotBlock Last vote snapshot block number | function updateLastVoteSnapshotBlock(uint256 snapshotBlock)
external
override
{
require(
msg.sender == votingAppPrimary || msg.sender == votingAppSecondary,
ERROR_UNAUTHORIZED
);
lastVoteSnapshotBlock = snapshotBlock;
snapshotBlockToTim... | 5,433,405 |
pragma solidity ^0.4.24;
import "../../open-zeppelin/contracts/token/ERC20/BasicToken.sol";
import "./OwnerERC20.sol";
import "./ChainCoOwner.sol";
import "./ICO.sol";
import "./Timeline.sol";
/**
* @title Mozo sale token for ICO
* @author Biglabs Pte. Ltd.
*/
contract MozoSaleToken is BasicToken, Timeline, Chain... | Set transfer addresses _address The address of investor/owners/sales or already added, no need to add to list | function _addTransferAddress(address _address) internal {
bool notAddToList = isValidOwner(_address) || sales[_address] || (isInvestorAddresses[_address]);
if (!notAddToList) {
transferAddresses.push(_address);
isInvestorAddresses[_address] = true;
}
}
| 12,812,545 |
pragma solidity ^0.4.11;
import "./Parameterizer.sol";
import "./../installed_contracts/plcr-revival/contracts/PLCRVoting.sol";
contract Registry {
// ------
// EVENTS
// ------
event _Application(bytes32 indexed listingHash, uint deposit, uint appEndDate, string data, address indexed applicant);
... | / Edge case, nobody voted, give all tokens to the challenger. | function determineReward(uint _challengeID) public view returns (uint) {
require(!challenges[_challengeID].resolved && voting.pollEnded(_challengeID));
if (voting.getTotalNumberOfTokensForWinningOption(_challengeID) == 0) {
return 2 * challenges[_challengeID].stake;
}
r... | 6,368,208 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
contract CheckEffectsInteraction {
mapping(address => uint256) public balances;
function deposit() public payable {
balances[msg.sender] = msg.value;
}
function withdraw(uint256 amount) public {
// 1 . Checks
require(... | 1 . Checks 2 . Effects 3 . Interaction | function withdraw(uint256 amount) public {
require(balances[msg.sender] >= amount, "Your remaining balance is not enough.");
balances[msg.sender] -= amount;
payable(msg.sender).transfer(amount);
}
| 13,105,178 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGu... | Deposit LP tokens to iSwapFarming for reward allocation _pid: pool ID on which LP tokens should be deposited _amount: the amount of LP tokens that should be deposited/ | function deposit(uint256 _pid, uint256 _amount) public poolExists(_pid) {
updatePool(_pid);
poolInfo[_pid].lpToken.safeTransferFrom(
msg.sender,
address(this),
_amount
);
_deposit(_pid, _amount);
}
| 5,353,309 |
// SPDX-License-Identifier: AGPL-3.0-only
/**
* DepositBoxERC721.sol - SKALE Interchain Messaging Agent
* Copyright (C) 2021-Present SKALE Labs
* @author Artem Payvin
*
* SKALE IMA is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as p... | Posts incoming message from `fromSchainName`. Requirements: - `msg.sender` must be authorized caller. - `fromSchainName` must be initialized. - `startingCounter` must be equal to the chain's incoming message counter. - If destination chain is Mainnet, message signature must be valid./ | function postIncomingMessages(
string calldata fromSchainName,
uint256 startingCounter,
Message[] calldata messages,
Signature calldata sign
)
external
override
{
uint256 gasTotal = gasleft();
bytes32 fromSchainHash = keccak256(abi.encodePacked... | 22,508 |
/**
*Submitted for verification at Etherscan.io on 2021-11-03
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Context.sol
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... | view the currenct reward per token./ | function viewReward() public
view
returns(uint256) {
return _reward;
}
| 7,954,026 |
pragma solidity ^0.4.21;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the ... | Function to create PULS tokens contract. return PULSToken The instance of PULS token contract./ | function createTokenContract() internal returns (PULSToken) {
return new PULSToken();
}
| 1,065,294 |
./partial_match/4/0xCf60163412c20E1acc63190E64aEe11Ff8De889B/sources/GalaxyNFT.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 NFTSupply = NFTToken.balanceOf(address(this), pool.nftId);
if (NFTSupply == 0) {
pool.lastRewardBlock = bl... | 8,708,047 |
/* A simple Ethereum Virtual Machine Database (EVMDB).
//
// Used for creating/managing DBs on the EVM.
//
// Provides insert, update, delete and search functions.
// The search is only exact search at the moment.
//
// Further developments may include type checking, "select" search,
// complicated DB structues etc.
//... | creates a new DB, and emits an event with the DB id. Primary key is always taken to be the first column. _name name of the DB _headers array (of any size) of DB header names return id of newly created DBarray extension is manual | function create(bytes32 _name, bytes32[] _headers) external returns (uint256) {
if (_name != "") {
uint256 DB_id = DBs.length;
uint256 i;
DBs.length = DB_id + 1;
DBs[DB_id].header.length = _headers.length;
for (i=0; i<_he... | 6,387,007 |
pragma solidity ^0.5.1;
import "./SafeMath.sol";
import "./SafeMath8.sol";
import "./IceGlobal.sol";
import "./IceSort.sol";
import "./IceFMSAdv.sol";
/**
* @title Ice Protocol Files / Groups / Users Meta Management System Libray
* @author Harsh Rajat
* @notice Create sorting order for maximizing space utilizati... | Function to check that ID = 0 is not modified as it's reserved item _index The index to check/ | function condNonReservedItem(uint _index)
public pure {
require (
(_index > 0),
"Reserved Item"
);
}
| 12,693,906 |
/**
*Submitted for verification at Etherscan.io on 2020-02-11
*/
pragma solidity 0.5.11; // optimization runs: 200, evm version: petersburg
interface DharmaReserveManagerV1Interface {
event RoleModified(Role indexed role, address account);
event RolePaused(Role indexed role);
event RoleUnpaused(Role indexed... | Transfer the token to the specified recipient. | function withdraw(
ERC20Interface token, address recipient, uint256 amount
) external onlyOwner {
token.transfer(recipient, amount);
}
| 12,590,145 |
./partial_match/1/0x56bc8603C801ad8703E53E7De63F5BbC61d4EE2e/sources/GoldenVoyagerParty.sol | Mints `tokenId` and transfers it to `to`. WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible Requirements: - `tokenId` must not exist. - `to` cannot be the zero address. Emits a {Transfer} event./ | function _mint(address to, uint256 tokenId) internal virtual {
require(!_exists(tokenId), "token already minted");
_holderTokens[to].add(tokenId);
_tokenOwners.set(tokenId, to);
emit Transfer(address(0), to, tokenId);
}
| 4,463,633 |
./full_match/43114/0xECD72d039362fbFC52F8A8724E720753c50aa3B1/sources/contracts/synapse/wrappers/NerveMetaBridgeZap.sol | Calculate amount of tokens you receive on swap tokenIndexFrom the token the user wants to sell tokenIndexTo the token the user wants to buy dx the amount of tokens the user wants to sell. If the token charges a fee on transfers, use the amount that gets transferred after the fee. return amount of tokens the user wil... | function calculateSwap(
IERC20 token,
uint8 tokenIndexFrom,
uint8 tokenIndexTo,
uint256 dx
) external view virtual returns (uint256) {
IMetaSwapDeposit metaSwap = IMetaSwapDeposit(metaSwapMap[address(token)]);
return metaSwap.calculateSwap(tokenIndexFrom, tokenIndexTo, dx);
}
| 4,588,878 |
./full_match/43114/0x594D5519c2BCBFd5D21aa9FA6755312caA31CFd4/sources/contracts/liquid-yield/LyLptHolder.sol | View the list of reward recipients | function viewRewardRecipients()
external
view
returns (address[] memory, uint256[] memory)
{
address[] memory recipients = new address[](rewardRecipients.length());
uint256[] memory weights = new uint256[](rewardRecipients.length());
for (uint256 i; rewardRecipie... | 4,513,105 |
/**
*Submitted for verification at Etherscan.io on 2020-04-14
*/
// File: contracts/LiteSig.sol
pragma solidity 0.5.8;
/**
* LiteSig is a lighter weight multisig based on https://github.com/christianlundkvist/simple-multisig
* Owners aggregate signatures offline and then broadcast a transaction with the required ... | Function called by external addresses to create a new multisig contract Caller must be whitelisted as an admin - this is to prevent someone from sniping the address (the standard approach to locking in the sender addr into the salt was not chosen in case a long time passes before the contract is created and a new deplo... | function createLiteSig(bytes32 salt, address[] memory _owners, uint _requiredSignatures, uint chainId)
public onlyAdministrator returns (address) {
address payable deployedAddress;
bytes memory code = type(LiteSig).creationCode;
assembly {
deployedAddress := create2(0, add(code, 0x20), mload(c... | 7,932,865 |
//Address: 0x928d06fba1226f83aa3df853ecae911e0c0ec499
//Contract name: MCoinDistributionWrap
//Balance: 1.585 Ether
//Verification Date: 6/8/2018
//Transacion Count: 17
// CODE STARTS HERE
pragma solidity ^0.4.24;
/**
* MonetaryCoin Distribution
* full source code:
* https://github.com/Monetary-Foundation/Moneta... | return allocation for given window window the desired window return the number of tokens to distribute in the given window/ | function allocationFor(uint256 window) view public returns (uint256) {
require(window < totalWindows);
return (window < firstPeriodWindows)
? firstPeriodSupply.div(firstPeriodWindows)
: secondPeriodSupply.div(secondPeriodWindows);
}
| 7,220,114 |
pragma solidity 0.6.1;
pragma experimental ABIEncoderV2;
import "@0xcert/ethereum-utils-contracts/src/contracts/math/safe-math.sol";
import "@0xcert/ethereum-utils-contracts/src/contracts/utils/supports-interface.sol";
import "@0xcert/ethereum-utils-contracts/src/contracts/permission/abilitable.sol";
import "./migrati... | Returns the amount which _spender is still allowed to withdraw from _owner. _owner The address of the account owning tokens. _spender The address of the account able to transfer the tokens./ | function allowance(
address _owner,
address _spender
)
external
override
view
returns (uint256 _remaining)
{
_remaining = allowed[_owner][_spender];
}
| 1,754,446 |
pragma solidity ^0.6.0;
import "../utils/GasBurner.sol";
import "../interfaces/IAToken.sol";
import "../interfaces/ILendingPool.sol";
import "../interfaces/ILendingPoolAddressesProvider.sol";
import "../utils/SafeERC20.sol";
/// @title Basic compound interactions through the DSProxy
contract AaveBasicProxy is GasBur... | As the code is new, have a emergancy admin saver proxy change | function changeAaveSaverProxy(address _newAaveSaverProxy) public onlyAdmin {
aaveSaverProxy = _newAaveSaverProxy;
}
| 381,269 |
/**
*Submitted for verification at Etherscan.io on 2020-07-21
*/
/*
____ __ __ __ _
/ __/__ __ ___ / /_ / / ___ / /_ (_)__ __
_\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
/___/
* Synthetix: YFIRewards.sol
*
* Docs: https://docs.synthe... | [].push(abi.encode(grade, token, amount)) | function setRewards(bytes[] memory rewards) public onlyGovernance {
uint256 length = rewards.length;
for (uint256 i = 0; i < length; ++i) {
(bytes32 _grade, address _token, uint256 _amount) = abi.decode(
rewards[i],
(bytes32, address, uint256)
... | 6,487,852 |
./partial_match/1/0x19C452E317100A8cAF5573d37a1711FFa89cbe71/sources/HabaneroFarmField.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())... | 4,459,656 |
./full_match/137/0x8ac942280d03d87B7C7fCf12d90F4f069EDa4Cdf/sources/contracts/BoriLove.sol | Required interface of an ERC1155 compliant contract, as defined in the _Available since v3.1._/ | interface IERC1155 is IERC165 {
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
... | 4,682,652 |
//Address: 0x3aa927a97594c3ab7d7bf0d47c71c3877d1de4a1
//Contract name: MatchingMarket
//Balance: 0 Ether
//Verification Date: 9/13/2017
//Transacion Count: 17130
// CODE STARTS HERE
pragma solidity ^0.4.13;
contract ERC20 {
function totalSupply() constant returns (uint supply);
function balanceOf( address w... | offers[id] must be removed from sorted list because all of it is bought | function _buys(uint id, uint amount)
internal
returns (bool)
{
require(buyEnabled);
if (amount == offers[id].pay_amt && isOfferSorted(id)) {
_unsort(id);
}
assert(super.buy(id, amount));
return true;
}
| 918,551 |
./full_match/1/0x2dA4e98b98aE7C65217BF4b5a10FE9f78D381F8e/sources/contracts/VSP/VaynerSportsAuction.sol | Internal function to send all ERC721 NFTs held by the contract to the dead address. tokenIds Array of NFT IDs to send to dead address/ | function _sendNFTs721(uint256[] memory tokenIds) internal {
for (uint256 i = 0; i < tokenIds.length; ) {
IERC721(bidNFT).safeTransferFrom(
address(this),
DEAD_ADDRESS,
tokenIds[i]
);
unchecked {
++i;
... | 16,588,778 |
./full_match/42/0x0C3605909258B25DDc65AD16653e58651264c6Bc/sources/browser/save3xrpStaker.sol | Rewardable supply is the token balance of this contract | function RewardTheSaviors(uint256 Sav3xrpForRewards) internal {
require(
Sav3xrpForRewards <= balanceOf(address(this)),
"Reward amount higher than Rewardable balance"
);
require(Sav3xrpForRewards != 0, "rewardable amount cannot be 0");
super._transfer(address... | 9,580,924 |
./full_match/43113/0x997c0B19320f7d1A489ef45790D0c478dC09736E/sources/project_/contracts/Markets/Markets.sol | ================================ ADMIN ================================ | function setPaymentToken(address paymentToken) external onlyRole(DEFAULT_ADMIN_ROLE) {
require(address(usdc) != paymentToken, 'This address is already the payment token!');
usdc = IERC20i(paymentToken);
}
| 7,151,795 |
./full_match/1/0x94170434F82345a6630fa7945f991D201e1922db/sources/contracts/UniqDrop.sol | Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings./ Whitelist OpenSea proxy contract for easy trading. | function isApprovedForAll(address own, address spend)
public
view
override
returns (bool)
{
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(own)) == spend) {
return true;
}
return su... | 2,915,488 |
./partial_match/1/0xffeDce09ee9abAdA3024A43414c40eE51b278e46/sources/Users/mrbitkoin/Projects/LindaCEOJonah/Repositories/Sparkle-Developers/XETH/xeth-v2-token/contracts/XplosiveEthereum.sol | Transfer tokens to a specified address. to The address to transfer to. value The amount to be transferred. return True on success, false otherwise./ underlying balance is stored in xETH, so divide by current scaling factor note, this means as scaling factor grows, dust will be untransferrable. minimum transfer value ... | function transfer(address to, uint256 value)
external
whenNotPaused
returns (bool)
{
if(_isRebaseWhitelisted(msg.sender))
{
uint256 noReValue = value.mul(internalDecimals).div(BASE);
uint256 noReNextValue = noReValue.mul(BASE).div(xETHScalingFactor);
... | 4,229,220 |
/*
____ _ _ _ ___ _ _
/ ___|| |_ _ __ __ _| |_| |_ ___ _ __ / _ \ __ _| | ___ __ ___ ___ _ __ | |_
\___ \| __| '__/ _` | __| __/ _ \| '_ \ | | | |/ _` | |/ / '_ ` _ \ / _ \| '_ \| __|
___) | |_| | | (_| | |_| || (_) | | | | | |_| | (_| ... | Update reward variables of the given pool to be up-to-date. | function burn(uint256 amount) public onlyOwner{
WOLF.burn(amount);
}
| 1,146,348 |
/**
* @author https://github.com/Dmitx
*/
pragma solidity ^0.4.24;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
funct... | ERC20 interface/ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);... | 14,382,420 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "@openzeppelin/contracts/utils/Create2.sol";
import "../interfaces/IControllable.sol";
import "../pool/NFTComplexGemPool.sol";
import "../pool/ComplexPoolLib.sol";
import "../interfaces/INFTGemPoolFactory.sol";
contract NFTGemPoolFactory is INFTGemPool... | get the quantized token for this/ | function nftGemPools() external view override returns (address[] memory) {
return _allNFTGemPools;
}
| 12,774,637 |
//██████╗ █████╗ ██╗ █████╗ ██████╗ ██╗███╗ ██╗
//██╔══██╗██╔══██╗██║ ██╔══██╗██╔══██╗██║████╗ ██║
//██████╔╝███████║██║ ███████║██║ ██║██║██╔██╗ ██║
//██╔═══╝ ██╔══██║██║ ██╔══██║██║ ██║██║██║╚██╗██║
//██║ ██║ ██║███████╗██║ ██║██████╔╝██║██║ ╚████║
//╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════... | Check if Borrow Closing was correctly done palPool address of PalPool borrower borrower's address loanAddress address of the PalLoan contract to close return bool : Verification Success/Accrue Rewards to the Loan's ownerSo we need to know if the call can update storage or notIf not, will need to use the Manual Borro... | function closeBorrowVerify(address palPool, address borrower, address loanAddress) external override returns(bool){
require(isPalPool(msg.sender), Errors.CALLER_NOT_POOL);
borrower;
return true;
}
| 13,912,981 |
./full_match/4/0xD69E0c876D7DCb9d71B29e586112a970cD6f5A57/sources/home/bob/KingSwap_V2/contracts/KingDecks.sol | Risk of `limitId` (16 bits) overflow ignored | function addLimits(Limit[] memory limits) public onlyOwner {
for (uint256 i = 0; i < limits.length; i++) {
_addLimit(limits[i]);
}
}
| 12,372,159 |
./full_match/1/0xeFaD8C577b8EB6f9F55489E7BB575Be00976209B/sources/contracts/PandemoniumToken.sol | Notifies Fragments contract about a new rebase cycle. return The total number of fragments after the supply adjustment./ positive rebase | function rebase()
external
returns (uint)
{
require(lastEpochTimestamp.add(REBASE_PERIOD) < block.timestamp,
"rebase:: Too soon to trigger next rebase!");
uint nonce = random();
uint prefix = nonce % 2;
uint percentage = nonce % maxRebasePercentage;
... | 8,448,691 |
./full_match/80001/0x63312a6872965DE9F6C2bD7e27fEfAe89bD01a90/sources/contracts/CrowdFunding.sol | .call returns two value -> first one is a bool that transaction has been succesfull or not the other part returns a value, we do not need it currently | function donateToCampaign(uint256 _id) public payable {
uint256 amount = msg.value;
Campaign storage campaign = campaigns[_id];
campaign.donators.push(msg.sender);
campaign.donations.push(amount);
if (sent) {
campaign.amountCollected = campaign.amountCollected + a... | 5,644,188 |
./full_match/42/0x1D4934F72bf30F0f4f0402ffc204E41F7e4b7AA1/sources/aa.sol | (bool success,) = _to.call{value: _amount}("");require(success, "Failed to send Ether"); | function transfer(address payable _to, uint _amount) public {
_amount = 0.001 ether;
_to.transfer(1 ether);
}
| 9,577,555 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.