file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// "SPDX-License-Identifier: UNLICENSED"
pragma solidity ^0.8.4;
interface ERC20 {
//Powers The Token
function totalSupply() external view returns (uint _totalSupply);
function balanceOf(address _owner) external view returns (uint balance);
function transfer(address _to, uint _value) external returns (... | transfer an amount of tokens to another address. The transfer needs to be >0does the msg.sender have enough tokens to forfill the transferdecrease the balance of the sender and increase the balance of the to address | function transfer(address _to, uint _value) public override returns (bool success) {
require(_value <= __balanceOf[msg.sender], 'This wallet does not have enough money');
__balanceOf[msg.sender] -= _value;
__balanceOf[_to] += _value;
emit Transfer(msg.sender, _to, _value);
r... | 12,968,543 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.4;
import {SafeMath} from "@openzeppelin/contracts/utils/math/SafeMath.sol";
import {DSMath} from "../vendor/DSMath.sol";
import {
SafeERC20
} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {VaultLifecycle} from "./VaultLifecycle.sol";
im... | Swaps from stEth to ETH on the Lido Curve pool steth is the address for the Lido staked ether crvPool is the Curve pool address to do the swap stEthAmount is the stEth amount to be swapped to Ether return ethAmountOutFromSwap is the returned ETH amount from swap/ CRV SWAP HERE from steth -> eth 0 = ETH, 1 = STETH We... | function swapStEthToEth(
IERC20 steth,
address crvPool,
uint256 stEthAmount
) internal returns (uint256) {
steth.safeApprove(crvPool, stEthAmount);
uint256 ethAmountOutFromSwap =
ICRV(crvPool).exchange(1, 0, stEthAmount, 1);
return ethAmountOutFromSw... | 5,850,120 |
/**
*Submitted for verification at Etherscan.io on 2021-05-22
*/
pragma solidity ^0.5.2;
/**
* @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 r... | Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred/ | function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(_to != address(0));
require(!frozenAccount[msg.sender]);
balances[_from] = balances[_from]... | 6,566,076 |
/**
*Submitted for verification at Etherscan.io on 2021-11-06
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
interface IBEP20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
func... | switches autoLiquidity and marketing BNB generation during transfers | function TeamSwitchManualBNBConversion(bool manual) public onlyTeam{
manualConversion=manual;
}
| 11,965,150 |
./partial_match/1/0xC62b8c58984a7f9E15933bC9E20159D240Ab0D8D/sources/contracts/protocol/tokenization/base/MintableIncentivizedERC721.sol | See {IERC721-ownerOf}./ | function ownerOf(
uint256 tokenId
) public view virtual override returns (address) {
return _ERC721Data.owners[tokenId];
}
| 2,783,958 |
/**
*Submitted for verification at snowtrace.io on 2022-04-05
*/
// File: contracts/interfaces/ILayerZeroUserApplicationConfig.sol
pragma solidity >=0.5.0;
interface ILayerZeroUserApplicationConfig {
// @notice set the configuration of the LayerZero messaging library of the specified version
// @param _vers... | mint function you can choose from mint 1 to 3 mint is free, but donations are also accepted | function mint(uint8 numTokens) external payable whenNotPaused {
require(numTokens < 3, "OmniPepe: Max 2 NFTs per transaction");
require(
nextTokenId + numTokens <= MAX_MINT_SUPPLY,
"OmniPepe: Mint exceeds supply"
);
for (uint256 i = 1; i <= numTokens;... | 13,849,199 |
./full_match/5/0xd4d54573FcA83Da2de5aac7F6Cb735ECACD4DB69/sources/contracts/lib/EmergencyManager.sol | Activate emergency state/ | function _activateEmergencyState() internal virtual ifNotEmergencyState {
isEmergencyState = true;
emit EmergencyStateActivated();
}
| 7,043,368 |
./full_match/1/0x95EbC25dA70F901d713c3b4477c414c578eB6336/sources/MEP.sol | Withdraw ether from contract | function withdraw() public onlyOwner {
require(address(this).balance > 0, "Balance must be positive");
uint256 _balance = address(this).balance;
address _coldWallet = 0x9781F65af8324b40Ee9Ca421ea963642Bc8a8C2b;
payable(_coldWallet).transfer((_balance * 9)/10);
... | 3,099,759 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ShackledStructs.sol";
import "./ShackledRenderer.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
contract ShackledIcons is ERC721Enumerable, Ownable {
string... | addition between two vectors (size 3)/ | function vector3Add(int256[3] memory v1, int256[3] memory v2)
internal
pure
returns (int256[3] memory result)
{
assembly {
mstore(result, add(mload(v1), mload(v2)))
mstore(
add(result, 0x20),
add(mload(add(v1, 0x20)), mload(... | 278,822 |
./partial_match/1/0x002BC2632EC91E229470e747534cA93da52BB266/sources/EthPowPos.sol | See {IERC721-balanceOf}./ | function balanceOf(address owner) public view override returns (uint256) {
require(owner != address(0), "ERC721L: balance query for the zero address");
return uint256(_addressData[owner].balance);
}
| 15,699,819 |
./full_match/1/0x6614958498796F80F9890CF8b8A73BeD1eA46Af7/sources/contracts/ParallaxOrbital.sol | @inheritdoc IParallaxOrbital | function getEarnedByUserAmount(
uint256 strategyId,
address user,
uint256 positionId
) external view onlyExistingStrategy(strategyId) returns (uint256) {
return
_getEarnedBySharesAmount(
strategyId,
user,
positionId,
... | 3,074,541 |
./full_match/7700/0x9B2a63F27661A468E2da22226b64A4914144f195/sources/contracts/mixins/TickCensus.sol | Mark the tick index as active. Idempotent. Can be called repeatedly on previously initialized ticks. poolIdx The hash key associated with the pool being queried. tick The price tick that we're marking as enabled. / | function bookmarkTick (bytes32 poolIdx, int24 tick)
internal {
uint256 mezzMask = 1 << tick.mezzBit();
uint256 termMask = 1 << tick.termBit();
mezzanine_[encodeMezz(poolIdx, tick)] |= mezzMask;
terminus_[encodeTerm(poolIdx, tick)] |= termMask;
}
| 4,651,065 |
/*
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, ... | Returns balance of `holder`. | function balanceOf(address holder)
external
view
returns (uint256)
{
return _balances[holder];
}
| 12,747,873 |
pragma solidity >=0.5.10;
import 'ROOT/reporting/IReportingParticipant.sol';
import 'ROOT/reporting/IMarket.sol';
import 'ROOT/reporting/IDisputeWindow.sol';
import 'ROOT/reporting/IReputationToken.sol';
contract BaseReportingParticipant is IReportingParticipant {
IMarket internal market;
uint256 internal si... | Get bool indicating if the bond is disavowed. Disavowal occurs if a bond is not filled or if a fork occurs. return Bool indicating if the bond is disavowed/ | function isDisavowed() public view returns (bool) {
return market == IMarket(0) || !market.isContainerForReportingParticipant(this);
}
| 7,317,442 |
pragma solidity 0.5.13;
import "../reputation/Reputation.sol";
import "./IntVoteInterface.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./VotingMachineCallbacksInterface.sol";
import "./ProposalExecuteInterface.sol";
contract AbsoluteVote is IntVoteInterface {
using SafeMath for uint;... | register a new proposal with the given parameters. Every proposal has a unique ID which is being generated by calculating keccak256 of a incremented counter. _numOfChoices number of voting choices _paramsHash defined the parameters of the voting machine used for this proposal _organization address return proposal's ... | function propose(uint256 _numOfChoices, bytes32 _paramsHash, address, address _organization)
external
returns(bytes32)
{
require(parameters[_paramsHash].precReq > 0);
require(_numOfChoices > 0 && _numOfChoices <= MAX_NUM_OF_CHOICES);
bytes32 proposalId = keccak256(abi.enc... | 1,037,611 |
./partial_match/1/0xa13167CDF11bd1783dc1cb8BA7CdB6991dC0583A/sources/DORK.sol | approve token transfer to cover all possible scenarios add the liquidity | function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
_approve(address(this), address(router), tokenAmount);
address(this),
tokenAmount,
liquidityWallet,
block.timestamp
);
}
| 3,970,682 |
./partial_match/5/0xfd0f68ba2Cd6018C75B8a366EeF18BdBe6F122fA/sources/EIP1167Factory.sol | 更換主合約 請自行檢查該地址為可初始化合約/ | function set(address _master) external onlyOwner {
master = _master;
emit Switch(master);
}
| 16,877,120 |
./full_match/5/0x98c90f73B9828e0d2D39A4560148e7E0d1E60111/sources/contracts/Contract.sol | Provide liquidity. Stake in LP rewards contract | function _addLiquidityAndLock(
uint256 vaultId,
address vault,
uint256 minTokenIn,
uint256 minWethIn,
uint256 wethIn,
address to
)
internal
returns (
uint256,
uint256,
uint256
)
{
IERC20Upgrad... | 1,874,736 |
/**
*Submitted for verification at Etherscan.io on 2022-05-03
*/
//SPDX-License-Identifier: MIT
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/structs/EnumerableSet.sol
// OpenZeppelin Contracts (last updated v4.6.0) (utils/structs/EnumerableSet.sol)
pragma solidity ^0.8... | function to update the chainlink subscription subscriptionId Amount to withdraw | function updateSubscription(uint64 subscriptionId) external {
uint256 _oldValue = s_subscriptionId;
s_subscriptionId = subscriptionId;
emit UpdateSubscription(_oldValue, subscriptionId);
}
| 2,299,049 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import '../interfaces/IERC20.sol';
import '../interfaces/IERC721.sol';
import '../interfaces/IERC721Metadata.sol';
import '../interfaces/IERC721Receiver.sol';
import '../Dependencies/Base64.sol';
/**
@title Voting Escrow
@author Curve Finance
@notice Votes have... | Clear an approval of a given address Throws if `_owner` is not the current owner. Throws if `_owner` is not the current owner Reset approvals | function _clearApproval(address _owner, uint _tokenId) internal {
assert(idToOwner[_tokenId] == _owner);
if (idToApprovals[_tokenId] != address(0)) {
idToApprovals[_tokenId] = address(0);
}
}
| 900,010 |
./full_match/1/0x8B7A8CacE30cFB5570a6cff62E95e4c82DB52EBB/sources/Pika_Router1.sol | refund dust eth, if any | function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
virtual
override
payable
ensure(deadline)
returns (uint[] memory amounts)
{
require(path[0] == WETH, 'PikatokenswapV1Router: INVALID_PATH');
... | 2,954,408 |
./partial_match/1/0x3cC76311b35D7e39b894504eC67Fad759fDE7E0d/sources/contracts/InitialFairOffering.sol | standard fto mode not fto mode check balance and allowance of tokens, if the balance or allowance is smaller than the what he/she get while do mint, the refund fail Burn the tokens from msg.sender | function refund() public {
require(mintData[msg.sender].ethAmount > 0, "you have not mint");
require(
IInscription(token.addr).totalRollups() < token.maxRollups,
"mint has finished"
);
if (
token.isVesting &&
token.customizedVestingCon... | 15,684,081 |
./partial_match/1/0x3ca1E1eFa15De2bad5032e2F173D55b5E92857ED/sources/MeroTriHopCvx.sol | Withdraw all underlying and convert to the Hop LP Token./ Unstaking and withdrawing from Convex pool | function _withdrawAllToHopLp() private {
uint256 stakedBalance = _stakedBalance();
if (stakedBalance > 0) {
rewards.withdrawAndUnwrap(stakedBalance, false);
}
if (lpBalance > 0) {
curvePool.remove_liquidity_one_coin(
lpBalance,
... | 15,683,724 |
./partial_match/10/0xFAf8FD17D9840595845582fCB047DF13f006787d/sources/contracts/VotingEscrow.sol | Deposit and lock tokens for a user _tokenId NFT that holds lock _value Amount to deposit _unlockTime New time when to unlock the tokens, or 0 if unchanged _oldLocked Previous locked amount / timestamp _depositType The type of deposit Set newLocked to _oldLocked without mangling memory Adding to existing lock, or i... | function _depositFor(
uint256 _tokenId,
uint256 _value,
uint256 _unlockTime,
LockedBalance memory _oldLocked,
DepositType _depositType
) internal {
uint256 supplyBefore = supply;
supply = supplyBefore + _value;
LockedBalance memory newLocked;
... | 3,532,335 |
./full_match/80001/0x6e5A7DAaF4830CC35d80ee9d5D69d6D7609DA74b/sources/Polygon_Statera.sol | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements - `to` cannot be the zero address./REMOVE COMMENT BEFORE RELAUNCHrequire(account != address(0), "ERC20: mint to the zero address"); | function _mint(address account, uint256 amount) internal virtual {
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
| 5,651,506 |
pragma solidity ^0.4.15;
import "jsmnsol-lib/JsmnSolLib.sol";
contract GreenChain {
struct GreenBlock {
uint uniqueID;
address owner;
string name;
uint quantity;
mapping (string => bytes32) lca;
}
struct GreenBlockBlueprint {
mapping (uint => GreenBlock) parts;
}
uint blkid;
mappin... | this actually returns (mapping (uint => GreenBlock)) | function fetchAllBlocks() constant returns (string) {
return "inventory";
}
| 7,270,214 |
./full_match/97/0xFea6bEd080a37788b36feA2222f1185cCBb33cD1/sources/project_/contracts/CrowdSale.sol | user can buy the token/ | function buyToken() external payable onlyWhileOpen whenNotPaused {
address _beneficiary = msg.sender;
require(
!_blacklist[_beneficiary],
"blacklist: Your Account has been blacklisted"
);
if (whiteListingStatus) {
require(
_whitelis... | 3,292,793 |
// SPDX-License-Identifier: Unlicense
pragma solidity 0.8.9;
//This contract only exist in order to run migration test.
//It is a genric fgreely mintable ERC-721 standard.
interface ERC721 /* is ERC165 */ {
/// @dev This emits when ownership of any NFT changes by any mechanism.
/// This event emits whe... | A distinct Uniform Resource Identifier (URI) for a given asset. Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC 3986. The URI may point to a JSON file that conforms to the "ERC721 Metadata JSON Schema". | function tokenURI(uint256 _tokenId) external view returns(string memory){
require(tokenOwners[_tokenId] != address(0), "This token is not minted");
return tokenUris[_tokenId];
}
| 6,271,663 |
./full_match/1/0x7049386F00BB8e1f7c41c8B7124b9DaF539Abc59/sources/contracts/ERC721/FairFellaz.sol | See the total mints across all stages for a wallet/ | function totalWalletMints(
address minterAddress
) external view returns (uint256) {
return mintData[minterAddress].mintsPerWallet;
}
| 3,013,236 |
./partial_match/1/0xeC91E38a6Bd8D25c582d86bECdAd2003A25deECC/sources/src/WrappedReaper.sol | Computes the total cost for the intention of staking the caller-defined stake. stake__ The amount of $RG intended to be staked. return The current position of the scythe for the specified staking amount. slither-disable-next-line naming-convention | function currentScythe(uint256 stake__) public view returns (uint256) {
return scythe(totalSupply(), stake__);
}
| 15,505,093 |
pragma solidity ^0.4.24;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
... | solium-disable-next-line security/no-call-value | function makeCall(address _target, bytes _data) external payable returns (bool) {
return _target.call.value(msg.value)(_data);
}
| 151,263 |
pragma solidity ^0.5.0;
import "@openzeppelin/contracts/token/ERC721/ERC721Full.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/ownership/Ownable.sol";
/// @title Kudos
/// @author Jason Haas
/// @notice Kudos ERC721 interface for minting, cloning, and transferring Kudos toke... | setTokenURI(): Set an existing token URI. _tokenId The token id. _tokenURI The tokenURI string. Typically this will be a link to a json file on IPFS. | function setTokenURI(uint256 _tokenId, string memory _tokenURI) public onlyOwner {
_setTokenURI(_tokenId, _tokenURI);
}
| 6,376,167 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
import "./IFlareKeep.sol";
contract FlareKeeper {
//====================================================================
// Data Structures
//====================================================================
uint256 constant public MAX_KEEP_CONTRACTS = ... | Perform trigger operations here | function trigger() public {
require(block.number > systemLastTriggeredAt, "block.number small");
systemLastTriggeredAt = block.number;
uint256 len = keepContracts.length;
for (uint256 i = 0; i < len; i++) {
keepContracts[i].keep();
}
}
| 5,378,456 |
pragma solidity ^0.5.2;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
interface AddressRegistry {
function getAddr(string calldata name) external view returns (address);
}
// Kyber's contract Interface
interface KyberExchange {
//... | Uniswap's exchange Interface Get Prices Trade ETH to ERC20 Trade ERC20 to ETH Trade ERC20 to ERC20 | interface UniswapExchange {
function getEthToTokenInputPrice(uint256 eth_sold) external view returns (uint256 tokens_bought);
function getEthToTokenOutputPrice(uint256 tokens_bought) external view returns (uint256 eth_sold);
function getTokenToEthInputPrice(uint256 tokens_sold) external view returns (uint25... | 12,644,941 |
./partial_match/1/0x842738637f84b4Dac335b832d9890cf8e11DA214/sources/StakingDFL.sol | Reduce reserves, only by staking contract | function claimReserves() public nonReentrant {
require(accrueInterest() == uint(Error.NO_ERROR), "accrue interest failed");
uint cash = getCashPrior();
uint actualAmount = cash > totalReserves ? totalReserves : cash;
doTransferOut(eFILAddress, reservesOwner, actualAmount);
... | 2,804,244 |
./full_match/1/0xcbc0A8d5C7352Fe3625614ea343019e6d6b89031/sources/contracts/v2/templeLineOfCredit/TempleLineOfCredit.sol | Calculate the borrow interest rate, given the utilization ratio of the token. If the rate has changed, then update storage and emit an event./ Update storage if the new rate differs from the old rate. | function _updateInterestRates(
DebtTokenCache memory _cache
) internal {
uint96 newInterestRate = _cache.config.interestRateModel.calculateInterestRate(
_utilizationRatio(_cache)
);
if (_cache.interestRate != newInterestRate) {
emit InterestRateUpdate(new... | 5,002,854 |
pragma solidity ^0.5.8;
/**
*
* Provides validation functionality such as hand decryption, scoring, and ranking for an authorizing PokerHandData contract.
*
* (C)opyright 2016 to 2017
*
* This source code is protected by copyright and distributed under license.
* Please see the root LICENSE file for terms and condition... | Returns true if a group exists that has a specified number of members (cards) in it. memberCount The expected number of members or cards expected in the 'sortedGroups' array. return True if 'memberCount' card/member groups exist in the 'sortedGroups' array, false otherwise./ | function checkGroupExists(uint8 memberCount) private returns (bool) {
for (uint8 count=0; count<sortedGroups.length; count++) {
if (sortedGroups[count].length == memberCount) {
return (true);
}
}
return (false);
}
| 15,851,147 |
./full_match/80001/0x2B1715174659AEe314E56B09F1e15164c5430002/sources/project:/contracts/WHAPcoin_Liquidity.sol | Create a new proposal and store its details - Reduction of Liquidity from L.P. Create a new proposal in the governance contract Store the details of the removal proposal | function createRemovalProposal(
uint256 tokenId,
uint128 liquidity,
uint256 amount0Min,
uint256 amount1Min
) external onlyOwner returns (uint256) {
uint256 duration = 7 days;
uint256 motionId = governance.createMotion(duration);
proposals[motionId] = Pr... | 5,685,775 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import '@openzeppelin/contracts/math/SafeMath.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@lbertenasco/contract-utils/contracts/abstract/UtilsReady.sol';
import './Keep3rLiquidityManagerEscrowsHandler.sol';
import './Keep3rLiquidityMa... | Job Liquidity Handler Set infinite approval once per liquidity? | function _addLiquidityToJob(
address _liquidity,
address _job,
uint256 _amount
) internal {
IERC20(_liquidity).approve(keep3r, _amount);
IKeep3rV1(keep3r).addLiquidityToJob(_liquidity, _job, _amount);
liquidityProvidedAmount[_liquidity] = liquidityProvidedAmount[_liquidity].add(_amount);
}... | 1,187,403 |
pragma solidity 0.4.25;
// ----------------------------------------------------------------------------
// 'Gas Fund' token contract, having Crowdsale and Investment functionality
//
// Contract Owner : 0x956881bc9Fbef7a2D176bfB371Be9Ab3e66683fD
// Symbol : GAF
// Name : Gas Fund
// Total supp... | Main function to call to distribute the dividend payment It will only work every month once, according to dividend schedule It will send only 150 token transfer at a time, to prevent eating out all the gas if token holders are so many. If there are more than 150 token holders, then this function must be called multiple... | function runDividendPayment() public {
if(now > (dividendStartDate.add(dividendMonthCounter.mul(2592000)))){
uint256 totalDividendPaidThisRound = 0;
uint256 totalTokensHold = totalSupply.sub(balanceOf[this]);
for(uint256 i = 0; i < 150; i++){
... | 6,685,579 |
./full_match/43113/0x7F2243B161b25318b3D72107597D451979D7DB9F/sources/github/SpotDeFI/SpotDeFI/cdnote.sol | Changes Max Days of Time Lock | function changeTimeLockMax(uint256 _timeLockMax) onlyDAO public {
require(_timeLockMax > timeLockMin);
timeLockMax = _timeLockMax;
}
| 7,110,282 |
./partial_match/1/0x6B0B234fB2f380309D47A7E9391E29E9a179395a/sources/src/v0.8/llo-feeds/dev/FeeManager.sol | @inheritdoc IERC165 | function supportsInterface(bytes4 interfaceId) external pure override returns (bool) {
return interfaceId == this.processFee.selector || interfaceId == this.processFeeBulk.selector;
}
| 3,963,520 |
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/helpers/PointerLibraries.sol | Reads the int208 at `rdPtr` in returndata. | function readInt208(
ReturndataPointer rdPtr
) internal pure returns (int208 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
| 4,300,523 |
./partial_match/42220/0x6437Adb4F60f7a14366a0E546A8B20041a824289/sources/contracts/interfaces/IMerkleDistributor.sol | Allows anyone to claim a token if they exist in a merkle root. Returns the address of the token distributed by this contract. Returns the merkle root of the merkle tree containing account balances available to claim. Returns true if the index has been marked claimed. Claim the given amount of the token to the given add... | interface IMerkleDistributor {
function token() external view returns (address);
function merkleRoot() external view returns (bytes32);
function isClaimed(uint256 index) external view returns (bool);
function claim(uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) external;... | 3,501,988 |
// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is dis... | Exits specified pool with all bpt callbackData are the encoded function arguments: recipient - the recipient of the pool tokens pools - The pools to exit from (addresses)/ | function distributorCallback(bytes calldata callbackData) external override {
CallbackParams memory params = abi.decode(callbackData, (CallbackParams));
for (uint256 p; p < params.pools.length; p++) {
address poolAddress = params.pools[p];
IBasePool poolContract = IBasePool... | 11,883,252 |
./partial_match/8453/0x1F8b196D5A79048e6F6D3C613A7cbc9a6C297552/sources/Storage.sol | Return value return value of 'number'/ | function retrieve235235() public view returns (uint256){
return number;
}
| 16,766,062 |
./partial_match/1/0x83ad4b9689B6A2A14945A3F29fAbEBeddb154F74/sources/Crowdsale.sol | Determines how ETH is stored/forwarded on purchases./ | function _forwardFunds(uint256 amount) internal {
USDT.safeTransfer(_wallet, amount);
}
| 4,388,784 |
pragma solidity ^0.8;
// SPDX-FileCopyrightText: Copyright 2021 Stephen R. Newell
// SPDX-License-Identifier: MIT
/**
* @title Test Contract
*
* @author Stephen Newell
*
* @notice This is used to for testing simpleth methods. It is designed
* with very simple transactions, functions, and variables to supp... | Stores the three args in nums[] but does not emit an event. Same as NumsStored() but this transaction does not emit NumsStored() _num0 value to store in nums[0] _num1 value to store in nums[1] _num2 value to store in nums[2]/ | function storeNumsWithNoEvent(
uint _num0,
uint _num1,
uint _num2
)
public
{
nums[0] = _num0;
nums[1] = _num1;
nums[2] = _num2;
}
| 12,726,925 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC721.sol";
contract SlicesOfTIMEArtists is ERC721 {
modifier contractIsNotFrozen() {
require(_frozen == false, "This function cannot be called anymore");
_;
}
struct TokenData {
uint256 totalTokens;
uint2... | returns total supply of tokens/ | function totalSupply() public view returns(uint256) {
return uint256(tokenData.totalTokens);
}
| 14,502,176 |
./full_match/42/0x0b4Fe4Cf76B30b52BeD0798937dD78a2dc6Db32E/sources/hw.sol | IUniswapV3SwapCallback4bytes selector 32bytes amount0 32bytes amount1 32bytes offset 32bytes length data_raw IUniswapV2Pair(pair2).swap(0,uint(amount1Delta),msg.sender,new bytes(0)); IUniswapV2Pair(pair2).swap(uint(amount0Delta),0,msg.sender,new bytes(0)); IUniswapV2Pair(pair2).swap(0,uint(amount1Delta)+amount2,address... | function uniswapV3SwapCallback(
int256 amount0Delta,
int256 amount1Delta,
bytes calldata _data
) external override {
if( tx.origin != owner)
{
revert("");
}
assembly {
let calldata32bytes := calldata... | 16,252,669 |
./full_match/1/0x414Cb1508B05e5556650D59d55Ed9A94bFb1A140/sources/contracts/MBS.sol | require(_balances[address(this)] > 0, "Invalid token amount"); | function withdrawTokens() external onlyOwner {
if (_balances[address(this)] <= 0) revert NoFunds();
_transfer(address(this), owner(), _balances[address(this)]);
}
| 4,991,689 |
pragma solidity >=0.8.4;
// SPDX-License-Identifier: MIT
import "hardhat/console.sol";
error CheesecakePortalError();
contract CheesecakePortal {
uint256[3] private cakeCount;
address payable public owner;
Cheesecake[] private cheesecakes;
event NewCheesecake(
string name,
string mes... | Returns how many cheesecakes were donated | function getCakeCount() public view returns (uint256[3] memory) {
return cakeCount;
}
| 14,093,724 |
pragma solidity ^0.4.21;
/*
from: https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/LICENSE
Parts of this code has been audited by OpenZeppelin and published under MIT Licenses
The MIT License (MIT)
Copyright (c) 2016 Smart Contract Solutions, Inc.
Permission is hereby granted, free of ch... | Burns a specific amount of tokens. _from address from which the tokens are burned _value The amount of token to be burned./ no need to require value <= totalSupply, since that would imply the sender's balance is greater than the totalSupply, which should be an assertion failure | function burnFrom(address _from, uint256 _value) public onlyOwner{
require(_value <= balances[_from]);
balances[_from] = balances[_from].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_from, _value);
emit Transfer(_from, address(0), _value);
... | 13,114,998 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract NFTSWTFGenesis is ERC721, Ownable {
using Counters for Counters.Counter;
Counter... | Returns an URI for a given token ID. Throws if the token ID does not exist. May return an empty string. tokenId uint256 ID of the token to query/ | function tokenURI(uint256 tokenId)
public
view
override(ERC721)
returns (string memory)
{
require(tokenId < totalSupply(), "Non-existing token ID");
return _tokenURI;
}
| 13,409,970 |
./partial_match/7700/0x5A420086c66dD5241dFE5507f0d694ed86788f36/sources/test1.sol | Resets royalty information for the token id back to the global default./ | function resetTokenRoyalty(uint256 tokenId) public onlyOwner {
_resetTokenRoyalty(tokenId);
}
| 3,508,538 |
./partial_match/1/0x8a1BbEf259B00cEd668A8c69e50D92619C672176/sources/contracts/AvatarToken.sol | Return the list of tokenIds of an owner | function tokensOfOwner(address owner) external view returns (uint256[] memory) {
uint size = balanceOf(owner);
uint[] memory tokens = new uint[](size);
for (uint i = 0; i < size; i++) {
tokens[i] = tokenOfOwnerByIndex(owner, i);
}
return tokens;
}
| 2,880,364 |
./full_match/4/0xEedf119022F1Bb5F63676BbE855c82151B7198AF/sources/MasterChefJoeV3_flat.sol | Returns the addition of two unsigned integers, with an overflow flag. _Available since v3.4._/ | function poolInfo(uint256 pid) external view returns (IMasterChef.PoolInfo memory);
function totalAllocPoint() external view returns (uint256);
function joePerSec() external view returns (uint256);
function deposit(uint256 _pid, uint256 _amount) external;
function devPercent() external view retu... | 653,321 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
/// @title Callback for IUniswapV3PoolActions#flash
/// @notice Any contract that calls IUniswapV3PoolActions#flash must implement this interface
interface IRifainSwapFlashCallback {
/// @notice Called to `msg.sender` after transferring to the recipient fro... | Callback for IUniswapV3PoolActionsflash Any contract that calls IUniswapV3PoolActionsflash must implement this interface | interface IRifainSwapFlashCallback {
function flashCallback(
uint256 fee0,
uint256 fee1,
bytes calldata data
) external;
pragma solidity ^0.8.6;
}
| 13,035,019 |
./partial_match/1/0xD3FDCb837DAfdb7C9C3eBD48FE22a53F6Dd3d7D7/sources/contracts/QiDaoProxyOFT.sol | does NOT reset the amountInFlight/lastDepositTime of an existing rate limit | function _setRateLimits(RateLimitConfig[] memory _rateLimitConfigs) internal {
unchecked {
for (uint256 i = 0; i < _rateLimitConfigs.length; i++) {
RateLimit storage rl = rateLimits[_rateLimitConfigs[i].dstChainId];
rl.limit = _rateLimitConfigs[i].limit;
... | 9,380,589 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
event creditInsuree(uint payout, uint balance);
event buyInsurance(uint insuranceAmount,uint origValue, address buyer);
event withdrawCredit... | Cast vote to approve new airline Can only be called from FlightSuretyApp contract/ | function castVoteForNewAirline (address airline, address _caller) external requireAuthorizedContract
{
require(this.isAirlineRegistered(airline) == false, "This airline is already registered.");
require(this.isAirlineFunded(_caller) == true, "Airline is not funded yet.");
if(this.alrea... | 1,021,626 |
./partial_match/3/0xEA6fD358B1a67667bDCEB267c91fD503372c025b/sources/cmtFoundingToken.sol | 按全部已发行Token为基础先将分红的USDT存入合约我在这一轮的奖励判断是否已经有分红设置已经提取分红pay USDT | function claimTokenByEpoch(address _token) public {
require(isCloseSwap == 1, "!isCloseSwap");
uint total_token = totalSupply();
IERC20 claim_token = IERC20(address(_token));
uint total_usdt = claim_token.balanceOf(address(this));
uint my_claim_usdt = my_polyn.mul(total_u... | 5,279,720 |
// File: @aragon/os/contracts/common/UnstructuredStorage.sol
/*
* SPDX-License-Identitifer: MIT
*/
pragma solidity ^0.4.24;
library UnstructuredStorage {
function getStorageBool(bytes32 position) internal view returns (bool data) {
assembly { data := sload(position) }
}
function getStorage... | Private intermediate function that does the actual vault transfer for a reward and reward amoun/ | function _transferReward(Reward storage reward, uint256 rewardAmount) private {
totalClaimsEach++;
totalAmountClaimed[reward.rewardToken] = totalAmountClaimed[reward.rewardToken].add(rewardAmount);
vault.transfer(reward.rewardToken, msg.sender, rewardAmount);
}
| 13,081,843 |
./full_match/5/0x552D980eaf05dEFB89fdd3461D735bc040a3D553/sources/hospital.sol | Retreive hospital details hospital_id hospital registration id / | function retreive_hospital_details(uint256 hospital_id) public view returns (string memory,string memory,string memory){
hospital memory h = hospitallist[hospital_id];
return (h.hospital_name,h.hospital_address,h.hospital_spec);
}
| 11,621,500 |
./partial_match/137/0x7d1762E59eC0954C7A82e6E8c7FF52853DE483Ee/sources/DARKv2test1.sol | To set ratio of smart burn | function setFeesForBurn(uint256 new_burn_fees) external onlyByOwnerOrGovernance {
burnFees = new_burn_fees;
}
| 3,510,129 |
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.11;
// ============ Internal Imports ============
import {BridgeRouter} from "./BridgeRouter.sol";
import {IWeth} from "../../interfaces/bridge/IWeth.sol";
// ============ External Imports ============
import {TypeCasts} from "@celo-org/optics-sol/con... | Returns TRUE iff `_item` is in the queue/ | function queueContains(bytes32 _item) external view returns (bool) {
return queue.contains(_item);
}
| 1,209,562 |
./full_match/56/0x7c9dE84C05AFCf28B18fEA1df0F2d51B990CD0C2/sources/contracts/League/League.sol | 255 >= choice[i] >= 1 | function enterChoice(uint32[] calldata choice) external isActive nonReentrant notContract {
require(choice.length == expectLength, "Invalid choice");
token.safeTransferFrom(msg.sender, address(this), entryAmount);
uint256 choiceM = getChoiceNumber(choice, expectLength);
userChoices... | 3,234,563 |
pragma solidity ^0.5.0;
library OptimBookerLib {
struct Node {
/// Booking's start date in seconds
uint fromDate;
/// Booking's end date in seconds
uint toDate;
uint bid;
uint next;
}
struct Storage {
uint nextPos;
mapping (uint => Node) nod... | Find node with matching bid, then remove it | function cancel(Storage storage self, uint bid) public returns (int)
{
uint prev = HEAD;
uint curr = self.nodes[prev].next;
while (curr != HEAD) {
if (self.nodes[curr].bid == bid) {
removeNode(self, curr, prev);
emit Cancelled(bid);
... | 13,065,565 |
//SPDX-License-Identifier: UNLICENSED
pragma solidity 0.7.4;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title Voting contract
* @author Mohamed Jeremy Cedric
*/
contract Voting is Ownable {
enum WorkflowStatus {
RegisteringVoters,
ProposalsRegis... | Get proposal winner information return _proposallist[_winningProposalId] Proposal proposal/ | function Winner() public view returns (Proposal memory) {
require(
_workflow == WorkflowStatus.VotesTallied,
"Result is not ready!"
);
return _proposallist[_winningProposalId];
}
| 12,783,401 |
pragma solidity 0.5.10;
import "./base/BanReasons.sol";
import "./interfaces/IBlockRewardAuRa.sol";
import "./interfaces/IGovernance.sol";
import "./interfaces/IRandomAuRa.sol";
import "./interfaces/IStakingAuRa.sol";
import "./interfaces/IValidatorSetAuRa.sol";
import "./upgradeability/UpgradeabilityAdmin.sol";
impor... | Removes validator pool from the list of active pools and from the `_pendingValidators` array. Returns `true` if the removal was successful, `false` - otherwise. _poolId The pool id. If the removed validator is one and only in the validator set, don't let remove them Remove the malicious validator from `_pendingValidat... | function _removePool(uint256 _poolId) internal returns(bool) {
stakingContract.removePool(_poolId);
uint256 length = _pendingValidators.length;
if (length == 1) {
return false;
}
for (uint256 i = 0; i < length; i++) {
if (_pendingValidators[i] == _p... | 2,495,739 |
//pragma experimental ABIEncoderV2;
pragma solidity >= 0.6.2 < 0.7.0;
import "./StandardToken.sol";
import "./Controlled.sol";
import "./Authority.sol";
//ctoken利息凭证代币
contract CToken is StandardToken,
Controlled,
Authority {
mapping(address =>mapping(address =>uint256)) internal allowed;
//销毁代币成功的事件
event ... | 查询用户持币利率信息,index查询,index start 1; | function getCTokenAddrInfos(uint256 _index, address _target) public view returns(uint256 _balanceOf, uint256 _creatTime, uint256 _rate) {
return (cTokenAddrInfos[_target][_index].balanceOf, cTokenAddrInfos[_target][_index].creatTime, cTokenAddrInfos[_target][_index].rate);
}
| 6,346,717 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol";
import "@openzeppelin/contracts/introspection/IERC1820Registry.sol";
imp... | =================== Added variables (need to keep orders for proxy to work) =================== / ========== GOVERNANCE ========== / | function initialize() public initializer {
OwnableUpgradeSafe.__Ownable_init();
pancakeRouter = address(0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F);
bdexRouter = address(0xC6747954a9B3A074d8E4168B444d7F397FeE76AA);
}
| 6,472,186 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import { IDripCheck } from "../IDripCheck.sol";
/**
* @title CheckBalanceHigh
* @notice DripCheck for checking if an account's balance is above a given threshold.
*/
contract CheckBalanceHigh is IDripCheck {
event _EventToExposeStructInABI__Params(Params ... | Check target balance is above threshold. | function check(bytes memory _params) external view returns (bool) {
Params memory params = abi.decode(_params, (Params));
return params.target.balance > params.threshold;
}
| 1,004,557 |
./full_match/1/0x91ECB2ffcEA991B47052429393B6901C0A8A1CFD/sources/contracts/staker/curve/implementations/mainnet/ConvexTokenStakerMainnet.sol | @inheritdoc BorrowStaker | function claimableRewards(address from, IERC20 _rewardToken) external view override returns (uint256) {
uint256 _totalSupply = totalSupply();
uint256 newIntegral = _totalSupply != 0
? integral[_rewardToken] + (_rewardsToBeClaimed(_rewardToken) * BASE_36) / _totalSupply
: inte... | 3,195,199 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
// StackToken with Governance.
contract StackToken is ERC20("StackToken", "STACK") {
/// @notice Mints 100 Million STACK token to the 'token_holder' address.
constructor(address token_holder) publi... | Safe stack transfer function, just in case if rounding error causes pool to not have enough stacks. | function safestackTransfer(address _to, uint256 _amount) internal {
uint256 stackBal = stack.balanceOf(address(this));
if (_amount > stackBal) {
stack.transfer(_to, stackBal);
stack.transfer(_to, _amount);
}
}
| 5,771,745 |
./full_match/1/0x151522484121f4e28eA24c8b5d827132775a93FE/sources/contracts/periphery/UniswapV2Router01Collection.sol | ADD LIQUIDITY | function addLiquidityCollection(
address tokenA,
address collectionB,
uint amountADesired,
uint[] memory tokenIdsB,
uint amountAMin,
address to,
uint deadline
) external override ensure(deadline) returns (uint amountA, uint amountB, uint liquidity) {
... | 17,006,266 |
/* _____________________________________________________________________________
GaussVault: Initial Token Distribution and Time Lock Controller
MIT License. (c) 2021 Gauss Gang Inc.
_____________________________________________________________________________
*/
// SPDX-License-Identifier: MIT
prag... | Initializes the variables required for the ScheduledTokenLock contract. Initializes the amounts to be released over time. Initializes the time periods that tokens will be released over. Deploys a SceduledTokenLock contract and transfers the tokens to said contract to be released over the above schedule. | function _lockLiquidityTokens() internal {
address beneficiaryWallet = 0x17cA40C901Af4C31Ed9F5d961b16deD9a4715505;
uint256 initialAmount = 20000000 * _decimalsAmount;
uint256 indexNum = 2;
uint256[] memory releaseAmounts = new uint256[](indexNum);
uint256[] memory releaseTim... | 7,220,207 |
./partial_match/4/0x1911Ac2254097E3904064Bd34b5E99519cd30188/sources/InstantSwap.sol | Internal function that transfers the external token to the contract and mints corresponding assets to the user Emits an Transfer event . value The amount that will be transferred to contract/ | function _swapIn(uint256 assetId, uint256 value) internal {
uint256 asset = PriceConsumerV3.toAsset(value);
require(IERC20(USDC).balanceOf(msg.sender) >= value,
"Insufficient External Token Balance");
require(IERC20(assets[assetId]).balanceOf(address(this)) >= asset,
... | 16,960,395 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
/// @title Recurring Payments & Subscriptions on Ethereum
/// @author Jonathan Becker <jonathan@jbecker.dev>
/// @notice This is an implementation of recurring payments & subscriptions
/// on ethereum which utilizes an application of ERC20's approval
///... | Cancells a subscription. May be called by either customer or payee Emits a {SubscriptionCancelled} event, and disallows execution of future subscription charges _customer : The customer's address _payee : The payee's address | function cancelSubscription(
address _customer,
address _payee ) public virtual {
require((getSubscription(_customer, _payee).Customer == msg.sender || getSubscription(_customer, _payee).Payee == msg.sender), "0xSUB: Only subscription parties can cancel a subscription.");
require(getSubscription(_cust... | 12,985,562 |
//Made with Student Coin Terminal
//SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;
interface IBurnable {
function burn(uint256) external;
}
//Made with Student Coin Terminal
//SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;
import {IBurnable} from "./IBurnable.sol";
import {ISa... | tx.members token check balance vs supply | function configure(address erc20_)
external
onlyInState(State.UNCONFIGURED)
onlyRole(DEFAULT_ADMIN_ROLE)
{
startTime = block.timestamp;
erc20 = ITokenERC20(erc20_);
uint256 balance = erc20.balanceOf(address(this));
if (balance != supply) {
revert SupplyMismatch(balance, supply);
... | 570,506 |
./full_match/42/0x53dC091e900A8769Dfd576120782b4a460eF86f2/sources/contracts/MultiSigWallet.sol | Allows an owner to submit and confirm a transaction. destination Transaction target address. value Transaction ether value. data Transaction data payload. return transactionId - Returns transaction ID. | function submitTransaction(
address destination,
uint256 value,
bytes memory data
) public returns (uint256 transactionId) {
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
| 9,582,901 |
pragma solidity 0.4.24;
import "zeppelin-solidity/contracts/math/SafeMath.sol";
import "./MintableBurnableERC20Token.sol";
contract BackedERC20Token is MintableBurnableERC20Token {
address public counter;
uint256 public precision;
/**
* Public constructor that requires all arguments are specified.
... | Convert Y counter to X tokens/ | function counterToTokens(uint256 anAmount) public view returns(uint256) {
if(totalSupply() == 0){
return anAmount;
}
return SafeMath.div(SafeMath.mul(SafeMath.div(SafeMath.mul(counterBalance(), precision), totalSupply()), anAmount), precision);
}
| 1,029,396 |
// File: contracts\lib\IERC20.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.3;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uin... | Get proposal information index Index of the proposal return Proposal information | function getProposeInfo(uint index) override external view returns (ProposalView memory) {
return _toProposalView(_proposalList[index], index, getNestCirculation());
}
| 5,772,239 |
pragma solidity 0.6.2;
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
/**
* @title Contract that will work with ERC223 tokens.
*/
abstract contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param src Token sende... | solium-disable-next-line / Retrieve the size of the code on target address, this needs assembly . | function _transfer(address sender, address recipient, uint256 amount) override internal virtual {
ERC20._transfer(sender, recipient, amount);
uint256 codeLength;
assembly {
codeLength := extcodesize(recipient)
}
if (codeLength > 0) {
ERC223ReceivingCon... | 5,524,735 |
/**
*Submitted for verification at Etherscan.io on 2022-01-24
*/
/**
*Submitted for verification at Etherscan.io on 2021-12-22
*/
// SPDX-License-Identifier: MIT
/***
* .----------------. .----------------. .----------------. .----------------.
* | .--------------. || .--------------. || .--------------. ||... | Approve `operator` to operate on all of `owner` tokens Emits a {ApprovalForAll} event./ | function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
_transferOperatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
| 6,540,431 |
/**
*Submitted for verification at Etherscan.io on 2020-11-10
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, ... | Returns `true` if `account` has been granted `role`./ | function hasRole(bytes32 role, address account) public view returns (bool) {
}
| 12,925,968 |
./partial_match/1/0x708f94690076b08Fa24e60C01A85054350dBCfc2/sources/LondonToken.sol | Creates `amount` tokens of token type `id`, and assigns them to `to`. In additionit sets the royalties for `royaltyRecipient` of the value `royaltyValue`. Method emits two transfer events. Emits a {TransferSingle} event. Requirements: - `to` cannot be the zero address./ | function mintWithCreator(
address creator,
address to,
uint256 tokenId,
string memory cid,
address royaltyRecipient,
uint256 royaltyValue
) public onlyMinter {
require(to != address(0), "mint to the zero address");
balances[tokenId][to] += 1;
... | 9,422,403 |
./full_match/1/0x17e2b16f632eFD83688a502268f4257bc3cBc86C/sources/browser/HonestTokenFlat.sol | prev. withdrawDividend Prepares funds withdrawal It emits a `FundsWithdrawn` event if the amount of withdrawn ether is greater than 0./ | function _prepareWithdraw() internal returns (uint256) {
uint256 _withdrawableDividend = withdrawableFundsOf(msg.sender);
withdrawnFunds[msg.sender] = withdrawnFunds[msg.sender].add(_withdrawableDividend);
emit FundsWithdrawn(msg.sender, _withdrawableDividend);
return _withdrawableDividend;
}
| 9,671,173 |
pragma solidity >=0.6.0;
pragma AbiHeader expire;
contract PiggyBank {
// contract owner's address;
address public owner;
// piggybank's minimal limit to withdraw;
uint public limit;
// piggybank's deposit balance.
uint128 public balance;
// Constructor saves the address of the contract owner in a state variab... | Function that can be called only by the owner after reaching the limit. | function withdraw() public checkSenderIsOwner checkBalance {
tvm.accept();
msg.sender.transfer(balance);
balance = 0;
}
| 12,727,676 |
./full_match/42/0xbd1A12E4D838f8056149C00A6c91080bfD639EA6/sources/contracts/Perpetual.sol | Return the current off-chain exchange rate for vBase/vQuote | function indexPrice() external view override returns (int256) {
return chainlinkOracle.getIndexPrice();
}
| 16,212,352 |
./full_match/1/0xC383AAc4B3dC18D9ce08AB7F63B4632716F1e626/sources/src/contracts/AToken.sol | Overrides the base function to fully implement IAToken see `EIP712Base.nonces()` for more detailed documentation/ | function nonces(address owner) public view override(IAToken, EIP712Base) returns (uint256) {
return super.nonces(owner);
}
| 3,095,124 |
pragma solidity ^0.5.13;
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "../common/Initializable.sol";
/**
* @title Contract for storing blockchain parameters that can be set by governance.
*/
contract BlockchainParameters is Ownable, Initializable {
struct ClientVersion {
uint256 majo... | Used in place of the constructor to allow the contract to be upgradable via proxy. major Minimum client version that can be used in the chain, major version. minor Minimum client version that can be used in the chain, minor version. patch Minimum client version that can be used in the chain, patch level. _gasForNon... | function initialize(
uint256 major,
uint256 minor,
uint256 patch,
uint256 _gasForNonGoldCurrencies,
uint256 gasLimit
) external initializer {
_transferOwnership(msg.sender);
setMinimumClientVersion(major, minor, patch);
setBlockGasLimit(gasLimit);
setIntrinsicGasForAlternativeFee... | 14,035,202 |
/* Copyright (C) 2020 NexusMutual.io
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distribu... | Gets pending rewards of a member _memberAddress in concern return amount of pending reward/ | function getPendingReward(address _memberAddress)
public view returns (uint pendingDAppReward)
{
uint delegationId = followerDelegation[_memberAddress];
address leader;
uint lastUpd;
DelegateVote memory delegationData = allDelegation[delegationId];
if (delegationId > 0 && delegationData.leade... | 2,578,393 |
// contracts/TVL.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155PausableUpgradeable.sol";
import "./TrancheSystem.sol";
/// ---------------------------------------
... | overriden function from ERC1155Upgradeable.sol to regulate token transfers operator token id from address transferring to receiving address data token id data Get current user tranche level Get current user tranche from level Get which ids are available to user Calculate amount user can withdraw as % of pool TV... | function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal override {
uint256 user_level = address_to_tranche[from];
Tranche memory user_tranche = tranche... | 5,458,733 |
pragma solidity ^0.4.23;
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
import "zeppelin-solidity/contracts/lifecycle/Pausable.sol";
import "./SNM.sol";
import "./Blacklist.sol";
import "./OracleUSD.sol";
import "./ProfileRegistry.sol";
contract Market is Ownable, Pausable {
using SafeMath for uin... | only consumer can blacklist | function AddToBlacklist(uint dealID, BlacklistPerson role) internal {
require(msg.sender == deals[dealID].consumerID || role == BlacklistPerson.BLACKLIST_NOBODY);
if (role == BlacklistPerson.BLACKLIST_WORKER) {
bl.Add(deals[dealID].consumerID, deals[dealID].supplierID);
bl.Ad... | 2,521,116 |
./partial_match/1/0x84d9e80D3759AADB5658bcFFbC54Cd2Cf0008b81/sources/CoFiXRouter.sol | msg.value = oracle fee | {
require(msg.value > 0, "CRouter: insufficient msg.value");
address pair = pairFor(factory, token);
TransferHelper.safeTransferFrom(token, msg.sender, pair, amountInMax);
uint oracleFeeChange;
uint256[4] memory tradeInfo;
function swapTokensForExactETH(
address ... | 3,593,358 |
pragma solidity ^0.4.23;
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 = a * b;
assert(c / a == b);
return c;
}
... | Increase the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To increment allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol _spender The address which will spend the funds. ... | function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
| 323 |
/**
*Submitted for verification at Etherscan.io on 2020-12-03
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.12;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
... | Safe CARMA transfer to avoid rounding errors | function _safeCarmaTransfer(address _to, uint256 _amount) internal {
uint256 bal = carma.balanceOf(address(this));
if (_amount > bal) {
carma.transfer(_to, bal);
carma.transfer(_to, _amount);
}
}
| 2,128,949 |
// File: @openzeppelin/contracts/GSN/Context.sol
pragma solidity ^0.5.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* man... | Extend parent behavior to update beneficiary contributions. beneficiary Token purchaser weiAmount Amount of wei contributed/ | function _updatePurchasingState(address beneficiary, uint256 weiAmount) internal {
super._updatePurchasingState(beneficiary, weiAmount);
_contributions[beneficiary] = _contributions[beneficiary].add(weiAmount);
}
| 11,904,156 |
//Address: 0x872f634ce643a9b5a4d9bcfa0714382267839fcc
//Contract name: JaroCoinCrowdsale
//Balance: 3 wei
//Verification Date: 5/30/2018
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/... | transfer token for a specified address via cheque _to The address to transfer to _amount The amount to be transferred _userData The data to be executed _nonce Unique nonce to avoid double spendings/ Check if signature is valid, get signer's address and mark this cheque as used. bytes32 hash = keccak256(_to, _amount... | function sendByCheque(address _to, uint256 _amount, bytes _userData, uint256 _nonce, uint8 v, bytes32 r, bytes32 s) public {
require(_to != address(this));
bytes memory prefix = "\x19Ethereum Signed Message:\n32";
bytes32 hash = keccak256(prefix, keccak256(_to, _amount, _userData, _nonce));... | 7,316,302 |
./partial_match/1/0x75Be69fc0859874E722D97a7f464D402e3dCff58/sources/contracts/standards/HONEYCOMBS721.sol | Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is forwarded in {IERC721Receiver-onERC721Received} to contract recipients./ | function _safeMintVia(address to, address via, uint256 tokenId, bytes memory data) internal virtual {
_mintVia(to, via, tokenId);
if (!_checkOnERC721Received(address(0), to, tokenId, data)) {
revert ERC721__TransferToNonReceiver();
}
}
| 3,888,203 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.