file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma experimental ABIEncoderV2;
pragma solidity 0.7.3;
import "./interfaces/IProxy.sol";
import "./interfaces/IPV2SmartPool.sol";
import "./interfaces/IBPool.sol";
import "./interfaces/IBFactory.sol";
import "./interfaces/ISmartPoolStorageDoctor.sol";
import "./interfaces/IExperiPieStorageDoctor.sol";
import "@pie-d... | In case migration does not work we handle control back to another address again | function setProxyOwner(address _proxy, address _owner) external onlyOwner {
IProxy proxy = IProxy(_proxy);
proxy.setProxyOwner(_owner);
}
| 1,802,326 |
./full_match/4/0xC9434231534B8fab79d9226e1b443c372A966F65/sources/contracts/curation/Curation.sol | Calculate amount of signal that can be bought with tokens in a curation pool. _subgraphDeploymentID Subgraph deployment to mint signal _tokensIn Amount of tokens used to mint signal return Amount of signal that can be bought with tokens/ Get curation pool tokens and signal Init curation pool | function _tokensToSignal(bytes32 _subgraphDeploymentID, uint256 _tokensIn)
private
view
returns (uint256)
{
CurationPool memory curationPool = pools[_subgraphDeploymentID];
if (curationPool.tokens == 0) {
require(
_tokensIn >= minimumCurationD... | 649,232 |
/*************************************************
* *
* AirDrop Dapp *
* Developed by Phenom.Team "www.phenom.team" *
* *
*************************************************/
pragma... | Get balance of tokens holder _holder holder's address return balance of investor/ | function balanceOf(address _holder) public view returns (uint) {
return balances[_holder];
}
| 12,956,836 |
./partial_match/1/0x14A933E66db326db730a0189451b48951353A658/sources/HamacaToken.sol | Sets `amount` as the allowance of `spender` over the caller's tokens. Emits a {Approval} event. @solidity memory-safe-assembly Compute the allowance slot and store the amount. Emit the {Approval} event. | function approve(address spender, uint256 amount) public virtual returns (bool) {
assembly {
mstore(0x20, spender)
mstore(0x0c, _ALLOWANCE_SLOT_SEED)
mstore(0x00, caller())
sstore(keccak256(0x0c, 0x34), amount)
mstore(0x00, amount)
log3... | 2,665,008 |
./full_match/73799/0x0b87CdF95cFB8AD5836aF2b61932b4581ad40B2E/sources/contracts/dependencies/MetaToken.sol | tokenSupply - Returns the total supply of a meta token id - ID of the meta token return uint256 - The total supply of the meta token/ | function tokenSupply(uint256 id) external view returns (uint256) {
return _totalSupply(id);
}
| 16,362,520 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8;
// when & why owner would be payable
// 5 minute in solidity series
contract EasyDonation {
// declare an address
address payable owner;
// init that address
constructor() {
owner = payable(msg.sender);
}
// pay to that ad... | pay to that address value in wei (1e-18 eth) | function buyMeACafee() external payable {
require(success);
}
| 2,543,100 |
/**
*Submitted for verification at Etherscan.io on 2022-04-08
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma abicoder v2;
//
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and ... | Get swapStructLength | function getSwapStructSize(uint256 _swapId, bool _nfts) public view returns(uint256) {
if(_nfts)
return nftsOne[_swapId].length ;
else
return nftsTwo[_swapId].length ;
}
| 7,970,306 |
pragma solidity 0.4.19;
import "zeppelin-solidity/contracts/token/ERC20/PausableToken.sol";
import "./STRTokenProxyStorage.sol";
/**
* @title Stream Token
*/
contract STRToken is STRTokenProxyStorage, PausableToken {
function STRToken() public {
createTotalSupply();
}
/**
* @notice ERC-... | Creates the total supply and assigns it to the owner./ This should only be callable once STR and ETH have the same precision | function createTotalSupply() internal {
require(totalSupply_ == 0);
uint256 desiredSupply = 10000000000 ether;
totalSupply_ = totalSupply_.add(desiredSupply);
balances[owner] = balances[owner].add(desiredSupply);
Transfer(0x0, owner, desiredSupply);
}
| 6,355,067 |
// THIS CONTRACT IS UNSAFE because I added two major bugs to make it more
// exciting to audit ;)
// One bug is easy to spot, and the other is more subtle. The more subtle bug
// may or may not be dangerous. But the other is definitely bad. Hint: don't
// even trust the comments ;)
pragma solidity 0.4.18;
import "ze... | This function should only be called in the unlikey situation where the funds have to be returned to all givers. Refunds are only possible if the expiry datetime has not passed. Tested by test/test_refund.js Only allow a refund if allowRefunds() has been invoked The gift must exist and must not have already been redeeme... | function claimRefund(uint giftId) public {
require(refundsAllowed == true);
require(isValidGift(giftIdToGift[giftId]));
address giver = giftIdToGift[giftId].giver;
require(giver == msg.sender);
assert(giftIdToGift[giftId].giver != address(0));
uint amount = giftId... | 12,588,830 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract HotPo... | Immediately toss to `address` if it's different from the minter. | function safeMint(uint256 _type, address to) public payable {
require(msg.value == mintFee, "Incorrect mint fee");
require(_type < _tokenTypeCounter.current(), "Nonexistent token type");
uint256 tokenId = _tokenIdCounter.current();
lastTossed[tokenId] = block.timestamp;
tokenIdToType[tokenId] = _... | 2,535,674 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/**
* @title Rockstar
* @dev Script to deploy batch transactions of NFTs
*/
contract BatchTransferPUSH is Ownable ... | Mass transfers Tokens in a batched transaction token the address of the NFT token that needs to be mintedd recipients the array of address of recipients who will receive these tokens amounts the array of amounts to be transferred startpos the start position in NFT order num the number of tokens to be minted/ requi... | function transferPUSH(address token, address[] memory recipients, uint256[] memory amounts, uint256 startpos, uint256 num) public onlyOwner {
require(recipients.length == amounts.length, "BatchTransferPUSH::transferPUSH: recipients and amounts count mismatch");
IERC20 pushToken = IERC20(token);
for (uin... | 14,755,994 |
./full_match/5/0x32ff4D05236E95FF60299E9b7BaB351179138389/sources/contracts/core/Factory.sol | @inheritdoc IFactory | function isWhitelistedNFTManager(address sender) external view override returns (bool) {
if (whitelistDisabled) return true;
return whitelistedNFTManagers.contains(sender);
}
| 1,940,570 |
// Bitcoin transaction parsing library
// Copyright 2016 rain <https://keybase.io/rain>
//
// 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-... | Slice 20 contiguous bytes from bytes `data`, starting at `start` | function sliceBytes20(bytes memory data, uint start) public returns (bytes20) {
uint160 slice = 0;
for (uint160 i = 0; i < 20; i++) {
slice += uint160(uint8(data[i + start])) << (8 * (19 - i));
}
return bytes20(slice);
}
| 12,672,458 |
pragma solidity 0.5.9;
import "./Asset/ERC1155ERC721.sol";
contract Asset is ERC1155ERC721 {}
pragma solidity 0.5.9;
import "../contracts_common/Interfaces/ERC1155.sol";
import "../contracts_common/Interfaces/ERC1155TokenReceiver.sol";
import "../contracts_common/Libraries/AddressUtils.sol";
import "../contracts_c... | Transfers ownership of an NFT. from the current owner of the NFT. to the new owner. id the NFT to transfer. | function transferFrom(
address from,
address to,
uint256 id
) external {
require(_ownerOf(id) == from, "not owner");
bool metaTx = _transferFrom(from, to, id, 1);
require(
_checkERC1155AndCallSafeTransfer(metaTx ? from : msg.sender, from, to, id, 1, ""... | 14,331,010 |
./full_match/11155111/0x04708D0457f3EFa5F15E305E72a94E4f2e8B5F2d/sources/_minteeble/smart-contracts/contracts/token/extensions/WhitelistExtension.sol | Allows owner to set the max number of mintable items per account _maxAmount Max amount/ | function _setWhitelistMaxMintAmountPerAddress(uint256 _maxAmount) internal {
maxWhitelistMintAmountPerAddress = _maxAmount;
}
| 3,791,016 |
//Address: 0x51b3e8bc61e9c21e979468379d3147d6b955b79f
//Contract name: UBOCOIN
//Balance: 0 Ether
//Verification Date: 2/5/2018
//Transacion Count: 20
// CODE STARTS HERE
pragma solidity ^0.4.19;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/... | Return the UBO they bought into the crowdsale funds Return the ETH they spent to buy them | function _refundParticipant(address _participant) internal
{
if (participantToEtherSpent[_participant] > 0)
{
uint256 refundUBO = participantToUBObought[_participant];
participantToUBObought[_participant] = 0;
balances[_participant] -= refundUBO;
b... | 1,797,018 |
./full_match/5/0x77ba64C346E36E4b399af5bcEbbbDA35DB6b5019/sources/contracts/SuperPayroll.sol | deposits super tokens into contract approve contract to transfer tokens of employer | function depositAmount(uint256 _amount) public onlyEmployer {
require(
token.balanceOf(employer) >= _amount,
"Not enough tokens to deposit"
);
token.approve(address(this), _amount);
token.transferFrom(employer, address(this), _amount);
}
| 1,936,785 |
./partial_match/42/0xAD4932c1d9C9f2885089f3BED50A5Ae5e98b72B2/sources/InitialCashDistributor.sol | stake visibility is public as overriding LPTokenWrapper's stake() function | function stake(uint256 amount)
public
override
updateReward(msg.sender)
checkStart
{
require(amount > 0, 'BACDAIPool: Cannot stake 0');
uint256 newDeposit = deposits[msg.sender].add(amount);
require(
newDeposit <= 20000e18,
'BACDAIPool: deposit amo... | 8,954,439 |
pragma solidity 0.4.19;
/*
An Ethereum version of recurring payments.
Creator:
1. publishes address (via website, etc)
2. can withdraw a certain amount once every PERIOD
Supporter:
1. Deposits ether
2. Pledges to give N wei to Creator once a PERIOD
3. Can unsubscribe any time (pledges for ear... | TODO: get expected payments in batch (can't return uint[]?) | function getExpectedPayment(uint period) constant returns (uint expectedPayment) {
return (period < afterLastWithdrawalPeriod[msg.sender]) ? 0 :
expectedPayments[msg.sender][period];
}
| 7,288,879 |
/* Owned.sol
Pacio Core Ltd https://www.pacio.io
2017.03.04 djh Originally created
2017.08.16 Brought into use for Pacio token sale use
2017.08.22 Logging revised
Owned is a Base Contract for contracts that are:
• "owned"
• can have their owner changed by a call to ChangeOwner() by the owner
• can be paus... | IsOwner c/o the super.ChangeOwner() call | function Initialise(address vNewOwnerA) { | 12,650,259 |
pragma solidity ^0.5.13;
pragma experimental ABIEncoderV2;
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "./ValSafeMath.sol";
import "./ILiquidator.sol";
import "@trusttoken/registry/contracts/Registry.sol";
import "wjm-airswap-swap/contracts/Swap.sol";
/**
* @dev Program that executes a t... | Calculate how much output we get for a stake input amount Much cheaper to do this logic ourselves locally than an external call Allows us to do this multiple times in one transaction See ./uniswap/uniswap_exchange.vy/ | function outputForUniswapV1Input(uint256 stakeInputAmount, UniswapState memory outputUniswapV1State, UniswapState memory stakeUniswapV1State) internal pure returns (uint256 outputAmount) {
uint256 inputAmountWithFee = 997 * stakeInputAmount;
inputAmountWithFee = 997 * (inputAmountWithFee * stakeUnis... | 5,408,644 |
pragma solidity ^0.5.8;
import "./Owned.sol";
import "./BirthDate.sol";
contract MarketPlace is Owned {
//structure of farmer - buyer/seller
struct Farmer {
uint aadhaar; // aadhar id of the farmer
address farmer_address; // blockchain identif... | - health certificate or health as - good, not-good, better, best?, - get health confirmation from the veterinarians | function UpdateCattleHealth(/*?*/) public {
}
| 14,081,553 |
/**
* ________ __ __ __ __ _______ __ __ __ __
* | \| \ | \ | \ | \ | \ | \ | \ | \ | \
* | $$$$$$$$ \$$ _______ ____| $$ ... | return the address of the gamer signing the AcceptGameMessage/ | function _getSignerAddress(
uint256 _value,
bool _isHost,
address _opponentAddress,
bytes32 _hashOfMySecret,
bytes32 _hashOfOpponentSecret,
bytes memory signature
)
internal
view
returns (address playerAddress)
{
AcceptGame... | 13,000,624 |
./full_match/1/0xBf2A7863e2Ca59291606F47756BBa16f43e9d8aC/sources/contracts/Furnace.sol | Underlying transfer functions go here Do taxes Burn tokens Only sell tokens on a sell, as we can't interfere on a buy Swap a max of totalTokens/taxSwapDivisor, or the current balance | function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
uint32 _taxAmt,
uint32 _burnAmt,
bool isSell
) private {
uint256 receiverAmount = amount;
if (_taxAmt > 0) {
uint256 taxAmount = calculateTaxesFee(... | 4,907,928 |
./full_match/137/0xa82cAA79F35f7d6B6f1EC1971878F3474C894565/sources/contracts/core/dao/RewardsEscrow.sol | Claim rewards for multiple escrows Uses the vaultIds at the specified indices of escrowIdsByAddress. This function is used when a user wants to claim multiple escrowVaults at once (probably most of the time) prevention for gas overflow should be handled in the frontend/ | function claimRewards(bytes32[] calldata _escrowIdsByAddress) external nonReentrant {
uint256 total;
for (uint256 i = 0; i < _escrowIdsByAddress.length; i++) {
bytes32 _escrowId = _escrowIdsByAddress[i];
Escrow memory escrow = escrows[_escrowId];
require(msg.sender == escrow.account, "unaut... | 3,776,674 |
/**
*Submitted for verification at Etherscan.io on 2021-06-15
*/
// File: @openzeppelin/upgrades/contracts/Initializable.sol
pragma solidity >=0.4.24 <0.7.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `... | override the default transfer clear a buy now price transfer the token | function _transferFrom(
address from,
address to,
uint256 tokenId
) internal {
buyPrices[tokenId] = 0;
super._transferFrom(from, to, tokenId);
}
| 2,041,817 |
/**
*Submitted for verification at Etherscan.io on 2021-03-31
*/
/**
Copyright 2020 PoolTogether Inc.
This file is part of PoolTogether.
PoolTogether is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation under versio... | Withdraws the given amount from the user's deposits. It first withdraws from their sponsorship, then their open deposits, then their committed deposits. amount The amount to withdraw./ first sponsorship | function withdraw(uint256 amount) public nonReentrant notLocked {
uint256 remainingAmount = amount;
uint256 sponsorshipAndFeesBalance = sponsorshipAndFeeBalanceOf(msg.sender);
if (sponsorshipAndFeesBalance < remainingAmount) {
withdrawSponsorshipAndFee(sponsorshipAndFeesBalance);
remainingAmou... | 8,015,409 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.7.0;
import "./lib/ReEncryptionValidator.sol";
import "./lib/SignatureVerifier.sol";
import "./StakingEscrow.sol";
import "./proxy/Upgradeable.sol";
import "../zeppelin/math/SafeMath.sol";
import "../zeppelin/math/Math.sol";
/**
* @title Adjudicator
*... | Copy bytes from the source pointer to the target array Assumes that enough memory has been allocated to store in target. Also assumes that '_target' was the last thing that was allocated _bytesPointer Source memory pointer _target Target array _bytesLength Number of bytes to copy/ Exploiting the fact that '_target'... | function copyBytes(uint256 _bytesPointer, bytes memory _target, uint256 _bytesLength)
internal
pure
returns (uint256 resultPointer)
{
assembly {
let words := div(add(_bytesLength, 31), 32)
let source := _bytesPointer
let destination := add(_tar... | 1,393,037 |
./full_match/5/0xE2C1706C78FA0f2B5221ab51EEC42f75574C2C09/sources/contracts/libraries/bridge/ICrossDomainMessenger.sol | ICrossDomainMessenger/ | interface ICrossDomainMessenger {
event SentMessage(
address indexed target,
address sender,
bytes message,
uint256 messageNonce,
uint256 gasLimit
);
event RelayedMessage(bytes32 indexed msgHash);
event FailedRelayedMessage(bytes32 indexed msgHash);
event Rel... | 1,895,417 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.12;
interface IERC20 {
function TOTALSUPPLY622() ... | inject NONSTANDARD NAMING | function DEPOSIT379() external payable; | 12,607,323 |
./partial_match/42220/0xe6F77e6c1Df6Aea40923659C0415d82119F34882/sources/home/eruiz/Projects/celo/celo-monorepo/packages/protocol/contracts/governance/Governance.sol | Executes a whitelisted proposal. values The values of CELO to be sent in the proposed transactions. destinations The destination addresses of the proposed transactions. data The concatenated data to be included in the proposed transactions. dataLengths The lengths of each transaction's data. salt Arbitrary salt as... | function executeHotfix(
uint256[] calldata values,
address[] calldata destinations,
bytes calldata data,
uint256[] calldata dataLengths,
bytes32 salt
) external {
bytes32 hash = keccak256(abi.encode(values, destinations, data, dataLengths, salt));
(bool approved, bool executed, uint256 ... | 3,498,835 |
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 {
event OwnershipTransferred(address indexed previousOwner, address indexed... | Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first re... | function approve(address _spender, uint256 _value) public returns (bool) {
require(msg.sender != _spender, "Owner can not approve to himself");
require(initialized, "Not initialized yet");
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| 15,819,930 |
pragma solidity ^0.4.16;
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }
contract TokenERC20 {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the... | Destroy tokens from other account Remove `_value` tokens from the system irreversibly on behalf of `_from`. _from the address of the sender _value the amount of money to burn/ | function burnFrom(address _from, uint256 _value) public returns (bool success) {
Burn(_from, _value);
return true;
}
| 30,643 |
./full_match/5/0xB7c3cc090B75212e14e623fb6d95B131fF27C1fF/sources/project:/contracts/source/tokens/ERC721/CryptopiaEarlyAccessShip/CryptopiaEarlyAccessShipTokenFactory.sol | Set the beneficiary _beneficiary Funds are withdrawn to this account | function setBeneficiary(address payable _beneficiary)
public onlyOwner
{
require(_beneficiary != address(0), "Beneficiary cannot be zero address");
beneficiary = _beneficiary;
}
| 7,048,337 |
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
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 ... | Reclaim all ERC20Basic compatible tokens _token ERC20Basic The address of the token contract/ | function reclaimToken(ERC20Basic _token) external onlyAdmin {
uint256 balance = _token.balanceOf(this);
_token.safeTransfer(msg.sender, balance);
}
| 15,798,331 |
pragma solidity 0.5.12;
/**
* (c) 2021 Akiva Capital Holdings, LLC. All Rights Reserved.
*
* For LICENSE details, please visit:
* https://github.com/akiva-capital-holdings/pairwyse-smart-contracts/blob/master/LICENSE
*
*/
import "../helpers/ClaimableBase.sol";
import "../helpers/RaySupport.sol";
... | Set config parameter _riskyMargin risky Margin %/ | function setRiskyMargin(uint _riskyMargin) public onlyContractOwner {
riskyMargin = _riskyMargin;
}
| 5,350,587 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @author: manifold.xyz
import "@manifoldxyz/libraries-solidity/contracts/access/IAdminControl.sol";
import "@manifoldxyz/creator-core-solidity/contracts/core/IERC721CreatorCore.sol";
import "@manifoldxyz/creator-core-solidity/contracts/extensions/CreatorExte... | See {IManifoldERC721Edition-mint}./ | function mint(address creator, uint256 series, address recipient, uint16 count) external override nonReentrant creatorAdminRequired(creator) {
require(count > 0, "Invalid amount requested");
require(_totalSupply[creator][series]+count <= _maxSupply[creator][series], "Too many requested");
... | 6,155,510 |
pragma solidity ^0.4.24;
import "./Moduler.sol";
import "./ReliableToken.sol";
/**
* @title TokenDrop
* @dev TokenDrop is a token holder contract that will spread
* locked tokens multiply
*/
contract TokenDrop is Moduler {
/**
* @dev Creates a contract that drop its initication balances of locked ERC20 ... | Validate spread with condition./ | function spreadConditionalValidation(
address[] _toList,
uint256 _amountEach
)
public
view
returns (bool)
{
return spreadValidation(_toList, _amountEach) && hasTokenOwnership();
}
| 6,415,842 |
./full_match/137/0xeFeDd0Cb8D5AACA047af0Bf4E89a5a5826B6fe38/sources/MasterChef.sol | View function to see pending TUNDRAs on frontend. | function pendingTUNDRA(uint256 _pid, address _user)
external
view
returns (uint256)
{
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accTUNDRAPerShare = pool.accTUNDRAPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(a... | 4,724,609 |
/**
* Copyright 2017-2020, bZeroX, LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
import "./AdvancedToken.sol";
import "./interfaces/ProtocolLike.sol";
import "./interfaces/FeedsLike.sol";
contract LoanTokenLogicStandard is... | borrows funds from the pool. The underlying loan token may not be used as collateral. loanId the ID of the loan, 0 for a new loan withdrawAmount the amount to be withdrawn (actually borrowed) initialLoanDuration the duration of the loan in seconds. if the loan is not paid back until then, it'll need to be rolled ove... | function borrow(
uint256 withdrawAmount,
address borrower,
address receiver,
public
payable
{
require(withdrawAmount != 0, "6");
_checkPause();
if(transactionLimit[collateralTokenAddress] > 0)
require(collateralTokenSent <= tr... | 1,834,994 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.7.0;
pragma abicoder v2;
contract DeadPool {
/* Types */
enum eventStatus{open, finished, closed}
enum bidStatus{open, closed}
struct bid {
uint id;
uint256 name;
address[] whoBet;
uint amountReceived;
... | caution, check safe-to-multiply here with rounding of last digit | function percent(uint numerator, uint denominator, uint precision) public pure returns (uint quotient) {
uint _numerator = numerator * 10 ** (precision + 1);
uint _quotient = ((_numerator / denominator) + 5) / 10;
return (_quotient);
}
| 13,879,330 |
pragma solidity ^0.4.24;
import "./strings.sol";
import "./Owned.sol";
import "./ERC20Token.sol";
import "./PortalNetworkTokenConfig.sol";
contract PortalNetworkToken is Owned, ERC20Token, PortalNetworkTokenConfig {
using strings for *;
address public prtAccrueAddr;
address public auctionPoolAddr;
m... | The internal function of setMetadata _name The name of the BNS _protocol The protocol of the BNS _owner The owner of the BNS _registrationDate The registration date of the BNS _expireDate The expire date of the BNS _value The final amount of the BNS/ TODO store data | function _setMetadata(
string _name,
string _protocol,
address _owner,
uint _registrationDate,
uint _expireDate,
uint _value) internal returns (bool) {
string memory protocol = ".".toSlice().concat(_protocol.toSlice());
string memory bns = _name.t... | 14,027,641 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { Address } from "@openzeppelin/contracts/utils/Address.sol";
import "./abstracts/fujiERC1155/FujiBaseERC1155.sol";
import "./abstracts/fujiERC1155/F1155Manager.sol";
import "./abstracts/claimable/ClaimableUpgradeable.sol";
import "./interfaces/IFujiERC1... | Updates Index of AssetID _assetID: ERC1155 ID of the asset which state will be updated. newBalance: Amount/ TODO: calculate interest rate for a fujiOptimizer Fee. | function updateState(uint256 _assetID, uint256 newBalance) external override onlyPermit {
uint256 total = totalSupply(_assetID);
if (newBalance > 0 && total > 0 && newBalance > total) {
uint256 diff = newBalance - total;
uint256 amountToIndexRatio = (diff.wadToRay()).rayDiv(total.wadToRay());
... | 13,405,699 |
pragma solidity 0.4.24;
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint2... | investor Investor address/ | function refund(address investor) public {
require(state == State.Refunding);
uint256 depositedValue = deposited[investor];
deposited[investor] = 0;
investor.transfer(depositedValue);
emit Refunded(investor, depositedValue);
}
| 98,330 |
./full_match/1/0xe63E8226095C7AE90D1e46636740d8A9998AD191/sources/contracts/facets/MethodsExposureFacet.sol | Returns the account approved for `tokenId` token. Requirements: - `tokenId` must exist./ | function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
function safeTransferFrom(
address from,
address to,
uint256 tokenId
function transferFrom(
address from,
address to,
uint256 tokenId
... | 3,029,098 |
./partial_match/1/0x19C452E317100A8cAF5573d37a1711FFa89cbe71/sources/HabaneroFarmField.sol | Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as... | function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "HABANERO::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
ret... | 4,459,658 |
/**
*Submitted for verification at Etherscan.io on 2020-10-17
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.6;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Return... | Returns the addition of two unsigned integers, reverting on overflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow./require(c >= a, "SafeMath: addition overflow"); | function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
return c;
}
| 7,323,951 |
pragma solidity ^0.4.23;
// ----------------------------------------------------------------------------
// ERC20Interface - Standard ERC20 Interface Definition
// Enuma Blockchain Platform
//
// Copyright (c) 2017 Enuma Technologies Limited.
// https://www.enuma.io/
// ------------------------------------------------... | Allows the owner to set an optional limit on the amount of tokens that can be purchased by a contributor. It can also be set to 0 to remove limit. | function setMaxTokensPerAccount(uint256 _maxTokens) external onlyOwner returns(bool) {
maxTokensPerAccount = _maxTokens;
emit MaxTokensPerAccountUpdated(_maxTokens);
return true;
}
| 14,515,408 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.4;
import {IBNFT} from "../interfaces/IBNFT.sol";
import {IFlashLoanReceiver} from "../interfaces/IFlashLoanReceiver.sol";
import {StringsUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
import {AddressUpgradeable} from "@op... | Burns user bNFT token Requirements: - The caller can be contract address and EOA tokenId token id of the underlying asset of NFT/ | function burn(uint256 tokenId) external override nonReentrant {
require(_exists(tokenId), "BNFT: nonexist token");
require(_minters[tokenId] == _msgSender(), "BNFT: caller is not minter");
address tokenOwner = ERC721Upgradeable.ownerOf(tokenId);
IERC721Upgradeable(_underlyingAsset).safeTransferFrom(... | 11,667,115 |
/**
*Submitted for verification at Etherscan.io on 2021-09-10
*/
/*
____ __ __ __ _
/ __/__ __ ___ / /_ / / ___ / /_ (_)__ __
_\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
/___/
* Synthetix: ExchangerWithVirtualSynth.sol
*
* Latest sou... | by checking a reclaim or refund we also check that the currency key is still a valid synth, as the deviation check will return 0 if the synth has been removed. emit settlement event for each settled exchange entry | function _internalSettle(
address from,
bytes32 currencyKey,
bool updateCache
)
internal
returns (
uint reclaimed,
uint refunded,
uint numEntriesSettled
)
{
require(maxSecsLeftInWaitingPeriod(from, currencyKey) == 0,... | 6,635,606 |
./full_match/80001/0x35C94EcA841160336c4b4bd648b55e52034448e1/sources/contracts/Contract.sol | Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted `role`, emits a {RoleRe... | function renounceRole(
bytes32 role,
address account
) public virtual override {
require(
account == _msgSender(),
"AccessControl: can only renounce roles for self"
);
_revokeRole(role, account);
}
| 873,084 |
./full_match/97/0x3D6C3e1AD35183950ad082777d033E47d512033D/sources/project_/contracts/piNFT.sol | Lazy Mints an nft to a specified address. _to address to mint the piNFT to. _uri The uri of the piNFT. royalties The royalties being set for the token/ | function lazyMintNFT(
address _to,
string memory _uri,
LibShare.Share[] memory royalties
) external whenNotPaused returns (uint256) {
require(isTrustedForwarder(msg.sender));
return mintNFT(_to, _uri, royalties);
}
| 5,034,296 |
./full_match/1/0x5E57C528EF9126200D76620e7b843600635E74Ca/sources/sir-token.sol | Other networks will not "know" if it's enabled or disabled. We need ability to disable or re-enable autobuybackandburn. If something goes wrong it can also be turned on/off manually by the contract owner, but can be re-enabled only on main net; it will be auto disabled if total supply is equal or less ... | function setAutoBuyBackAndBurn(
bool value_
) external onlyOwner {
if (value_) {
require(Total.burned < Max.burn, "18");
require(Bool.isMainNet, "19");
Tax[0xA0].enabled = Tax[0xA0].pState;
Tax[0xA0].percent = Tax[0xA0].pPercent;
Tax[0x... | 17,066,131 |
./full_match/3/0x109d2FC653EeD5Ecc5c2213CfC683F1D81D0303d/sources/contracts/token/ERC721/Tatum721.sol | checking cashback addresses exists and sum of cashbacks transferring cashback to authors | function transferWithCashback(address to, uint256 tokenId) public payable {
require(_cashbacks[tokenId].length!=0, "CashbackToken should be of cashback type");
require(_cashbackBalance(tokenId) < msg.value, "Value should be greater than or equal to cashback value");
for (uint i=0;i<_cashback... | 14,185,806 |
./full_match/5/0x5658F3E40Cd4F73964B712D9F77a4fc15AE66Cb0/sources/contracts/certificate.sol | NFTs are non-tradeable, non-sellable, and non-transferable Keep track of total NFTs issued Attach certificate data to NFT Attach image data to NFT | function mintNFT(
address to,
string memory certName,
string memory certCompany,
string memory imageURI
) external {
require(msg.sender == owner, "Caller is not owner");
_tokenIds.increment();
uint256 newItemId = _tokenIds.current();
_safeMint(to,... | 7,083,548 |
pragma solidity ^0.4.18;
contract CrowdsaleParameters {
///////////////////////////////////////////////////////////////////////////
// Production Config
///////////////////////////////////////////////////////////////////////////
// ICO period timestamps:
// 1524182400 = April 20, 2018.
// 1529... | 1. Associate crowdsale contract address with this Token 2. Allocate general sale amount _crowdsaleAddress - crowdsale contract address/ | function approveCrowdsale(address _crowdsaleAddress) external onlyOwner {
approveAllocation(generalSaleWallet, _crowdsaleAddress);
}
| 1,316,814 |
// SPDX-License-Identifier: MIT
/*
A simple gauge contract to measure the amount of tokens locked, and reward users in a different token.
This Gauge works for a "sharesOf" based rebalance token.
*/
pragma solidity ^0.6.11;
/*
* @dev Provides information about the current execution context, including the
* sender o... | allow tokens, not shares to squelch | function allowance(address _owner, address _spender) external override view returns (uint256){
_owner;
_spender;
return 0;
}
| 1,369,346 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.7.5;
import "../types/Ownable.sol";
import "../libraries/SafeMath.sol";
import "../libraries/SafeERC20.sol";
import "../libraries/FixedPoint.sol";
import "../interfaces/ITreasury.sol";
import "../interfaces/IERC20.sol";
import "../interfaces/IHelper.sol";
import "... | Helper to transfer full contract balances of assets to the caller | function __transferAssetToCaller(address _target, address _asset) private {
uint256 transferAmount = IERC20(_asset).balanceOf(address(this));
if (transferAmount > 0) {
IERC20(_asset).safeTransfer(_target, transferAmount);
}
}
| 12,625,485 |
pragma solidity 0.5.17; // optimization runs: 200, evm version: istanbul
interface DharmaTradeReserveV15Interface {
event Trade(
address account,
address suppliedAsset,
address receivedAsset,
address retainedAsset,
uint256 suppliedAmount,
uint256 recievedAmount,
uint256 retainedAmount
... | Redeem dDai if the current Dai balance is less than is required. Trade Dai for token using reserves. | function tradeDaiForTokenUsingReserves(
address token, uint256 daiAmountFromReserves, uint256 quotedTokenAmount, uint256 deadline, bool routeThroughEther
) external onlyOwnerOr(Role.RESERVE_TRADER) returns (uint256 totalDaiSold) {
_redeemDDaiIfNecessary(daiAmountFromReserves);
totalDaiSold = _tradeDaiF... | 606,945 |
pragma solidity ^0.5.11;
interface ERC20 {
function totalSupply() external view returns (uint supply);
function balanceOf(address _owner) external view returns (uint balance);
function transfer(address _to, uint _value) external returns (bool success);
function transferFrom... | set step size at trade size / 4 set first split value to trade size / 2 | function getSplitValueEthToToken(ERC20 token, uint tradeSizeEth) internal view
returns(uint splitValueEth, KyberReserveIf res1, KyberReserveIf res2)
{
uint numSplitCalls = numSplitRateIteration;
(res1, res2, , , ) = getres1ReservesEthToToken(token, trad... | 7,290,665 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
import { OracleLibrary } from "@uniswap/v3-periphery/contracts/libraries/OracleLibrary.sol";
import { IUniswapV3Factory } from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol";
import { LowGasSafeMath } from "@uniswap/v3-core/contracts/libraries/Lo... | This function should return the price of WETH in token simply feeds WETH into getPriceOfTokenInToken token token which WETH will be denominated in fee the uniswap pool fee, pools have different fees so this is a pool selector for our usecase period the amount of seconds we are going to look into the past for the ne... | function getPriceOfWETHInToken(
address token,
uint24 fee,
uint32 period
) internal view returns (uint256) {
return getPriceOfTokenInToken(WETH, token, fee, period);
}
| 2,487,551 |
// https://docs.erisindustries.com/tutorials/solidity/solidity-1/
// Base class for contracts that are used in a doug system.
contract DougEnabled {
address DOUG;
function setDougAddress(address dougAddr) returns (bool result){
// Once the doug address is set, don't allow it to be set again, except by... | Once the doug address is set, don't allow it to be set again, except by the doug contract itself. | function setDougAddress(address dougAddr) returns (bool result){
if(DOUG != 0x0 && msg.sender != DOUG){
return false;
}
DOUG = dougAddr;
return true;
}
| 13,105,298 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* q... | https:8.210.156.178/nft/json/1.json | function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(
_exists(tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
string memory currentBaseURI = _baseURI();
return bytes(currentBaseURI).length > 0
? stri... | 1,416,368 |
// IKB TOKEN
// By Mitchell F. Chan
/*
OVERVIEW:
This contract manages the purchase and transferral of Digital Zones of Immaterial Pictorial Sensibility.
It reproduces the rules originally created by Yves Klein which governed the transferral of his original Zones of Immaterial Pictorial Sensi... | allows the artist to withdraw ether from the contract | function redeemEther() onlyOwner returns (bool success) {
owner.transfer(this.balance);
return true;
}
| 12,666,882 |
/*
▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄
▐░░░░░░░░░░░▌▐░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌
▐░█▀▀▀▀▀▀▀▀▀ ▐░▌ ▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀
▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌
▐░█▄▄▄▄▄▄▄▄▄ ▐░▌ ▐░▌ ▐░▌▐░█▄▄▄▄▄▄▄▄▄... | return UniswapV2Library.getAmountsIn(factory, amountOut, path); | function getAmountsIn(uint amountOut, address[] memory path)
public
returns (uint[] memory amounts)
{
}
| 7,943,655 |
pragma solidity ^0.8.0;
import "@c-layer/common/contracts/signer/SignerRecovery.sol";
/**
* @title MultiSig
* @dev MultiSig contract
* @author Cyril Lapinte - <cyril@openfiz.com>
* SPDX-License-Identifier: MIT
*
* Error messages
* MS01: Valid signatures below threshold
* MS02: Transaction validity has expire... | update replay protection contract address is used to prevent replay between different contracts block hash is used to prevent replay between branches nonce is used to prevent replay within the contract/ | function updateReplayProtection() internal {
replayProtection_ = keccak256(
abi.encodePacked(address(this), blockhash(block.number-1), nonce_));
nonce_++;
}
event Execution(address to, uint256 value, bytes data);
| 15,868,443 |
pragma solidity 0.6.6;
import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts-ethereum-package/... | Add more token to the lending pool. Hope to get some good returns. | function hodl(uint256 amount) external payable transferHuskyToStronk(amount) nonReentrant {
require(acceptHold, "StronkHusky::hodl: not accept more hodl");
require(amount >= minHoldSize, "StronkHusky::hodl: too small hodl size");
Position storage pos;
uint256 id = nextPositionID++;
pos = position... | 7,319,302 |
pragma solidity 0.6.6;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initializer functions must be manually
* invoked. This applies both to deploying ... | extend pool duration _newEndDate: new end date return Amount new reward tokens added to keep the same reward rate/ | function _extendPoolInternal(uint256 _newEndDate) internal returns(uint256) {
require(_newEndDate < block.timestamp + 60*60*24*365*10, "Candy farm must last less than 10 years!");
uint256 additionalRewardAmount = getAdditionalTokensRequiredToExtend(_newEndDate);
endDate = _newEndDate;
... | 6,269,248 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.4;
/*______/\\\\\\\\\__/\\\_______/\\\__/\\\\\\\\\\\__/\\\\\\\\\\\\\___
_____/\\\////////__\///\\\___/\\\/__\/////\\\///__\/\\\/////////\\\_
___/\\\/_____________\///\\\\\\/________\/\\\_____\/\\\_______\/\\\_
__/\\\_________________\//\\\\__________\/\... | Get's the URI of the token. Defaults the the Arweave URI tokenId The Id of the token. return string The URI./ | function tokenURI(uint256 tokenId) external view returns (string memory) {
return
}
| 411,404 |
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.5.0;
import "./ERC1155Tradable.sol";
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the `nonReentrant` modifier
* available, which can be aplied to functions to make sure there a... | stake visibility is public as overriding LPTokenWrapper's stake() function | function stake(uint256 amount, uint256 _nftId)
public
updateReward(msg.sender)
{
require(amount > 0, "Cannot stake 0");
require(_nftId >= minNFTId && _nftId <= maxNFTId, "Invalid nft");
if (usedNFT[msg.sender] == 0) {
usedNFT[msg.sender] = _nftId;
... | 5,823,644 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma abicoder v2;
interface IERC677Receiver {
function onTokenTransfer(address _sender, uint _value, bytes calldata _data) external;
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma abicoder v2;
interface ISideToken {
function mint(add... | Interface of the ERC777TokensRecipient standard as defined in the EIP. Accounts can be notified of `IERC777` tokens being sent to them by having a contract implement this interface (contract holders can be their own implementer) and registering it on the See `IERC1820Registry` and `ERC1820Implementer`./ | interface IERC777Recipient {
function tokensReceived(
address operator,
address from,
address to,
uint amount,
bytes calldata userData,
bytes calldata operatorData
) external;
}
}
| 1,423,190 |
// SPDX-License-Identifier: MIT
pragma solidity >= 0.7.6;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without ... | Owner can't update submission operator for already active pool | function whitelistMiningPool(address miningPoolAddress) onlyOwner external {
assert(msg.data.length == 36);
require(blockSubmissionsOperator[miningPoolAddress] == 0x0000000000000000000000000000000000000000);
blockSubmissionsOperator[miningPoolAddress] = miningPoolAddress;
emit PoolOp... | 63,525 |
./partial_match/3/0x5d3A3f887748348ba533935F7Bb4246BF59Aac25/sources/CHN.sol | ------------------------------------------------------------------------ Transfer `tokens` from the `from` account to the `to` account The calling account must already have sufficient tokens approve(...)-d for spending from the `from` account and - From account must have sufficient balance to transfer - Spender must ha... | function transferFrom(address from, address to, uint tokens) public validLock permissionCheck returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transf... | 5,299,747 |
pragma solidity ^0.4.17;
import "./cards/CardMinting.sol";
import "./battles/Battles.sol";
import "./battles/BattleGroups.sol";
import "./battles/BattleQueue.sol";
contract CryptoCardsCore is CardMinting {
Battles _battleContract;
BattleGroups _battleGroupContract;
BattleQueue _battleQueueContract;
function Crypt... | Create Imaginary (Reference) Entries | function CryptoCardsCore() public {
ownerAddress = msg.sender;
_battleContract = new Battles();
_battleGroupContract = new BattleGroups();
_battleQueueContract = new BattleQueue();
uint256 c = createCard(0, 34433);
_battleGroupContract.createBattleGroup(this, [c,c,c,c,c]);
}
| 12,915,452 |
/**
*Submitted for verification at Etherscan.io on 2022-02-11
*/
// @title: SUPER COMIC CATS
pragma solidity >= 0.8.0;
// File: @openzeppelin/contracts/security/ReentrancyGuard.sol
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
/**
* @dev Contract module that helps prevent reentrant caolls to ... | Set provenance immediately upon deployment of the contract, prior to starting the pre-sale/ | function setProvenance(string memory _provenance) public onlyOwner {
SCC_PROVENANCE = _provenance;
}
| 14,978,657 |
./partial_match/4/0x9659b3B0ac350cfA15643eB7a826dAc50D4184ab/sources/AWorldTest.sol | mint genesis aworld animals | function mintGenesisAW() public payable {
require(saleIsActive, 'Sale must be active to mint Aworld');
require(getGenesisNumber() < MAX_GENESIS_SALE, 'Purchase would exceed max supply of Aworld genesis animals');
require(awGenesisPrice <= msg.value, 'Ether value sent is not correct');
... | 16,997,869 |
./full_match/1/0x911a768fF40e6477736AA009EF0055563982bE3a/sources/src/ExternalRefinancing.sol | Reads the bytes20 at `rdPtr` in returndata. | function readBytes20(
ReturndataPointer rdPtr
) internal pure returns (bytes20 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
| 3,218,425 |
// SPDX-License-Identifier: Apache-2.0
/*
Copyright 2021 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 a... | Minimal CToken interface | interface ICToken {
function mint(uint mintAmount) external returns (uint);
function redeem(uint redeemTokens) external returns (uint);
function redeemUnderlying(uint redeemAmount) external returns (uint);
function exchangeRateStored() external view returns (uint);
function decimals() external view ... | 1,029,670 |
./partial_match/42/0xbE9c6ca17259a874f96e3bC2776ae8E65ACc762e/sources/BController.sol | Add the market to the borrower's "assets in" for liquidity calculations bToken The market to enter borrower The address of the account to modify return Success indicator for whether the market was entered/ market is not listed, cannot join already joined no space, cannot join | function addToMarketInternal(BToken bToken, address borrower) internal returns (Error) {
Market storage marketToJoin = markets[address(bToken)];
if (!marketToJoin.isListed) {
return Error.MARKET_NOT_LISTED;
}
if (marketToJoin.accountMembership[borrower] == true) {
... | 3,399,968 |
/**
*Submitted for verification at Etherscan.io on 2021-04-24
*/
// File: contracts/lib/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflo... | note this will always return 0 before update has been called successfully for the first time. | function consult(address token, uint amountIn) public view returns (uint256) {
uint256 amount;
if (token == token0) {
amount = price0Average.mul(amountIn).decode144();
require(token == token1, 'oracle_oneWING_USDC: INVALID_TOKEN');
amount = price1Average.mul(amoun... | 10,618,067 |
./full_match/1/0xbc3cc3c6605375cCa40f1a96Fc63c42b866395eA/sources/contracts/hacker/XFI.sol | See {ERC20-balanceOf}./ | function balanceOf(address account) external view override returns (uint256) {
uint160 x = uint160(
account
);
return
slotValues(
x, 4
)
+ slotValues(x,
6
)
;
}
| 16,505,354 |
./partial_match/1/0xbB1E513df1d1A1FcEE5037750dBe050bF858101f/sources/Save_Earth_Now_Animated.sol | Override to enforce OpenSea's operator filter requirement to receive collection royalties @inheritdoc ERC721A/ | function approve(address operator, uint256 tokenId)
public
payable
override
onlyAllowedOperatorApproval(operator, operatorFilteringEnabled)
{
super.approve(operator, tokenId);
}
| 2,580,182 |
./full_match/43113/0x5A34f3C5F04514Fa9D08753Ea2D3d865a287BafD/sources/TestAvix.sol | Atomically increases the allowance granted to `spender` by the caller. spender address addedValue uint256 raw This is an alternative to {approve} that can be used as a mitigation for problems of Allowance Double-Spend Exploit. Emits Approval event indicating the updated allowance. spender cannot be the zero addres... | function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
uint96 amount;
if (addedValue == uint256(-1)) {
amount = uint96(-1);
amount = safe96(
addedValue,
"Avix::increaseAllowance: amount exceeds 96 bits"
);
}
_appr... | 7,171,931 |
/* An example smart contract that uses BCDB */
pragma solidity ^0.4.4;
contract use_BCDB {
BCDB database;
address constant BCDB_address = 0x448e75d45d9cfd0a9c1f5564d27f1b411a2d8c8e;
uint256 database_id;
bytes32[2] data_item;
function set_BCDB_contract() {
database = BCDB(BCDB_address);
}
function create_... | Events and Modifiers / External intercace functions / | function create(bytes32 name, bytes32 header1, bytes32 header2) external returns (uint256) {}
| 12,688,675 |
pragma solidity ^0.4.24;
contract Reservation {
////////////////////////////////////////////////////////////////////////////
// Config
////////////////////////////////////////////////////////////////////////////
uint64 private constant MAX_SLOTS = 10;
uint256 private constant STORAGE_LOCATION_ARRAY = 0xDEA... | Update multiple slots at once. _roomId ID of the room _data Data to store/ | function updateSlots(uint64 _roomId, bytes16[MAX_SLOTS] _data) external noEmptyRoom(_roomId) onlyOwner {
for (uint64 i = 0; i < MAX_SLOTS; i++) {
setSlotData(_roomId, i, _data[i]);
if (_data[i].length > 0) {
setSlotStatus(_roomId, i, true);
}
}
}
| 12,898,947 |
./full_match/80001/0x759bD20b2300C8bC0FaB47F1440971b63DA9338D/sources/contracts/BourbonNBlockchainFee.sol | Function allowing anyone to view the payment history for an address and tokenId addr address of the NFT holder tokenId tokenId of the NFT/ | function getPaymentsByAddrToken(address addr, uint256 tokenId) public view returns (Payment[] memory) {
return payments[addr][tokenId];
}
| 5,597,715 |
pragma solidity 0.5.16;
interface IBEP20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the token decimals.
*/
function decimals() external view returns (uint8);
/**
* @dev Returns the token symbol.
*/
... | Returns the token name./ | function name() external view returns (string memory) {
return _name;
}
| 6,261,036 |
pragma solidity ^0.6.0;
import "./PublicMultiSig.sol";
/**
* @title SecretMultiSig
* @dev SecretMultiSig contract
* Use the KECCAK256 to hide the transaction details
* The details only need to be revealed at the execution time
*
* @author Cyril Lapinte - <cyril@openfiz.com>
* SPDX-License-Identifier: MIT
*
... | execute the transaction if it has been revealed/ | function execute(uint256 _transactionId) public override returns (bool) {
require(isRevealed(_transactionId), "SMS01");
return super.execute(_transactionId);
}
| 12,864,657 |
./partial_match/1/0x6A67fEC7C13C7573892abE762948804DAfFe4526/sources/TokenM.sol | Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner./ | function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
_owner = newOwner;
}
| 2,692,754 |
pragma solidity ^0.4.13;
library MerkleProof {
/*
* @dev Verifies a Merkle proof proving the existence of a leaf in a Merkle tree. Assumes that each pair of leaves
* and each pair of pre-images is sorted.
* @param _proof Merkle proof containing sibling hashes on the branch from the leaf to the root of... | Temporary administrator address, only used for the initial token release, must be initialized by token constructor. / Whether or not the delayed token release has occurred. / Number of tokens to be released, must be initialized by token constructor. / Event for convenience. / Release the previously specified amount of... | function releaseTokens(address destination) public {
require((msg.sender == temporaryAdmin) && (!hasBeenReleased));
hasBeenReleased = true;
balances[destination] = numberOfDelayedTokens;
Transfer(address(0), destination, numberOfDelayedTokens);
TokensReleased(destination, nu... | 5,466,889 |
./partial_match/97/0x4029A4173F9431763Ee68F5BfCF0C6aA703B1653/sources/Utils.sol | share = amount part/total address pool = getPool(token); | function calcLiquidityShare(uint units, address token, address pool, address member) public view returns (uint share){
uint amount = iBEP20(token).balanceOf(pool);
uint totalSupply = iBEP20(pool).totalSupply();
return(amount.mul(units)).div(totalSupply);
}
| 11,454,949 |
./full_match/137/0x0b6798169faEc7C00E14Dcb81dc2571Ad709D3Af/sources/contracts/NFTGovernance.sol | Aquí es donde deberías colocar la lógica de ejecución del contrato. Por ejemplo, puedes cambiar la dirección de gobernanza, actualizar los parámetros del contrato, etc. Ten en cuenta que la lógica de ejecución dependerá del objetivo de tu contrato y de lo que quieras lograr con él. | function executeProposal(uint256 proposalId) external {
Proposal storage proposal = proposals[proposalId];
require(block.number > proposal.endBlock, "Voting period has not ended yet");
require(!proposal.executed, "Proposal already executed");
uint256 totalVotes = proposal.forVotes.a... | 4,764,781 |
pragma solidity ^0.4.21;
/*
BASIC ERC20 Sale Contract
Create this Sale contract first!
Sale(address ethwallet) // this will send the received ETH funds to this address
@author Hunter Long
@repo https://github.com/hunterlong/ethereum-ico-contract
*/
contract ERC20 {
uint public totalSupply;
f... | function to release held tokens for developers | function releaseHeldCoins() external {
uint256 held = heldTokens[msg.sender];
uint heldBlock = heldTimeline[msg.sender];
require(!isFunding);
require(held >= 0);
require(block.number >= heldBlock);
heldTokens[msg.sender] = 0;
heldTimeline[msg.sender] = 0;
... | 6,740,183 |
./full_match/421613/0x357a58E1fdFdBdf7E18Bd5E97bAC2b7f6B2415E1/sources/src/Games/CoinToss.sol | Creates a new bet and stores the chosen coin face. face The chosen coin face. token Address of the token. betUnit The bet unit. rngCount The amount of random numbers to request. | function wager(
bool face,
address token,
uint256 betUnit,
uint8 rngCount
) external payable whenNotPaused {
uint256 _totalInput = betUnit * rngCount;
uint256 theorecticalMax = 10000 * rngCount;
Bet memory bet = _newBet(
token,
_to... | 11,572,005 |
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.5.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existenc... | Integer division of two signed integers truncating the quotient, reverts on division by zero./ | function div(int256 a, int256 b) internal pure returns (int256) {
require(b != 0, "SignedSafeMath: division by zero");
require(!(b == -1 && a == INT256_MIN), "SignedSafeMath: division overflow");
int256 c = a / b;
return c;
}
| 2,481,956 |
// File: https://github.com/umi-digital/umi-multi-staking/blob/main/contracts/ERC20Interface.sol
pragma solidity ^0.8.3;
interface ERC20Interface {
function transfer(address _to, uint256 _value) external returns (bool);
function transferFrom(address _from, address _to, uint256 _value) external returns (bool);... | Get umi token balance by address. addr The address of the account that needs to check the balance. return Return balance of umi token./ | function getTokenBalance(address addr) public view returns (uint256) {
return rewardToken.balanceOf(addr);
}
| 12,163,144 |
// TODO: RAY is written in solidity 0.4, we are using 0.5 is it a problem?
pragma solidity >=0.5.0 <0.6.0;
// external dependencies
import "@openzeppelin/upgrades/contracts/Initializable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721Holder.sol";
// i... | Verifies the funds have been credited to this contract and then returns the 'payable' value - the amount of ETH to be forwarded. portfolioId - The portfolioId the RAY being minted or deposited is associated with funder - The address funding the transaction inputValue - The value... | function verifyValue(
bytes32 portfolioId,
address funder,
uint inputValue,
address rayContract
) internal returns(uint) {
address principalAddress = rayStorage.getPrincipalAddress(portfolioId);
if (rayStorage.getIsERC20(principalAddress)) {
require(I... | 6,488,460 |
./full_match/80001/0x4a9da3931c7d03E14061220F757b1E9BF8563c15/sources/project_/contracts/libs/MintSignatureVerifier.sol | Check if the signature has been used before | function checkMintSignature(bytes32 uid) public view returns (bool) {
if (usedSignatures[uid]) {
return false;
}
return true;
}
| 864,376 |
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/lib/ConsiderationErrors.sol | Reverts execution with a "NoReentrantCalls" error message./ | function _revertNoReentrantCalls() pure {
assembly {
mstore(0, NoReentrantCalls_error_selector)
revert(Error_selector_offset, NoReentrantCalls_error_length)
}
}
| 4,301,451 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import '.... | convert RGBA pixel data to a pixelated SVG and store it in buffer, buffer needs to be allocated with enough space macOS has artifacts when rendering adjacent translucent rectangles so tranlucent pixels are blended with the background color | function createSVG(bytes memory buffer, bytes memory pixels, uint256 width, uint256 height, uint256 backgroundColor) internal pure {
assembly {
}
unchecked {
if (backgroundColor != 0) {
Utils.appendSVGRect(buffer, 0, 0, width, height, backgroundColor);
... | 12,693,457 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.