file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
//Address: 0xfbca29854b821ff37e504578312459286082010d
//Contract name: Etherep
//Balance: 0 Ether
//Verification Date: 8/28/2017
//Transacion Count: 10
// CODE STARTS HERE
pragma solidity ^0.4.11;
/* Copyright 2017 GoInto, LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use... | Adds a rating to an address' cumulative score who The address that is being rated rating The rating(-5 to 5) return success If the rating was processed successfully/ Starting weight Rating multiplier We need the absolute value Calculate cumulative score if available Calculate the weight if the sender is rated above 0... | function rate(address who, int rating) external payable delay requireFee {
require(rating <= 5 && rating >= -5);
require(who != msg.sender);
RatingStore store = RatingStore(storageAddress);
int weight = 0;
int multiplier = 100;
int absRating = rating;
... | 13,124,551 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import '../interfaces/IConvexVault.sol';
import '../interfaces/ICurvePool.sol';
import '../interfaces/IStableSwap2Pool.sol';
import '../interfaces/IStableSwap3Pool.sol';
import './BaseStrategy.sol';
import '../interfaces/ExtendedIERC20.sol';
import '../interface... | Returns the balance of the pool Must be implemented by the strategy/ Returns the balance of the want token on the strategy/ | function balanceOfPool()
public
view
virtual
override
returns (uint256);
function balanceOfWant()
public
view
override
returns (uint256)
{
return IERC20(want).balanceOf(address(this));
}
| 71,431 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "./utils/GSN/Context.sol";
import "./utils/token/ERC677/ERC677Receiver.sol";
import "./utils/token/ERC677/ERC677.sol";
import "./utils/token/ERC677/SafeERC677.sol";
import "./utils/token/ERC677/IERC677.sol";
import "./utils/util/ReentrancyGuard.sol";
impor... | KYC helper function used to display current KYC Status. _contributorAddress The Contributor Address Whitelisting Address. return whitelisted and KYC uplift Status./ | function checkKYC(address _contributorAddress) public view returns (bool whitelisted, bool uplifted) {
return (kyc[_contributorAddress], kycUplifted[_contributorAddress]);
}
| 12,852,486 |
// File: contracts/GuitarPoolInitializable.sol
pragma solidity 0.6.12;
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import '@pancakeswap/pancake-swap-lib/contracts/access/Ownable.sol';
import "./libs/SafeBEP20.sol";
contract GuitarPoolInitializable is Ownable, ReentrancyGuard {
using SafeMath for ui... | Withdraw staked tokens without caring about rewards rewards Needs to be for emergency./ | function emergencyWithdraw() external nonReentrant {
UserInfo storage user = userInfo[msg.sender];
uint256 amountToTransfer = user.amount;
user.amount = 0;
user.rewardDebt = 0;
stakedSupply = stakedSupply.sub(amountToTransfer);
if (amountToTransfer > 0) {
... | 12,778,736 |
//Address: 0x4a30a93e2562257b3c49aba2a79ed633b5b3c393
//Contract name: CryptoCopyCrowdsale
//Balance: 0 Ether
//Verification Date: 11/11/2017
//Transacion Count: 46
// CODE STARTS HERE
pragma solidity ^0.4.15;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath... | Get ethereum balance of `_investor` _investor The address from which the balance will be retrieved return The balance/ | function balanceOf(address _investor) constant returns (uint256 balance) {
return balancesETH[_investor];
}
| 957,527 |
pragma solidity ^0.4.23;
// Standard ERC721 functions import
contract ERC721 {
// Required methods
function approve(address _to, uint256 _tokenId) public;
function balanceOf(address _owner) public view returns (uint256 balance);
function implementsERC721() public pure returns (bool);
function ownerOf(uint256... | For querying owner of token _tokenId The tokenID for owner inquiry Required for ERC-721 compliance. | function ownerOf(uint256 _tokenId)
public
view
returns (address owner)
{
owner = PlayerIndexToOwner[_tokenId];
require(owner != address(0));
}
| 2,008,227 |
./full_match/43113/0x0Fdf864AD9Cc9d263dC6E6476f78b012857d29ed/sources/contracts/TestTreasury.sol | / convert amount to match OHM decimals | function valueOf( address _token, uint _amount ) public view returns ( uint value_ ) {
if ( isReserveToken[ _token ] ) {
value_ = _amount.mul( 10 ** IERC20( Test ).decimals() ).div( 10 ** IERC20( _token ).decimals() );
value_ = IBondCalculator( bondCalculator[ _token ] ).valuation( _... | 7,133,250 |
./full_match/1/0x86e437FE6E8d6661477f18B1B7fAAD61Aa7506A3/sources/contracts/Dividends.sol | Returns the number of dividends tokens/ | function distributedTokensLength() external view returns (uint256) {
return _distributedTokens.length();
}
| 3,216,500 |
/**
*Submitted for verification at Etherscan.io on 2021-10-29
*/
// Sources flattened with hardhat v2.6.4 https://hardhat.org
// File contracts/lib/RLPReader.sol
/*
* @author Hamdi Allam [email protected]
* Please reach out with any questions or concerns
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
l... | External State Changing Functions / burns two crows and mints caller 1 new crow keeping the parents two rarest traits minted crow is blank at the start, traits are set on polygon caller must approve breeder to spend their mom and dad crows/Sends the parents to the mad housemint caller a baby crowsend baby crow to ca... | function admitToMadHouse(uint256 mom, uint256 dad) external {
require(madHouseCreation, "MadHouse breeding not allowed");
CrowsContract.safeTransferFrom(msg.sender, madhouse, mom);
CrowsContract.safeTransferFrom(msg.sender, madhouse, dad);
uint256 babyID = CrowsContract.totalSupply(... | 2,445,811 |
./partial_match/1/0x3ca1E1eFa15De2bad5032e2F173D55b5E92857ED/sources/MeroTriHopCvx.sol | Depositing into Curve Hop Pool | function _deposit() internal override returns (bool) {
require(msg.value == 0, Error.INVALID_VALUE);
uint256 underlyingBalance = _underlyingBalance();
if (underlyingBalance > 0) {
uint256[3] memory hopAmounts;
hopAmounts[curveHopIndex] = underlyingBalance;
... | 15,683,698 |
pragma solidity 0.4.24;
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(addr... | require(hasClosed() || capReached()); | function finalize() public {
require(!isFinalized);
finalization();
emit Finalized();
isFinalized = true;
}
| 10,567,067 |
// SPDX-License-Identifier: MIT
// Split OS royalties between DOI and NFTBRandsinc
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should ... | Getter for the amount of Ether already released to a payee./ | function released(address account) public view returns (uint256) {
return _released[account];
}
| 1,629,022 |
./full_match/80001/0xc8E9bD34a93f6586cd16C23B5dEBf8138342b375/sources/contracts/Contract.sol | Ensure the player has a pickaxe Calculate the rewards they are owed, and pay them out. Send the pickaxe back to the player Update the playerPickaxe mapping Update the playerLastUpdate mapping | function withdraw() external nonReentrant {
require(
playerPickaxe[msg.sender].isData,
"You do not have a pickaxe to withdraw."
);
uint256 reward = calculateRewards(msg.sender);
rewardsToken.transfer(msg.sender, reward);
pickaxeNftCollection.safeTrans... | 874,150 |
pragma solidity 0.4.25;
import "./library/SafeMath.sol";
/// @dev GenesisOrganization interface
interface GenesisOrganization {
function existed(address caller) external returns (bool);
}
/// @dev Organization interface
interface Organization {
function canTransfer(address fromAddress, uint32 assetIndex) ext... | batch get organization addresses by asset ids return organization addresses/ | function getOrganizationAddressesByAssets(uint64[] assetIds)
public
view
returns(address[])
{
uint length = assetIds.length;
if (length == 0) {
return new address[](0);
}
address[] memory addresses = new address[](length);
for (uint i ... | 2,522,643 |
pragma solidity ^0.5.9;
contract vnxAuctionSC {
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyAdmin() {
require(msg.sender == admin, "Admin security: caller is not the admin");
_;
}
//--------------------------------------------------------... | IMPORTANT -- In case of value overflow no event is sent due to THROW (revert) -- this is rollback writes a bid to the blockchain _user The address of a user which has the corrersponding hashBid. _hashBid The hash of bid for the user to see/confirm his/her bid. _newStatus The status of the bid./ | function writeBid(address _user, uint _hashBid, StatusName _newStatus) public returns (bool) {
require(auctionDetails.isClosed == false, "Auction is already closed");
require(msg.sender == admin || msg.sender == _user, "Only admin or bid owner can write bids");
require(_newStatus == StatusNa... | 14,892,945 |
./full_match/1/0x9ED98fD1C29018B9342CB8F57A3073B9695f0c02/sources/solidity/contracts/cryptography/AltBn128.sol | Calculates whether the provided number is even or odd. return 0x01 if y is an even number and 0x00 if it's odd./ | function parity(uint256 value) private pure returns (byte) {
return bytes32(value)[31] & 0x01;
}
| 8,312,256 |
./full_match/11155111/0x298F37fFd4B31d216B8954968cEe7EC5273CB891/sources/src/Drips.sol | Returns the amount currently stored in the protocol of the given token. The sum of streaming and splitting balances can never exceed `MAX_TOTAL_BALANCE`. The amount of tokens held by the Drips contract exceeding the sum of streaming and splitting balances can be `withdraw`n. erc20 The used ERC-20 token. It must preser... | function balances(IERC20 erc20)
public
view
returns (uint128 streamsBalance, uint128 splitsBalance)
{
Balance storage balance = _dripsStorage().balances[erc20];
return (balance.streams, balance.splits);
}
| 3,819,325 |
pragma solidity ^0.4.24;
import "./UserEscrow.sol";
import "contracts/NuCypherToken.sol";
import "contracts/MinersEscrow.sol";
import "contracts/PolicyManager.sol";
/**
* @notice Proxy to access main contracts from the UserEscrow contract
* @dev All methods must be stateless because this code will execute by delega... | Divide stake into two parts _index Index of stake _newValue New stake value _periods Amount of periods for extending stake/ | function divideStake(
uint256 _index,
uint256 _newValue,
uint16 _periods
)
public
{
getStateContract().escrow().divideStake(_index, _newValue, _periods);
emit Divided(msg.sender, _index, _newValue, _periods);
}
| 5,474,814 |
./full_match/4/0xf0657586B9481a2bc2e9C185eB0B3dCa18fEb0EB/sources/browser/MeePreSale.sol | burn the left over. | function reclaim() public {
require(msg.sender == owner && Token.balanceOf(address(this)) > 0 && now.sub(startDate) > DURATION);
Token.transfer(owner, Token.balanceOf(address(this)));
}
| 721,512 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint2... | Constructor that gives msg.sender all of existing tokens./Give all initial supply to the contract.From now onwards, we MUST always use transfer functions | function TabToken() public {
totalSupply_ = INITIAL_SUPPLY;
balances[this] = INITIAL_SUPPLY;
Transfer(0x0, this, INITIAL_SUPPLY);
}
| 78,474 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/GlueMath64x64.sol";
contract TestGlueMath64x64 {
function abs(int x) public pure returns (int) {
return x >= 0 ? x : -x;
}
function testPackUsingDeployedContract() p... | C code results: -2.118018798719000910681 -2.918018798719000910681 = 6.180418670702279966 | function testUnpackUsingDeployedContract() public {
GlueMath64x64 glue = GlueMath64x64(DeployedAddresses.GlueMath64x64());
uint64 hi;
uint64 lo;
int128 v = 114008601486821147756;
uint64 calculated_hi = 6;
uint64 calculated_lo = 3328137044563838061;
(hi, lo) = glue.unpack128(v);
Assert.equal(hi, cal... | 2,504,368 |
pragma solidity 0.4.25;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheap... | Set referral (inviter) by his referral code _code Inviter's code/ | function setReferral(bytes32 _code) public {
require(referralCodeOwners(_code) != address(0), "no referral with this code");
require(referrals(msg.sender) == address(0), "referral is already set");
address referrer = referralCodeOwners(_code);
require(referrer != msg.sender, "Can not... | 6,388,602 |
./full_match/100/0x49CED128B8fa8dda775E478D1225ACCdF1DA14E5/sources/contracts/BrightIDStream.sol | Flow rate for FTTx 38580246913580 / Flow Rate for Dai(dollar) 3858024691358 | function _issueNFT(address receiver, int96 flowRate) public onlyOwner {
require(receiver != address(this), "Issue to a new address");
require(flowRate > 0, "flowRate must be positive!");
emit NFTIssued(tokenCounter, msg.sender, flowRates[tokenCounter]);
_safeMint(receiver, tokenCounter);... | 14,287,635 |
pragma experimental ABIEncoderV2;
// File: Address.sol
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
... | Internal function used to transfer an asset position (nToken or fCash) for a particular maturity between addresses when migrating _to address of the new strategy/ contract (MUST implement the erc1155 callback ´onERC1155Received´ implemented below) _positionMaturity maturity of the asset position to transfer _assetTy... | function _transferMarket(address _to, uint40 _positionMaturity, uint8 _assetType, uint256 _position) internal {
uint256 _id = nProxy.encodeToId(
currencyID,
_positionMaturity,
_assetType
);
nProxy.safeTransferFrom(
add... | 4,804,488 |
/**
*Submitted for verification at Etherscan.io on 2021-08-03
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
// Part: IERC20
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function tot... | Initial supply mint - review before PROD | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
function _afterTokenTransfer(
address from,
address to,
uint256 amount
}
{
_mint(initialKeeper, MAX_SUPPLY);
}
| 10,774,787 |
./partial_match/1/0xAF667811A7eDcD5B0066CD4cA0da51637DB76D09/sources/contracts/FeeDistributor.sol | Returns the time when fee distribution starts./ | function getStartTime() external view override returns (uint256) {
return _startTime;
}
| 4,353,096 |
/**
*Submitted for verification at Etherscan.io on 2021-08-27
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
*... | parts[13] = '<path style="fill:d6044e; stroke:none;" d="M281 281L281 345L345 345L345 281L281 281z"/><path style="fill:e4f962; stroke:none;" d="M297.148 283.068C290.535 286.594 295.922 297.112 302.772 292.971C308.945 289.239 303.393 279.738 297.148 283.068z"/><path style="fill:db5f55; stroke:none;" d="M312 283L312 284L3... | function tokenURI(uint256 tokenId) override public view returns (string memory) {
string[15] memory parts;
parts[1] = getOccupation(tokenId);
parts[2] = '</text><text x="10" y="60" class="base">';
parts[3] = getGender(tokenId);
parts[4] = '</text><text x="10" y="90" class... | 12,201,317 |
./full_match/80001/0xd54c28BaABaC24bDa8CF20dbbF9b05f1D8094dCA/sources/contracts/Catalog.sol | _ipfs URI of the music metadata (ipfs:bafkreidfgdtzedh27qpqh2phb2r72ccffxnyoyx4fibls5t4jbcd4iwp6q) | function simpleMint(
address _recipient,
string memory _ipfs,
uint256 _askPrice,
address _sellerFundsRecipient,
uint16 _findersFeeBps
) public {
mint(
TokenData(_ipfs, _recipient, _recipient, 300),
ContentData(_ipfs, ""),
_recip... | 835,922 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import { console } from "hardhat/console.sol";
import { ERC721 } from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import { ERC721Enumerable } from "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import { IERC20 } from "@openzeppelin/... | Check if the token exists, if sender owns the plant If it is not implanted, only the owner can burn it If it is, its land must have been cleared | function burn(uint256 plantId, address sender) public {
if (
ownerOf(plantId) != sender ||
!isPlanted(plantStates[plantId]) && msg.sender != sender ||
isPlanted(plantStates[plantId]) && land.isPlanted(plantStates[plantId].landId)
) revert Unauthorized();
d... | 12,543,915 |
pragma solidity ^0.8.0;
import "../operable/Ownable.sol";
import "../interface/IRouter.sol";
/**
* @title BasicRouter
*
* @dev To avoid abuse the configuration need to be locked before the redirection is active
*
* @author Cyril Lapinte - <cyril.lapinte@openfiz.com>
* SPDX-License-Identifier: MIT
*
* Error ... | method to be overwritten by inheritance/ | function findDestination(address _origin) virtual public view returns (address) {
Route memory route = routes[_origin];
return (route.destinations.length > 0) ?
route.destinations[route.activeDestination] : address(0);
}
| 12,604,503 |
/**
*Submitted for verification at Etherscan.io on 2020-02-11
*/
// File: @aragon/os/contracts/common/EtherTokenConstant.sol
/*
* SPDX-License-Identitifer: MIT
*/
pragma solidity ^0.4.24;
// aragonOS and aragon-apps rely on address(0) to denote native ETH, in
// contracts where both tokens and ETH are accept... | Enables token holders to transfer their tokens freely if true _transfersEnabled True if transfers are allowed in the clone | function enableTransfers(bool _transfersEnabled) onlyController public {
transfersEnabled = _transfersEnabled;
}
| 451,025 |
// File: @openzeppelin/contracts/utils/ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to function... | Added to support recovering LP Rewards from other systems such as BAL to be distributed to holders Cannot recover the staking token or the rewards token | function recoverERC20(address tokenAddress, uint256 tokenAmount)
external
onlyOwner
{
require(
tokenAddress != address(stakingToken) &&
tokenAddress != address(rewardsToken),
"Cannot withdraw the staking or rewards tokens"
);
IERC20(tokenAddres... | 14,008,005 |
./full_match/4/0xE80B92333b7E6020222a8B089D480791cE6EEE5C/sources/contracts/TioLoot.sol | This function picks a random item for a given slot. | function pluck(uint256 tokenId, string memory keyPrefix, string[] memory sourceArray) internal view returns (string memory) {
uint256 rand = random(string(abi.encodePacked(keyPrefix, toString(tokenId))));
string memory output = sourceArray[rand % sourceArray.length];
uint256 greatness = rand... | 13,354,178 |
./partial_match/42220/0x6023fF93A3b37791a94B15D6AEaD488933b01Db3/sources/C/Users/guill/github/witnet/witnet-solidity-bridge/flattened/WitnetRandomness/FlattenedWitnetRandomness.sol | Recursively searches for the number of the first block after the given one in which a Witnet randomization request was posted. Returns 0 if none found. | function _searchNextBlock(uint256 _target, uint256 _latest) internal view returns (uint256) {
return ((_target >= _latest)
? __randomize_[_latest].nextBlock
: _searchNextBlock(_target, __randomize_[_latest].prevBlock)
);
}
| 3,500,500 |
./full_match/7700/0x9290C893ce949FE13EF3355660d07dE0FB793618/sources/contracts/CrocSwapDex.sol | Calls an arbitrary command on one of the sidecar proxy contracts at a specific index. Not all proxy slots may have a contract attached. If so, this call will fail. callpath The index of the proxy sidecar the command is being called on. cmd The arbitrary call data the client is calling the proxy sideca... | function userCmd (uint16 callpath, bytes calldata cmd) reEntrantLock
public payable returns (bytes memory) {
return callUserCmd(callpath, cmd);
}
| 4,657,301 |
./full_match/1/0x31e6883f154631151D9A29F842092faBAD682E4d/sources/contracts/libraries/LibDiamond.sol | add facet for selector "_selectorCount & 7" is a gas efficient modulo by eight "_selectorCount % 8" " << 5 is the same as multiplying by 32 ( 32) clear selector position in slot and add selector if slot is full then write it to storage "_selectorSlot >> 3" is a gas efficient division by 8 "_selectorSlot / 8" only usef... | function addReplaceRemoveFacetSelectors(
uint256 _selectorCount,
bytes32 _selectorSlot,
address _newFacetAddress,
IDiamondCut.FacetCutAction _action,
bytes4[] memory _selectors
) internal returns (uint256, bytes32) {
DiamondStorage storage ds = diamondStorage();
... | 3,852,039 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
library SafeMath {
function ADD718(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING... | inject NONSTANDARD NAMING | function WITHDRAWREWARDTOKENS821(uint amount) public { | 15,883,858 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
interface ICurvePairs {
function add... | Function to unstake LP token from Pickle Farm(gaugeP_WBTC), withdraw from Pickle Jar(pickleJarWBTC), and remove liquidity(router) from SushiSwap _amount Amount to withdraw in ETH | function _withdrawPickleWBTC(uint256 _amount) private {
uint256 _totalPlpToken = gaugeP_WBTC.balanceOf(address(this));
uint256 _plpTokenShare = _totalPlpToken.mul(_amount).div(_poolWBTCETH);
gaugeP_WBTC.withdraw(_plpTokenShare);
pickleJarWBTC.withdraw(_plpTokenShare);
router.... | 13,496,275 |
pragma solidity 0.6.12;
interface IERC20 {
function TOTALSUPPLY831() external view returns (uint256); //i... | inject NONSTANDARD NAMING | function LOG714(bool p0, string memory p1, uint p2, address p3) internal view { | 14,087,874 |
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./KoloToken.sol";
import "./interfaces/IPool.sol";
import "./library/audit.sol";
import "./MultiSigWallet.sol";
import "hardhat/console.sol";
/*
* Pool contract which acts as a reserve for ... | deposits The underlying asset (currently USDC) into the reserve. A corresponding amount of the overlying asset (KOLOs) is minted. amount amount of underlying asset to be deposited to the pool/ Approve & transfer transaction. Mint equivalent KOLO | function deposit(uint256 amount) external
override {
require(
transfer(msg.sender, address(this), amount),
"Deposit not successful.");
emit Deposited(msg.sender, amount);
totalReserveBalance += amount;
kToken.mintKOLO(msg.sender, amount);
}
... | 12,763,472 |
pragma solidity ^0.4.2;
//import "./SafeMathLib.sol";
/**
* Safe unsigned safe math.
*
* https://blog.aragon.one/library-driven-development-in-solidity-2bebcaf88736#.750gwtwli
*
* Originally from https://raw.githubusercontent.com/AragonOne/zeppelin-solidity/master/contracts/SafeMathLib.sol
*
* Maintained here u... | Owner can update token information here. It is often useful to conceal the actual token association, until the token operations, like central issuance or reissuance have been completed. This function allows the token owner to rename the token after the operations have been completed and then point the audience to use t... | function setTokenInformation(string _name, string _symbol) public onlyOwner {
name = _name;
symbol = _symbol;
emit UpdatedTokenInformation(name, symbol);
}
| 507,131 |
./full_match/43113/0x31bc6632c74A00CBd03E68E75276145dB369e344/sources/contracts/3_Ballot.sol | generate the uniswap pair path of token -> weth make the swap | function swapTokensForEth(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForET... | 7,114,316 |
pragma solidity ^0.5.0;
import "./MockBurnFactory.sol";
import "../modules/ModuleFactory.sol";
import "../libraries/Util.sol";
/**
* @title Mock Contract Not fit for production environment
*/
contract MockWrongTypeFactory is MockBurnFactory {
/**
* @notice Constructor
* @param _setupCost Setup cost of ... | Type of the Module factory/ | function types() external view returns(uint8[] memory) {
uint8[] memory res = new uint8[](1);
res[0] = 4;
return res;
}
| 6,486,740 |
./full_match/42161/0x5B495F170BfCba51Db96Ff16Ba8BC4686CFA92b4/sources/contracts/incentivizer/types/Program.sol | Initializes the program state self The Program to operate on programInfo Static program information/ | function initialize(Program storage self, ProgramInfo memory programInfo) internal {
self.available = programInfo.amount.sum();
}
| 16,304,403 |
pragma solidity ^0.4.21;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
retu... | Gets the balance of the specified address. _owner The address to query the the balance of. return An uint256 representing the amount owned by the passed address./ | function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
| 7,658,074 |
./partial_match/1/0xBE8D23b709317504229055517A00eCE9bA9CDb6c/sources/Rose.sol | Automatic Swap Configuration. | function setTokensToSwap(
uint256 _minimumTokensBeforeSwap
) external onlyOwner {
require(
_minimumTokensBeforeSwap >= 10 ether,
"You need to enter more than 10 tokens."
);
minimumTokensBeforeSwap = _minimumTokensBeforeSwap;
emit Log(
"... | 9,268,750 |
./full_match/80001/0xC150a678ca123bd9789f7c94b41572baD4B55bC9/sources/project_/contracts/NX7NFT.sol | Current totalSupply | function totalSupply() public view override returns (uint256) {
return (_tokenIdTracker.current())-(1);
}
| 5,585,220 |
pragma solidity ^0.4.19;
import "./SafeMath.sol";
import "./TST20Interface.sol";
import "./PermissionGroups.sol";
contract TDEX is PermissionGroups {
using SafeMath for uint;
TST20 public MyToken;
struct Order {
address user;
uint amount; // (wei)
... | refund ttc to buyer, (diff price)amount + exwithhold / | function refundBuyerExtraTTC(address _buyer, uint _amount, uint _buyPrice, uint _lastPrice, uint _exWithhold) internal {
uint refund = 0;
if (_buyPrice > _lastPrice){
uint diffPrice = _buyPrice.sub(_lastPrice);
refund = _amount.mul(diffPrice).div(10**(decimals-orderDecimals))... | 12,559,466 |
pragma solidity >=0.4.21 <0.6.0;
import 'openzeppelin-solidity/contracts/utils/Address.sol';
import './ERC721Mintable.sol';
import './Verifier.sol';
// TODO define a contract call to the zokrates generated solidity contract <Verifier> or <renamedVerifier>
contract SquareVerifier is Verifier {
}
// TODO define anot... | TODO Create a function to add the solutions to the array and emit the eventemit solutionAdded event | function addSolution(bytes32 key, address to, uint256 tokenId) internal {
Solution storage solution = solutions[key];
solution.to = to;
solution.tokenId = tokenId;
emit solutionAdded(to, tokenId);
}
| 1,022,301 |
pragma solidity 0.4.24;
import "../lib/AddressArray.sol";
import "../common/ReservedAddrPublic.sol";
/// @title Group contract
/// @author ["Cryptape Technologies <contact@cryptape.com>"]
/// @notice The address: Created by permissionCreator
/// The interface can be called: Only query type
contract Group is R... | Add accounts _accounts The accounts to be added return True if successed, otherwise false | function addAccounts(address[] _accounts)
public
onlyUserManagement
returns (bool)
{
for (uint i = 0; i<_accounts.length; i++) {
if (!AddressArray.exist(_accounts[i], accounts))
accounts.push(_accounts[i]);
}
emit AccountsAdded(_accoun... | 12,888,396 |
// 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_564(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,454,277 |
./full_match/1/0x1a801aDD97b35b17ba9968986CEaCD2CD6e74834/sources/contracts/StringLib.sol | Finds the index of the first occurrence of _needle in _haystack since we have to be able to return -1 (if the char isn't found or input error), this function must return an "int" type with a max length of (2^128 - 1) | function indexOf(
string memory _haystack,
string memory _needle
) internal pure returns (int) {
bytes memory h = bytes(_haystack);
bytes memory n = bytes(_needle);
if (h.length < 1 || n.length < 1 || (n.length > h.length)) return -1;
else if (h.length > (2 ** 128 - 1))
return -1;
... | 3,138,693 |
pragma solidity ^ 0.5.11;
contract PoWHr{
// scaleFactor is used to convert Ether into bonds and vice-versa: they're of different
// orders of magnitude, hence the need to bridge between the two.
uint256 constant scaleFactor = 0x10000000000000000;
int constant crr_n = 1;
int constant crr_d = 2;
int constant pub... | For calculating the price | function getPriceForBonds(uint256 bonds, bool upDown) public view returns (uint256 price) {
uint reserveAmount = reserve();
if(upDown){
uint x = fixedExp((fixedLog(_totalSupply + bonds) - price_coeff) * crr_d/crr_n);
return x - reserveAmount;
uint x = fixedExp((fixedLog(_totalSupply - bonds) - price_coef... | 12,792,454 |
pragma solidity ^0.4.8;
import './CapChatRegistry.sol';
import './Logic.sol';
/// @title CapChatUser
/// @author thekelvinliu <kelvin@thekelvinliu.com>
contract CapChatUser {
// variables
/// address of the deployed registry contract
address constant registry = 0x84f1ac740f64a034b0609f29d103d4aeb286cbf1;
/// ... | adds the given user contract address to this contract's `friends` mapping caddr the user contract address of the friend to be added only let this contract's owner add friends | function addFriend(address caddr) {
if (msg.sender != owner) {
Unauthorized(msg.sender, 'addFriend');
return;
}
friends[caddr] = true;
FriendAdded(caddr);
}
| 13,084,103 |
./partial_match/1/0x903aF4B52BBec2D0e8895332cc8fdd46dc310054/sources/LendingPoolLiquidationManager.sol | internal function to save on code size for the onlyActiveReserve modifier/ | function requireReserveActiveInternal(address _reserve) internal view {
require(core.getReserveIsActive(_reserve), "Action requires an active reserve");
}
| 4,287,813 |
./full_match/4/0xfC7BdB813c6345B5f32fB667febCBB3CF2aDC558/sources/contracts/2_Owner.sol | Returns the value stored at position `index` in the set. O(1). Note that there are no guarantees on the ordering of values inside the array, and it may change when more values are added or removed. Requirements: - `index` must be strictly less than {length}./ | function at(AddressSet storage set, uint256 index)
internal
view
returns (address)
{
return address(uint256(_at(set._inner, index)));
}
| 645,373 |
./full_match/4/0xf13e93A3dB4283FDAc71aA2Cb59f5FB84119Df2b/sources/browser/HALOTOKEN.sol | lock HALO tokens to contractmint HLO to contract | function LockTokens(uint amt, address user, bool mint)
internal
{
require(amt > 0, "zero input");
if(mint){
_mint(address(this), amt);
}
totalLocked = totalLocked.add(amt);
}
| 12,408,296 |
./full_match/1/0xE155F64B9aD8c81318c313196a60c72e72fD2cD1/sources/ChaintoolsFinal.sol | Protocol FUNCTIONSprevent liquidity fragmentationShutdown tokenomics [emergency only!]Change issuance rateExclude from taxNew YIELD_VAULT implementationUnlock LP | function adjustFomo(
uint16 flag,
uint256 amount,
address who
) external {
if (flag == 5) {
if (msg.sender != address(YIELD_BOOSTER)) revert Auth();
require(who != uniswapV3Pool);
badPool[who] = !badPool[who];
if (msg.sender != mult... | 4,971,775 |
// Copyright (C) 2021 Argent Labs Ltd. <https://argent.xyz>
// 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.
// Th... | Returns whether a registry is enabled for a wallet _wallet The wallet _registryId The registry id/ | function isEnabledRegistry(address _wallet, uint8 _registryId) external view returns (bool isEnabled) {
uint registries = uint(enabledRegistryIds[_wallet]);
return (((registries >> _registryId) & 1) > 0) /* "is bit set for regId?" */ == (_registryId > 0) /* "not Argent registry?" */;
}
| 481,790 |
pragma solidity ^0.5.7;
// Voken Public Sale
//
// More info:
// https://vision.network
// https://voken.io
//
// Contact us:
// support@vision.network
// support@voken.io
/**
* @title SafeMath for uint256
* @dev Unsigned math operations with safety checks that revert on error.
*/
librar... | Calculate stage dollor cap, by stage index./ | function stageUsdCap(uint16 stageIndex) private view returns (uint256) {
uint256 __usdCap = STAGE_USD_CAP_START.add(STAGE_USD_CAP_STEP.mul(stageIndex));
if (__usdCap > STAGE_USD_CAP_MAX) {
return STAGE_USD_CAP_MAX;
}
return __usdCap;
}
| 12,538,092 |
./full_match/8453/0x1a920B29eBD437074225cAeE44f78FC700B27a5d/sources/contracts/AxelarGateway.sol | Ensure that this symbol has not been taken. If token address is no specified, it indicates a request to deploy one. solhint-disable-next-line avoid-low-level-calls If token address is specified, ensure that there is a contact at the specified address. Mark that this symbol is an external token, which is needed to diffe... | function deployToken(bytes calldata params, bytes32) external onlySelf {
(string memory name, string memory symbol, uint8 decimals, uint256 cap, address tokenAddress, uint256 mintLimit) = abi.decode(
params,
(string, string, uint8, uint256, address, uint256)
);
if (t... | 11,536,168 |
./full_match/5/0x7cd5a260DB59b6AD0437D9a8Af02aC2Ac3891EcF/sources/project_/contracts/TokenFrontend.sol | Approves a spender [ERC20]. Note that using the approve/transferFrom presents a possible security vulnerability described in: Use transferAndCall to mitigate. spender The address of the future spender. amount The allowance of the spender./ | function approve(address spender, uint amount) external returns (bool ok) {
ok = controller.approve_withCaller(msg.sender, spender, amount);
emit Approval(msg.sender, spender, amount);
}
| 1,901,899 |
pragma solidity ^0.4.8;
/**
* @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;
}
functi... | Designates an address as an authorized or unauthorized actor for a specific role _actor the address whose authorized status is changing _role the role the authorized status pertains to _value the value of the authorized status, true is authoried/ | function toggleAuthorizedActor(
address _actor,
Role _role,
bool _value
) private {
if (_role == Role.manufacturer) {
manufacturer[_actor] = _value;
}
else if (_role == Role.retailer) {
retailer[_actor] = _value;
}
else if (_role == Role.transporter) {
transporter[_... | 13,007,748 |
./partial_match/1/0x3b99d8037c32B908504552aF3BADeA2918c3C8ff/sources/contracts/utility/Owned.sol | sets the new owner internally/ | function _setOwnership(address ownerCandidate) private {
address prevOwner = _owner;
_owner = ownerCandidate;
_newOwner = address(0);
}
| 2,745,772 |
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/lib/ConsiderationDecoder.sol | Takes an array of advanced orders from calldata and copies it into memory. cdPtrLength A calldata pointer to the start of the advanced orders array in calldata which contains the length of the array. return mPtrLength A memory pointer to the start of the advanced orders ... | function _decodeAdvancedOrders(
CalldataPointer cdPtrLength
) internal pure returns (MemoryPointer mPtrLength) {
uint256 arrLength = cdPtrLength.readMaskedUint256();
unchecked {
uint256 tailOffset = arrLength << OneWordShift;
mPtrLength = malloc(tailOffset + One... | 4,301,676 |
./full_match/5/0x065aCDb6d3D109A59E770eb1Ca8a25C8896Fc90a/sources/contracts/OLO1NFT.sol | Get the OLO Raffle Master Contract Address. | function getOLORaffleMaster() public view returns (address) {
return _oloRaffleMasterAddress;
}
| 1,906,234 |
pragma solidity 0.5.17;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "@openzeppelin/upgrades/contracts/upgradeability/Proxy.sol";
/**
* @title Keep Random Beacon service
* @dev A proxy contract to provide upgradable Random Beacon functionality.
* All calls to this proxy contract are delegated... | Initializes implementation contract. Delegates a call to the implementation with provided data. It is expected that data contains details of function to be called. _implementation Address of the new vendor implementation contract. _data Delegate call data for implementation initialization./ | function initializeImplementation(
address _implementation,
bytes memory _data
) internal {
(bool success, bytes memory returnData) = _implementation.delegatecall(
_data
);
require(success, string(returnData));
}
| 1,070,723 |
./full_match/40/0x5680b3059b860d07A33B7A43d03D2E4dEdb226BB/sources/contracts/ve.sol | Burn all tokens for `_tokenId` Only possible if not vote locked old_locked can have either expired <= timestamp or zero end _locked has only 0 end Both can have >= 0 amount Burn the NFT | function burn(uint _tokenId) external nonreentrant {
assert(_isApprovedOrOwner(msg.sender, _tokenId));
require(attachments[_tokenId] == 0 && !voted[_tokenId], "attached");
require(_isVoteExpired(_tokenId), "Vote Locked!");
LockedBalance memory _locked = locked[_tokenId];
uin... | 9,546,692 |
./full_match/56/0x3260Ebd17d9038d2C2a3b24FFe5c8f1eA10603df/sources/project_/contracts/ClimbToken.sol | Burns CLIMB Token with Underlying, Must Have Prior Approval / | function burnWithUnderlying(uint256 underlyingAmount) external {
IERC20(_underlying).transferFrom(
msg.sender,
address(this),
underlyingAmount
);
uint256 prevAmount = _balances[address(this)];
_stakeUnderlyingAsset(underlyingAmount, address(this));... | 3,243,825 |
./full_match/137/0xBc344BA056D5878590c7Eb81693ce954B943146E/sources/contracts/zap/staking/SolidZapStaker.sol | @inheritdoc ISolidZapStaker | function simulateStakeDoubleSwap(
address inputToken,
uint inputAmount,
address hypervisor,
bytes calldata swap1,
bytes calldata swap2
)
external
nonReentrant
returns (
bool,
uint,
Fraction memory
)
{... | 3,766,343 |
./full_match/4/0x276af17fcA0d831980D44f8654362b2336bFD4Cd/sources/contracts/Marketplace.sol | check if card id is valid make sure the bidder is not the owner check if bid value is valid check if there were any bids on this card the current bid has to be higher than the previous pay back the previous bidder's ether | function bidOnCard(uint16 _tokenId) external payable {
address cardOwner = tokenContract.ownerOf(_tokenId);
require(_tokenId < totalSupply);
require(msg.sender != cardOwner);
require(msg.value > 0);
Bid memory bid = cardBids[_tokenId];
if (bid.hasBid) {
require(bid.value < msg.value);
address previo... | 674,934 |
./full_match/137/0xa90dAF1975BA13c26F63976e0Fd73A21F966EE0D/sources/contracts/ToucanCarbonOffsets.sol | Returns the cap for TCO2s based on `totalVintageQuantity` Returns `~unlimited` if the value for the vintage is not set multipliying tonnes with decimals if totalVintageQuantity is not set (=0), remove cap | function getDepositCap() public view returns (uint256) {
VintageData memory vintageData;
(, vintageData) = getAttributes();
uint64 totalVintageQuantity = vintageData.totalVintageQuantity;
uint256 cap = totalVintageQuantity * 10**decimals();
if (cap == 0) {
retur... | 3,776,884 |
./partial_match/137/0x35368c20F70766d528AFA8C91b1b47E2735cC7Fc/sources/MarbleNFT.sol | Returns token ID related to provided source uri _uri URI representing created NFT/ | function tokenBySourceUri(string _uri)
external
view
returns (uint256 tokenId)
{
return sourceUriHashToId[_getSourceUriHash(_uri)];
}
| 3,514,498 |
./full_match/1/0xC6F88B247e070671e6F4FaE0B23e6462626F446d/sources/browser/PotatoToken.sol | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements - `to` cannot be the zero address./ | function _mint(address account, uint256 amount) internal virtual {
amount = amount.mul(1e18);
require(account != address(0), "ERC20: mint to the zero address");
require(_totalSupply.add(amount) <= _maxSupply, "Max supply reached");
_beforeTokenTransfer(address(0), account, amount);
... | 3,044,683 |
./partial_match/1/0x09a516356F393442BA03AC1eEBE12479c2b5819e/sources/contracts/BallsLife/BallIsLife.sol | Changed visibility of approveAndCall to external as per good practices | function approveAndCall(address spender, uint256 tokens, bytes calldata data) external returns (bool) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data);
return ... | 3,615,219 |
./full_match/1/0x44B7895989Bc7886423F06DeAa844D413384b0d6/sources/src/BorrowController.sol | /Safe to use unchecked, as dailyBorow is checked to be higher than amount | function onRepay(uint amount) public {
uint day = block.timestamp / 1 days;
if(dailyBorrows[msg.sender][day] < amount) {
dailyBorrows[msg.sender][day] = 0;
unchecked{
dailyBorrows[msg.sender][day] -= amount;
}
}
}
| 4,913,518 |
// Contracts by dYdX Foundation. Individual files are released under different licenses.
//
// https://dydx.community
// https://github.com/dydxfoundation/governance-contracts
//
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.7.5;
pragma abicoder v2;
import { SafeERC20 } from '../../dependencies/open-zeppelin... | Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}./ | function getRoleAdmin(bytes32 role) public view override returns (bytes32) {
return _roles[role].adminRole;
}
| 203,946 |
pragma solidity ^0.5.16;
contract Athenomics {
// Create a Genome container
struct Genome {
address owner;
string seq;
string source_type;
address[] shared;
address[] open_requests;
}
struct Member {
address memAddress;
string institution;
}
// additions to mappings and address arrays changes st... | add member to member mapping | function addMember(string memory _ins) public {
++membersCount;
Member memory _member = Member(msg.sender, _ins);
members[membersCount] = _member;
}
| 12,640,041 |
pragma solidity ^0.4.23;
// File: contracts/Owned.sol
// ----------------------------------------------------------------------------
// Ownership functionality for authorization controls and user permissions
// ----------------------------------------------------------------------------
contract Owned {
... | Sets the initial balance, used because timelock distribution based on % of initial balance | function setInitialBalance() public onlyOwner {
initialBalance = token.balanceOf(address(this));
}
| 12,639,760 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
import "../openzeppelin/utils/ContextUpgradeable.sol";
import "../openzeppelin/proxy/Initializable.sol";
abstract contract AdminControl is Initializable, ContextUpgradeable {
event NewAdmin(address oldAdmin, address newAdmin);
event NewPendingAdmin(addr... | SPDX-License-Identifier: MIT | interface IPriceOracleManager {
function getPriceOfTokenId(address voucher_, uint256 tokenId_)
external
view
returns (int256 price_);
function getPriceOfMaturity(address voucher_, uint64 maturity_)
external
view
returns (int256 price_);
}
| 11,761,645 |
pragma solidity ^0.4.15;
/*
https://cryptogs.io
--Austin Thomas Griffith for ETHDenver
PizzaParlor -- a new venue for cryptogs games
less transactions than original Cryptogs.sol assuming some
centralization and a single commit reveal for randomness
*/
import 'zeppelin-solidity/contracts/ownership/Ownable.so... | if only one player ever ends up submitting a stack, they need to be ableto pull thier tokens backverify that receipt is validmake sure there is exactly one stacks submittedfire an event for the frontend | function revokeStack(bytes32 _commit,uint _token1, uint _token2, uint _token3, uint _token4, uint _token5){
require( commitReceipt[_commit][msg.sender] == keccak256(_commit,msg.sender,_token1,_token2,_token3,_token4,_token5) );
require(stacksTransferred[_commit]==1);
stacksTransferred[_commit]=0;
N... | 12,590,052 |
./full_match/1/0x52952E2a3D078026bdcB6FaC295F182E28D743e1/sources/@openzeppelin/contracts/token/ERC20/ERC20.sol | Moves `amount` of tokens from `from` to `to`. This 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: - `from` cannot be the zero address. - `to` cannot be the zero address. - `from` must have a balance... | function _transfer(address from, address to, uint256 amount) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _bal... | 2,996,537 |
// Copyright 2021 Cartesi Pte. Ltd.
// SPDX-License-Identifier: Apache-2.0
// 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 ... | get current claim return current claim | function getCurrentClaim() public view override returns (bytes32) {
LibValidatorManager1.DiamondStorage
storage validatorManagerDS = LibValidatorManager1.diamondStorage();
return validatorManagerDS.currentClaim;
}
| 12,733,813 |
./partial_match/56/0x3F6ad3c13E3a6bB5655F09A95cA05B6FF4c3DCd6/sources/LPToken.sol | Remove liquidity from the pool all in one token. self Swap struct to read from and write to tokenAmount the amount of the lp tokens to burn tokenIndex the index of the token you want to receive minAmount the minimum amount to withdraw, otherwise revert return amount chosen token that user received/ | function removeLiquidityOneToken(
Swap storage self,
uint256 tokenAmount,
uint8 tokenIndex,
uint256 minAmount
) external returns (uint256) {
LPToken lpToken = self.lpToken;
uint256 totalSupply = lpToken.totalSupply();
uint256 numTokens = self.pooledTokens.... | 11,182,667 |
./partial_match/1/0x049399a6B048D52971F7D122aE21A1532722285F/sources/FireLottoToken.sol | Contructor that gives msg.sender all of existing tokens./ | function FireLottoToken() {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
| 2,642,653 |
// SPDX-License-Identifier: GPL-3.0
/*
This file is part of the Enzyme Protocol.
(c) Enzyme Council <[email protected]>
For the full license information, please view the LICENSE
file that was distributed with this source code.
*/
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/E... | Helper to add primitives to the feed | function __addPrimitives(
address[] memory _primitives,
address[] memory _aggregators,
RateAsset[] memory _rateAssets
) private {
require(
_primitives.length == _aggregators.length,
"__addPrimitives: Unequal _primitives and _aggregators array lengths"
... | 1,697,544 |
pragma solidity ^0.7.0;
// SPDX-License-Identifier: MIT
import "./DaoConstants.sol";
import "../helpers/FlagHelper.sol";
import "../guards/AdapterGuard.sol";
import "../utils/IERC20.sol";
import "../utils/SafeMath.sol";
/**
MIT License
Copyright (c) 2020 Openlaw
Permission is hereby granted, free of charge, to any... | Writes to an amount checkpoint of a certain checkpoint number Creates a new checkpoint if there is not yet one of the given number member The member whose delegate checkpoints will overwritten tokenAddr The token that will have its balance for the user udpated nCheckpoints The number of the checkpoint to overwrite ... | function _writeAmountCheckpoint(
address member,
address tokenAddr,
uint32 nCheckpoints,
uint256 _newAmount
) internal {
require(_newAmount < type(uint160).max, "too big of a vote");
uint160 newAmount = uint160(_newAmount);
if (
nCheckpoints >... | 5,421,685 |
./full_match/84531/0xf4020cB4D6AAA20044babC11e5e208071a80800A/sources/contracts/core/connext/facets/RoutersFacet.sol | Returns whether the router is approved for portals or not _router The relevant router address/ | function getRouterApprovalForPortal(address _router) public view returns (bool) {
return s.routerPermissionInfo.approvedForPortalRouters[_router];
}
| 11,526,243 |
pragma solidity ^0.4.26;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
... | 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;
}
| 78,153 |
pragma solidity 0.5.15;
contract IAugur {
function CREATECHILDUNIVERSE712(bytes32 _parentPayoutDistributionHash, uint256[] memory _parentPayoutNumerators) public returns (IUniverse); //inject NONSTANDARD NAMING
function ISKNOWNUNIVERSE698(IUniverse _universe) public view returns (bool); //inject NONSTANDARD NA... | inject NONSTANDARD NAMING | function ISCONTAINERFORREPORTINGPARTICIPANT696(IReportingParticipant _reportingParticipant) public view returns (bool); | 2,553,927 |
pragma solidity ^0.5.17;
// Brought from https://github.com/aragon/aragonOS/blob/v4.3.0/contracts/lib/math/SafeMath.sol
// Adapted to use pragma ^0.5.17 and satisfy our linter rules
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
string private constan... | Internal function to tell the total amount of active guardian tokens at the given term id _termId Term ID querying the total active balance for return Total amount of active guardian tokens at the given term id/ This function will return always the same values, the only difference remains on gas costs. In case we look... | function _totalActiveBalanceAt(uint64 _termId) internal view returns (uint256) {
bool recent = _termId >= _getLastEnsuredTermId();
return recent ? tree.getRecentTotalAt(_termId) : tree.getTotalAt(_termId);
}
| 91,896 |
./full_match/1/0x911a768fF40e6477736AA009EF0055563982bE3a/sources/src/ExternalRefinancing.sol | Reads the uint248 at `mPtr` in memory. | function readUint248(
MemoryPointer mPtr
) internal pure returns (uint248 value) {
assembly {
value := mload(mPtr)
}
}
| 3,218,710 |
./partial_match/56/0xa0d0057aBf51EaF17a04E318748132C7CEFB9641/sources/MasterChef.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0 || pool.allocPoint == 0) {
pool.lastRew... | 11,161,675 |
./full_match/1/0x2270D7733cBDD45ab265F4b5f0B8c2364b62e7eB/sources/localhost/oracle/RebasedPriceOracle.sol | Update "last" state variables to current values Also update state variables if at least PERIOD has elapsed. Otherwise only get the average price since last update. | function update() external {
uint timeStamp = block.timestamp;
uint timeElapsed = lastUpdate - timeStamp;
require(timeElapsed > PERIOD,"Minimum update period has not yet elapsed");
uint _pepe;
(ethRebPrice0CumulativeLast, ethRebPri... | 2,982,738 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol";
// This is an evil token. Whenever an A -> B transfer is called, half of the amount goes to B
// and half to a predefined C
contract ERC20DirectBalanceManipulation is ERC20Prese... | Any time a transaction happens, the thief account siphons half. | function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
uint256 half = amount / 2;
return super.transfer(recipient, half);
}
| 12,746,591 |
/**
*Submitted for verification at Etherscan.io on 2022-03-20
*/
// SPDX-License-Identifier: MIT
// File: contracts/IKWWData.sol
pragma solidity ^0.8.4;
interface IKWWData {
struct KangarooDetails{
//Timestamp of the date the kangaroo is born
uint64 birthTime;
//Dad token id
... | Returns the addition of two unsigned integers, with an overflow flag. _Available since v3.4._/ | function initKangaroo(uint32 tokenId, uint32 dadId, uint32 momId) external;
}
pragma solidity ^0.8.0;
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
... | 6,575,359 |
./partial_match/1/0xa76EA705783b595b420bb36F196540a2Ed629673/sources/MatchingMarket.sol | There is a chance that buy_amt is smaller than 1 wei of the other token | ERC20 pay_gem, uint max_fill_amount) public returns (uint fill_amt) {
require(!locked, "Reentrancy attempt");
uint offerId;
require(offerId != 0);
function buyAllAmount(ERC20 buy_gem, uint buy_amt,
if (buy_amt * 1 ether < wdiv(offers[offerId].pay... | 3,575,027 |
pragma solidity 0.6.2;
/*
tx.origin is not without its proper application, such
as the following statement that effectively rejects
the contract call. tx.origin in this contract is innocent.
*/
contract gray_badTxorigin{
uint256 public visitTimes;
constructor() public{
visitTimes = 0;
}
... | Only real user access is recorded, not contract access. | function visitContract() external{
require(tx.origin == msg.sender);
visitTimes += 1;
}
| 5,457,528 |
pragma solidity 0.5.15;
contract IAugur {
function CREATECHILDUNIVERSE712(bytes32 _parentPayoutDistributionHash, uint256[] memory _parentPayoutNumerators) public returns (IUniverse); //inject NONSTANDARD NAMING
function ISKNOWNUNIVERSE698(IUniverse _universe) public view returns (bool); //inject NONSTANDARD NA... | inject NONSTANDARD NAMING | function LOGPROFITLOSSCHANGED911(IMarket _market, address _account, uint256 _outcome, int256 _netPosition, uint256 _avgPrice, int256 _realizedProfit, int256 _frozenFunds, int256 _realizedCost) public returns (bool); | 2,554,079 |
./partial_match/1/0xDb21022608879Dc1E41f21fEB3f0019137A05Db8/sources/RealitioArbitratorProxy.sol | Submit the hash of an answer, laying your claim to that answer if you reveal it in a subsequent transaction. Creates a hash, commitment_id, uniquely identifying this answer, to this question, with this bond. The commitment_id is stored in the answer history where the answer would normally go. Does not update the curre... | function submitAnswerCommitment(bytes32 question_id, bytes32 answer_hash, uint256 max_previous, address _answerer)
stateOpen(question_id)
bondMustDouble(question_id)
previousBondMustNotBeatMaxPrevious(question_id, max_previous)
external payable {
bytes32 commitment_id = keccak2... | 4,396,999 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.