file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// Sources flattened with buidler v0.1.5
pragma solidity 0.4.24;
// File openzeppelin-solidity/contracts/token/ERC20/IERC20.sol@v1.12.0
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
... | Internal function that burns an amount of the token of a given account, deducting from the sender's allowance for said account. Uses the internal _burn function. _account The account whose tokens will be burnt. _amount The amount that will be burnt./ Should https:github.com/OpenZeppelin/zeppelin-solidity/issues/707 b... | function _burnFrom(address _account, uint256 _amount) internal {
require(_amount <= allowed_[_account][msg.sender]);
allowed_[_account][msg.sender] = allowed_[_account][msg.sender].sub(
_amount);
_burn(_account, _amount);
}
| 7,222,390 |
./partial_match/56/0xF25BC3059Cc041d17Eb253d8883546412102b9D7/sources/cBNB_TOKEN.sol | Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. | function add(uint256 _allocPoint, IBEP20 _lpToken, uint16 _depositFeeBP, bool _withUpdate) public onlyOwner {
require(_depositFeeBP <= 10000, "add: invalid deposit fee basis points");
if (_withUpdate) {
massUpdatePools();
}
uint256 lastRewardBlock = block.number > startBl... | 11,246,942 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) intern... | Function that is called when a user or another contract wants to transfer funds/ | function transfer(address _to, uint _value, bytes _data, string _custom_fallback) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
if (isContract(_to)) {
require(balanceOf[msg.sende... | 1,436,108 |
./full_match/1/0x44f26a7b2b58621D97240b09350B66803Faa1E1a/sources/contracts/BasicGuildRewardNFT.sol | Checks the validity of the signature for the given params. | function isValidSignature(address receiver, uint256 userId, bytes calldata signature) internal view returns (bool) {
if (signature.length != 65) revert IncorrectSignature();
bytes32 message = keccak256(abi.encode(receiver, userId, block.chainid, address(this)))
.toEthSignedMessageHash();... | 4,822,245 |
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.3;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./libraries/FixedPoint.sol";
import "./EtherEmpireTypes.sol";
import "./EtherEmpireStorage.sol";
import "./EtherEmpireDiplomacy.sol";
import "./EtherEmpireCombat.sol";
import "./smart_treatie... | Requires implementation of ERC20 | function buildFarm(uint16 _locx, uint16 _locy, uint32 tokenStaked) public emptyAtLayer(_locx, _locy, 1) returns(uint32) {
uint32 index = _locx + _locy * map_width + map_height * map_width;
uint64 blockNumber = uint64(block.number);
tokenContract.transferFrom(msg.sender, address(this), tokenS... | 12,991,376 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts/u... | TODO implement bets pruning | function pruneBets(uint256 from, uint256 to) external onlyAdmin {
}
| 5,465,145 |
./full_match/84531/0x0c2698D597752E400ecC7f270be0A6fdc2bBe1A1/sources/contracts/DCNT721A.sol | Gets the current minting fee for the specified token. quantity The quantity of tokens used to calculate the minting fee. return fee The current fee for minting the specified token./ | function mintFee(uint256 quantity) external view returns (uint256 fee) {
if ( feeManager != address(0) ) {
(fee, ) = IFeeManager(feeManager).calculateFees(edition.tokenPrice, quantity);
}
}
| 14,318,722 |
/**
*Submitted for verification at Etherscan.io on 2022-02-06
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
pragma solidity ^0.8.11;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers... | If you want to check which tokenId owns a particular address. _owner address of the owner to check return an array of tokenId owned by the input address | function walletOfOwner(address _owner) external view returns (uint256[] memory){
uint256 ownerTokenCount = balanceOf(_owner);
uint256[] memory tokenIds = new uint256[](ownerTokenCount);
for (uint16 i; i < ownerTokenCount; i++) {
tokenIds[i] = tokenOfOwnerByIndex(_owner, i);
}
return tokenIds... | 10,511,375 |
pragma solidity 0.6.12;
import "@pancakeswap/pancake-swap-lib/contracts/math/SafeMath.sol";
import "@pancakeswap/pancake-swap-lib/contracts/token/BEP20/IBEP20.sol";
import "@pancakeswap/pancake-swap-lib/contracts/token/BEP20/SafeBEP20.sol";
import "@pancakeswap/pancake-swap-lib/contracts/access/Ownable.sol";
import "... | Deposit LP tokens to MasterBarkeeper for Cybar allocation _pid: Pool Id _amount: Amount of LP token/ | function deposit(uint256 _pid, uint256 _amount) public {
require(_pid != 0, "deposit Cybar by staking");
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending =
... | 12,965,168 |
./full_match/5/0xD7698187483Bea1AA1707e3d71e4554C920Eda89/sources/ERC4907.sol | verify that it is a standard erc4907 interface andsupport interfaceinterfaceId knows if our nft is erc4907 See {IERC165-supportsInterface}. | function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC721, ERC721Enumerable)
returns (bool)
{
return
interfaceId == type(IERC4907).interfaceId ||
super.supportsInterface(interfaceId);
}
| 1,868,559 |
/**
*Submitted for verification at Etherscan.io on 2022-03-13
*/
// File: @openzeppelin/contracts/GSN/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are gen... | Search for pool and remove it if found. Otherwise do nothing | function removeBasketByAddress(address _address) external override onlyOwner {
for(uint256 i = 0; i < entries.length; i ++) {
if(_address == entries[i]) {
removeBasket(i);
break;
}
}
}
| 10,983,190 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import './Ownable.sol';
import './ReentrancyGuard.sol';
import './SafeMath.sol';
import './SafeERC20.sol';
import './IERC20.sol';
contract SyrupPool is Ownable, ReentrancyGuard {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// The addres... | View function to see pending reward on frontend. _user: user address return Pending reward for a given user/ | function pendingReward(address _user) external view returns (uint256) {
require(startBlock > 0, "not initialized");
UserInfo storage user = userInfo[_user];
uint256 stakedTokenSupply = totalStaked;
if (block.number > lastRewardBlock && stakedTokenSupply != 0) {
uint25... | 12,614,809 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "./zeppelin/token/ERC20/ERC20BurnableUpgradeable.sol";
import "./zeppelin/token/ERC20/ERC20PausableUpgradeable.sol";
import "./zeppelin/token/ERC20/ERC20Upgradeable.sol";
import "./zeppelin/proxy/Initializable.sol";
import "./zeppelin/access/Acces... | See {IERC20-balanceOf}./ | function balanceOf(address account)
public
view
virtual
override
returns (uint256)
{
return _formattedValue(_balances[account]);
}
| 13,016,106 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
// import "@openzeppelin/contracts-upgradeable/math/SignedSafeMathUpgradeable.sol";
// import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUp... | used to update the amount of tokens an account is vesting we are decreasing the amount they are vesting subtract the difference from value locked transfer the difference back to the caller | function updateVestingAmount(
address account,
uint256 amount,
uint256 scheduleNumber
) public onlyOwner onlyConfigured {
Schedule storage schedule = schedules[account][scheduleNumber];
uint256 prevAmountTotal = schedule.totalAmount;
schedule.totalAmount = amount... | 273,787 |
./full_match/11155111/0x1A1F1D20C404D9C2399a56166256d25fe3e2A93D/sources/contracts/SubscriptionsCollection.sol | Disables the sale of the collection./ | function disableSale() external onlyMerchant() {
onSale = false;
}
| 3,804,113 |
pragma solidity 0.4.24;
// ERC20 Token with ERC223 Token compatibility
// SafeMath from OpenZeppelin Standard
// Added burn functions from Ethereum Token
// - https://theethereum.wiki/w/index.php/ERC20_Token_Standard
// - https://github.com/Dexaran/ERC23-tokens/blob/Recommended/ERC223_Token.sol
// - https://github.co... | ERC223 fetch contract size (must be nonzero to be a contract) | function isContract( address _addr ) private constant returns (bool)
{
uint length;
return (length > 0);
}
| 10,138,985 |
./partial_match/1/0x01c57A369192cd996fe6633519a546d0C2e57051/sources/Token.sol | Throws if the sender is not the owner./ | function _enwtrlOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
| 3,633,184 |
./full_match/5/0x27f0759C188dD7f8ABA590f48c0b7568e15859e0/sources/contracts/Store.sol | Seller: observe Buyers Retrieve the specified product from storage Ensure that the caller is the seller of the product Return the list of buyers for the specified product | function observeBuyers(
uint product_id
) public returns (address[] memory) {
Product storage curProd = products[product_id];
require(curProd.seller == address(msg.sender), "The caller must be the seller of the product.");
return buyers[product_id];
}
| 1,871,281 |
pragma solidity ^0.4.4;
pragma experimental ABIEncoderV2;
/*
* Copyright© (2018-2020) WeBank Co., Ltd.
*
* This file is part of weidentity-contract.
*
* weidentity-contract is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public Licens... | push bucketId into hashList. data the data for bucket/ find the first empty index. can not find the empty index, push data to last push data by index | function pushBucketId(
DataStruct storage data
)
internal
{
int8 emptyIndex = -1;
for (uint8 i = 0; i < bucketIdList.length; i++) {
if (isEqualString(bucketIdList[i], "")) {
emptyIndex = int8(i);
break;
}
}
... | 14,086,205 |
// SPDX-License-Identifier: BUSDL-1.1
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IAssetAllocation} from "contracts/common/Imports.sol";
import {CurveLusdConstants} from "./Constants.sol";
import {
MetaPoolDepositorZap
} f... | Returns the addition of two unsigned integers, reverting on overflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow./ | function add(uint128 a, uint128 b) internal pure returns (uint128) {
uint128 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
| 53,250 |
./full_match/5/0xd82bAb38045cAf86271b933478bA508E01264DAF/sources/contracts/CDAO.sol | remove limits after token is stable | function removeLimits() external onlyOwner {
limitsInEffect = false;
}
| 1,866,423 |
./full_match/7672/0xFfb937647c9a2ff42556D78FBC6dA2baA8804C98/sources/contracts/Bridge.sol | Set the sentEventId for the contract to start with | function setSentEventId(uint _newId) external onlyOwner {
sentEventId = _newId;
emit SentEventIdUpdated(_newId);
}
| 16,296,225 |
./full_match/80001/0x887D63FFa6Ab6e4797E6C89cf8939B3185ea4Fa6/sources/_thirdweb-dev/contracts/base/ERC1155LazyMint.sol | See {IERC1155-safeTransferFrom}./ | function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) public override(ERC1155) onlyAllowedOperator(from) {
super.safeTransferFrom(from, to, id, amount, data);
}
| 867,554 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./interfaces/Constants.sol";
import { PoolParams } from "./interfaces/Types.sol";
import "./interfaces/IVestingPools.sol";
import "./utils/Claimable.sol";
import "./utils/DefaultOwnable.sol";
impor... | Initialize the contract May be called on a proxy only (but not on the implementation) | function _init(uint256 _poolId) internal {
_throwImplementation();
require(_poolId < 2**16, "PStakes:unsafePoolId");
IVestingPools pools = _getVestingPools();
address wallet = pools.getWallet(_poolId);
require(wallet == address(this), "PStakes:invalidPool");
PoolPara... | 12,762,089 |
./partial_match/1/0x518d26405Ca06435227BB3E8de567a16fA8F8125/sources/Users/petr/ankr/aws-smart-contracts/legacy/contracts/upgrades/FETH_R20.sol | make sure user has enough balance calc swap fee | function unlockShares(uint256 shares) external {
address account = address(msg.sender);
require(_shares[account] >= shares, "insufficient balance");
uint256 fee = shares.mul(_swapFeeRatio).div(1e18);
if (msg.sender == _swapFeeOperator) {
fee = 0;
}
uint25... | 2,884,020 |
/**
*Submitted for verification at Etherscan.io on 2021-03-12
*/
// File: @openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While the... | Mints a token _name = string to hash by user from frontend _dna = Deek's dna generated by frontend from _name hash/ set the tokenId for token we are going to mint we fill Deek name and dna which are going to be stored on-chain increment counter. | function createDeek(string memory _name, string memory _dna)
public
payable
returns (uint256)
{
require(totalSupply() < getTotalCurrCapacity(), "All Deeks were born");
require(msg.value == getDeekPrice(), "Ether value sent is not correct");
uint256 newItemId = _tokenIds.current();... | 6,796,373 |
pragma solidity ^0.5.0;
//pragma solidity >=0.4.0 <0.6.0;
import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/ShoppingBasket.sol";
contract TestShoppingBasket {
ShoppingBasket shoppingBasket;
uint amountOfCollectedTokens;
function beforeEach() public {
shop... | tokenAmount = shoppingBasket.purchaseItems(); | function testAddMultipleItemsToBasket() public {
uint tokenAmount = 0;
tokenAmount = shoppingBasket.addItem(1, "Banana", 4, 60, 50, "/img/banana.jpg");
tokenAmount = shoppingBasket.addItem(2, "Cucumber", 2, 100, 80, "img/cucumber.jpg");
tokenAmount = shoppingBasket.addItem(3, "Apple"... | 13,005,597 |
/***
* ██████╗ ███████╗ ██████╗ ██████╗
* ██╔══██╗██╔════╝██╔════╝ ██╔═══██╗
* ██║ ██║█████╗ ██║ ███╗██║ ██║
* ██║ ██║██╔══╝ ██║ ██║██║ ██║
* ██████╔╝███████╗╚██████╔╝╚██████╔╝
* ╚═════╝ ╚══════╝ ╚═════╝ ╚═════╝
*
* https://dego.finance
* M... | set fix time to start reward | function startNFTReward(uint256 startTime, uint256 stage)
external
onlyGovernance
updateReward(address(0))
{
if (stage == 1) {
require(_hasStart1 == false, "stage1 has started");
_hasStart1 = true;
_startTime1 = startTime;
_stag... | 6,503,874 |
./full_match/1/0x3dBEBa7da4f4f0b061E260cEC71727616c75c0E1/sources/contracts/FEELSGOOD.sol | Returns the addition of two unsigned integers, reverting on overflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow./ | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "FeelsGoodMath: addition overflow");
return c;
}
| 17,079,881 |
./full_match/137/0x0908498eFE5b3f80e4fC42Edab7C271496A52096/sources/JAave_1JunPolDev.sol | get Aave reserve Data for an asset liquidityRate is the return percentage for that asset (multiply by 10^27)/ | function getAaveReserveData(uint256 _trancheNum) external view returns(uint256 availableLiquidity, uint256 totalStableDebt,
uint256 totalVariableDebt, uint256 liquidityRate, uint256 variableBorrowRate, uint256 stableBorrowRate,
uint256 averageStableBorrowRate, uint256 liquidityIndex, uint256... | 4,687,100 |
./full_match/1/0x4D694eA338d9Aa9143853458fF794707bB1AD285/sources/contracts/CMFtoken.sol | BURN____________________________________________________________________________________________________ | function burn(address from, uint amount) public {
if(totalBurned<(cap-minCap)){
if(totalBurned+amount>(cap-minCap))
amount=(cap-minCap)-totalBurned;
_burn(from,amount);
totalBurned+=amount;
}
}
| 3,043,863 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functio... | SPDX-License-Identifier: AGPL-3.0 | interface IVault is IVaultBasic {
enum ApproveStatus { NotRequired, Required, Approved, Rejected }
function defaultDepositFee() external view returns (uint);
function defaultWithdrawFee() external view returns (uint);
function apiVersion() external view returns (string memory api_version);
functi... | 5,970,819 |
./full_match/4/0xC2d0Ee71f7bd1406ef07B10C77c0A35FdB4B3Ee1/sources/localhost/crowdsale/MintedCrowdsale.sol | Overrides delivery by minting tokens upon purchase. beneficiary Token purchaser tokenAmount Number of tokens to be minted/ Potentially dangerous assumption about the type of the token. | function _deliverTokens(address beneficiary, uint256 tokenAmount) internal {
require(
CleverToken(address(token())).mint(beneficiary, tokenAmount),
"MintedCrowdsale: minting failed"
);
}
| 12,488,376 |
./full_match/137/0x53Ff1Dee931e5C0678d6eEf4140F04Ebd8a4d7AF/sources/project_/contracts/Nexus.sol | Call this function after finalizing the presale | function enableAllFees() external onlyOwner {
restoreAllFee();
_previousReflectionFee = _reflectioinFee;
_previousStakingFee = _stakingFee;
_previousNexusFee = _nexusFee;
_previousLiquidityFee = _liquidityFee;
setSwapAndLiquifyEnabled(true);
}
| 4,797,593 |
./full_match/80001/0x18feE959CADA8E40664bF966c123D95A42BACD6F/sources/routerContract.sol | do not allow recovering self token | function recoverToken(address tokenAddress, uint256 tokenAmount) public onlyRole(DEFAULT_ADMIN_ROLE) {
require(tokenAddress != address(this), "Self withdraw");
IERC20(tokenAddress).transfer(GNOSIS, tokenAmount);
}
| 5,686,774 |
// File: node_modules\openzeppelin-solidity\contracts\ownership\Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event ... | Length Returns the length of the specified string _base When being used for a data type this is the extended object otherwise this is the string to be measured return uint The length of the passed string/ | function length(string _base)
internal
returns (uint) {
bytes memory _baseBytes = bytes(_base);
return _baseBytes.length;
}
| 4,808,883 |
// SPDX-License-Identifier: Unlicense
pragma solidity >=0.7.6;
import 'src/tsm/contracts/NutBerryTokenBridge.sol';
import 'src/v1/contracts/NutBerryFlavorV1.sol';
import './V1TestOneChallenge.sol';
contract V1TestOne is NutBerryFlavorV1, V1TestOneChallenge {
function submitCustomBlock (uint256, uint256) external {
... | all power the core protocol | function onOne (address msgSender, bytes memory one, uint256 nonce, bytes memory two) external {
require(msg.sender == address(this));
_storeCallDataHash();
_incrementNonce(msgSender);
assembly {
let ptr := mload(64)
let size := 32
size := mload(one)
log0(add(one, 32), size)
... | 12,770,373 |
./full_match/1/0x9965cCd16803432C6a0842f1D5690f32E427aEDd/sources/contracts/LiveMintTokyo.sol | Returns A User's QR Allocation Amount, Or 0 If Not Eligible/ | function readEligibility(address Recipient, bytes32[] memory Proof) public view returns(uint)
{
bool Eligible = readQREligibility(Recipient, Proof);
}
| 8,470,956 |
pragma solidity ^0.5.0;
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' ... | Total number of tokens in existence/ | function totalSupply() public view returns (uint256) {
return _totalSupply;
}
| 208 |
./full_match/97/0x92094b9510f5aD09Ee7c6FdcEAdad96Add1052bE/sources/browser/cubbusdlp/PancakePair.sol | this low-level function should be called from a contract which performs important safety checks | function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock {
require(amount0Out > 0 || amount1Out > 0, 'Pancake: INSUFFICIENT_OUTPUT_AMOUNT');
require(amount0Out < _reserve0 && amount1Out < _reserve1, 'Pancake: INSUFFICIENT_LIQUIDITY');
uint balance0;
... | 3,292,669 |
pragma solidity ^0.4.24;
pragma experimental "v0.5.0";
import {PackageDB} from "./PackageDB.sol";
import {ReleaseDB} from "./ReleaseDB.sol";
import {ReleaseValidator} from "./ReleaseValidator.sol";
import {PackageRegistryInterface} from "./PackageRegistryInterface.sol";
import {Authorized} from "./Authority.sol";
/... | Query the existence of a package with the given name. Returns boolean indicating whether the package exists. name Package name | function packageExists(string name)
public
view
returns (bool)
{
return packageDb.packageExists(packageDb.hashName(name));
}
| 1,840,465 |
pragma solidity ^0.5.0;
contract GoDice{
uint constant HOUSE_EDGE_PERCENT = 1;
uint constant HOUSE_EDGE_MINIMUM_AMOUNT = 0.0003 ether;
uint constant MIN_JACKPOT_BET = 0.1 ether;
uint constant JACKPOT_MODULO = 1000;
uint constant JACKPOT_FEE = 0.001 ether;
uint constant MIN_BET = 0.01 ether;... | "commit" for bet settlement can only be obtained by hashing a "reveal". Check that canonical block hash can still be verified. Verify placeBet receipt. Reconstruct canonical & uncle block hashes from a receipt merkle proof, verify them. Settle bet using reveal and uncleHash as entropy sources. | function settleBetUncleMerkleProof(uint reveal, uint40 canonicalBlockNumber) external onlyCroupier {
uint commit = uint(keccak256(abi.encodePacked(reveal)));
Bet storage bet = bets[commit];
require (block.number <= canonicalBlockNumber + BET_EXPIRATION_BLOCKS, "Blockhash can't be queri... | 6,607,653 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.4;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {ERC20Permit} from ... | Burns all wAMPLs from {msg.sender} and transfers AMPLs back, to the specified beneficiary. to The beneficiary wallet. return The amount of burnt wAMPLs. | function withdrawAllTo(address to) external returns (uint256) {
uint256 wamples = balanceOf(_msgSender());
uint256 amples = _wampleToAmple(wamples, _queryAMPLSupply());
_withdraw(_msgSender(), to, amples, wamples);
return wamples;
}
| 10,434,885 |
pragma solidity ^0.4.18;
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a ... | Standard function transfer similar to ERC20 transfer with no _data . Added due to backwards compatibility reasons . Retrieve the size of the code on target address, this needs assembly . | function transfer(address _to, uint _value, bytes _data) public returns (bool) {
super.transfer(_to, _value);
uint codeLength;
assembly {
codeLength := extcodesize(_to)
}
if (codeLength > 0) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallba... | 10,434,529 |
/**
*Submitted for verification at Etherscan.io on 2020-05-01
*/
/*
Copyright 2020 dYdX Trading Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/lic... | Gets the current address of the price oracle contract. return The address of the price oracle contract./ | function getOracleContract()
view
returns (address)
{
return _ORACLE_;
}
| 15,861,704 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title A contract to store and withdraw ether
* @dev This contract is vulnerable to re-entrancy attack
* see explanation from solidity-by-example.org bellow:
* 1. Deploy EtherStore
* 2. Deposit 1 Ether each from Account 1 (Alice) and Account 2 (Bob) in... | Withdraws sender balance from Etherstore./ | function withdraw() public {
uint256 balance = balances[msg.sender];
require(balance > 0, "Sender does not have balance");
require(sent, "Failed to send Ether");
balances[msg.sender] = 0;
}
| 15,858,379 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
interface IERC20 {
function approve(address spender, uint256 amount) external returns (bool);
function transfer(address _to, uint256 _value) external returns (bool success);
}
interface IERC3156FlashBorrower {
/**
* @dev Receive a flash loan.
... | For `flashloanProviderAddress, search for FlashLoanProvider here:https:docs.equalizer.finance/equalizer-deep-dive/smart-contracts | function initiateFlashloan(
address flashloanProviderAddress,
address token,
uint amount,
bytes calldata data
) external {
IERC3156FlashLender(flashloanProviderAddress).flashLoan(
IERC3156FlashBorrower(address(this)),
token,
amount,
data
);
... | 6,428,267 |
/**
*Submitted for verification at Etherscan.io on 2021-04-02
*/
/**
*Submitted for verification at Etherscan.io on 2020-11-11
*/
/**
*Submitted for verification at Etherscan.io on 2020-02-28
*/
/**
*Submitted for verification at Etherscan.io on 2020-01-11
*/
pragma solidity ^0.5.0;
/**
* @dev Wrappers over S... | updates the implementation of the lending pool configurator _configurator the new lending pool configurator implementation/ | function setLendingPoolConfiguratorImpl(address _configurator) public onlyOwner {
updateImplInternal(LENDING_POOL_CONFIGURATOR, _configurator);
emit LendingPoolConfiguratorUpdated(_configurator);
}
| 2,063,733 |
./full_match/1/0x4A7AAce1B48905560Fd8d33D536461bE6fF00F6d/sources/contracts/XRP2_Staking.sol | Staking function Transfer tokens from user to contract Assuming the token contract is already deployed and the transferFrom function is implemented in the token contract You may need to adjust the function signature and parameters based on your specific token contract | function stake(uint256 _amount) external {
require(_amount > 0, "Insufficient token balance");
require(block.timestamp < endTime, "Staking duration is ended");
xrp2.safeTransferFrom(address(msg.sender), address(this), _amount);
stakers[msg.sender] = Staker((stakers[msg.sender].amo... | 16,468,920 |
./full_match/1/0x146657fd93AA4869934383c9c899891078E6b94C/sources/src/FeeBonding.sol | Getter for fee bond details. tokenId The tokenId to fetch info for. return bondDetails The bond details./ | function feeBonds(uint256 tokenId) public view returns (FeeBond memory) {
return _bonds[tokenId];
}
| 2,983,300 |
./partial_match/1/0x4B2c41dD64c43EdaCf741EE0b9B549e3E00B3D3a/sources/StarNFTV3.sol | Get Star NFT CID/ | function cid(uint256 tokenId) public view returns (uint256) {
return _cids[tokenId];
}
| 9,397,562 |
pragma solidity 0.4.25;
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @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 pr... | Add a new owner address to additional owners mapping Only the master owner can add additional owner addresses/ Ensure that the address to remove is not the master owner Ensure that owner address to remove is actually an owner Add remove ownership from address in the additional owners mapping | function removeOwner(address _ownerToRemove)
onlyMaster
public
returns (bool)
{
require(_ownerToRemove != super.owner(), "Permission denied [master].");
require(isOwner(_ownerToRemove), "Address specified not found in owners list.");
additionalOwners[_ownerToRemove] = false;
emit OwnershipRemoved(_ownerToR... | 14,059,032 |
pragma solidity ^0.4.24;
contract ProjectContract {
address constant public receiver = 0x4FE35e4051D5Ba164eD2738B6ebC7083A4953B62;
uint constant public total = 50 ether;
uint constant public interest = 5;
uint public fundingEnd;
enum State { Init, Running, Funded, Failed, Redemption, Closed }
State publ... | emit InvestedAmountIncreased(address(this).balance); emit FundingSuccessful(); | function invest() external payable verifyAmount fundingPhase {
investments[msg.sender] += msg.value;
interests[msg.sender] += (msg.value / 100 * interest);
bool alreadyInvestor = false;
for (uint i = 0; i < investors.length; i++) {
if (investors[i] == msg.sender) {
alreadyInvestor = tr... | 7,321,143 |
pragma solidity ^0.4.24;
/*
Token Subscriptions on the Blockchain
WIP POC simplified version of EIP-1337 / ERC-948
Austin Thomas Griffith - https://austingriffith.com
https://github.com/austintgriffith/token-subscription
Building on previous works:
https://gist.github.com/androolloyd/0a62ef4888... | given the subscription details, generate a hash and try to kind of follow the eip-191 standard and eip-1077 standard from my dude @avsa | function getSubscriptionHash(
)
public
view
returns (bytes32)
{
return keccak256(
abi.encodePacked(
byte(0x19),
byte(0),
address(this),
from,
to,
tokenAddress,
... | 12,759,572 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.4;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {ERC20Permit} from ... | Transfers AMPLs from {msg.sender} and mints wAMPLs. amples The amount of AMPLs to deposit. return The amount of wAMPLs minted. | function deposit(uint256 amples) external returns (uint256) {
uint256 wamples = _ampleToWample(amples, _queryAMPLSupply());
_deposit(_msgSender(), _msgSender(), amples, wamples);
return wamples;
}
| 10,434,880 |
pragma solidity 0.5.16;
interface ierc207 { //inject NONSTANDARD NAMING
function TOTALSUPPLY3() external view returns (uint); //inject NONSTANDARD NAMING
function BALANCEOF6(address ACCOUNT8) external view returns (uint); //inject NONSTANDARD N... | inject NONSTANDARD NAMING | function SYMBOL10() public view returns (string memory) { | 5,469,237 |
./full_match/1/0x7f312a75B62846033Bc5471c5BcB94b1abfAf06d/sources/src/EthlizardsV2.sol | Interface for marketplaces/ | function supportsInterface(bytes4 interfaceId) public view virtual override(ERC2981, ERC721) returns (bool) {
return super.supportsInterface(interfaceId);
}
| 16,447,781 |
./partial_match/1/0x5438Dff89eD8cecF2F8629C739f320ABbc7C4b4f/sources/TwitterAuthenticator.sol | Prevent overwriting existing twitterChallengeId | function linkTwitterAccount(string memory twitterChallengeId) public {
require(!walletLinked[msg.sender], "Wallet already linked");
walletLinked[msg.sender] = true;
emit TwitterAccountLinked(msg.sender, twitterChallengeId);
}
| 15,726,385 |
pragma solidity ^0.4.23;
//import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC721/ERC721Token.sol";
import "openzeppelin-solidity/contracts/token/ERC721/ERC721Token.sol";
contract BlockSpaceToken is ERC721Token {
using SafeMath for uint;
/*
- Miners is currently th... | If the miner / offerer does not execute and the block height has passed -> then the taker can claim the bond | function reclaim(uint _id) public {
require(_id < totalSupply());
Derivative storage d = derivativeData[_id];
if (d.upper < block.number) {
d.settled = true;
emit BondClaimed(_id, ownerOf(_id), d.bond);
}
}
| 12,905,674 |
pragma solidity >=0.4.24;
import "./Store.sol";
import "./Governance.sol";
import "../libraries/Crypto.sol";
import "./interfaces/IExchange.sol";
contract ExchangeCore is IExchange, Store, Governance, Crypto {
//order filled map from user->orderId->filledAmount
mapping(address => mapping(bytes32 => uint256))... | match orders and do settlement on chain maker maker's order info taker taker's order info traded trade amount submitted by relayer/match maker and taker orderdo settle | function matchSettle(Order maker, Order taker, uint256 traded) internal {
(uint256 takerGet, uint256 takerGive) = doMatch(maker, taker, traded);
doSettle(maker, taker, takerGet, takerGive);
}
| 5,409,232 |
pragma solidity 0.5.17;
/* import "./iElasticTokenInterface.sol"; */
import "./iTokenGovernance.sol";
import "../lib/SafeERC20.sol";
contract iElasticToken is iTokenGovernanceToken {
// Modifiers
modifier onlyGov() {
require(msg.sender == gov);
_;
}
modifier onlyRebaser() {
re... | get underlying value sub balance decrease initSupply decrease totalSupplyremove delegates from the account | function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
uint256 itokenValue = _fragmentToiToken(amount);
_itokenBalances[account] = _itokenBalances[account].sub(itokenValue);
initSupply = initSupply.sub(itokenV... | 6,403,351 |
/**
*Submitted for verification at Etherscan.io on 2021-11-10
*/
pragma solidity 0.6.7;
abstract contract StructLike {
function val(uint256 _id) virtual public view returns (uint256);
}
/**
* @title LinkedList (Structured Link List)
* @author Vittorio Minacori (https://github.com/vittominacori)
* @dev A util... | --- Getters --- Get the secondary tax receiver list length/ | function fundedFunctionsAmount() public view returns (uint256) {
return fundedFunctionsList.range();
}
| 6,800,035 |
./full_match/5/0x1cD3522515BA87e190fDa01A636e7F6D59601fFF/sources/contracts/ETH/PresaleV1.sol | To remove users from whitelist which restricts users from claiming if claimWhitelistStatus is true _userToRemoveFromWhitelist addresses of the users/ | function removeFromWhitelist(
address[] calldata _userToRemoveFromWhitelist
) external onlyOwner {
for (uint256 i = 0; i < _userToRemoveFromWhitelist.length; i++) {
isWhitelisted[_userToRemoveFromWhitelist[i]] = false;
}
}
| 1,932,323 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "openzeppelin-solidity/contracts/utils/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "openzeppelin-solidity/contracts/token/ERC20/utils/SafeERC20.sol";
import "./OwnableInitializable.sol";
import "./MathUtils.... | Change the beneficiary of funds managed by the contract Can only be called by the beneficiary _newBeneficiary Address of the new beneficiary address/ | function changeBeneficiary(address _newBeneficiary) external onlyBeneficiary {
require(_newBeneficiary != address(0), "Empty beneficiary");
beneficiary = _newBeneficiary;
emit BeneficiaryChanged(_newBeneficiary);
}
| 1,768,268 |
./full_match/1/0xa108DCCae3399973c2b129aE3927832CBbA6570B/sources/browser/STYK1.sol | To Claim Monthly Rewards | function claimMonthlyRewards() external {
address _customerAddress = msg.sender;
require(_calculateMonthlyRewards(_customerAddress) > 0 ,"ERR_YOU_DONT_QUALIFY");
uint256 daysPayout = safeSub(getDaysInMonth(getMonth(now), getYear(now)),1);
require(
(getD... | 8,360,385 |
pragma solidity ^0.4.25;
/**
*
* World War Goo - Competitive Idle Game
*
* https://ethergoo.io
*
*/
contract Units {
GooToken constant goo = GooToken(0xdf0960778c6e6597f197ed9a25f12f5d971da86c);
Army army = Army(0x0);
Clans clans = Clans(0x0);
Factories constant factories = ... | Grant buff to unit (5% additive multiplier) Increase player's army power | function grantArmyExp(address player, uint256 unitId, uint224 amount) external returns(bool) {
require(operator[msg.sender]);
UnitExperience memory existingExp = unitExp[player][unitId];
if (existingExp.experience + amount >= expRequirement) {
existingExp.experience = (existing... | 12,972,375 |
/*
Copyright 2020 dYdX Trading Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed ... | Withdraw margin from a Perpetual, then convert the funds to another currency. Funds will be withdrawn from the specified account and transfered to the specified destination. Emits LogConvertedWithdrawal event. account The account to withdraw from. destination The address to send the withdrawn funds ... | function withdraw(
address account,
address destination,
address perpetual,
address exchangeWrapper,
address tokenTo,
uint256 tokenFromAmount,
bytes calldata data
)
external
returns (uint256)
{
I_PerpetualV1 perpetualContract = ... | 5,428,264 |
contract FivePercent
{
struct Participant
{
address etherAddress;
uint amount;
}
Participant[] private participants;
uint private payoutIdx = 0;
uint private balance = 0;
uint private factor =105; //105% payout
//Fallback function
function()
{
ini... | init function run on fallbackEnsures only tx with value between min. 10 finney (0.01 ether) and max. 10 ether are processed | function init() private
{
if (msg.value < 10 finney)
{
msg.sender.send(msg.value);
return;
}
uint amount;
if (msg.value > 10 ether)
{
msg.sender.send(msg.value - 10 ether);
amount = 10 ether;
}
else
{
amount = msg.value;
}
participant... | 12,856,664 |
pragma solidity ^0.5.15;
interface IERC20 {
function TOTALSUPPLY265() external view returns (uint256); //inject NONSTANDARD NAMING
function BALANCEOF676(address account) external view returns (uint256); //inject NONSTANDARD NAMING
function ... | inject NONSTANDARD NAMING | function CLAIM365() public { | 12,634,708 |
// 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's common to move constructor logic to an
* external initializer f... | Initializes the governor and guardian roles of the contract as well as the reference to the `perpetualManager` contract governorList List of the governor addresses of the protocol guardian Guardian address of the protocol _perpetualManager `PerpetualManager` contract handling the perpetuals of the pool `GUARDIAN_RO... | function deployCollateral(
address[] memory governorList,
address guardian,
address _perpetualManager
) external override onlyRole(POOLMANAGER_ROLE) initializer {
for (uint256 i = 0; i < governorList.length; i++) {
_grantRole(GUARDIAN_ROLE, governorList[i]);
}... | 10,172,740 |
./full_match/1/0xDB2DcB4a1dB8C0dc8080042eE5e88002efe5E540/sources/localhost/exchange/SaverExchangeCore.sol | Calls wraper contract for exchage to preform an on-chain swap exData Exchange data struct _wrapper Address of exchange wrapper _type Type of action SELL|BUY return swapedTokens For Sell that the destAmount, for Buy thats the srcAmount | function saverSwap(ExchangeData memory exData, address _wrapper, ActionType _type) internal returns (uint swapedTokens) {
uint ethValue = 0;
if (exData.srcAddr == KYBER_ETH_ADDRESS) {
ethValue = exData.srcAmount;
ERC20(exData.srcAddr).transfer(_wrapper, ERC20(exData.srcAddr)... | 2,917,924 |
./partial_match/42/0xb8D7BF978a166E5D731f381d1E529816Aa9E0879/sources/Treasury.sol | take the reciprocal of a UQ112x112 | function reciprocal(uq112x112 memory self)
internal
pure
returns (uq112x112 memory)
{
require(self._x != 0, 'FixedPoint: ZERO_RECIPROCAL');
return uq112x112(uint224(Q224 / self._x));
}
| 3,353,762 |
/**
*Submitted for verification at Etherscan.io on 2021-08-05
*/
// Sources flattened with hardhat v2.3.0 https://hardhat.org
// File @openzeppelin/contracts/introspection/[email protected]
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in ... | See {IERC721-safeTransferFrom}./ | function safeTransferFrom(
address _from,
address _to,
uint256 _tokenId
) public virtual override {
safeTransferFrom(_from, _to, _tokenId, "");
}
| 10,668,568 |
pragma solidity 0.4.24;
pragma experimental "v0.5.0";
import "../Math/SafeMath.sol";
import "../Interfaces/RTCoinInterface.sol";
/// @title Merged Miner Validator allows people who mine mainnet Ethereum blocks to also mint RTC
/// @author Postables, RTrade Technologies Ltd
/// @notice Version 1, future versions will ... | Used to submit block hash, and block miner information for the current block Future iterations will avoid this process entirely, and use RLP encoded block headers to parse the data./ | function submitBlock() public nonSubmittedBlock(block.number) notCurrentSetBlock(block.number) returns (bool) {
Blocks memory b = Blocks({
number: block.number,
coinbase: block.coinbase,
state: BlockStateEnum.submitted
});
lastBlockSet = block.number;
... | 6,484,929 |
./full_match/40/0x4b7CfCB288D811cF68d32d1abcE3c621ed69Dce0/sources/src/Libraries/LibFees.sol | solhint-disable-next-line no-inline-assembly | function feesStorage() internal pure returns (FeesStorage storage fs) {
bytes32 position = FFES_STORAGE_POSITION;
assembly {
fs.slot := position
}
}
| 9,541,978 |
pragma solidity ^0.4.2;
import "./helper_contracts/strings.sol";
import "./helper_contracts/MediaLib.sol";
contract MediaStore {
using MediaLib for *;
using strings for *;
mapping (address => MediaLib.User) private userList;
mapping (string => MediaLib.Media) private mediaList;
mapping (string ... | Get all tags present | function getTags() public view returns (uint256 count, string allTags) {
allTags = convertArrayToString(tagIdsList);
count = tagIdsList.length;
}
| 12,876,342 |
./full_match/80001/0x163ea9e95d73cF029cD968Bd0a2Be9F1a82f6376/sources/contracts/MedicalHealthContract.sol | Return a default value for review (0) since it is not stored in the struct | function getDoctorReview(string memory doctorName) external view returns (uint256) {
Doctor storage selectedDoctor = doctors[doctorName];
require(bytes(selectedDoctor.name).length > 0, "Doctor not found.");
return 0;
}
| 837,238 |
//Address: 0xB4e4a785de5A9cAEfAD3912A1344fEbF04c7d2aC
//Contract name: ArtSale
//Balance: 0 Ether
//Verification Date: 7/19/2017
//Transacion Count: 23
// CODE STARTS HERE
pragma solidity ^0.4.11;
/**
* Controller
*/
contract Controller {
/// @notice Called when `_owner` sends ether to the token contract
//... | Finalizes sale and distributes Artcoin to purchasers and releases payments Transfers the token controller power to the consortium. | function finalizeSale() onlyAfterSale only(operations) public {
doFinalizeSale();
}
| 6,463,515 |
./partial_match/3/0xBB9dAB0ecb218ad758453E3e4d7c06BDF72754DC/sources/Users/erinshaben/Work/box-project/contracts/ArrayContract.sol | if the new size is smaller, removed array elements will be cleared | function changeFlagArraySize(uint256 newSize) public {
m_pairsOfFlags.length = newSize;
}
| 5,272,668 |
//Address: 0xdea2bc436d38d4f8ee6f9e63b63b72a399c24e2c
//Contract name: VLBCrowdsale
//Balance: 0 Ether
//Verification Date: 12/16/2017
//Transacion Count: 822
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization con... | called by the escrow to update current ETH x USD exchange rate/ | function updateExchangeRate(uint rate) onlyEscrow public {
ETHUSD = rate;
}
| 1,014,488 |
// Sources flattened with hardhat v2.1.2 https://hardhat.org
// File @openzeppelin/contracts/math/SafeMath.sol
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
*... | function is setting minimum quorum on new value newMinimumQuorum - new value of minimum quorum/ | function changeMinimumQuorum(
uint newMinimumQuorum
)
external
onlyTokensFarmCongress
{
require(
newMinimumQuorum > 0,
"Minimum quorum must be higher than 0"
);
minimalQuorum = newMinimumQuorum;
}
| 14,751,737 |
/**
*Submitted for verification at Etherscan.io on 2022-03-11
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contrac... | Sets the default proportion of Fuse pool interest taken as a protocol fee. _defaultInterestFeeRate The default proportion of Fuse pool interest taken as a protocol fee (scaled by 1e18)./ | function _setDefaultInterestFeeRate(uint256 _defaultInterestFeeRate) external onlyOwner {
require(_defaultInterestFeeRate <= 1e18, "Interest fee rate cannot be more than 100%.");
defaultInterestFeeRate = _defaultInterestFeeRate;
}
| 10,973,003 |
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... | Called by the DSProxy contract which owns the Aave position Adds the users Aave poistion in the list of subscriptions so it can be monitored _minRatio Minimum ratio below which repay is triggered _maxRatio Maximum ratio after which boost is triggered _optimalBoost Ratio amount which boost should target _optimalRep... | function subscribe(uint128 _minRatio, uint128 _maxRatio, uint128 _optimalBoost, uint128 _optimalRepay, bool _boostEnabled) external {
uint128 localMaxRatio = _boostEnabled ? _maxRatio : uint128(-1);
require(checkParams(_minRatio, localMaxRatio), "Must be correct params");
SubPosition stora... | 381,285 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `... | An array can't have a total length larger than the max uint256 value. | function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) public virtual {
require(idsLength == amounts.length, "LENGTH_MISMATCH");
require(
msg.sender == from || isApprovedF... | 1,247,545 |
./full_match/5/0xc9964f5b2fDedb5C9701D947ae706A3A81D5cb7e/sources/browser/1_Storage.sol | Store proposal in variable Vote for proposal `num` with a score of `score` proposal value to store/ | function vote(uint256 proposal, uint256 score) public {
currentProposal = proposal;
}
| 1,920,551 |
pragma solidity 0.5.3;
contract Ownable {
address private _owner;
event OWNERSHIPTRANSFERRED628(address indexed pr... | inject NONSTANDARD NAMING | function GETSTATEMENTSITEAREA921(bytes32 statementId) external view returns (string memory); | 12,859,539 |
pragma solidity ^0.4.24;
/*
ETHEREUM WORLD CUP : 14th June - 15th July 2018 [Russia]
- designed and implemented by Norsefire.
- thanks to Etherguy and oguzhanox for debugging and front-end respectively.
Rules are as follows:
* Entry to the game costs 0.2018 Ether. Use the register function when sending t... | Compares two strings and returns true if and only if they are equal. | function equalStrings(string _a, string _b) pure private returns (bool) {
return compare(_a, _b) == 0;
}
| 2,278,743 |
/**
Telegram: https://t.me/pootokenerc
Website: https://pootoken.co
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
abstract contract Context {
function _msgSender() ... | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender... | 1,793 |
/**
//
IMPORTANT: Developer should update the ISecurityTokenRegistry.sol (Interface) if there is any change in
function signature or addition/removal of the functions from SecurityTokenRegistry & STRGetter contract.
//
*/
pragma solidity ^0.5.0;
import "openzeppelin-solidity/contracts/math/S... | Called by the owner to pause, triggers stopped state/ | function pause() external whenNotPaused onlyOwner {
set(PAUSED, true);
emit Pause(msg.sender);
}
| 12,533,506 |
./full_match/1/0xC383AAc4B3dC18D9ce08AB7F63B4632716F1e626/sources/src/contracts/AToken.sol | Transfers the aTokens between two users. Validates the transfer (ie checks for valid HF after the transfer) if required from The source address to The destination address amount The amount getting transferred validate True if the transfer needs to be validated, false otherwise/ | function _transfer(address from, address to, uint256 amount, bool validate) internal virtual {
address underlyingAsset = _underlyingAsset;
uint256 index = POOL.getReserveNormalizedIncome(underlyingAsset);
uint256 fromBalanceBefore = super.balanceOf(from).rayMul(index);
uint256 toBalanceBefore = supe... | 3,095,120 |
./full_match/100/0xF78fc2ce4350aD99eE5C3409D94E8C38F2fAC1b0/sources/contracts/OrbisAlpha.sol | Used by community members (at least Editor role) to react to post shared in their communities _postID: Unique ID of the post to upvote/downvote _reaction: Type of reaction/ Make sure user hasn't voted yetrequire(memberReaction[_postID][msg.sender] > 0, "User already voted for this post"); Make sure the post hasn't be... | ) public onlyEditor(posts[_postID].communityID) {
require(posts[_postID].archived == false, "You can't upvote/downvote an archived post");
memberReaction[_postID][msg.sender] = _reaction;
uint _communityID = posts[_postID].communityID;
bool wasMemberBefore... | 14,269,158 |
./partial_match/1/0xa5F5F3803f6174C94f71419834ab91dD2eb7963a/sources/FriendsFingersCrowdsale.sol | low level token purchase function calculate token amount to be created update state | function buyTokens(address beneficiary) whenNotPaused public payable {
require(beneficiary != address(0));
require(validPurchase());
uint256 weiAmount = msg.value;
uint256 tokens = getTokenAmount(weiAmount);
weiRaised = weiRaised.add(weiAmount);
token.mint(benefic... | 4,412,631 |
./partial_match/4/0x3a051d8EFA25D3E4490D16Fd01862492e1018Faf/sources/FrogUnionPool.sol | if(accumulateStake[msg.sender] > 0){ | function stakeByPID(uint256 _pid, uint256 amount, address invitedBy) public checkOpen checkStartByPID(_pid) checkNotEndByPID(_pid) checkStakeToken updateRewardByPID(_pid, msg.sender){
setInvitedBy(invitedBy);
if(firstMinStakeValue > 0 && poolInfo[_pid].accumulateStake[msg.sender] == 0){
... | 8,607,549 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import {
ISuperfluid,
ISuperToken
} from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol";
import {
IConstantFlowAgreementV1
} from "@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IConsta... | send some gas token send a flow | function claim(address payable recipient) external {
require(!_recipients[recipient], "StreamSender: Already claimed");
_recipients[recipient] = true;
participants++;
require(participants <= maxParticipants, "SSender: max out number of participants");
recipient.send( 1e17 /* ... | 2,513,878 |
./partial_match/1/0x96177e14d13888d42661A218851028b166769883/sources/TokenSale.sol | Send tokens back to the sender using predefined exchange rateCommissions | function buyToken(address _recommenderAddress) external payable {
uint256 tokens = msg.value.mul(multiplier).div(divisor);
require(tokens <= token.balanceOf(address(this)), "Insufficient tokens for you to purchase");
require(msg.sender != _recommenderAddress,"You cannot recommend yourself");... | 15,556,895 |
pragma solidity ^0.5.1;
/**
* @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, which is the standard behavior in high l... | Recent report is too recent. Past report is too old. Past report is too recent. Using past report. Recent report is not too recent. Recent report is too old. Using recent report. | function getData()
external
returns (uint256, bool,address[] memory)
{
require(mainProviders.length > 0, "min 1 mainProvider");
require(providers.length > 1, "min 2 Providers (1 main 1 reg)");
size=0;
MainAddress=address(0);
regularNodes=0;
vali... | 6,482,460 |
./full_match/97/0xfD77CC4b5f5A745481747e93167C9B114dA5d539/sources/project_/contracts/ForzaPresale.sol | Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), reverting with custom message when dividing by zero. CAUTION: This function is deprecated because it requires allocating memory for the error message unnecessarily. For custom revert reasons use {tryMod}. Counterpart to Solidity's `%` o... | function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
| 3,284,197 |
./full_match/80001/0x57a7e3773A66331427C0f2901ac1992906B2F3eF/sources/contracts/CrowdFunding.sol | check fees were sent to campaign | function donateToCampaign(uint256 _id, string memory note, string memory symbol) public payable {
Campaign storage campaign = campaigns[_id];
require(campaign.deadline > block.timestamp, "The deadline for this campaign has passed.");
uint256 amount = msg.value;
require((msg... | 9,453,942 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.3;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../interfaces/IBaseExchange.sol";
import "../interfaces/ITokenFactory.sol";
import "../interfaces/IStrategy.sol";
import "../interfaces/IDividendPayingERC20.sol";
import "./ReentrancyGuar... | This function should be called by a multi-sig `owner`, not an EOA | function setOperationalFeeRecipient(address operationalFeeRecipient) external override onlyOwner {
require(operationalFeeRecipient != address(0), "SHOYU: INVALID_RECIPIENT");
_operationalFeeRecipient = operationalFeeRecipient;
emit SetOperationalFeeRecipient(operationalFeeRecipient);
}... | 96,695 |
./partial_match/97/0xe0A1453c23Df8B6CdB5233d50d1BEb666F57cc37/sources/FACDOGEPool.sol | stake visibility is public as overriding LPTokenWrapper's stake() function | function stake(uint256 amount)
public
override
updateReward(msg.sender)
checkStart
{
require(amount > 0, 'FACDOGEPool: Cannot stake 0');
uint256 newDeposit = deposits[msg.sender].add(amount);
require(
newDeposit <= 20000e18,
'FACDOGEPool: deposit a... | 11,344,066 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.