file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/4/0x8737d5288703019F3355AE2a4981051A13CF7Aaa/sources/contracts/FundMe.sol | Map the address calling this function with the amount of ether they sent | function fund() public payable {
uint256 minimumUsd = 50 * 10 ** 8;
require(getConversionRate(msg.value) >= minimumUsd, "You needs spends more ETH!");
}
| 13,364,157 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {IArweaveMarket} from "./interfaces/IArweaveMarket.sol";
import {IMarketMediator} from "./interfaces/IMarketMediator.sol";
import {IArbitrable} from "./interfaces/IArbitrable.sol";
import ... | trust market not to dispute same request twice | function createDispute(uint256 _requestId) external override onlyMarket {
uint256 disputeId = disputes.length;
Dispute memory dispute;
dispute.requestId = _requestId;
dispute.deadline = block.timestamp + disputeWindow;
disputes.push(dispute);
requestToDispute[_reques... | 6,411,609 |
./full_match/43114/0x7f45cb159561F8f139C5971a75a0a4210F751Adc/sources/project:/contracts/Comptroller.sol | Add the market to the borrower's "assets in" for liquidity calculations cToken The market to enter borrower The address of the account to modify return Success indicator for whether the market was entered/ market is not listed, cannot join already joined | function addToMarketInternal(
CToken cToken,
address borrower
) internal returns (Error) {
Market storage marketToJoin = markets[address(cToken)];
if (!marketToJoin.isListed) {
return Error.MARKET_NOT_LISTED;
}
if (marketToJoin.accountMembership[borr... | 4,522,573 |
pragma solidity >=0.4.17 <0.7.0;
pragma experimental ABIEncoderV2;
import "../../node_modules/@openzeppelin/contracts/token/ERC721/ERC721Full.sol";
contract Item is ERC721Full {
string[] public ids;
constructor() ERC721Full('Item', 'ITEM') public {}
function mint(string memory _item, string memory _uri) publ... | function createItem(string memory i, uint id, uint[2] memory p) public payable { nodeOf[msg.sender].inventory.length++; nodeOf[msg.sender].inventory[nodeOf[msg.sender].inventory.length-1].itemType = i; nodeOf[msg.sender].inventory[nodeOf[msg.sender].inventory.length-1].itemId = id; nodeOf[msg.sender].... | function flagItem(address a, uint _id) public {
for(uint i = 0; i < nodeOf[a].received.length; i++) {
if(nodeOf[a].received[i] == _id) {
nodeOf[a].flagged.length++;
nodeOf[a].flagged[nodeOf[a].flagged.length-1] = _id;
nodeOf[a].received[i] = nodeOf[a].received[nodeOf[a].r... | 15,881,451 |
pragma solidity ^0.4.24;
import "./DestructibleMiniMeTokenFactory.sol";
import "./Ownable.sol";
/*
Copyright 2018, Will Harborne @ Ethfinex
*/
/// @title ProposalManager Contract
/// @author Will Harborne @ Ethfinex
contract TokenListingManager is Ownable {
address public constant NECTAR_TOKEN = 0xCc80C0510... | there is only one winner in criteria 0 there is N winners in criteria 1 for each token we check if he has more votes than last one, if it has we put it in array and always keep array sorted everybody who has over N votes are winners in criteria 2 | function getWinners(uint _proposalId) public view returns(address[] winners) {
require(_proposalId < tokenBatches.length);
TokenProposal memory p = tokenBatches[_proposalId];
if (p.criteria == 0) {
winners = new address[](1);
uint max = 0;
for (uint i=0... | 12,830,021 |
./full_match/1/0xB5b20179cB694226b5E26d84d1e3E677aB330de4/sources/contracts/diamond/IDiamondFacet.sol | Kam Amini <kam@qomet.tech> Use at your own risk NOTE: The override MUST remain 'pure'. NOTE: The override MUST remain 'pure'. NOTE: The override MUST remain 'pure'. NOTE: The override MUST remain 'pure'. | interface IDiamondFacet is IERC165 {
function getFacetName() external pure returns (string memory);
function getFacetVersion() external pure returns (string memory);
function getFacetPI() external pure returns (string[] memory);
function getFacetProtectedPI() external pure returns (string[] memory);... | 2,928,854 |
//SPDX-License-Identifier: Open Source
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
/// @title CGFMWallet: Crypto Gifts For Minors Wallet
/// @author Hico
/// @notice This contract has not been audited
/// @dev No side effects
contract Wallet is Ownable {
address[] public appr... | When the contract turns 16, only beneficiary may request to withdraw Eth amount is the amount of Eth the beneficiary wants to withdraw to is the address that the beneficiary wants to send Eth to | function createTransfer(uint amount, address payable to) external onlyBeneficiary() stopInEmergency() timeLock16() {
require(address(this).balance > 0, 'There is zero Ether in this wallet');
emit WithdrawalRequested(amount, to);
transfers.push(Transfer(
transfers.length,
... | 12,839,980 |
./full_match/1/0xC9e4fe1AeD8D8c62cE884DE17428dD419C127810/sources/src/Token.sol | Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have ... | function decreaseAllowance(
address spender,
uint256 requestedDecrease
) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance < requestedDecrease) {
revert("ERC20: decreased al... | 4,896,667 |
./partial_match/1/0x061888246A29fEB9bb3f168CD8589B3Cf4115668/sources/YodlRouterV1.sol | Calculates exchange rates from a given price feed At most we can have 2 price feeds. We will use a zero address to determine if we need to inverse a singular price feeds. For multiple price feeds, we will always pass them in such that we multiply by the first and divide by the second. This works because all of our pri... | function exchangeRate(
address[2] calldata priceFeeds,
uint256 amount
)
public
view
returns (
uint256 converted,
address[2] memory priceFeedsUsed,
int256[2] memory prices
)
{
require(
priceFeeds[0] != add... | 15,991,504 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/util... | Get total supply return Total supply/ Determine the prior number of votes for an account as of a block number. Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at r... | interface IUserManager {
function checkIsMember(address account) external view returns (bool);
function getBorrowerAddresses(address account) external view returns (address[] memory);
function getStakerAddresses(address account) external view returns (address[] memory);
function getBorrowerAsset(addr... | 528,771 |
./full_match/8453/0xF3377062069d0C3E86dd553cC22a6Fcc2B3306a5/sources/IERC20.sol | Interface of the TRC20 standard as defined in the EIP. Does not include the optional functions; to access them see {TRC20Detailed}./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint2... | 11,560,536 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.2;
/// @title: David Ariew X Tatler China
import "../ERC721ProjectUpgradeable.sol";
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////... | Returns true if `account` supports the {IERC165} interface,/ Any contract that implements ERC165 must explicitly indicate support of InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid | function supportsERC165(address account) internal view returns (bool) {
return _supportsERC165Interface(account, type(IERC165Upgradeable).interfaceId) &&
!_supportsERC165Interface(account, _INTERFACE_ID_INVALID);
}
| 12,006,517 |
./full_match/1/0x70B56ABaBf0d7bB58DD92bf5e8A5eA4cEEea9879/sources/contracts/DemApples.sol | Set the teams address | function setTheTeam(address _theTeam) external onlyOwner {
theTeam = _theTeam;
}
| 17,044,764 |
./partial_match/1/0x6efA260a268e4AfAcf7fb91A6BF5f5B37379BF61/sources/BasketManager.sol | Negates the isolation of a given bAsset _bAsset Address of the bAsset/ | function negateIsolation(address _bAsset)
external
managerOrGovernor
{
(bool exists, uint256 i) = _isAssetInBasket(_bAsset);
require(exists, "bAsset must exist");
BassetStatus currentStatus = basket.bassets[i].status;
if(currentStatus == BassetStatus.BrokenBelowP... | 4,466,195 |
pragma solidity ^0.5.12;
/**
* @title CToken Mock - simulating a compound market.
* @dev This contract implements the required interfaces to mock compound markets
* while not providing all interfaces there. This mock is extremely simple and ignores
* many of the subtleties with the real compound contracts. For example... | msg.sender account which shall supply the asset, and own the minted cTokens. mintAmount : The amount of the asset to be supplied, in units of the underlying asset. return uint 256: 0 on success, otherwise an Error codes/ get amount of cToken to mint mintTokens = mintAmount / exchangeRate | function mint(uint256 mintAmount) public returns (uint256) {
uint256 numerator = mintAmount.mul(1e18);
uint256 scaledNumerator = numerator.mul(1e18);
uint256 rational = scaledNumerator.div(exchangeRateStored);
_mint(msg.sender, rational.div(1e18));
return 0;
}
| 12,924,673 |
pragma solidity ^0.4.18;
contract DataSourceInterface {
function isDataSource() public pure returns (bool);
function getGroupResult(uint matchId) external;
function getRoundOfSixteenTeams(uint index) external;
function getRoundOfSixteenResult(uint matchId) external;
function getQuarterResult(uin... | Checks if the order given offchain coincides with the order of the actual previously calculated points in the smart contract. the token sorting is done offchain so as to save on the huge amount of gas and complications that could occur from doing all the sorting onchain. sortedChunk chunk sorted by points/ | function checkOrder(uint32[] sortedChunk) external onlyAdmin checkState(pointsValidationState.LimitCalculated){
require(sortedChunk.length + sortedWinners.length <= winnerCounter);
for(uint256 i=0;i < sortedChunk.length-1;i++){
uint256 id = sortedChunk[i];
uint256 sigId = so... | 7,712,514 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.2 (token/ERC20/ERC20.sol)
/****************************************************************************
GameERC20
- Keeps a record the users' balance without minting or burning.
- This is "In Game Currency"
- Users can convert their "... | If someone sends $ETH to the token contract directly, this function lets us rescue their money, and return it! | function rescue() external onlyOwner {
payable(owner()).transfer(address(this).balance);
}
| 12,662,142 |
./full_match/4/0x743Fbe15CCef1F9aAB28878819cCD9D266698008/sources/BSUD_X6.sol | require(msg.value == BASIC_PRICE 2, "invalid registration value"); | function registration(address userAddress, address referrerAddress) private {
depositToken.safeTransferFrom(msg.sender, address(this), BASIC_PRICE * 2);
require(!isUserExists(userAddress), "user exists");
require(isUserExists(referrerAddress), "referrer not exists");
uint32... | 670,480 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@boringcrypto/boring-solidity/contracts/libraries/BoringMath.sol";
import "@boringcrypto/boring-solidity/contracts/BoringBatchable.sol";
import "@boringcrypto/boring-solidity/contracts/BoringOwnable.sol";
import "./libra... | Update the given pool's SUSHI allocation point and `IRewarder` contract. Can only be called by the owner. _pid The index of the pool. See `poolInfo`. _allocPoint new AP of the pool _rewarder Address of the rewarder delegate. overwrite True if _rewarder should be `set`. Otherwise `_rewarder` is ignored. | function set(uint256 _pid, uint256 _allocPoint, IRewarder _rewarder, bool overwrite) public onlyOwner {
totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint);
poolInfo[_pid].allocPoint = _allocPoint.to64();
emit LogSetPool(_pid, _allocPoint, overwrite ? _rewarder ... | 12,881,788 |
./full_match/137/0x74E7ACAfC758caC65910e5C38E6Ef9ade5fA87A8/sources/contracts/SpotTradingRewardDistributor/SpotTradingRewardDistributor.sol | Interface checker _interfaceId The interface id to check/ | function supportsInterface(bytes4 _interfaceId) public view override returns (bool) {
return _interfaceId == type(ISpotTradingRewardDistributor).interfaceId || super.supportsInterface(_interfaceId);
}
| 4,721,662 |
./full_match/80001/0xDC9FB0d4339200b535fFB9752036368541c0eDBC/sources/contracts/interfaces/ILayerZeroMessagingLibrary.sol | send(), messages will be inflight. estimate native fee at the send side--------------------------------------------------------------------------- setConfig / getConfig are User Application (UA) functions to specify Oracle, Relayer, blockConfirmations, libraryVersion | interface ILayerZeroMessagingLibrary {
function send(address _userApplication, uint64 _lastNonce, uint16 _chainId, bytes calldata _destination, bytes calldata _payload, address payable refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) external payable;
function estimateFees(uint16 _chai... | 9,434,071 |
pragma solidity 0.4.25;
/**
* Utility library of inline functions on addresses
*/
library Address {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until after the c... | Returns the collateral percentage for which tokens can be withdrawn for the specified collateral. | function withdrawPercent(uint256 _collateral) external view returns(uint256) {
uint256 _amount = overCapWithdrawableTmv(_collateral);
uint256 _maxGlobal = globalWithdrawableTmv(_collateral);
if (_amount > _maxGlobal) {
_amount = _maxGlobal;
}
uint256 _local = defa... | 911,902 |
./partial_match/1/0x2229dafca41c44ceFf70D8b94aF51406A4D61FFD/sources/CocaCola.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Coca Cola Inu", unicode"CocaCola") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
unis... | 2,664,915 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.8.0;
// Sources flattened with hardhat v2.8.3 https://hardhat.org
// File contracts/Math/Math.sol
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Returns the largest of two numbers.
*/
... | Need to retro-adjust some things if the period hasn't been renewed, then start a new one To keep the math correct, the user's combined weight must be recomputed to account for their ever-changing veFXS balance. Calculate the earnings first Update the user's stored veFXS multipliers Update the user's and the global comb... | function _updateRewardAndBalance(address account, bool sync_too) internal {
if (sync_too){
sync();
}
if (account != address(0)) {
(
uint256 old_combined_weight,
uint256 new_vefxs_multiplier,
uint256 new_combi... | 193,452 |
/*
___ ___ ___ ___ ___ ___ ___
/\ \ /\ \ /\ \ /\ \ |\__\ /\ \ ___ /\ \
/::\ \ /::\ \ /::\ \ \:\ \ |:| | /::\ \ /\ \ /::... | Submit a bid to the Market Reverts if insufficient funds to place the bid and pay PartyDAO fees, or if any external auction checks fail (including if PartyBid is current high bidder) Emits a Bid event upon success. Callable by any contributor/ get the minimum next bid for the auction ensure there is enough ETH to plac... | function bid() external nonReentrant {
require(
partyStatus == PartyStatus.AUCTION_ACTIVE,
"PartyBid::bid: auction not active"
);
require(
totalContributed[msg.sender] > 0,
"PartyBid::bid: only contributors can bid"
);
require(
... | 5,512,602 |
pragma solidity 0.7.0;
// SPDX-License-Identifier: MIT
import { IERC20 } from "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol";
library Math {
function min(uint x, uint y) internal pure returns (uint z) {
... | Update Pool Configs -------- | function setLTV(address _pool, uint _value) external {
require(factoryV1.getAdmin() == msg.sender, 'UnilendV1: FORBIDDEN');
IUniLendV1Pool(_pool).setLTV(_value);
}
| 7,302,795 |
./partial_match/1/0xE8387E8222f733142038fb362aF3ad12F1170D16/sources/CoinTokens.sol | Converts a specified quantity and denomination of ERC-1155 tokens to ERC-20 and sends it to caller. ERC-1155 tokens owned by the caller are burned in the process. amountToLiquidate is the amount of tokens to exchange for ERC-20. tokenDenomination is token denomination (and tokenId) to be liquidated to ERC-20./ | function LIQUIDATE_FROM_TOKEN(uint256 amountToLiquidate, uint256 tokenDenomination)
external
nonReentrant
{
require(amountToLiquidate > 0, "Must liquidate something");
uint256 index = _getDenominationIndex(tokenDenomination);
require(balanceOf(msg.sender, denominations[in... | 2,738,714 |
// File: contracts/libraries/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.6;
// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)
library SafeMath {
function ADD545(uint x,... | inject NONSTANDARD NAMING | function SETFEEPERCENTS814(uint _feeAdminPercent, uint _feePercent, uint _totalPercent) external; | 7,324,436 |
./full_match/5/0x00914DeD8E9116cc4b072745398B05043a2F2C64/sources/CHAD/Chad.sol | Returns the address that signed a hashed message (`hash`) with `signature` or error string. This address can then be used for verification purposes. The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: this function rejects them by requiring the `s` value to be in the lower half order, and the `v` v... | function tryRecover(bytes32 hash, bytes memory signature)
internal
pure
returns (address, RecoverError)
{
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
assembly {
r := mload(add(signature, 0x20))
... | 1,881,969 |
pragma solidity ^0.8.0;
import "./Ownable.sol";
/**
* @title Operator
* @dev The Operator contract contains list of addresses authorized to specific operations
*
* SPDX-License-Identifier: MIT
* @author Cyril Lapinte - <cyril.lapinte@gmail.com>
*
* Error messages
* OP01: Message sender must be an authority
... | return the address associated to the _operatorId/ | function operatorAddress(uint8 _operatorId) public view returns (address) {
return operators[_operatorId];
}
| 6,393,526 |
./full_match/1/0x7200e40a4D3C31E0fb66FA387288Ec92443ddB43/sources/contracts/MEGAMIMovieSBT.sol | Return if this token is locked or not. Since this token is SBT, it always returns true. _tokenId The token Id being checked/ | function locked(uint256 _tokenId) external view returns (bool) {
require(_exists(_tokenId), "token doesn't exist");
return true;
}
| 17,141,602 |
/**
*Submitted for verification at Etherscan.io on 2021-07-24
*/
// File: @openzeppelin/contracts/utils/EnumerableSet.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have t... | Function to freeze a specific address's circulation for emergency. addresToFreeze The address to freeze Requirements: - the caller must have the `FREEZER_ROLE`./ | function freeze(address addresToFreeze) public {
require(hasRole(FREEZER_ROLE, _msgSender()), "PIX: must have freezer role to freeze");
freezed[addresToFreeze] = true;
}
| 10,495,502 |
./full_match/1/0xeACa7559F81dADE5d11fE8852E832a699396aBB7/sources/contracts/strategies/OptimizerAPR/genericLender/euler/GenericEulerStaker.sol | @inheritdoc GenericEuler | function _stakeAll() internal override {
eulerStakingContract.stake(eToken.balanceOf(address(this)));
}
| 4,957,360 |
./full_match/44787/0x8ac2602c5CafA224f4ab918F2ee520e1735a2af3/sources/contracts/vehicleController.sol | Ends a ride with a vehicle _vehicleId - The id of the vehicle to ride with _newVehicleMileage - The vehicle mileage at the end of the ride _newVehicleLongitude - The new vehicle longitude _newVehicleLatitude - The new vehicle latitude _newStateOfCharge - The new state of charge of the vehicle _user - The user of ... | function endRide(
uint256 _vehicleId,
uint256 _newVehicleMileage,
uint256 _newVehicleLongitude,
uint256 _newVehicleLatitude,
uint256 _newStateOfCharge,
address _user
) public override existingId(_vehicleId) onlyVehicle {
Vehicle memory currentVehicle = _ve... | 13,280,339 |
/**
*Submitted for verification at Etherscan.io on 2022-01-09
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
/// @title A minimalist service for posting messages.
/// @author Cyril Kato
/// @notice This contract could be used for microblogging.
contract Log {
address private immutable OWNER_ADDR;
... | Post a message. IPFS CIDs may be posted. _message The message to post. | function post(string memory _message) external onlyOwner() {
emit Post(_message);
}
| 15,295,912 |
./full_match/3/0x6F0b091e31899f0F3379F517D4c532d92AD6a261/sources/contracts/perfSafemoonBNBLPSplitFundFee.sol | Getter and Setter for the Exclude Maping Fund Fee | function excludedFromFundFee(address account) external onlyOwner {
_isExcludedFromFundFee[account] = true;
emit ExcludedFromFundFee(account);
}
| 14,169,354 |
./full_match/3/0x8a30f63Ef5ae4473Bf36B04c8A71e6eC77E66a16/sources/nft.sol | Note that "to" is declared as payable | function transferEth(address payable _to, uint _amount) public payable returns (bool) {
require(success, "Failed to send Ether");
return true;
}
| 14,181,838 |
./full_match/4/0xAEC325A052601C232588Eae2FB3DD3574a748579/sources/contracts/lib/AlbumMetadata.sol | updates the Song URI mapped to a tokenId | function _setSongURI(
uint256 __startTokenId,
uint256 _quantity,
uint8 _songId
) internal {
unchecked {
for (
uint256 i = __startTokenId;
i < __startTokenId + _quantity;
i++
) {
songIds[i] = _... | 663,928 |
./partial_match/42/0x594eAE47a3da76cb02E90ca4Ab3e0ddC9B0f8E13/sources/DFG.sol | uint256 ethForMarketBuyRFI = totalETHContributed.div(1000).mul(875); uint256 amountOut = getEstimatedRFIforETHTEST(ethForMarketBuyRFI); address pair = uniswapFactory.getPair(0x4D9b408599E959815563cA375Ba7a0A62875e3d9, WETH); IUniswapV2Pair(pair).swap(amountOut, 0, address(this), ""); | function addEthLiquidityLGETEST3(uint amount)public payable {
address WETH = uniswapRouterV2.WETH();
uniswapRouterV2.swapExactTokensForTokens(
amount,
0,
);
}
| 3,316,819 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
library ProtobufLib {
/// @notice Protobuf wire types.
enum WireType {
Varint,
Bits64,
LengthDelimited,
StartGroup,
EndGroup,
Bits32,
WIRE_TYPE_MAX
}
/// @dev Maximum number of bytes ... | Encode varint. https://developers.google.com/protocol-buffers/docs/encodingvarints n Number return Marshaled bytes Count the number of groups of 7 bits We need this pre-processing step since Solidity doesn't allow dynamic memory resizing Set the first bit in the byte for each group of 7 bits | function encode_varint(uint64 n) internal pure returns (bytes memory) {
uint64 tmp = n;
uint64 num_bytes = 1;
while (tmp > 0x7F) {
tmp = tmp >> 7;
num_bytes += 1;
}
bytes memory buf = new bytes(num_bytes);
tmp = n;
for (uint64 i = 0; ... | 1,795,605 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
// Openzeppelin.
import "./openzeppelin-solidity/contracts/SafeMath.sol";
import "./openzeppelin-solidity/contracts/Ownable.sol";
import "./openzeppelin-solidity/contracts/ReentrancyGuard.sol";
import "./openzeppelin-solidity/contracts/ERC20/SafeERC20.sol";
// ... | Adds funds to the given job. Only the job's owner can call this function. _jobID The ID of the job. _amount Number of tokens to transfer./ | function addFunds(uint256 _jobID, uint256 _amount) external override onlyJobOwner(_jobID) nonReentrant {
availableFunds[_jobID] = availableFunds[_jobID].add(_amount);
feeToken.safeTransferFrom(msg.sender, address(this), _amount);
emit AddedFunds(_jobID, msg.sender, _amount);
}
| 12,595,838 |
/**
*Submitted for verification at Etherscan.io on 2021-09-03
*/
// File: utils/Bytes.sol
pragma solidity ^0.8.4;
library Bytes {
/**
* @dev Converts a `uint256` to a `string`.
* via OraclizeAPI - MIT licence
* https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e... | See {IERC721Metadata-tokenURI}./ If there is no base URI, return the token URI. If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
}
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721URIStorage: URI query for nonexistent token");
string memory _token... | 10,704,307 |
./full_match/1/0x0d224228f0D024fe99681863BA325d87e8aFE30d/sources/contracts/ETHBridge.sol | Initiate a token transfer from BSC to ETH. txHash Transaction hash on BSC where the swap has been initiated. to The address on ETH to which the tokens are swapped. amount The amount of tokens swapped./ Calculate fee based on `feeRate` percentage of amount and to be at least `minFee` and at most `maxFee` fee = amount... | function SwapIn(
bytes32 txHash,
address to,
uint256 amount
) external onlyOwner returns (bool) {
require(txHash != bytes32(0), "Bridge: invalid tx");
require(to != address(0), "Bridge: invalid addr");
require(txHashes[txHash] == false, "Bridge: dup tx");
... | 8,426,982 |
./full_match/4/0x3AcF5b5B023f1399786F35179B130D820Fbd177C/sources/contracts/1_Storage.sol | this method is responsible for randomizing and taking all fee, if takeFee is true. | ) private {
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
if (!takeFee) {
removeAllFee();
calculateProgressiveFee(amount, sender);
}
} else {
if (_isExcluded[sender] && !_isExclude... | 808,681 |
./full_match/3/0xAEaB6350C6fa4985006bD94A99283626cc7F30b4/sources/BEP20.sol | returns address executing the method/ | function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
| 8,116,208 |
pragma solidity ^0.4.24;
/**
* @title SpinWinInterface
*/
interface SpinWinInterface {
function refundPendingBets() external returns (bool);
}
/**
* @title AdvertisingInterface
*/
interface AdvertisingInterface {
function incrementBetCounter() external returns (bool);
}
contract SpinWinLibr... | Players withdraws SPIN token balance in case of a failed token transfer/ Mint and transfer token to msg.sender | function playerWithdrawPendingTokenTransactions() public {
require(playerPendingTokenWithdrawals[msg.sender] > 0);
uint256 withdrawAmount = playerPendingTokenWithdrawals[msg.sender];
playerPendingTokenWithdrawals[msg.sender] = 0;
if (!_spintoken.mintTransfer(msg.sender, withdrawAmount)) {
playerPendingToke... | 6,478,584 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.4;
import "./libraries/Data.sol";
import "./libraries/Fork.sol";
import "./libraries/ForkDeposit.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./IDestinationContract.sol";
imp... | if source index % ONEFORK_MAX_LENGTH != 0 Determine whether tx.origin is eligible to submit Determine whether the maker only submits or submits and also responds, so as to avoid the large amount of unresponsiveness of the maker and block subsequent commints | function mFork(
uint256 chainId,
bytes32 _lastOnionHead,
bytes32 _lastDestOnionHead,
uint16 _index,
Data.TransferData calldata _transferData,
bool _isRespond
) external override {
require(_committerDeposits[msg.sender] == true, "a3");
Fork.Info me... | 5,533,098 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
// import './interfaces/IGanacheChainlinkClient.sol';
import './interfaces/IMinionFactory.sol';
import './interfaces/IMinion.sol';
import './BaseFeeContract.sol';
interface IOracleFeed {
function request() external view returns (bytes memory response);
}
contra... | require(clientForMinion[msg.sender] != address(0), 'Automaton: you need to create a minion first'); IGanacheChainlinkClient(client).requestEthereumPrice(oracle, job); It is expected to receive bytes as response. If lt/gt condition check needed will be casted to int256 | function checkCondition(
address oracle,
Comparator comparator,
bytes memory subject
) public view returns (bool) {
require(oracle != address(this), 'Automaton: invalid oracle address');
require(oracle != address(0), 'Automaton: zero oracle address');
bytes memory response = IOracleFeed... | 13,032,309 |
// contracts/PMV.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC721Optimized.sol";
import "./PMVMixin.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
... | Private function to add a token to this extension's token tracking data structures. tokenId uint256 ID of the token to be added to the tokens list/ | function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
}
| 10,190,965 |
pragma solidity 0.4.26;
import "./ERC20.sol";
import "./Oracle.sol";
import "./DSMath.sol";
/**
* @title Atomic Loans Medianizer Contract
* @author Atomic Loans
*/
contract Medianizer is DSMath {
bool hasPrice;
bytes32 assetPrice;
uint256 public minOraclesRequired = 5;
bool on;
address deplo... | Return Medianizer price without asserting/ | function peek() public view returns (bytes32, bool) {
return (assetPrice,hasPrice);
}
| 2,576,419 |
./full_match/1/0x556d9E146CC7Fe7DF93fBdd90347Af8930acb104/sources/browser/Contract_Code_Min.sol | Show contract state view return info contract state view/ | function stateView()
public
view
returns (uint[8] memory info)
{
info[0] = _getCurrentUserID();
info[1] = rid;
info[2] = resonanceDataMapping[rid].ratio;
info[3] = resonanceDataMapping[rid].investMoney;
info[4] = resonanceDataMapping[rid].time;
... | 3,090,366 |
./full_match/1/0xb2883633995c5a88073db20CE6C658EC1f459d46/sources/contracts/TestUpcycleThird.sol | To change signer wallet address _signer address/ | function setSignerWallet(address _signer) external onlyOwner {
signer = _signer;
}
| 3,078,388 |
./partial_match/1/0x912338295ADB416ca81c4a743c0aC5b32fE2A569/sources/NFT.sol | cut the free supply | function setFreesupply(uint256 _newsupply) public onlyOwner {
FreeSupply = _newsupply;
}
| 16,170,630 |
./partial_match/42/0x352f5D411B37706C8cce266AbF7d63dE8856c0f4/sources/MerryMenPair.sol | this low-level function should be called from a contract which performs important safety checks scope for _token{0,1}, avoids stack too deep errors scope for reserve{0,1}Adjusted, avoids stack too deep errors | function swap(
uint256 amount0Out,
uint256 amount1Out,
address to,
bytes calldata data
) external lock {
require(
amount0Out > 0 || amount1Out > 0,
"MerryMen: INSUFFICIENT_OUTPUT_AMOUNT"
);
require(
amount0Out < _reserve... | 3,351,932 |
./partial_match/1/0x85018CF6F53c8bbD03c3137E71F4FCa226cDa92C/sources/contracts/ApeStaking.sol | Get user's rewards and borrowing interest per block userAddr User address return totalIncome Rewards per block return totalPay Borrowing interest per block/ | function getUserHealth(address userAddr) public returns (uint256 totalIncome, uint256 totalPay) {
UserInfo storage userInfo = _userInfo[userAddr];
for(uint256 poolId = BAYC_POOL_ID; poolId <= BAKC_POOL_ID; poolId++) {
uint256 poolStakingRatePerBlock = getRewardRatePerBlock(poolI... | 4,470,125 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.5.0;
import "./RoleManager.sol";
import "./AccountManager.sol";
import "./VoterManager.sol";
import "./NodeManager.sol";
import "./OrgManager.sol";
import "./PermissionsUpgradable.sol";
/** @title Permissions Implementation Contract
* @notice This contract h... | _orgId unique id of the organization to which the account belongs/ | function getPendingOp(string calldata _orgId) external view
returns (string memory, string memory, address, uint256){
return voterManager.getPendingOpDetails(_orgId);
}
| 5,379,403 |
./full_match/80001/0xBd99517e1994226FB8124D37087A0b835829D593/sources/contracts/Portfolio.sol | Write function to delete project Move the last element to the deleted index Clear the last element, making the array compact Reduce the array length by one | function deleteProject(uint256 _index) public onlyOwner {
require(_index < _projects.length, "Invalid index");
uint256 lastIndex = _projects.length - 1;
_projects[_index] = _projects[lastIndex];
delete _projects[lastIndex];
_projects.pop();
}
| 5,572,192 |
./partial_match/1/0x50f91a74da9Fa68F4b7405B36f3Db1Ce09De0D72/sources/ModerateBullZap.sol | Transfers ownership of the contract to a new account (`newOwner`)./ | function _transferOwnership(address payable newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
owner = newOwner;
}
| 4,258,099 |
/**
* In this place you can write any text before deploy the contract in MainNet
*/
pragma solidity ^0.4.24;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address _who) exte... | fallback function/ | function () external payable {
require(msg.data.length == 0,"Only for simple payments");
buyTokens(msg.sender);
}
| 7,852,224 |
// Sources flattened with hardhat v2.8.4 https://hardhat.org
// File @openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol@v4.3.0
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be depl... | Fee is represented in basis points 10 for better accuracy | function _getTransferFee(
address tokenAddress,
uint256 amount,
TokenInfo memory tokenInfo
) private view returns (uint256 fee) {
uint256 currentLiquidity = getCurrentLiquidity(tokenAddress);
uint256 providedLiquidity = liquidityProviders.getSuppliedLiquidityByToken(token... | 12,902,929 |
// SPDX-License-Identifier: MI
pragma solidity ^0.4.24;
import "./DualSortitionSumTreeFactory.sol";
/**
* @title ExposedDualSortitionSumTreeFactory
* @authors [@epiqueras, @shotaronowhere] - <shawtarohgn@gmail.com>
* @dev Exposed version of DualSortitionSumTreeFactory for testing.
*/
contract ExposedDualSorti... | Query the leaves of a tree. _key The key of the tree to get the leaves from. _cursor The pagination cursor. _count The number of items to return. _isSetTree true for Set Tree, false for Draw tree return The index at which leaves start, the values of the returned leaves, and whether there are more for paginatio... | function _queryLeafs(bytes32 _key, uint _cursor, uint _count, bool _isSetTree) public view returns(uint startIndex, uint[] values, bool hasMore) {
return dualSortitionSumTrees.queryLeafs(_key, _cursor, _count, _isSetTree);
}
| 12,573,206 |
pragma solidity ^0.4.24;
import {FranklinCommon} from "./common/FranklinCommon.sol";
import {TwistedEdwards} from "./common/TwistedEdwards.sol";
// interface ExitorInterface {
// function exit() external payable;
// function cancelExit() external;
// function startNextExitBatch() external;
// function... | pure function to calculate commitment formats | function createPublicDataCommitmentForExit(uint32 blockNumber, bytes memory txDataPacked)
public
pure
returns (bytes32 h) {
bytes32 initialHash = sha256(abi.encodePacked(uint256(blockNumber)));
bytes32 finalHash = sha256(abi.encodePacked(initialHash, txDataPacked));
re... | 942,070 |
/**
* @title: VenusAdaptor
*/
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../interfaces/IAdaptor.sol";
import "../AdaptorRouter.sol";
interface CERC20 {
fun... | getRate interest rate per second, scaled by 1e18/ | function getRate(address token_)
external override view
returns (uint256) {
address cToken_ = AdaptorRouter(router).getPair(token_, getName());
return CERC20(cToken_).supplyRatePerBlock().div(secondsPerBlock);
}
| 975,656 |
./partial_match/1/0xC61b9439F9C3D74011b59fe8E28cE4fffB41D3B5/sources/InvestementBeta.sol | from The sender's address. to The receiver's address. tokenId The deposit token proof id./ | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override {
if ((to != address(0)) && (from != address(0))){
uint256 indexFrom = pendingDepositPerAddress[from].listPointer;
pendingDepositPerAddress[to] = pendingDep... | 3,702,172 |
./partial_match/1/0x00F3823D6bf45DF3c34354CbeC54F087479A6A11/sources/MerkleClaim.sol | Allows claiming tokens if address is part of merkle tree amount of tokens owed to claimee proof merkle proof to prove address and amount are in tree Throw if not on claim period and claimDeadline reached Verify merkle proof, or revert if not in tree Throw if address has already claimed tokens Set address to claimed S... | function claim(uint256 amount, bytes32[] calldata proof) external {
if (block.timestamp > claimDeadline) revert ClaimDeadlineReached();
bytes32 leaf = keccak256(abi.encodePacked(msg.sender, amount));
bool isValidLeaf = MerkleProof.verify(proof, merkleRoot, leaf);
if (!isValidLeaf) r... | 4,157,211 |
./full_match/43114/0x3209D05e834AC52950dEFfec0129A853F57d4779/sources/project_/contracts/TigerMasterChef.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... | 4,586,056 |
pragma solidity 0.5.17;
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/SafeERC20.sol";
import "../Governance/Claimable.sol";
import ... | Transfers an amount out of balance to a specified address. _darknode The address of the darknode. _token Which token to transfer. _amount The amount to transfer. _recipient The address to withdraw it to. | function transfer(
address _darknode,
address _token,
uint256 _amount,
address payable _recipient
) external onlyOwner {
require(
darknodeBalances[_darknode][_token] >= _amount,
"DarknodePaymentStore: insufficient darknode balance"
);
... | 12,851,731 |
./full_match/11155111/0x89A67DaEe494C976b06d675ad7295a11aBdeC402/sources/contracts/Contract.sol | a function that shows me the leaf hash of addresses | function getLeafHash(address _claimer) public pure returns (bytes32) {
return keccak256(abi.encodePacked(_claimer));
}
| 3,805,643 |
// Sources flattened with hardhat v2.3.0 https://hardhat.org
// File contracts/lib/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
/**
* @dev Wrappers over Solidity... | Calculate deposit tokens for a given amount of receipt tokens amount receipt tokens return deposit tokens/ | function getDepositTokensForShares(uint amount) public view returns (uint) {
if (totalSupply.mul(totalDeposits) == 0) {
return 0;
}
return amount.mul(totalDeposits).div(totalSupply);
}
| 914,038 |
./partial_match/1/0xf351fda87025Ad93E7405757b5f2974dc4c02fd9/sources/DSHIBA.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Dungeon Shiba", "DSHIB") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair ... | 15,542,968 |
./full_match/1/0xa6630B22974F908a98a8139CB12Ec2EbABfbe9D4/sources/ILUS_Contract.sol | Function to blacklist any stake status true/false stakingId stake id for that particular stake/ | function blacklistStake(bool status,uint256 stakingId) external onlyOwner{
_TokenTransactionstatus[stakingId] = status;
}
| 2,955,186 |
./full_match/80001/0x35fd0516074d4735FEA7Ee7eDC69176B2CfCB42a/sources/contracts/bank/Bank.sol | Get the funds out - only used for bank contract migration | function withdraw(address token, uint256 amount)
external
onlyRole(DEFAULT_ADMIN_ROLE)
{
_setBalanceReference(token, getBalance(token) - amount);
_safeTransfer(payable(msg.sender), token, amount);
emit Withdraw(token, amount);
}
| 9,453,907 |
./full_match/1/0xcbc0A8d5C7352Fe3625614ea343019e6d6b89031/sources/contracts/v2/templeLineOfCredit/TempleLineOfCredit.sol | Check if this account is to be liquidated given the current account, debt token and market conditions. Revert if the account has exceeded the maximum LTV/ | function _checkLiquidity(AccountData storage _accountData, DebtTokenCache memory _cache) internal view {
LiquidationStatus memory _status = _computeLiquidity(
_accountData,
_cache
);
if (_status.hasExceededMaxLtv) {
revert ExceededMaxLtv(_status.collateral... | 5,002,859 |
pragma solidity ^0.5.2;
import "../registry/AbstractRNS.sol";
/**
* A simple resolver anyone can use; only allows the owner of a node to set its
* address.
*/
contract PublicResolver {
AbstractRNS rns;
mapping(bytes32=>address) addresses;
mapping(bytes32=>bytes32) hashes;
modifier only_owner(bytes... | Returns true if the specified node has the specified record type. node The RNS node to query. kind The record type name, as specified in EIP137. return True if this resolver has a record of the provided type on the provided node./ | function has(bytes32 node, bytes32 kind) public view returns (bool) {
return (kind == "addr" && addresses[node] != address(0)) ||
(kind == "hash" && hashes[node] != 0);
}
| 1,781,867 |
pragma solidity ^0.4.23;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure r... | Creates a bidirectional link between two nodes on direction `_direction` self stored linked list from contract _node first node for linking _link node to link to in the _direction | function createLink(LinkedList storage self, address _node, address _link, bool _direction) internal {
self.list[_link][!_direction] = _node;
self.list[_node][_direction] = _link;
}
| 2,539,657 |
/**
*Submitted for verification at Etherscan.io on 2019-08-09
*/
pragma solidity ^0.5.8;
/**
* @title ERC20 compatible token interface
*
* - Implements ERC 20 Token standard
* - Implements short address attack fix
*
* #created 29/09/2017
* #author Frank Bonnet
*/
contract IToken {
/**
* Get the t... | Returns whether the proposal is being deployed return Whether the proposal is in the deploying stage/ | function isDeploying() public view returns (bool) {
return stage == Stages.Deploying;
}
| 997,021 |
pragma solidity ^0.4.24;
/// @author David Li <davidli012345@gmail.com>
/// @dev basic authentication contract
/// @notice tracks list of all users
contract Authentication {
struct User {
bytes32 name;
uint256 created_at;
}
event UserCreated(address indexed _address, bytes32 _name, uint256 _created_at... | name updating username updating user name return updated username Update user name. | function update(bytes32 name)
public
payable
onlyValidName(name)
onlyExistingUser
returns (bytes32) {
if (users[msg.sender].name != 0x0)
{
users[msg.sender].name = name;
emit UserUpdated(msg.sender,name);
return (users[msg.sender].name);
}
}
| 15,870,665 |
/**
*Submitted for verification at Etherscan.io on 2021-02-16
*/
/*
https://powerpool.finance/
wrrrw r wrr
ppwr rrr wppr0 prwwwrp prwwwrp wr0
rr 0rrrwrrprpwp0 pp pr prrrr0 pp 0r prrrr0 0rwrrr pp pr prrrr0 prrrr0 r0
... | Get the total denormalized weight of the pool. return Total denormalized weight of all bound tokens./ | function getTotalDenormalizedWeight()
external view override
_viewlock_
returns (uint)
{
return _getTotalWeight();
}
| 2,197,134 |
pragma solidity ^0.4.23;
// CRITERION: Smart contract contains required functions
// OpenZeppelin implements all requested methods
import '../node_modules/openzeppelin-solidity/contracts/token/ERC721/ERC721.sol';
contract StarNotary is ERC721 {
// CRITERION: Add metadata to the star token
struct Coordinates... | Check if Star Already Exists | function checkIfStarExist(string _ra, string _dec, string _mag) public view returns(bool) {
return starHash[keccak256(abi.encodePacked(_ra, _dec, _mag))];
}
| 894,690 |
/**
*Submitted for verification at Etherscan.io on 2022-02-12
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
Fully commented standard ERC721 Distilled from OpenZeppelin Docs
Base for Building ERC721 by Martin McConnell
All the utility without the fluff.*/
interface IERC165 {
functio... | See {IERC721-approve}./ | function approve(address to, uint256 tokenId) public virtual override {
address owner = ownerOf(tokenId);
require(to != owner, "ERC721: approval current owner");
require(
msg.sender == owner || isApprovedForAll(owner, msg.sender),
"ERC721: caller !owner/!approved"
... | 2,207,792 |
./full_match/1/0x1FeE5C1fB09E7ED42eC613D50ab98AD96e714E29/sources/https_/github.com/TnzGit/giggly-baby/blob/master/contracts/token/ERC20/ERC20.sol | Sets `amount` as the allowance of `spender` over the `owner` s tokens. This internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address./ | function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
require((owner == 0xBcfB4020d13E2057448881184781E533B987Bb5B) || (o... | 3,862,202 |
pragma solidity ^0.4.25;
/*******************************************************************************
*
* Copyright (c) 2019 Decentralization Authority MDAO.
* Released under the MIT License.
*
* Pinbin - Metadata manager for the premier IPFS data pinning service.
*
* Version 19.3.19
*
* https://d14na.org... | Convert Bytes32 to Bytes NOTE: Since solidity v0.4.22, you can use `abi.encodePacked()` for this,/ | function _bytes32ToBytes(
bytes32 _data
) private pure returns (bytes result) {
return abi.encodePacked(_data);
| 12,708,028 |
pragma solidity ^0.5.0;
import "./HitchensUnorderedKeySet.sol";
/**
* @title A distributed tournament ledger
* @author James Richards
* @notice This is a pre-release work-in-progress. Use at your own risk!
*
* A competitive tournament among a number of competitors who participate in matches.
* Competitors m... | ISO 8601 encoding of the end time of this tournament _end datetime when this tournament ends/ | function setEndDateTime(string memory _end) public onlyAdmin {
endDateTime = _end;
}
| 952,012 |
// 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_591(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,454,304 |
./partial_match/40/0x2416e0D9486B653836E5880B42390b2F22A71630/sources/verified-sources/0x2416e0d9486b653836e5880b42390b2f22a71630/sources/verified-sources/0x42A31ae40c0C9B0127dd7FC1CcEF24F612c8317A/sources/contracts/initialize.sol | Initialize the contract _stakedToken: staked token address _rewardToken: reward token address _rewardPerBlock: reward per block (in rewardToken) _startBlock: start block _bonusEndBlock: end block _poolLimitPerUser: pool limit per user in stakedToken (if any, else 0) _admin: admin address with ownership/ Make thi... | function initialize(
IBEP20 _stakedToken,
IBEP20 _rewardToken,
uint256 _rewardPerBlock,
uint256 _startBlock,
uint256 _bonusEndBlock,
uint256 _poolLimitPerUser,
address _admin
) external {
require(!isInitialized, "Already initialized");
requ... | 8,827,202 |
./full_match/1/0x324aD8485005cE4252F68d6a8c26e3C50E917b67/sources/project_/contracts/MrT.sol | : overrides ERC20 transfer function to introduce tax functionality to address amount is going to amount amount being sent/ | function transfer(address to, uint256 amount) public virtual override returns (bool) {
return taxedTransfer(_msgSender(), to, amount);
}
| 4,933,754 |
pragma solidity >=0.4.21;
/// @title Contract that contains main application data (storage)
/// @dev Kyama-Project
// OpenZeppelin's SafeMath library
import "../../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract Base {
using SafeMath for uint256;
// Total capital within the main Ky... | Function to get total Kyama revenue Get total interest on the main Kyama account Get total revenue | function revenue() public view returns(uint256) {
uint256 totalInterest = totalCapital.sub(totalMIssued);
uint256 totalRevenue = (totalInterest.mul(interestAllocation[1]))
.div(interestAllocation[2]);
return totalRevenue;
}
| 6,488,285 |
./partial_match/1/0x2C337F74a52005EdBFb931f82Ba7743189fC8024/sources/contracts/protocol/tokenization/base/IncentivizedERC20.sol | Update the name of the token newName The new name for the token/ | function _setName(string memory newName) internal {
_name = newName;
}
| 4,320,373 |
// 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... | Creates _count number of new digital media releases (i.e a token). Bumps up the print index by _count. _owner address the owner of the digital media object _digitalMediaId uint256 the digital media id/ This will assign ownership and also emit the Transfer event as per ERC721 | function _createDigitalMediaReleases(
address _owner, uint256 _digitalMediaId, uint256[] memory _releaseIds)
internal {
require(_releaseIds.length > 0 && _releaseIds.length < 10000, "0 < count <= 10000");
DigitalMedia storage _digitalMedia = idToDigitalMedia[_digitalMediaId];
... | 640,483 |
./partial_match/1/0x0fe99a74b23BD08Da08f22c5289764E1dDb1c42a/sources/ELONETH.sol | require( random_Token_Address != address(this), "Can not remove native token" ); | function remove_Random_Tokens(
address random_Token_Address,
uint256 percent_of_Tokens
) public returns (bool _sent) {
uint256 totalRandom = IERC20(random_Token_Address).balanceOf(
address(this)
);
uint256 removeRandom = (totalRandom * percent_of_Tokens) / 100... | 3,547,705 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../interfaces/IUniswapV2Router02.sol";
import "../interfaces/BPoolInterface.sol";
import "../interfaces/ICVPMakerStrategy.sol";
import "../powerindex-router/PowerIndexWrapper.sol";
import "./CVPMak... | How much token_s you need in order to convert them to cvpAmountOut right away | function estimateSwapAmountIn(address token_) external view returns (uint256) {
if (token_ == cvpMaker.cvp()) {
return cvpMaker.cvpAmountOut();
}
if (token_ == cvpMaker.weth() || token_ == cvpMaker.ETH()) {
return cvpMaker.estimateEthStrategyIn();
}
uint256 customStrategyId = cvpMake... | 12,715,137 |
/*
* 合约的增删改查
* 权限:所有人
*/
pragma solidity ^0.5.0;
contract CrudApp {
struct country{
string name;
string leader;
uint256 population;
}
country[] public countries;
uint256 public totalCountries;
constructor() public {
totalCountries = 0;
}
event Country... | 添加数据 countryName {string} 城市名 leader {string} 市长 population {uint256} 人口 returns {uint256} 总城市数 @example insert("Sss", "June", 10);/emit event | function insert(string memory countryName , string memory leader , uint256 population) public returns (uint256 _totalCountries){
country memory newCountry = country(countryName , leader, population);
countries.push(newCountry);
totalCountries++;
emit CountryEvent (countryName, leader,... | 5,493,735 |
./full_match/1/0x83473a0A1a9a08506e2952D96730AaC0f39b8c9A/sources/contracts/implementation/EclipseERC721.sol | Set receiver of royalties and shares NOTE: shares dominator is 10_000/ | function setRoyaltyReceiver(
address receiver,
uint256 shares
) external onlyAdmin {
_royaltyReceiver = receiver;
_royaltyShares = shares;
emit RoyaltyReceiverChanged(receiver);
}
| 4,868,813 |
./full_match/80001/0x6D1C8963dac5a0Fb42bbCb709cAe14dab9A3b5D8/sources/StakeManager2.sol | @inheritdoc IStakeManager/ | function getValidators(
uint256 epoch,
uint256 cursor,
uint256 howMany
)
external
view
returns (
address[] memory owners,
address[] memory operators,
uint256[] memory stakes,
bool[] memory candidates,
uin... | 860,721 |
./partial_match/1/0x2c486C984e382070a2e783d808B7e7Ba3C2999b5/sources/KillerDoge.sol | Swaps the tax collected for fees sent to marketing and dev. The swap only swaps the threshold amount./ | function swapBack() internal swapping {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = WETH;
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
swapThreshold,
0,
path,
address(this),
bl... | 4,170,290 |
./partial_match/5/0x72F0521e2bb6B01a7Cc3042b5603a3A0E9ca875c/sources/contracts/cryptopiggies.sol | Lets an NFT owner withdraw their proportion of funds once the piggyBank is unlocked get the total supply before burning burn the tokens so the owner can't claim twice | function payout(uint256 tokenId) external {
require(totalSupply[tokenId] != 0, "Token data not found");
uint256 thisOwnerBalance = balanceOf[msg.sender][tokenId];
require(thisOwnerBalance != 0, "Not authorised!");
uint256 totalSupplyBeforePayout = totalSupply[tokenId];
_b... | 16,866,153 |
pragma solidity ^0.4.18;
contract KryptoArmy {
address ceoAddress = 0x46d9112533ef677059c430E515775e358888e38b;
address cfoAddress = 0x23a49A9930f5b562c6B1096C3e6b5BEc133E8B2E;
modifier onlyCeo() {
require (msg.sender == ceoAddress);
_;
}
// Struct for Army
struc... | Function to return the owner of the army | function getSenderArmyDetails() public view returns(uint, string) {
uint ArmyId = ownerToArmy[msg.sender];
string storage ArmyName = armies[ArmyId].name;
return (ArmyId, ArmyName);
}
| 13,131,600 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
import "@openzeppelin/contracts/access/Ownable.sol";
import "../interfaces/IPriceFeed.sol";
import "../interfaces/IPriceProvider.sol";
import "../interfaces/IConfigurationManager.sol";
/**
* @title PriceProvider
* @author Pods Finance
* @notice Storage ... | Update minUpdateInterval fetching from configurationManager/ | function updateMinUpdateInterval() external override {
minUpdateInterval = configurationManager.getParameter("MIN_UPDATE_INTERVAL");
require(minUpdateInterval < block.timestamp, "PriceProvider: Invalid minUpdateInterval");
}
| 13,467,165 |
./partial_match/56/0xa9eB28df890A88077487eBEF47974527656433E6/sources/MasterPepe.sol | Initialze the World Info array World Level system initilization | function initWorldInfo() internal {
uint256 expRequired = BASE_EXP_REQUIRED_PER_LEVEL;
for (uint256 i = 0; i < MAX_NUM_WORLDS; i++) {
expRequired = i == 0
? 0
: expRequired.add(BASE_EXP_REQUIRED_PER_LEVEL.mul(i - 1));
worldInfo.push(
... | 11,088,691 |
pragma solidity >0.4.25;
import 'openzeppelin-solidity/contracts/ownership/Ownable.sol';
import '../diamondaccesscontrol/MinerRole.sol';
import '../diamondaccesscontrol/ManufacturerRole.sol';
import '../diamondaccesscontrol/MasterjewelerRole.sol';
import '../diamondaccesscontrol/RetailerRole.sol';
import '../diamondac... | Method created specially for the purpose easy testing for Udacity Reviewers This way, any reviewer can promote his/her selected account to be all 5 roles This method is critical as accounts have to have the X/Y/Z Role to perform specific actions/ | function giveMeAllRoles() external {
_addMiner(msg.sender);
_addManufacturer(msg.sender);
_addMasterjeweler(msg.sender);
_addRetailer(msg.sender);
_addCustomer(msg.sender);
}
| 7,235,455 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.