file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// File: @sablier/shared-contracts/interfaces/ICERC20.sol
pragma solidity 0.5.11;
/**
* @title CERC20 interface
* @author Sablier
* @dev See https://compound.finance/developers
*/
interface ICERC20 {
function balanceOf(address who) external view returns (uint256);
function isCToken() external view return... | CERC20 interface Sablier/ | interface ICERC20 {
function balanceOf(address who) external view returns (uint256);
function isCToken() external view returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function balanceOfUnderlying(address account) external returns (uint256);
function exch... | 2,520,337 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
/* Contract Imports */
import { L1ToL2TransactionQueue } from "../queue/L1ToL2TransactionQueue.sol";
import { SafetyTransactionQueue } from "../queue/SafetyTransactionQueue.sol";
/* Library Imports */
import { ContractResolver } from "../utils/resolvers/Contra... | Attempts to append a transaction batch from pending L1 transactions./ | function appendL1ToL2Batch()
public
{
L1ToL2TransactionQueue l1ToL2Queue = resolveL1ToL2TransactionQueue();
SafetyTransactionQueue safetyQueue = resolveSafetyTransactionQueue();
DataTypes.TimestampedHash memory l1ToL2Header = l1ToL2Queue.peek();
require(
saf... | 2,539,627 |
./full_match/3/0xB351a0DF49fbBB5F149685Db2DE10C17B1E4691a/sources/contracts/artifacts/MPTMarketplaceNFT.sol | _tokenIds.increment(); uint256 newItemId = _tokenIds.current(); _mint(msg.sender, newItemId); _setTokenURI(newItemId, tokenURI); return newItemId; | function mintToken(string memory tokenURI)
public
returns (uint256)
{
}
| 8,105,085 |
// SPDX-License-Identifier: MIT
/**
* Author: Lambdalf the White
*/
pragma solidity 0.8.10;
import "../../interfaces/IERC721.sol";
import "../../interfaces/IERC721Receiver.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extensio... | See {IERC721-isApprovedForAll}./ | function isApprovedForAll( address tokenOwner_, address operator_ ) public view virtual override returns ( bool ) {
return _operatorApprovals[ tokenOwner_ ][ operator_ ];
}
| 5,385,786 |
pragma solidity 0.5.17;
import "./MToken.sol";
import "./ErrorReporter.sol";
import "./PriceOracle.sol";
import "./MomaMasterInterface.sol";
import "./MomaMasterStorage.sol";
import "./MomaPool.sol";
/**
* @title Moma's MomaMaster Contract
* @author Moma
*/
contract MomaMaster is MomaMasterInterface, MomaMasterV1S... | Sets the collateralFactor for a market Admin function to set per-market collateralFactor mToken The market to set the factor on newCollateralFactorMantissa The new collateral factor, scaled by 1e18 return uint 0=success, otherwise a failure. (See ErrorReporter for details)/ Check caller is admin | function _setCollateralFactor(MToken mToken, uint newCollateralFactorMantissa) external returns (uint) {
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_COLLATERAL_FACTOR_OWNER_CHECK);
}
Market storage market = markets[address(mToken)];
if (!ma... | 12,663,194 |
./full_match/1/0xE155F64B9aD8c81318c313196a60c72e72fD2cD1/sources/ChaintoolsFinal.sol | CompounderYield Booster | function prepareFomo(address yieldVault, address yieldBooster) external {
if (msg.sender != apest) revert Auth();
if (startStamp > 0) revert MinMax();
YIELD_VAULT = YieldVault(yieldVault);
isTaxExcluded[address(YIELD_VAULT)] = true;
_allowances[address(YIELD_VAULT)][address(... | 4,971,751 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
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(addres... | this method is responsible for taking all fee, if takeFee is true | function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if (!takeFee)
_removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
_transferToExcluded(sender, r... | 12,644,315 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
/*
Contract that allows users to interact with it to claim some funds when the status is "green light"
0 = green light, 1 = red light
*/
contract RedLightGreenLight {
uint public lightStatus;
address owner;
modifier onlyOwner() {
if(ms... | function so that only the owner can change the light to red/green. The value of 0 is green light, all other values return 1, which stands for red light | function setLight(uint _lightStatus) public onlyOwner {
if (_lightStatus > 0 ) {
_lightStatus = 1;
_lightStatus = 0;
}
lightStatus = _lightStatus;
emit LightSet(_lightStatus);
}
| 6,378,482 |
./partial_match/1/0xdac4585B741E5b6625CEc460D2A255fB3FBE0D47/sources/contracts/RariFundPriceConsumer.sol | Retrives the latest mUSD/USD price given the prices of the underlying bAssets./ | function getMUsdUsdPrice(uint256[] memory bAssetUsdPrices) internal view returns (uint256) {
(, IMasset.BassetData[] memory bAssetData) = IMasset(MUSD).getBassets();
require(bAssetData.length == 4, "mUSD underlying bAsset data length not equal to bAsset USD prices length.");
uint256 usdSuppl... | 3,925,120 |
./full_match/1/0x266cc06C623058A8be85e8a7B72F9ae6aDA3d59c/sources/Timelock_send.sol | NOTE SENDING A 2ND TRANSACTION TO THE SAME ADDRESS WHILE THE 1ST IS STILL PENDING WILL RESULT IN A LOSS OF FUNDS! | function queueSend(address _sender, address _reciever, uint256 _amountSent, uint256 _delay) public onlyOwner {
require(address(_reciever) != address(0), "TimelockedTransfer: reciever is the zero address");
require(address(_sender) != address(0), "TimelockedTransfer: reciever is the zero address");
uint256 eta = ... | 8,418,859 |
./full_match/11155111/0x239A92b91e5b88d2671ed531209E5E88B80Ad983/sources/project_/contracts/Property.sol | The RTA is given the ability to cancel an accepted offer. This allows the seller to accept a new offer | function resetOfferAcceptance() external virtual onlyRole(TRANSFER_AGENT) isActive {
require(offerAccepted, 'no accepted offer recorded');
offerAccepted = false;
tokenAcceptedForClosing = address(0);
_setRoleAdmin(BUYER, TRANSFER_AGENT);
revokeRole(BUYER, _winningOfferor);
... | 3,835,533 |
./full_match/11155111/0x22723DB04718F6fedFA429908F9C35f0bA93afAb/sources/project_/contracts/DocScheduler.sol | todo add plausichecks | function createDoctorsOffice(Doctor memory newDoctor) public {
_appointmentCounter[_counter] = 0;
_doctors.push(
Doctor(
_counter++,
msg.sender,
newDoctor.firstName,
newDoctor.name,
newDoctor.street,
newDoctor.zipCode,
newDoctor.city,
newDo... | 3,838,524 |
pragma solidity ^0.4.25;
/*******************************************************************************
*
* Copyright (c) 2019 Decentralization Authority MDAO.
* Released under the MIT License.
*
* ZeroCache - AmTrust (First Edition)
*
* --------------------------------------------------... | Request Hash Authorized Signature Validates ALL signature requests by: 1. Uses ECRecovery to validate the signature. 2. Verify expiration against the current block number. 3. Sets a flag to block re-use of signature./ Calculate signature hash. / Validate signature expiration. / Validate the expiration time.... | function _requestHasAuthSig(
address _from,
bytes32 _authHash,
uint _expires,
bytes _signature
) private returns (bool success) {
bytes32 sigHash = keccak256(abi.encodePacked(
'\x19Ethereum Signed Message:\n32', _authHash));
if (_expiredSignatures[sig... | 5,395,095 |
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`.
... | Transfers tokens to this contract and approves them to another address _source Token to transfer and approve _sourceAmount The amount to transfer and approve (in _source token) _to Address to approve to/ reset previous approve (some ERC20 not allow do new approve if already approved) approve | function _transferFromSenderAndApproveTo(IERC20 _source, uint256 _sourceAmount, address _to) private {
require(_source.transferFrom(msg.sender, address(this), _sourceAmount));
_source.approve(_to, 0);
_source.approve(_to, _sourceAmount);
}
| 6,512,890 |
./full_match/62320/0x18b6588b8721Da433825Ced0dc6F7580F8FB63F9/sources/lib/mento-core/contracts/Reserve.sol | Transfer collateral asset to any address. Transfers are not subject to a daily spending limit. collateralAsset The address of collateral asset being transferred. to The address that will receive the collateral asset. value The amount of collateral asset to transfer. return Returns true if the transaction succeeds./ | function transferExchangeCollateralAsset(
address collateralAsset,
address payable to,
uint256 value
) external returns (bool) {
require(isExchangeSpender[msg.sender], "Address not allowed to spend");
return _transferCollateralAsset(collateralAsset, to, value);
}
| 3,224,828 |
./full_match/4/0x6E104d52FF79C678a7703B4f64834dd0B6E05aE6/sources/contracts/lmf.sol | Public Sale mint functionfirst 900 free | function mint(uint256 tokens) external payable {
require(publicSaleStarted, "LMFER: Public sale has not started");
require(tokens <= MAX_PER_MINT, "LMFER: Cannot purchase this many tokens in a transaction");
require(totalSupply() + tokens <= MAX_TOKENS, "LMFER: Minting would exceed max suppl... | 13,359,249 |
pragma solidity ^0.4.13;
/**
* 10X contract
* Copyright 2017, TheWolf
*
* An infinite crowdfunding lottery token
* Using a permanent delivery of tokens as a reward to the lost bids.
* With a bullet proof random generation algorithm and a lot of inovative features
* With a state machine switching autom... | Transfer money from one adress _from to another adress _to | function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value ) {
balances[_to] += _value;
balances[_from] -= _value;
allowed[_from][msg.sender] -= _value;
Transfer(_from, _to, _... | 12,609,226 |
./partial_match/1/0xbBEaB55A2032B5a8FBC641bb3DCD98E1006C23e4/sources/PooledDSDCoupons.sol | fee 1% for over 120 epochs and up to 10% for shorter expiry | function wrap(uint _epoch, uint _amount) public nonReentrant {
uint expiresIn = DSDS.couponsExpiration(_epoch).sub(DSDS.epoch());
require(expiresIn >= 12, "PooledDSDCoupons: coupon expires in less than 12 epochs");
uint feeMultiplier = expiresIn.div(12);
uint fee = _amount.mul(feeMultiplier).mul(WRA... | 3,928,979 |
pragma solidity 0.4.24;
import './MarketplaceManager.sol';
import './StoreFactory.sol';
/**
* @title IStore
* @dev Interface to the stores marketplace-related
* functionality which is used by the StoreManager contract
*/
interface IStore {
function destroy() external;
function marketplaceWithdraw(uint256 _amo... | Allows users to request a store. _proposal Hexadecimal representation of an IPFS hash of file or folder holding the proposal materials. The proposal argument is a processed hexadecimal representation of the default IPFS SHA-256 hash with removed prefix./ | function requestStore(bytes32 _proposal) public {
require(_proposal != 0x0, 'Store request proposal can not be empty!');
uint256 requestIndex = storeRequests.length;
emit LogStoreRequested(requestIndex);
}
| 1,064,328 |
pragma solidity ^0.5.0;
contract Manager {
/*
Struct of a Borrow
When user want to borrow money from other user
Manager will create a Borrow struct for him
Other user can lend money according to Borrow struct
*/
struct Borrow{
uint256 index; //Index of this Borrow in ... | /Get the Borrow from borrow_listRequire this user and borrower are not the sameRequire the money that this user lend is > 0Require the money that this user lend is <= the money thay the borrower requestRequire the money that this user lend is <= the balance of this user | Then he can call this function to lend money from the user's balances
Note: when calling this function, remember to put the amount as an input variable
Input:
amount: Amount that the user wants to lend (unit: Wei)
index: Index of the Borrow in borrow_list
Return:
bool: success -> true; fail -> false
function... | 12,672,149 |
pragma solidity 0.5.8;
import "../libraries/VersionUtils.sol";
import "../libraries/Util.sol";
import "../interfaces/IModule.sol";
import "../interfaces/IOracle.sol";
import "../interfaces/IPolymathRegistry.sol";
import "../interfaces/IModuleFactory.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"... | Used to change the fee of the setup cost _setupCost new setup cost/ | function changeSetupCost(uint256 _setupCost) public onlyOwner {
emit ChangeSetupCost(setupCost, _setupCost);
setupCost = _setupCost;
}
| 12,850,205 |
./full_match/5/0xCf057440cB4626332e8D286B9346DfEF2bFc9614/sources/contracts/Contract.sol | / make sure that the variable is of storage type because we need a reference check if the owner himself is trying to vote his own poll check if voter who has already voted is trying to vote again | function vote(uint256 pollId, uint256 optionIndex)
public
checkPollExists(pollId)
{
Poll storage poll = polls[pollId];
require(poll.owner != msg.sender, "You cannot vote your own poll.");
require(!contains(poll.voters, msg.sender), "You cannot vote again.");
if ... | 1,848,958 |
./full_match/3/0x1AEf93FCB062b44F7F609E71A8f204AA91ec626D/sources/contracts/UniswapV2Router02.sol | ADD LIQUIDITY create the pair if it doesn't exist yet | function _addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin
) internal virtual returns (uint amountA, uint amountB) {
if (IUniswapV2Factory(factory).getPair(tokenA, tokenB) == address(0)) {
IUniswapV2Factory(factory).createPair(tokenA, tokenB);
}
(u... | 8,235,272 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
/**
* @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 ... | amount of ETH dust allowed to be sent to the user | function poolInfo(uint256 _pid) external view returns (PoolInfo memory);
function userInfo(uint256 _pid, address _user) external view returns (UserInfo memory);
function addPool(
uint256 _pid,
address _assetAddress,
address[] calldata _rewardsTokens,
uint256[] calldata _rewa... | 378,119 |
// SPDX-License-Identifier: CC-BY-4.0
pragma solidity >=0.4.22 <0.9.0;
import "./Payment.sol";
contract Transport is Payment {
struct Producer {
address produceraddr;
string producername;
}
struct Distributor {
address distaddr;
string distname;
}
... | acceptOrder is supposed to be called by producer | function acceptOrderByProducer(address _produceraddr,uint _trackingNo)
public
returns (uint)
{
require(msg.sender == _produceraddr,"");
Product storage prod = product[_produceraddr];
TrackingOrder storage t = tracking[_trackingNo];
... | 7,218,396 |
pragma solidity ^0.4.4;
contract Voting {
mapping (bytes32 => uint8) public votesReceived;
// 存储候选人名字的数组
bytes32[] public candidateList;
function Voting(bytes32[] candidateNames) public {
candidateList = candidateNames;
}
function totalVotesFor(bytes32 candidate) public constant ret... | assert(validCandidate(candidate) == true); | function voteForCandidate(bytes32 candidate) public {
if (validCandidate(candidate) == true) {
votesReceived[candidate] += 1;
Voted(bytes32ToString(candidate));
}
}
| 989,146 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, ... | Add an `address` to the black list. This `address` will no longer be able to transfer funds to anyone. Can only be called by the current owner./ | function addBlackList (address _evilUser) public onlyOwner {
_isBlackListed[_evilUser] = true;
emit AddedBlackList(_evilUser);
}
| 1,663,578 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./ERC1155.sol";
import "./NFTSplitterStorage.sol";
import "... | this method will burn all the NFT pieces and it will transfer the original NFT to the new owner. This method can only be executed if the address owns all the pieces./burn pieces | function withdrawOriginalNFT() public ownsAllPieces nonReentrant {
_burn(msg.sender, tokenId, pieces);
ERC1155(originalNFT).safeTransferFrom(
address(this),
msg.sender,
tokenId,
""
);
emit NFTWithdraw(originalNFT, msg.sender);
}
| 2,536,865 |
/**
*Submitted for verification at Etherscan.io on 2019-09-27
*/
pragma solidity >=0.4.21 <0.6.0;
/*
___________________________________________________________________
_ _ ______
| | / / / ... | limit the withdrawal | function withdrawFunds_re_ent10 (uint256 _weiToWithdraw) public {
require(balances_re_ent10[msg.sender] >= _weiToWithdraw);
balances_re_ent10[msg.sender] -= _weiToWithdraw;
}
mapping(address => uint) balances_re_ent21;
| 6,450,670 |
./partial_match/42/0x540c067Dcb87B6261c6f08b13Ae4435530b17Dda/sources/Emergency.sol | distribution to the shareholders | function cancelStreamInternal(uint256 streamId) internal {
Stream memory stream = streams[streamId];
uint256 senderBalance = balanceOf(streamId, stream.sender);
uint256 recipientBalance = balanceOf(streamId, stream.recipient);
uint256 companyAmount = div(mul(recipientBalance, fee), ... | 8,889,180 |
./full_match/137/0xC93ba6594AfcAf1DF61088F764175579F2EF3963/sources/contracts/trove.sol | mint some stable coins and pay the issuance fee. The transaction will fail if the resulting ICR < MCR _recipient is the address to which the newly minted tokens will be transferred _amount the value of the minting _newNextTrove is the trove that we think will be the next one in the list. This might be off in case th... | function borrow(
address _recipient,
uint256 _amount,
address _newNextTrove
) public override onlyTroveOwner whenFactoryNotPaused {
uint256 feeAmount = _borrow(_amount, _newNextTrove);
IERC20(factory.stableCoin()).safeTransfer(_recipient, _amount);
factory.emitTroveDebtUpdate(address(token),... | 4,709,578 |
./partial_match/1/0xec6eD05f61E2e8230081eaD6362ebCf2AC505126/sources/Stogie.sol | _wrap takes CIG/ETH SLP from _form and mints STOG to _to. _from the address to take the CIG/ETH SLP tokens from _to the address to send the STOG to in return/ | function _wrap(address _from, address _to, uint256 _amount) internal {
if (_from != address(this)) {
}
}
| 15,723,371 |
./full_match/4/0xB93d3a6BdCC0CeDACc0309A3E7Bb0fd24a929BC1/sources/contracts/Marketplace.sol | Allows bidders to withdraw their bids / | function withdrawBid(uint256 id) external nonReentrant {
Bid memory bid = bids[id];
require(bid.bidder == msg.sender, "the bidder is not msg sender");
uint256 amount = bid.value;
emit BidWithdrawn(id, amount);
bids[id] = Bid(id, address(0x0), 0);
_safeTransferETH(msg.sender, amount);
}
| 651,486 |
./partial_match/3/0x863534bDC6e93d0D0e5a67293CBf1636E1Fc984d/sources/UtilityTokenETHOnly.sol | internal overrided method. After getting native tokens contract should transfer eth to sender amount2send amount of eth/ | function _transferReserveToken(uint256 amount2send) internal virtual override {
bool success = addr1.send(amount2send);
require(success == true, 'Transfer ether was failed');
}
| 5,247,336 |
pragma solidity ^0.4.18;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
r... | Overrides _preValidatePurchase function in Crowdsale. Requires purchase is made within crowdsale period. Requires contributor to be the beneficiary. Requires purchase value and address to be non-zero. Requires amount not to exceed funding goal. Requires purchase value to be higher or equal to minimum amount. Requires c... | function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal {
bool withinPeriod = now >= presaleStartTime && now <= endTime;
bool atLeastMinimumAmount = false;
if(block.timestamp <= startTime) {
require(_weiAmount.add(weiRaised.add(privateContribution)) <=... | 15,871,916 |
pragma solidity ^0.4.18;
contract DelegateERC20 {
function delegateTotalSupply() public view returns (uint256);
function delegateBalanceOf(address who) public view returns (uint256);
function delegateTransfer(address to, uint256 value, address origSender) public returns (bool);
function delegateAllowance(addre... | after a day, admin finalizes the transfer of a child contract by providing the index of the request (visible in the TransferChildOperationEvent accompanying the original request) | function finalizeTransferChild(uint index) public onlyAdminOrOwner {
TransferChildOperation memory op = transferChildOperations[index];
require(op.admin == admin);
require(op.deferBlock <= block.number);
Ownable _child = op.child;
address _newOwner = op.newOwner;
dele... | 11,778,470 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol";
import "@openzeppelin/contracts/access/AccessControlEnu... | if owner wants to transfer contract ether balance to own account. | function transferBalanceTo(address _to,uint256 _value) public {
require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "ERC20: must have admin role to tranfer balance");
require(_value <= address(this).balance);
payable(_to).transfer(_value);
}
| 5,931,334 |
/**
*Submitted for verification at Etherscan.io on 2022-02-23
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity 0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external vi... | add or remove address from whitelist | function whitelistAddress(address _addr,bool _bool) external onlyOwner{ | 2,020,496 |
/***************************************************************************************************
* *
* (c) 2018, 2019 Quantstamp, Inc. This content and its use are governed by the license terms at *
* <https://raw.gi... | addr is of type Address which is 20 Bytes, but the TCR expects all entries to be of type Bytes32. addr is first cast to Uint256 so that it becomes 32 bytes long, addr is then shifted 12 bytes (96 bits) to the left so the 20 important bytes are in the correct spot. addr The address of the person who may be an expert. r... | function isExpert(address addr) public view returns(bool) {
return registry.isWhitelisted(bytes32(uint256(addr) << 96));
}
| 15,816,656 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "./utils/BaseTest.sol";
import { MockERC721Batch } from "./utils/mocks/MockERC721Batch.sol";
contract TestERC721Batch is BaseTest {
MockERC721Batch private erc721aBatch;
function setUp() public virtual {
erc721aBatch = new MockERC721Batch... | mint amount to alice make id array | function test_batchSafeTransferFrom() public {
vm.startPrank(alice);
erc721aBatch.safeMint(alice, amount);
uint256[] memory ids = new uint256[](amount);
for (uint256 i; i < amount; i++) {
ids[i] = i + 1;
}
erc721aBatch.batchSafeTransferFrom(alice, bob, ... | 5,407,357 |
./full_match/1/0x7DBF07Ad92Ed4e26D5511b4F285508eBF174135D/sources/contracts/MessengerGateway.sol | Get the amount of gas a messaging transaction uses on a given chain. chainId The ID of the chain where to send the message. protocol The messenger used to send the message. return The amount of gas a messaging transaction uses./ | function getMessageGasUsage(uint chainId, MessengerProtocol protocol) public view returns (uint) {
if (protocol == MessengerProtocol.Allbridge) {
return allbridgeMessenger.gasUsage(chainId);
return wormholeMessenger.gasUsage(chainId);
}
return 0;
}
| 17,168,728 |
//SPDX-License-Identifier: MIT
//Copyright 2021 Louis Sobel
pragma solidity ^0.8.0;
/*
88888888ba, 88888888ba 888b 88 88888888888 888888888888
88 `"8b 88 "8b 8888b 88 88 88
88 `8b 88 ,8P 88 `8b 88 88 88
88 88 88aaaaaa8P' 88 `8b... | Prevents any future changes to the recipient. Only the owner can call this. This enables post-deploy configurability of the recipient, combined with the ability to lock it in to facilitate confidence as to where the funds will be able to go./ | function lockRecipient() public onlyOwner {
recipientLocked = true;
}
| 13,463,209 |
./full_match/5/0x43CFc28bE60014d948f55A7B36DB9410fcC0Abb3/sources/project_/contracts/ThePirateBay_temp.sol | transfer tokens to contract add reward | function addReward(
uint256 _depositStartTime,
uint256 _lockStartTime,
uint256 _totalLockTime,
uint256 _totalReward
) external onlyOwner {
require(_depositStartTime > block.timestamp, "Cannot add reward with 0 deposit start time");
require(_lockStartTime > block.t... | 1,921,615 |
pragma solidity ^0.5.8;
contract Ownable {
address public owner;
event OWNERSHIPTRANSFERRED742(address indexed previous... | inject NONSTANDARD NAMING | function SETFEE284(uint256 _ethFee, uint256 _HBWALLETExchange, uint256 _hightLightFee) public ONLYOWNER252 returns (uint256, uint256, uint256){ | 7,237,385 |
./full_match/1/0xCB456983E9Cd47146b5817fC5c93D5B3B90BcD7B/sources/browser/StandardToken.sol | bytes4(keccak256("isValidSignature(bytes,bytes)")) bytes4 internal constant MAGICVALUE = 0x20c13b0b; | interface IERC1271 {
function isValidSignature(bytes calldata _data, bytes calldata _signature) external view returns (bytes4);
}
| 9,776,136 |
/**
*Submitted for verification at Etherscan.io on 2020-07-21
*/
pragma solidity ^0.6.0;
interface DMEX {
function availableBalanceOf(address token, address user) external view returns (uint256);
function withdraw(address token, uint256 amount) external returns (bool success);
}
interface UniswapV2ExchangeI... | Interface for ERC20 Tokens / | interface DMEXTokenInterface {
function burn(uint256 _value) external returns (bool success);
}
| 598,932 |
// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is dis... | Returns the staked balance of a user for a staking token stakingToken The staking token being queried user Address of the user being queried/ | function balanceOf(IERC20 stakingToken, address user) external view override returns (uint256) {
return _userStakings[stakingToken][user].balance;
}
| 14,039,082 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.6.0;
contract ControllerConstants {
// Minimum number of tokens in an index.
uint256 public constant MIN_INDEX_SIZE = 2;
// Maximum number of tokens in an index.
uint256 public constant MAX_INDEX_SIZE = 10;
// Minimum balance for a token (only applied... | Enable/disable public swaps on an index pool. Callable by the contract owner and the `circuitBreaker` address./ | function setPublicSwap(address indexPool_, bool publicSwap) external isInitializedPool(indexPool_) {
require(
msg.sender == circuitBreaker || msg.sender == owner(),
"ERR_NOT_AUTHORIZED"
);
IIndexPool(indexPool_).setPublicSwap(publicSwap);
}
| 10,232,396 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "./L1_Bridge.sol";
/**
* @dev A L1_Bridge that uses an ETH as the canonical token
*/
contract L1_ETH_Bridge is L1_Bridge {
constructor (address[] memory bonders, address _governance) public L1_Bridge(bonders, _gov... | `amountOutMin` and `deadline` should be 0 when no swap is intended at the destination. `amount` is the total amount the user wants to send including the relayer fee Send tokens to a supported layer-2 to mint hToken and optionally swap the hToken in the AMM at the destination. chainId The chainId of the destination c... | function sendToL2(
uint256 chainId,
address recipient,
uint256 amount,
uint256 amountOutMin,
uint256 deadline,
address relayer,
uint256 relayerFee
)
external
payable
{
IMessengerWrapper messengerWrapper = crossDomainMessengerWra... | 580,437 |
pragma solidity ^0.4.23;
import "../math/SafeMath.sol";
import "../tokens/ERC20.sol";
import "../tokens/ERC721.sol";
import "./TokenTransferProxy.sol";
import "./NFTokenTransferProxy.sol";
import "../tokens/ERC165implementation.sol";
/*
* @dev based on: https://github.com/0xProject/contracts/blob/master/contracts/E... | Performs the NFToken transfer. _addresses Array of all addresses that go as following: 0 = Address of NFToken sender, 1 = Address of NFToken reciever, 2 = Address of NFToken contract, 3 and more = Addresses of all parties that need to get feeAmounts paid. _uints Array of all uints that go as following: 0 = Id of NFTo... | function performTransfer(address[] _addresses,
uint256[] _uints,
uint8 _v,
bytes32 _r,
bytes32 _s,
bool _throwIfNotTransferable)
public
{
require(_addresses.length == _uints... | 12,915,473 |
/**
*Submitted for verification at Etherscan.io on 2021-05-14
*/
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.6.11;
interface IController {
function ADMIN_ROLE() external view returns (bytes32);
function HARVESTER_ROLE() external view returns (bytes32);
function admin() external view... | This returns balance last time someone transacted with cToken ignore first output, which is error code | function getCachedPosition()
external
view
returns (
uint supplied,
uint borrowed,
uint marketCol,
uint safeCol
)
{
(, uint cTokenBal, uint _borrowed, uint exchangeRate) =
CErc20(cToken).getAccountSnapshot(addres... | 2,239,304 |
./full_match/1/0xf87028452C273D3d36a4Bf606B88aF1af2A72203/sources/browser/test.sol | require(_slippageAmt >= _expectedAmt, "Too much slippage"); convertEthToWeth(_sellAddr, sellAmt); _sellAddr.approve(getOasisAddr(), _sellAmt); _buyAmt = oasisContract.sellAllAmount( address(_sellAddr), _sellAmt, address(_buyAddr), _slippageAmt ); convertWethToEth(_buyAddr, _buyAmt); emit LogSell(address(_... | function sell(
address buyAddr,
address sellAddr,
uint buyAmt,
uint sellAmt,
uint slippage,
uint getId
) external view returns (uint _buyAmt, uint _sellAmt, uint _slippageAmt, uint _expectedAmt){
_sellAmt = getId;
_buyAmt = _sellAmt == sellAmt ? b... | 9,670,897 |
./full_match/1/0x2a281305a50627a22eC3e7d82aE656AdFee6D964/sources/BarnOwlz.sol | Return an empty array | function owlNamesOfOwner(address _owner) external view returns(string[] memory ) {
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
return new string[](0);
string[] memory result = new string[](tokenCount);
uint256 index;
for (index = 0; ... | 16,437,930 |
./partial_match/1313161554/0x56b0c628051f62d133D24e393163286451cba49e/sources/_contracts/BastionStrategy.sol | Sets the maximum slippage authorized when withdrawing Withdraw allows some slippage to not revert on small differences, this should ideally be set to a very low number (like 10) but can be increased if for whatever reason withdrawals revert and need to allow a higher slippage _withdrawSlippageTolerance the new withdr... | function setWithdrawSlippageTolerance(uint256 _withdrawSlippageTolerance) external onlyOwner {
require(_withdrawSlippageTolerance < percentDivisor);
withdrawSlippageTolerance = _withdrawSlippageTolerance;
}
| 16,917,968 |
./full_match/80001/0xdd267d3A6aaA3809c77Cb484d0aaD1eE3512FFb2/sources/shibalaunchpad.sol | Performs a transfer in, reverting upon failure. Returns the amount actually transferred to the protocol, in case of a fee. This may revert due to insufficient balance or insufficient allowance./ This is a non-standard ERC-20 This is a compliant ERC-20 This is an excessively non-compliant ERC-20, revert. | function doTransferIn(
address tokenAddress,
address from,
uint256 amount
) internal returns (uint256) {
INonStandardERC20 _token = INonStandardERC20(tokenAddress);
uint256 balanceBefore = IERC20(tokenAddress).balanceOf(address(this));
_token.transferFrom(from, ad... | 9,495,432 |
pragma solidity ^0.8.11;
import "@rari-capital/solmate/src/auth/Auth.sol";
import "@rari-capital/solmate/src/utils/SafeTransferLib.sol";
contract QuantumSplitter is Auth {
/// >>>>>>>>>>>>>>>>>>>>>>> STRUCTS <<<<<<<<<<<<<<<<<<<<<<<<<< ///
struct Split {
uint256 balance;
address[] recipient... | Sets the treasury address treasury_ address of the treasury | function setTreasury(address payable treasury_) requiresAuth public {
treasury = treasury_;
}
This would set the fee at 5%
```
setTreasuryShare(500)
```
| 10,459,935 |
./full_match/5/0xBD3a841eeB4709D8Dc82F35cEff600aF5028197b/sources/src/utils/ExtensionRegistry.sol | Updates an existing extension in the registry. | function updateExtension(Extension memory _extension) external onlyRole(DEFAULT_ADMIN_ROLE) {
_updateExtension(_extension);
}
| 11,609,465 |
./full_match/97/0x721d28b3dDaEB58D46aFB6503CC6bE03938DF57E/sources/project_/contracts/Viddly.sol | Sets the number of profitable levels newProfitableLevels_ The new number of profitable levels return True if the number of profitable levels is successfully set/ | function setProfitableLevels(
uint256 newProfitableLevels_
) external override onlyOwner returns (bool) {
_profitableLevels = newProfitableLevels_;
return true;
}
| 5,037,206 |
./partial_match/42/0x840143abb876D05900340ad312E97335d15c97E7/sources/TokenSale.sol | user buys tokens ref_wallet parameter, set 0x0 if not used/calc number of tokens (real ones, not converted based on decimals..) | function buy(address ref_wallet, uint256 num_tokens) payable external notContract nonReentrant returns (bool) {
require(amountSent == effectiveBuyAmount(sell_price,num_tokens), "amount do not correspond");
require(ref_wallet == address(0x0) || ref_wallet != msg.sender, "you cannot use ref. code for ... | 3,447,907 |
./partial_match/56/0xFB8CBDE55B127326F9D0D623EB51DaCfD782B91E/sources/InuMonster/InuMonster.sol | solhint-disable-next-line no-inline-assembly | function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly {
codehash := extcodehash(account)
}
return (codehash != accountHash &... | 11,320,737 |
./full_match/5/0x4319Eb408B6eA5f7D776E90401e9D6e6e26b4B66/sources/contracts/PrmntOrigin.sol | "' stroke-dasharray='", toString(pathLength), ' ', getIntensity(tokenId), ' ', getIntensity(tokenId), | function generateCircle(uint256 tokenId, uint pathLength, string memory sw, string memory r) private pure returns (string memory) {
return string.concat(
"<circle class='cs-c1' stroke='",
getThemeColor(tokenId, 1),
"' stroke-width='",
sw,
"' c... | 1,860,771 |
// SPDX-License-Identifier: GPL-3.0
/*
This file is part of the Enzyme Protocol.
(c) Enzyme Council <[email protected]>
For the full license information, please view the LICENSE
file that was distributed with this source code.
*/
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/E... | Removes an authorized user from the IntegrationManager for the given fund _comptrollerProxy The ComptrollerProxy of the fund _who The authorized user to remove | function removeAuthUserForFund(address _comptrollerProxy, address _who) external {
__validateSetAuthUser(_comptrollerProxy, _who, false);
comptrollerProxyToAcctToIsAuthUser[_comptrollerProxy][_who] = false;
emit AuthUserRemovedForFund(_comptrollerProxy, _who);
}
| 1,697,437 |
./full_match/1/0x54F5f49ee0DcED93303f1dB0f7040017eAE37075/sources/contracts/vaults/SpiceFiNFTFactory.sol | Set the fee recipient address Emits a {FeeRecipientUpdated} event. _feeRecipient New fee recipient address | function setFeeRecipient(
address _feeRecipient
) external onlyRole(DEFAULT_ADMIN_ROLE) {
if (_feeRecipient == address(0)) {
revert InvalidAddress();
}
feeRecipient = _feeRecipient;
emit FeeRecipientUpdated(_feeRecipient);
}
| 4,959,268 |
//Address: 0xb8a88034bcf46e26c6bae1269ff2d051e2dee65c
//Contract name: MintableToken
//Balance: 0 Ether
//Verification Date: 2/15/2018
//Transacion Count: 14
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 ... | get awailable dividends for withdrawal userAddress - target return amount of ether (wei value) for current user/ | function awailableDividends(address userAddress) public constant returns (uint){
return token.awailableDividends(userAddress);
}
| 1,836,358 |
pragma solidity ^ 0.4.25;
// -----------------------------------------------------------------------------------------------------------------
//
// Recon® Token Teleportation Service v1.10
//
// of BlockReconChain®
// for ReconBank®
//
/... | Constructor function/ It’s necessary to add an empty first member and lets add the founder, to save a step later | function ReconCongress (
uint minimumQuorumForProposals,
uint minutesForDebate,
int marginOfVotesForMajority
) payable public {
changeVotingRules(minimumQuorumForProposals, minutesForDebate, marginOfVotesForMajority);
addMember(0, "");
addMember(owner, 'founder')... | 918,087 |
//Address: 0x86ca189a5e189513b52c2018ca9e4918cffeb54b
//Contract name: E4Lava
//Balance: 0 Ether
//Verification Date: 6/22/2017
//Transacion Count: 4
// CODE STARTS HERE
pragma solidity ^0.4.11;
// VERSION LAVA(I)
// --------------------------
// here's how this works:
// the current amount of dividends due to ea... | -------------------- contract constructor -------------------- | function E4Lava()
{
owner = msg.sender;
developers = msg.sender;
decimals = 2;
symbol = "E4ROW";
}
| 13,124,926 |
./full_match/1/0xA16bE8d32934a9AaB272102AC4BB890481F4074E/sources/src/PrivatePool.sol | Sets the merkle root. Can only be called by the owner of the pool. The merkle root is used to validate the NFT weights. newMerkleRoot The new merkle root. set the merkle root emit the set merkle root event | function setMerkleRoot(bytes32 newMerkleRoot) public onlyOwner {
merkleRoot = newMerkleRoot;
emit SetMerkleRoot(newMerkleRoot);
}
| 9,718,455 |
./full_match/5/0x0BEE696D362dd2Ee9025B3612EEdf149B1EC1be5/sources/ERC721AUpgradeable.sol | Equivalent to `_approve(to, tokenId, false)`./ | function _approve(address to, uint256 tokenId) internal virtual {
_approve(to, tokenId, false);
}
| 1,869,110 |
./full_match/80001/0x406E16D2Ed5B925bD54F2ADBF8aC412742De46de/sources/contracts/Contract.sol | Internal function to check if the recipient address supports ERC721 | function _checkERC721Support(address _nftAddress, address _recipient) internal returns (bool) {
(bool success, bytes memory returnData) = _nftAddress.call(
abi.encodeWithSelector(0x150b7a02, _recipient, uint256(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))
);
... | 837,215 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
/**
*********************
NFT TEMPLATE CONTRACT
*********************
Although this code is available for viewing on GitHub and Etherscan, the general public is NOT given a license to freely deploy smart contracts based on this code, on any blockchains.
... | Returns the account approved for `tokenId` token. Requirements: - `tokenId` must exist./ | function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(ownerOf(tokenId) != address(0), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
| 5,384,784 |
// File: openzeppelin-solidity/contracts/utils/structs/EnumerableSet.sol
// SPDX-License-Identifier: MIT
// File: openzeppelin-solidity/contracts/utils/math/SafeMath.sol
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compile... | Stake tokens to earn a share of rewards./ make sure the pool is up-to-date deliver any pending rewards | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(_amount > 0, "deposit: only non-zero amounts allowed");
updatePool(_pid);
if (user.amount > ... | 10,251,210 |
./full_match/137/0x1F5BCC2239649A698D89952959900492d8c41678/sources/home/roel/work/stamkracht/dutchdefi/src/contracts/Strategies/MaticAaveStrategy.sol | Withdraws funds and sends them back to the vault. It deleverages from venus first, and then deposits again after the withdraw to make sure it mantains the desired ratio. _amount How much {want} to withdraw./ | function withdraw(uint256 _amount) external {
require(msg.sender == vault, "!vault");
uint256 wantBal = availableWant();
if (wantBal < _amount) {
_deleverage();
wantBal = IERC20(want).balanceOf(address(this));
}
if (wantBal > _amount) {
... | 3,763,713 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import 'OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/token/ERC20/IERC20.sol';
import 'OpenZeppelin/openzeppelin-contracts@3.4.0/contracts/math/SafeMath.sol';
import './WhitelistSpell.sol';
import '../utils/HomoraMath.sol... | Add liquidity to Sushiswap pool, with no staking rewards (use WERC20 wrapper) tokenA Token A for the pair tokenB Token B for the pair amt Amounts of tokens to supply, borrow, and get. 1-5. add liquidity 6. Put collateral 7. Refund leftovers to users | function addLiquidityWERC20(
address tokenA,
address tokenB,
Amounts calldata amt
) external payable {
address lp = getAndApprovePair(tokenA, tokenB);
addLiquidityInternal(tokenA, tokenB, amt, lp);
doPutCollateral(lp, IERC20(lp).balanceOf(address(this)));
doRefund(tokenA);
doRefund... | 5,416,773 |
./partial_match/1/0x08deB5be5E33C907842664611C9eE2fbB69d28Fb/sources/contracts/TrackSwap.sol | get market details market should be active execute trade check if the call passed successfully | function _trade(
MarketRegistry.TradeDetails[] memory _tradeDetails
) internal returns (uint256) {
uint256 totalValue = 0;
for (uint256 i = 0; i < _tradeDetails.length; i++) {
totalValue += _tradeDetails[i].value;
}
require(msg.value >= totalValue * 1005/1000,... | 9,214,759 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "../interfaces/IReserveInterestRateStrategy.sol";
import "../libraries/KyokoMath.sol";
import ".... | Executes a percentage division value The value of which the percentage needs to be calculated percentage The percentage of the value to be calculated return The value divided the percentage/ | function percentDiv(uint256 value, uint256 percentage) internal pure returns (uint256) {
require(percentage != 0, "MATH_DIVISION_BY_ZERO");
uint256 halfPercentage = percentage / 2;
require(
value <= (type(uint256).max - halfPercentage) / PERCENTAGE_FACTOR,
"MATH_MULT... | 5,861,398 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;
import { Bytes } from "./Bytes.sol";
library ScaleCodec {
// Decodes a SCALE encoded uint256 by converting bytes (bid endian) to little endian format
function decodeUint256(bytes memory data) internal pure returns (uint256) {
uint256 number;
... | The biggest compact supported uint is 2 536 - 1. But the biggest value supported by this method is 2 256 - 1(max of uint256) | function encodeUintCompact(uint256 v) internal pure returns (bytes memory) {
if ( v < 64 ) {
return abi.encodePacked(uint8(v << 2));
return abi.encodePacked(reverse16(uint16(((v << 2) + 1))));
return abi.encodePacked(reverse32(uint32(((v << 2) + 2))));
bytes m... | 14,117,322 |
/**
*Submitted for verification at Etherscan.io on 2022-01-01
*/
// SPDX-License-Identifier: MIT
// GO TO LINE 1904 TO SEE WHERE THE ALPHA CONTRACT STARTS
// File: @openzeppelin/contracts/utils/Context.sol
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, includ... | Returns the license for tokens | function tokenLicense(uint _id) public view returns(string memory) {
require(_id < totalSupply(), "CHOOSE A ALPHA WITHIN RANGE");
return LICENSE_TEXT;
}
| 14,609,273 |
./partial_match/3/0xD13e3c3fFEFC7668Cc145286B1527f39e52dCfb9/sources/STARS.sol | We cannot just use balanceOf to create the new tokenId because tokens can be burned (destroyed), so we need a separate counter. | function mint(address to) public virtual {
require(hasRole(MINTER_ROLE, _msgSender()), "ERC721PresetMinterPauserAutoId: must have minter role to mint");
_mint(to, _tokenIdTracker.current());
_tokenIdTracker.increment();
}
| 5,051,371 |
./full_match/137/0x6de6b4c86cE482100606629BDA74C4b31e7293Cc/sources/contracts/IDO.sol | for purpose of dry run, it is commentedrequire(!ready, "should set paras before ready"); initialise parameters switch on | function setParas(address _Tiersys,
uint _tokensForSale,
address _token,
address _U,
uint _price,
uint _startTime,
uint _duration,
uint _clearTime,
uint _round2start,
uint... | 4,747,569 |
pragma solidity ^0.4.25;
contract Token{
using SafeMath for *;
uint256 public totalSupply;
string public name; //name of token
string public symbol; //symbol of token
uint256 public decimals;
mapping (address => uint256) balances;
mapping (address =>... | ico activity is started and must buy one ess at least | function buy() public payable normal{
computeBonus(msg.value);
require(isOffering()&&msg.value>=icoPrice);
uint256 _amount = (msg.value).div(icoPrice).mul(10**decimals);
icoTotal = icoTotal.sub(_amount);
owner.transfer(msg.value);
_mintToken(msg.sender,_amount);
}... | 1,793,874 |
./full_match/1/0xD634626DE5C6237CE3eaa6805B102Bb8CE9a0e9E/sources/contracts/ClayMatic.sol | Calculate & returns `percent` value on given `amount_` uses `PERCENTAGE_BASE` for 2 decimal precision (i.e, 100.00) percent : Percentage with 2 point decimal precision. amount_ : Amount on which `_percent` needs to be calculated./ | function _getPercentValue(uint256 percent, uint256 amount_) internal pure returns (uint256) {
return (amount_ * percent) / PERCENTAGE_BASE;
}
| 9,774,146 |
pragma solidity ^0.4.18;
/**
* @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;
}
uint2... | 取回eth, 参数设为0 则全部取回, 否则取回指定数量的eth | function safeWithdrawal(uint _value ) onlyOwner public {
if (_value == 0)
owner.transfer(address(this).balance);
else
owner.transfer(_value);
}
| 1,326,948 |
./full_match/80001/0xf093EE3b51B4485692E59f736752aB573d8c6126/sources/contracts/IndradexBaseVault.sol | returns the scaled vault total value (sum of all tokens multiplied by their price) with 18 decimals/ | function scaledVaultTotalValue(uint256 amount) public view returns(uint256){
return amount.mul(vaultTotalValue()).div(totalSupply());
}
| 9,508,091 |
./full_match/77/0x9D717b1a345a46A76e3d6fe9D3EEf0E15fCe6ee6/sources/contracts/official/TAR1/TAR1Token.sol | Registers the offer on the token/ this token transfer only supports 1 offer make sure the address isn't empty convert the offer to a interface, and save it to the contract make sure the offer is not intiialized save the date the offer should be considered for dividends initialize the offer | function startOffer(address _aTokenOffer) public onlyOwner {
require(nOfferStartDate == 0, "Offer already set");
require(_aTokenOffer != address(0), "Offer cant be empty");
offer = IOffer(_aTokenOffer);
require(!offer.getInitialized(), "Offer should not be initialized");
nOff... | 5,049,511 |
./full_match/80001/0x8e82483B435D4f8731B9f9Fb3960C053d62A056c/sources/project_/contracts/Whitelist.sol | Removes array of addresses (`_bundleAddresses`) from whitelist Allowed only for ComplianceManager. Function blocked when contract is paused. Emits event {DeWhitelisted} for all addresses of array _bundleAddresses array of addresses to remove from whitelist | function removeAddressFromWhitelist(address[] calldata _bundleAddresses)
external
ifTokenNotPaused
onlyComplianceManager
{
for (uint256 i = 0; i < _bundleAddresses.length; i++) {
address ad = _bundleAddresses[i];
_removeAddressFromWhitelist(ad);
}
... | 5,627,651 |
// File: @openzeppelin/contracts/utils/cryptography/ECDSA.sol
pragma solidity ^0.8.0;
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum... | Changes the creator for the current sender, in the event we need to be able to mint new tokens from an existing digital media print production. When changing creator, the old creator will no longer be able to mint tokens. A creator may need to be changed: 1. If we want to allow a creator to take control over their toke... | function changeCreator(address _creator, address _newCreator) external {
address approvedCreator = changedCreators[_creator];
require(msg.sender != address(0) && _creator != address(0), "Creator must be valid non 0x0 address.");
require(msg.sender == _creator || msg.sender == approvedCreator... | 640,519 |
pragma solidity 0.5.10;
import 'openzeppelin-solidity/contracts/token/ERC20/ERC20.sol';
import 'openzeppelin-solidity/contracts/math/SafeMath.sol';
import {BytesLib} from "@summa-tx/bitcoin-spv-sol/contracts/BytesLib.sol";
import {BTCUtils} from "@summa-tx/bitcoin-spv-sol/contracts/BTCUtils.sol";
import './FundsInte... | Get the Temporary Seizable Collateral of a Loan Represents the amount of seizable collateral that has been locked and only has 1 conf, where 6 confs hasn't been received yet loan The Id of a Loan return Amount of temporary seizable collateral backing the loan (in sats)/ | function temporarySeizableCollateral(bytes32 loan) external view returns (uint256) {
return col.temporarySeizableCollateral(loan);
}
| 7,298,197 |
./full_match/1/0x11111eA590876f5E8416cD4a81A0CFb9DfA2b08E/sources/LibBaseAuth.sol | Returns true if the `account` has the Agent role./ | function isAgent(address account)
public
view
returns (bool)
{
return _agents.has(account);
}
| 2,953,185 |
// SPDX-License-Identifier: UNLICENSED
// (c) Copyright 2021 YieldMagic LLC. All rights reserved.
//
// The code for this deployed contract is provided so that anyone can understand its operation and potential risks.
// Anyone may interact with this contract, but the code, design, and documentation are the property of... | Get the number of pools in the list of pools return length of the list of pools | function totalPools()
external view
returns (uint256)
{
return pools.length;
}
| 12,700,335 |
./full_match/288/0xaBB5c9fC0dA8622B5371B24Dc50503f4525d7216/sources/contracts/yieldBearing/ZenchaVault.sol | delete controller _controller controller of this contract/ | function deleteController(address _controller) public onlyOwner {
require(controllers[_controller]);
controllers[_controller] = false;
}
| 7,104,559 |
./partial_match/1/0x002849bd763c2cd3Cd4875788acfB6aE7D3b7d26/sources/Basket.sol | withdraw ETH in the case a held NFT earned ETH (ie. euler beats) | function withdrawETH() external {
require(_isApprovedOrOwner(msg.sender, 0), "withdraw:not allowed");
payable(msg.sender).transfer(address(this).balance);
emit WithdrawETH(msg.sender);
}
| 9,299,878 |
pragma solidity 0.6.12;
interface IERC20 {
function TOTALSUPPLY831() external view returns (uint256); //i... | inject NONSTANDARD NAMING | function LOG714(uint p0, bool p1, bool p2, address p3) internal view { | 14,087,770 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "./RandomNumberGener... | The function returns an array with the characteristics of all my NFTs. return Array of characters./ | function getMyCharacters() external view returns(Character[] memory) {
uint8 count;
Character[] memory myCharacters = new Character[](_balanceOfCharacters[msg.sender]);
for (uint16 i = 256; i < nextBruteId; i++) {
if (_ownerOf(i)) {
myCharacters[count] = _characte... | 2,558,015 |
./partial_match/56/0x836005b4382D8E952dd582DDf133F7C0f2b974c2/sources/MasterChef.sol | Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as... | function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "MUL::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0... | 11,150,840 |
pragma solidity ^0.4.0;
contract dkgEnc {
/**
* DKG phases:
*
* 0) Create the contract with a threshold (t) and
* number of participants.
*
* 1) Each of the participants sends a deposit and
* a public key address that he owns.
*
* (not on contract) - each participant generates t+1
* r... | Join the DKG (enrollment - phase 1). A point on G1 that represents this participant's pk for encryption have to be published. The publisher have to know the secret that generates this point. TODO: phase timeout, check pk Check the pk isn't registered already Abort if capacity on participants was reached | function join(uint256[2] encPk)
checkDeposit()
inPhase(Phase.Enrollment)
external payable
returns (uint16 index)
{
uint16 cn = curN;
address sender = msg.sender;
for (uint16 i = 1; i <= cn; i++) {
if (participants[i].ethPk == sender) {
revert("already joined");
}
}
... | 913,375 |
./full_match/1/0x72A72BC52b4B0e89613909C709C2CD14C2d1cD1E/sources/contracts/btcregistrar/BaseRegistrarImplementation.sol | Reclaim ownership of a name in HI, if you own it in the registrar./ | function reclaim(uint256 id, address owner) external override live {
require(_isApprovedOrOwner(msg.sender, id));
hi.setSubnodeOwner(baseNode, bytes32(id), owner);
}
| 3,873,338 |
pragma solidity >=0.4.24 <0.6.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initializer functions must be manually
* invoked. This applies both to ... | Sets the initializing flag. newInitializing Boolean value of the initializing flag./ | function _setInitializing(bool newInitializing) internal {
bytes32 slot = INITIALIZING_SLOT;
assembly {
sstore(slot, newInitializing)
}
}
| 15,859,308 |
./full_match/11155111/0x1A1F1D20C404D9C2399a56166256d25fe3e2A93D/sources/contracts/SubscriptionsCollection.sol | Terminates a subscription if its deadline is expired. tier: subscription tier subscriptionOwner: subscription owner/if(_tiersSupplies[tier][0] >= 0) {} | function endSubscription(uint256 tier, address subscriptionOwner) public onlyExistentSubscription(tier, subscriptionOwner){
SubscriptionInfo memory info = _subscriptions[subscriptionOwner][tier];
require(info.deadline < block.timestamp, "SubscriptionsCollection: Subscription n... | 3,804,122 |
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma abicoder v2;
import "@openzeppelin/contracts/GSN/Context.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/t... | Request unlock of the token, removing this senders reward accural by: - Setting balanceOf to return 0 (used for reward calculation) and adjusting total supply by amount unlocking./ | function unlock() external updateReward(msg.sender) {
require(unlocks[msg.sender] == 0, "LockIn/UnlockOnce");
_unlockingSupply = _unlockingSupply.add(balanceOf(msg.sender));
unlocks[msg.sender] = block.timestamp;
emit Unlock(msg.sender);
}
| 12,841,722 |
./full_match/1/0xBe9064ec3331F7Fc9E10DD9074Cc23C411E7EE00/sources/contracts/MothValley.sol | Supports the following `interfaceId`s: - IERC165: 0x01ffc9a7 - IERC721: 0x80ac58cd - IERC721Metadata: 0x5b5e139f - IERC2981: 0x2a55205a | function supportsInterface(
bytes4 interfaceId
) public view virtual override(ERC721A, IERC721A, ERC2981) returns (bool) {
return ERC721A.supportsInterface(interfaceId) || ERC2981.supportsInterface(interfaceId);
}
| 9,702,311 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.