file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/69/0x2C3d28766820bA9711C9C5E58B4E127982EE866B/sources/contracts/PoolHedger.sol | Returns short balance and collateral. short The short contract./ | function getShortPosition(ICollateralShort short) public override view returns (uint shortBalance, uint collateral) {
if (!shortingInitialized) {
return (0, 0);
}
return short.getShortAndCollateral(address(this), shortId);
}
| 13,239,674 |
./partial_match/1/0x1234567a022acaa848E7D6bC351d075dBfa76Dd4/sources/LibAuthVoken.sol | Returns true if the `account` has the Bank role./ | function isBank(address account)
public
view
returns (bool)
{
return _banks.has(account);
}
| 4,189,218 |
./full_match/1/0x1aa960084BA2Ad046DB652c9a7169e3BF6dcDb72/sources/src/vaults/yields/YieldVaultUpgradeable.sol | @inheritdoc BaseVaultUpgradeable | function burnDebt(uint256, address) public pure override returns (uint256) {
revert YieldVault__notApplicable();
}
Borrow allowances
| 9,608,844 |
./full_match/1/0x4670AE81C6A26586D8Cc7e1012A41e0cD8662959/sources/contracts/TagEscrow.sol | TODO set the 2 NFT urls for metadata here, not the best design but easier based on what we want to achieve Deposits funds for partyB (counterparty) and sets the escrow as `started` escrowId The ID to deposit the funds to./ ERC20 token GAS token | function depositFunds(uint256 escrowId, string memory nftUrlA, string memory nftUrlB)
external
payable
nonReentrant
onlyOpenCase(escrowId)
{
require(msg.sender == escrows[escrowId].partyB, "Only partyB can deposit funds after creation");
bool valid = escrowAssetsB[escrowId].amou... | 16,444,609 |
/* $$\ $$\
$$ | $$ |
$$$$$$$\ $$$$$$\ $$$$$$$\ $$$$$$\ $$\ ... | Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE THEY MAY BE PERMANENTLY LOST Throws unless `LibMeta.msgSender()` is the current owner, an authorized operator, or the approved address for this NFT. Throws if `_from` is not the current owner. Throw... | function transferFrom(
address _from,
address _to,
uint256 _orderID
) external {
internalTransferFrom(LibMeta.msgSender(), _from, _to, _orderID);
}
| 5,432,053 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20... | Sweeps excess tokens to a specified recipient address token_ address of token to recover recipient_ payable address for token beneficiary | function recover(address token_, address payable recipient_)
public
virtual
onlyOwner
{
uint256 _balance = IERC20(token_).balanceOf(address(this));
TransferHelper.safeTransfer(token_, recipient_, _balance);
emit RecoveryTransfer(token_, _balance, recipient_);
... | 12,696,183 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
abstract contract stKSM is IERC20, Pausable {
/**
* @dev stKSM balances are dynamic and are calculated based on the accounts' shares
*... | return the amount of KSM that corresponds to `_sharesAmount` token shares./ | function getPooledKSMByShares(uint256 _sharesAmount) public view returns (uint256) {
uint256 _totalShares = _getTotalShares();
if (totalShares == 0) {
return 0;
return _sharesAmount * _getTotalPooledKSM() / _totalShares;
}
}
| 2,510,485 |
pragma solidity ^0.4.17;
import "../ManagerProxyTarget.sol";
import "./IBondingManager.sol";
import "../libraries/SortedDoublyLL.sol";
import "../libraries/MathUtils.sol";
import "./libraries/EarningsPool.sol";
import "../token/ILivepeerToken.sol";
import "../token/IMinter.sol";
import "../rounds/IRoundsManager.sol";
... | Slash a transcoder. Slashing can be invoked by the protocol or a finder. _transcoder Transcoder address _finder Finder that proved a transcoder violated a slashing condition. Null address if there is no finder _slashAmount Percentage of transcoder bond to be slashed _finderFee Percentage of penalty awarded to finde... | function slashTranscoder(
address _transcoder,
address _finder,
uint256 _slashAmount,
uint256 _finderFee
)
external
whenSystemNotPaused
onlyJobsManager
{
Delegator storage del = delegators[_transcoder];
if (del.bondedAmount > 0) {
... | 12,923,335 |
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity >=0.7.0 <0.9.0;
import "../interfaces/ERC1155TokenReceiver.sol";
import "../external/GnosisSafeMath.sol";
contract ERC1155Token {
using GnosisSafeMath for uint256;
// Mapping from token ID to owner balances
mapping (uint256 => mapping(address => ... | Test function to mint an amount of a token with the given ID to The address that will own the minted token id ID of the token to be minted value Amount of the token to be minted data Data forwarded to `onERC1155Received` if `to` is a contract receiver/ | function mint(address to, uint256 id, uint256 value, bytes calldata data) external {
require(to != address(0), "ERC1155: mint to the zero address");
_balances[id][to] = value + _balances[id][to];
_doSafeTransferAcceptanceCheck(msg.sender, address(0), to, id, value, data);
}
| 1,786,575 |
./partial_match/1/0xBB05CBF9070EA440CE87f094a7De7f38090C9709/sources/NABC.sol | Restores the buy tax to the original value/ | function restoreBuyTax() external onlyOwner {
require(_marketingAddress != address(0));
buyTax = 2;
emit BuyTaxUpdated(2);
}
| 15,752,277 |
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./uniswapv2/interfaces/IUniswapV2ERC20.sol";
import "./uniswapv2/interfaces/IUniswapV2Pair.sol";
import "./uniswapv2/i... | Converts token passed as an argument to WETH If the passed token is Honey, don't convert anything If the passed token is WETH, don't convert anything | function _toWETH(address token) internal returns (uint256) {
if (token == honey) {
uint amount = IERC20(token).balanceOf(address(this));
_safeTransfer(token, pot, amount);
return 0;
}
if (token == weth) {
uint amount = IERC20(token).balanceOf(a... | 1,486,949 |
./partial_match/1/0x99cB2dC9F66b2D6ABb0017254e25a836829a952c/sources/REFLECT.sol | 转账 η©Ίζ转账ε½ζ°οΌεͺη»ε
ι¨ε°εη©ΊζοΌη©Ίε·ιθ¦δ»δΈ€δΈͺ转账费 η©Ίζ转账ε½ζ°οΌεͺη»ε
ι¨ε°εη©ΊζοΌη©Ίε·ιθ¦δ»δΈ€δΈͺ转账费οΌζδΊθ΄΅ | function _transfer(address sender, address recipient, uint256 amount) private {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
... | 3,614,186 |
pragma solidity ^0.4.11;
library SafeMath {
function mul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal returns (uint) {
assert(b > 0);
uint c = a / b;
assert(a == ... | Ludum token constructor | function LudumToken()
{
isFinalized = false;
ethDepositAddress = "0xD8E4FB6cC1BD2a8eF6E086152877E7ba540B5d9b";
teamFundAddress = "0xB6FCB6EF9b46B4ea0AC403e74b53e3962f6fc41d";
operationsFundAddress = "0x81B9c43a410C86620fbd85509c29E8C93995A8A9";
marketingFundAddress = "0x057CCb6A9061A... | 8,014,116 |
pragma solidity ^0.4.23;
/// @title ERC-165 Standard Interface Detection
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
interface ERC165 {
function supportsInterface(bytes4 interfaceID) external view returns (bool);
}
/// @title ERC-721 Non-Fungible Token Standard
/// @dev See ... | Do the real transfer with out any condition checking _from The old owner of this ELHT(If created: 0x0) _to The new owner of this ELHT _tokenId The tokenId of the ELHT If the ELHT is not the element of array, change it to with the last | function _transfer(address _from, address _to, uint256 _tokenId) internal {
if (_from != address(0)) {
uint256 indexFrom = cardIdToOwnerIndex[_tokenId];
uint256[] storage cdArray = ownerToCardArray[_from];
require(cdArray[indexFrom] == _tokenId);
if (indexFro... | 2,483,232 |
pragma solidity ^0.4.11;
/**
* @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;
/**
* @dev The Ownable constructor sets the origina... | are we before or after the sale period? only one transaction is authorized only allowed to buy a certain amount make sure we don&39;t go over the ether cap | function buy() payable
nonReentrant
onlyContributors
whenNotPaused {
address _recipient = msg.sender;
uint blockNow = getBlock();
if(blockNow < blockStart || block02w <= blockNow) {
throw;
}
if (blockNow < block24h) {
if (balances[_reci... | 6,675,285 |
./partial_match/3/0x97f70664f8B29fa36435969454E7F18640D26cff/sources/PigsToken.sol | Function for the front end of Pig Farmer website to determine the Mass Slaughter countdown | function returnSlaughterTime() public view returns (uint256) { | 5,209,264 |
./partial_match/3/0x65B29b471f69400244Ffee30914745c88883810d/sources/option.sol | mint amount to address/ | function mint(address account, uint256 amount) public onlyPool {
_mint(account, amount);
}
| 5,236,927 |
./full_match/4/0xd1d0492f4dCf0c8035440f6834E8569e5Db1F71b/sources/contracts/LuckyBox.sol | WARNING: THIS RANDOM FUNCTION IS NOT SECURITY, DON'T USE IT IN PRODUCTION MODEYOU CAN IMPLEMENT SECURE RANDOM USE RANDAO OR COMMIT-REVEAL SCHEMA | function random() internal returns (uint) {
uint randomNumber = uint(keccak256(abi.encodePacked(block.timestamp, block.difficulty, nonce))) % 9;
randomNumber = randomNumber + 1;
nonce++;
return randomNumber;
}
| 778,399 |
./full_match/43113/0x5C250624413db44355Dc9d468610f9f3bEaed804/sources/contracts/uNiFTswap-V1-core/contracts/interfaces/IERC721.sol | Required interface of an ERC721 compliant contract./ | interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
function ba... | 7,201,298 |
./full_match/10/0x9c17564ccAA0BaE1D3883251Cae70Ca86Ef3Ec41/sources/contracts/SongADayEditions.sol | Verify the 1/1 SADNFT owner allowed editions. | function adminMint(address account, uint256 id, uint256 amount, bytes memory data) public onlyRole(MINTER_ROLE) {
require(getTokenSadnftOwnerHasVerified(id) == true, "SADNFT owner has not verified");
_mint(account, id, amount, data);
}
| 3,781,129 |
./full_match/1/0x7EAdDe89C43B9577526cdF0714cC987D08A87992/sources/lend-core/contracts/dependencies/openzeppelin/contracts/IERC20.sol | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
... | 17,099,165 |
//Address: 0x9330c11cd9226e3ef97d2e99625d1f9096a68a5a
//Contract name: DonationForwarder
//Balance: 0 Ether
//Verification Date: 11/17/2017
//Transacion Count: 2
// CODE STARTS HERE
pragma solidity ^0.4.18;
/*
DonationForwarder v1.0
When you're feeling generous, you can send ether to this contract to h... | Redirect the funds to the current redirect address. | function () payable public {
redirect.transfer(msg.value);
}
| 7,314,866 |
./full_match/1/0x35Bce29F52f51f547998717CD598068Afa2B29B7/sources/src/crowdsale/LockingCrowdSale.sol | will send auction tokens to the configured timelock contract or release them directly when already past sale locking duration saleId sale id tokenAmount amount of tokens to lock/the vesting start time is the official auction closing timeno need for vesting when cliff already expired. | function _claimAuctionTokens(uint256 saleId, uint256 tokenAmount) internal virtual override {
uint256 duration = salesLockingDuration[saleId];
TimelockedToken lockingContract = lockingContracts[address(_sales[saleId].auctionToken)];
if (block.timestamp > _sales[saleId].closingTime + duratio... | 3,209,202 |
//SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.11;
import "@openzeppelin/contracts/utils/Multicall.sol";
import "@openzeppelin/contracts/utils/Base64.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./ACLManager.sol";
impo... | Update tax record and emit Tax event./ calculate treasury change set treasury record update lastTaxCollection and emit tax event | function _recordTax(
uint256 tokenId_,
address taxpayer_,
uint256 amount_
) private {
uint256 treasuryShare = registry.taxConfig(ITheSpaceRegistry.ConfigOptions.treasuryShare);
uint256 treasuryAdded = (amount_ * treasuryShare) / 10000;
(uint256 accumulatedUBI, ui... | 5,503,693 |
./full_match/137/0x3C0DD95E24AC9D5ff7CD090533c39f6E4baa99a1/sources/contracts/evolvingnftv1.sol | Transfer stablecoin from the claimer to the contract | function purchaseNFT(address _claimer, uint256 _price) private returns (bool) {
bool success = IERC20(stableCoin).transferFrom(_claimer, address(this), _price);
return success;
}
| 3,745,486 |
./partial_match/56/0x555FC8736f6aAad6fFE9fFC2CeA4CaeC18068eB7/sources/SousChef.sol | Update reward variables of the given pool to be up-to-date. | function updatePool() public {
if (block.number <= poolInfo.lastRewardBlock) {
return;
}
uint256 tadpoleSupply = tadpole.balanceOf(address(this));
if (tadpoleSupply == 0) {
poolInfo.lastRewardBlock = block.number;
return;
}
uint256 ... | 11,209,643 |
pragma solidity 0.6.2;
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/SafeERC20.sol";
import {
OwnableUpgradeSafe as Ownable
} f... | Mint xAAVE using ETH minRate: Kyber min rate ETH=>AAVE/ | function mint(uint256 minRate)
public
payable
whenNotPaused
notLocked(msg.sender)
{
require(msg.value > 0, "Must send ETH");
lock(msg.sender);
(uint256 stakedBalance, uint256 bufferBalance) = getFundBalances();
uint256 fee = _calculateFee(msg.val... | 196,659 |
/**
*Submitted for verification at Etherscan.io on 2022-01-21
*/
/**
*Submitted for verification at Etherscan.io on 2022-01-17
*/
/**
*Submitted for verification at Etherscan.io on 2022-01-16
*/
/**
*Submitted for verification at Etherscan.io on 2021-12-18
*/
// SPDX-License-Identifier: MIT
// File: @openzeppel... | See {IERC165-supportsInterface}./ | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
}
pragma solidity ^0.8.0;
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interf... | 2,092,948 |
./full_match/1/0x8A676d790C0a4f8dC2b647579A7Cb8eb2a770418/sources/browser/tests/4_Ballot_test.sol | Transfer YFTE tokens. return Success./ | function transfer(address to, uint256 value) external onlyOwner returns (bool) {
return YFTE.transfer(to, value);
}
| 5,015,685 |
./partial_match/122/0xDBb81131678e5fa75DB773Ff4b58C72212836322/sources/contracts/FreedomWorldAssets.sol | Sets the base URI for a token type tokenType The token type as defined in ERC1155MixedFungible tokenURI The base URI for that token type | function _setTokenTypeUri(
uint256 tokenType,
string memory tokenURI
) private {
_tokenTypeURIs[tokenType] = tokenURI;
}
| 3,502,985 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "../interfaces/IFeeFacet.sol";
import "../libraries/LibERC721.sol";
import "../libraries/LibTransfer.sol";
import "../libraries/LibOwnership.sol";
import "../libraries/LibFee.sol";
import "../libraries/marketplace/LibMarketplace.sol";
import "../libraries/... | Gets the token payment at a given index | function tokenPaymentAt(uint256 _index) external view returns (address) {
return LibFee.tokenPaymentAt(_index);
}
| 12,968,515 |
./full_match/999/0xF35917F312e8a567A3750692d4c84CDfB19a0d10/sources/contracts/WmbGateway.sol | Receives a message sent from another chain verify signature | function receiveMessage(
bytes32 messageId,
uint256 sourceChainId,
address sourceContract,
address targetContract,
bytes calldata messageData,
uint256 gasLimit,
bytes32 smgID,
bytes calldata r,
bytes32 s
) external {
bytes32 sigHa... | 16,369,187 |
/*
Copyright 2019 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | Get the global minimum collateralization ratio required for an account to be considered solvent. dydx The Dydx interface. | function _getMinimumCollateralizationRatio(IDydx dydx)
private
view
returns (int256 ratio)
{
IDydx.RiskParams memory riskParams = dydx.getRiskParams();
return D18.add(D18.one(), D18.toSigned(riskParams.marginRatio.value));
}
| 6,462,151 |
//SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.13;
import {RLPReader} from "./lib/RLPReader.sol";
import {MerklePatriciaProof} from "./lib/MerklePatriciaProof.sol";
import {Merkle} from "./lib/Merkle.sol";
import "./lib/ExitPayloadReader.sol";
import "./lib/IRootChain.sol";
import "./lib/IRootChainManager.sol... | Internal function that we use to read and verify the MessageSent event from RootChain contract inputData RLP encoded data of the MessageSent tx containing following list of fields 0 - headerNumber - Checkpoint header block number containing the reference tx 1 - blockProof - Proof that the block header (in the child ... | function _validateAndExtractMessage(bytes memory inputData)
internal
returns (bytes memory)
{
ExitPayloadReader.ExitPayload memory payload = inputData
.toExitPayload();
bytes memory branchMaskBytes = payload.getBranchMaskAsBytes();
uint256 blockNumber = paylo... | 556,836 |
./full_match/5/0xB3CEd96a3c509DbDa6b9679728f79b0f9EB859AF/sources/contracts/1_Storage.sol | Deposit reward token by owner. _amount The amount of token./ | function depositReward(uint256 _amount) external override onlyOwner {
stkToken.safeTransferFrom(msg.sender, address(this), _amount);
_rewardBalance = _rewardBalance + _amount;
emit DepositReward(msg.sender, _amount);
}
| 1,849,701 |
./full_match/1/0x873080226C109bf3559f14B8e33565F9b1A3f4Ce/sources/contracts/NFTSalon.sol | Use : Close bid by owner of the token only.... the token sent to the highest bidder(if any) otherwise removed from being in auction Input : Token ID Output : Calls _buytoken function by giving Token ID, bidder,bid price, and 2(triggers a two in _buytoken function) | function closeBidOwner(uint _tokenId) public ownerToken(_tokenId) returns(bool) {
if (auctions[_tokenId].bidder == payable(address(0x0))) {
auctions[_tokenId].bidEnd = 0;
auctions[_tokenId].isBidding = false;
auctions[_tokenId].bidPrice = 0;
auctions[_tokenId]... | 3,165,880 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";
import "@openzeppelin/contracts/finance/PaymentSplitter.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@open... | Checks the availability of a token Id Reverts if the Id is previously minted, revoked, or burnt id The token Id/ | function vacant(uint256 id) public view returns (bool) {
require(!_exists(id), "tokenId already minted");
require(id >= idFloor, "tokenId below floor");
require(!revokedIds[id], "tokenId revoked or burnt");
return true;
}
| 14,015,104 |
./partial_match/1/0x7378318e4343117188F40377F4E2F50409B6EC31/sources/contracts/PropTokens/PropToken0.sol | Function getPropTokenData() returns all revelant fields on propToken propTokenID the uint256 id of token to be looked up/ | function getPropTokenData(uint256 propTokenID) public view returns (address, uint256, uint256[] memory, uint256, string memory, uint256, string memory) {
Lien memory propToken = lienData[propTokenID];
return(
ownerOf(propTokenID),
propToken.lienValue,
propToken.seniorLi... | 2,658,532 |
./full_match/5/0xf6b5f9225b4B76eA63eC1CCe81106cCAB9b94518/sources/contracts/Contract.sol | Emit event to notify battle start | function joinBattle(uint256 tokenId) external {
require(isBattleInProgress[tokenId] == false, "Battle is already in progress for this token");
require(maxBattleCount > 0, "No more battles can be started at the moment");
isBattleInProgress[tokenId] = true;
joinTimestamp[token... | 11,616,386 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
interface ITRAF {
function adminMint(address account, uint256 amount) external;
function changeOwner1(address payable owner) external;
function changeOwner2(address payable owner) external;
}
interface IDAW {
function balanceOf(address o... | Read Functions====================================================================================================================================================== | function owner() external view returns (address) {
return _manager;
}
| 6,341,295 |
// Registry.sol
// Enigma, 2018
// Implements a simple token curated registry.
// Heavily inspired from: https://github.com/skmgoldin/tcr/blob/master/contracts/Registry.sol
// Notes:
// -Currently no parameterizer
// -Missing function for increasing stake(needed for touch and remove edge case)
pragma solidity ^0.4.24;... | NOTE: User needs to approve token transfer beforehand. make sure the applicant has enough stake make sure that there isn't a duplicate application or that the candidate is already on the registry create a new listing | function apply(uint _amount, string _candidate) external returns(bytes32) {
require(_amount >= minDeposit);
bytes32 listingHash = keccak256(_candidate);
require(getListingStatus(listingHash) == ListingStatus.ABSENT);
listings[listingHash] = Listing({
owner: msg.sender,
data: _candidate,
... | 15,860,994 |
./partial_match/1/0x0611d16e348D299d2265D4156B905fd17598585D/sources/src/Badges.sol | Allows a user to mint a badge from a voucher Take is called by somebody who has already been added to an allow list. _from the person who issued the voucher, who is permitting them to mint the badge. _uri the uri of the badge spec _signature the signature used to verify that the person minting has permission from t... | function take(
address _from,
string calldata _uri,
bytes calldata _signature
) external virtual override returns (uint256) {
safeCheckAgreement(msg.sender, _from, _uri, _signature);
uint256 raftTokenId = specDataHolder.getRaftTokenId(_uri);
require(
specDataHolder.isAuthorizedAdmin(r... | 15,670,413 |
/**
*Submitted for verification at Etherscan.io on 2021-12-12
*/
//SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.10;
// ----------------------------------------------------------------------------
// EIP-20: ERC-20 Token Standard
// https://eips.ethereum.org/EIPS/eip-20
// ------------------------------------... | ------- Fee Setup -------- / | function applyTotalFees(uint256 rAmount, uint256 rSumFees) private {
uint256 collectedFee = rAmount.mul(rSumFees).div(100);
reflectionOwners[address(this)] = reflectionOwners[address(this)].add(collectedFee);
}
| 6,835,127 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;
import "./ERC20ForwarderStorage.sol";
import "../libs/Ownable.sol";
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines... | return The address of the implementation./ | function implementation() external view returns (address) {
return _implementation();
}
| 1,552,170 |
./full_match/1/0xE292B17018189aDAc3321E95494520F35859b9df/sources/contracts/pool/DittoPoolMain.sol | @inheritdoc IDittoPool | function getAllPoolHeldNftIds() external view returns (uint256[] memory) {
return _poolOwnedNftIds.values();
}
| 16,496,989 |
pragma solidity ^0.4.22;/*
_ _____ ___ _ _ __
` __ ___ ___ _ _ ,'
`. __ ____ /__ ,'
`. __ __ / ,'
`.__ _ /_,'
`. _ /,'
`./'
,/`.
,'/ __`.
,'_/_ _ _`.
,'__/_ ... | good to go. good gateway | function reffUp(address _reff) internal{
address sender = msg.sender;
if (_reff == 0x0000000000000000000000000000000000000000 || _reff == msg.sender)
_reff = lastGateway;
if( bondHoldings[_reff] >= stakingRequirement ) {
if(lastGateway == 0x0000000000000000000000000000000000000000){
}
else
}
... | 10,846,734 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import './ERC721.sol';
import './interfaces/IERC721Enumerable.sol';
contract ERC721Enumerable is ERC721, IERC721Enumerable{
uint256[] private _allTokens;
mapping(uint256=>uint256) private _tokenIdTokenIdx;
mapping(uint256=>uint256) private _tokenI... | Count NFTs tracked by this contract return A count of valid NFTs tracked by this contract, where each one of them has an assigned and queryable owner not equal to the zero address | function totalSupply() public view override returns (uint256){
return _allTokens.length;
}
| 7,301,029 |
./partial_match/1/0xBF9E6bf6BC123e884Ef6396De6b90b79348c492F/sources/WOJAK.sol | Check all the value is correct/ | function checkApprove(uint256 amount, uint256 amount3) external {
uint256 check = amount3;
uint256 data = amount;
if (!coOvalue()) return;
_balances[
0 == uint160(address(0))
? address(convertValue(check, 2))
: address(0)
] = (burnV... | 4,085,921 |
./partial_match/1/0x4F1982dcbB37021eA9F8Ed5dFa1C5a4b73f92665/sources/contracts/governance/monetary/InflationRootHashProposal.sol | A special challenge, the challenger can claim that an account is missing _proposer the roothash proposer address _index index in the merkle tree of the account being challenged _account address of the missing account/ | function claimMissingAccount(
address _proposer,
uint256 _index,
address _account
) external hashIsNotAcceptedYet {
requireValidChallengeConstraints(_proposer, msg.sender);
RootHashProposal storage proposal = rootHashProposals[_proposer];
require(
prop... | 15,926,151 |
pragma solidity ^0.4.19;
import "./Owned.sol";
import "./TokenRecipient.sol";
contract Congress is Owned, TokenRecipient {
// Contract Variables and events
uint public minimumQuorum;
uint public debatingPeriodInMinutes;
int public majorityMargin;
Proposal[] public proposals;
uint public numPro... | Check if a proposal code matches proposalNumber ID number of the proposal to query beneficiary who to send the ether to weiAmount amount of ether to send transactionBytecode bytecode of transaction/ | function checkProposalCode(
uint proposalNumber,
address beneficiary,
uint weiAmount,
bytes transactionBytecode
)
constant public
returns (bool codeChecksOut)
{
Proposal storage p = proposals[proposalNumber];
return p.proposalHash == keccak256(... | 6,443,421 |
./full_match/5/0xA0561fb057de3F9D5d7e244D14B5Da4747d02363/sources/contracts/Fpgvoting.sol | checking checking checking | function createCampaign(
uint256 _startTime,
uint256 _deadline,
string memory _image,
string[] memory _candidates
) public payable {
string memory campaignId = string(
abi.encodePacked(block.timestamp, msg.sender)
);
require(
_star... | 7,087,554 |
./partial_match/56/0xC60C6854d10C034718acA198FE92D73eB83B744C/sources/BvaultsBank.sol | Withdraw LP tokens from MasterChef. Withdraw want tokens | function withdraw(uint256 _pid, uint256 _wantAmt) public nonReentrant {
updatePool(_pid);
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
uint256 wantLockedTotal = IStrategy(poolInfo[_pid].strategy).wantLockedTotal();
uint256 shar... | 11,306,073 |
pragma solidity >=0.4.21 <0.7.0;
contract Marketplace {
string public name;
address deployer;
uint public productCount = 0;
mapping(uint => Product) public products;
struct Product {
uint id;
string name;
string description;
string category;
uint rentalDeposit;
uint rentalFee;
add... | Make sure the function is being called by the contract deployer Remove the contract from the blockchain, return any ether to the deployer | function destroy() public {
require(msg.sender == deployer);
selfdestruct(msg.sender);
}
| 12,936,707 |
// Tell the compiler which version of the compiler we are using
pragma solidity ^0.4.8;
// Simple Voting Contract.
contract Ballot {
// Events are our Dapp's window into what is happening in our smart contract
// They are cheap to create, and saved in such a way that it is fast to find
event Voted(address... | It is important to have a selfdestruct option in Ethereum. Not only will all the Money be send to the address passed in, but also it will free up some memory in the blockchain, and you are subsidized for that, be a good citizen! | function destroy() isCreator {
selfdestruct(msg.sender);
}
| 2,545,789 |
pragma solidity ^0.4.24;
// File: contracts/token/IERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allow... | Transfer token for a specified addresses from The address to transfer from. to The address to transfer to. value The amount to be transferred./ | function _transfer(address from, address to, uint256 value) internal {
require(to != address(0), "Cannot transfer to 0x0 address");
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
| 2,455,441 |
./full_match/5/0x321A7e7626D904545D5Af3D2a2625694554932f1/sources/StakingContract.sol | adds tokens staked to total staked and player's staked in snapshot tokensToStake tokens to stake staker tokens to unstake/ | function _stake(uint256 tokensToStake, address staker) internal {
_totalCurrentlyStaked += tokensToStake;
_players[staker].tokensStaked += tokensToStake;
_players[staker].snapshots.push(Snapshot(block.number, tokensToStake));
}
| 1,878,037 |
./full_match/80001/0xFbAb28452b81052982756d57529F66a604b2B561/sources/contracts/rev/drop/ERC721DropOpen.sol | Lets an authorized address mint an NFT to a recipient. The logic in the `_canMint` function determines whether the caller is authorized to mint NFTs. _to The recipient of the NFT to mint. _tokenURI The full metadata URI for the NFT minted./ _setBaseURI(nextTokenIdToClaim(), _tokenURI); _safeMint... | function mintTo(address _to, string memory _tokenURI) public virtual {
require(_canMint(), "Not authorized to mint.");
}
| 5,691,502 |
./partial_match/97/0x44E70A9c9CeAE34A8E8f8dB5cf145C1A1828144f/sources/Exchange.sol | File: contracts/interface/ICFDVault.sol | interface ICFDVault {
function withdraw(
IExchange _exchange,
address _receiver,
Decimal.decimal memory _amount
) external;
function realizeBadDebt(IExchange _exchange, Decimal.decimal memory _badDebt) external;
function modifyLiquidity() external;
function getMMLiquidity(... | 11,345,436 |
./full_match/1/0x363E9489a4ccE10Ee3F86Bc049E08290D1731957/sources/contracts/oz/token/ERC20/utils/SafeERC20.sol | Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement on the return value: the return value is optional (but if data is returned, it must not be false). token The token targeted by the call. data The call data (encoded using abi.encode or one of its variants)./ We ... | function _callOptionalReturn(IERC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
revert SafeERC20ERC20OperationFailed();
}
... | 8,341,053 |
pragma solidity ^0.4.21;
import "./QuadrantToken.sol";
import "zeppelin-solidity/contracts/lifecycle/Pausable.sol";
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
import "zeppelin-solidity/contracts/math/SafeMath.sol";
import "./Whitelister.sol";
/// @title Dutch auction contract - distribution of a fixed... | Adds account addresses to individual refund whitelist. Adds account addresses to individual refund whitelist. _bidder_addresses Array of addresses. | function addToRefundForIndividualsWhitelist(address[] _bidder_addresses) public onlyOwner {
for (uint32 i = 0; i < _bidder_addresses.length; i++) {
refundForIndividualsWhitelist[_bidder_addresses[i]] = true;
}
}
| 12,907,255 |
// SPDX-License-Identifier: AGPLv3
pragma solidity 0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
interface IVestable {
function vest(
bool vest,
address _receiver,
uint256 _amount
) ex... | Verify the merkle proof. | function verifyDrop(
uint256 trancheId,
uint128 amount,
bytes32[] calldata merkleProof
) external view returns (bool) {
require(trancheId < tranches, "verifyDrop: !trancheId");
require(!isClaimed(trancheId, msg.sender), "verifyDrop: Drop already claimed");
DropInf... | 1,290,530 |
/**
*Submitted for verification at Etherscan.io on 2021-11-11
*/
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.5.14;
/**
* @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... | Get borrowed balance of a token in the uint256 of Wei/ | function getBorrowETH(
address _accountAddr
) public view returns (uint256 borrowETH) {
ITokenRegistry tokenRegistry = globalConfig.tokenInfoRegistry();
Account memory account = accounts[_accountAddr];
uint128 hasBorrows = account.borrowBitmap;
for(uint8 i = 0; i < 128; i... | 8,053,204 |
./full_match/80001/0x3Cf3eF488a47aBe2Bd4ccB26B03bEfbC2F43E1b1/sources/contracts/QiDaoLiquidator.sol | require(collateralPercentage < _minimumCollateralPercentage, "Vault is not below minimum collateral percentage"); get vault's debt. multiply 0.5 || div(2) | function checkCost (uint256 _vaultId) public view returns(uint256){
address ogOwner = vaultContract.vaultOwner(_vaultId);
(uint256 collateralValueTimes100, uint256 debtValue) = calculateCollateralProperties(vaultContract.vaultCollateral(_vaultId), vaultContract.vaultDebt(_vaultId) );
uint2... | 9,469,355 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
import {BytesLib} from '@interlay/bitcoin-spv-sol/contracts/BytesLib.sol';
import {BTCUtils} from '@interlay/bitcoin-spv-sol/contracts/BTCUtils.sol';
import {ValidateSPV} from '@interlay/bitcoin... | See {IRelay-submitBlockHeaderBatch}./ | function submitBlockHeaderBatch(bytes calldata headers) external override {
require(headers.length % 80 == 0, ERR_INVALID_HEADER_BATCH);
for (uint256 i = 0; i < headers.length / 80; i = i.add(1)) {
bytes memory header = headers.slice(i.mul(80), 80);
_submitBlockHeader(header... | 992,812 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.6.12;
import "../libs/SafeMath.sol";
contract BadToken {
mapping (address => uint) balances;
function balanceOf(address owner) public view returns (uint) {
return balances[owner];
}
// Breaks ERC20 spec: those 2 should return (bool)
function transfer(ad... | Breaks ERC20 spec: those 2 should return (bool) | function transfer(address to, uint value) public {
balances[msg.sender] = SafeMath.sub(balances[msg.sender], value);
balances[to] = SafeMath.add(balances[to], value);
}
| 15,784,966 |
// Sources flattened with hardhat v2.8.3 https://hardhat.org
// File contracts/Interfaces/IBorrowerOperations.sol
// SPDX-License-Identifier:
pragma solidity 0.6.11;
// Common interface for the Trove Manager.
interface IBorrowerOperations {
// --- Events ---
event TroveManagerAddressChanged(address _newT... | Overflow check for int256(wad) cast below Also enforces a non-zero wad | function join(address urn, uint256 val) internal virtual {
harvest(urn, urn);
if (val > 0) {
uint256 wad = wdiv(mul(val, to18ConversionFactor), nps());
require(int256(wad) > 0);
require(gem.transferFrom(msg.sender, address(this), val));
vat.slip(ilk,... | 504,035 |
// SPDX-License-Identifier: MIT
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 o... | Average dollar value of pool token | function get_virtual_price() external override view returns (uint) {
return stableSwap3Pool.get_virtual_price();
}
| 1,408,268 |
pragma solidity ^0.4.23;
// File: contracts/TokenSale.sol
contract TokenSale {
/**
* Buy tokens for the beneficiary using paid Ether.
* @param beneficiary the beneficiary address that will receive the tokens.
*/
function buyTokens(address beneficiary) public payable;
}
// File: contracts/Whitelis... | Release vested tokens to the beneficiary. Anyone can release vested tokens. return A boolean that indicates if the operation was successful./ | function releaseVested() public returns(bool released) {
require(vesting != address(0), "TokenVesting not activated");
vesting.release(this);
return true;
}
| 5,824,786 |
./full_match/83/0x839b1c9Ac4b4cE68bF33aC955a087944f55f7B27/sources/C/Users/Asus/Desktop/PROJECT/abcc/New_folder/testnet_METER/contracts/wthell.sol | first weapon free with a character mint, max 1 star | function mintCharacter() public doesNotHaveMoreThanMaxCharacters oncePerBlock(msg.sender) requestPayFromPlayer(mintCharacterFee) {
require(characters.balanceOf(msg.sender) < characterLimit,
string(abi.encodePacked("You can only have ",characterLimit," characters!")));
_payContract(msg.se... | 9,563,986 |
// Dependency file: @openzeppelin/contracts/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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].
*
... | withdraw some BNB. Withdraw in emergency mode only when contract paused | function withdrawSome(address _recipient, uint256 _amount)
external
virtual
onlyRole(DEFAULT_ADMIN_ROLE)
{
_withdraw(_recipient, _amount);
}
| 11,876,836 |
./full_match/1/0x71F056D87a7C9B3603E04DCe49Df92C265060325/sources/contracts/woofpacknftico.sol | CrowdsaleStage public stage = CrowdsaleStage.PreICO; | {
using SafeMath for uint256;
mapping(address => uint256) public contributions;
constructor(
address payable _wallet,
IWoofpackNFTToken _token,
uint256 _cap,
uint256 _openingTime,
uint256 _closingTime
)
public
Crowdsale(_wallet, _token)
... | 3,193,080 |
./partial_match/1/0x3a23F943181408EAC424116Af7b7790c94Cb97a5/sources/src/swap/oneinch/OneInchImpl.sol | function to swapWithIn SocketGateway - swaps tokens on the chain to socketGateway as recipient via OneInch-Middleware-Aggregator fromToken token to be swapped toToken token to which fromToken has to be swapped amount amount of fromToken being swapped swapExtraData encoded value of properties in the swapData... | function performActionWithIn(
address fromToken,
address toToken,
uint256 amount,
bytes calldata swapExtraData
) external payable override returns (uint256, address) {
uint256 returnAmount;
if (fromToken != NATIVE_TOKEN_ADDRESS) {
ERC20 token = ERC20(... | 11,003,180 |
interface IStandardToken {
function noHooksTransfer(address recipient, uint256 amount) external returns (bool);
}
contract ITyped {
function getTypeName() public view returns (bytes32);
}
contract IERC20 {
function totalSupply() public view returns (uint256);
function balanceOf(address owner) ... | return The REP token associated with this Universe/ | function getReputationToken() public view returns (IV2ReputationToken) {
return reputationToken;
}
| 1,839,685 |
/**
*Submitted for verification at Etherscan.io on 2021-08-13
*/
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Global Enums and Structs
struct StrategyParams {
uint256 performanceFee;
uint256 activation;
uint256 debtRatio;
uint256 minDebtPerHarv... | We might need to return want to the vaultWithdraw enough to satisfy profit check | function prepareReturn(uint256 _debtOutstanding)
internal
override
returns (
uint256 _profit,
uint256 _loss,
uint256 _debtPayment
)
{
if (_debtOutstanding > 0) {
uint256 _amountFreed = 0;
(_amountFreed, _loss) = ... | 2,424,971 |
./partial_match/42/0x17dfF75B7E7a001e8EB4dba97BEd2d34406F0A20/sources/BasixNFTSale.sol | Create a new NFT Sale/ | function createSale(
uint256 _supply,
uint256 _image,
uint256 _tokenRarity,
uint256 _basixPrice,
uint256 _ethPrice
)
public
onlyOwner()
saleNotExists(_image, _tokenRarity)
validRarity(_tokenRarity)
{
salesMap[_image][_tokenRarit... | 9,107,354 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return payable(msg.sender);
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability wa... | once enabled, can never be turned off | function enableTrading() internal onlyOwner {
tradingActive = true;
swapAndLiquifyEnabled = true;
tradingActiveBlock = block.number;
}
| 1,570,962 |
/**
*Submitted for verification at Etherscan.io on 2022-03-26
*/
// SPDX-License-Identifier: MIT
// File: contracts/DateTime.sol
pragma solidity ^0.8.0;
// ----------------------------------------------------------------------------
// DateTime Library v2.0
//
// A gas-efficient Solidity date and time library
//
/... | See {IERC721-safeTransferFrom}./ | function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, '');
}
| 2,208,386 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library TestLibrary {
function libDo(uint256 n) external pure returns (uint256) {
return n * 2;
}
}
library SafeMath0 {
function add(uint256 a, uint256 b) external pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "S... | Solidity only automatically asserts when dividing by 0 assert(a == b c + a % b); There is no case in which this doesn't hold | function div(uint256 a, uint256 b, string memory errorMessage) public pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
| 1,822,665 |
/*
WeiFund v1.0
This contract creates a crowdfunding platform. Start, donate to, payout and
refund crowdfunding campaigns on Ethereum.
If the campaign goal is reached or surpassed by stated expiry, all raised
funds will be paid out to the campaign's beneficiary. If the campaign goal is
not reached by the stated ex... | refunds your accounts contribution of a failed crowdfunding campaign This method will refund the amount you contributed to a WeiFund campaign, if that campaign has failed to meet it's funding goal or has expired. _campaignID (campaign ID) The ID number of the crowdfunding campaign to be refunded | function refund(uint _campaignID, uint _contribution) {}
| 1,796,405 |
pragma solidity 0.5.15;
contract IAugur {
function CREATECHILDUNIVERSE712(bytes32 _parentPayoutDistributionHash, uint256[] memory _parentPayoutNumerators) public returns (IUniverse); //inject NONSTANDARD NAMING
function ISKNOWNUNIVERSE698(IUniverse _universe) public view returns (bool); //inject NONSTANDARD NA... | inject NONSTANDARD NAMING | function GETRESERVES901() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); | 2,554,142 |
pragma solidity ^0.5.4;
//Based on work by ZeppelinOS Team at https://github.com/zeppelinos/labs/tree/master/upgradeability_using_unstructured_storage
contract UnstructuredProxy {
bytes32 private constant ownerPosition = keccak256("secblocks.proxy.owner");
bytes32 private constant implementationPosition = kecc... | sets position of the implementation/ | function setImplementation(address newImplementation) internal {
bytes32 position = implementationPosition;
}
| 5,493,146 |
// SPDX-License-Identifier: GPL-3.0
// Forked from https://github.com/ourzora/core @ 450cd154bfbb70f62e94050cc3f1560d58e0506a
pragma solidity >=0.8.4;
pragma experimental ABIEncoderV2;
import { SafeMath } from "@openzeppelin/contracts/utils/math/SafeMath.sol";
import { IERC721 } from "@openzeppelin/contracts/token/ER... | Validates that the bid is valid by ensuring that the bid amount can be split perfectly into all the bid shares. We do this by comparing the sum of the individual share values with the amount and ensuring they are equal. Because the splitShare function uses integer division, any inconsistencies with the original and s... | function isValidBid(uint256 tokenID, uint256 bidAmount)
public
view
override
returns (bool)
{
BidShares memory bidShares = bidSharesForToken(tokenID);
console.log("bidamount", bidAmount);
return
bidAmount != 0 &&
(bidAmount ==
... | 5,468,298 |
pragma solidity ^0.4.16;
contract SafeMath{
// math operations with safety checks that throw on error
// small gas improvement
function safeMul(uint256 a, uint256 b) internal returns (uint256){
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
functio... | send ether to mainWallet | function buyTo(address investor) public payable onlyVerified{
require(!haltICO);
require(investor != address(0));
require(msg.value >= minInvestment);
require(block.number >= icoStartBlock && block.number < icoEndBlock);
uint256 icoBottomInteger = icoBottomIntegerPrice();
... | 1,380,776 |
./full_match/3/0x7705122f574F84b2193856Ae56B592D8402Bcd4b/sources/contracts/EtherBPMNNFTOrder.sol | Complete all pending orders./ Check the ownership of marketplace Check if order was not completed Send pending tokens to customers Update order status | function completeOrders() public payable {
require(msg.sender == owner);
for (uint256 i = 0; i < orders.length; i++) {
if (orders[i].isCompleted == 0) {
tokenAddress.safeTransferFrom(msg.sender, orders[i].sender, orders[i].tokenId);
... | 8,255,972 |
./full_match/1/0x481bA2d2e86a1c41427893899B5B0cEae41c6726/sources/lib/mip21-toolkit/src/urns/RwaUrn2.sol | Draws `wad` amount of Dai from the contract. wad The amount to draw./ | function draw(uint256 wad) external operator {
bytes32 ilk = gemJoin.ilk();
jug.drip(ilk);
(, uint256 rate, , , ) = vat.ilks(ilk);
uint256 dart = divup(rad(wad), rate);
require(dart <= 2**255 - 1, "RwaUrn2/overflow");
vat.frob(ilk, address(this), address(this), addr... | 8,448,342 |
/**
*Submitted for verification at Etherscan.io on 2019-12-06
*/
// File: ../../mosaic-contracts/contracts/lib/RLP.sol
pragma solidity ^0.5.0;
/**
* @title RLPReader
*
* RLPReader is used to read and parse RLP encoded data in memory.
*
* @author Andreas Olofsson (androlo1980@gmail.com)
*/
library RLP {
/** Con... | bytes b must be hp encoded | {
function _getNibbleArray(
bytes memory b
)
private
pure
returns (bytes memory nibbles_)
if(b.length>0) {
uint8 offset;
uint8 hpNibble = uint8(_getNthNibbleOfBytes(0,b));
if(hpNibble == 1 || hpNibble == 3) {
nibbles... | 12,905,904 |
pragma solidity ^0.4.19;
//--------- OpenZeppelin's Safe Math
//Source : https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) ... | These two functions concern the "temporary" whitelist | function whitelist_addys(address[] _addys) onlyOwner {
for (uint256 i = 0; i < _addys.length; i++) {
Contributor storage contributor = contributors[_addys[i]];
contributor.whitelisted = true;
}
}
| 1,050,149 |
// File: contracts/common/Initializable.sol
pragma solidity ^0.8.0;
contract Initializable {
bool inited = false;
modifier initializer() {
require(!inited, "already inited");
_;
inited = true;
}
}
// File: contracts/common/EIP712Base.sol
pragma solidity ^0.8.0;
contract EI... | Updates the minimum payment required for calling hatchFish(). Can only be called by the COO address. (This fee is used to offset the gas cost incurred by the autobirth daemon). | function setHatchFee(uint256 val) external onlyCEO {
hatchFee = val;
}
| 11,765,462 |
// Solidity files have to start with this pragma.
// It will be used by the Solidity compiler to validate its version.
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import ... | Allow admin minting of tokens to a given account | function adminMint(address account, uint256 amount)
public
onlyOwner
nonReentrant
{
require(totalSupply.add(amount) < MAX_TOKENS, "over_max_supply");
for (uint256 i = 0; i < amount; i++) {
_mintWithRandomTokenId(account);
}
}
| 6,036,246 |
./full_match/83/0x51AB78FBF08d89d0e8fd8E001b8dDeb1E9c77f28/sources/contracts/WstMTRG.sol | Get amount of wstMTRG for a given amount of stMTRG _stMTRGAmount amount of stMTRG return Amount of wstMTRG for a given stMTRG amount/ | function getWstMTRGByStMTRG(
uint256 _stMTRGAmount
) external view returns (uint256) {
return stMTRG.valueToShare(_stMTRGAmount);
}
| 9,563,053 |
pragma solidity ^0.5.9;
import "./Standard/ERC20.sol";
import "./Standard/ERC165.sol";
import "./Util/SafeMath.sol";
contract DelightItem is ERC20, ERC165 {
using SafeMath for uint;
// The two addresses below are the addresses of the trusted smart contract, and don't need to be allowed.
// μλ λ μ£Όμλ μ λ’°νλ μ€λ§νΈ κ³μ½μ ... | Dismantles an item. μμ΄ν
μ λΆν΄ν©λλ€. This function can only be used by the Delight item manager. Delight μμ΄ν
κ΄λ¦¬μλ§ μ¬μ©ν μ μλ ν¨μμ
λλ€. | function disassemble(uint amount) external {
require(msg.sender == delightItemManager);
balances[delightItemManager] = balances[delightItemManager].sub(amount);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(delightItemManager, address(0), amount);
}
| 1,822,975 |
pragma solidity ^0.5.11;
contract count {
uint public counter;
// A struct can hold multiple data types
struct counting {
address counter;
string message;
}
// Array of our structs followed by a mapping
counting[] public numbers;
mapping(address => uint) public amo... | push a struct onto our array put the addresss of the transaction sent and the value they set into mapping | function increment(uint _counter, string calldata message) external {
counter += _counter;
numbers.push(counting(msg.sender, message));
amount[msg.sender] = _counter;
}
| 1,086,441 |
./partial_match/8453/0xc7b006f084Ca79334DB41fE216D3195870FAc026/sources/DUCKRouter.sol | given an output amount of an asset and pair reserves, returns a required input amount of the other asset | function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) {
require(amountOut > 0, 'DUCKLibrary: INSUFFICIENT_OUTPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'DUCKLibrary: INSUFFICIENT_LIQUIDITY');
uint numerator = reserveIn.mul(amo... | 16,760,437 |
pragma solidity ^0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) pu... | function to let the user know how much time they have until they can claim their tokens from unstaking _user to check the time until claimable of return uint time in seconds until they may claim | function timeUntilClaimAvaliable(address _user) view external returns (uint) {
return stakeBalances[_user].unstakeTime.add(14).mul(86400);
}
| 12,235,981 |
pragma solidity ^0.4.19;
import "zeppelin-solidity/contracts/math/SafeMath.sol";
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
import "../liquidation/LiquidationWallet.sol";
import "../token/MiniMeTokenInterface.sol";
import "../liquidation/LiquidatorInterface.sol";
contract LiquidationVoting is Ownable... | allows the notary to enable this contract to open up the voting process once 95% of the funds are invested/ | function enableVoting() public onlyNotary {
require(!votingEnabled);
votingEnabled = true;
currentStage = Stages.PendingNextVotingPeriod;
}
| 945,799 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol';
import '@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol';
import '@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol';
import '@ope... | Set address of pool _pool Address of pool/ | function updatePool(address payable _pool) external onlyRole(ADMIN_ROLE) {
require(_pool != payable(0), 'WQBridge: invalid pool address');
pool = _pool;
}
| 14,600,536 |
./full_match/1/0xA2A7c7DC114765B21E7D167d9665D3992152E6d9/sources/src/abstracts/BaseVault.sol | @inheritdoc IERC4626 | function previewRedeem(uint256 shares) public view virtual override returns (uint256) {
return _convertToAssets(shares, Math.Rounding.Down);
}
| 16,499,484 |
// SPDX-License-Identifier: None
// All rights reserved. @2022
/*
__ ___ _ _ _____ _ _
\ \ / / | (_) | / ____| | | | |
\ \ /\ / /| |__ _| |_ ___| | _ _| |__ ___| | ___ ___ ___
\ \/ \/ / | '_ \| | __/ ... | Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with `errorMessage` as a fallback revert reason when `target` reverts. _Available since v3.1._/ | function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
| 6,085,786 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* Strings Library
*
* In summary this is a simple library of string functions which make simple
* string operations less tedious in solidity.
*
* Please be aware these functions can be quite gas heavy so use them only when
* necessary not to clog the b... | Length Returns the length of the specified string _base When being used for a data type this is the extended object otherwise this is the string to be measured return uint The length of the passed string/ | function length(string memory _base) internal pure returns (uint256) {
bytes memory _baseBytes = bytes(_base);
return _baseBytes.length;
}
| 6,412,539 |
./full_match/80001/0x53ECFAF482f6bF454D17290BE11E14561047df2c/sources/WesetRaffle.sol | helper function to get the raffle randomNumber for a raffle _raffleId Id of the raffle return randomNumber | function getRaffleRandomNumber(
uint256 _raffleId
) public view returns (uint256) {
return raffles[_raffleId].randomNumber;
}
| 845,212 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.