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.4.11;
contract CrowdFunding{
//投資者
struct Investor{
address addr; //投資者的位址
uint amount; //投資額
}
address public owner; //合約擁有者
uint public numInvestors; //投資者數目
uint public deadline; //截止時間(UnixTime)
string public st... | 投資時會被呼叫的函數若是活動已結束的話就中斷處理 | function fund() payable{
require(!ended);
Investor inv = investors[numInvestors++];
inv.addr = msg.sender;
inv.amount = msg.value;
totalAmount += inv.amount;
}
| 5,452,203 |
./full_match/80001/0x254DB172Ac1aA96753580de3619bc1005Ba7F020/sources/contracts/Contract.sol | uint256 currentId = i + 1; | function getAllProperties() public view returns (Property[] memory) {
uint256 itemCount = propertyIndex;
uint256 currentIndex = 0;
Property[] memory items = new Property[](itemCount);
for (uint256 i = 0; i < itemCount; i++) {
uint256 currentId = i;
Property ... | 9,462,568 |
// 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 index % ONEFORK_MAX_LENGTH == 0 If same commiter, don't need deposit Determine whether the maker only submits or submits and responds !!! Whether to add the identification position of the index Locks the new committer's bond, unlocks the previous committer's bond state | function zFork(
uint256 chainId,
bytes32 workForkKey,
address dest,
uint256 amount,
uint256 fee,
bool _isRespond
) external override {
(Fork.Info memory workFork, Fork.Info memory newFork) = hashOnionForks
.createZFork(chainId, workForkKey, des... | 5,533,086 |
./full_match/5/0x01DF690E42e621Bf79E78D952C38e16bc3B497b7/sources/contracts/CrowdFunding.sol | 'payable' denotes there will be some crypto transactions | function donateToCampaign(uint256 _id) public payable{
uint256 amount = msg.value;
Campaign storage campaign = campaigns[_id];
campaign.donators.push(msg.sender);
campaign.donations.push(amount);
if(sent)
campaign.amountCollected= campaign.amountCollected + amount;... | 1,904,137 |
./partial_match/1/0xB02b25158d0875de0A9084eC85768133f97A9828/sources/src/Cassette.sol | Set the address of the kmart contract _kmart Address of the kmart contract/ | function setKmart(address _kmart) public payable onlyOwner {
kmart = _kmart;
}
| 9,352,332 |
/**
*Submitted for verification at Etherscan.io on 2021-06-30
*/
/**
*Submitted for verification at Etherscan.io on 2020-07-14
*/
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. ... | See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`./ | function transfer(address recipient, uint256 amount) virtual public payable override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
| 2,128,663 |
./full_match/5/0x52cbE67E81C61549Dc7115CE1A26D39Ef39f0793/sources/contracts/IMasStaking1155Upgradeable.sol | Set rewards per unit of time. Interpreted as x rewards per second/per day/etc based on time-unit. Only admin/authorized-account can call it. _tokenId ERC1155 token Id. _iMasRewardsPerUnitTime New rewards per unit time./ | function setRewardsPerUnitTime(uint256 _tokenId, uint256 _iMasRewardsPerUnitTime, uint256 _iMasXRewardsPerUnitTime) external virtual {
if (!_canSetStakeConditions()) {
revert("Not authorized");
}
uint256 _nextConditionId = nextConditionId[_tokenId];
StakingCondition memo... | 7,047,540 |
pragma solidity ^0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfe... | _beneficiary Address performing the token purchase _weiAmount Value in wei involved in the purchase _tokenAmount Number of tokens to be purchased/ | function _validatePurchase(
address _beneficiary,
uint256 _weiAmount,
uint256 _tokenAmount
)
internal view
{
require(_beneficiary != address(0));
require(_weiAmount != 0);
require(_tokenAmount >= minPurchase);
require(totalSupply_ + _tokenAmount <= hardCap);
require(block.times... | 1,799,207 |
./full_match/1313161554/0x69cc93FEA4e21c4145bc089Ca13b08bA1f565980/sources/contracts/SwapDepositUnderlying.sol | A simple method to convert amount of underlying to amount in cToken and pass to calculateTokenAmount This shouldn't be used outside frontends for user estimates. amounts an array of token amounts to deposit or withdrawal, corresponding to pooledTokens. The amount should be in each pooled underlying token's native pre... | function calculateTokenAmount(uint256[] calldata amounts, bool deposit)
external
view
returns (uint256)
{
uint256[] memory c_amounts = new uint256[](numPooledToken);
for (uint8 i = 0; i < numPooledToken; i++) {
uint256 amount = amounts[i];
address ... | 13,234,078 |
./full_match/3/0x1185CCCd59906a756717fB175d4d832C8FBABAC6/sources/MoonKat.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("MoonKat", "$MKAT") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = I... | 14,211,696 |
pragma solidity >=0.4.21 <0.7.0;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721Metadata.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "... | Makes sure that the account passed is set as the token's warrantor account address is the address being checked against tokenId uint256 ID is the token in question return matches as bool whether the account is indeed the warrantor of the token/ | function isWarrantor(address account, uint256 tokenId) public view returns(bool matches) {
return account == _claims[tokenId].warrantor;
}
| 7,242,682 |
/**
*Submitted for verification at Etherscan.io on 2020-12-04
*/
// File: @openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in ex... | Max amount of tokens we can get by adding current balance plus what can be minted from collateral Balance on higher reserve side is the sum of what can be minted (collateralTokenBalance) plus existing balance of the token Rb >= Rw, Pb <= Pw Sanity check that we don't exceed actual physical balances In case this happens... | function getVirtualReservesInternal(
IMarket market,
uint256 collateralTokenBalance
) internal view returns (uint256, uint256) {
uint256 bTokenBalanceMax = market.bToken().balanceOf(address(this)).add(
collateralTokenBalance
);
uint256 wTokenBalanceMax = marke... | 10,594,769 |
pragma solidity ^0.4.18;
// File: contracts/IPricingStrategy.sol
interface IPricingStrategy {
function isPricingStrategy() public view returns (bool);
/** Calculate the current price for buy in amount. */
function calculateTokenAmount(uint weiAmount, uint tokensSold) public view returns (uint tokenAmoun... | Function to mint tokens _to The address that will receive the minted tokens. _amount The amount of tokens to mint. return A boolean that indicates if the operation was successful./ | function mint(address _to, uint _amount, bool freeze) canMint onlyMinter external returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
if (freeze) {
freezedList[_to] = true;
}
Mint(_to, _amount);
Transfer(add... | 2,319,186 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implemen... | Returns an abbreviated name for NFTokens. return _symbol Representing symbol./ | function symbol() external view returns (string memory _symbol) {
_symbol = nftSymbol;
}
| 286,316 |
/**
*Submitted for verification at Etherscan.io on 2021-07-11
*/
// 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... | Pauses all token transfers. See {ERC20Pausable} and {Pausable-_pause}. Requirements: - the caller must have the `PAUSER_ROLE`./ | function pause() public virtual {
require(hasRole(PAUSER_ROLE, _msgSender()), "TRAX: must have pauser role to pause");
_pause();
}
| 10,871,479 |
pragma solidity >0.5.4;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20Mintable.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20Burnable.sol";
import "@daostack/arc/contr... | Anyone can call this to trigger calculations. Reserve sends UBI to Avatar DAO and returns interest to FundManager. _interestToken The token that was transfered to the reserve _transfered How much was transfered to the reserve for UBI in `_interestToken` _interest Out of total transfered how much is the interest (in ... | function mintInterestAndUBI(
ERC20 _interestToken,
uint256 _transfered,
uint256 _interest
)
public
requireActive
onlyCDai(_interestToken)
onlyFundManager
returns (uint256, uint256)
{
require(canMint(), "Need to wait for the next interva... | 12,756,937 |
pragma solidity 0.5.10;
contract Context {
constructor () internal { }
function _MSGSENDER793() internal view returns (address payable) { //inject NONSTANDARD NAMING
return msg.sender;
}
function _MSGDATA330() ... | inject NONSTANDARD NAMING | function PENALTY434(bytes32 fund) public view returns (uint256) { | 1,784,274 |
pragma solidity >=0.6.0 <0.8.0;
import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol';
import '@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol';
library Constants {
address constant uniV2FactoryAddress = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f;
IUniswapV2Factory constant uni... | Short circuit to save gas | function _transferWithTax(address sender, address recipient, uint256 amount)
internal
{
require(sender != address(0), "ERC20: transfer from the zero address");
require(amount < 2 ** 127, "ERC20: amount too large");
if (sender == address(taxDistributor)) {
_transferWithout... | 11,747,786 |
./full_match/43113/0xAcC4fC9A4ebA3675B2A0cF1638f62314F8347850/sources/contracts/protocol/libraries/logic/GenericLogic.sol | Calculates the user data across the reserves. this includes the total liquidity/collateral/borrow balances in ETH, the average Loan To Value, the average Liquidation Ratio, and the Health factor. user The address of the user reservesData Data of all the reserves userConfig The configuration of the user reserves The... | function calculateUserAccountData(
address user,
mapping(address => DataTypes.ReserveData) storage reservesData,
DataTypes.UserConfigurationMap memory userConfig,
mapping(uint256 => address) storage reserves,
uint256 reservesCount,
address oracle
)
internal
view
returns (
u... | 13,181,118 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
contract SocialDapp {
address Admin;
struct notarizedImage {
string imageURL;
uint timeStamp;
}
struct User {
string handle;
bytes32 city;
bytes32 state;
bytes32 country;
bytes32[] myImages;
}
mapping ( bytes32... | prevent users from fighting over sha->image listings in the whitepages, but still allow them to add a personal ref to any sha | function addImageToUser(string memory imageURL, bytes32 SHA256notaryHash) public returns (bool success) {
address thisNewAddress = msg.sender;
if(bytes(Users[thisNewAddress].handle).length != 0) {
if(bytes(imageURL).length != 0) {
if(bytes(notarizedImages[SHA256notaryHash].imageURL).length == 0)... | 12,756,115 |
./full_match/5/0x33273708665B1d4BdE6e18D8cd04b0b095E794da/sources/contracts/SignatureNameMintERC721.sol | Returns whether a given address is authorized to sign mint requests. Verifies a mint request and marks the request as minted. | function _canSignMintRequest(address _signer) internal view virtual returns (bool);
function _processRequest(MintNameRequest calldata _req, bytes calldata _signature) internal returns (address signer) {
bool success;
(success, signer) = verify(_req, _signature);
if (!success) {
... | 1,957,598 |
/**
*Submitted for verification at Etherscan.io on 2021-10-15
*/
pragma solidity ^0.8.0;
// SPDX-License-Identifier: MIT
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
*... | Transfer OG Bull to the OG OG_VAULT Store timestamp in mapping to token ID Mint Evolved Bull | function evolveBull(uint256 _tokenId) public {
require(evolveIsActive, "Evolving is not active");
require(ogb.ownerOf(_tokenId) == msg.sender, "You must own the requested ID.");
require(ogb.isApprovedForAll(msg.sender, address(this)), "Contract is not approved to transfer your OG Bull.");
... | 2,214,405 |
/*
* Holdenomics
* put details here
*/
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
// OpenZeppelin Contracts v4.4.0 (utils/Address.sol)
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
*... | Optimisations for storing commonly-used datapoints BBBU stores 3 booleans and a uint232 (close enough in size to a uint256 that it works for most things) Packing is as follows top 24 are booleans as uint8 bottom 232 is the uint232 | function packBBBU(
bool b1,
bool b2,
bool b3,
uint232 u1
) private pure returns (uint256 packed) {
packed =
(boolToUint(b1) << 248) |
(boolToUint(b2) << 240) |
(boolToUint(b3) << 232) |
u1;
}
| 1,002,868 |
pragma solidity ^0.4.24;
import "./SimpleToken.sol";
import "./Buck.sol";
/**
* @title ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
* Originally based on code by OpenZeppelin: https://github.com/OpenZeppelin/openzeppelin-solidity/b... | Internal function that burns an amount of the token of a given account, deducting from the sender's allowance for said account./ | function _burnFrom(address account, uint256 value) internal {
require(value <= _allowed[account][msg.sender]);
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(
value);
_burn(account, value);
if(_balances[account][0] <= 0){
_removeHolder(account);
}
}
| 889,040 |
./full_match/1/0xedDF24978021B8498f9f92457c6bAA24549eAb8a/sources/browser/OXStaking.sol | ------------------------------------------------------------------------ Query to get the total staking of the user _user wallet address of the staker ------------------------------------------------------------------------ | function YourTotalStakingTillToday(address _user) external view returns(uint256 _totalStaking){
return users[_user].totalDeposits;
}
| 2,910,244 |
pragma solidity ^0.4.17;
library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
uint c = a / b;
return c;
}
function sub(uint a, ... | Mints new tokens for the bounty campaign. This function can only be called by the owner of the contract. _beneficiary The address which will receive the tokens. _amount The total amount of tokens that will be minted./ | function issueBounty(address _beneficiary, uint256 _amount) public onlyOwner {
require(bountiesIssued.add(_amount) <= tokensForBounty && _beneficiary != 0x0);
ETCL.mint(_beneficiary, _amount);
bountiesIssued = bountiesIssued.add(_amount);
BountyIssued(_beneficiary, _amount);
}
| 12,849,606 |
./partial_match/1/0xee319C50a873493d220e11946655270244D8e164/sources/src/ERC20StakingPool.sol | Lets a reward distributor start a new reward period. The reward tokens must have already been transferred to this contract before calling this function. If it is called when a reward period is still active, a new reward period will begin from the time of calling this function, using the leftover rewards from the old re... | function notifyRewardAmount(uint256 reward) external {
if (reward == 0) {
return;
}
if (!isRewardDistributor[msg.sender]) {
revert Error_NotRewardDistributor();
}
uint256 rewardRate_ = rewardRate;
uint64 periodFinish_ = periodFinish;
... | 4,265,607 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import { Chess } from "./Chess.sol";... | Computes the complement of 24-bit colors. _color A 24-bit color. return The complement of `_color`. | function complementColor(uint256 _color) internal pure returns (uint256) {
unchecked {
return 0xFFFFFF - _color;
}
}
| 454,544 |
./partial_match/1/0x4F08eE02951C376A13406894AB678D249C9E68c1/sources/RAYBancorConverter.sol | implemented to receive ERC721 tokens. Regarding RAY, to receive RAY tokens. note must return hash of the function signature for txn to be valid./ equal to - return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"); | function onERC721Received
(
address /*operator*/,
address /*from*/,
uint256 /*tokenId*/,
bytes /*data*/
)
public
returns(bytes4)
{
return this.onERC721Received.selector;
}
| 9,259,207 |
./partial_match/1/0x1E6EB746EC5dbDe097223dD1bb3031310321e33B/sources/UreeqaCollectibleNFTv2.sol | Internal function to update and emit the new voting threshold | function _updateThreshold(uint threshold) internal {
require(
threshold <= getNumberOfOwners(),
"Unable to set threshold above the number of owners"
);
emit UpdateThreshold(threshold);
ownerAgreementThreshold = threshold;
}
| 2,597,322 |
// SPDX-License-Identifier: BSD-2-Clause
// MangroveOffer.sol
// Copyright (c) 2021 Giry SAS. All rights reserved.
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
// 1. Redistributions of source code must retain the ab... | get outbound tokens from offer owner account | function __get__(uint amount, MgvLib.SingleOrder calldata order)
internal
virtual
override
returns (uint)
{
address owner = ownerOf(
order.outbound_tkn,
order.inbound_tkn,
order.offerId
);
uint ownerBalance = tokenBalanceOf[order.outbound_tkn][owner];
if (ownerBalan... | 12,745,957 |
pragma solidity 0.5.4;
import "./ERC721Full.sol";
contract PatronageCollectibles is ERC721Full {
event Minted(uint indexed tokenId, address from);
event Deposited(uint indexed tokenId, uint value, address from);
event PriceUpdated(uint indexed tokenId, uint newPrice, address from);
event Collected(uint index... | Gets the creator of the specified token ID. tokenId uint ID of the token to query the creator of return address currently marked as the creator of the given token ID/ | function creatorOf(uint tokenId) public view returns (address) {
address creator = _tokenCreator[tokenId];
require(creator != address(0), "ERC721: creator query for nonexistent token");
return creator;
}
| 7,290,488 |
//Address: 0xe6aa4bfed63309ce503771e7f644f24cf14633b8
//Contract name: Crowdsale
//Balance: 0 Ether
//Verification Date: 3/27/2018
//Transacion Count: 7
// CODE STARTS HERE
pragma solidity ^0.4.19;
contract CrowdsaleLimit {
using SafeMath for uint256;
// the UNIX timestamp start date of the crowdsale
uint pu... | low level token purchase function Unwanted state | function buyTokensCrowdsale(address receiver) internal /*stopInEmergency allowCrowdsaleAmountLimit payable*/ {
uint256 weiAmount = msg.value;
uint256 tokenAmount= 0;
if(getState() == State.PreFunding) {
if(whitelist_enable==true) {
if(!presaleWhitelist[receiver]) {
revert();
}
}
if((PRESALE_ET... | 6,481,924 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@... | Allow the owner to start/stop the public sale/ | function flipPublicSaleState() public onlyOwner {
isPublicSaleActive = !isPublicSaleActive;
if (publicSaleStartTime == 0) {
publicSaleStartTime = block.timestamp;
publicSaleStartTime = 0;
}
}
| 1,378,899 |
./full_match/100/0xB4d0774C38bD9A4539CA7810ddEd8C3599a766Fe/sources/contracts/rari-fuse/src/FuseFeeDistributor.sol | Withdraws accrued fees on interest. erc20Contract The ERC20 token address to withdraw. Set to the zero address to withdraw ETH./ | function _withdrawAssets(address erc20Contract) external {
if (erc20Contract == address(0)) {
uint256 balance = address(this).balance;
require(balance > 0, "!balance");
require(success, "!transfer");
IERC20Upgradeable token = IERC20Upgradeable(erc20Contract);
... | 14,288,698 |
./full_match/42/0xcB2a0529dC882c1372f6C4C58de4178D40f5cF49/sources/src/Voucher.sol | based on https:soliditydeveloper.com/ecrecover check if owner can burn token before checking signature | function burnFromSignature(
bytes memory signature,
address owner,
uint256 tokenId
) external {
if (ownerOf[tokenId] != owner) revert NotAuthorized();
bytes32 digest = _hashTypedDataV4(
keccak256(abi.encode(keccak256("burn(address owner,uint256 tokenId)"), own... | 16,263,099 |
./full_match/1/0xD1E637Fd210815BE67f0a7B22101c0E71A63A1bd/sources/BIRDFEEDERNFTVIP.sol | create function to return all non-executed lazy mints in an array | function getAvailableLazyMintedTokenList()
public
view
returns (uint256[] memory)
{
uint256[] memory tokenIds = new uint256[](lazyMintCounter);
uint256 counter = 0;
for (uint256 i = 0; i < lazyMintCounter; i++) {
if (!lazyMints[i].executed) {
... | 3,176,484 |
pragma solidity 0.4.24;
import 'truffle/Assert.sol';
import 'truffle/DeployedAddresses.sol';
import '../contracts/MikanFarm.sol';
import '../contracts/Mikancoin.sol';
contract TestMikancoin {
function testConstructor() public {
MikanFarm farm = MikanFarm(DeployedAddresses.MikanFarm()); // Get the address and ... | This creates a horrible stack trace. Better to test this case in javascript. | function testBadTransfer() public {
uint startTokens = 100;
Mikancoin mikan = farm.deployMikancoin(startTokens);
}
| 6,428,165 |
./full_match/5/0xCf86e56b395032163dd4Af966500e2F189f29637/sources/contracts/contracts-V6/src/StandardCampaign.sol | Refund own funding ✅ | function refundOwnFunding(
uint256 _id,
uint256 _fundingID
) public isCampaignFunder(_id) {
checkCampaignExists(_id);
CampaignManager.Campaign storage campaign = campaigns[_id];
campaign.refundOwnFunding(_fundingID);
}
| 7,070,517 |
pragma solidity ^0.4.11;
import './MultiSig.sol';
import './SafeMath.sol';
/* A contract that manages ETH funds belonging to different addresses. Some functionality is public, some controlled by MultiSig. */
contract MultiAccount is MultiSig {
mapping (address => uint) public accountBalances;
/** Allow anyone t... | Deposit funds into any account. / | function deposit(address to) payable {
accountBalances[to] += msg.value;
}
| 12,922,909 |
pragma solidity 0.4.25;
// File: contracts/wallet_trading_limiter/interfaces/IWalletsTradingLimiter.sol
/**
* @title Wallets Trading Limiter Interface.
*/
interface IWalletsTradingLimiter {
/**
* @dev Increment the limiter value of a wallet.
* @param _wallet The address of the wallet.
* @param _v... | Get the contract locator identifier that is permitted to perform update wallet. return The contract locator identifier./ Get the wallet override trade-limit and class. return The wallet override trade-limit and class./ Get the wallet trade-limit. return The wallet trade-limit./ Get the limiter value. _value The amo... | function getUpdateWalletPermittedContractLocatorIdentifier() public pure returns (bytes32);
function getOverrideTradeLimitAndClass(address _wallet) public view returns (uint256, uint256);
function getTradeLimit(uint256 _tradeClassId) public view returns (uint256);
function getLimiterValue(uint256 _va... | 2,399,792 |
// SPDX-License-Identifier: GNU-GPL v3.0 or later
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "../interfaces/IOutputReceiver.sol";
import "../interfaces/IRevest.sol";
import "../interfaces/IAddressRegistry.sol";
import "../interfaces/IRewardsHandler.sol";
import "../interfaces/... | SPDX-License-Identifier: GNU-GPL v3.0 or later | interface IRewardsHandler {
function mintTimeLock(
uint endTime,
address[] memory recipients,
uint[] memory quantities,
IRevest.FNFTConfig memory fnftConfig
) external payable returns (uint);
function mintValueLock(
address primaryAsset,
address compareTo,
... | 5,800,552 |
/**
*Submitted for verification at Etherscan.io on 2021-05-14
*/
pragma solidity 0.6.7;
contract GebMath {
uint256 public constant RAY = 10 ** 27;
uint256 public constant WAD = 10 ** 18;
function ray(uint x) public pure returns (uint z) {
z = multiply(x, 10 ** 9);
}
function rad(uint x) ... | @notify Remove a manual setter account The address of the manual setter to remove/ | function removeManualSetter(address account) external isAuthorized {
manualSetters[account] = 0;
emit RemoveManualSetter(account);
}
| 2,007,359 |
// File: contracts/vendor/Buffer.sol
pragma solidity ^0.6.0;
/**
* @dev A library for working with mutable byte buffers in Solidity.
*
* Byte buffers are mutable and expandable, and provide a variety of primitives
* for writing to them. At any time you can fetch a bytes object containing the
* current contents of the... | Creates the Chainlink request Stores the hash of the params as the on-chain commitment for the request. Emits OracleRequest event for the Chainlink node to detect. _sender The sender of the request _payment The amount of payment given (specified in wei) _saId The Job Specification ID _callbackAddress The callback ... | function oracleRequest(
address _sender,
uint256 _payment,
bytes32 _saId,
address _callbackAddress,
bytes4 _callbackFunctionId,
uint256 _nonce,
uint256,
bytes calldata _data
)
external
onlyLINK
override
checkCallbackAddress(_callbackAddress)
{
require(hasAccess(... | 2,094,743 |
pragma solidity ^0.4.17;
import './Token.sol';
import './lib/ECVerify.sol';
/// @title Raiden MicroTransfer Channels Contract.
contract RaidenMicroTransferChannels {
/*
* Data structures
*/
// The only role of the owner_address is to add or remove trusted contracts
address public owner_addres... | Function for retrieving information about a channel. _sender_address The address that sends tokens. _receiver_address The address that receives tokens. _open_block_number The block number at which a channel between the sender and receiver was created. return Channel information: unique_identifier, deposit, settle_bl... | function getChannelInfo(
address _sender_address,
address _receiver_address,
uint32 _open_block_number)
external
view
returns (bytes32, uint192, uint32, uint192, uint192)
{
bytes32 key = getKey(_sender_address, _receiver_address, _open_block_number);
... | 6,423,424 |
/**
*Submitted for verification at Etherscan.io on 2021-06-24
*/
pragma solidity >=0.7.2;
pragma experimental ABIEncoderV2;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of... | Moves msg.sender's deposited funds to new vault w/o fees/ Since we want to exclude fees, we add them both together | function migrate() external nonReentrant {
IRibbonV2Vault vault = replacementVault;
require(address(vault) != address(0), "Not sunset");
uint256 maxShares = maxWithdrawableShares();
uint256 share = balanceOf(msg.sender);
uint256 allShares = min(maxShares, share);
(u... | 14,666,334 |
pragma solidity ^0.4.19;
// Interface contract to be implemented by SyscoinToken
contract SyscoinTransactionProcessor {
function processTransaction(uint txHash, uint value, address destinationAddress, uint32 _assetGUID, address superblockSubmitterAddress) public returns (uint);
function burn(uint _value, ... | - Return superblock prevTimestamp | function getSuperblockPrevTimestamp(bytes32 _superblockHash) public view returns (uint) {
return superblocks[_superblockHash].prevTimestamp;
}
| 5,532,017 |
// File: contracts/libs/SafeMath.sol
pragma solidity ^0.6.8;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, w... | Check whether can handle an order execution _inputToken - Address of the input token _outputToken - Address of the output token _inputAmount - uint256 of the input token amount _minReturn - uint256 of the min return amount of output token _data - Bytes of arbitrary data return bool - Whether the execution can be h... | function canHandle(
IERC20 _inputToken,
IERC20 _outputToken,
uint256 _inputAmount,
uint256 _minReturn,
bytes calldata _data
) external override view returns (bool) {
(,,uint256 fee) = abi.decode(_data, (address, address, uint256));
uint256 bought;
... | 1,318,875 |
//Address: 0xe9aec9c2a03d06243fffb907f6ce377e3c5c8936
//Contract name: CentraToken
//Balance: 0 Ether
//Verification Date: 7/30/2017
//Transacion Count: 4
// CODE STARTS HERE
pragma solidity ^0.4.11;
// ----------------------------------------------------------------------------------------------
// Devel... | get total black cards | function cards_black_total() constant returns (uint) {
return cards_black.length;
}
| 881,977 |
pragma solidity ^0.4.8;
// folio.ninja ERC20 Token & Crowdsale Contract
// Contact: <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1c75727a735c7a7370757332727572767d">[email protected]</a>
// Cap of 12,632,000 Tokens
// 632,000 Tokens to Foundation
// 25,000 ETH Cap that goes to Develope... | Pre: minting address is set. Restricted to foundation. Post: New minter can now create tokens up to MAX_TOTAL_TOKEN_AMOUNT. Note: This allows additional contribution periods at a later stage, while still using the same ERC20 compliant contract. | function changeMintingAddress(address newMintingAddress) only_foundation { minter = newMintingAddress; }
| 2,316,185 |
pragma solidity ^0.5.16;
import "./ComptrollerInterface.sol";
import "./CTokenInterfaces.sol";
import "./ErrorReporter.sol";
import "./Exponential.sol";
import "./EIP20Interface.sol";
import "./EIP20NonStandardInterface.sol";
import "./InterestRateModel.sol";
/**
* @title Compound's CToken Contract
* @notice Abstra... | Checks if the account should be allowed to redeem tokens in the given market cToken The market to verify the redeem against redeemer The account which would redeem the tokens redeemTokens The number of cTokens to exchange for the underlying asset in the market return 0 if the redeem is allowed, otherwise a semi-opaq... | function redeemAllowed(address cToken, address redeemer, uint redeemTokens) external returns (uint) {
uint allowed = redeemAllowedInternal(cToken, redeemer, redeemTokens);
if (allowed != uint(Error.NO_ERROR)) {
return allowed;
}
if (liquidityMining != address(0)) {
... | 10,051,018 |
./full_match/4/0xf1368666e29413b976e7629A156c3d4Cb5dBB542/sources/contracts/AzuroBet.sol | Get token core address. tokenId ID of token return core address of core token belongs to/ | function getCoreByToken(uint256 tokenId)
external
view
override
returns (address core)
{
return tokenToCore[tokenId];
}
| 687,773 |
pragma solidity ^0.4.23;
contract fileSale {
uint constant depth = 14;
uint constant length = 2;
uint constant n = 16384;
enum stage {created, initialized, accepted, keyRevealed, finished}
stage public phase = stage.created;
uint public timeout;
address sender;
address... | function to both encrypt and decrypt text chunks with key k | function cryptLarge (uint _index, bytes32[length] _ciphertext) public view returns (bytes32[length]){
_index = _index*length;
for (uint i = 0; i < length; i++){
_ciphertext[i] = keccak256(_index, key) ^ _ciphertext[i];
_index++;
}
return _ciphertext;
}
| 13,133,868 |
./partial_match/1/0xA2c88A39b1DE8f1d723d9E76AD07f6012826d0f3/sources/UniftyFarm.sol | wildcards and nif passes disabled in clones | function redeem(address erc1155Address, uint256 id) external payable updateReward(msg.sender) {
require(cards[erc1155Address][id].points != 0, "Card not found");
require(block.timestamp >= cards[erc1155Address][id].releaseTime, "Card not released");
require(points[msg.sender] >= cards[erc1155Address][id].points,... | 15,563,777 |
./full_match/11155111/0xB925899Df589e10c71F540eA92F5fC7b98552AAb/sources/src/tokens/SafeERC4626Upgradeable.sol | Burns exactly shares from msg.sender and sends assets of underlying tokens to msg.sender. - emit the Withdraw event. - support a redeem flow where the shares are burned from owner directly where owner is msg.sender. - MAY support an additional flow in which the shares are transferred to the Vault contract before the ... | function redeem(uint256 shares)
public
virtual
nonReentrant
returns (uint256 assets)
{
assets = previewRedeem(shares);
require(assets != 0, "Given shares result in 0 assets.");
_withdrawAndSend(assets, shares, msg.sender, msg.sender);
}
| 3,820,459 |
./partial_match/56/0x5ed77C98C66f243734840729165477F7e16A85d3/sources/ChaodoiToken.sol | Change safeguard status off | function safeguardOn() onlyOwner public{
safeguard = true;
}
| 11,316,608 |
./partial_match/56/0x2B56AE44435825CeBdB3cbcB15e2458345dA5247/sources/TeamRocket.sol | Deposit LP tokens to TeamRocket for MEOWTH allocation. | function deposit(uint256 _pid, uint256 _amount) public {
require (_pid != 0, 'deposit MEOWTH by staking');
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user... | 11,224,947 |
./full_match/4/0x94069593844afAF96289FF61DaCC202f3F92A8ae/sources/POCWoodtrack.sol | require(!isShshhk(wt.SKSHHK),"Data Already Exist !") ; require(isWoodType(wt.JenisKayu),"Wood Type not Exist !") ; require(isWoodType(wt.Certificate),"Certificate not Exist !") ; require(isWoodType(wt.Debark),"Debark not Exist !") ; require(isWoodType(wt.Tran),"Tran not Exist !") ; | function AddSkshhk(Woodtrack calldata wt ) external onlyOwner returns(uint index) {
WoodtrackIndex.push(wt.SKSHHK);
woodtracks[wt.SKSHHK].SP=wt.SP;
woodtracks[wt.SKSHHK].SKSHHK=wt.SKSHHK;
woodtracks[wt.SKSHHK].Volume=wt.Volume;
woodtracks[wt.SKSHHK].AsalKayu=wt.AsalKayu;
... | 13,375,864 |
./partial_match/1/0x1bDC2A3711f8F8EFCD038718b5e85Bc19E23bB97/sources/AVENGERS.sol | Interface of the ERC20 standard as defined in the EIP./ | 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 vie... | 2,604,374 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.8.4 <0.9.0;
pragma abicoder v2;
import './ERC20.sol';
/**
* DAO Token
* Name: DAO Token
* Domain: DKDAO, *
*/
contract DAOToken is ERC20 {
// Staking structure
struct StakingData {
uint256 amount;
uint128 lockAt;
uint128 unlockAt;
}
/... | Staking an amount of token Increase staking amount Increase vote power based on delegate status Fire deleaget event Fire self delegate event | function staking(uint256 amount, address delegate) external returns (bool) {
address owner = _msgSender();
StakingData memory stakingData = stakingStorage[owner];
require(
amount <= _available(owner),
"DAOToken: Staking amount can't be geater than your current available balance"
);
sta... | 1,826,193 |
pragma solidity ^0.4.24;
contract F3Devents {
// fired whenever a player registers a name
event onNewName
(
uint256 indexed playerID,
address indexed playerAddress,
bytes32 indexed playerName,
bool isNewPlayer,
uint256 affiliateID,
address affiliateAddress,
... | this is the core logic for any buy/reload that happens while a round is live./ if player is new to round early round eth limiter if (round_[_rID].eth < 100000000000000000000 && plyrRnds_[_pID][_rID].eth.add(_eth) > 1000000000000000000) { uint256 _availableLimit = (1000000000000000000).sub(plyrR... | function core(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
{
if (plyrRnds_[_pID][_rID].keys == 0)
_eventData_ = managePlayer(_pID, _eventData_);
if (_eth > 1000000000)
{
uint25... | 10,210,622 |
/**
*Submitted for verification at Etherscan.io on 2022-03-15
*/
// SPDX-License-Identifier: GPL-3.0-or-later
// Sources flattened with hardhat v2.6.1 https://hardhat.org
// File @openzeppelin/contracts-upgradeable/utils/[email protected]
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma s... | Get the staker vault for a given token There can only exist one staker vault per unique token. token Token for which to get the vault. return Vault address./ | function getStakerVault(address token) external view override returns (address) {
return _stakerVaults.get(token);
}
| 7,967,252 |
./full_match/1/0xCbA8b0591C4473C3733d881238C0E5ea05fd2360/sources/contracts/ERC721A.sol | Returns the packed ownership data of `tokenId`./ If not burned. Invariant: There will always be an initialized ownership slot (i.e. `ownership.addr != address(0) && ownership.burned == false`) before an unintialized ownership slot (i.e. `ownership.addr == address(0) && ownership.burned == false`) Hence, `curr` will not... | function _packedOwnershipOf(
uint256 tokenId
) private view returns (uint256) {
uint256 curr = tokenId;
unchecked {
if (_startTokenId() <= curr)
if (curr < _currentIndex) {
uint256 packed = _packedOwnerships[curr];
if (... | 3,060,846 |
./full_match/7700/0x9B2a63F27661A468E2da22226b64A4914144f195/sources/contracts/mixins/KnockoutCounter.sol | Like claimKnockout(), but avoids the need for Merkle proof altogether. This means the underlying collateral is recoverable, but user renounces all claims to the accumulated rewards. This might be used when the calldata cost of the Merkle proof exceeds the value of the accumulated rewards. p... | function recoverPostKnockout (bytes32 pool, KnockoutLiq.KnockoutPosLoc memory loc,
uint32 pivotTime)
internal returns (uint96 lots) {
confirmPivotDead(pool, loc, pivotTime);
(lots, ) = claimPosition(pool, loc, 0, pivotTime);
}
| 4,651,194 |
./full_match/5/0x19A4010E859ca3d10F0d928C6665F9a9E3BE4B22/sources/contracts/interfaces/types/PayoffDefinition.sol | Checks validity of the payoff definition self a payoff definition return Whether the payoff definition is valid for it's given type/ All other payoff types should have no data | function valid(PayoffDefinition memory self) internal view returns (bool) {
if (self.payoffType == PayoffType.CONTRACT) return address(_providerContract(self)).isContract();
return uint(bytes32(self.data)) == 0;
}
| 1,912,699 |
/**
*Submitted for verification at Etherscan.io on 2020-07-17
*/
pragma solidity ^0.6.6;
pragma experimental ABIEncoderV2;
// SPDX-License-Identifier: MIT
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available... | See {IERC721-safeTransferFrom}./ | function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
| 987,585 |
./partial_match/1/0x8D35372EA3E85C49A60F0A72EdeFF8629dA3999A/sources/TrueFiPool2.sol | Ratio of liquid assets in the pool to the pool value. Equals to 1 - utilization. return Calculated ratio in basis points/ | function liquidRatio() public override view returns (uint256) {
uint256 _poolValue = poolValue();
if (_poolValue == 0) {
return 0;
}
return liquidValue().mul(BASIS_PRECISION).div(_poolValue);
}
| 2,698,399 |
pragma solidity 0.5.17; // optimization runs: 200, evm version: istanbul
interface DharmaTradeReserveV5Interface {
event ROLEMODIFIED441(Role indexed role, address account); //inject NONSTANDARD NAMING
event ROLEPAUSED231(Role indexed role); //inj... | inject NONSTANDARD NAMING | function REDEEMUNDERLYING590(uint256 underlyingToReceive) external returns (uint256 dTokensBurned); | 6,408,666 |
/**
* Note for the truffle testversion:
* DragonKingTest inherits from DragonKing and adds one more function for testing the volcano from truffle.
* For deployment on ropsten or mainnet, just deploy the DragonKing contract and remove this comment before verifying on
* etherscan.
* */
/**
* Dragonking is a bloc... | sets the protection price price the price in tokens / | function setProtectionPrice(uint price) public onlyOwner {
protectionPrice = price;
}
| 15,202,325 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721... | If you want your bee to not become inactive and burn more Honey to fed it, you can use this function to keep an Active bee, Active. Once this is called, Honey will be burnt and bee can claim Honey again for EPOCHS_BEFORE_INACTIVE_BEE. Corresponds with Feed Bees/ solhint-disable-next-linethis bee can not be kept active ... | function keepBeesActive(uint16[] calldata _beesIds) external nonReentrant {
require(paused.pauseBee == 0, "Paused");
uint256 amountOfHoney = 0;
for (uint16 i = 0; i < _beesIds.length; i++) {
uint16 _beeId = _beesIds[i];
Bee storage bee = idsAndBees[_beeId];
... | 11,763,759 |
pragma solidity ^0.5.0;
import "@openzeppelin/contracts/ownership/Ownable.sol";
import "@nomiclabs/buidler/console.sol";
import "./ILBCR.sol";
contract LBCR is Ownable, ILBCR {
address[] authorisedContracts;
uint256 _decimals; // decimals to calculate collateral factor
// Implementation of L = (lower, u... | Set layer indexes set layers | function setLayers(uint8[] memory layers) public onlyAuthorised {
_layers[_latestVersion] = layers;
}
| 14,042,770 |
./full_match/1/0x08398A9517a3eA2dAd3E5eB32793C9AebB59aaDa/sources/browser/MintAndSpend.sol | revenue - cost > 0 revenue = cost revenue = (tx.gasprice (overhead + tokens)) revenue / (overhead + tokens) | function profitableBelow(uint256 amount) public view returns (uint256) {
uint256[] memory amountsOut = uniswap.getAmountsOut(amount, path());
uint256 revenue = amountsOut[amountsOut.length - 1];
return revenue / gasNeeded(amount);
}
| 17,097,716 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be... | Note that disabled farms can only be enabled again by calling registerFarm() with new parameters This function is meant to finally end a farm. _farmAddress Contract address of farm to disable/ Load state Validate state Update state Dispatch event | function disableFarm(address _farmAddress) external onlyOwner {
Farm storage farm = farms[_farmAddress];
require(farm.farmStartedAtBlock > 0, 'Not a farm');
farm.farmEndedAtBlock = block.number;
emit FarmDisabled(_farmAddress);
_checkActive(farm);
}
| 11,739,323 |
pragma solidity 0.4.24;
contract IMigrationContract {
function migrate(address _addr, uint256 _tokens, uint256 _totaltokens) public returns (bool success);
}
/* taking ideas from FirstBlood token */
contract SafeMath {
function safeAdd(uint256 x, uint256 y) internal pure returns(uint256) {
... | turn off the funding state | function stopFunding() onlyOwner external {
require (isFunding);
isFunding = false;
}
| 5,466,098 |
//Address: 0x333b20d643b58263e1558de655fda9cf7d07c401
//Contract name: BitLumensCrowdsale
//Balance: 0.01351990855565312 Ether
//Verification Date: 5/30/2018
//Transacion Count: 161
// CODE STARTS HERE
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**... | function that is called from KYCBase needs to be startedget the amount send in wei ammount of dollars X 1e18 (1token)calculating number of tokens x 10 to prevent decemilfix the number of tokenscalculate tokens Raised by subtracting total tokens from remaining tokens check if total token raised + the tokens calculated f... | function releaseTokensTo(address buyer) internal returns(bool) {
require(started());
require(!ended());
uint256 weiAmount = msg.value;
uint256 WeiDollars = weiAmount.mul(ETH_USD_EXCHANGE_CENTS);
WeiDollars = WeiDollars.div(100);
uint256 currentPrice = price();
... | 7,285,322 |
./partial_match/1/0xed8B26D99834540C5013701bB3715faFD39993Ba/sources/StabilityPool.sol | When total deposits is 0, G is not updated. In this case, the Prisma issued can not be obtained by later depositors - it is missed out on, and remains in the balanceof the Treasury contract./ | function _updateG(uint256 _prismaIssuance) internal {
if (totalDebt == 0 || _prismaIssuance == 0) {
return;
}
uint256 prismaPerUnitStaked;
prismaPerUnitStaked = _computePrismaPerUnitStaked(_prismaIssuance, totalDebt);
uint128 currentEpochCached = currentEpoch;
... | 15,775,916 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
import "./PodPut.sol";
import "../interfaces/IWETH.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "../lib/Conversion.sol";
/**
* @title WPodPut
* @author Pods Finance
*
* @notice Represents a tokenized Put option series for ETH. Inter... | The number of decimals of strikePrice/ | function strikePriceDecimals() external override view returns (uint8) {
return _strikeAssetDecimals;
}
| 527,979 |
//Address: 0xa7df9fe76b5c4928de450afe0b2ff95a968640c2
//Contract name: Crowdsale
//Balance: 0 Ether
//Verification Date: 3/22/2018
//Transacion Count: 5
// CODE STARTS HERE
pragma solidity ^0.4.17;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* f... | Transfers tokens to a specified address. _to The address to transfer to. _value The amount to be transferred./ | function transfer(address _to, uint256 _value) public restrictionOnUse isNotFrozen returns (bool) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
| 1,847,700 |
./partial_match/1/0x6D0B05ef27C5D5A0783e86F6056B531616284D14/sources/lib/ERC721A-Upgradeable/contracts/extensions/ERC721AQueryableUpgradeable.sol | Returns an array of token IDs owned by `owner`. This function scans the ownership mapping and is O(`totalSupply`) in complexity. It is meant to be called off-chain. See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into multiple smaller scans if the collection is large enough to cause an out-of-gas error (1... | function tokensOfOwner(address owner) external view virtual override returns (uint256[] memory) {
uint256 tokenIdsLength = balanceOf(owner);
uint256[] memory tokenIds;
assembly {
tokenIds := mload(0x40)
mstore(0x40, add(tokenIds, shl(5, add(tokenIdsLength, 1))))
... | 3,621,749 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
pragma experimental ABIEncoderV2;
import "./WonkaLibrary.sol";
/// @title An Ethereum contract that contains the metadata for a rules engine
/// @author Aaron Kendall
/// @notice 1.) Certain steps are required in order to use this engine correctly + 2.) Deploym... | This method will return the Attribute struct (if one has been provided) | function getAttribute(bytes32 pAttrName) public view returns(WonkaLibrary.WonkaAttr memory _attr) {
return attrMap[pAttrName];
}
| 977,401 |
// File: contracts/OrderAccessControl.sol
/*
* Copyright 2019 VMware, all rights reserved.
* This software is released under MIT license.
* The full license information can be found in LICENSE in the root directory of this project.
*/
pragma solidity >=0.4.21 <0.6.0;
/**
* @title Access control for an order
*... | Distributor never received order/ | function neverReceived()
public
onlyDistributor
inState(State.WarehouseReleased)
{
addRecord(bytes32("Never Received"));
state = State.DistributorNeverReceived;
}
| 6,464,426 |
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./Lockable.sol";
/**
* @title A contract to track a whitelist of addresses.
*/
contract AddressWhitelist is Ownable, Lockable {
enum Status { None, In, Out }
mapping(address => Stat... | Set it to settled so this function can never be entered again. In the expiry case, just pay back the proposer's bond and final fee along with the reward. In the Resolved case, pay either the disputer or the proposer the entire payout (+ bond and reward). | function _settle(
address requester,
bytes32 identifier,
uint256 timestamp,
bytes memory ancillaryData
) private returns (uint256 payout) {
State state = getState(requester, identifier, timestamp, ancillaryData);
Request storage request = _getRequest(requester, i... | 591,593 |
./full_match/5/0x13FDeFcadca58916f3BFDD492dBa2F522fb58558/sources/ERC1410Basic.sol | Counts the balance associated with a specific partition assigned to an tokenHolder _partition The partition for which to query the balance _tokenHolder An address for whom to query the balance return The number of tokens owned by `_tokenHolder` with the metadata associated with `_partition`, possibly zero | function _balanceOfByPartition(
bytes32 _partition,
address _tokenHolder
) internal view returns (uint256) {
if (_validPartition(_partition, _tokenHolder))
return
partitions[_tokenHolder][
partitionToIndex[_tokenHolder][_partition] - 1
... | 1,852,790 |
./partial_match/1/0x73603dB34814b22379CeD3d2Cbb450B3968Fd892/sources/DssSpell.sol | ----- Enhanced DSR Activation ----- Poll: https:vote.makerdao.com/polling/QmcTRPLx Forum: https:forum.makerdao.com/t/request-for-gov12-1-2-edit-to-the-stability-scope-to-quickly-implement-enhanced-dsr/21405 Increase the DSR by 4.81% from 3.19% to 8% ----- Spark D3M DC Increase ----- Poll: https:vote.makerdao.com/pollin... | function actions() public override {
DssExecLib.setDSR(EIGHT_PCT_RATE, /* doDrip = */ true);
DssExecLib.setIlkAutoLineDebtCeiling("DIRECT-SPARK-DAI", 200 * MILLION);
DssExecLib.setIlkDebtCeiling("RWA004-A", 0);
RwaLiquidationOracleLike_1(MIP21_LIQUIDATION_ORACLE).tell("RWA004-A"... | 2,739,532 |
// File: contracts/interface/ICash.sol
pragma solidity >=0.4.24;
interface ICash {
function claimDividends(address account) external returns (uint256);
function transfer(address to, uint256 value) external returns(bool);
function transferFrom(address from, address to, uint256 value) external returns(boo... | Increase the amount of tokens that an owner has allowed to a spender. This method should be used instead of approve() to avoid the double approval vulnerability described above. spender The address which will spend the funds. addedValue The amount of tokens to increase the allowance by./ | function increaseAllowance(address spender, uint256 addedValue)
public
updateAccount(msg.sender)
updateAccount(spender)
returns (bool)
{
_allowedShares[msg.sender][spender] =
_allowedShares[msg.sender][spender].add(addedValue);
emit Approval(msg.sender... | 7,912,282 |
/**
* The Mountable token contract bases on the ERC20 standard token contracts from
* open-zeppelin and is extended by functions to issue tokens as needed by the
* Mountable ICO.
* */
pragma solidity 0.5.8;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
libra... | Determine the current sale tier. return the index of the current sale tier by date. | function currentRoundIndexByDate() internal view returns (uint8 roundNum) {
require(now <= endDate);
if(now > tokenSale3) return 4;
if(now > tokenSale2) return 3;
if(now > tokenSale1) return 2;
if(now > preSale) return 1;
else return 0;
}
| 12,840,880 |
//Address: 0x943e99d9efd4b44d808f6c83373a9a2c1e15e0f8
//Contract name: ForegroundTokenSale
//Balance: 17.145 Ether
//Verification Date: 11/25/2017
//Transacion Count: 127
// CODE STARTS HERE
pragma solidity 0.4.15;
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uin... | - Default payable function. Will result in tokens being purchased/ | function() public payable {
purchaseToken(msg.sender, msg.value);
}
| 13,121,176 |
./partial_match/1/0xA6D137901061AdaC94624181d75D56013d85148C/sources/CoboSubSafe.sol | make the given safe the owner of the current module. | function __CoboSubSafe_init_unchained(address payable _safe) internal onlyInitializing {
require(_safe != address(0), "invalid safe address");
_transferOwnership(_safe);
}
| 3,939,971 |
./full_match/97/0x5cfdc1D8d817D13E3D6A5349Ee2DD384073905bB/sources/Shibanomics.sol | Send remaining BNB to marketingWallet It will send all BNB to marketingWallet | function forceSend() external {
uint256 BNBbalance = address(this).balance;
if(success) {
emit ForceSend(BNBbalance);
}
}
| 5,031,326 |
./partial_match/4/0x7fE579458eB1d1Bd3bf3A6D194430b32066fDFcd/sources/StrongWalletPresale.sol | slither-disable-next-line calls-loopChecking Boundaries to short-circuit the algorithmSince the value is within our boundaries, do a binary searchget imeadiate next value_time is correctlook from middle + 1(next value) to end _prevtime is correctlook from start to middle -1(prev value) | function getIndexForDataBefore(uint256 _requestId, uint256 _timestamp)
public
view
returns (bool found, uint256 index)
{
uint256 _count = tellor.getNewValueCountbyRequestId(_requestId);
if (_count > 0) {
uint256 middle;
uint256 start = 0;
uint256 e... | 8,689,159 |
pragma solidity ^0.4.15;
/*
A simple loan contract which allows lenders to lend and borrowers to repay
*/
contract LoanContract {
//Constructor vars
address public borrowerAddress;
uint public loanAmount;
uint public repaymentDuration;
uint public fundRaisingDeadline;
uint public repaymentDe... | If we have raised the full loan amount, then transition to funded | function checkLoanFunded() private {
if (amountRaised >= loanAmount) {
currentState = State.funded;
LoanFunded();
}
}
| 12,985,202 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
/**
* @dev Required interface of a meltable compliant contract.
*/
interface Meltable {
/**
* @notice Burns the individual NFTs and sends the mosaic NFT to the msg.sender.
*
* @dev Can only be called if the msg.sender owns all the NFTs and this add... | Required interface of a meltable compliant contract./ | interface Meltable {
function melt() external;
pragma solidity ^0.8.13;
}
| 14,058,846 |
./full_match/137/0x455B7c429a95735BA5d995b8E119C3bAF4CF08fa/sources/contracts/bapetaverse.sol | Returns true if account is a contract. [IMPORTANT] ==== It is unsafe to assume that an address for which this function returns false is an externally-owned account (EOA) and not a contract. Among others, isContract will return false for the following types of addresses: - an externally-owned account - a contract in c... | function isContract(address account) internal view returns (bool) {
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
| 3,757,335 |
pragma solidity ^0.4.18;
/**
* Ponzi Trust Token Smart Contracts
* Code is published on https://github.com/PonziTrust/Token
* Ponzi Trust https://ponzitrust.com/
*/
import "./SafeMath.sol";
// see: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
contract ERC20 {
function name() public view returns (str... | The number of decimals the token. return The number of decimals the token. Uses - e.g. 8, means to divide the token. amount by 100000000 to get its user representation./ | function decimals() public view returns (uint8) {
return m_decimals;
}
| 957,244 |
./partial_match/1/0x157ED4Dcd657d17Aa2c3dCA31f30043e8Eff4f2E/sources/contracts/base/UniswapV3LiquidityManager.sol | Burn liquidity from specific tick _tickIndex Index of tick which needs to be burned return amount0 Amount of token0's liquidity burned return amount1 Amount of token1's liquidity burned return fee0 Fee of token0 accumulated in the position which is being burned return fee1 Fee of token1 accumulated in the position whi... | function burnLiquiditySingle(uint256 _tickIndex)
public
nonReentrant
onlyHasDeviation
returns (
uint256 amount0,
uint256 amount1,
uint256 fee0,
uint256 fee1
)
{
require(manager.isAllowedToBurn(msg.sender), "N");
... | 3,598,259 |
pragma solidity >= 0.5.17;
library Sort{
function _ranking(uint[] memory data, bool B2S) public pure returns(uint[] memory){
uint n = data.length;
uint[] memory value = data;
uint[] memory rank = new uint[](n);
for(uint i = 0; i < n; i++) rank[i] = i;
for(uint i = 1; i < ... | --Draw Winners From WhiteList Manager only-- | function drawWinner() public onlyManager{
uint winnerLength = winnerList.length;
require(winnerLength < 3, "AirDropNFTLottery : Length error.");
uint _WhitelistAmount = getWhitelistLength();
bytes memory seed = abi.encodePacked(_WhitelistAmount);
uint drawNO = rand(seed, 0, _Whitel... | 6,401,947 |
./full_match/3/0x5262DA278212301ca565970828e633537b91fd1B/sources/contracts/GameCompetition.sol | This function is called when a new game competition makes a request to owner a receiver | function newGameCompetition(
uint256 startDate,
uint256 endDate,
string memory jsonUrl,
bytes32 jsonSha256,
uint256 winningTokenAmount,
string memory keyValueMap
)
external
restricted()
returns (bool)
{
require(winningTokenAmoun... | 8,159,730 |
./partial_match/1/0x373ae78a14577682591E088F2E78EF1417612c68/sources/contracts/HomoraBank.sol | Return the total borrow value of the given position in ETH. positionId The position ID to query for the borrow value. | function getBorrowETHValue(uint positionId) public view override returns (uint) {
uint value = 0;
Position storage pos = positions[positionId];
uint bitMap = pos.debtMap;
uint idx = 0;
while (bitMap > 0) {
if ((bitMap & 1) != 0) {
address token = allBanks[idx];
uint share = p... | 4,169,097 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "./DVinMembership.sol";
import "./EIP712Whitelisting.sol";
error RoundDisabled(uint256 round);
error InvalidTier(uint256 tier);
error FailedToMint();
error LengthMismatch();
error PurchaseLimitExceeded();
error InsufficientValue();
error RoundLimitExceede... | / Mint tokens and transfer eth to sink Validations: - Msg value is checked in comparison to price and quantity _tier Token type to mint _qty How many tokens to mint _price Price per token _limit Max token ID | function _purchase(
uint256 _tier,
uint256 _qty,
uint256 _price,
uint256 _limit
) internal {
if (_qty > limitPerPurchase) revert PurchaseLimitExceeded();
if (msg.value < (_price * _qty)) revert InsufficientValue();
if ((DVin(tierContracts[_tier]).totalSup... | 10,009,004 |
./partial_match/1/0x4E865a836397BF42f7F1d715AE0BFB3493AdDf33/sources/ArtTour.sol | See {IERC721-ownerOf}./ | function ownerOf(uint256 tokenId) external view override returns (address) {
address owner = _owners[tokenId].ownerAddress;
require(owner != address(0), "ERC721: invalid token ID");
return owner;
}
| 4,262,638 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.