file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity ^0.6.0;
import "./interfaces/IERC20.sol";
import "./VRFConsumerBase.sol";
import "@openzeppelin/contracts/utils/Address.sol";
// import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
cont... | require( msg.sender == adminAddress, "Starting the Lottery requires Admin Access" ); | function pauseNextLottery() public onlyOwner {
pauseLottery = true;
emit LotteryPaused();
}
| 12,624,495 |
./full_match/1/0x5A01592A2a4acfE2949f766EF67F4f7d04bE4ac0/sources/contracts/core/prize-pool/PrizePool.sol | Calculates a number of seconds for which the user has to pay the exit fee. If Lido's rebase operatio didn't happen yet, calculates the seconds difference between contract's deployment timestamp and user's current withdraw timestamp. If at least one Lido's rebase operation took place, calculates the ... | function _getSecondsNumberToPayExitFee(
uint32 _withdrawTimestamp
) private view returns (uint32) {
uint32 _firstLidoRebaseTimestamp = firstLidoRebaseTimestamp;
if (_withdrawTimestamp < _firstLidoRebaseTimestamp) {
return _withdrawTimestamp - deploymentTimestamp;
... | 9,746,647 |
pragma solidity ^0.5.0;
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/utils/Address.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contr... | sub removes specified amount of tokens from given account and updates the total balance references. update the balance of the account update the total | function sub(address _account, address _token, uint256 _amount) public onlyMinter {
balance[_account][_token] = balance[_account][_token].sub(_amount);
totalBalance[_token] = totalBalance[_token].sub(_amount);
}
| 12,676,129 |
./full_match/44787/0x7Ee4006e2bDD272938ba2B867E7d85C9f9d3a3f8/sources/project_/contracts/CASRegistryManager.sol | transfer tokens to another user holderInput ( holderAddress: bytes(address), bundleId: bytes(string), bundleVolume: bytes(int), unitType: bytes(string), metadataUrl: bytes(string), projectAddress: bytes(address) ) holderOutput ( holderAddress: bytes(address), outputBundleId: bytes(stri... | function transferFrom(bytes[] calldata holderInput, bytes[] calldata holderOutput) external checkAccess {
tokensOfTheSameType(holderInput[3], holderOutput[3]);
sameAmount(holderInput[2], holderOutput[2]);
sameProjectAddress(holderInput[5], holderOutput[5]);
IBundle(holderContractAddr... | 13,282,111 |
./full_match/7700/0x9B2a63F27661A468E2da22226b64A4914144f195/sources/contracts/mixins/TickCensus.sol | Same logic as seekLobbyUp(), but the inverse direction. / Unchecked because we want idx to wrap around to 255, to check all 256 bits | function seekLobbyDown (bytes32 poolIdx, uint8 lobbyBit)
private view returns (int24) {
uint8 MIN_MEZZ = 255;
unchecked {
for (uint8 i = lobbyBit - 1; i < 255; --i) {
(int24 tick, bool spills) = seekAtMezz(poolIdx, i, MIN_MEZZ, false);
}
}
... | 4,651,081 |
pragma solidity ^0.4.11;
import "github.com/Arachnid/solidity-stringutils/strings.sol";
/**
* Manage & Preserve eBook ownership via Ethereum smart contract to widen, utilize eBook market.
*
* TODO: Separate into multiple contracts
* TODO: Add ownership transfer function
* TODO: Manage list of published eBooks wi... | Validate ownership of the eBook by it's ISBN customer Address of the customer isbn ISBN number of the eBook/ | function validateOwnership(address customer, uint isbn) constant internal returns (bool) {
validateIsbn(isbn);
return customers[customer].books[isbn].exists;
}
| 7,243,535 |
./full_match/1/0xc2731fb2823af3Efc2694c9bC86F444d5c5bb4Dc/sources/@keep-network/sortition-pools/contracts/SortitionTree.sol | Gets the operator addresses corresponding to the given ID numbers. A zero address means the ID number has not been allocated yet. This function works just like getIDOperator except that it allows to fetch operator addresses for multiple IDs in one call. ids the array of the operator ids return an array of the associat... | function getIDOperators(uint32[] calldata ids)
public
view
returns (address[] memory)
{
uint256 idCount = idAddress.length;
address[] memory operators = new address[](ids.length);
for (uint256 i = 0; i < ids.length; i++) {
uint32 id = ids[i];
operators[i] = idCount > id ? idAddr... | 2,973,634 |
./full_match/80001/0x3F2b72B9D52651B4dcdB99d1AB1736aC889e6e38/sources/contracts/mixins/MixinLockMetadata.sol | A distinct Uniform Resource Identifier (URI) for a given asset. _tokenId The iD of the token for which we want to retrieve the URI. If 0 is passed here, we just return the appropriate baseTokenURI. If a custom URI has been set we don't return the lock address. It may be included in the custom baseTokenURI if needed. ... | function tokenURI(
uint256 _tokenId
) external
view
returns(string memory)
{
string memory URI;
string memory tokenId;
string memory lockAddress = address(this).address2Str();
string memory seperator;
if(_tokenId != 0) {
tokenId = _tokenId.uint2Str();
tokenId = '';
... | 9,486,875 |
./full_match/1/0x249846ee9acfdCd7685EC7fd7AB02d536d343e3D/sources/contracts/dao/logic/GnarsDAOLogicV2.sol | returns the dynamic quorum parameters values at a certain block number The checkpoints array must not be empty, and the block number must be higher than or equal to the block of the first checkpoint blockNumber_ the block number to get the params at return The dynamic quorum parameters that were set at the given ... | function getDynamicQuorumParamsAt(uint256 blockNumber_) public view returns (DynamicQuorumParams memory) {
uint32 blockNumber = safe32(blockNumber_, 'GnarsDAO::getDynamicQuorumParamsAt: block number exceeds 32 bits');
uint256 len = quorumParamsCheckpoints.length;
if (len == 0) {
... | 9,673,293 |
/**
*Submitted for verification at Etherscan.io on 2021-02-24
*/
// Sources flattened with hardhat v2.0.10 https://hardhat.org
// File @openzeppelin/contracts/utils/[email protected]
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context... | Transfer tokens to a specified address. to The address to transfer to. value The amount to be transferred. return True on success, false otherwise./ | function transfer(address to, uint256 value) external override validRecipient(to) whenNotPaused returns (bool) {
require(!isBlacklisted[msg.sender], "from blacklisted");
require(!isBlacklisted[to], "to blacklisted");
uint256 shareValue = value.mul(_sharesPerToken);
_shareBalances[ms... | 10,898,142 |
// File: localhost/utils/Address.sol
pragma solidity ^0.6.0;
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a... | draw debt Send back money to repay FL | function open(
address _cCollAddr,
address _cBorrowAddr,
uint _collAmount,
uint _debtAmount
) public {
address collAddr = getUnderlyingAddr(_cCollAddr);
address borrowAddr = getUnderlyingAddr(_cBorrowAddr);
depositCompound(collAddr, _cCollAddr, _collAmou... | 6,075,053 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.10;
import "./types/NoteKeeper.sol";
import "./libraries/SafeERC20.sol";
import "./interfaces/IERC20Metadata.sol";
import "./interfaces/IBondDepository.sol";
/// @title Olympus Bond Depository V2
/// @author Zeus, Indigo
/// Review by: JeffX
contra... | up to date control variable accounts for control variable adjustment _id ID of market return control variable for market in OHM decimals/ | function currentControlVariable(uint256 _id) public view returns (uint256) {
(uint64 decay, , ) = _controlDecay(_id);
return terms[_id].controlVariable - decay;
}
| 12,969,457 |
./partial_match/1/0x2AF772E90398B6Eca5bfb4c36d20bEAb71979938/sources/src/SteamerBuffer.sol | @inheritdoc ISteamerBuffer | function setFlowRate(address underlyingToken, uint256 _flowRate) external override onlyAdmin {
_exchange(underlyingToken);
flowRate[underlyingToken] = _flowRate;
emit SetFlowRate(underlyingToken, _flowRate);
}
| 2,685,915 |
/**
*Submitted for verification at Etherscan.io on 2021-08-31
*/
// 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
*... | get 3 highest dice rolls | function pluck(uint256 tokenId, string memory keyPrefix, uint multiplier) internal pure returns (string memory) {
uint256 roll1 = random(string(abi.encodePacked(keyPrefix, toString(tokenId), "1")));
uint256 min = roll1;
uint256 roll2 = random(string(abi.encodePacked(keyPrefix, toString(token... | 10,429,061 |
./full_match/1/0x266BFfc052a5F02d4797A3DD99C3455Ac9D49eb6/sources/contracts/MTGYTrustedTimestamping.sol | Process transaction and store hash in blockchain/ | function storeHash(
bytes32 dataHash,
string memory fileName,
uint256 fileSizeBytes
) public {
_token.transferFrom(msg.sender, address(this), mtgyServiceCost);
_token.approve(spendAddress, mtgyServiceCost);
_spend.spendOnProduct(mtgyServiceCost);
uint256 theTimeNow = block.timestamp;
... | 8,430,233 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// pargma experimental ABIEncoderV2 no longer necessary from solidity 0.8.0
// LEARNING:
// - DAO Investment concept
// - Integration of Uniswap as DEX to trade on
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol";
import "@uniswap/v3-periphery... | 5. Sell token depending on predicted price development Check if price predicted in future x hours < (last buy - tuner) | function sellToken(uint _assetId, /*uint currentPrice,*/ uint predPrice, uint tuner) external onlyOwner() {
require(currentState == State.TRADING, "Tradingbot must be started first");
require(getTokenBalance(assets[_assetId].tokenAddress) > 0, "No token available");
if(predPrice < (assets[_assetId].lastP... | 13,133,897 |
// Credit: https://github.com/alex-miller-0/eth-dev-101/blob/master/truffle/contracts/TokenChannelsV2.sol
/**
* Version two of the TokenChannels contract
* Adds nonces to the messages as well as the notion of a challenge period.
* Either party may challenge the closing channel if they have a message with
* a higher... | Returns true if the channel is closed (or if the channel doesn't exist) | function IsChannelClosed(bytes32 id) public constant returns (bool) {
return channels[id].closeTime != 0;
}
| 892,085 |
pragma solidity ^0.5.8;
/// @title ERC20 Token Interface
/// @author Hoard Team
/// @notice See https://github.com/ethereum/EIPs/issues/20
contract ERC20Token {
// PUBLIC INTERFACE
// /// @dev Returns total amount of tokens
// /// @notice params -> (uint256 totalSupply)
// It's implamented as a vari... | ExtendedStandardToken is StandardToken | function transferFrom (address _from, address _to, uint256 _value) public
returns (bool)
{
return super.transferFrom(_from, _to, _value);
}
| 6,447,314 |
//Before life even began, before even the cosmos took shape, there was Light ... and Void. In the form of a boundless prismatic sea, the Light swelled across all existence. The ocean of Light was dynamic and ever shifting. Yet as it expanded, some of its energies faded and dimmed, leaving behind pockets of cold nothing... | Withdraws the ether distributed to the sender. It emits a `DividendWithdrawn` event if the amount of withdrawn ether is greater than 0. | function withdrawDividend(address _rewardToken) external virtual override {
_withdrawDividendOfUser(payable(msg.sender), _rewardToken);
}
| 2,072,941 |
pragma solidity ^0.5.8;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOw... | Retrieves a list of darknodes which were registered for the previous epoch. See `getDarknodes` for the parameter documentation. | function getPreviousDarknodes(address _start, uint256 _count) external view returns (address[] memory) {
uint256 count = _count;
if (count == 0) {
count = numDarknodesPreviousEpoch;
}
return getDarknodesFromEpochs(_start, count, true);
}
| 6,360,635 |
./full_match/43113/0x0fF356982E0aa01eac04A42a2e7E60a6216c3ED8/sources/PUMPKINS/Farm_vault.sol | Farm_Vault Interface.Farm Vault ABI | interface Farm_Vault{
function sendfarm() external returns(bool);
event Sendfarm();
}
| 13,148,676 |
pragma solidity ^0.4.24;
/*
@title Provides support and utilities for contract ownership
*/
contract Ownable {
address public owner;
address public newOwnerCandidate;
event OwnerUpdate(address prevOwner, address newOwner);
/*
@dev constructor
*/
constructor() public {
owner = m... | Revoke the grant of tokens of a specifed address. _holder The address which will have its tokens revoked. Revoke the remaining VCN. Remove the grant. | function revoke(address _holder) public ownerOnly {
Grant storage grant = grants[_holder];
require(grant.revokable);
uint256 refund = grant.value.sub(grant.transferred);
delete grants[_holder];
totalVesting = totalVesting.sub(refund);
emit RevokeGrant(_holder, re... | 6,476,296 |
./full_match/1/0xb8318F9d48ba890f867b3699bcFA22d795FA19D0/sources/contracts/Livestreambets.sol | Check that the amount is available to claim. Revert if unsuccessful. | function withdrawRake(
uint256 amount_
) public onlyAdminOrBalanceManager nonReentrant {
if (amount_ > claimableRakeAmount()) {
revert InvalidAmount();
}
if (!success) {
revert WithdrawalFailed();
}
}
| 9,766,233 |
pragma solidity >=0.6 <0.9.0;
//SPDX-License-Identifier: MIT
import "@chainlink/contracts/src/v0.6/ChainlinkClient.sol";
import "@aave/protocol-v2/contracts/misc/interfaces/IWETHGateway.sol";
import "@aave/protocol-v2/contracts/interfaces/IAToken.sol";
import "hardhat/console.sol";
contract YourContract is ChainlinkC... | Stake ETH and deposit into Aave to get back aWETH/ | function stake()
public
payable {
require(msg.value > 0, "Staking amount must be higher than 0");
stakers[msg.sender] = true;
stakerReg.push(msg.sender);
balances[msg.sender] += aWETH.balanceOf(address(this)) - lastAWETHBalance;
}
| 12,673,404 |
./full_match/43114/0x594D5519c2BCBFd5D21aa9FA6755312caA31CFd4/sources/contracts/liquid-yield/LyRebalancer.sol | / Internally pull sAVAX out of liquidity pool | function _withdrawSAvaxFromLp(uint256 amount) internal {
(uint256 sAvaxRes, , ) = pair.getReserves();
uint256 supply = pair.totalSupply();
uint256 burnAmount = 100 + (supply * amount) / sAvaxRes;
_burnLpt(burnAmount);
}
| 4,513,075 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "./interfaces/ILenderPool.sol";
import "./interfaces/IUniswapV2Router.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
///... | Withdraw the initial deposit of the specified lender for the specified roundId claim rewards of the specified roundId for the specific lender only `Owner` can withdraw round must be finish (`block.timestamp` must be higher than `round.endPeriod`) run `_claimRewards` and `_withdraw` lender, address of the lender r... | function withdraw(
address lender,
uint roundId,
uint amountOutMin
) public onlyOwner {
Round memory round = _lenderRounds[lender][roundId];
require(
block.timestamp >= round.endPeriod,
"Round is not finished yet"
);
uint amountLent... | 1,781,369 |
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
pragma solidity ^0.5.2;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address ... | OVERRIDE Transfer tokens between two accounts while enforcing the update of Snapshots from The address to transfer from to The address to transfer to value The amount to be transferred/ | function _transfer(address from, address to, uint256 value) internal {
_createAccountSnapshot(from, balanceOf(from));
_createAccountSnapshot(to, balanceOf(to));
}
| 5,444,807 |
pragma solidity 0.5.14;
contract SwapProxyInterface {
function NAME553() public view returns(string memory); //inject NONSTANDARD NAMING
function GETSWAPQUANTITY3(address src, address dst, uint256 srcQty) public view returns(uint256); //inject ... | inject NONSTANDARD NAMING | function BALANCEOF790(address account) external view returns (uint256); | 14,035,977 |
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.3;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/... | enumSet.add(uint(Type1.MARKET)); trade pairs are added without MARKET orders tradePairMap[_tradePairId].addOrderPaused = false; addOrder is not paused by default (EVM initializes to false) tradePairMap[_tradePairId].pairPaused = false; pair is not paused by default (EVM initializes to false) | function addTradePair(bytes32 _tradePairId,
bytes32 _baseSymbol, uint8 _baseDecimals, uint8 _baseDisplayDecimals,
bytes32 _quoteSymbol, uint8 _quoteDecimals, uint8 _quoteDisplayDecimals,
uint _minTradeAmount, uint _maxTradeAmount, Auctio... | 6,436,955 |
./full_match/11155111/0x35bA9372EE2fb8d96c572D82d86946fbF0F6E204/sources/contracts/Contract.sol | Validate referrer token Lookup referrer address Ensure that the referrer doesn't already have the maximum number of referrals Initialize uplinesHierarchy if it hasn't been created yet | function _addReferral(address referee, uint256 referrerToken, uint256 tokenId) internal {
require(referrers[referrerToken] != address(0), "Invalid referrer token");
address referrer = referrers[referrerToken];
require(users[referrer].referrals.length < MAX_REFERRALS, "Referrer alre... | 3,801,119 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Pausable.sol";
import "@openzeppelin/contracts/utils/Context.sol... | Buys a martian for a specific price (payable) The martian must be for sale before other user calls this method. If the same user had the higher bid before, it gets refunded into the pending withdrawals. On success, emits the MartianBought event. Executes a ERC721 safeTransferFrom tokenId The id of the martian to be b... | function buyMartian(uint tokenId) external payable {
require(msg.sender != nonFungibleContract.ownerOf(tokenId), "You cant buy your own martian");
Offer memory offer = martianIdToOfferForSale[tokenId];
require(offer.isForSale, "Item is not for sale");
require(offer.seller ==... | 10,138,498 |
./full_match/80001/0xc6Cd863A78D2137E0c5a881FD6920c36AE959eC3/sources/contracts/DJcomm.sol | Check for duplicate keys Update the mapping | function bulkUpdateMapping(
uint256[] calldata keys,
uint256[] calldata to,
uint256[] calldata timestamps
) public {
require(
keys.length == to.length &&
keys.length == timestamps.length,
"Invalid input lengths"
);
uint256[... | 9,533,472 |
pragma ton-solidity >=0.47.0;
pragma AbiHeader expire;
pragma AbiHeader time;
pragma AbiHeader pubkey;
import "https://raw.githubusercontent.com/tonlabs/debots/main/Debot.sol";
import "https://raw.githubusercontent.com/tonlabs/DeBot-IS-consortium/main/Terminal/Terminal.sol";
import "https://raw.githubusercontent.com/to... | Json.deserialize(0,''); | function start() public override {
UserInfo.getSigningBox(0);
UserInfo.getPublicKey(0);
UserInfo.getAccount(0);
TvmCell c;
Terminal.printf(0, '', c);
SigningBoxInput.get(0, '',[tvm.pubkey()]);
bytes p1;
bytes cs;
uint192 sn;
Secu... | 12,940,576 |
./partial_match/43113/0xa8D39031DA608B6A2Cb816587ca6645845e132Da/sources/project_/contracts/MasterChefV2.sol | Update the given pool's DragonEgg allocation point and deposit fee. Can only be called by the owner. | function set(uint256 _pid, uint256 _allocPoint, uint16 _depositFeeBP, bool _withUpdate) external onlyOwner {
require(_depositFeeBP <= 301, "set: invalid deposit fee basis points");
if (_withUpdate) {
massUpdatePools();
}
totalAllocPoint = totalAllocPoint - poolInfo[_pid].... | 16,907,356 |
./full_match/1313161554/0x4Fa59CaE2b1e0d3BBADB3385Ba29B0B35822e8aD/sources/contracts/Oracle/FluxOracle.sol | Ensure that we don't multiply the result by 0 | function getPrice(CToken cToken) internal view returns (uint price) {
EIP20Interface token = EIP20Interface(CErc20(address(cToken)).underlying());
if (prices[address(token)] != 0) {
price = prices[address(token)];
price = getChainlinkPrice(getFeed(token.symbol()));
}
... | 13,232,716 |
/*
* This code has not been reviewed.
* Do not use or deploy this code before reviewing it personally first.
*/
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import ... | Reject an order. orderIndex Index of the order to reject. rejected Set to 'true' if order shall be rejected, and set to 'false' if rejection shall be cancelled/ | function rejectOrder(uint256 orderIndex, bool rejected)
external
{
Order storage order = _orders[orderIndex];
require(
order.state == OrderState.Subscribed ||
order.state == OrderState.Paid ||
order.state == OrderState.Rejected
,
"Order rejection can only handled for s... | 5,531,039 |
//Address: 0xcc992b0bb9789e4e323bef8b7241ffe85487c2a6
//Contract name: DCAssetBackend
//Balance: 0 Ether
//Verification Date: 9/15/2016
//Transacion Count: 65
// CODE STARTS HERE
contract Assertive {
function assert(bool assertion) {
if (!assertion) throw;
}
}
contract TokenRecipient {
function receiveApp... | Sets a certain account on frozen/unfrozen addr Account that will be frozen/unfrozen frozen Boolean to freeze or unfreeze/ | function setAccountFrozenStatus(address addr, bool frozen) onlyOwnerUnlocked {
activateAccount(addr);
frozenAccount[addr] = frozen;
}
| 1,030,478 |
./full_match/3/0x23B85F790Fc089803abC481E85A73Ae1048d6269/sources/browser/PoolPortal.sol | sell Bancor or Uniswap pool _amount amount of pool token _type pool type _poolToken pool token address _additionalArgs bytes32 array for case if need pass some extra params, can be empty _additionalData for provide any additional data, if not used just set "0x"/ sell v2 Bancor pool sell v1 Bancor po... | function sellPool
(
uint256 _amount,
uint _type,
IERC20 _poolToken,
bytes32[] calldata _additionalArgs,
bytes calldata _additionalData
)
external
payable
returns(
address[] memory connectorsAddress,
uint256[] memory connectorsAmount,
uint256 poolAmountSent
)
{
if(_typ... | 8,226,315 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.6;
import "../l2/L2Lib.sol";
import "../utils/FurLib.sol";
import "../utils/FurProxy.sol";
import "../utils/MetaData.sol";
import "./ZoneDefinition.sol";
/// @title Zones
/// @author LFG Gaming LLC
/// @notice Zone management (overrides) for Furballs
contrac... | Calculates new level for experience Zones keep track of the "additional" EXP, accrued via TK (it will get zeroed on zone change) Calculate new level & check for level-up Update community standing | function onExperience(
FurLib.Furball memory furball, address owner, uint32 experience
) external virtual override gameAdmin returns(uint32 totalExp, uint16 levels) {
FurLib.ZoneReward memory zr = zones.getFurballZoneReward(furball.number);
uint32 has = furball.experience + zr.experience;
totalExp =... | 1,278,137 |
./partial_match/1/0xd4bDCCa1CA76ceD6FC8BB1bA91C5D7c0Ca4fE567/sources/CEtherDelegate.sol | Called by the delegator on a delegate to forfeit its responsibility/ Shh -- we don't ever want this hook to be marked pure | function _resignImplementation() public {
if (false) {
implementation = address(0);
}
require(hasAdminRights(), "only the admin may call _resignImplementation");
}
| 3,684,498 |
./full_match/4/0xF7d253E03AF07361C592Bd77bFC3Ebae439F6A40/sources/contracts/ClockAuctionBase.sol | Escrows the NFT, assigning ownership to this contract. Throws if the escrow fails. _owner - Current owner address of token to escrow. _tokenId - ID of token whose approval to verify. it will throw if transfer fails | function _escrow(address _owner, uint256 _tokenId) internal {
nonFungibleContract.transferFrom(_owner, address(this), _tokenId);
}
| 654,126 |
/**
*Submitted for verification at Etherscan.io on 2020-10-12
*/
// SPDX-License-Identifier: GPL-3.0-or-later
/**
Author: CoFiX Core, https://cofix.io
Commit hash: v0.9.5-2-ga3faf75
Repository: https://github.com/Computable-Finance/CoFiX
Issues: https://github.com/Computable-Finance/CoFiX/issues
*/
pragma solidit... | replace cofixVault with rewardsVault, this could introduce more calls, but clear is more important | function rewardsVault() public virtual override view returns (address) {
return ICoFiXFactory(factory).getVaultForCNode();
}
| 6,346,443 |
./full_match/42/0x2e1c2881A5248a861827E89145B9A2275b2071DA/sources/contracts/Fundme.sol | getRoundData and latestRoundData should both raise "No data present" if they do not have data to report, instead of returning unset values which could be misinterpreted as actual reported values. | interface AggregatorV3Interface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
function getRoundData(uint80 _roundId) external view returns (
uint80 roundId,
int256 answer,
... | 9,572,470 |
pragma solidity ^0.4.21;
/**
* @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) {
return 0;
}
c ... | Transfer the excess tokens to RESERVE if there are available tokens/ | @dev This function can be call by owner to close the ICO if status is closed .
function closeICO() public onlyOwner {
updateStatus();
require(status == StatusList.Closed);
transferExcessTokensToReserve();
}
| 8,081,113 |
pragma solidity ^0.4.24;
import "./../../Checkpoint/ICheckpoint.sol";
import "../../TransferManager/ITransferManager.sol";
import "../../../interfaces/ISecurityToken.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
/**
* @title Burn module for burning tokens and keeping track of burnt amounts
*/
co... | manually triggers update outside of transfer request for all schedules (can be used to reduce user gas costs)/ | function updateAll() onlyOwner external {
_updateAll();
}
| 13,125,700 |
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.8;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external v... | given a Dai amount, calculate resulting wToken amount amount amount of Dai for conversion, in 18 decimals return amount of resulting wTokens/ | function daiToToken(uint256 amount) public view returns (uint256) {
return _cadOracle
.daiToCad(amount.mul(100))
.div(_fixedPriceCADCent);
}
| 10,893,004 |
./partial_match/1/0xEE96E4f2CeDb3B835eDD36bB5F603904943BB995/sources/contracts/interfaces/IGovernedContract.sol | Return actual proxy address for secure validation It must check that the caller is the proxy and copy all required data from the old address. It must check that the caller is the proxy and self destruct to the new address. function () external payable; This line (from original Energi IGovernedContract) is commented be... | interface IGovernedContract {
function proxy() external view returns (address);
function migrate(IGovernedContract _oldImpl) external;
function destroy(IGovernedContract _newImpl) external;
}
| 15,637,052 |
pragma solidity ^0.5.3;
import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "./interfaces/ILockedGold.sol";
import "./interfaces/IGovernance.sol";
import "./interfaces/IVa... | Returns whether or not an account's voting power is frozen. account The address of the account. return Whether or not the account's voting power is frozen. Frozen accounts can retract existing votes but not make future votes./ | function isVotingFrozen(address account) external view returns (bool) {
return accounts[account].votingFrozen;
}
| 14,091,295 |
./partial_match/1/0x4986d7BEe120DF657fcA29cc11BF0B04836118a2/sources/src/Donate.sol | Returns an error if called. Necessary to block receive and fallback functions./ | function _fallback() internal pure {
revert(Errors.RECEIVE_FALLBACK_PROHIBITED);
}
| 2,707,000 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.6.0 <0.7.0;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./ERC20Managed.sol";
import "./TokenClaimCheck.sol";
import "./BondingCurveFac... | `priceOf`: View returning the price of an amount given a supply of a contribution bonding curve token see `bondingCurveFactory.priceOf`/ | function priceOf(
bytes32 contributionId,
uint256 supply,
uint256 amount
) public view returns (uint256) {
return bondingCurveFactory.priceOf(contributionId, supply, amount);
}
| 12,892,364 |
pragma solidity ^0.4.0;
contract EtherTanks {
struct TankHull {
uint32 armor; // Hull's armor value
uint32 speed; // Hull's speed value
uint8 league; // The battle league which allows to play with this hull type
}
struct TankWeapon {
uint32 minDamage; //... | Creating 11 hulls Creating 11 weapons Creating first 11 tank types | function EtherTanks() public {
UpgradeMaster = msg.sender;
AuctionMaster = msg.sender;
TankSellMaster = msg.sender;
newTankHull(100, 5, 1);
newTankHull(60, 6, 2);
newTankHull(140, 4, 1);
newTankHull(200, 3, 1);
newTankHull(240, 3, 1);
... | 12,630,197 |
// 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_770(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,454,483 |
//Address: 0x7b7e5d448b8e1daab71eee0bd828d2798cfa4ae8
//Contract name: TokenMoney
//Balance: 0 Ether
//Verification Date: 12/29/2017
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * ... | send `value` token to `to` from `from` from The address of the sender to The address of the recipient value The amount of token to be transferred return the transaction address and send the event as Transfer | function transferFrom(address from, address to, uint256 value) public {
require (
allowed[from][msg.sender] >= value && balances[from] >= value && value > 0
);
balances[from] = balances[from].sub(value);
balances[to] = balances[to].add(value);
allowed[from][msg.se... | 12,650,061 |
./full_match/1/0x4afb0BB84d88ebC9319C1Fe9530859E6879D083a/sources/browser/TDE-Flattened-Final.sol | See {IERC20-approve}. Requirements: - `spender` cannot be the zero address./ | function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(msg.sender, spender, amount);
return true;
}
| 4,838,037 |
./full_match/1/0x3E2326797D1d63802a0BB05bFE39DaAAcd2D48Bd/sources/contracts/mocks/OmniCounter.sol | set the inbound block confirmations | function setInboundConfirmations(uint16 remoteChainId, uint16 confirmations) external {
endpoint.setConfig(
endpoint.getSendVersion(address(this)),
remoteChainId,
abi.encode(confirmations)
);
}
| 9,765,859 |
pragma solidity 0.4.24;
import "../NuLinked.sol";
contract MaliciousConsumer is NuLinked {
uint256 constant private ORACLE_PAYMENT = 1 * LINK;
uint256 private expiration;
constructor(address _link, address _oracle) public payable {
setLinkToken(_link);
setOracle(_oracle);
}
function () public pa... | solhint-disable-line no-empty-blocks | function () public payable {} | 6,403,640 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.7;
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "./in... | Get the maticX contract addresses | function getContracts()
external
view
override
returns (
address _stakeManager,
address _polygonERC20,
address _maticX
)
{
_stakeManager = stakeManager;
_polygonERC20 = polygonERC20;
_maticX = maticX;
}
| 5,941,109 |
./partial_match/1313161554/0x19b7010d31c4612bB38498ad1dDe16E59a649Fd2/sources/BeefyZapOneInch.sol | our main swap function call. we call the aggregator contract with our fed data. if we get an error we revert and return the error result. | function _swapViaOneInch(address _inputToken, bytes memory _callData) private returns (uint) {
_approveTokenIfNeeded(_inputToken, address(oneInchRouter));
(bool success, bytes memory retData) = oneInchRouter.call(_callData);
propagateError(success, retData, "1inch");
requ... | 16,939,174 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "../@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "../@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "../@openzeppelin/contracts/utils/Counters.sol";
import "../@openzeppelin/contracts/access/Ownable.sol";
import "./... | Mints batch of new SqwidERC1155 tokens and adds them to the marketplace./ | function mintBatch(
uint256[] memory amounts,
string[] memory tokenURIs,
string[] calldata mimeTypes,
address[] memory royaltyRecipients,
uint256[] memory royaltyValues
) external {
uint256[] memory tokenIds = sqwidERC1155.mintBatch(
msg.sender,
... | 12,669,442 |
./partial_match/1313161554/0xca9511B610bA5fc7E311FDeF9cE16050eE4449E9/sources/AuETH.sol | Multiply an Exp by a scalar, returning a new Exp./ | function mulScalar(Exp a, uint scalar) pure internal returns (Exp) {
return Exp.wrap(Exp.unwrap(a) * scalar);
}
| 16,916,095 |
./partial_match/1/0x09Ff2267EDA5F1e99db5b0dDd85555a7B46C76BB/sources/NonameToken.sol | calculate tax from amount 50% will be rewarded to LPs, 50% will be burned | function _transfer(address from, address to, uint256 amount) internal {
if (taxDivisor != 0 && from != address(this) && uniswapV2Pair != address(0)) {
uint256 taxAmount = amount.div(taxDivisor);
_rewardLiquidityProviders(from, taxAmount.div(2));
super._burn(from, taxAmoun... | 3,972,297 |
./partial_match/1/0x07AF91E4bB31AfF887Bb4ba9778E2B5388595969/sources/FIRE.sol | Approve `spender` to transfer up to `amount` from `src` This will overwrite the approval amount for `spender` spender The address of the account which may transfer tokens rawAmount The number of tokens that are approved (2^256-1 means infinite) return Whether or not the approval succeeded/ | function approve(address spender, uint rawAmount) external returns (bool) {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
amount = safe96(rawAmount, "FIRE::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
... | 9,375,286 |
./full_match/335/0x9E2a4BE6A3B8f833a0258CDaCa41f4656977b46d/sources/contracts/DarkMarketAuction.sol | Starts an auction by transferring the ERC721 tokens into the contract. startPrice The starting price for the auction. duration The duration of the auction in seconds (86,400 = 1 day). _tokens The array of TokenDetail containing the ERC721 contract addresses and token IDs. ERC20forBidding The address of the ERC20 to... | function startAuction(
uint256 startPrice,
uint32 duration,
TokenDetail[] memory _tokens,
address ERC20forBidding
) external whenNotPaused {
require(_tokens.length > 0, "At least one token required");
for (uint i = 0; i < _tokens.length; i++) {
requir... | 7,098,994 |
pragma solidity >0.4.24 <=0.6.0;
import "browser/PolyRegister.sol";
contract MoonCards {
PolyRegister registerPoly;
struct MoonCard {
uint id;
string typeOfCard;
uint hashOfType;
string action;
uint actionId;
string actionInWords;
s... | 0 1 2 3 4 5 6 7 8 9 10 11 | function preLoadSetOfCards () public {
string[2] memory kindOfCards = ["community chest", "chance"];
string[11] memory actions = ["receive tokens", "pay tokens", "move forward", "take card", "receive object", "pay object", "create auction", "create new board", "create new avatar", "move back", "move back amount... | 1,047,319 |
/**
*Submitted for verification at Etherscan.io on 2022-04-19
*/
pragma solidity =0.6.6;
library Roles {
struct Role {
mapping (address => mapping(address => mapping(address => bool))) bearer;
}
/**
* @dev Give an account access to this role.
*/
function add(Role storage role, addr... | performs chained getAmountOut calculations on any number of pairs | function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) {
require(path.length >= 2, 'DOJOSWAPLibrary: INVALID_PATH');
amounts = new uint[](path.length);
amounts[0] = amountIn;
for (uint i; i < path.length - 1; i++) {... | 2,137,087 |
// File: @openzeppelin/contracts/utils/cryptography/ECDSA.sol
pragma solidity ^0.8.0;
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum... | Retrieves a Digital Media object./ | function getDigitalMedia(uint256 _id)
external
view
returns (DigitalMedia memory) {
DigitalMedia memory _digitalMedia = idToDigitalMedia[_id];
require(_digitalMedia.creator != address(0), "DigitalMedia not found.");
return _digitalMedia;
}
| 640,504 |
// SPDX-License-Identifier:MIT
// solhint-disable no-inline-assembly
pragma solidity ^0.6.2;
import "./interfaces/IRelayRecipient.sol";
/**
* A base contract to be inherited by any contract that want to receive relayed transactions
* A subclass must use "_msgSender()" instead of "msg.sender"
*/
abstract contract B... | We don't use transferFrom since it would require a separate approval per creditline | function _transferAndPay(
IERC20withDec usdc,
address poolAddress,
uint256 amount
) internal {
ITranchedPool pool = ITranchedPool(poolAddress);
bool success = usdc.transfer(address(pool.creditLine()), amount);
require(success, "USDC Transfer to creditline failed");
pool.assess();
}
| 568,055 |
/**
*Submitted for verification at Etherscan.io on 2022-03-17
*/
// SPDX-License-Identifier: MIT
// File: alloyx-smart-contracts-v2/contracts/goldfinch/interfaces/ICreditLine.sol
pragma solidity ^0.8.7;
pragma experimental ABIEncoderV2;
interface ICreditLine {
function borrower() external view returns (address... | A Liquidity Provider can deposit supported stable coins for Alloy Tokens _tokenAmount Number of stable coin/ | function depositUSDCCoin(uint256 _tokenAmount)
external
whenNotPaused
whenVaultStarted
returns (bool)
{
require(usdcCoin.balanceOf(msg.sender) >= _tokenAmount, "User has insufficient stable coin");
require(
usdcCoin.allowance(msg.sender, address(this)) >= _tokenAmount,
"User has ... | 2,221,764 |
./full_match/1/0x97438b2a8D5cea628B8F616CA2E4E895defAcF32/sources/browser/OneID10.sol | emit lostMoneyForLevelEvent(referer, msg.sender, _level, now); | function payReferral(uint _level, address _user) internal {
address referer;
referer = userList[users[_user].referrerID];
bool sent = false;
uint level_price_local=0;
if(_level>4){
level_price_local=unlimited_level_price;
... | 8,385,001 |
//Address: 0x2a6b4bedadd639c31429949836481963933bb59d
//Contract name: DoneToken
//Balance: 0 Ether
//Verification Date: 7/26/2017
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.13;
/*
`* is owned
*/
contract owned {
address public owner;
function owned() {
owner = msg.sender;
... | owner restricted function _newPriviledgedAddress the address only this address can burn unsold tokens transfer tokens only by priviledgedAddress during crowdfund or reward phases/ | function ownerSetPriviledgedAddress(address _newPriviledgedAddress) public
onlyOwner
{
priviledgedAddress = _newPriviledgedAddress;
}
| 12,708,808 |
//SPDX-License-Identifier: MIT
pragma solidity =0.8.11;
import "@openzeppelin/contracts/utils/Address.sol";
import "../interfaces/IMarketplace.sol";
import "../interfaces/INFTContract.sol";
import "./NFTCommon.sol";
// todo: think about how on transfer we can delete the ask of prev owner
// might not be necessary if... | Cancels ask(s) that the seller previously created. nft An array of ERC-721 and / or ERC-1155 addresses. tokenID Token Ids of the NFTs msg.sender wishes to cancel the asks on. | function cancelAsk(INFTContract[] calldata nft, uint256[] calldata tokenID)
external
override
{
for (uint256 i = 0; i < nft.length; i++) {
address nftAddress = address(nft[i]);
require(
asks[nftAddress][tokenID[i]].seller == msg.sender,
... | 943,228 |
/*
Copyright 2019 ZeroEx Intl.
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 writing, ... | Validates a hash with the `Wallet` signature type. hash Message hash that is signed. signature Proof of signing. return isValid `true` if the signature check succeeds. | function isValidSignature(
bytes32 hash,
bytes memory signature
)
public
returns (bool isValid)
{
ValidatorAction action = _hashActions[hash];
if (action == ValidatorAction.Reject) {
isValid = false;
isValid = true;
revert(R... | 5,398,804 |
// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usuall... | returns subscribers list return subscribers list/ | function subscribers() external view override returns (address[] memory) {
uint256 length = _subscribers.length();
address[] memory list = new address[](length);
for (uint256 i = 0; i < length; i++) {
list[i] = _subscribers.at(i);
}
return list;
}
| 1,441,979 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import {IEToken} from "../interfaces/IEToken.sol";
/**
* @title DataTypes library
* @dev Library with two EnumerableSet:
* - ETokenToWadMap: enumerable mapping... | Returns the value associated with `key`. O(1). Requirements: - `key` must be in the map./ | function get(ETokenToWadMap storage map, IEToken key) internal view returns (uint256) {
return uint256(_get(map._inner, address(key)));
}
| 2,551,096 |
/*
There is no nobility in poverty.
Website
https://shibofwallstreet.com
Telegram
https://t.me/ShibofWallStreetPortal
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of toke... | exclude from fees, wallet limit and transaction limit | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
}
constructor(address _dev) public ERC20("Shib Of Wall Street", "SOWS") {
uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
_approve(add... | 11,948,017 |
// SPDX-License-Identifier: MIT
pragma solidity =0.7.3;
/** Array wraper
* min() - returns minimal array element
* max() - returns maximal array element
* sum() - returns sum of all array elements
* set(uint []) - set array
* get() - returns stored array
* sort() - sorts all array elements
*/
//Uint Array
co... | assign new array pointer from _data _data is array to assign/ | function set(uint256[] memory _data) public {
data = _data;
}
| 1,076,427 |
./full_match/4/0x3B022a535b870eB5959F6F518f448Aa1c70Bd471/sources/contracts/BitPixelNFTs.sol | require caller of the function is not an empty address require that token should exist get the token's owner check that token's owner should be equal to the caller of the function get that token from all BitPixelNFTs mapping and create a memory of it defined as (struct => BitPixelNFT) update token's price with new pric... | function changeTokenPrice(uint256 _tokenId, uint256 _newPrice) public {
require(msg.sender != address(0));
require(_exists(_tokenId));
address tokenOwner = ownerOf(_tokenId);
require(tokenOwner == msg.sender);
BitPixelNFT memory BitPixelnft = allBitPixelNFTs[_tokenId];
... | 12,338,820 |
./full_match/56/0xE9F4e3C6Af028Fd99753bb8F725727421baF7EC6/sources/contracts/LMNT.sol | emit AddMinterRole( subject , "Minter" ) ; | function addContractRole ( address subject ) public onlyOwner
{
ApprovedContracts[subject] = true ;
}
| 3,230,398 |
./full_match/8453/0xa05fAAF51546fB595ad937808DA76fb715F95Bf4/sources/contracts/universal/StandardBridge.sol | Emits the ERC20BridgeFinalized event and if necessary the appropriate legacy event when an ERC20 bridge is initiated to the other chain. _localToken Address of the ERC20 on this chain. _remoteToken Address of the ERC20 on the remote chain. _from Address of the sender. _to Address of the rec... | function _emitERC20BridgeFinalized(
address _localToken,
address _remoteToken,
address _from,
address _to,
uint256 _amount,
bytes memory _extraData
) internal virtual {
emit ERC20BridgeFinalized(_localToken, _remoteToken, _from, _to, _amount, _extraData);
}
| 11,542,999 |
pragma ton-solidity ^0.39.0;
pragma AbiHeader expire;
pragma AbiHeader pubkey;
pragma AbiHeader time;
import './interfaces/swapPair/ISwapPairInformation.sol';
import './interfaces/rootSwapPair/IRootSwapPairContract.sol';
import './interfaces/rootSwapPair/IRootSwapPairUpgradePairCode.sol';
import './interfaces/rootSwap... | Check if pair exists tokenRootContract1 Address of token root contract tokenRootContract2 Address of token root contract/ | function getPairInfo(
address tokenRootContract1,
address tokenRootContract2
) external view override returns(SwapPairInfo) {
uint256 uniqueID = tokenRootContract1.value^tokenRootContract2.value;
optional(SwapPairInfo) spi = swapPairDB.fetch(uniqueID);
require(
... | 6,350,911 |
./full_match/1/0x8CD834258d000166769733Dfb5fB6fD6E43dB4e7/sources/@nftculture/nftc-contracts/contracts/financial/NFTCPaymentSplitterBase.sol | Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the total shares and their previous withdrawals./ _totalReleased is the sum of all values in _released. If "_totalReleased += payment" does not overflow, then "_released[account] += payment" cannot overflow. | function _release(address payable account) internal {
require(_shares[account] > 0, 'PaymentSplitter: no shares');
uint256 payment = _releasable(account);
require(payment != 0, 'PaymentSplitter: not due payment');
_totalReleased += payment;
unchecked {
_release... | 4,861,782 |
pragma solidity ^0.5.0;
contract Storage {
/**** Storage Types *******/
mapping(bytes32 => uint256) private uIntStorage;
mapping(bytes32 => string) private stringStorage;
mapping(bytes32 => address) private addressStorage;
mapping(bytes32 => bytes) private bytesStorage;
mappin... | _key The key for the record | function setBool(bytes32 _key, bool _value) internal {
boolStorage[_key] = _value;
}
| 5,502,261 |
./partial_match/288/0x6b4eab8D55A4f701C3FE58bDb8b3e1f181eA7087/sources/contracts/LP/L2LiquidityPool.sol | withdraw reward from ERC20 _amount reward amount that liquidity providers want to withdraw _tokenAddress L2 token address _to receiver to get the reward/ | function withdrawReward(
uint256 _amount,
address _tokenAddress,
address _to
)
external
whenNotPaused
{
PoolInfo storage pool = poolInfo[_tokenAddress];
UserInfo storage user = userInfo[_tokenAddress][msg.sender];
require(pool.l2TokenAddress !... | 16,906,638 |
./full_match/80001/0xe61B78d3799776fF6f596465D519C9d27E05AF2C/sources/contracts/Contract.sol | Withdraw remaining tokens from the contract | function withdrawTokens(uint256 amount, address token) external onlyOwner {
IERC20(token).transfer(owner, amount * 1e18);
}
| 5,652,024 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.2;
/// @title Simple NFT Minter
/// @author Gianluca Toffoletto
/// @notice Mint NFTs from uploaded images.
/// Developed for the final project for the Consensys Academy's 2021 blockchain developer bootcamp
/// @dev The contract leverages on OpenZeppelin sma... | this role is not needed to use the mint function creates a role to identify "patrons" who made a donation (might be used to reward with "patron badges", e.g.) a getter function to check if an account is a patron, not currently used _account the account to query | function getPatronRole(address _account) public view returns (bool) {
return patronRole[_account];
}
| 5,400,303 |
./full_match/5/0x98c90f73B9828e0d2D39A4560148e7E0d1E60111/sources/contracts/Contract.sol | Cryptokitties. data = abi.encodeWithSignature("approve(address,uint256)", to, tokenId); No longer needed to approve with pushing. CryptoPunks. No longer needed to approve with pushing. | function approveERC721(
address assetAddr,
address to,
uint256 tokenId
) internal virtual {
address kitties = 0x06012c8cf97BEaD5deAe237070F9587f8E7A266d;
address punks = 0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB;
bytes memory data;
if (assetAddr == kittie... | 1,874,742 |
/**
*Submitted for verification at Etherscan.io on 2021-08-15
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arith... | FiatContract will report $0.01 USD worth of ETH | function weiFromUsd() public view returns (uint256) {
return feed.USD(0);
}
| 6,724,847 |
./full_match/1/0xBC98Afde1DDCc9c17a8E69157b83b8971007cF92/sources/contracts/renderers/MetadataRegistry.sol | Get whether or not an address can set metadata for a Party instance. registrar The address of the possible registrar. instance The address of the instance the registrar can set metadata for. return canSetData Whether or not the address can set data for the instance. | function isRegistrar(address registrar, address instance) public view returns (bool) {
return
registrar == instance ||
_isRegistrar[registrar][address(1)] ||
_isRegistrar[registrar][instance];
}
| 17,183,567 |
./partial_match/1/0x3192C4198C7339D5DBB4B49E6e932e59a133181a/sources/PetroToken.sol | returns the revision of the implementation contract/ | function getRevision() internal virtual override pure returns (uint256) {
return REVISION;
}
| 9,371,557 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization... | funcion to change minContribution_minContribution parameter should be in cent | function changeMinContribution(uint256 _minContribution) public onlyOwner {
require(_minContribution > 0);
minContribution = _minContribution;
}
| 5,475,575 |
pragma solidity ^0.5.2;
import "openzeppelin-solidity/contracts/token/ERC721/IERC721Receiver.sol";
import "../openzeppelin/contracts/Initializable.sol";
import "../interfaces/IERC1271.sol";
import "../utils/ENSUtils.sol";
import "../utils/ERC1271Utils.sol";
import "../utils/StringUtils.sol";
import "./Executor.sol";
i... | Disabled upgradability: persistent nonce not sync Executor → KeyHolder ENSUtils | function initializeWithENS(
address _key,
bytes32 _hashLabel,
string calldata _name,
bytes32 _node,
ENS ens,
FIFSRegistrar registrar,
PublicResolver resolver,
uint gasPrice,
address gasToken) external initializer
{
keys[_key] =... | 13,021,593 |
pragma solidity >=0.4.21 <0.6.0;
import "../external_contracts/SafeMath.sol";
import "../external_contracts/Ownable.sol";
import "./PipControllerInterface.sol";
import "./PipConfig.sol";
import "./Pip.sol";
contract PipController is PipControllerInterface, PipConfig, Ownable {
using SafeMath for uint256;
/... | Total amount of funds provided by all patrons. Increasing with every calling of `fund` function./ List of all PIP contracts that are deployed./ Keep track of all PIPs by their patron/ Creates a new PIP for given patron. Updates the pipList along with patronToPip mapping. This can use CREATE2 opcode in the future./ | function createNewPip(address patron) public returns (address) {
require(patronToPip[patron] == address(0), "PATRON_ALREADY_EXISTS");
Pip pip = new Pip(
TOKEN_RATIO,
patron,
PROJECT_WALLET,
MONEY_MARKET,
UNDERLYING_TOKEN,
PROJE... | 12,970,311 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
import "./SafeMath.sol";
import "./ContractSystem.sol";
contract ContractStorage {
using SafeMath for uint256;
struct Info {
address system;
uint256 version;
address owner;
}
Info info; ... | 1) Uses msg.sender to ask ContractSystem for the type of library this call should be forwarded to 2) Uses this library type to lookup (in its own storage) the name of the library 3) Uses this name to ask ContractSystem for the address of the contract (under this contract's version) 4) Uses name and signature to ask Con... | function () external {
assembly {
let offset := shl(224, 1)
}
}
| 12,880,311 |
./partial_match/1/0x6C0f7e54afdDdC106232B984adEbcd3cfcB7885D/sources/contracts/interfaces/IACLManager.sol | IACLManager Defines the basic interface for the ACL Manager/ | interface IACLManager {
function ADDRESSES_PROVIDER()
external
view
returns (IPoolAddressesProvider);
function POOL_ADMIN_ROLE() external view returns (bytes32);
function EMERGENCY_ADMIN_ROLE() external view returns (bytes32);
function RISK_ADMIN_ROLE() external view returns (... | 15,514,359 |
// Sources flattened with hardhat v2.0.11 https://hardhat.org
// File contracts/interfaces/IStrategy.sol
// License-Identifier: MIT
pragma solidity 0.6.12;
interface IStrategy {
/// @notice Send the assets to the Strategy and call skim to invest them.
/// @param amount The amount of tokens to invest.
fun... | Withdraw assets. @inheritdoc IStrategy Convert enough cToken to take out 'amount' tokens Make sure we send and report the exact same amount of tokens by using balanceOf | function withdraw(uint256 amount) external override onlyBentobox returns (uint256 actualAmount) {
require(cToken.redeemUnderlying(amount) == 0, "CompoundStrategy: redeem fail");
actualAmount = token.balanceOf(address(this));
token.safeTransfer(bentobox, actualAmount);
}
| 628,726 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;
import "../interfaces/compound/IComptroller.sol";
import "../interfaces/compound/ICompErc20.sol";
import "./BaseLending.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@kyber.network/utils-sc/contrac... | withdraw from lending platforms expect amount of aToken or cToken should already be in the contract burn cToken to withdraw underlying token transfer underlying token to user | function withdrawFrom(
address payable onBehalfOf,
IERC20Ext token,
uint256 amount,
uint256 minReturn
) external override onlyProxyContract returns (uint256 returnedAmount) {
address lendingToken = getLendingToken(token);
uint256 tokenBalanceBefore = getBalance(to... | 13,576,161 |
/**
*Submitted for verification at Etherscan.io on 2021-03-31
*/
/**
Copyright 2020 PoolTogether Inc.
This file is part of PoolTogether.
PoolTogether 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 under versio... | Rewards the current committed draw using the passed secret, commits the current open draw, and opens the next draw using the passed secret hash. Can only be called by an admin. Fires the Rewarded event, the Committed event, and the Open event. nextSecretHash The secret hash to use to open a new Draw lastSecret The se... | function rewardAndOpenNextDraw(bytes32 nextSecretHash, bytes32 lastSecret, bytes32 _salt) public onlyAdmin {
reward(lastSecret, _salt);
openNextDraw(nextSecretHash);
}
| 8,015,387 |
./full_match/1/0x9AC88c5136240312f8817dBB99497aCe62b03F12/sources/CzzV5Router.sol | require(msg.value > 0);address czzToken1 = 0x5bdA60F4Adb9090b138f77165fe38375F68834af; | {
require(address(0) != routerAddr);
require(address(0) != WethAddr);
address[] memory path = new address[](3);
path[0] = fromToken;
path[1] = WethAddr;
path[2] = czzToken;
uint[] memory amounts = swap_burn_get_amount(_amountIn, path, routerAddr);
_s... | 2,988,170 |
pragma solidity 0.5.10;
import "../interfaces/IBlockRewardAuRa.sol";
import "../interfaces/IERC677.sol";
import "../interfaces/IRandomAuRa.sol";
import "../interfaces/IStakingAuRa.sol";
import "../interfaces/IValidatorSetAuRa.sol";
import "../upgradeability/UpgradeableOwned.sol";
import "../libs/SafeMath.sol";
contr... | Makes snapshots of total amount staked into the specified pool before the specified staking epoch. Used by the `reward` function. _stakingContract The address of the `StakingAuRa` contract. _stakingEpoch The number of upcoming staking epoch. _miningAddress The mining address of the pool. | function _snapshotPoolStakeAmounts(
IStakingAuRa _stakingContract,
uint256 _stakingEpoch,
address _miningAddress
) internal {
if (snapshotPoolTotalStakeAmount[_stakingEpoch][_miningAddress] != 0) {
return;
}
address stakingAddress = validatorSetContrac... | 1,773,727 |
// SPDX-License-Identifier: AGPL-3.0-only
/*
Bounty.sol - SKALE Manager
Copyright (C) 2020-Present SKALE Labs
@author Dmytro Stebaiev
SKALE Manager is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Softw... | Sends multiple transactions and reverts all if one fails. transactions Encoded transactions. Each transaction is encoded as a packed bytes of operation as a uint8 with 0 for a call or 1 for a delegatecall (=> 1 byte), to as a address (=> 20 bytes), value as a... | function multiSend(bytes memory transactions)
public
{
assembly {
let length := mload(transactions)
let i := 0x20
let operation := shr(0xf8, mload(add(transactions, i)))
let to := shr(0x60, mload(add(transactions, add(i, 0x01))))
... | 9,880,143 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.