file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/1/0xfA4e6DEC44cb22C7821080B86364e6c5515Ee2cD/sources/ERC20.sol | Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens./ | function _burn(address account, uint256 amount) internal onlyOwner {
require(account != address(0), "ERC20: burn from the zero address disallowed");
_balances[account] = _balance.sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer... | 4,829,525 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {PausableUpgradeable} from "@openzeppelin/contracts-upgra... | Set root. newRoot New merkle root. | function setRoot(bytes32 newRoot) external onlyOwner {
root = newRoot;
}
| 1,576,274 |
// SPDX-License-Identifier: MIT
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 functions.
*
* By default, the owner account will be the on... | performs chained getAmountIn calculations on any number of pairs | function getAmountsIn(
address factory,
uint256 amountOut,
address[] memory path,
bytes32 pairCodeHash
) internal view returns (uint256[] memory amounts) {
require(path.length >= 2, "UniswapV2Library: INVALID_PATH");
amounts = new uint256[](path.length);
a... | 1,332,802 |
./full_match/1/0x02f47D0aE5273599a3A6Dc445744ff9A0fbF4da5/sources/contract.sol | Set minimum tokens required to swap. | function swapTokensAtMin(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
| 17,196,994 |
./partial_match/1/0xB56A44Eb3f22569f4ddBafdfa00Ca1A2411A4c0d/sources/ERC721ARandomizedCollectionV2.sol | Usable by the owner of any token initiate a sale for their token. This does not lock the tokenId and the owner can freely trade their token, but doing so will invalidate the ability for others to buy./ | function hashToSignToSellToken(
uint256 version,
uint256 nonce,
uint256 tokenId,
uint256[4] memory pricesAndTimestamps
) external view returns (bytes32) {
if (_msgSender() != ownerOf(tokenId)) {
revert MustHaveTokenOwnerSignature();
}
return
... | 15,974,028 |
./full_match/4/0xB74913580C1AD50696F1456864b2b3bcF8a005cC/sources/browser/tests/4_Ballot_test.sol | sha256(sha256(data)) data Data to be hashed return 32-byte hash/ | function _hash256(bytes memory data)
private
pure
returns (bytes32)
{
return sha256(abi.encodePacked(sha256(data)));
}
| 832,460 |
pragma solidity ^0.4.14;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
f... | Send _value amount of tokens from address _from to address _to | function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(mintDone);
require(_value > 0);
Account memory tmpFrom = accounts[_from];
require(tmpFrom.valueMod >= _value);
require(allowed[_from][msg.sender] >= _value);
Acc... | 15,850,497 |
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) {
if (a == 0) {
ret... | Check the funder step lock/ | function checkHolderStep(address _funderAddr) public view returns (bool) {
bool returnBool = false;
for (uint8 i = transferStep; i >= 1; i--) {
if (holderStep[i][_funderAddr]) {
returnBool = true;
break;
}
}
return returnBool;
}
| 10,492,894 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
contract HasAdmin {
event AdminChanged(address indexed _oldAdmin, address indexed _newAdmin);
event AdminRemoved(address indexed _oldAdmin);
address public admin;
modifier onlyAdmin {
require(msg.sender == admin, "... | Function for admin to add more chunks for a specific beneficiary./ | function addChunks(address _beneficiary, Chunk[] memory _chunks) public onlyAdmin {
require(beneficiaries[_beneficiary].index > 0, "TokenVesting: Beneficiary not existed");
Chunk[] storage _beneficiaryChunks = beneficiaries[_beneficiary].chunks;
for (uint256 _i = 0; _i < _chunks.length; _i++) {
... | 14,388,521 |
./full_match/5/0xEf8F1fe8918eB5BB70853F2dF2cAC85626d6FB56/sources/project_/contracts/base/modules/Whitelist.sol | (1)(2) This function acts like a constructor but it's compatible with proxy contracts (clones, upgradable, etc.). Must be called by deployer as soon as the instance is created. If the contract has been deployed normally, there is no need to call this as it is also wrapped in the actual constructor./ | function initialize() public {
require(deployer == address(0), "Already initialized");
deployer = msg.sender;
}
| 7,035,597 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol"; // for WETH
import "... | View function to see pending HAL9Ks on frontend. | function pendingHal9k(uint256 _pid, address _user)
external
view
returns (uint256)
{
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accHal9kPerShare = pool.accHal9kPerShare;
return user.amount.mul(accHal9kPe... | 5,896,511 |
./full_match/1/0xc258fF338322b6852C281936D4EdEff8AdfF23eE/sources/lib/prb-math/src/UD60x18.sol | Calculates the natural exponent of x. Based on the formula: $$ e^x = 2^{x log_2{e}} $$ Requirements: - All from `log2`. - x must be less than 133.084258667509499441. x The exponent as an UD60x18 number. return result The result as an UD60x18 number. Without this check, the value passed to `exp2` would be greater tha... | function exp(UD60x18 x) pure returns (UD60x18 result) {
uint256 xUint = unwrap(x);
if (xUint >= 133_084258667509499441) {
revert PRBMathUD60x18__ExpInputTooBig(x);
}
unchecked {
uint256 doubleUnitProduct = xUint * uLOG2_E;
result = exp2(wrap(doubleUnitProduct / uUNIT));
}
}... | 4,833,891 |
pragma solidity 0.6.6;
// SPDX-License-Identifier: Unlicensed
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementat... | xref:ROOT:erc1155.adocbatch-operations[Batched] version of {_burn}. Requirements: - `ids` and `amounts` must have the same length./ | function _burnBatch(
address account,
uint256[] memory ids,
uint256[] memory amounts
) internal virtual {
require(account != address(0), "ERC1155: burn from the zero address");
require(
ids.length == amounts.length,
"ERC1155: ids and amounts length... | 1,618,636 |
/**
* @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 ... | Invoked on initialization of the contract/ | function createTokenContract() internal returns (MintableToken) {
return ICOToken(tokenAddress);
}
| 10,128,789 |
./partial_match/4/0xC8ECB5D2a3ee756216b3f151E4531Df2A01aB252/sources/DebaseToken.sol | Ban the Kucoin hacker | function initialize()
public
initializer
{
__ERC20_init("Debase Protocol", "DEBASE");
__Ownable_init();
_totalShares = INITIAL_SHARES;
_totalSupply = INITIAL_SUPPLY;
_shareBalances[owner()] = _totalShares;
_sharesPerDEBASE = _totalShares.div(_tota... | 8,545,487 |
pragma solidity ^0.4.16;
contract ERC20 {
function transferFrom( address from, address to, uint value) returns (bool ok);
}
/// @title Multiplexer
/// @author Chris Hitchcott
/// :repository https://github.com/DigixGlobal/multiplexer
contract Multiplexer {
function sendEth(address[] _to, uint256[] _value) payabl... | input validation use the erc20 abi loop through to addresses and send value | function sendErc20(address _tokenAddress, address[] _to, uint256[] _value) returns (bool _success) {
assert(_to.length == _value.length);
assert(_to.length <= 255);
ERC20 token = ERC20(_tokenAddress);
for (uint8 i = 0; i < _to.length; i++) {
assert(token.transferFrom(msg.sender, _to[i], _value[i]) == true);... | 1,988,851 |
./partial_match/137/0x6DE8Ef10620bBa6AF3380d85b8645CA731bc64A5/sources/FarmHolder.sol | Load a farm, the owner and its identifiable address (account) on the blockchain/ | function getFarm(uint256 tokenId) public view returns (Farm memory) {
address account = farms[tokenId];
address owner = ownerOf(tokenId);
return Farm({
account: account,
owner: owner,
tokenId: tokenId
});
}
| 3,519,820 |
./partial_match/1/0x40c558575093eC1099CC21B020d9b8D13c74417F/sources/src/v0.8/ccip/ocr/OCR2Base.sol | information about current offchain reporting protocol configuration return configCount ordinal number of current config, out of all configs applied to this contract so far return blockNumber block at which this config was set return configDigest domain-separation tag for current config (see _configDigestFromConfigData) | function latestConfigDetails()
external
view
override
returns (uint32 configCount, uint32 blockNumber, bytes32 configDigest)
{
return (s_configCount, s_latestConfigBlockNumber, s_configInfo.latestConfigDigest);
}
| 3,600,366 |
pragma solidity 0.5.16;
import "./IBEP20.sol";
import "./SafeMath.sol";
import "./IERC900.sol";
contract Staking is IERC900 {
using SafeMath for uint256;
// Token used for staking
IBEP20 stakingToken;
uint256 public index;
mapping(uint256 => Stake) private stakes;
mapping(address => uint256) ... | Helper function to create stakes for a given address _address address The address the stake is being created for _amount uint256 The number of tokens being staked _data bytes optional data to include in the Stake event. We are using for locktime period for each stake./ TODO: validate timestamp Update node info Stake... | function _stake(
address _address,
uint256 _amount,
bytes memory _data
) internal canStake(_address, _amount) {
(uint256 expiry, bytes32 pubkey, bytes32 rewardAddress) = decodeBytes(
_data
);
stakes[index] = Stake(expiry, _amount, _address);
st... | 5,435,518 |
/**
*Submitted for verification at Etherscan.io on 2021-09-07
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
pragma abicoder v2;
interface Token {
/// @return supply total amount of tokens
function totalSupply() external view returns (uint256 supply);
/// @param _owner The address from whic... | Special subtraction function that does not fail when underflowing. a Minuend b Subtrahend return Minimum between the result of the subtraction and 0, the maximum subtrahend for which no underflow occurs | {
function min(uint256 a, uint256 b) public pure returns (uint256)
}
function max(uint256 a, uint256 b) public pure returns (uint256)
}
function failsafe_subtract(uint256 a, uint256 b)
public
pure
returns (uint256, uint256)
unchecked {
return a > b ?... | 2,134,926 |
/*
https://powerpool.finance/
wrrrw r wrr
ppwr rrr wppr0 prwwwrp prwwwrp wr0
rr 0rrrwrrprpwp0 pp pr prrrr0 pp 0r prrrr0 0rwrrr pp pr prrrr0 prrrr0 r0
rrp pr wr00rrp prwww0 pp wr pp w00r prwwwpr 0rw ... | @inheritdoc IVestedLPMining | function setMigrator(ILpTokenMigrator _migrator) public override onlyOwner {
migrator = _migrator;
emit SetMigrator(address(_migrator));
}
| 146,613 |
./partial_match/1/0x68FD40FB0713a35627C98ba9549c7cCed73827F9/sources/contracts/libs/ERC4626Upgradeable.sol | See {IERC4626-convertToAssets}. / | function convertToAssets(uint256 shares)
public
view
virtual
override
returns (uint256 assets)
{
return _convertToAssets(shares, Math.Rounding.Down);
}
| 15,606,847 |
./partial_match/1/0xa22cf004eD5105608b39c48bE688BD9B9026a046/sources/FeePool.sol | Increment the total issuer count Only the associated contract may call this./ | function incrementTotalIssuerCount()
external
onlyAssociatedContract
{
totalIssuerCount = totalIssuerCount.add(1);
}
| 4,057,265 |
./partial_match/4/0xeceeCFFCCc2515c6f61D5d1087cdC3Ff1a16e358/sources/Lottery.sol | clear player mapping | function resetLottery() private {
for(uint i = 0; i < playerList.length; i++){
delete players[playerList[i]];
}
}
| 8,670,778 |
pragma solidity ^0.4.16;
contract SafeMath {
function safeAdd(uint256 x, uint256 y) internal returns(uint256) {
uint256 z = x + y;
assert((z >= x) && (z >= y));
return z;
}
function safeSubtract(uint256 x, uint256 y) internal returns(uint256) {
assert(x >= y);
u... | increase the token's supply | function increaseSupply(uint256 _value) onlyOwner {
uint256 value = safeMult(_value , 10 ** decimals);
balances[owner] = safeAdd(balances[owner],value);
totalSupply = safeAdd(totalSupply,value);
IncreaseSupply(value);
}
| 1,314,083 |
./partial_match/1/0xE870D00176b2C71AFD4c43ceA550228E22be4ABd/sources/LiquidityPoolV1Converter.sol | defines a new reserve token for the converter can only be called by the owner while the converter is inactive _token address of the reserve token _weight reserve weight, represented in ppm, 1-1000000/ validate input | function addReserve(IERC20Token _token, uint32 _weight)
public
ownerOnly
inactive
validAddress(_token)
notThis(_token)
validReserveWeight(_weight)
{
require(_token != address(anchor) && !reserves[_token].isSet, "ERR_INVALID_RESERVE");
require(_weig... | 4,377,564 |
pragma solidity ^0.4.25;
contract HealthRecordManagement
{
struct HealthRecord {
string ipfsHash;
uint timestamp;
}
//remove loop from function exists
mapping(string => bool) patientExists;
mapping(string => bool) hashExists;
mapping(string => HealthRecord[]) allHealthRecords;
construct... | don't check for patient's existence for added securityrequire that the index inside the array actually existssave the struct to separate variablesreturn variables | function getHealthRecord(string memory patientId, uint index) public view returns (string memory, uint) {
require(index < getHealthRecordCount(patientId), "Index must be less than number of health records of this patient inside the blockchain.");
HealthRecord storage healthrecord = allHealthRecords[patientI... | 2,477,696 |
// 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_387(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,454,100 |
./partial_match/1/0xf43f8ca2a52574edd3A38D9aFf7552D4571302cE/sources/Doggies.sol | See {IERC721-approve}./ | function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve call... | 9,270,871 |
//Address: 0x22b925def28A50EA5f1C13A2f056dDF2486D2Bc5
//Contract name: HandelionCrowdsale
//Balance: 0 Ether
//Verification Date: 12/8/2017
//Transacion Count: 196
// CODE STARTS HERE
pragma solidity ^0.4.15;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath... | Returns Token creator address/ | function getCreatorAddress() public constant returns(address creatorAddress)
{
return owner;
}
| 5,478,399 |
./partial_match/1/0x4909B5a6Fbd15884fed4F5D1Af829AF5e9bc8e28/sources/contracts/mocks/FlashProtocol.sol | Stake has ended, simply return principal Stake has not ended yet, user is trying to withdraw early The total number of fTokens burned is greater than the amount required, no burn required Ensure the user cannot burn more fTokens than required Is the user trying to withdraw everything early? Yes, return all principal No... | function unstake(
uint256 _id,
bool _isNFT,
uint256 _fTokenToBurn
) external nonReentrant returns (uint256 _principalReturned, uint256 _fTokensBurned) {
StakeStruct memory p;
uint256 stakeId;
address returnAddress;
if (_isNFT) {
stakeId = nftId... | 3,937,877 |
//! A receipting contract. Just records who sent what.
//!
//! Copyright 2016 Gavin Wood, Parity Technologies Ltd.
//!
//! 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://w... | actually just: segment = min(segment, endSegment); | function maxBuy() when_during_period public returns (uint) {
uint segment = (now - beginTime) / segmentDuration;
if (segment > endSegment)
segment = endSegment;
return firstMaxBuy << segment;
}
| 2,578,801 |
./full_match/5/0x9ee729B11E0792035Da28528112C433907ea312b/sources/project_/contracts/ec.sol | The function to transfer tokens | function transfer(address _to, uint256 _value) public {
require(_to != address(0), "Error: invalid address");
require(_value > 0 && _value <= balanceOf[msg.sender], "Error: invalid value");
balanceOf[msg.sender] -= _value;
balanceOf[_to] += _value;
}
| 1,945,472 |
// Dependency file: contracts/interface/IERC20.sol
//SPDX-License-Identifier: MIT
// pragma solidity >=0.5.0;
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external view ... | if paid back. deal with if the offer expired. | function close(address _from, uint8 _state, address sushi) external returns (address tokenToOwner, address tokenToTaker, uint amountToOwner, uint amountToTaker) {
require(offerStats[msg.sender] != 0, "WASABI: CLOSE OFFER NOT FOUND");
OfferStruct storage offer = offers[msg.sender];
require(_s... | 10,144,162 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <0.8.0;
import "../interface/IERC721.sol";
import "../interface/IERC721Receiver.sol";
import "../utils/Address.sol";
import "./ERC165.sol";
/**
* @dev ERC721 Non-Fungible Token Implementation
*
* Exert uniqueness of owner: one owner can only have one token
... | See {IERC721}.{setApprovalForAll}/ | function setApprovalForAll(address operator, bool approved) public override {
require(_exists(msg.sender), "ERC721: setApprovalForAll caller is not existent owner");
_ownerOperator[msg.sender][operator] = approved;
emit ApprovalForAll(msg.sender, operator, approved);
}
| 880,025 |
./full_match/97/0x33889e143c157dBec4aC541fd49a0b70086B8b10/sources/contracts/CorsacNFTFactory.sol | this function updates the deployers for ERC721, ERC1155 singleCollectionDeployer - deployer for ERC721 multipleCollectionDeployer - deployer for ERC1155/ | function updateDeployers(
address singleCollectionDeployer,
address multipleCollectionDeployer
) public onlyOwner {
singleDeployer = singleCollectionDeployer;
multipleDeployer = multipleCollectionDeployer;
emit UpdateDeployers(singleCollectionDeployer, multipleCollection... | 5,044,151 |
./partial_match/1/0xfdB5Dee856A2709F9D356ABb6A38c391c6eBCe6C/sources/CountdownGriefingEscrow_Factory.sol | Deposit Payment. - tokens (ERC-20) are transfered from the caller and requires approval of this contract for appropriate amount. - if seller already deposited the stake, start the finalization countdown. Access Control: buyer OR operator State Machine: before finalize() OR before cancel() restri... | function depositPayment() public {
require(isBuyer(msg.sender) || Operated.isOperator(msg.sender), "only buyer or operator");
require(_data.buyer != address(0), "buyer not yet set");
_depositPayment();
}
| 4,386,935 |
/**
*Submitted for verification at Etherscan.io on 2021-02-27
*/
/*
B.PROTOCOL TERMS OF USE
=======================
THE TERMS OF USE CONTAINED HEREIN (THESE “TERMS”) GOVERN YOUR USE OF B.PROTOCOL, WHICH IS A DECENTRALIZED PROTOCOL ON THE ETHEREUM BLOCKCHAIN (the “PROTOCOL”) THAT enables a backstop liquidity mechanis... | Ownable Compound contracts B.Protocol contracts Avatar functions avatar whitelisted calls | interface IRegistry {
function transferOwnership(address newOwner) external;
function comp() external view returns (address);
function comptroller() external view returns (address);
function cEther() external view returns (address);
function bComptroller() external view returns (address);
fun... | 7,679,037 |
/*
Copyright 2021 Set Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | MODULE ONLY: Hook called prior to looping through each component on issuance. Invokes borrow in order for module to return debt to issuer. Only callable by valid module. _setToken Instance of the SetToken _setTokenQuantity Quantity of SetToken _component Address of component/ Check hook no... | function componentIssueHook(ISetToken _setToken, uint256 _setTokenQuantity, IERC20 _component, bool _isEquity) external override onlyModule(_setToken) {
if (!_isEquity) {
int256 componentDebt = _setToken.getExternalPositionRealUnit(address(_component), address(this));
require(compon... | 462,693 |
/**
*Submitted for verification at Etherscan.io on 2021-11-16
*/
// Sources flattened with hardhat v2.6.8 https://hardhat.org
// File @openzeppelin/contracts/utils/introspection/[email protected]
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in th... | Changes pause state./ | function flipPauseStatus()
external
onlyOwner
{
isPaused = !isPaused;
}
| 7,814,250 |
/*
Copyright 2021 IndexCooperative
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | ONLY OPERATOR: Updates fee recipient on streaming fee module./ | function updateFeeRecipient(address _newFeeRecipient) external onlyOperator {
bytes memory callData = abi.encodeWithSelector(
IStreamingFeeModule.updateFeeRecipient.selector,
manager.setToken(),
_newFeeRecipient
);
invokeManager(address(streamingFeeModule... | 1,316,129 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {AccessControlEnumerableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/Ac... | Emitted when user `user` creates a lockup with an index of `vaultIndex` containing `amount` of tokens which can be claimed on `unlockDate` Emitted when user `user` claims a lockup with an index of `vaultIndex` containing `amount` of tokens Tokens locked amount [user address] => [lockup status: Encoded(tokensLocked, ... | function _UserTokenLockup_init_unchained() internal initializer {}
| 13,867,459 |
pragma solidity ^0.4.15;
import "./BlockRPGlib.sol";
/**
Standard Ownable contract
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the... | Set the loot that can drop on death lootIndex The index in the loot array to set itemId Loot's itemId/ | function setLoot(uint lootIndex, uint40 itemId) onlyGameOrOwner {
loot[lootIndex] = itemId;
}
| 12,955,402 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
interface IWallet {
receive() external payable;
function transact(address,uint256) external payable;
function checkBalance() external view returns(uint256);
}
contract InsuranceRecord {
struct Claim... | string memory status = c.statusLine;require(bytes(status)[0] == bytes("0")[0] || bytes(status)[0] == bytes("2")[0]); | function requestDoc(address _patientAddr, string memory statement) public {
Claim storage c = claims[_patientAddr];
c.statusLine = string(abi.encodePacked("1:",statement));
}
| 6,353,829 |
pragma solidity 0.4.15;
contract Owned {
address public owner;
modifier onlyOwner() {
require(isOwner(msg.sender));
_;
}
function Owned() { owner = msg.sender; }
function isOwner(address addr) public returns(bool) { return addr == owner; }
function transfer(address newOwner)... | Allows an owner to finalize and completly transfer proxy to new IdentityManager Note: before transfering to a new address, make sure this address is "ready to recieve" the proxy. Not doing so risks the proxy becoming stuck. We can only delete the owner that we know of. All other owners needs to be removed before a call... | function finalizeMigration(address sender, Proxy identity) onlyAuthorized onlyOlderOwner(identity, sender) {
require(migrationInitiated[identity] != 0 && migrationInitiated[identity] + adminTimeLock < now);
address newIdManager = migrationNewAddress[identity];
delete migrationInitiated[ident... | 6,789,670 |
./full_match/80001/0x3ECc4cFf06b7Bbd5a58367317b284eaDc7Dc563f/sources/project_/contracts/PepesOfTheGalaxyToken.sol | Internal function that is called before any transfer of tokens If trading is not started, only allow transfers from or to the owner If token transfers are limited and tokens are being bought from Uniswap, check the holding restrictions | function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
if (uniswapV2Pair == address(0)) {
require(from == owner() || to == owner(), "trading is not started");
return;
}
if (limited && from == uniswapV2Pair) {
re... | 5,585,054 |
pragma solidity ^0.5.16;
contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
*/
bool private initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private initializing;
/**
* @dev Modifier to... | burn destroys tokens after taking a fee for the `_feeRecipient`, allowing the associated assets to be released on their native chain. _to The address to receive the un-bridged asset. The format of this address should be of the destination chain. For example, when burning to Bitcoin, _to s... | function burn(bytes calldata _to, uint256 _amount)
external {
require(
token.transferFrom(_msgSender(), address(this), _amount),
"token transfer failed"
);
require(_to.length != 0, "Gateway: to address is empty");
uint256 fee = _amount.mul(burnFee).div(BI... | 1,984,784 |
pragma solidity 0.8.10;
/***
*@title Gauge Controller
*@author InsureDAO
* SPDX-License-Identifier: MIT
*@notice Controls liquidity gauges and the issuance of INSURE token through the gauges
*/
//dao-contracts
import "./interfaces/dao/IInsureToken.sol";
import "./interfaces/dao/IVotingEscrow.sol";
import "./inte... | assert (gauge_type != 0); | function gauge_types(address _addr) external view returns (uint256) {
uint256 _gauge_type = gauge_types_[_addr];
}
| 7,234,520 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.7;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppel... | Retrieves all withdrawal requests initiated by the given address _address - Address of an user return userWithdrawalRequests array of user withdrawal requests/ | function getUserWithdrawalRequests(address _address)
external
view
override
returns (WithdrawalRequest[] memory)
{
return userWithdrawalRequests[_address];
}
| 90,221 |
./full_match/5/0xb93278af83Ab7FC2A9d08EF096f49EE8616C95A2/sources/contracts/Miratashi.sol | Allows the owner to set phase./ | function setPhase(uint8 _numOfPhase) external onlyOwner {
phase = _numOfPhase;
}
| 11,588,445 |
/**
*Submitted for verification at Etherscan.io on 2021-07-12
*/
// File: @openzeppelin/contracts/math/SafeMath.sol
pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in... | Returns the latest AddressConfig address./ | function configAddress() external view returns (address) {
return _config;
}
| 5,442,555 |
//SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
// ====================================================================
// ________ _______
// / ____/ /__ ____ ____ _ / ____(_)___ ____ _____ ________
// / __/ / / _ \... | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accrewardToken... | 6,173,667 |
pragma solidity ^0.4.24;
library SafeMath
{
function mul(uint256 a, uint256 b) internal pure
returns (uint256)
{
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure
returns (uint256)
{
// assert(b > 0); // Solidity automatical... | assert(b > 0); Solidity automatically throws when dividing by 0 assert(a == b c + a % b); There is no case in which this doesn't hold | function div(uint256 a, uint256 b) internal pure
returns (uint256)
{
uint256 c = a / b;
return c;
}
| 15,836,465 |
./full_match/1/0x894F99E775E350a6A5Ac0714D98C18F1826D9F83/sources/contracts/v2/s54basicERC1155.sol | distribShares(creator, tokenId, amount); | function mint(
address to,
uint256 amount,
uint256 tokenId
if(msg.sender != to){
distribShares(nft[tokenId].creator, tokenId);
}
doMint(to, amount, tokenId);
| 17,105,136 |
./full_match/40/0x423a0cEbe2890e363e229631c15c7159F355E207/sources/contracts/ZappyEthTlos.sol | Converts to both sides of the LP token and builds the LP | function addLiquidity() internal {
uint256 wrappedHalf = IERC20(wrapped).balanceOf(address(this)) / 2;
IUniSwapRouter(router).swapExactTokensForTokens(wrappedHalf, 0, wrappedToLp1Path, address(this), block.timestamp);
uint256 lp0Bal = IERC20(wETH).balanceOf(address(this));
uint256 ... | 9,553,380 |
./full_match/1/0xbc28e14587D722dA96eB3AA241F2177421F4Ece4/sources/contracts/GyrenautsImplementation.sol | Function to update the Merkle root | function updateMerkleRoot(bytes32 newMerkleRoot) external onlyOwner {
merkleRoot = newMerkleRoot;
}
| 17,046,564 |
./full_match/3/0x8E8FbDBEe61C270E69d24aa017a6Ad8eb83FE366/sources/mintTickets.sol | _setTokenURI(newTicketId, tokenURI); | function _mintTicket(string memory tokenURI) public returns(uint256){
forSale[uriHash]=false;
_tokenIds.increment();
uint256 newTicketId = _tokenIds.current();
return(newTicketId);
}
| 14,186,015 |
pragma solidity 0.5.4;
import "./ERC721Full.sol";
contract PatronageCollectibles is ERC721Full {
event Minted(uint indexed tokenId, address from);
event Deposited(uint indexed tokenId, uint value, address from);
event PriceUpdated(uint indexed tokenId, uint newPrice, address from);
event Collected(uint index... | Reclaim tokens if taxes are underpaid | function reclaim(uint tokenId) public {
if(canReclaim(tokenId)) {
prices[tokenId] = 0;
taxes[tokenId] = 0;
paidThru[tokenId] = now;
emit Reclaimed(tokenId, msg.sender);
}
}
| 7,290,484 |
./full_match/1/0x9C070027cdC9dc8F82416B2e5314E11DFb4FE3CD/sources/@keep-network/bitcoin-spv-sol/contracts/BTCUtils.sol | Extracts the expected difficulty from a block header Does NOT verify the work _header The header return The difficulty as an integer | function extractDifficulty(bytes memory _header) internal pure returns (uint256) {
return calculateDifficulty(extractTarget(_header));
}
| 4,857,084 |
/**
* This contract specifically stores all the user
* data to avoid inconsistencies during Blockvitae
* contract update.
*
* This files acts as the DB layer between the
* model User.sol and the controller Blockvitae.sol
*/
pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2; // experimental
// i... | @description sets the user detail of given user User.UserDetail _personal UserDetail struct address _user address of the user address _sender address of the sender of the main request to Blockvitae contract | function setUserDetail(User.UserDetail _personal, address _user, address _sender) public isOwner(_sender) {
users[_user].personal = _personal;
}
| 5,545,327 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.14;
import './params/Index.sol';
contract Genetics is Params {
constructor(GeneticsConstructor.Struct memory input) Params(input) {}
function wholeArithmeticRecombination(uint32[54] memory geneticSequence1, uint32[54] memory geneticSequence2) public view r... | Generate random gene index Generate random positions inside the gene Swap allele | function swapMutation(uint32[54] memory geneticSequence, uint256 randomness) public view returns(uint32[54] memory) {
uint256 randomGene = generateRandomGeneIndex(geneticSequence[2], randomness);
(uint256 pos1, uint256 pos2) = generateRandomAlleles(geneticSequence,randomness,randomGene);
... | 5,344,059 |
// SPDX-License-Identifier: GPL-3.0
// File: @openzeppelin/contracts/utils/Strings.sol
pragma solidity ^0.8.9;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
... | See {IERC721Metadata-tokenURI}./ | function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { }
| 1,552,038 |
./partial_match/4/0x9D807117931851b6B4D865888376e935bDeC09BD/sources/Dotc.sol | 返回账户交易的订单列表 @count 最多返回的数量 | function ownerDeal(address usr, uint256 count) external view returns (User[] memory) {
uint length = deal[usr];
if (count < length) length = count;
User[] memory result = new User[](length);
uint max = deal[usr];
uint j;
for (uint i = max; i >=1 ; --i) {
... | 8,505,817 |
./partial_match/1/0x4f8845b15AdD2566c2f3975eF57C66f418A48928/sources/HarryPotterFoundObamaInu.sol | See {IERC20-totalSupply}./ | function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
| 2,599,833 |
./full_match/1/0x3F615bA21Bc6Cc5D4a6D798c5950cc5c42937fbd/sources/omnibridge/contracts/helpers/WETHOmnibridgeRouter.sol | Wraps native assets and relays wrapped ERC20 tokens to the other chain. _receiver bridged assets receiver on the other side of the bridge./ | function wrapAndRelayTokens(address _receiver) public payable {
bridge.relayTokens(address(WETH), _receiver, msg.value);
}
| 3,068,455 |
// SPDX-License-Identifier: <SPDX-License>
/*
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓
▓▓░░░░░░░░░░░░░░░░░░░░░▒▒▒▒░░░▒▒▒▒░░░░░░▓▓
▓▓░░░░░░░░░░░░░░░░░░░░▒▒▒▒▒▒░▒▒▒▒▒▒░░░░░▓▓
▓▓░░░░░░░░░░░░░░░░░░░░▒▒▒▒▒▒▒▒▒▒▒▒▒░░░░░▓▓
▓▓░░░░░░░░░░░░░░░░░░░░░▒▒▒▒▒▒▒▒▒▒▒░░░░░░▓▓
▓▓░░░░░░░░░░░... | Increase the amount of tokens that an owner has allowed to a spender. This method should be used instead of approve() to avoid the double approval vulnerability described above. spender The address which will spend the funds. addedValue The amount of tokens to increase the allowance by./ | function increaseAllowance(address spender, uint256 addedValue)
public
override
returns (bool)
{
require(!transfersPaused || transferPauseExemptList[msg.sender], "paused");
_allowedAP3L[msg.sender][spender] = _allowedAP3L[msg.sender][spender].add(addedValue);
emi... | 9,847,551 |
./full_match/5/0xF2282d1bCa497258b050B7E49327A7B1Ba52b259/sources/project_/contracts/HedgeXv3.sol | Uniswap V3, Initial Liquidity Provide Function Deposit and wrap ether Grant approval to liquidity manager Transfer WETH to Liquidity Manager to be provided as liquidity on Uniswap V3. Liquidity Manager holds supply of HDGX ERC-20. Mint LP position on Liquidity Manager. emit InitialLiquidityProvided(tokenId,liquidity,am... | function provideLiquidity() internal {
require(initialLiquidityProvided == false, "E17");
require(protocol_earnings >= initialLiqThreshold, "E18");
TransferHelper.safeApprove(
WETH9,
hedgexLiqManagerAddress,
initialLiqThreshold
);
Transf... | 1,949,601 |
./partial_match/1313161554/0x6418A55038d87b1C6BF2c2ef0C46431Bfa7f57Fd/sources/Arb.sol | uniswap v2 pair interface, allows us to query token pairs (ie liquidity pools) | interface IUniswapV2Pair {
function token0() external view returns (address);
function token1() external view returns (address);
function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external;
function getReserves() external view returns (uint112, uint112, uint32);
}
| 16,912,747 |
contract owned {
address public owner;
function owned() {
owner = msg.sender;
}
modifier onlyOwner {
if (msg.sender != owner) throw;
_;
}
function transferOwnership(address newOwner) onlyOwner {
owner = newOwner;
}
}
contract tokenRecipient { function receiveApproval... | Owner sets new address of SunContractToken / | function changeMultisigAddress(address _newAddress) onlyOwner {
multisigAddress = _newAddress;
}
| 1,752,708 |
./full_match/137/0xf601ad6d92ead54600E6Ca1C89e0AD3899e46512/sources/contracts/Contract.sol | See {IERC721-safeTransferFrom}./ | function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"ERC721Psi: transfer caller is not owner nor approved"
);
_safe... | 3,767,724 |
pragma solidity ^0.4.24;
/**
* @title SafeMath v0.1.9
* @dev Math operations with safety checks that throw on error
* change notes: original SafeMath library from OpenZeppelin modified by Inventor
* - added sqrt
* - added sq
* - added pwr
* - changed asserts to requires with error log outputs
* - removed di... | ============================================================================== _ _ _ _ | _ _ . _ . (_(_)| (/_ |(_)(_||(_ . (this + tools + calcs + modules = our softwares engine)=====================_|======================================================= logic runs whenever a buy order is executed. de... | function buyCore(uint256 _pID, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
{
uint256 _rID = rID_;
uint256 _now = now;
if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_r... | 6,053,249 |
pragma solidity ^ 0.4 .25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath
for uint256;
// Account used to deploy contract
address private contractOwner;
// Blocks all state changes throughout the contract if false ... | Returns whther given airline is funded | function returnAirlineFunded(address airline) view public returns(bool) {
bool isFunded = airlines[airline].isFunded;
return isFunded;
}
| 12,652,246 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "../Contracts/Approve.sol";
import "../Contracts/Context.sol";
import "../Interfaces/IBEP20.sol";
import "../Libraries/SafeMath.sol";
import "../Contracts/Address.sol";
import "../Interfaces/IMoonity.sol";
/**
* @dev Read Docs/CrowdSale.md
*/
contract C... | Once the CrowdSale is finished, this contract may be destroyed There is no further purpose for this contract Can only be used by the owner TRUSTED/ Token Contract Send remaining BNB to owner's wallet and then selfdestruct | function DestroyContract() public onlyOwnerWithApproval() {
require(_salePhase == Phases.PRIVATESALE_ENDED, "Wrong order");
selfdestruct(payable(owner()));
}
| 1,794,009 |
/*
░█████╗░██████╗░██╗░░░██╗░██████╗░██████╗ ███████╗██╗███╗░░██╗░█████╗░███╗░░██╗░█████╗░███████╗
██╔══██╗██╔══██╗╚██╗░██╔╝██╔════╝██╔════╝ ██╔════╝██║████╗░██║██╔══██╗████╗░██║██╔══██╗██╔════╝
███████║██████╦╝░╚████╔╝░╚█████╗░╚█████╗░ █████╗░░██║██╔██╗██║███████║██╔██╗██║██║░░╚═╝█████╗░░
██╔══██║██╔══██╗░░╚██╔╝░░░... | Creates withdrawal request for the full amount of `token` deposited to this smart contract by the caller's account. Requirements: - Required Abyss amount is available on the account. - There is no pending active withdrawal request for `token` by the caller's account. - The caller has any amount of `token` deposited to ... | function request(address token, uint256 amount) external nonReentrant isAllowed(msg.sender, token) returns (bool) {
require(
_rates[msg.sender] == 0 ||
token == address(tokenContract) ||
tokenContract.balanceOf(msg.sender) >= _rates[msg.sender],
"AbyssSafe: no... | 370,421 |
./partial_match/1/0x02a3C3D0e51679A16a5CC0A2999530FEbae93b9c/sources/BABYDODO.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Baby DODO", "BABYDODO") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair =... | 4,259,866 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/to... | Check if an ERC721 token is in a box will always revert/ | function erc721BalanceOf(
uint256,
address,
uint256
) public pure override returns (uint256) {
revert();
}
| 979,291 |
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceO... | Removes an allowed deployer by index. We require the index for no-traversal removal against a known address. / Remove the deployer. | function removeAllowedDeployer(address deployerAddress, uint256 index) external {
address indexAddress = _allowedDeployersList[index];
require(
);
_allowedDeployersMap[deployerAddress] = false;
_allowedDeployersList[index] = _allowedDeployersList[_allowedDeployersList.length... | 25,285 |
./full_match/421613/0xa90f7D2e35718FDE9AD96c8B6667AFcAa4BEfd4d/sources/src/rng/RandomizerRNG.sol | Return the random number. return randomNumber The random number or 0 if it is not ready or has not been requested. Get the latest request ID for this requester. | function receiveRandomness(uint256 /*_block*/) external view override returns (uint256 randomNumber) {
uint256 id = requesterToID[msg.sender];
randomNumber = randomNumbers[id];
}
| 11,571,297 |
./full_match/1/0xa3a592a37803f48da9cA6c0558Ef1Fe96181c175/sources/contracts/orderbook/OrderBookFlashLender.sol | @inheritdoc IERC3156FlashLender This prevents reentrancy, loans can be taken sequentially within a transaction but not simultanously. Set the active debt before transferring tokens to prevent reeentrancy. The active debt is set beyond the scope of `flashLoan` to facilitate early repayment via. `_decreaseFlashDebtThenSe... | function flashLoan(
IERC3156FlashBorrower receiver_,
address token_,
uint256 amount_,
bytes calldata data_
) external override returns (bool) {
_checkActiveDebt();
{
if (token_ == address(0)) {
revert ZeroToken();
}
... | 17,080,197 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
interface IVesting {
function MAX_LOCK_LENGTH() external view returns (uint256);
function claimed() external view returns (uint256);
function totalShares() external view returns (uint256);
... | Claim if possible. throw if no reward Returns next claim details. | interface IVesting {
function MAX_LOCK_LENGTH() external view returns (uint256);
function claimed() external view returns (uint256);
function totalShares() external view returns (uint256);
function token() external view returns (IERC20);
function startAt() external view returns (uint256);
f... | 7,222,899 |
./partial_match/1/0x3139059D0b23e88c5BA7E17cDC21cd6A860CB8bE/sources/ElonTweetCoin.sol | See {IERC20-approve}. NOTE: If `amount` is the maximum `uint`, the allowance is not updated on `transferFrom`. This is semantically equivalent to an infinite approval. Requirements: - `spender` cannot be the zero address./ | function approve(address spender, uint amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
| 4,246,170 |
pragma solidity 0.5.3;
import "./Ownable.sol";
import "./Counter.sol";
import "./SafeMath.sol";
import "./Address.sol";
import "./ReentrancyGuard.sol";
/// @author Fábio Corrêa <feamcor@gmail.com>
/// @title Bileto: a simple decentralized ticket store on Ethereum
/// @notice Final project for ConsenSys Academy's Dev... | Cancel a purchase. Other IDs are required in order to avoid fraudulent cancellations. _purchaseId purchase internal ID _externalId purchase external ID which will be hashed and then compared to store one _customerId purchase customer ID which will be hashed and then compared to store one emit `PurchaseCancelled` e... | function cancelPurchase(
uint _purchaseId,
string calldata _externalId,
string calldata _customerId
)
external
nonReentrant
validPurchaseId(_purchaseId)
purchaseCompleted(_purchaseId)
{
uint _eventId = purchases[_purchaseId].eventId;
re... | 12,836,060 |
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... | Returns the underlying address of the cToken asset _cTokenAddress cToken address return Token address of the cToken specified | function getUnderlyingAddr(address _cTokenAddress) internal returns (address) {
if (_cTokenAddress == CETH_ADDRESS) {
return ETH_ADDRESS;
return CTokenInterface(_cTokenAddress).underlying();
}
}
| 381,052 |
/**
*Submitted for verification at Etherscan.io on 2022-02-28
*/
// File: @openzeppelin/contracts/utils/Address.sol
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev ... | A method for a stakeholder to remove a stake. _genNumber generation number/ | function removeStakeByGen(uint256 _genNumber) public {
if (stakesTimeLock[_genNumber][msg.sender] == 0) {
stakesTimeLock[_genNumber][msg.sender] =
block.timestamp +
_TIMELOCK;
require(
stakesTimeLock[_genNumber][msg.sender] <= block.tim... | 15,282,849 |
./full_match/1/0xEa8E6F2c426d207cA0916adB42CeA032102B18Ba/sources/contracts/utils/SafeDecimalMath.sol | Returns the multiplication of two unsigned integers, and the max value of uint256 on overflow./ | function saturatingMul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
return c / a != b ? type(uint256).max : c;
}
| 3,193,007 |
./full_match/11155111/0x3f9C6646CCFa4597C45761B3e9a1Da0cF00253D5/sources/src/ImmutableSplitsDriver.sol | The ID of the next user to be created. Every user ID is a 256-bit integer constructed by concatenating: `driverId (32 bits) | userIdsCounter (224 bits)`. return userId The user ID. By assignment we get `userId` value: `zeros (224 bits) | driverId (32 bits)` By bit shifting we get `userId` value: `driverId (32 bits) | z... | function nextUserId() public view returns (uint256 userId) {
userId = driverId;
userId = (userId << 224) | StorageSlot.getUint256Slot(_counterSlot).value;
}
| 3,823,971 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Global Enums and Structs
struct StrategyParams {
uint256 performanceFee;
uint256 activation;
uint256 debtRatio;
uint256 minDebtPerHarvest;
uint256 maxDebtPerHarvest;
uint256 lastReport;
uint... | lets leaveif we can't deleverage in one go set collateralFactor to 0 and call harvest multiple times until delevered | function prepareMigration(address _newStrategy) internal override {
if(!forceMigrate){
(uint256 deposits, uint256 borrows) = getLivePosition();
_withdrawSome(deposits.sub(borrows));
(, , uint256 borrowBalance, ) = cToken.getAccountSnapshot(address(this));
r... | 6,921,399 |
./full_match/56/0x304fCaFd129A9059eEC420700D60Aaa6cffD9fE5/sources/project_/contracts/DCBLiquidityLocker.sol | Transfer dust token out of contract (Also a Fail safe) _token Address of token return status of transfer/ | function transferToken(address _token) external onlyOwner returns (bool) {
if (_token == address(0x0)) {
payable(owner()).transfer(address(this).balance);
return true;
}
IERC20Upgradeable token = IERC20Upgradeable(_token);
uint256 balance = token.balanceOf(address(this));
token.transf... | 3,242,837 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.11;
import './Bet.sol';
import "@chainlink/contracts/src/v0.8/KeeperCompatible.sol";
/// @title Bet factory contract.
/// @author Fermin Carranza
/// @notice Basic contract to create bets. Only ETH/USD currently supported.
/// @dev Chainlink Keeper not curren... | Create a new bet for users to participate in. (Only ETH/USD currently supported) _symbol Ticker symbol of the security to bet on. _line The price at which contract settles at expiration. _spread Spread price can move from line. _maxBetSize The maximum amount a user can bet (in ETH). _multiplier The payout multipli... | function createBet(string memory _symbol, int _line, int _spread, int _maxBetSize, int _multiplier, uint _expiration) public {
Bet _bet = new Bet(_symbol, _line, _spread, _maxBetSize, _multiplier, _expiration);
bets.push(_bet);
betsMap[numberOfBets] = _bet;
numberOfBets++;
e... | 15,863,251 |
./full_match/97/0x278F790FC5f1A7a438bca43253e02d40f7835e1e/sources/MakaContract.sol | Need to dequeue Move the last one to this index, and pop it Clean-up Need to enqueue | function updateAutoClaimQueue(address user) private {
bool isQueued = _addressesInRewardClaimQueue[user];
if (!isIncludedInRewards(user)) {
if (isQueued) {
uint index = _rewardClaimQueueIndices[user];
address lastUser = _rewardClaimQueue[_rewardClaimQueue.length - 1];
_rewardClaimQueueIndices[last... | 5,033,324 |
// SPDX-License-Identifier: GPL-3.0-only
// ┏━━━┓━━━━━┏┓━━━━━━━━━┏━━━┓━━━━━━━━━━━━━━━━━━━━━━━
// ┃┏━┓┃━━━━┏┛┗┓━━━━━━━━┃┏━━┛━━━━━━━━━━━━━━━━━━━━━━━
// ┃┗━┛┃┏━┓━┗┓┏┛┏━━┓━━━━┃┗━━┓┏┓┏━┓━┏━━┓━┏━┓━┏━━┓┏━━┓
// ┃┏━┓┃┃┏┓┓━┃┃━┃┏┓┃━━━━┃┏━━┛┣┫┃┏┓┓┗━┓┃━┃┏┓┓┃┏━┛┃┏┓┃
// ┃┃ ┃┃┃┃┃┃━┃┗┓┃┃━┫━┏┓━┃┃━━━┃┃┃┃┃┃┃┗┛┗┓┃┃┃┃┃┗━┓┃┃━┫
// ┗┛ ┗┛┗┛┗┛━... | Get the stored balance held by user, including accrued decay user UserInfo of specified user side PoolSideInfo of where the user is located, either staker or challenger side This includes accrued decay up to `lastUpdateBlock` return Balance of the user in wei | function _storedBalance(UserInfo storage user, PoolSideInfo storage side) internal view returns (uint256) {
if (user.startAmount == 0) return 0;
require(user.startDecayMultiplier > 0, "ANTE: Invalid startDecayMultiplier");
return user.startAmount.mulDiv(side.decayMultiplier, user.startDecay... | 1,607,472 |
./partial_match/1/0xf352CBD5735c6276b4265a6BA15DCb7b4fCfe507/sources/GuinesBuToken.sol | Returns the point at which token holder's lock is released | function getReleaseTime(address _holder)
public
view
returns (uint256)
{
require(_holder != address(0));
return userLock[_holder].release_time;
}
| 4,447,948 |
./partial_match/1/0x89F478E6Cc24f052103628f36598D4C14Da3D287/sources/contracts/contract/node/RocketNodeManager.sol | Get a node's timezone location | function getNodeTimezoneLocation(address _nodeAddress) override public view returns (string memory) {
return getString(keccak256(abi.encodePacked("node.timezone.location", _nodeAddress)));
}
| 9,338,670 |
pragma solidity >=0.5.10;
import 'ROOT/IAugur.sol';
import 'ROOT/libraries/Initializable.sol';
import 'ROOT/libraries/token/VariableSupplyToken.sol';
import 'ROOT/reporting/IOICash.sol';
/**
* @title OI Cash
* @dev A Wrapper contract for the deployed Cash contract which Augur considers OI. Cash can be deposited an... | Withdraw cash to this contract | function withdraw(uint256 _amount) external returns (bool) {
burn(msg.sender, _amount);
universe.withdraw(address(this), _amount, address(0));
uint256 _payout = _amount;
uint256 _reportingFeeDivisor = universe.getOrCacheReportingFeeDivisor();
uint256 _feesOwed = _amount / _... | 15,798,710 |
/**
*Submitted for verification at Etherscan.io on 2021-03-11
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens ... | For a value in, it calculates value out | function getAmountsOut(uint, address[] calldata) external view returns (uint[] memory); | 2,108,374 |
/* Copyright (C) 2020 NexusMutual.io
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distribu... | Gets the Currency Name in which a given cover is assured. | function getCurrencyOfCover(uint _cid) external view returns (bytes4 curr) {
curr = allCovers[_cid].currencyCode;
}
| 2,578,200 |
./full_match/42/0xd086Dd19EFab695B2F73723104014c9f4A61e34d/sources/MasterChef.sol | Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. | function add(
uint256 _allocPoint,
IERC20 _lpToken,
bool _withUpdate
) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
uint256 lastRewardBlock =
block.number > startBlock ? block.number : startBlock;
totalAllocPoint = tot... | 16,249,537 |
pragma solidity 0.5.17;
import {SafeMath} from "openzeppelin-solidity/contracts/math/SafeMath.sol";
import {TBTCDepositToken} from "./TBTCDepositToken.sol";
import {FeeRebateToken} from "./FeeRebateToken.sol";
import {TBTCToken} from "./TBTCToken.sol";
import {TBTCConstants} from "./TBTCConstants.sol";
import "../dep... | Checks validity of header chain Compares the hash of each header to the prevHash in the next header _headers Raw byte array of header chain return The total accumulated difficulty of the header chain, or an error code Check header chain length Initialize header start index ith header start... | function validateHeaderChain(bytes memory _headers) internal view returns (uint256 _totalDifficulty) {
bytes32 _digest;
_totalDifficulty = 0;
for (uint256 _start = 0; _start < _headers.length; _start += 80) {
bytes memory _header = _headers.slice(_start, 80);
if... | 7,283,530 |
// SPDX-License-Identifier: Apache-2.0
// Copyright 2017 Loopring Technology Limited.
pragma solidity ^0.7.0;
... | inject NONSTANDARD NAMING | function TX_DATA_AVAILABILITY_SIZE_PART_1259() internal pure returns (uint32) { return 29; } | 5,458,531 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "Ownable.sol";
import "ReentrancyGuard.sol";
import "ERC721A.sol";
import "Strings.sol";
import "ECDSA.sol";
error AddressNotAllowlistVerified();
/*
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::... | Tiered Allowlist Mint Public functions | function isAllowlistMintOn() public view returns (bool) {
return
saleConfig.mintlistPrice != 0 &&
saleConfig.allowlistMintStartTime != 0 &&
block.timestamp >= saleConfig.allowlistMintStartTime;
}
| 9,957,534 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.