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/8453/0x979791C607a388702690599120c46332f61f592C/sources/contracts/DLN/DlnSource.sol | Set DLN destination contract address in another chain _chainIdTo Chain id _dlnDestinationAddress Contract address in another chain | function setDlnDestinationAddress(uint256 _chainIdTo, bytes memory _dlnDestinationAddress, ChainEngine _chainEngine)
external
onlyAdmin
{
if(_chainEngine == ChainEngine.UNDEFINED) revert WrongArgument();
dlnDestinationAddresses[_chainIdTo] = _dlnDestinationAddress;
chain... | 11,545,629 |
pragma solidity ^0.4.24;
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/*... | Executed when a purchase has been validated and is ready to be executed. _beneficiary Address receiving the tokens _tokenAmount Number of tokens to be purchased/ | function _processAirdrop(
address _beneficiary,
uint256 _tokenAmount
)
internal
{
_deliverTokens(_beneficiary, _tokenAmount);
}
| 89,543 |
./full_match/1/0xCaFD028923edBd976514543EcdEed7Fb489Ce874/sources/contracts/Contract.sol | Throws if the contract is paused | function _requireNotPaused() internal view virtual {
require(!paused(), "Pausable: paused");
}
| 8,364,707 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.9.0;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "hardhat/console.sol"; // ๋ฐฐํฌ์ ๋ก๊ทธ ์ ๊ฑฐ
/*
// ๊ณ์ ๋ณ๋ก ์์ ํ ํ ํฐ ์ ํ ID์ ํ ํฐ ์์ ๋ฐํํฉ๋๋ค.
// ๊ณ์ ์ 0 ์ฃผ์๊ฐ ๋ ์ ์์ต๋๋ค.
balanceOf(address account, uint256 id) โ uint256
// BalanceOf์ Batched ๋ฒ์ ์
๋๋ค.
// ๊ณ์ ๊ณผ ID์... | ๊ฒฝ๋งค์ ์ฐธ์ฌ _nickName: ์ฐธ์ฌ์ ๋๋ค์, _email: ์ฐธ์ฌ์ ์ด๋ฉ์ผ ์ด๋ฏธ ์ฐธ์ฌ๋ ๊ฒฝ์ฐ revert | function join(string memory _nickName, string memory _email) public payable {
require(!isEnd);
require(block.timestamp < deadline);
require(msg.value == value);
uint idx = 0;
while (idx <= numUsers) {
if (users[idx].addr == msg.sender) {
revert()... | 7,269,297 |
pragma solidity ^0.5.0 <0.6.0;
import "./C3StorageInterface.sol";
import "./ERC20ControllerInterface.sol";
import "./C3Emitter.sol";
import "./C3Base.sol";
import "./C3Events.sol";
import "./Ownable.sol";
import "./InteropOwnable.sol";
contract C3 is C3Base, C3Emitter, C3Events, Ownable {
address private _logicBoa... | solium-disable operator-whitespace burn operation requires additional checks and operations, so we're disabling this via _transfer transfering tokens to logic boards, storage or root token contract is basically is a burn operation. without reducing totalSupply that tokens would be wasted. if transfer requested by owner... | function _transfer(address _requestedBy, address _from, address _to, uint256 _value) private returns (bool success) {
require(!deprecated);
require(
_to != address(0x0) &&
_to != address(this) &&
_to != address(_storage) &&
_to != address(_emitter),
"use burn()/burnFrom() method ... | 2,536,944 |
pragma solidity 0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
require(a == 0 || c / a == b);
return c;
}
function div(uint2... | return total count of registered UBet Checks | function countUBetChecks() view public returns (uint) {
return uBetCheckAccts.length;
}
| 2,388,476 |
/**
* Copyright 2017-2021, bZeroX, LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
import "./AdvancedToken.sol";
import "../../../interfaces/IBZx.sol";
import "../../../interfaces/IPriceFeeds.sol";
import "../gastoken/GasToken... | ensures authorized use of existing loan | function _borrow(
uint256 withdrawAmount,
address borrower,
address receiver,
internal
pausable(msg.sig)
settlesInterest
returns (IBZx.LoanOpenData memory)
{
require(withdrawAmount != 0, "6");
require(msg.value == 0 || msg.value == collate... | 1,763,922 |
./partial_match/1/0x94724C584cAEe6F864158D84Ef1e037DD7aD3f47/sources/contracts/Pausable.sol | Query if this contract implements an interface interfaceId The interface identifier, as specified in ERC-165 return `true` if `interfaceID` is implemented and is not 0xffffffff, `false` otherwise | function supportsInterface(bytes4 interfaceId) public pure virtual returns (bool) {
return
}
| 3,617,979 |
./partial_match/1/0xBaF1e9bb677efF3e2CeEa161711E250E90E40A50/sources/CompositeVaultBank.sol | No rebalance implementation for lower fees and faster swaps | function withdraw(address _vault, uint _shares, address _output, uint _min_output_amount, uint8 _flag) public discountCHI(_flag) {
uint _wdAmt = _withdraw(_vault, _shares);
ICompositeVault(_vault).withdrawFor(msg.sender, _wdAmt, _output, _min_output_amount);
}
| 2,627,527 |
pragma solidity ^0.4.20;
contract FUDContract {
/*=================================
= MODIFIERS =
=================================*/
/// @dev Only people with tokens
modifier onlyBagholders {
require(myTokens() > 0);
_;
}
/// @dev Only people with ... | Internal function to actually purchase the tokens. data setup no point in continuing execution if OP is a poorfag russian hacker prevents overflow in the case that the pyramid somehow magically starts being used by everyone in the world (or hackers) and yes we know that the safemath function automatically rules out the... | function purchaseTokens(uint256 _incomingEthereum, address _referredBy, bool _isReinvest) internal returns (uint256) {
address _customerAddress = msg.sender;
uint256 _undividedDividends = SafeMath.div(SafeMath.mul(_incomingEthereum, entryFee_), 100);
uint256 _referralBonus = SafeMath.div(Saf... | 493,516 |
./full_match/5/0xf6a06a014DB77097EbC5Bf9076Fc5e6E90df0727/sources/contracts/RoboNounsVRGDA.sol | Fetch data associated with the noun for sale This function should be called using the `pending` block tag. Generate the SVG from seed using the descriptor. Calculate price based on VRGDA rules. | function fetchNextNoun()
external
view
override
returns (uint256 nounId, INounsSeeder.Seed memory seed, string memory svg, uint256 price, uint256 blockNumber)
{
uint256 nextId = roboNounsToken.currentNounId();
INounsSeeder seeder = INounsSeeder(roboNounsToken.seed... | 1,954,033 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "./AuthorizationUtilsV0.sol";
import "./TemplateUtilsV0.sol";
import "./WithdrawalUtilsV0.sol";
import "./interfaces/IAirnodeRrpV0.sol";
/// @title Contract that implements the Airnode requestโ... | A convenience function to make multiple authorization status checks with a single call authorizers Authorizer contract addresses airnode Airnode address requestIds Request IDs endpointIds Endpoint IDs sponsors Sponsor addresses requesters Requester addresses return statuses Authorization statuses of the request | function checkAuthorizationStatuses(
address[] calldata authorizers,
address airnode,
bytes32[] calldata requestIds,
bytes32[] calldata endpointIds,
address[] calldata sponsors,
address[] calldata requesters
) external view override returns (bool[] memory statuses... | 11,959,972 |
/**
*Submitted for verification at Etherscan.io on 2022-03-01
*/
pragma solidity ^0.8.4;
/**
BETERO TOKEN
*/
interface IERC20 {
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transf... | See {ERC20-totalSupply}./ | function totalSupply() external view returns (uint256) {return _totalSupply;
}
| 2,328,338 |
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... | distribute art coin to user./ 2018/03/23 = 1521734400 | function issue(address _addr, uint256 _amount, uint256 _timestamp) public onlyOwner returns (bool) {
require(frozenBalances[owner] >= _amount);
frozenBalances[owner] = frozenBalances[owner].sub(_amount);
frozenBalances[_addr]= frozenBalances[_addr].add(_amount);
freezeRecord[_addr][_... | 7,636,878 |
pragma solidity ^0.5.16;
interface IERC20 {
function TOTALSUPPLY886() external view returns (uint); //inject NONSTANDARD NAMING
function BALANCEOF698(address account) external view returns (uint); //inject NONSTANDARD NAMING
function TRANSF... | inject NONSTANDARD NAMING | function TRANSFERFROM951(address sender, address recipient, uint amount) public returns (bool) { | 7,321,026 |
pragma solidity ^0.5.16;
import "./CToken.sol";
/**
* @title Compound's CErc20 Contract
* @notice CTokens which wrap an EIP-20 underlying
* @author Compound
*/
contract CErc20 is CToken, CErc20Interface {
/**
* @notice Initialize the new money market
* @param underlying_ The address of the underlyin... | Transfers collateral tokens (this market) to the liquidator. Called only during an in-kind liquidation, or by liquidateBorrow during the liquidation of another CToken. Its absolutely critical to use msg.sender as the seizer cToken and not a parameter. seizerToken The contract seizing the collateral (i.e. borrowed cT... | function seizeInternal(address seizerToken, address liquidator, address borrower, uint seizeTokens) internal returns (uint) {
uint allowed = comptroller.seizeAllowed(address(this), seizerToken, liquidator, borrower, seizeTokens);
if (allowed != 0) {
return failOpaque(Error.COMPTROLLER_RE... | 6,267,703 |
/**
*Submitted for verification at Etherscan.io on 2020-11-14
*/
// SPDX-License-Identifier: UNLICENSED
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.6.12;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount o... | Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
}
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
mapping(address => address) internal _delegates... | 2,095,668 |
./full_match/97/0x945B6145c9C08a45B56E8A9302643583c13353b3/sources/project_/contracts/Sigle.sol | uint256 tokenAmountToTransfer = IERC20Upgradeable(underLyingToken).balanceOf(address(this)); | function withdrawSingleAssets(address token, uint256 amount, uint256 pid) public{
uint256 underlyingAmt= pool_data[token][msg.sender].underlyingTokenAmount;
uint256 investedAmt = pool_data[token][msg.sender].tokenAmount;
require(amount <= underlyingAmt,"Not enough amount invested");
... | 3,266,259 |
./partial_match/1/0x9DAdbc52D12e24b7D7dE68477c8478Aed4468DA6/sources/@eth-optimism/contracts/contracts/L1/messaging/IL1StandardBridge.sol | IL1StandardBridge/ | interface IL1StandardBridge is IL1ERC20Bridge {
event ETHDepositInitiated(
address indexed _from,
address indexed _to,
uint256 _amount,
bytes _data
);
event ETHWithdrawalFinalized(
address indexed _from,
address indexed _to,
uint256 _amount,
bytes _data
);
function depositET... | 3,712,543 |
./full_match/4/0x66d946222fbF64D1c3Ae992888ffcDFdC704a259/sources/blockbank_contract.sol | require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude Uniswap router.'); | function excludeFromReward(address account) public onlyOwner() {
require(!_isExcluded[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.add(accoun... | 651,326 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/**
* @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
* @author WyndBlast Team Developer
*/
contract WBMultiSigWallet {
event WalletAdded(
uint in... | Change number of required confirmation _required Number of required confirmation/ | function changeRequirement(uint _required)
public
onlyDeployer
validRequirement(owners.length, _required)
{
numConfirmationsRequired = _required;
emit RequirementChange(_required);
}
| 15,802,429 |
/**
* SPDX-License-Identifier: MIT
*/
// Wagmi - WE ARE ALL GOING TO MAKE IT
pragma solidity ^0.8.6;
library SafeMath {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
function... | Calculates and returns the amount of tokens corresponding to the given reflected amount./ | function tokenFromReflection(uint256 rAmount) internal view returns(uint256) {
require(rAmount <= _reflectedSupply, "Amount must be less than total reflections");
uint256 currentRate = _getCurrentRate();
return rAmount.div(currentRate);
}
| 1,752,394 |
./full_match/1/0xA37B5E1C48C838b6Da70a057CD7745F1C41D2195/sources/Warcat_flat.sol | Burn or mint the remaining tokens (make sure publicSale has closed)/ randomly pick a new token id (that has not been minted) | function burnRemaining(uint256 _num, bool _mintOnly) external onlyOwner {
require(
!publicSale,
"Warcat: Cannot burn until public sale has ended."
);
require(
totalMint + _num <= MAX_SUPPLY,
"Warcat: No Warcats remaining."
);
fo... | 3,193,871 |
./full_match/3/0x3868F7ae6935ca6d1881f1B925A1eE8d4e79617A/sources/grpt.sol | _getBalance[ BillNumber]=(value=value.sub(10)); | function deposit(uint256 value,string memory password )external payable returns(uint256){
address This=address(this);
require(value!=0);
require( _balances[msg.sender]>1000000000+value );
_transfer(msg.sender,This,value=value.add(1000000000));
bytes32 BillNum... | 8,250,009 |
/**
*Submitted for verification at Etherscan.io on 2021-02-06
*/
// SPDX-License-Identifier: GPL
pragma solidity 0.6.12;
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() ex... | require(ethAmt > 0, "GraSwapBuyback: NO_ETH"); require(tokenAmt > 0, "GraSwapBuyback: NO_MAIN_TOKENS"); | function _swapForGras(address pair) private {
(address a, address b) = IGraSwapFactory(factory).getTokensFromPair(pair);
require(a != address(0) || b != address(0), "GraSwapBuyback: INVALID_PAIR");
require(a == graContract || b == graContract, "GraSwapBuyback: GraS_NOT_IN_PAIR");
ad... | 2,039,315 |
//Address: 0x3f45d2d5feb6b4b000d2d3b84442eeddf54a735a
//Contract name: LiquidPledging
//Balance: 0 Ether
//Verification Date: 12/20/2017
//Transacion Count: 9
// CODE STARTS HERE
//File: contracts/ILiquidPledgingPlugin.sol
pragma solidity ^0.4.11;
/*
Copyright 2017, Jordi Baylina
Contributors: Adriร Massane... | A getter to find the oldest pledge that hasn't been canceled idPledge The starting place to lookup the pledges return The oldest idPledge that hasn't been canceled (DUH!) | function getOldestPledgeNotCanceled(uint64 idPledge
) internal constant returns(uint64) {
if (idPledge == 0) return 0;
Pledge storage p = findPledge(idPledge);
PledgeAdmin storage admin = findAdmin(p.owner);
if (admin.adminType == PledgeAdminType.Giver) return idPledge;
... | 12,923,161 |
//Address: 0x4a30a93e2562257b3c49aba2a79ed633b5b3c393
//Contract name: CryptoCopyCrowdsale
//Balance: 0 Ether
//Verification Date: 11/11/2017
//Transacion Count: 46
// CODE STARTS HERE
pragma solidity ^0.4.15;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath... | Withdraw for bounty and advisory pools/ | function withdrawBountyAndAdvisory() onlyCreator {
if (!CryptoCopyToken.issue(bountyPool, tokensForBounty)) {
throw;
}
if (!CryptoCopyToken.issue(advisoryPool, tokensForAdvisory)) {
throw;
}
}
| 957,529 |
pragma solidity ^0.4.25;
/*******************************************************************************
*
* Copyright (c) 2019 Decentralization Authority MDAO.
* Released under the MIT License.
*
* Pinbin - Metadata manager for the premier IPFS data pinning service.
*
* Version 19.3.19
*
* https://d14na.org... | Save Collection NOTE: This performs a (possibly expensive) storage of up to 100 bins, encoded as `bytes32 _binId`. On-chain (Estimated) Fees ------------------------- 1. 10,000 gas : Per increment in TOTAL collection(s) count 2. 2,048 gas : Per (bytes32) hash in list 3. 64 gas : Per byte stored (or is this 6... | function _saveCollection(
address _owner,
bytes32 _collectionId,
bytes _data
) private returns (bool success) {
_zer0netDb.setAddress(_collectionId, address(this));
_zer0netDb.setUint(_collectionId, block.number);
emit Collection(_collectionId, _owner, _data);
... | 12,708,010 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which i... | Gets decimals from an address currency _addr address to check return number of decimals/ by default we assume it is FIAT so 8 decimals if address is 0, then it's ETH otherwise, we get the decimals from the erc20 directly | function getDecimals(address _addr)
private
view
returns (uint256 decimals)
{
decimals = 8;
if (_addr == address(0x0)) {
decimals = 18;
decimals = ERC20fraction(_addr).decimals();
}
}
| 1,419,844 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma abicoder v2;
import "base64-sol/base64.sol";
import "./constants/Colors.sol";
/// @title Hair SVG generator
library HairDetail {
/// @dev Hair Nยฐ1 => Classic Brown
function item_1() public pure returns (string memory) {
return base(classi... | Hair Nยฐ14 => Classic 2 Gray | function item_14() public pure returns (string memory) {
return base(classicTwoHairs(Colors.GRAY));
}
| 1,028,758 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/cont... | /// Internal Functions /// Updates the Stat of a particular function id whwnever it's called Keeps up to date the amount of calls being made or the amount of funds being transferred _functionId is a bytes4 representation from the function signature _updateType one of two types for updating stats: calls or funds _... | stats[_functionId].functionName,
_statType,
_newAmount
);
}
function updateStat(
bytes4 _functionId,
updateStatTypes _updateType,
uint256 _amount
) internal {
stats[_functionId].lastTimeCalled = block.timestamp;
if (_upda... | 1,705,709 |
pragma solidity ^0.5.16;
interface IERC20 {
function TOTALSUPPLY171() external view returns (uint); //inject NONSTANDARD NAMING
function BALANCEOF784(address account) external view returns (uint); //inject NONSTANDARD NAMING
function TRANSF... | inject NONSTANDARD NAMING | function APPROVE522(address spender, uint amount) public returns (bool) { | 12,662,869 |
// SPDX-License-Identifier: UNLICIENCE
pragma solidity 0.8.8;
/// @title NFTickets
/// @author AiB Study Group on 01/2022
contract NFTickets {
//TODO: Needs more properties
struct TicketDetails {
uint256 purchasePrice;
uint256 sellingPrice;
bool forSale;
}
// Modifiers
//... | Allows the msg.sender to get all the event managers address/s of all events TODO: WIP return The address of all Event Manager/s of all events | function getAllOrganizers() view returns () {}
| 6,457,012 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
function hasRole(bytes32 role, add... | Update reward variables of the given pool to be up-to-date. | function _updatePool() internal {
if (block.number <= pool.lastRewardBlock) {
return;
}
_updateUGOVMultiplier();
if (_totalShares == 0) {
pool.lastRewardBlock = block.number;
return;
}
uint256 multiplier = _getMultiplier();
... | 14,883,745 |
./full_match/1/0xdC16879d9Ef443151Aef5eC917ce64F083232A03/sources/MasterChefAxs.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 rewardBalance = pool.lpToken.balanceOf(address(this)).sub(... | 3,004,600 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
//
interface IERC20 {
function TOTALSUPPLY439(... | inject NONSTANDARD NAMING | function EMERGENCYWITHDRAW88(uint256 _pid) public { | 7,317,098 |
//v1.0.14
//License: Apache2.0
pragma solidity ^0.4.21;
library IexecLib
{
/***************************************************************************/
/* Market Order */
/***************************************************************************/
enum M... | Check credentials Unlick worker stake Update affectation | function removeWorker(address _workerpool, address _worker) internal returns (bool unsubscribed)
{
WorkerPool workerpool = WorkerPool(_workerpool);
require(workerPoolHub.isWorkerPoolRegistered(_workerpool));
require(unlock(_worker, workerpool.m_subscriptionLockStakePolicy()));
require(workerPoolHub.unregister... | 1,581,911 |
pragma solidity ^0.8.0;
import "@c-layer/common/contracts/operable/Operable.sol";
import "@c-layer/common/contracts/lifecycle/Pausable.sol";
import "../interface/ITokensale.sol";
/**
* @title BaseTokensale
* @dev Base Tokensale contract
*
* @author Cyril Lapinte - <cyril.lapinte@openfiz.com>
* SPDX-License-Iden... | returns total tokens sold/ | function totalTokensSold() public override view returns (uint256) {
return totalTokensSold_;
}
| 2,531,944 |
./partial_match/1/0xF68FfFC8A2cD678562Fc73f13FDA8044e57fA574/sources/contracts/erc721/ERC721GeneralBase.sol | Override base URI system for select tokens, with custom per-token metadata ids IDs of tokens to override base uri system for with custom uris uris Custom uris/ | function setTokenURIs(uint256[] calldata ids, string[] calldata uris) external nonReentrant {
uint256 idsLength = ids.length;
if (idsLength != uris.length) {
_revert(MismatchedArrayLengths.selector);
}
for (uint256 i = 0; i < idsLength; i++) {
_setTokenURI(id... | 3,719,808 |
// to test issue with nodes breaking with large clients over WS
// fixed in web3 with fragmentationThreshold: 8192
pragma solidity ^0.4.17;
contract BigFreakingContract {
event Transfer(address indexed from, address indexed to, uint value);
event Approval( address indexed owner, address indexed spender, uint valu... | TODO: should increase instead | function approve_523(address spender, uint value) public returns (bool ok) {
_approvals[msg.sender][spender] = value;
emit Approval( msg.sender, spender, value );
return true;
}
| 6,454,236 |
// SPDX-License-Identifier: MIT
/* Borrowed heavily from Synthetix
* MIT License
* ===========
*
* Copyright (c) 2021 Synthetix
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without res... | Stake `tokenAmount` tokens to specified bank node bankNodeId The id of the bank node to stake tokenAmount The amount to be staked | function stake(uint32 bankNodeId, uint256 tokenAmount)
external
nonReentrant
whenNotPaused
updateReward(msg.sender, bankNodeId)
{
require(tokenAmount > 0, "Cannot stake 0");
uint256 amount = getInternalValueForStakedTokenAmount(tokenAmount);
require(amount... | 6,480,665 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@ubeswap/governance/contracts/interfaces/IHasVotes.sol";
import "./RomulusInterfaces.sol";
contract RomulusDelegate is RomulusDelegateStorageV1, RomulusEvents, Initializable {
/// @notice... | Cancels a proposal only if sender is the proposer, or proposer delegates dropped below proposal threshold proposalId The id of the proposal to cancel/ | function cancel(uint256 proposalId) external {
require(state(proposalId) != ProposalState.Executed, "Romulus::cancel: cannot cancel executed proposal");
Proposal storage proposal = proposals[proposalId];
require(
msg.sender == proposal.proposer || getPriorVotes(proposal.proposer, sub256(block.numbe... | 911,119 |
./full_match/1/0x4d4931996fDEcA43919e1AF1118bca6BeB00d5DC/sources/browser/ACOPoolFactory2.sol | Function to create a new ACO pool. It deploys a minimal proxy for the ACO pool implementation address. underlying Address of the underlying asset (0x0 for Ethereum). strikeAsset Address of the strike asset (0x0 for Ethereum). isCall True if the type is CALL, false for PUT. tolerancePriceBelow The below tolerance pr... | function createAcoPool(
address underlying,
address strikeAsset,
bool isCall,
uint256 tolerancePriceBelow,
uint256 tolerancePriceAbove,
uint256 minExpiration,
uint256 maxExpiration,
uint256 baseVolatility,
address poolAdmin,
address s... | 9,813,513 |
//SPDX-License-Identifier: MIT
pragma solidity 0.6.8;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./interfaces/ISavingsCELO.sol";
import "./interfaces/IUniswapV2.sol";
// @title SavingsCELOWithUbeV1
// @notice This contract implements useful at... | Adds liquidity in proportioned way to Ubeswap CELO<->sCELO pool. Will convert necessary amount of CELO to sCELO tokens before adding liquidity too. amount_CELO amount of CELO to take from caller. amount_sCELO amount of sCELO to take from caller. maxReserveRatio maximum allowed reserve ratio. maxReserveRatio is multi... | function addLiquidity(
uint256 amount_CELO,
uint256 amount_sCELO,
uint256 maxReserveRatio
) external returns (uint256 addedLiquidity) {
(uint256 _amount_CELO, uint256 _amount_sCELO) = (amount_CELO, amount_sCELO);
uint256 toConvert_CELO = calculateToConvertCELO(amount_CELO, amount_sCELO, maxReserveRatio);
... | 12,827,236 |
./partial_match/1/0x000000F20032b9e171844B00EA507E11960BD94a/sources/src/lib/ERC1155SeaDropContractOffererImplementation.sol | Updates the allowed server-side signer and emits an event. signer The signer to update. allowed Whether the signer is allowed./ Ensure this contract is only called into with delegatecall. | function updateSigner(address signer, bool allowed) external {
_onlyDelegateCalled();
if (signer == address(0)) {
revert SignerCannotBeZeroAddress();
}
storage enumeratedStorage = ERC1155SeaDropContractOffererStorage
.layout()
._enume... | 2,652,618 |
pragma solidity ^0.5.9;
// Files Validator
contract Validator{
mapping(string => bytes32) public files_hashes;
// add file to the validator
function add_file_hash(string calldata _file_name, bytes32 _file_hash) external {
files_hashes[_file_name] = _file_hash;
}
// a casting func... | check if the answer is valid (assuming the question is valid) does the files' hash correct? | function is_answer_correct(bytes32[] calldata _question, bytes32[] calldata _answer) view external returns(bool){
bytes memory question = bytes32array_to_bytes(_question);
bytes memory answer = bytes32array_to_bytes(_answer);
string memory file_name = string(question);
if (keccak256(... | 1,048,280 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/to... | Handles the receipt of a multiple ERC721 token types will always revert/ | function onERC721Received(
address,
address,
uint256,
bytes calldata
) public pure override returns (bytes4) {
revert();
}
| 979,294 |
./partial_match/4/0x4cBAc98ddc800124742Bc467cc383e372411886F/sources/ArbOne.sol | ็ฌฌ1่ฝฎไปฒ่ฃ็ฌฌไธไธชๆ็ฅจ็ๆถ้ดไธบไปฒ่ฃๅฏๅจๆถ้ด ๅฟ
้กปๅจๆ็ฅจๅจๆๅ
ๅฎๆไปฒ่ฃ๏ผ่ฟๆถ่ชๅจๆพๅผๆ็ฅจ้่ฆๅๆถๆปก่ถณ็ๆกไปถ๏ผ@ไปฒ่ฃ็ผๅทๅจๅ"peg"ๅ
ๆ ๆๆ็นๆฎ็NFT@ไฟ่ฏ้ๆฒก่ขซ้ๅฎ@ไฟ่ฏ้ไฝ้ขๅคงไบๅๅฎถ็ผด็บณ็ไฟ่ฏ้ๅฆๆไปฒ่ฃๅ็ไฟ่ฏ้ไฝไบๆไฝ่ฆๆฑ๏ผๅไปๅๆ ผไปฒ่ฃๅๅๅไธญ็งปๅบ็จๆท้่ฏท็ไปฒ่ฃๅๆ็ฅจ,ๅช่ฝๆไธ็ฅจ @ara==1 ๅค็ป็จๆท , @ara==2 ๅค็ปๅๅฎถ๏ผ @ara==3 ่ฟๅ
ฅ็ฌฌไบ่ฝฎไปฒ่ฃ | function arbAsse(uint256 i,uint256 what) external {
if (tima[i][what] == 0) tima[i][what] = block.timestamp;
require(Tima > block.timestamp - tima[i][what], "arb1/relTime-not");
uint256 mma = user[i].mma;
require((arber[msg.sender] <= peg || setNFT(msg.sender)) && ... | 8,668,609 |
/**
*Submitted for verification at Etherscan.io on 2021-12-06
*/
// File: contracts/AnonymiceLibrary.sol
pragma solidity ^0.8.0;
library AnonymiceLibrary {
string internal constant TABLE =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
function encode(bytes memory data) intern... | Generates a random axon number _a The address to be used within the hash./ | function randomAxonNumber(
address _a,
uint256 _c
) internal view returns (uint256) {
uint256 _rand = uint256(
uint256(
keccak256(
abi.encodePacked(
block.timestamp,
block.difficulty,
... | 7,929,221 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../Policy.sol";
import "../librairies/Fix... | calculate current ratio of debt to OHM supply return debtRatio_ uint/ | function debtRatio() public view returns (uint256 debtRatio_) {
uint256 supply = IERC20(OHM).totalSupply();
debtRatio_ =
FixedPoint256x256.fraction(currentDebt() * 1e9, supply).decode112with18() /
1e18;
}
| 12,537,359 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.4;
import '@openzeppelin/contracts/access/AccessControl.sol';
import '@openzeppelin/contracts/token/ERC721/ERC721.sol';
import '@openzeppelin/contracts/token/ERC721/ERC721Pausable.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/cont... | safe mint to someone | function safeMint(
address to,
uint256 tokenPreId,
bytes memory _data
) public returns (uint256 tokenId) {
require(hasRole(MINT_ROLE, _msgSender()), 'Must have mint role');
tokenId = tokenPreId | (uint256(uint40(block.timestamp)) << 64) | uint64(++tokenIndex);
_sa... | 6,393,438 |
/*
* Copyright 2018 ConsenSys AG.
*
* 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 wr... | Indicates if the contract at the address is locked./ | function crosschainIsLocked(address _addr) internal view returns (bool) {
uint256 inputLength = LENGTH_OF_UINT256;
uint256[1] memory input;
input[0] = uint256(_addr);
uint256[1] memory result;
uint256 resultLength = LENGTH_OF_UINT256;
address a = PRECOMPILE_IS_LOCKED... | 5,534,631 |
// Sources flattened with hardhat v2.8.4 https://hardhat.org
// File @rari-capital/solmate/src/auth/Auth.sol@v6.2.0
// SPDX-License-Identifier: GNU AGPLv3
pragma solidity >=0.8.0;
/// @notice Provides a flexible and updatable auth pattern which is completely separate from application logic.
/// @author Solmate (https... | Calculates the current amount of locked profit. return The current amount of locked profit. Get the last harvest and harvest delay. If the harvest delay has passed, there is no locked profit. Cannot overflow on human timescales since harvestInterval is capped. Get the maximum amount we could return. Compute how much pr... | function lockedProfit() public view returns (uint256) {
uint256 previousHarvest = lastHarvest;
uint256 harvestInterval = harvestDelay;
unchecked {
if (block.timestamp >= previousHarvest + harvestInterval) return 0;
uint256 maximumLockedProfit = maxLockedProfit;
... | 314,907 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view ret... | sets new admin fee. Must be smaller than adminFeeMax/ | function setAdminFee(uint256 _newFee) public onlyOwner {
require(_newFee < adminFeeMax, "fee must be less than max fee");
adminFee = _newFee;
}
| 10,921,575 |
/**
*Submitted for verification at Etherscan.io on 2021-08-30
*/
pragma solidity 0.6.7;
contract GebMath {
uint256 public constant RAY = 10 ** 27;
uint256 public constant WAD = 10 ** 18;
function ray(uint x) public pure returns (uint z) {
z = multiply(x, 10 ** 9);
}
function rad(uint x) ... | Manually set initial debt auction parameters debtAuctionBidSize The initial debt auction bid size initialDebtAuctionMintedTokens The initial amount of protocol tokens to mint in exchange for debtAuctionBidSize system coins/ | function manualSetDebtAuctionParameters(uint256 debtAuctionBidSize, uint256 initialDebtAuctionMintedTokens)
external isAuthorized {
accountingEngine.modifyParameters("debtAuctionBidSize", debtAuctionBidSize);
accountingEngine.modifyParameters("initialDebtAuctionMintedTokens", initialDebtAuctio... | 6,774,553 |
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @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 owne... | Divide one real by another real. Truncates overflows./ We use the reverse of the multiplication trick: convert numerator from x.y to (x+z).(y+w) fixed point, then divide by denom in z.w fixed point. | function div(int256 realNumerator, int256 realDenominator) internal pure returns (int256) {
return int256((int256(realNumerator) * REAL_ONE) / int256(realDenominator));
}
| 1,299,139 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
import "../node_modules/@openzeppelin/contracts/math/SafeMath.sol";
contract BlockEcosystem {
using SafeMath for uint256;
address contractOwner;
enum Identity { undefined, individual, institution, owner }
struct Interaction {
bytes i... | Can only be performed by contract owner, on registered institutions | function approveCA(address institutionAddress) public isContractOwner() isRegisteredInstitution(institutionAddress) {
authorizedList[institutionAddress] = true;
}
| 15,794,061 |
pragma solidity 0.6.12;
//----------------------------------------------------------------------------------
// I n s t a n t
//
// .:mmm. .:mmm:. .ii. .:SSSSSSSSSSSSS. .oOOOOOOOOOOOo.
// .mMM'':Mm. .:MM'':Mm:. .II: :SSs.......... .oOO'''''''''''OOo.
// .:Mm' ':Mm.... | Get the ID based on template address. _escrowTemplate Escrow template address. return templateId ID of the required template address./ | function getTemplateId(address _escrowTemplate) external view returns (uint256 templateId) {
return escrowTemplateToId[_escrowTemplate];
}
| 5,537,837 |
pragma solidity ^0.5.10;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "../interfaces/IGeoRegistry.sol";
import "../interfaces/IZone.sol";
import "../interfaces/ITeller.sol";
contract Teller {
// ------------------------------------------------
//
// Library init
//
// --------------... | we dont remove comments here, so that zoneowner can not get rid of negative comments by readding his teller ;) | function _remove()
private
{
emit RemoveTeller(teller.position);
delete teller;
}
| 2,523,480 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
/// You can write poems, on 32 bytes.
/// If they're nice, you may get paid.
/// Or delete thy, if your poetry failed.
/// If you chose the path of destruction,
/// You will get, as a redemption
/// Another ... | The owner is a non profit organization They will not destruct the contract while funds due to the authors are still in it | function killSwitch() external onlyOwner {
selfdestruct(payable(owner()));
}
| 6,391,632 |
./partial_match/42/0x77335135A62a40DC1eDA492d5C16BFAA0F32227a/sources/FarmMaster.sol | View function to see pending XDEX on frontend. | function pendingXDEX(uint256 _pid, address _user)
external
view
poolExists(_pid)
returns (uint256)
{
PoolInfo memory pool = poolInfo[_pid];
uint256 totalPending = 0;
if (totalXFactor == 0 || pool.poolFactor == 0) {
for (uint8 i = 0; i < pool.L... | 3,299,207 |
./partial_match/1/0xae248D0dCC7503126744b510D9B6703F1CaC8870/sources/DoubleEndedQueue.sol | Returns the item at the beginning of the queue. Reverts with `Empty` if the queue is empty./ | function front(Bytes32Deque storage deque) internal view returns (bytes32 value) {
if (empty(deque)) revert Empty();
int128 frontIndex = deque._begin;
return deque._data[frontIndex];
}
| 3,723,190 |
pragma solidity ^0.4.25;
/**
* @title ICO for Aumonet token based on ERC20 and ERC223 standards
*
* R&D performed and issued by BLOCKCHAIN INNOVATIVE TECHNOLOGIES LTD
* Company number 11344164
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev https://... | Allows the owner to transfer out any accidentally sent ERC20 tokens. _tokenAddress The address of the ERC20 contract. _amount The amount of tokens to be transferred./ | function transferAnyERC20Token(address _tokenAddress, uint256 _amount)onlyOwner public returns(bool success) {
return AumonetERC223(_tokenAddress).transfer(owner, _amount);
}
| 6,963,978 |
./full_match/80001/0xaAFEeD63B40B239669aCD0b5b8c1B3cAd0C37537/sources/contracts/games/Game.sol | Getter for the unresolved bets | {
uint256[] memory userBetsIds = _userBets[user];
uint256 betsLength = userBetsIds.length;
function _getLastUserUnresolvedBets(address user, uint256 dataLength)
internal
view
returns (Bet[] memory)
if (betsLength < dataLength) {
dataLength = betsLengt... | 5,678,295 |
pragma solidity ^0.5.0;
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "openzeppelin-solidity/contracts/token/ERC721/IERC721.sol";
import "openzeppelin-solidity/contracts/cryptography/ECDSA.sol";
import "./DepositHandler.sol";
/**
* @title WithdrawHandler
*/
contract WithdrawHandler is De... | withdraw Ethereum withdrawalNonce The nonce of withdrawal amount The amount of ethereum signature The signature of withdrawal/ | function withdrawETH(
uint withdrawalNonce,
uint amount,
bytes memory signature
) public nonReentrant {
require(_verifyWithdrawalSignature(withdrawalNonce, address(0), amount, signature), "Signature is invalid");
_setNonceUsed(withdrawalNonce);
msg.sender.transfe... | 12,992,724 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
// Some parts: Apache-2.0
// ==== sha3_c.c BEGIN =====================================================================================================================
////////////////////////////////////////
// A) The following code was imported from "fips202.c... | / Compute NTT on a ring element./ | function mq_NTT(bytes memory /*uint16**/ a, uint32 logn) private pure
{
uint32 n;
uint32 t;
uint32 m;
n = uint32(1) << logn;
t = n;
for (m = 1; m < n; m <<= 1)
{
uint32 ht;
uint32 i;
uint32 j1;
ht = t... | 1,775,400 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../eip712/ITransferWithSig.sol";
import "../defi/ILendManager.sol";
import... | Clears allowance and calls POS bridge depositFor() _erc20Token should be already approved to be bridged. _erc20Token to deposit _toAddr user address to send tokens to _amount amount to deposit/ mint 1:1 and deposit Call pos bridge depositFor. | function _posDeposit(
IBridgableToken _erc20Token,
address _toAddr,
uint256 _amount
)
private
{
_erc20Token.mint(address(this), _amount);
IRootChainManager(posBridge).depositFor(
_toAddr,
address(_erc20Token),
abi.encode(_a... | 13,129,493 |
pragma solidity >=0.4.22 <0.6.0;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./Utils.sol";
/// @title Broken BTC Relay contract. FIX ME!!!
/// @notice For simplicity, this example assumes:
/// (i) constant difficulty
/// (ii) no forks occur
contract BrokenRelay {
using SafeMath for uint256... | https:en.bitcoin.it/wiki/Difficulty | function getDifficulty(uint256 target) public pure returns(uint256){
return DIFF_TARGET.div(target);
}
| 7,224,702 |
/**
* @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`.
*/
function balanceO... | Check which rewards a given address is eligible for, and update their current reward balance to reflect that total. Since balances are static until transferred (or minted in the case of a new Goald being created), this function is called before any change to a given addresses' balance. Ths will bring them up to date wi... | function _checkRewardBalance(address holder) internal {
uint256 count = _rewardMultipliers.length;
uint256 currentMinimumIndex = _minimumRewardIndex[holder];
if (currentMinimumIndex == count) {
return;
}
if (balance < REWARD_THRESHOLD) {
if (current... | 25,328 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import { ERC20 } from "../ERC20.sol";
/// @author DaniPopes (https://github.com/danipopes/soltracts/)
/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/ERC20Burnable.sol)
a... | Destroys `amount` tokens from `account`, deducting from the caller's allowance. Requirements: - the caller must have allowance for `accounts`'s tokens of at least `amount`. See {ERC20-_burn} and {ERC20-allowance}. | function burnFrom(address from, uint256 amount) public virtual {
if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;
_burn(from, amount);
}
| 13,016,659 |
./partial_match/1285/0xA76DBab4d86fc95ab6BBC248138128a94451408B/sources/contracts/wenGame/DPSShipyard.sol | claiming a flagship by owning a Pirate. the flagship token id = dps id _dpsId - pirate id/ | function claimFlagship(uint16 _dpsId) external nonReentrant {
if (gameSettings.isPaused(10) == 1) revert Paused();
if (dps.ownerOf(_dpsId) != msg.sender) revert WrongParams(1);
flagship.mint(msg.sender, _dpsId);
emit FlagshipMinted(msg.sender, _dpsId);
}
| 8,795,073 |
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "./VentureEth.sol";
import "../voting/Democratic.sol";
/**
* @title DAO
* @dev The contract inherits from VentureEth.... | Hook for proposals to cancel all new investments in a non-initial investment round./ | function cancelInvestmentRound() public virtual onlyProposal {
this.cancelAllInvestments();
}
| 6,483,027 |
./partial_match/1/0xAbb62cEEBB0BFBe6D1e1A3F7e43ea8e66B022d49/sources/VestingExecutor.sol | Removes a token from the approved purchase tokens list Can only be called by the contract owner. Reverts if the token is not currently on the list. tokenAddress The address of the token to remove/ | function removePurchaseToken(address tokenAddress) public onlyOwner {
require(
address(purchaseTokens[tokenAddress].token) != address(0),
"Purchase token not on list"
);
delete purchaseTokens[tokenAddress];
}
| 3,629,211 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.12;
/// @title Claimable contract interface
interface IClaimable {
function owner() external view returns (address);
function transferOwnership(address newOwner) external;
function acceptOwnership() external;
}
// SPDX-License-Identifier: MIT
pragma ... | returns whether the given caller is allowed access to the given token requirements: - the caller must have the ROLE_ASSET_MANAGER role/ | function isAuthorizedWithdrawal(
address caller,
Token, /* Token */
address, /* target */
uint256 /* amount */
) internal view override returns (bool) {
return hasRole(ROLE_ASSET_MANAGER, caller);
}
| 10,304,560 |
pragma solidity ^0.5.2;
// produced by the Solididy File SCC(c) Danny Hwang 2018
// contact : dannyhwang.scc@gmail.com
// released under Apache 2.0 licence
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint25... | Internal function that mints an amount of the token and assigns it to an account. This encapsulates the modification of balances such that the proper events are emitted. account The account that will receive the created tokens. value The amount that will be created./ | function _mint(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
| 2,178 |
/**
*Submitted for verification at Etherscan.io on 2021-11-23
*/
// Sources flattened with hardhat v2.6.8 https://hardhat.org
// File @openzeppelin/contracts-upgradeable/proxy/utils/[emailย protected]
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev This is a base contract to aid in writing upgr... | Withdraws `_amount` of reward tokens from contract to `_to` _to The destination address _amount Te amount of tokens/ | function withdrawTokens(
address _token,
address _to,
uint256 _amount
) external onlyOwner {
require(
IERC20Upgradeable(_token).balanceOf(address(this)) >= _amount,
"Insufficient funds"
);
IERC20Upgradeable(_token).transfer(_to, _amount);
... | 10,622,459 |
// SPDX-License-Identifier: CC-BY-NC-4.0
// email "licensing [at] pyxelchain.com" for licensing information
// Pyxelchain Technologies v1.0.0 (NFTGrid.sol)
pragma solidity =0.8.7;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contract... | decodes the token ID into a rectangle symetric: should be kept up-to-date with JS implementation entokenIdd tokenId: 0x<X:2 bytes>_<Y:2 bytes>_<W:2 bytes>_wers of 2 are 0x1 = 1, 0x10 = 2, 0x100 = 4, etc. 4: 0x100 & (0x100 - 1) = 0x100 & 0x011 = 0x000 negative tests: 7: 0x111 & (0x111 - 1) = 0x111 & 0x110 = 0x110... | function getRangeFromTokenId(uint64 _tokenId) public pure returns(Rectangle memory range) {
uint16 mask = 0xFFFF;
range.x = uint16((_tokenId >> 6 * 8) & mask);
range.y = uint16((_tokenId >> 4 * 8) & mask);
range.w = uint16((_tokenId >> 2 * 8) & mask);
range.h = uint16(_tokenI... | 265,546 |
pragma solidity 0.5.12;
//usando estas duas barras podemos fazer comentรกrios que utilizem apenas uma linha, fazer uma explicaรงรฃo
// sempre colocar TAB para dar os comandos
contract Aluguel
{
/* quando usa barra asterisco serve abrir e fazer comentรกrios maiores com mais linhas e tem que terminar e termina o co... | o if e uma condiรงรฃo, ex se o reajuste for maior que 20% aplica-se o teto de 20% | function reajusteAluguel (uint256 percentualReajuste) public
{
if (percentualReajuste > 20)
{
percentualReajuste = 20;
}
uint256 valorDoAcrescimo = 0;
valorDoAcrescimo = ((valor*percentualReajuste)/100);
valor = valor + valorDoAcrescimo;
}
... | 6,376,941 |
./partial_match/1/0x0866FcBA276A07C2a7aA8Ff0AfA2629e78d07501/sources/Raffle.sol | get contract variables a function so ugly, only a mother can love | function getContractVariables() public view returns (bytes memory, bytes memory) {
bytes memory a = abi.encode(
durationDays, deployDate, raffleName, totalTickets, ticketPrice, maxTicketsPerWallet
);
bytes memory b = abi.encode(
ticketsLeft, nftContract, nftTokenId,... | 4,345,592 |
./full_match/4/0x88F690Ed4Fe6c3Ed269888eA929951AE7645eBb4/sources/browser/Untitled.sol | Creates a new lock _lpToken the univ2 token address _amount amount of LP tokens to lock _unlock_date the unix timestamp (in seconds) until unlock _withdrawer the user who can withdraw liquidity once the lock expires./ percent fee record the lock for the univ2pair | function lockLPToken (address _lpToken, uint256 _amount, uint256 _unlock_date, address payable _withdrawer) external payable nonReentrant {
require(_amount > 0, 'INSUFFICIENT');
TransferHelper.safeTransferFrom(_lpToken, address(msg.sender), address(this), _amount);
uint256 ethFee = gFees.ethFe... | 816,636 |
/**
*Submitted for verification at Etherscan.io on 2021-07-31
*/
/**
*Submitted for verification at Etherscan.io on 2021-07-29
*/
// SPDX-License-Identifier: MIT
/**
* Submitted for verification at Etherscan.io on XXXX-XX-XX
* Sales contract inherited from the Bored Ape Yacht Club. Check their opensea at:
* ht... | Set some Bananax aside/ | function reserveBananax() public onlyOwner {
uint supply = totalSupply();
uint i;
for (i = 0; i < 48; i++) {
_safeMint(msg.sender, supply + i);
}
}
| 2,354,034 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.8.0;
library safe_math {
function mul(uint256 a, uint256 b)
internal
pure
returns (uint256 c)
{
if (a == 0) {
return 0;
}
c = a * b;
require(c / a == b, "safe_math... | Transfer token for a specified address to The address to transfer to. value The amount to be transferred./ | function transfer(address to, uint256 value) override external returns (bool) {
require(value <= _balances[msg.sender]);
require(to != address(0));
_balances[msg.sender] = _balances[msg.sender].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(msg.sender, to, value);
return ... | 12,585,609 |
pragma solidity ^0.4.18;
import "zeppelin/contracts/math/SafeMath.sol";
import "zeppelin/contracts/lifecycle/Pausable.sol";
import "./ERC721Deed.sol";
import "./ERC721Metadata.sol";
/*
Notes on this ERC721 implementation:
A simple Bike deed.
*/
contract BikeDeed is ERC721Deed, ERC721Metadata, Pausable {
usi... | Private helper functions / | function _buildName(bytes32 _serialNumber, bytes32 _manufacturer)
private pure returns(bytes32) {
return _stringToBytes32(_strConcat(_bytes32ToString(_serialNumber),
_bytes32ToString(_manufacturer)));
}
| 12,915,065 |
pragma solidity ^0.4.24;
/**
* @title Library for KeyHolder.
* @notice Fork of Origin Protocol's implementation at
* https://github.com/OriginProtocol/origin/blob/master/origin-contracts/contracts/identity/KeyHolderLibrary.sol
* We want to add purpose to already existing key.
* We do not want to have purpose J if... | We do not want to have purpose J if you have purpose I and I < J Exception: we want purpose 1 to have all purposes. | function keyHasPurpose(KeyHolderData storage _keyHolderData, bytes32 _key, uint256 _purpose)
public
view
returns(bool isThere)
{
if (_keyHolderData.keys[_key].key == 0) {
isThere = false;
}
uint256[] storage purposes = _keyHolderData.keys[_key].purpos... | 2,511,580 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./Krause.sol";
// This example was taken from the code examples on:
// https://ethereum.org/en/
contract Vote is ERC20 {
// An address is comparable to an email address - it's used to identify ... | / OVERRIDE ERC20 TRANSFERS /// | function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
require(false, "Cannot transfer delegation.");
return false;
}
| 1,041,954 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
//
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementat... | give initial allotment if this doggo hasn't claimed it's tokens yet | function accumulated(uint256 tokenId) public view returns (uint256) {
require(ITopDogBeachClub(_tdbcAddress).ownerOf(tokenId) != address(0), "Nobody owns this doggo");
require(tokenId < ITopDogBeachClub(_tdbcAddress).totalSupply(), "Doggo does not exist");
uint256 lastClaimed = uint256(_las... | 13,607,867 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./optimize/SlotHelper.sol";
import "./StorageHelper.sol";
import "./StorageSlotSelfDestructable.sol";
// Large storage manager to support arbitrarily-sized data with multiple chunk
contract LargeStorageManager {
using SlotHelper for bytes32;
usin... | Returns (size, of chunks). | function _size(bytes32 key) internal view returns (uint256, uint256) {
uint256 size = 0;
uint256 chunkId = 0;
while (true) {
(uint256 chunkSize, bool found) = _chunkSize(key, chunkId);
if (!found) {
break;
}
size += chunkSize;... | 12,745,799 |
./full_match/3/0x42D133BFb13625fF67F0D78394E025461799b734/sources/Wearables.sol | gets the current reserve total return reserveTotal_ the reserve total/ | function getReserve() public view override returns (uint256 reserveTotal_) {
return reserveTotal;
}
|__________________________________*/
| 8,134,534 |
/**
*Submitted for verification at Etherscan.io on 2020-10-21
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.6;
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
/**
* @dev Wrappers over Solidity's arithmetic operations with a... | allows governance to resolve a dispute on a keeper keeper the address cleared/ | function resolve(address keeper) external {
require(msg.sender == governance, "::resolve: only governance can resolve");
disputes[keeper] = false;
emit KeeperResolved(keeper, block.number);
}
| 280,812 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "./TitleEscrowCloneable.sol";
import "./TitleEscrowCloner.sol";
import "./interfaces/ITitleEscrowCreator.sol";
import "./interfaces/ITitleEscrow.sol";
import "./interfaces/ITradeTrustERC721.sol";
import { ERC721Mintable, IERC721Receiver } from "./li... | Burning token to 0xdead instead to show a differentiate state as address(0) is used for unminted tokens | function destroyToken(uint256 tokenId) external onlyMinter {
require(ownerOf(tokenId) == address(this), "TokenRegistry: Token has not been surrendered");
emit TokenBurnt(tokenId);
_registrySafeTransformFrom(ownerOf(tokenId), 0x000000000000000000000000000000000000dEaD, tokenId);
}
| 6,467,281 |
/**
*Submitted for verification at Etherscan.io on 2021-05-20
*/
pragma solidity 0.6.6;
pragma experimental ABIEncoderV2;
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function... | SPDX-License-Identifier: agpl-3.0 | interface IFlashLoanReceiver {
function executeOperation(
address[] calldata assets,
uint256[] calldata amounts,
uint256[] calldata premiums,
address initiator,
bytes calldata params
) external returns (bool);
}
| 7,997,980 |
./full_match/43114/0x1eCAE54806e69Dd11044961114DEeba06923B47c/sources/contracts/oracle.sol | note this will always return 0 before update has been called successfully for the first time. | function consult(address token, uint256 amountIn)
external
view
returns (uint256 amountOut)
{
if (token == token0) {
amountOut = price0Average.mul(amountIn).decode144();
require(token == token1, "Oracle: INVALID_TOKEN");
amountOut = price1Avera... | 4,515,903 |
pragma solidity ^0.5.0;
/**
* @title Lambdeth
* @dev Helpful methods for working with arrays
*/
contract Lambdeth {
/**
* @dev Iterates an array and returns true if the specified value is present in the array
*/
function concat(uint[] memory arr1, uint[] memory arr2) public pure returns (uint[] m... | Iterates an array and returns a new array of equal lenth containing transformed elements/ | function map(uint[] memory arr, bytes4 cb) public view returns (uint[] memory) {
uint length = arr.length;
uint[] memory returnArray = new uint[](length);
for (uint i = 0; i < length; i++) {
(bool success, bytes memory data) = msg.sender.staticcall(abi.encodeWithSelector(cb, arr... | 1,759,063 |
// Spraytoken.net (SPRAY)
// SPRAY is a deflationary cryptocurrency with auto-staking and dynamic burn model,
// designed to resist the bear market by increasing the burn rate when the market is in a downward phase.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable... | Returns the name of the token./ | function name() public pure override returns (string memory) {
return _NAME;
}
| 2,537,594 |
/**
*Submitted for verification at Etherscan.io on 2020-07-12
*/
// SPDX-License-Identifier: GPLv3
/**
Note that this is contract is not under the MIT license. While this is still open source code,
there are still limitations when using this contract.
*/
pragma solidity 0.6.11;
// This contract defines the st... | GetStakes: Return all staking transactions | function GetStakes(address account) public view returns (bytes32[] memory) {
bytes32[] memory hashList = _Hashes[account];
return hashList;
}
| 5,408,380 |
pragma solidity ^0.4.13;
library SafeMath {
function sub(uint a, uint b) internal returns (uint) {
assert(b <= a);
return a - b;
}
function add(uint a, uint b) internal returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
}
contract ERC20Basic {
uint public totalSupply;
address... | Change animator. _who The address of new animator./ | function changeAnimator(address _who) external onlyAnimator {
assert(_who != address(0));
commitDividend(msg.sender);
commitDividend(_who);
animator = _who;
}
| 2,111,683 |
pragma solidity >=0.5.10;
import "ROOT/libraries/token/IERC777.sol";
import "ROOT/libraries/token/IERC777Recipient.sol";
import "ROOT/libraries/token/IERC777Sender.sol";
import "ROOT/libraries/token/IERC20.sol";
import 'ROOT/libraries/math/SafeMathUint256.sol';
import 'ROOT/libraries/ContractExists.sol';
import "ROOT/... | See `IERC777.revokeOperator`./ | function revokeOperator(address operator) external {
require(operator != msg.sender, "ERC777: revoking self as operator");
delete _operators[msg.sender][operator];
emit RevokedOperator(operator, msg.sender);
}
| 5,450,620 |
pragma solidity ^0.4.11;
contract PullPayInterface {
function asyncSend(address _dest) public payable;
}
contract Governable {
// list of admins, council at first spot
address[] public admins;
function Governable() {
admins.length = 1;
admins[0] = msg.sender;
}
modifier only... | called by the owner to pause, triggers stopped state/ | function pause() onlyAdmins whenNotPaused {
paused = true;
}
| 1,002,642 |
./full_match/5/0x402CF8456F05D111ABEe84F4209334Ba37729479/sources/contracts/RoboNounsToken.sol | Lock the descriptor. This cannot be reversed and is only callable by the owner when not locked./ | function lockDescriptor() external override onlyOwner whenDescriptorNotLocked {
isDescriptorLocked = true;
emit DescriptorLocked();
}
| 1,854,430 |
pragma solidity ^0.4.16;
/*
* Abstract Token Smart Contract. Copyright © 2017 by ABDK Consulting.
* Author: Mikhail Vladimirov <<span class="__cf_email__" data-cfemail="c1aca8aaa9a0a8adefb7ada0a5a8aca8b3aeb781a6aca0a8adefa2aeac">[email protected]</span>>
*/
pragma solidity ^0.4.16;
/*
* ERC-20 Standard... | Get symbol of this token. return symbol of this token/ | function symbol () constant returns (string result) {
return "LUC";
}
| 2,163,543 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.