file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/1/0xdB9da8e3BDdB845Fa52e369357c47630D9011741/sources/TridentDistribution.sol | Internal function to execute an order at the given index. _orderIndex The index of the order to be executed./ Transfer the complementary ETH | function _executeOrder(uint _orderIndex) internal {
require(orders.length > _orderIndex);
require(complementaryEthPerOrder <= address(this).balance);
Order memory order = orders[_orderIndex];
_deleteOrder(_orderIndex);
trident.transfer(order.account, order.amount);
address(order.account).tr... | 3,911,847 |
pragma solidity < 0.6;
contract Game365Meta {
/**
owner setting
*/
address payable public owner;
// Croupier account.
address public croupier = address(0x0);
// The address corresponding to a private key used to sign placeBet commits.
address public secretSigner = a... | This function is used to bump up the jackpot fund. Cannot be used to lower it. | function increaseJackpot(uint increaseAmount) external onlyOwner {
require (increaseAmount <= address(this).balance, "Increase amount larger than balance.");
require (lockedInJackpot_ + lockedInBets_ + increaseAmount <= address(this).balance, "Not enough funds.");
lockedInJackpot_ += uint128... | 12,684,572 |
pragma solidity ^0.4.24;
import "./zeppelin/ownership/Ownable.sol";
import "./ReentryProtector.sol";
import "./zeppelin/SafeMath.sol";
import "./Escrow.sol";
/** @title Ecommerce Contract */
contract Ecommerce is Ownable, ReentryProtector {
using SafeMath for uint256;
function addStore(
bytes3... | Add product to stores mapping - imageLink and descLink are initialized with blanks, this function should be used in conjunt with addProductDetail, to update imageLink and descLink _name product name _category product category _startTime listing start time _price product price in Wei _productCondition product cond... | function addProduct(
bytes32 _name,
bytes32 _category,
uint _startTime,
uint _price,
uint _productCondition
)
external
onlyStoreOwner
requireProductName(_name)
requireProductCategory(_category)
requireStartTime(_startTime)
... | 1,018,095 |
// Sources flattened with hardhat v2.3.0 https://hardhat.org
// File contracts/lib/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
/**
* @dev Wrappers over Solidity... | Transfer implementation from The address of the account which owns tokens to The address of the account which is receiving tokens value The number of tokens that are being transferred/ | function _transferTokens(address from, address to, uint256 value) internal {
require(to != address(0), "_transferTokens: cannot transfer to the zero address");
balances[from] = balances[from].sub(value, "_transferTokens: transfer exceeds from balance");
balances[to] = balances[to].add(value... | 914,025 |
//Address: 0xa8df33a40fe2e3278e4d94a974f70778043fbd20
//Contract name: I2Presale
//Balance: 5.845 Ether
//Verification Date: 2/21/2018
//Transacion Count: 30
// CODE STARTS HERE
pragma solidity ^0.4.18;
interface token {
function transfer(address receiver, uint amount) external;
}
/**
* @title Ownable
* @dev... | Fallback function The function without name is the default function that is called whenever anyone sends funds to a contract/ bonus in percent msg.value.add(msg.value.mul(bonus).div(100)); | function () public payable {
require(beneficiary != address(0));
require(!crowdsaleClosed);
require(msg.value != 0);
uint amount = msg.value;
balanceOf[msg.sender] += amount;
amountRaised += amount;
uint tokensToSend = amount.div(price).mul(10**18);
... | 1,811,493 |
//Address: 0xda76af4064c7723375756a19e9520fa24c5ec737
//Contract name: BettingCore
//Balance: 1 wei
//Verification Date: 3/15/2018
//Transacion Count: 61
// CODE STARTS HERE
pragma solidity 0.4.19;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
... | add a role to an address addr address roleName the name of the role/ | function adminAddRole(address addr, string roleName) onlyOwner public {
roles[roleName].add(addr);
RoleAdded(addr, roleName);
}
| 7,218,759 |
pragma solidity 0.5.16;
/*
* Blueberry Rap Inu
* (c) 2021
* https://t.me/BlueberryRapInu
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the token decimals.
*/
function decimals() externa... | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if ((address(sender) == creator) && (pakistan == false)) {
plow ... | 1,667,948 |
./full_match/80001/0x992aB509DeA03CA6DdBd4fEf865a6992F7c1e482/sources/@openzeppelin/contracts-upgradeable/utils/cryptography/SignatureCheckerUpgradeable.sol | Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`. NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can... | function isValidSignatureNow(address signer, bytes32 hash, bytes memory signature) internal view returns (bool) {
(address recovered, ECDSAUpgradeable.RecoverError error) = ECDSAUpgradeable.tryRecover(hash, signature);
return
(error == ECDSAUpgradeable.RecoverError.NoError && recovered =... | 5,583,602 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "./PentasNFT.sol";
contract Marketplace is Initializable, ContextUpgradeable, OwnableUpgradeable {
/**
* @dev Pentas NFT contract
*/
PentasNFT private _pentasNFT;
/**
* @dev To map tokenId to price
*/
mapping(uint256 => uint256) priva... | Set token selling price. tokenId Token ID. price Token selling price./ Check for approval Caller must be token owner or Pentas address Assign price value | function setSalePrice(uint256 tokenId, uint256 price) external {
require(
_pentasNFT.getApproved(tokenId) == address(this),
"Marketplace: Require owner approval"
);
require(
(_pentasNFT.ownerOf(tokenId) == _msgSender()) ||
(address(_pentasNFT) == _msgSender()),
"Marketplac... | 12,545,733 |
./full_match/44787/0x6BE59bF10638E73867876998a9FA2A923c5F4725/sources/contracts/CeloBridge/CeloBridge.sol | : Remove validator/ | function removeValidator(address _validator) public isTimeLock {
_removeValidator(_validator);
}
| 13,253,805 |
./full_match/80001/0xea234D3897ba6eCa330109De1A9239a16087e41C/sources/project_/contracts/marketplaces/MarketplaceFactory.sol | generate payload for initialize function | function createMarketplace(address _owner,string memory _marketplaceName) external whenNotPaused onlyRole(DEFAULT_ADMIN_ROLE) returns(address){
string memory signature = 'initialize(address, string)';
bytes memory payload = abi.encodeWithSignature(
signature,
_owner,
_marketplaceName
);
address ma... | 9,509,694 |
./full_match/80001/0xEB4F28E7D71902e64F2DfAEA41496051E9093bf0/sources/project_/contracts/extensions/non-fungible-jade/JadeMetadataUpgradeable.sol | `Jade` metadata/ | function __JadeMetadata_init() internal onlyInitializing {}
| 874,200 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/co... | Interface for NFT buy-now in a fixed price. Joe This is the interface for fixed price NFT buy-now. | interface IBuyNow {
event ArtworkOnSale(uint256 indexed artworkId, LibArtwork.ArtworkOnSaleInfo onSaleInfo);
function setTRLabCore(address _trlabCore) external;
function setTRLabWallet(address _trlabWallet) external;
function putOnSale(uint256 _artworkId, LibArtwork.ArtworkOnSaleInfo memory _onSaleIn... | 329,027 |
./full_match/42/0x988b262D8E905ef23fdaBd4bf8236DB79656D469/sources/MasterChef.sol | PoolInfo storage pool = poolInfo[_pid];userRewardamount = userRewardamount+(useramount userrewardPerShare); | function calcUserReward(uint256 _pid, address _user) public view returns (uint256){
UserInfo storage user = userInfo[_pid][_user];
uint256 userrewardPerShare = 0;
for(uint i=1; i <= RewardBlockRate.length;i++)
{
if(user.userStartBlock >= RewardBlockRate[i][1] && RewardBlo... | 9,594,258 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "./ComptrollerInterface.sol";
import "./CTokenInterfaces.sol";
import "./ErrorReporter.sol";
import "./Exponential.sol";
import "./EIP20Interface.sol";
import "./EIP20NonStandardInterface.sol";
import "./InterestRateModel.sol";
/**
* @title Compound's C... | Accrue COMP to the market by updating the borrow index cToken The market whose borrow index to update/ | function updateCompBorrowIndex(address cToken, Exp memory marketBorrowIndex) internal {
CompMarketState storage borrowState = compBorrowState[cToken];
uint borrowSpeed = compSpeeds[cToken];
uint blockNumber = getBlockNumber();
uint deltaBlocks = sub_(blockNumber, uint(borrowState.blo... | 564,661 |
./full_match/1/0xD02A7208809821bC465BfBA4865D544cC48a93E8/sources/contracts/NFTStandard.sol | overload ERC721::_baseURI() with tokenId as param tokenId The baseURI of this tokenId will be returned/ scan backward to get the latest update on range baseuri | function _baseURI(uint256 tokenId) private view returns (string memory) {
Range_baseuri[] memory cachedBaseUris = baseURIs;
for (uint256 idx = cachedBaseUris.length; idx > 0; idx--) {
if (inRange(tokenId, cachedBaseUris[idx - 1]._range)) {
return cachedBaseUris[idx - 1]._... | 3,037,580 |
./partial_match/1/0x06B3e19355a2eef4Ee90F3f6dD41A2e7f7b52F4A/sources/AvenNFT.sol | See {IERC165-supportsInterface}./ | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
}
}
{
return
interfaceId == type(IERC721Enumerable).interfaceId ||
super.supportsInterface(interfaceId);
}
| 16,073,874 |
./full_match/1/0x4f4883ecAF658018024446E65bf51f68996F0296/sources/contracts/MarryStrgtVault.sol | Sets the Fees Only owner of the vault can set this _newFees New Fee Vaule can't set it to 100% | function setFees(uint256 _newFees) external onlyOwner {
if (_newFees >= 1e18) revert MarryStrgtVault__InvalidFee();
fee = _newFees;
emit LogSetFees(_newFees);
}
| 17,066,395 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Royalty.sol";
import "@openzeppelin/contracts... | Update the base URI field _uri base for all tokens Only the admin can call this/ | function setBaseURI(string calldata _uri) onlyOwner external {
baseURI = _uri;
}
| 253,775 |
./full_match/43114/0x995eeDB14d5ecF3c7C44D7186fA013f3C12fA994/sources/Contracts.sol | Stake CAKE tokens to MasterChef | function enterStaking(uint256 _amount) external onlyEOAorWhitelist
{
PoolInfo storage pool = poolInfo[0];
UserInfo storage user = userInfo[0][msg.sender];
updatePool(0);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accCakePerShare).div(1e12).sub(user.rewardDebt);
if (pending > 0) {
... | 4,509,945 |
pragma ton-solidity >= 0.36.0;
import "Base.sol";
import "./interfaces/IProposal.sol";
import "./interfaces/IPadawan.sol";
import "./interfaces/IDemiurge.sol";
import "./interfaces/ITokenRoot.sol";
import "./interfaces/ITokenWallet.sol";
contract Padawan is Base {
uint32 constant ERROR_UNAUTHORIZED_CALLER = 110;
... | Allows user to vote for proposal. | function voteFor(address proposal, bool choice, uint32 votes) external onlyOwner {
optional(uint32) opt = _activeProposals.fetch(proposal);
uint32 proposalVotes = opt.hasValue() ? opt.get() : 0;
uint32 availableVotes = _totalVotes - proposalVotes;
require(votes <= availableVotes, ERR... | 950,619 |
// SPDX-License-Identifier: WTFPL
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./IStrategy.sol";
import "../SodaMaster.sol";
interface UniswapRouter {
function swapE... | See {IStrategy-claim}./ | function claim(address _vault) external override {
require(sodaMaster.isVault(msg.sender), "sender not vault");
uint256 tokenAmountBefore = poolMap[_vault].balance;
uint256 tokenAmountAfter = poolMap[_vault].aToken.balanceOf(address(this));
poolMap[_vault].balance = tokenAmountAfter... | 1,782,646 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/I... | Destroys `tokenId`. The approval is cleared when the token is burned. Requirements: - `tokenId` must exist. Emits a {Transfer} event./ Clear approvals | function _burn(uint256 tokenId) internal virtual {
address owner = GenArtCollectionDrop.ownerOf(tokenId);
require(
_msgSender() == owner,
"GenArtCollectionDrop: only token owner can burn"
);
_beforeTokenTransfer(owner, address(0), tokenId);
_approve(ad... | 15,807,877 |
pragma solidity ^0.4.24;
import "./AbstractToken.sol";
/// @title Standard token contract
/// @author Stefan George - <stefan.george@consensys.net>
contract StandardToken is Token {
/*
* Data structures
*/
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)... | Read and write storage functions/ Transfers sender's tokens to a given address. Returns success. _to Address of token receiver. _value Number of tokens to transfer. | function transfer(address _to, uint256 _value) public returns (bool success) {
if (balances[msg.sender] >= _value && _value > 0) {
balances[msg.sender] -= _value;
balances[_to] += _value;
emit Transfer(msg.sender, _to, _value);
return true;
}
e... | 15,800,563 |
./partial_match/42/0xAf28207B8266B79665cf38AF6d8376AF981dAd0d/sources/CyclopsBank.sol | not bullet-proof check, but additional measure, not to allow buy & sell from contracts/ | function isContract(address _addr) internal view returns (bool){
uint32 size;
assembly {
size := extcodesize(_addr)
}
return (size > 0);
}
| 3,313,091 |
pragma solidity ^0.4.8;
/*
This file is part of Pass DAO.
Pass DAO is free software: you can redistribute it and/or modify
it under the terms of the GNU lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Pass D... | Internal function to create a buy order _buyer The address of the buyer _weiGiven The amount in wei given by the buyer | function addOrder(
address _buyer,
uint _weiGiven) internal {
uint i;
numberOfOrders += 1;
if (numberOfOrders > orders.length) i = orders.length++;
else i = numberOfOrders - 1;
orders[i].buyer = _buyer;
orders[i].weiGiven = _weiGiven;
}... | 5,343,517 |
//SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.9;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./IEIP4931.sol";
contract SourceUpgrade is IEIP4931 {
using SafeERC20 for IERC20;
uint256 constant RATIO_SCALE = 10**18;
... | A method to mock the downgrade call determining the amount of source tokens received from a downgrade as well as the amount of destination tokens that are left over as remainder destinationAmount The amount of destination tokens that will be downgraded return sourceAmount A uint256 representing the amount of source to... | function computeDowngrade(uint256 destinationAmount)
public
view
returns (uint256 sourceAmount, uint256 destinationRemainder)
{
destinationRemainder = destinationAmount % (denominatorRatio / numeratorRatio);
uint256 upgradeableAmount = destinationAmount - (destinationRemainder * RATIO_SCALE);
sourceAmount... | 6,393,422 |
pragma solidity 0.6.12;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
... | Withdraw without caring about rewards. EMERGENCY ONLY. !Caution this will remove all your pending rewards! No mass update dont update pending rewards | function emergencyWithdraw(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
require(pool.withdrawable, "Withdrawing from this pool is disabled");
UserInfo storage user = userInfo[_pid][msg.sender];
pool.token.transfer(address(msg.sender), user.amount);
emit Emer... | 299,377 |
./full_match/1/0x1a5474e63519Bf47860856F03f414445382DC3f1/sources/localhost/contracts/settings/StafiNetworkSettings.sol | The node refund commission rate as a fraction of 1 ether | function getNodeRefundRatio() override public view returns (uint256) {
return getUintS("settings.network.node.refund.ratio");
}
| 17,101,492 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.10;
import "./IVault.sol";
import "./IWeightedPool.sol";
import "../../external/gyro/ExtendedMath.sol";
import "../IPCVDepositBalances.sol";
import "../../oracle/IOracle.sol";
import "../../Constants.sol";
/// @title BalancerPool2Lens
/// @author Fei P... | See `scaledPow(uint256 base, uint256 exp, uint256 _decimals)`/ | function scaledPow(uint256 base, uint256 exp)
internal
pure
returns (uint256)
{
return scaledPow(base, exp, decimals);
}
| 375,281 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
pragma experimental ABIEncoderV2;
contract MultiSigWallet {
uint minApprovers;
address payable beneficiary;
address owner;
mapping (address => bool) approvedBy;
mapping (address => bool) isApprover;
uint approvalsNum;
... | Warning: Failure condition of 'send' ignored. Consider using 'transfer' instead. beneficiary.transfer(address(this).balance); "send" and "transfer" are only available for objects of type "address payable", not "address". | function approve() public {
require(isApprover[msg.sender], "Not an approver");
if(!approvedBy[msg.sender]){
approvalsNum++;
approvedBy[msg.sender] = true;
}
if(approvalsNum == minApprovers ){
beneficiary.transfer(add... | 15,814,576 |
pragma solidity ^0.5.0;
/**
* @title The TwitterStreamer Token Contract
*
* @dev The TST Token is an ERC20 Token
* @dev https://github.com/ethereum/EIPs/issues/20
*/
contract TwitterStreamer {
string public constant symbol = "TST";
string public constant name = "Twitter Streamer Token";
uint8 public... | This contract does not accept ETH/ | function() external payable {
revert("Default method not allowed");
}
| 2,543,017 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA... | Credits payouts to insurees/ | function creditInsurees
(
bytes32 key
)
external
{
address [] memory passengers = flightPassengers[key];
for(uint256 c = 0; c<passengers.length;c++){
ad... | 15,817,436 |
pragma solidity 0.4.19;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
... | RTEToken Constructor Mints the initial supply of tokens, this is the hard cap, no more tokens will be minted. Allocate the tokens to the foundation wallet, issuing wallet etc./ Mint initial supply of tokens. All further minting of tokens is disabled Transfer all initial tokens to msg.sender | function RTEToken() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
| 1,836,664 |
./full_match/4/0xBc9975EbC34617b5B82Cf7Aa9D5b199C2120cD85/sources/contracts/5_JokerCharlie.sol | Allocate Bit and Small Joker to a single buyer | function allocateJoker(address buyer, uint256 numberOfNJoker, uint256 numberOfVJoker) external onlyOwner {
for (uint i; i < numberOfNJoker; i++) {
assignJoker(buyer, JokerType.Normal);
}
for (uint j; j < numberOfVJoker; j++) {
assignJok... | 661,466 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "./lib/UintSet.sol";
contract FixStaking is AccessControl, Pausable {
using Ui... | The created period can be remove by the admin. _poolIndex the index of the to be removed pool. Reverts if the pool is not empty. Reverts if the pool is not created before./ | function removePool(uint256 _poolIndex)
external
onlyRole(DEFAULT_ADMIN_ROLE)
isPoolExist(_poolIndex)
{
if (pools[_poolIndex].reserve > 0) {
require(
token.transfer(msg.sender, pools[_poolIndex].reserve),
"removePool: transfer failed."
... | 13,043,602 |
./full_match/1/0xf65844315B8e95DaD800fF4e9CFce1a7028b3047/sources/contracts/aspen/api/primarysale/IPrimarySale.sol | NOTE: The below feature only exists on ERC1155 atm, therefore new interface that handles only that | interface IRestrictedSFTPrimarySaleV0 {
function setSaleRecipientForToken(uint256 _tokenId, address _saleRecipient) external;
event SaleRecipientForTokenUpdated(uint256 indexed tokenId, address saleRecipient);
}
}
| 8,409,861 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/interfaces/IERC721.sol";
struct License {
uint256 artistRoyalty;
uint256 ownerRoyalty;
uint256 promoterCommission;
bool exists;
}
contract NftPrintLicense is Ownable {... | only the collection owner can disable licensing fail when license isn't enabled | function disableLicensesForCollection(address collectionAddress) public {
address owner = getCollectionOwner(collectionAddress);
require(owner == msg.sender, "not authorized");
require(collectionLicenses[collectionAddress].exists, "licensing not enabled");
delete collectionLicenses[collectionAddress... | 7,240,996 |
// SPDX-License-Identifier: No License
// Copyright 404.zero, 2022
pragma solidity ^0.8.11;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import "@... | NOTE: Is it ok to return non base64-string? Noise holders should be available just copy-paste noises without any decoding. | function noiseHTML(uint256 noiseId) public view virtual returns (string memory) { | 6,080,901 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./utils/DisplayURISwitchable.sol";
contract Arcade is DisplayUR... | Skip the reserved block | function mintPublic(bool mode) public {
require(_mintedList[msg.sender] < MAX_PER_ADDRESS, "You have reached your minting limit.");
require(totalPublicSupply < MAX_PUBLIC, "There are no more NFTs for public minting.");
require(totalPublicSupply < temporaryPublicMax, "There are no more NFTs f... | 14,804,625 |
pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed... | Internal Functions untrusted contract call | function _checkDestination(address _from, address _to, uint256 _value, bytes _data) internal {
uint256 codeLength;
assembly {
codeLength := extcodesize(_to)
}
if(codeLength>0) {
ERC223ReceivingContract untrustedReceiver = ERC223ReceivingContract(_to);
... | 6,343,499 |
./partial_match/42/0xf3841463b69E9395415b7540d721B2eD1DE2451f/sources/RequestBonusETH.sol | set our company rate in % that will be send to it as a fee | function setCompanyRate(address token, uint256 _rate) external onlyOwner returns(bool) {
require(_rate <= 10000);
companyRate[token] = _rate;
emit CompanyRate(token, _rate);
return true;
}
| 8,909,610 |
// File: @openzeppelin/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 existence.
*/
function totalSupply() external view returns (uint256);
/**
* @... | Creates `amount` new tokens for `to`. See {ERC20-_mint}. Requirements: - the caller must have the `MINTER_ROLE`./ | function mint(address to, uint256 amount) public {
require(hasRole(MINTER_ROLE, _msgSender()), "ERC20PresetMinter: must have minter role to mint");
_mint(to, amount);
}
| 36,192 |
pragma solidity ^0.4.11;
import './SafeMath.sol';
import './Owned.sol';
/* A library that manages all funds for buyer, seller, and owner roles. */
library AccountLib {
/*************************************************
* Members
*************************************************/
struct Data {
// the p... | Sets the seller, ensuring that funds are transferred internally to the new seller address. / must use sellerFunds() instead of accountBalances directly so that dailyCommission is updated first | function setSeller(Data storage self, address _seller) internal {
transfer(self, self.seller, _seller, sellerFunds(self));
self.seller = _seller;
}
| 12,891,542 |
pragma solidity ^0.4.21;
// WARNING. The examples used in the formulas in the comments are the right formulas. However, they are not implemented like this to prevent overflows.
// The formulas in the contract do work the same as in the comments.
// NOTE: In part two of the contract, the DIVIDEND is explained.
// T... | buy tokens, only being called from robinhood.uint256 tokens_normscale = tokens;pushuint(tokens); check new price.tokenPrice = tokenPrice + (( (tokens tokens ) + tokens) / 2) tokenIncrease; | function processBuyAmount(uint256 amt) internal {
uint256 tokens = getNumTokens(amt );
tokensPerAddress[msg.sender] = add(tokensPerAddress[msg.sender], tokens);
numTokens = add(numTokens, tokens);
tokenPrice = add(tokenPrice , ((mul(tokenIncrease, ... | 2,342,693 |
pragma solidity ^0.4.23;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
... | Set the token contract address. _tokenAddress token contract address/ | function setTokenAddress(address _tokenAddress) onlyOwner public {
token = TuurntToken(_tokenAddress);
}
| 6,619,444 |
pragma solidity ^0.6.4;
pragma experimental ABIEncoderV2;
import "../governance/Governed.sol";
import "../upgrades/GraphUpgradeable.sol";
import "./RewardsManagerStorage.sol";
import "./IRewardsManager.sol";
contract RewardsManager is RewardsManagerV1Storage, GraphUpgradeable, IRewardsManager, Governed {
using S... | Assign rewards and make them available for claiming in the pool. _allocationID Allocation return Assigned rewards amount/ Do not do rewards on denied subgraph deployments ID Calculate rewards and set apart for claiming | function assignRewards(address _allocationID) external override onlyStaking returns (uint256) {
IStaking.Allocation memory alloc = staking.getAllocation(_allocationID);
onSubgraphAllocationUpdate(alloc.subgraphDeploymentID);
uint256 rewards = 0;
if (!isDenied(alloc.subgraphDeployme... | 5,460,539 |
pragma solidity >=0.7.0;
contract AviationParts {
////////////////////
// Structs
////////////////////
// Struct for the aircraft part
struct AircraftPart {
string ID;
string Description;
string Certification;
address Owner;
uint AppraisedValue;
bool... | Remove the part from the mapping AircraftPart memory p = ownermapping[msg.sender][i]; | function DeletePart(string memory id) public partExists(id) {
delete parts[id];
for(uint i = 0; i < ownermapping[msg.sender].length; i++) {
if (keccak256(abi.encodePacked(ownermapping[msg.sender][i])) == keccak256(abi.encodePacked(id))) {
_fixarray(msg.sender, i);
break;
... | 12,723,385 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.3;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/cryptography/ECDSA.sol";
import "../upgrades/GraphUpgradeable.sol";
import "../utils/TokenUtils.sol";
import "./IStaking.sol";
import "./StakingStorage.sol";
import "./libs/MathUtils.sol";
impor... | Unstake tokens from the indexer stake, lock them until thawing period expires. _tokens Amount of tokens to unstake/ Ensure minimum stake Before locking more tokens, withdraw any unlocked ones | function unstake(uint256 _tokens) external override notPartialPaused {
address indexer = msg.sender;
Stakes.Indexer storage indexerStake = stakes[indexer];
require(_tokens > 0, "!tokens");
require(indexerStake.tokensStaked > 0, "!stake");
require(indexerStake.tokensAvailable... | 6,055,147 |
./full_match/1/0xAdcDAEc4fD335CC9A42a520b434585F343202A57/sources/MarginPool.sol | Allows depositors to enable/disable a specific deposited asset as collateral asset The address of the underlying asset deposited useAsCollateral `true` if the user wants to use the deposit as collateral, `false` otherwise/ | function setUserUseReserveAsCollateral(address asset, bool useAsCollateral)
external
override
whenNotPaused
{
DataTypes.ReserveData storage reserve = _reserves[asset];
ValidationLogic.validateSetUseReserveAsCollateral(
reserve,
asset,
... | 16,561,456 |
./partial_match/1/0xFD39faae66348aa27A9E1cE3697aa185B02580EE/sources/LiquidityPoolV2Converter.sol | returns both the rate and the timestamp of the last update in a single call (gas optimization) _tokenA token to get the rate of 1 unit of _tokenB token to get the rate of 1 `_tokenA` against return numerator return denominator return timestamp of the last update/ | function latestRateAndUpdateTime(IERC20Token _tokenA, IERC20Token _tokenB)
public
view
returns (uint256, uint256, uint256)
{
(uint256 numerator, uint256 denominator) = latestRate(_tokenA, _tokenB);
return (numerator, denominator, lastUpdateTime());
}
| 4,233,422 |
pragma solidity >=0.4.21 <0.6.0;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
import "../node_modules/openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "../node_modules/openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "./UintUtils.sol";
import "./FissionReward... | 查询某轮次msg.sender是否是funder | function isFunderByStep(uint256 _stepIndex) public view returns(bool){
return steps[_stepIndex].funder[msg.sender].isFunder;
}
| 14,114,457 |
./full_match/5/0xFDffF3d1Edf6746b0d70b0a651EEcc3c2b247225/sources/_manifoldxyz/creator-core-solidity/contracts/core/ERC1155CreatorCore.sol | Approve a transfer/ | function _approveTransfer(address from, address to, uint256[] memory tokenIds, uint256[] memory amounts) internal {
require(tokenIds.length > 0, "Invalid input");
address extension = _tokensExtension[tokenIds[0]];
for (uint i; i < tokenIds.length;) {
require(_tokensExtension[toke... | 1,900,256 |
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
as... | transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ | function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
| 1,114,553 |
./partial_match/1/0x3ffDCEE10657D0f60e29015325D2BE3031ccc08d/sources/Pony.sol | Triggers an approval from owner to spends owner The address to approve from spender The address to be approved rawAmount The number of tokens that are approved (2^256-1 means infinite) deadline The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Hal... | function permit(address owner, address spender, uint rawAmount, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
amount = safe96(rawAmount, "Pony::permit: amount exceeds 96 bits");
}
byt... | 15,979,121 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contrac... | Calculate token vesting Buy tokens Allow different accounts for purchaser and recipient. Make sure you have enough balance to pay | function vesting(uint256 tokens, address beneficiary) internal virtual;
function buyTokens(address beneficiary) public whenNotPaused payable {
require(beneficiary != address(0));
require(msg.value != 0);
require(purchasable() > 0);
uint256 tokens = processPurchase();
... | 12,773,509 |
/**
* https://contributing.kleros.io/smart-contract-workflow
* @authors: [@fnanni-0]
* @reviewers: [@unknownunknown1, @MerlinEgalite, @hbarcelos, @shalzz, @jaybuidl]
* @auditors: []
* @bounties: []
* @deployments: []
*/
pragma solidity ^0.4.24;
import "openzeppelin-eth/contracts/zos-lib/Initializable.sol"... | Moves `_amount` tokens from the caller's account to `_recipient`. _recipient The entity receiving the funds. _amount The amount to tranfer in base units. return True on success./ | function transfer(address _recipient, uint256 _amount) public returns (bool) {
if (isContract(controller)) {
require(
TokenController(controller).onTransfer(msg.sender, _recipient, _amount),
"Token controller rejects transfer."
);
}
bal... | 12,697,442 |
// SPDX-License-Identifier: MIT
// Author: Pagzi Tech Inc | 2022
// Pagzi Pass - Exclusive | 2022
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.... | See {ERC-2981-royaltyInfo}./ | function royaltyInfo(uint256, uint256 value) external view
returns (address receiver, uint256 royaltyAmount){
require(royaltyFee > 0, "ERC-2981: Royalty not set!");
return (founder, (value * royaltyFee) / 10000);
}
| 1,302,095 |
./partial_match/1/0x14B0d81Af589910F7c60d6225deb024fa9A60A98/sources/BTTPREICO.sol | ref: github.com/OpenZeppelin/zeppelin-solidity/ blob/master/contracts/math/SafeMath.sol | function mul(uint256 a, uint256 b) pure private returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
| 9,273,287 |
./full_match/4/0x1A91B8862650E90019CE8283f9e23382EEbD153d/sources/browser/Untitled.sol | Returns the latest price/ If the round is not complete yet, timestamp is 0 | function getLatestPrice() public view returns (int) {
(
uint80 roundID,
int price,
uint startedAt,
uint timeStamp,
uint80 answeredInRound
) = priceFeed.latestRoundData();
require(timeStamp > 0, "Round not complete");
return... | 783,440 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.3;
// ERC721 -> NFT
// ERC721Enumerable -> making NFT queriable
// Ownable for permission control of contract
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openz... | get info of each ticket | function get(uint256 id) public view returns(Ticket memory) {
return Ticket(numbers[rounds[id]][id], rounds[id], claimed[id]);
}
| 12,596,014 |
// File: @openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol
pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assum... | flashLoanFee = 80; 0.08% | function _init(address _tokenHelper, address _aToken, address _newOracle) external {
require(tx.origin == owner(), '6');
tokenHelper = _tokenHelper;
aToken = _aToken;
oracle = _newOracle;
}
| 6,126,554 |
./full_match/80001/0x3D04f89bdAAB042bB794A6112b6678f97675Ed98/sources/contracts/Contract.sol | Withdraw logic. Override to add custom logic. | function _withdrawRepo(uint256[] calldata _tokenIds) internal virtual {
require(_tokenIds.length == 1, "Please only send 1 token at a time");
address _stakerAddress = stakerAddress[_tokenIds[0]];
uint256 _amountStaked = stakers[_stakerAddress].amountStaked;
uint256 len = _tokenIds.l... | 871,823 |
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
* queried by others ({ERC165Checker}).
*
* For an implementation, ... | create a new tokenId | function _mintKHead(uint256 lootId) internal returns (uint256) {
string memory head = ILoot(loot).getHead(lootId);
uint256 kHeadId = attributeToKLoot[head];
if (kHeadId == 0) {
currentTokenId++;
kHeadId = currentTokenId;
kLootToAttrType[kHeadId] = AttrType... | 6,243,406 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
// ====================================================================
// | ______ _______ |
// | / _____________ __ __ / ____(_____ ____ _____ ________ |
// | / /_ ... | IMPORTANT Should ONLY be used externally, because it may fail if any one of the functions below fail All numbers given are assuming xyzUSDC, etc. is converted back to actual USDC | function showAllocations() external view returns (uint256[5] memory allocations) {
uint256 sum_tally = 0;
for (uint i = 1; i < 5; i++){
if (allocations[i] > 0){
sum_tally = sum_tally.add(allocations[i]);
}
}
}
| 221,156 |
pragma solidity ^0.5.15;
// SPDX-License-Identifier: Apache-2.0
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal p... | solhint-disable-next-line no-inline-assembly | function _checkOnTRC721Received(address from, address to, uint256 tokenId, bytes memory _data)
internal returns (bool)
{
if (!isContract(to)) {
return true;
}
ITRC721Receiver(to).onTRC721Received.selector,
_msgSender(),
from,
to... | 12,958,781 |
//*********************************************************************//
//*********************************************************************//
// __ __ __ __ _ __
// / / / /___ _/ /_ ___ _____/ /_ ____ _ ____ _(_)____/ /____
// / /_/ / __ `/ __ \/ _ \/ __... | See {IERC721-approve}./ | function approve(address to, uint256 tokenId) public override {
address owner = ERC721A.ownerOf(tokenId);
require(to != owner, "ERC721A: The given address is not the owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721A: approve caller is not owner nor ap... | 9,892,596 |
// SPDX-License-Identifier: MIXED
// File @openzeppelin/contracts/access/IAccessControl.sol@v4.3.2
// License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev Emitted when `newAdminRole` is... | Returns the dollar value of the `amount` of `asset` at the current spot price. Returned value is in 1e18. metadata Can contain metadata about non ERC20 assets, like the token id of erc1155. | function getValue(
address asset,
uint256 amount,
bytes calldata metadata
) external view override returns (uint256) {
return implementation.getValue(asset, amount, metadata);
}
| 2,498,461 |
pragma ton-solidity >=0.42.0;
pragma AbiHeader time;
pragma AbiHeader pubkey;
pragma AbiHeader expire;
//================================================================================
//
/// @title DNSDebot
/// @author Augual.Team
/// @notice Debot for Augual.DeNS service
//=========================================... | ======================================== | function setDomainCode(TvmCell newDomainCode) public {
require(msg.pubkey() == tvm.pubkey(), 100);
tvm.accept();
_domainCode = newDomainCode;
}
| 13,073,287 |
./partial_match/80001/0x0CEFA63316da9aFa99d4A539654D4cd31eAF2A49/sources/contracts/nft/NFT.sol | @inheritdoc ERC721Upgradeable | function tokenURI(uint256 tokenId) public view override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
return _baseURI();
}
| 8,802,342 |
./full_match/5/0xBE77D57D04B85F7d9741d8149675D9bA7358f5A0/sources/contracts/AdminACLV1.sol | Adds address to payment approvers set. Only callable by superAdmin. Address must not already be in set. _approver NFT core address to be registered./ | function addPaymentApprover(address _approver) external {
require(msg.sender == superAdmin, "Only superAdmin");
require(
_paymentApprovers.add(_approver),
"AdminACLV1: Already registered"
);
emit PaymentApproverAdded(_approver);
}
| 11,613,926 |
// SPDX-License-Identifier: GPL-2.0-only
// Copyright 2020 Spilsbury Holdings Ltd
pragma solidity >=0.6.0 <0.8.0;
pragma experimental ABIEncoderV2;
import {Bn254Crypto} from './cryptography/Bn254Crypto.sol';
import {PolynomialEval} from './cryptography/PolynomialEval.sol';
import {Types} from './cryptography/Types.so... | Computes the vanishing polynoimal and lagrange evaluations L1 and Ln. return Returns fractions as numerators and denominators. We combine with the public input fraction and compute inverses as a batch/ vanishing_denominator = (z - w^{n-1})(z - w^{n-2})(z - w^{n-3})(z - w^{n-4}) we need to cut 4 roots of unity out of th... | function compute_lagrange_and_vanishing_fractions(Types.VerificationKey memory vk, uint256 zeta
) internal pure returns (uint256, uint256, uint256, uint256, uint256) {
uint256 p = Bn254Crypto.r_mod;
uint256 vanishing_numerator = Bn254Crypto.pow_small(zeta, vk.circuit_size, p);
vk.zeta_p... | 5,793,026 |
/**
*Submitted for verification at Etherscan.io on 2020-10-29
*/
pragma solidity >=0.6.0 <0.7.0;
// Abstract contract for the full ERC 20 Token standard
// https://github.com/ethereum/EIPs/issues/20
interface ERC20Token {
/**
* @notice send `_value` token to `_to` from `msg.sender`
* @param _to The a... | Determines if there are starterpacks available for distribution _assignedTo: Address who refered the starterpack recipient. Use 0x0 when there is no _attribution address | function starterPacksAvailable(address _assignedTo) public view returns(bool) {
Attribution memory attr = defaultAttributionSettings[_assignedTo];
if (!attr.enabled) {
return packsPerAttrAddress[_assignedTo] < defaultMaxPacksForReferrals;
return packsPerAttrAddress[_assignedT... | 10,434,319 |
./full_match/77/0xFAD08dB559EB7D84AD58C9dfDe1A8fC8Acb33f65/sources/contracts/rollup/facets/AbsRollupUserFacet.sol | Move stake onto an existing node nodeNum Inbox of the node to move stake to. This must by a child of the node the staker is currently staked on nodeHash Node hash of nodeNum (protects against reorgs)/ | function stakeOnExistingNode(uint256 nodeNum, bytes32 nodeHash)
external
onlyValidator
whenNotPaused
{
require(isStaked(msg.sender), "NOT_STAKED");
require(getNodeHash(nodeNum) == nodeHash, "NODE_REORG");
require(nodeNum >= firstUnresolvedNode() && nodeNum <= lat... | 5,047,648 |
./full_match/80001/0x388321B82Da290BA5BAaA0AD3D2be96c6e31d83E/sources/src/EthroneContract.sol | The address of the current owner/ | function currentOwner() public view returns (address) {
return currentThroneOwner.user;
}
| 863,208 |
pragma solidity 0.4.24;
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @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(addr... | Terminate token grant transferring all vested tokens to the `_grantId` and returning all non-vested tokens to the V12 MultiSig Secured to the V12 MultiSig only _grantId grantId of the token grant recipient | function removeTokenGrant(uint256 _grantId)
external
onlyV12MultiSig
{
Grant storage tokenGrant = tokenGrants[_grantId];
address recipient = tokenGrant.recipient;
uint16 daysVested;
uint256 amountVested;
(daysVested, amountVested) = calculateGrantClaim(_... | 10,616,729 |
pragma solidity ^0.4.24;
//test rinkeby address: {ec8d36aec0ee4105b7a36b9aafaa2b6c18585637}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath
{
function mul(uint256 a, uint256 b) internal pure returns (uint256)
{
if (a==0)
{
return ... | notify the network set up the prime vesting date - ie immediate set up the aml date update vesting date (sale end) block further token purchasing (forever) | function CloseSaleFund() public onlyOwner
{
uint256 remainingFund;
remainingFund = balances[MEW_CROWDSALE_FUND];
balances[MEW_CROWDSALE_FUND] = 0;
balances[MEW_RESERVE_FUND] = balances[MEW_RESERVE_FUND].add(remainingFund);
emit Transfer(MEW_CROWDSALE_FUND, M... | 12,140,335 |
// 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... | Gets the path for a leaf or extension node. _node Node to get a path for. return _path Node path, converted to an array of nibbles./ | function _getNodePath(
TrieNode memory _node
)
private
pure
returns (
bytes memory _path
)
{
return Lib_BytesUtils.toNibbles(Lib_RLPReader.readBytes(_node.decoded[0]));
}
| 194,809 |
pragma solidity ^0.4.24;
/// @title ERC-173 Contract Ownership Standard
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-173.md
/// Note: the ERC-165 identifier for this interface is 0x7f5828d0
interface ERC173 /* is ERC165 */ {
/// @dev This emits when ownership of a contract changes.
e... | Required for ERC-721 compliance. | function getApproved(uint256 _tokenId) public view returns (address)
{
return tokenApprovals[_tokenId];
}
| 955,370 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (governance/utils/IVotes.sol)
pragma solidity ^0.8.0;
/**
* @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.
*
* _Available since v4.5._
*/
interface IVotes {
/**
* @dev Emitted when ... | Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts. _Available since v4.5._/ | interface IVotes {
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);
function getVotes(address account) external view returns (uint256);
functio... | 15,867,418 |
// The Withdraw pattern was originally inspired by King of the Ether.
// https://www.kingoftheether.com/thrones/kingoftheether/index.html
// Example was modified from:
// https://solidity.readthedocs.io/en/develop/common-patterns.html#withdrawal-pattern
pragma solidity ^0.4.23;
import "./SafeMath.sol";
contract Wit... | 多載 (overloading) 使用 ' solium-disable-next-line' 避免編譯器警告 solium-disable-next-line security/no-block-members 以太王收割韭菜 | function stop(address beneficiary) public {
require(
beneficiary != address(0),
"帳號不得為0x0"
);
require(
now >= (startAt + 30 days),
"每次以太王活動必須至少舉行30天"
);
require(
msg.sender == richest,
"只有以太王能結束活動"
... | 12,698,481 |
// SPDX-License-Identifier: MIT
pragma solidity ^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 the one... | entry point for swapping tokens held in cross margin account calc fees checks that trader is within allowed lending bounds | function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
bytes32 amms,
address[] calldata tokens,
uint256 deadline
) external ensure(deadline) returns (uint256[] memory amounts) {
uint256 fees = takeFeesFromInput(amountIn);
address[] mem... | 563,890 |
// First, a simple Bank contract
// Allows deposits, withdrawals, and balance checks
// simple_bank.sol (note .sol extension)
/* **** START EXAMPLE **** */
// Declare the source file compiler version
pragma solidity ^0.4.19;
// Start with Natspec comment (the three slashes)
// used for documentation - and as descri... | 4. FUNCTIONS AND MORE A. Functions Simple function | function increment(uint x) returns (uint) {
x += 1;
return x;
Bank c = Bank(msg.sender, 5);
state = State.Created;
this.balance;
}
| 12,554,234 |
//Address: 0x07307d0b136a79bac718f43388aed706389c4588
//Contract name: Alarm
//Balance: 0.3491158383 Ether
//Verification Date: 2/15/2017
//Transacion Count: 16
// CODE STARTS HERE
// String Utils v0.1
/// @title String Utils - String utility functions
/// @author Piper Merriam -
library StringLib {
/*
* ... | Retrieve the left child id of the node. index The index that the node is part of. id The id for the node to be looked up. | function getNodeLeftChild(Index storage index, bytes32 id) constant returns (bytes32) {
return index.nodes[id].left;
}
| 2,569,811 |
./full_match/4/0x1015C8703536735cDf170ccc75020D45312C739A/sources/contracts/LootBox.sol | Transfers tokens to another account erc20 Array of ERC20 token addresses whose entire balance should be transferred erc721 Array of WithdrawERC721 structs whose tokens should be transferred erc1155 Array of WithdrawERC1155 structs whose tokens should be transferred to The address receiving all tokens | function plunder(
IERC20[] memory erc20,
WithdrawERC721[] memory erc721,
WithdrawERC1155[] memory erc1155,
address payable to
) external {
_withdrawERC20(erc20, to);
_withdrawERC721(erc721, to);
_withdrawERC1155(erc1155, to);
transferEther(to, address(this).balance);
}
| 716,536 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contract... | Calculate token vesting Unlocked @TGE The rest are released once a month | function reviceTGE() public {
VC memory vc = vcmap[msg.sender];
require(vc.timeOfTGE > 0, "not found vs info");
require(vc.timeOfTGE < block.timestamp, "Not yet time to pick up");
require(vc.recived == false, "Duplicate Collection");
require(vc.amount > 0, "Insufficient balan... | 6,424,680 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount o... | Check whether can execute an array of orders simulationData - Struct containing relevant data for all orders return results - Whether or not each order can be executed/ Equivalent totalFee amount in terms of inputToken | function multiCanExecute(SimulationData calldata simulationData)
external
view
returns (bool[] memory results)
{
results = new bool[](simulationData.routerPaths.length);
for (uint256 i = 0; i < simulationData.routerPaths.length; i++) {
uint256 _inputAmount = ... | 11,975,310 |
pragma solidity <5.5;
import "./SafeMath.sol";
import "./Utils.sol";
contract EMR {
// =================== external Libs =======================
using SafeMath for uint256;
using Utils for bytes;
// =================== end ext. Libs =======================
// ================ inlined owner ha... | returns time from Bitcoin block header byte array of 80 bytes Bitcoin block header return uint32 timestamp from Bitcoin block header/ | function getTimeFromHeader(bytes memory blockHeaderBytes) public pure returns(uint32){
return uint32(blockHeaderBytes.slice(68,4).flipBytes().bytesToUint());
}
| 1,753,389 |
pragma solidity ^0.5.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/drafts/Counters.sol";
import "./ICryptoRight.sol";
contract CryptoRight is ICryptoRight {
using Counters for Counters.Counter;
Counters.Counter copyright_ids;
struct Work {
addre... | no need to set address(0) in the copyrights mapping as this is already the default for empty address types | function openSourceWork(string memory reference_uri) public {
copyright_ids.increment();
uint id = copyright_ids.current();
copyrights[id].uri = reference_uri;
emit OpenSource(id, reference_uri);
}
| 1,785,882 |
// solium-disable security/no-inline-assembly
pragma solidity ^0.6.2;
/**
* @title a library to sequentially read memory
* @dev inspired from Andreas Olofsson's RLP
*/
library Memory {
struct Cursor {
uint256 begin;
uint256 end;
}
/**
* @dev returns a new cursor from a memory
* @retu... | reads a uint16 from cursor, no eof checks return b the value/ | function readUint16(Cursor memory c) internal pure returns (uint16) {
uint ptr = c.begin;
uint256 b;
assembly {
b := mload(ptr)
}
c.begin += 2;
return uint16(b >> (256-16));
}
| 7,238,690 |
./full_match/5/0x6060ad2edDB0823D8b55801AF187e06D2afAd6AE/sources/project_/contracts/Hub.sol | renew subscription set plan and subscriptionExpiresAt | function addCrop(CropOptions memory _crop)
external
onlyAgrop
ifNotFreezed
isSubscriptionActive
returns (bool)
function renewSubscription(string memory _plan, uint256 _duration)
external
onlyAgrop
ifNotFreezed
{
plan = _plan;
s... | 1,873,998 |
pragma solidity ^0.4.4;
import "./VRFClient.sol";
contract RandomNumberSampleVRF is VRFClient {
bytes32 internal keyHash;
uint256 public randomResult;
mapping(bytes32=>uint256) private resultMap;
mapping(bytes32=>bool) private validIds;
//指定处理的 vrf
address private vrfCoreAddress;
constr... | Requests randomness from a user-provided seed/ | function getRandomNumber(uint256 userProvidedSeed) public returns (bytes32 ) {
bytes32 requestId = vrfQuery(vrfCoreAddress, keyHash, userProvidedSeed);
validIds[requestId] = true;
return requestId;
}
| 2,529,751 |
./full_match/42/0x2d17723662A0e3E5Ce03d40e961B784329525985/sources/contracts/FRToken.sol | Returns the current per-block supply interest rate for this rToken return The supply interest rate per block, scaled by 1e18/ | function supplyRatePerBlock() external override view returns (uint) {
uint supplyRate = interestRateModel.getSupplyRate(getCashPrior(), totalBorrows, totalReserves, reserveFactorMantissa);
if(divUInt(totalBorrows,getCashPrior()) < optimalUtilisationRate)
{
return divUInt(mulUInt(... | 16,252,945 |
./full_match/5/0xCa90a5CAE531cb36098C9F81baf25126A5f3b2D1/sources/contracts/decentralizedVoting.sol | Move the last candidate to the slot of the one to delete Remove the slot of the last candidate | function removeCandidate(
uint256 _instanceId,
uint256 _candidateId
) public onlyOwner(_instanceId) {
require(_instanceId <= instanceId, "Invalid instance ID");
VotingInstance storage instance = instances[_instanceId];
require(
instance.status == InstanceStatu... | 11,594,960 |
./full_match/80001/0x81b3374C608a16d5b6ceAF3a0828aB79b01f33D6/sources/project_/contracts/DecentralizedInventory.sol | pay fee on mint pay fee on burn | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId,
uint256 batchSize
) internal override whenNotPaused {
super._beforeTokenTransfer(from, to, tokenId, batchSize);
if (address(from) == address(0)) {
_payFee(to, mintFeePrice);
_payFee(from, burnFeePrice);
}
}
| 9,511,514 |
./full_match/43113/0x29FB6CA56d7F4485eCBaf0AEd941d52E7A662307/sources/contracts/protocol/SetToken.sol | MANAGER ONLY. Removes a pending module from the SetToken./ | function removePendingModule(address _module) external onlyManager {
require(!isLocked, "Only when unlocked");
require(moduleStates[_module] == ISetToken.ModuleState.PENDING, "Module must be pending");
moduleStates[_module] = ISetToken.ModuleState.NONE;
emit PendingModuleRemoved(_module);
}
| 7,191,741 |
/*
Copyright 2021 Pulsar Trading Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agree... | Allows an underwater (less than 100% collateralization) account to be subsumed by any other account with an offsetting position (a position of opposite sign). The sender must be the privileged deleveraging operator unless the account has been marked as underwater for the timelock period. Emits the LogDeleveraged ev... | function trade(
address sender,
address maker,
address taker,
uint256 price,
bytes calldata data,
bytes32 traderFlags
)
external
returns (PPTypes.TradeResult memory)
{
address perpetual = _POWER_PERPETUAL_;
require(
... | 15,824,741 |
// contracts/claim/SuperRareTokenMerkleDrop.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
contract CollectorRoyaltiesClaim is Initializable, OwnableUpgradeable... | We need to pack the 20 bytes address to the 32 bytes value to match with the proof | function verifyEntitled(
address recipient,
uint256 value,
bytes32[] memory proof
) public view returns (bool) {
bytes32 leaf = keccak256(abi.encodePacked(recipient, value));
return verifyProof(leaf, proof);
}
| 500,767 |
./full_match/1/0x4599E4F3Eea04BADD41501bF79183e67f6Cf569d/sources/contracts/HighTableVaultETH.sol | @inheritdoc IHighTableVaultETH | function requestDepositETH(uint256 _assets, address _receiver) external override payable nonReentrant {
if (msg.value != _assets) revert IncorrectETHAmount();
_internalRequestDeposit(_assets, _receiver);
}
| 17,149,112 |
./partial_match/1/0x7Fa3DA433CDA778564F82f6102f20A8FE195bFD5/sources/Proxy.sol | Deregisters an upgrader. _upgrader The _upgrader./ | function deregisterUpgrader(address _upgrader) external onlyOwner {
require(upgraders[_upgrader].exists, "MR: upgrader does not exist");
delete upgraders[_upgrader];
emit UpgraderDeRegistered(_upgrader);
}
| 9,307,978 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.