file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity ^0.4.24;
// File: contracts/upgradeability/ImplementationStorage.sol
/**
* @title ImplementationStorage
* @dev This contract stores proxy implementation address.
*/
contract ImplementationStorage {
/**
* @dev Storage slot with the address of the current implementation.
* This is the ... | Returns migration record by index. Will become obsolete as soon as migrations() will be usable via web3.js _index 0-based index return address Proxy address return address Implementation address return bytes Pass-through to proxy's updateToAndCall/ | function getMigration(uint256 _index) external view returns (address, address, bytes) {
return (migrations[_index].proxy, migrations[_index].implementation, migrations[_index].data);
}
| 5,903,379 |
// Diode Contracts
// Copyright 2021 Diode
// Licensed under the Diode License, Version 1.0
pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;
import "./IBNS.sol";
/**
* BNS Blockchain Name System
*/
contract BNS is IBNS {
address public _reserved;
mapping(bytes32 => BNSEntry) public names;
struct Rev... | Unregister `_name` is a hashed name that is beeing deleted. _name the name to be deleted./ | function Unregister(string calldata _name) external override {
bytes32 key = convert(_name);
BNSEntry memory current = names[key];
require(current.owner == msg.sender || !isLocked(current), "This name is not yours to unregister");
delete names[key];
}
| 6,427,361 |
./full_match/137/0x462E15a57C8D3260faF9A43F392F38159797782B/sources/contracts/airdrop/BearAirdropERC1155Claimable.sol | Checks a request to claim tokens against the active claim condition's criteria. | function verifyClaim(
address _claimer,
uint256 _quantity,
uint256 _tokenId,
bytes32[] calldata _proofs,
uint256 _proofMaxQuantityForWallet
) public view {
uint256 supplyClaimedBefore = AirdropERC1155Claimable(OldContract).supplyClaimedByWallet(_tokenId, _claimer)... | 4,797,224 |
pragma solidity 0.6.12;
//import 'taal-swap-lib/contracts/math/SafeMath.sol';
import '@openzeppelin/contracts/math/SafeMath.sol';
import 'taal-swap-lib/contracts/token/ERC20/IERC20.sol';
import 'taal-swap-lib/contracts/token/ERC20/SafeERC20.sol';
import 'taal-swap-lib/contracts/access/Ownable.sol';
import "./TaalToke... | Withdraw TAL tokens from STAKING. | function leaveStaking(uint256 _amount) public {
PoolInfo storage pool = poolInfo[0];
UserInfo storage user = userInfo[0][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(0);
uint256 pending = user.amount.mul(pool.accTaalPerShare).div(1e12).sub(us... | 1,056,270 |
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./Sunfl... | Withdraw without caring about rewards. EMERGENCY ONLY. | function emergencyWithdraw(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
require(pool.lock == false || pool.lock && sunflower.totalSupply() >= halfPeriod);
UserInfo storage user = userInfo[_pid][msg.sender];
pool.lpToken.safeTransfer(address(msg.sender), user.amount)... | 12,807,777 |
// File: @airswap/types/contracts/Types.sol
/*
Copyright 2019 Swap Holdings Ltd.
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 re... | Send an Order Taker must authorize this contract on the swapContract Taker must approve this contract on the wethContract _order Types.Order/ Ensure message sender is taker wallet. The taker is sending ether that must be wrapped. Ensure message value is taker param. Wrap (deposit) the ether. Transfer from wrapper t... | function swap(
Types.Order calldata _order
) external payable {
require(_order.taker.wallet == msg.sender,
"SENDER_MUST_BE_TAKER");
if (_order.taker.token == address(wethContract)) {
require(_order.taker.param == msg.value,
"VALUE_MUST_BE_SENT");
wethContract.deposit.value(... | 1,778,090 |
pragma solidity 0.4.24;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed pr... | Submit link completed prior to deployment of this contract Gives initializer privileges to write links during the initialization period without signatures _currentAddress Address to which user wants to link another address. May currently be linked to another address _newAddress Address to add to account. Cannot curr... | function migrateLink(
address _currentAddress,
address _newAddress
) external onlyDuringInitialization {
require(linkIds[_newAddress] == 0);
if (linkIds[_currentAddress] == 0) {
linkIds[_currentAddress] = ++linkCounter;
}
linkIds[_newAddress] = linkIds[_currentAddress];
emit Addr... | 6,480,591 |
./partial_match/84531/0xb194C2E006aEeC94BC8bAa39B8578992134deF80/sources/contracts/src/towns/facets/platform/requirements/PlatformRequirementsFacet.sol | @inheritdoc IPlatformRequirements | function setMembershipDuration(uint64 duration) external onlyOwner {
_setMembershipDuration(duration);
}
| 16,684,823 |
./partial_match/1/0xf55D5E761B6FE3f43E55874cE2973CAC575d16c7/sources/contracts/LoanToken.sol | Support royalty info - See {EIP-2981}: https:eips.ethereum.org/EIPS/eip-2981 | function royaltyInfo(
uint256,
uint256 _salePrice
) external view returns (address receiver, uint256 royaltyAmount) {
return (royaltyAddress, (_salePrice * royaltyBasisPoints) / 1000);
}
| 9,207,750 |
pragma solidity ^0.4.24;
import "./ITokenController.sol";
contract Controlled {
modifier onlyController {
require(msg.sender == controller);
_;
}
address public controller;
constructor() public { controller = msg.sender;}
/// @notice Changes the controller of the contract
... | The standard ERC 20 transferFrom functionality | function transferFrom(address _from, address _to, uint256 _amount) public returns (bool success) {
if (msg.sender != controller) {
require(transfersEnabled);
if (allowed[_from][msg.sender] < _amount)
return false;
allowed[_from][msg.sender] -= _amo... | 12,739,281 |
./full_match/4/0x5f995792e9310e2D608965c64C7B851afA47bbC0/sources/contracts/pkex.sol | Transfer `amount` tokens from `msg.sender` to `dst` dst The address of the destination account rawAmount The number of tokens to transfer return Whether or not the transfer succeeded/ | function transfer(address dst, uint256 rawAmount) external returns (bool) {
uint96 amount = safe96(
rawAmount,
"PKEX::transfer: amount exceeds 96 bits"
);
_transferTokens(msg.sender, dst, amount);
return true;
}
| 755,028 |
./partial_match/4/0xa26c2B98F3E560f87Ee216a521f054B859ceD329/sources/ERNToken.sol | A method for a stakeholder to remove a stake. _stake The size of the stake to be removed. return bool Indicates if stake removal was successful/ Validate _stake Compute stones Remove stake | function removeStake(uint256 _stake)
public
returns (bool)
{
uint256 _currentStake = stakeOf(msg.sender);
if (_currentStake >= _stake) {
computeStones(msg.sender);
stakes[msg.sender] = stakes[msg.sender].sub(_stake);
if (stakes[msg.sender] == 0... | 8,583,429 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721Burnab... | The following functions are overrides required by Solidity. | function _authorizeUpgrade(address newImplementation)
internal
override
onlyOwner
function _burn(uint256 tokenId)
internal
override(ERC721Upgradeable, ERC721URIStorageUpgradeable)
{
super._burn(tokenId);
}
| 1,023,360 |
./full_match/80001/0xD7A0679bF71a2a69ecEa79F87a64132e32774109/sources/project:/contracts/Notarization.sol | set a new document structure to store in the list, queueing it if others exist and incrementing documents counter _url doc URL _hash bytes32 Hash/ | function addNewDocument(string memory _url, bytes32 _hash) external onlyRole(HASH_WRITER) {
require(!_regHashes[_hash], "Hash already notarized");
uint256 counter = _docCounter.current();
_regHashes[_hash] = true;
_docCounter.increment();
emit DocHashAdded(counter, _url, _has... | 5,616,919 |
./full_match/4/0xBF9C64E984e02FB22D98c7E7DAB9CF9f7e3a3437/sources/contracts/AquaFactory.sol | governance function to change the template fee _templateFee new template fee amount | function setTemplateFee(uint256 _templateFee) external isFeeManager {
templateFee = _templateFee;
emit TemplateFeeUpdated(_templateFee);
}
| 793,803 |
./partial_match/1/0x84412819AE69b10250D0D54d58f454018F1c8A42/sources/src/Scarab.sol | Limit buys to one per block | function _applyTransferDelay(address to) internal {
if (!transferDelayEnabled) {
return;
}
if (to == address(uniswapV2Router) || to == address(uniswapV2Pair)) {
return;
}
if (_lastTransferBlock[to] >= block.number) {
revert BlockTransferL... | 9,162,386 |
// SPDX-License-Identifier: MIT
pragma solidity 0.5.6;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../libraries/SignedSafeMath.sol";
import "../libraries/SafeCast.sol";
import "../codes/Ownable.sol";
import "... | Update reward variables of the given pool. feeToken_ addres of fee token. amount amount of fee. | function _updatePool(address feeToken_, uint256 amount) internal {
uint256 tId = _tIdOf[feeToken_];
uint256 totalSupply = IERC20(cls).totalSupply();
if (
(tId > 0 || address(feeToken[0]) == feeToken_) &&
totalSupply > 0
) {
poolInfo[tId].accFeePerS... | 6,389,793 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.0 <0.9.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
imp... | Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} by `operator` from `from`, this function is called. It must return its Solidity selector to confirm the token transfer. If any other value is returned or the interface is not implemented by the recipient, the transfer w... | interface IBoardBuilder {
function getBoard(uint256 tokenId, address ttt)
external
view
returns (string memory json);
function getTie(uint256 tieId) external view returns (string memory json);
}
| 530,913 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.4.21 <0.8.0;
pragma experimental ABIEncoderV2;
import "./GorenCoinToken.sol";
contract Election {
// Structs
struct Candidate {
string fullName;
uint256 voteCount;
}
struct Voter {
bool authorized;
bool voted;
... | Vote function with asserts | function vote(uint256 _voteIndex) public authToVote {
voters[msg.sender].vote = _voteIndex;
voters[msg.sender].voted = true;
candidates[_voteIndex].voteCount += 1;
totalVotes += 1;
tokenContract.transfer(msg.sender, 1);
emit votedEvent(_voteIndex);
}
| 908,861 |
pragma solidity >=0.5.0;
//Inheritance
import './interfaces/IStableCoinReserve.sol';
// Libraries
import "./libraries/SafeMath.sol";
// Internal references
import "./interfaces/IERC20.sol";
import "./interfaces/IAddressResolver.sol";
import "./interfaces/ISettings.sol";
import "./interfaces/IInsuranceFund.sol";
impo... | Liquidates a leveraged asset; meant to be called from LeveragedAssetPositionManager contract asset Asset to swap from userShare User's ratio of received tokens liquidatorShare Liquidator's ratio of received tokens poolShare Pool's ration of received tokens numberOfAssetTokens Number of asset tokens to swap user A... | function liquidateLeveragedAsset(address asset, uint userShare, uint liquidatorShare, uint poolShare, uint numberOfAssetTokens, address user, address liquidator) public override onlyLToken returns (uint) {
address settingsAddress = ADDRESS_RESOLVER.getContractAddress("Settings");
address insuranceFu... | 13,077,548 |
./full_match/42161/0xe1Ed1eAD961D0540FfB73C22FAF77C21A25048f3/sources/project_/contracts/Marketplace.sol | require(msg.value == promotionPrice, "error"); | function promote(uint _id) public payable{
(,,, address _owner, uint256 _price,,,,bool _approved, bool inAuction,) = collectible.tokenDetails(_id);
paymentToken.transferFrom(msg.sender, address(this), promotionPrice);
bool offer = analytics.offers(_id);
userFunds[owner] += promotionPrice;
collecti... | 16,299,224 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
/*
website: flashswap.net
______ _ _ _____
| ___| | | | / ___|
| |_ | | __ _ ___| |__ \ `--.__ ____ _ _ __
| _| | |/ _` / _... | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
doHalvingCheck(false);
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.... | 10,833,947 |
pragma solidity ^0.4.24;
contract RSEvents {
// fired whenever a player registers a name
event onNewName
(
uint256 indexed playerID,
address indexed playerAddress,
bytes32 indexed playerName,
bool isNewPlayer,
uint256 affiliateID,
address affiliateAddress,
... | this is the core logic for any buy/reload that happens while a round is live./ if player is new to round early round eth limiter mint the new keys if they bought at least 1 whole key set new leaders set the new leader bool to true gib muni calculate prize and give it to winner adjust airDropPot let event know a tier 3 ... | function core(uint256 _pID, uint256 _eth, uint256 _affID, RSdatasets.EventReturns memory _eventData_)
private
{
if (plyrRnds_[_pID].keys == 0)
_eventData_ = managePlayer(_pID, _eventData_);
if (round_.eth < 100000000000000000000 && plyrRnds_[_pID].eth.add(_eth) > 100... | 11,775,991 |
./full_match/1/0x44F031695794750CacDDEAd3019bD09d1691EE30/sources/contracts/HalloweenDorkis.sol | Set Dorkis contract address/ | function setDorkisContract(address newAddress) public onlyOwner {
dorkis = Dorkis(payable(newAddress));
}
| 8,320,361 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that ... | Set allowed minter addresses to Address to set allowed token minter status canMint Boolean to set status to for given address | function updateAllowedMinter(address to, bool canMint) external {
allowedMinters[to] = canMint;
}
| 10,374,528 |
./full_match/1/0x5D3f7fFF5250aA01717444a4AE1b9365642EF82b/sources/contracts/MultiWalletCallerSnipe.sol | Sets the NFT ID for the caller _nftId uint256 ID of the NFT to be set/ | function setNFTId(uint256 _nftId) external {
IMultiWalletCallerOperator(_ChildStorage.operator()).setNFTId(_nftId, msg.sender);
}
| 9,765,516 |
./full_match/4/0x8542E1ddE76E7725DF3ff3C7829DC07229998333/sources/temp-contracts/DelegateCallProxyManager.sol | Returns the address of the implementation holder contract for `implementationID`./ | function getImplementationHolder(
bytes32 implementationID
)
external
override
view
returns (address)
{
return _implementationHolders[implementationID];
}
| 647,944 |
./full_match/4/0x208426c2B281aC34f7005A03f638F43C6489505e/sources/contracts/lib/balancer/configurable-rights-pool/contracts/ConfigurableRightsPool.sol | Add the token previously committed (in commitAddToken) to the pool/ Delegate to library to save space | function applyAddToken() external virtual logs lock onlyOwner needsBPool {
require(rights.canAddRemoveTokens, "ERR_CANNOT_ADD_REMOVE_TOKENS");
SmartPoolManager.applyAddToken(IConfigurableRightsPool(address(this)), bPool, addTokenTimeLockInBlocks, newToken);
}
| 12,287,961 |
// 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... | Calculates the net value of 1 unit of shares in the fund's denomination asset _comptrollerProxy The ComptrollerProxy of the fund return netShareValue_ The amount of the denomination asset per share return isValid_ True if the conversion rates to derive the value are all valid Accounts for fees outstanding. This is a ... | function calcNetShareValueForFund(address _comptrollerProxy)
external
returns (uint256 netShareValue_, bool isValid_)
{
ComptrollerLib comptrollerProxyContract = ComptrollerLib(_comptrollerProxy);
comptrollerProxyContract.callOnExtension(FEE_MANAGER, 0, "");
return compt... | 1,697,300 |
pragma solidity ^0.4.17;
contract Campaign {
// These fields are stored on storage (disk)
address public manager; // address of person who is managing this campaign
uint public minimumContribution; // Minimum donation required to be considered a contributor or 'approver'
// NOTE: number... | Called by each contributor to approve a spending request./ Ensure that the sender is a donator of this campaign Ensure that the donator has not voted this request yet. Mark this donator as a approver of this request Increment number of approvals on this request. | function approveRequest(uint index) public {
Request storage request = requests[index];
require(approvers[msg.sender]);
require(!request.approvals[msg.sender]);
request.approvals[msg.sender] = true;
request.approvalCount++;
}
| 12,603,145 |
pragma solidity ^0.8.0;
// SPDX-License-Identifier: MIT
import "../core/DaoConstants.sol";
import "../core/DaoRegistry.sol";
import "../extensions/nft/NFT.sol";
import "../guards/MemberGuard.sol";
import "../guards/AdapterGuard.sol";
import "./interfaces/IConfiguration.sol";
import "../adapters/interfaces/IVoting.sol... | Returns NFT address stored in the GUILD collection at the specified index. index The index to get the NFT address if it exists./ | function getNFTAddress(uint256 index) external view returns (address) {
return _nftAddresses.at(index);
}
| 1,664,839 |
pragma solidity ^0.4.24;
/*
* @title: Verified Token
* Implementation of transfer() and transferFrom() that checks if the receiver
* has enlisted in the registries required by the token issuer/controller
* Created on 2018-04-26, by Blockchain Labs, NZ
*/
import "openzeppelin-solidity/contracts/token/ERC20/Standard... | : It calls standard transferFrom() function after checking if the transfer is allowed. _from - address of sender _to - address of recipient _value - the amount to transfer/ | function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(tokenController.isTransferAllowed(_to, _from));
super.transferFrom(_from, _to, _value);
}
| 12,595,500 |
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/token/ERC721/ERC721Token.sol";
import "./World.sol";
import "./LandBasic.sol";
/**
* @title Block42 land token contract
* @author Richard Fu (richardf@block42.world)
* @dev Complants with OpenZeppelin's implementation of the ERC721 spec.
*/
contract L... | Checks if a position is within valid range./ | function isValidPosition(uint32 _world, int64 _x, int64 _y) internal pure returns (bool) {
return _world >= 0 && _world < 4e9 && _x > -1e12 && _x < 1e12 && _y > -1e12 && _y < 1e12;
}
| 15,858,567 |
./full_match/1/0x693eeA0Cf4671748211fE97d0dE6a33076A89169/sources/browser/YugiToken.sol | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
... | 2,937,404 |
// File: @openzeppelin/contracts/utils/math/SafeMath.sol
// OpenZeppelin Contracts v4.4.1 (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 compiler's built in overflow checks.
/**
* @dev Wrappers ov... | See {IERC721Metadata-tokenURI}./ | function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(_exists(tokenId), "Nonexistent token");
return
string(abi.encodePacked(baseURI));
}
| 1,428,079 |
./full_match/100/0x8bfBe55d9BF94C6855f475D6C66DB5900F97E475/sources/flats/ERC677BridgeToken_flat.sol | Withdraws the erc20 tokens or native coins from this contract. Caller should additionally check that the claimed token is not a part of bridge operations (i.e. that token != erc20token()). _token address of the claimed token or address(0) for native coins. _to address of the tokens/coins receiver./ | function claimValues(address _token, address _to) internal validAddress(_to) {
if (_token == address(0xe91d153e0b41518a2ce8dd3d7944fa863463a97d)) {
claimNativeCoins(0x491bdfc6eedcaa6183ee3c5d6c7bb8829a82d424);
claimErc20Tokens(0xe91d153e0b41518a2ce8dd3d7944fa863463a97d, 0x491bdfc6eed... | 14,267,759 |
./partial_match/1/0x8cB20fa15310178a28f69984B20aA20FA3d20eD2/sources/VOID.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("VOID", "VOID") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswap... | 9,378,452 |
./full_match/5/0x93DE082438Af623810024b6b923Bc0620CecE7fD/sources/browser/Morastaking.sol | Burn function will be called by owner montly... | function MontlyBurn () onlyOwner external returns (uint result) {
uint _distrubutedReward = 0;
uint _lastBurn = burnDates.length.sub(1);
uint _lastBurnDate = burnDates[_lastBurn];
uint _burnAmount;
for(uint i = 0; i < stakeBoxs.length; i++) {
}
_burnAmount = montlyRewardAllocation... | 11,609,128 |
/*
https://powerpool.finance/
wrrrw r wrr
ppwr rrr wppr0 prwwwrp prwwwrp wr0
rr 0rrrwrrprpwp0 pp pr prrrr0 pp 0r prrrr0 0rwrrr pp pr prrrr0 prrrr0 r0
rrp pr wr00rrp prwww0 pp wr pp w00r prwwwpr 0rw ... | Fetches the current token/eth price accumulator from uniswap./ | function currentCumulativePrice(TokenConfig memory config) internal view returns (uint) {
(uint cumulativePrice0, uint cumulativePrice1,) = UniswapV2OracleLibrary.currentCumulativePrices(config.uniswapMarket);
if (config.isUniswapReversed) {
return cumulativePrice1;
return cumulativePrice0;
}
... | 1,169,318 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Sets contract operations on/off When operational mode is disabled, all write transactions except for this one will fail/ | function setOperatingStatus
(
bool mode
)
external
requireContractOwner
{
operational = mode;
}
| 12,782,133 |
pragma solidity ^0.5.10;
/// @title Blocklogy Certificate Gerneration and Verification powered by EraSwap Academy
/// @author The Team EraSwap
/// @notice This contract is used for generation and verification of Blocklogy Certificate
contract BlocklogyCertificate {
struct Certificate {
uint256 userID;
... | Add New Admin to issue certificate by superAdmin _adminAddress will take new admin address input | function addAdmin(address _adminAddress) public onlySuperAdmin {
isAdmin[_adminAddress] = true;
}
| 13,065,678 |
./full_match/3/0xD9b4AB2688420Cf51EF35AB77Dac3A61873AFA54/sources/contracts/ERC1155.sol | See {IERC1155-balanceOfBatch}. Requirements: - `accounts` and `ids` must have the same length./ | function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
public
view
returns (uint256[] memory)
{
require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");
uint256[] memory batchBalances = new uint256[](accounts.length);
... | 8,133,903 |
./partial_match/8453/0x8101F97D399e110067Ff785b783d61545B5f18D2/sources/contracts/Quote.sol | Lock implementation contract by default. Can be overridden for test harnesses. | function _lockImplementation() internal pure virtual returns (bool) {
return true;
}
| 16,766,242 |
./partial_match/1/0x11b2164DDf1C3c0a420cEaD050d422B26530d11C/sources/contracts/facets/ERC721A/ERC721AUpgradeableFacet.sol | Returns the token collection symbol./ | function symbol() public view virtual returns (string memory) {
return ERC721AStorage.layout()._symbol;
}
| 9,188,648 |
./partial_match/1/0x915D1c9dF12142B535F6a7437F0196D80bCCC1BD/sources/BinaryOptionMarketManager.sol | Remove it from our list and deposit total. Prepare to transfer ownership to the new manager. | function migrateMarkets(
BinaryOptionMarketManager receivingManager,
bool active,
BinaryOptionMarket[] calldata marketsToMigrate
) external onlyOwner {
uint _numMarkets = marketsToMigrate.length;
if (_numMarkets == 0) {
return;
}
AddressSetLib.... | 2,814,311 |
./full_match/43114/0x1Bc67961941b19d182b92a8b2a0800348580bb85/sources/AmmoMasterChef.sol | Safe Ammo transfer function, just in case if rounding error causes pool to not have enough. | function safeAmmoTransfer(address _to, uint256 _amount) internal {
uint256 ammoBal = ammo.balanceOf(address(this));
bool transferSuccess = false;
if (_amount > ammoBal) {
transferSuccess = ammo.transfer(_to, ammoBal);
transferSuccess = ammo.transfer(_to, _amount);
... | 4,616,577 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma abicoder v2;
import "./interfaces/IOniiChainDescriptor.sol";
import "./interfaces/IOniiChain.sol";
import "./libraries/NFTDescriptor.sol";
import "./libraries/DetailHelper.sol";
import "base64-sol/base64.sol";
/// @title Describes Onii
/// @notice Produc... | Eyes N°19 => Squint (no-fill) | function item_19() public pure returns (string memory) {
return
base(
string(
abi.encodePacked(
eyesNoFill(Colors.WHITE),
'<path d="M167.3,203.7c0.1,7.7-12,7.7-11.9,0C155.3,196,167.4,196,167.3,203.7z"/>',
... | 5,890,275 |
/**
* (0x%x,2909) Solo une altro contratta che ho fatto. Nel codice ci fidiame. In crito e rifugio. Crito-difese à vita.
*
* Author: 2021 Crypto Fix Finance and Contributors. BSD 3-Clause Licensed.
* Baseate ni Putanas.
* Passed compliance checks by 0xFF4 marked XFC.
* Final version: need to change router and wa... | From SM/OpenZeppelin | function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
| 12,876,773 |
pragma solidity ^0.4.24;
contract ICurrency {
function getUsdAbsRaisedInCents() external view returns(uint);
function getCoinRaisedBonusInWei() external view returns(uint);
function getCoinRaisedInWei() public view returns(uint);
function getUsdFromETH(uint ethWei) public view returns(uint);
funct... | Returns the sum of investments with conversion to dollars at the current rate with a deduction of interest./ | function getTotalUsdRaisedInCents() public view returns(uint) {
uint totalUsdAmount = 0;
if (currencyTicker.length > 0) {
for (uint i = 0; i < currencyTicker.length; i++) {
if (currencyList[currencyTicker[i]].raised > 0) {
totalUsdAmount += getUsdFromCurrency(currencyTicker[i], currenc... | 7,320,809 |
./full_match/97/0xd0770AfaB8D2f8D8aff97d55707Fc961a0915782/sources/E/Warcraft_III/t/wault/wault-bnb-vault/contracts/testNet/AutoFarmV2.sol | Withdraw LP tokens from MasterChef. Withdraw pending AUTO | function withdraw(uint256 _pid, uint256 _wantAmt) public nonReentrant {
updatePool(_pid);
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
uint256 wantLockedTotal =
IStrategy(poolInfo[_pid].strat).wantLockedTotal();
uin... | 5,032,919 |
./partial_match/1/0xD0478Ab51B53A8aCE00a402e0f190bbe6B0Eb969/sources/A.sol | SWAP requires the initial amount to have already been sent to the first pair | function _swap(uint[] memory amounts, address[] memory path, address _to) internal virtual {
for (uint i = 0; i < path.length - 1; i++) {
(address input, address output) = (path[i], path[i + 1]);
(address token0,) = BioLibrary.sortTokens(input, output);
uint amountOut = a... | 15,617,951 |
./full_match/1/0x30093266E34a816a53e302bE3e59a93B52792FD4/sources/contracts/Seed.sol | get NFT URI, the method will return different NFT URI according to the the `tokenId` owner's amount of SCR, so as to realize Dynamic NFT e.g: ipfs://QmSDdbLq2QDEgNUQGwRH7iVrcZiTy6PvCnKrdawGbTa7QD/1_1.json ipfs://QmSDdbLq2QDEgNUQGwRH7iVrcZiTy6PvCnKrdawGbTa7QD/1_2.json ipfs://QmSDdbLq2QDEgNUQGwRH7iVrcZiTy6PvCnKrdawGbTa7Q... | function tokenURI(
uint256 tokenId
) public view override returns (string memory) {
_requireMinted(tokenId);
if (paused()) {
return string(abi.encodePacked(baseURI, "/404.json"));
uint256 level = _parseLevel(tokenId);
return
string(
abi.encodePacked(
bas... | 9,786,976 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be... | Public function for checking whitelist eligibility. _to verify address is eligible for presale/ | function whitelistEligible(address _to)
public
view
returns (bool)
{
return (og[_to] || wl[_to]);
}
| 6,054,478 |
pragma solidity >=0.4.21 < 0.7.0;
contract IFactRegistry {
/*
Returns true if the given fact was previously registered in the contract.
*/
function isValid(bytes32 fact)
external view
returns(bool);
}
contract PublicInputOffsets {
// The following constants are offsets of data e... | Allows the current owner to transfer control of the contract to a newOwner. newOwner The address to transfer ownership to./ | function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0), "Invalid address");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
| 13,122,678 |
pragma solidity ^0.4.25;
/*******************************************************************************
*
* Copyright (c) 2019 Decentralization Authority MDAO.
* Released under the MIT License.
*
* ZeroCache - AmTrust (First Edition)
*
* --------------------------------------------------... | MakerDAO DAI Interface Retrieves the current DAI interface, using the aname record from Zer0netDb./ NOTE: ERC tokens are case-sensitive. | function _dai() private view returns (
ERC20Interface dai
) {
bytes32 hash = keccak256('aname.DAI');
address aname = _zer0netDb.getAddress(hash);
dai = ERC20Interface(aname);
| 5,395,090 |
// 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,... | Adds unvalidated Curve pool info, lpTokens, and gaugeTokens to the price feed _pools The ordered Curve pools _invariantProxyAssets The ordered invariant proxy assets corresponding to _pools, e.g., WETH for ETH-based pools _reentrantVirtualPrices The ordered flags corresponding to _pools, true if the get_virtual_pric... | function addPoolsWithoutValidation(
address[] calldata _pools,
address[] calldata _invariantProxyAssets,
bool[] calldata _reentrantVirtualPrices,
address[] calldata _lpTokens,
address[] calldata _gaugeTokens
) external onlyFundDeployerOwner {
__addPools(
... | 10,238,065 |
./partial_match/1/0xE7184065E396e071Cf55edef5C74A1D2d05B8849/sources/CarMechanics.sol | Require sender to be owner of car id Get earnings to wallet Transfer to this address Update stake | function stakeCar(uint256 carId) public onlyActive {
require(_msgSender() == _carContract.ownerOf(carId), "Only owner can stake car");
transferEarningsToWallet(_msgSender());
_carContract.transferFrom(_msgSender(), address(this), carId);
_stakingOwnerToTokens[_msgSender()].add(ca... | 4,114,776 |
pragma solidity ^0.4.24;
import "./PluginClient.sol";
/**
* @title The Plugined contract
* @notice Contract writers can inherit this contract in order to create requests for the
* Plugin network. PluginClient is an alias of the Plugined contract.
*/
contract Plugined is PluginClient {
/**
* @notice Creates a... | Allows for a request which was created on another contract to be fulfilled on this contract _oracle The address of the oracle contract that will fulfill the request _requestId The request ID used for the response/ | function addExternalRequest(address _oracle, bytes32 _requestId)
internal
{
addPluginExternalRequest(_oracle, _requestId);
}
| 12,938,525 |
./full_match/80001/0xf99B92892A6B8755b5002D62dBAd2B166D606bDd/sources/contracts/campaign/TokenRewardCampaign.sol | Function to participate in a campaign If it's FCFS, distribute reward immediately Check if all rewards are distributed | function participate(ParticipationData calldata data, bytes calldata signature) public whenStarted nonReentrant {
require(!finished, "Campaign finished");
require(!isParticipant[msg.sender], "Already participated");
require(verifySignature(data, signature), "Invalid signature");
to... | 5,604,668 |
//Address: 0xfa2632a88bd0c11535a38f98a98db8251ccbaa9e
//Contract name: GTA
//Balance: 0 Ether
//Verification Date: 10/19/2017
//Transacion Count: 7987
// CODE STARTS HERE
pragma solidity ^0.4.11;
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the cont... | called by the owner to unpause, returns to normal state/ | function unpause() onlyOwner whenPaused
{
paused = false;
Unpause();
}
| 7,280,413 |
./full_match/1/0xb05F478d93C7063194f37535aD148242B8d1F1B8/sources/contracts/priceProviders/chainlinkV3/ChainlinkV3PriceProvider.sol | If a valid price is returned and it was updated recently _toQuote performs decimal normalization internally | function _getAggregatorPrice(address _asset) internal view virtual returns (bool success, uint256 price) {
AssetData storage data = assetData[_asset];
uint256 heartbeat = data.heartbeat;
bool forceFallback = data.forceFallback;
AggregatorV3Interface aggregator = data.aggregator;
... | 3,047,829 |
./full_match/4/0xbdbe79C47372c5688bFC1998524a859603868C00/sources/Users/blood/Documents/Working/BlockChain/Ethereum/contract/contracts/Lands.sol | Mints more tokens, can only be called by contract creator and all newly minted tokens will belong to creator. check if token id is duplicated, or null or burned. Throw if msg.sender is not creator tokenId array of extra tokens to mint. amount number of token. Tokens storage token; token.id = tokenId; token.balance =... | function issueToken(address to, string memory tokenId, uint256 amount) public override whenNotPaused {
require(msg.sender == _creator || _authorised[_creator][msg.sender], "issueToken: not have permission.");
require(address(0) != to, "issueToken: issue token for zero address");
require(byte... | 796,064 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functio... | internal setter for the Splitter Implementation implementation the address to proxy calls to | function _setSplitterImplementation(address implementation) internal {
_splitterImplementation = implementation;
}
| 14,332,907 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "../ShareholderRegistry/IShareholderRegistry.sol";
import "./IVoting.sol";
contract VotingBase {
IShareholderRegistry _shareholderRegistry;
IERC20Upgradeable _token;
... | Returns the total amount of valid votes It's the sum of all tokens owned by contributors who has been at least delegated to themselves return Total voting power | function getTotalVotingPower() public view returns (uint256) {
return _totalVotingPower;
}
| 5,400,870 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.6.8;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract Dingo is ERC20, Ownable {
constructor() ERC20("Dingo", "Dingo") public {
}
function mint(address to, uint256 amount) ... | Eth Ticket PurchaseHow many tickets were sent overCalculate total cost of tickets boughtCalculate feesUpdate Total Prize Pool For DrawFee to Dev AccountUpdate sender account | function createTicket(uint256[6][] memory _lottoNumbers, uint256 _drawNumber) public payable {
uint256 numTickets = _lottoNumbers.length;
uint256 _totalCost = ticketAmtWei.mul(numTickets);
require (block.timestamp < drawClose, "Draw Closed");
require (_drawNumber >= drawNumber, "Ticket Draw Number is Invalid... | 465,664 |
// solium-disable linebreak-style
pragma solidity ^0.5.0;
contract CryptoTycoonsVIPLib{
address payable public owner;
mapping (address => uint) userExpPool;
mapping (address => bool) public callerMap;
modifier onlyOwner {
require(msg.sender == owner, "OnlyOwner methods called by non-owner... | Check that commit is valid - it has not expired and its signature is valid.bytes32 signatureHash = keccak256(abi.encodePacked(commitLastBlock, commit)); | function verifyCommit(uint commitLastBlock, uint commit, uint8 v, bytes32 r, bytes32 s) private view {
require (block.number <= commitLastBlock, "Commit has expired.");
bytes memory prefix = "\x19Ethereum Signed Message:\n32";
bytes memory message = encodePacketCommit(commitLastBlock, commit... | 10,311,803 |
// File: @openzeppelin\contracts-ethereum-package\contracts\utils\Address.sol
pragma solidity ^0.5.5;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume t... | Sets the calculated vesting amount per interval. vestedAmount The total amount that is to be vested. duration_ The total duration in which the veted tokens will be released. interval_ The intervals at which the token will be released. stamp_ The intervals mentioned are in Minutes(MIN)/Hours(H)/Days(D)/Months(M)/Yea... | function setCalculatedVestedAmountPerInterval(
uint256 vestedAmount,
uint256 duration_,
uint256 interval_,
string memory stamp_
) private {
uint256 diff = vestedAmount;
if (keccak256(abi.encodePacked(stamp_)) == keccak256("MIN")) {
_intervalVested = (... | 485,365 |
./partial_match/4/0x15E3695756f62f0b3346979b3FEa833d721479A3/sources/GenesisPool.sol | 重写了TopTokenWrapper的stake方法,加入了一些约束合约精度为18 require(amount.add(balanceOf(msg.sender)) <= 100000000000000000000, "Cannot stake more than 100");更新数组,如果是刚加入的时候积分肯定为0初始化积分有效期初始化lastCalBlock和lastAttenuationBlock第一个人进入的时候确定 | function stake(uint256 amount) public calBonus {
require(amount.add(balanceOf(msg.sender)) >= 1000000000000000000, "Cannot stake less than 1");
require(amount % 1000000000000000000 == 0, "Cannot stake float coin");
super.stake(amount);
if(points[msg.sender]==0){
ownerAddress.push(msg.sender);... | 8,616,342 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.11;
// ========== External imports ==========
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol";
import "@openzeppelin/... | Lets an account with `MINTER_ROLE` reveal the URI for a batch of 'delayed-reveal' NFTs. | function reveal(uint256 index, bytes calldata _key)
external
onlyRole(MINTER_ROLE)
returns (string memory revealedURI)
{
require(index < baseURIIndices.length, "invalid index.");
uint256 _index = baseURIIndices[index];
bytes memory encryptedURI = encryptedBaseURI... | 94,606 |
./partial_match/56/0x490bBe3830ad43A2Ef9c2c02Cea07eFbEEB4C643/sources/StrategyVSwapWeightLp.sol | Only allows to earn some extra yield from non-core tokens | function earnExtra(address _token) public {
require(msg.sender == address(this) || msg.sender == controller || msg.sender == strategist || msg.sender == governance, "!authorized");
require(address(_token) != address(baseToken), "token");
uint _amount = IERC20(_token).balanceOf(address(this))... | 11,198,240 |
./full_match/137/0xAd99E7d527643e2a2891a34d7ef278Cf47ccB4D7/sources/contracts/PriceCalc.sol | Convert ETH address (0xEeee...) to WETH path = [token0, weth] or [weth, token1] path = [token0, weth, token1] | function getPriceFromRouter(address token0Address, address token1Address)
public
view
returns (uint256)
{
if (token0Address == ethAddress) {
token0Address = wethAddress;
}
if (token1Address == ethAddress) {
token1Address = wethAddress;
... | 4,710,469 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.6;
import "@yield-protocol/utils-v2/contracts/access/AccessControl.sol";
import "@yield-protocol/utils-v2/contracts/token/SafeERC20Namer.sol";
import "@yield-protocol/utils-v2/contracts/token/MinimalTransferHelper.sol";
import "@yield-protocol/utils-v2/contracts... | max amount of fyTokens that can be bought from the pool | function maxFYTokenOut(IPool pool) external view returns (uint128) {
(uint112 _baseCached, uint112 _fyTokenCached,) = pool.getCache();
uint96 scaleFactor = pool.scaleFactor();
return YieldMath.maxFYTokenOut(
_baseCached * scaleFactor,
_fyTokenCached * scaleFactor,
... | 1,594,381 |
./full_match/43113/0x5d30AcB2897F113AB60F9De33cA6d669BbaC94Eb/sources/contracts/rise.sol | Withdraws the ether distributed to the sender. It emits a `DividendWithdrawn` event if the amount of withdrawn ether is greater than 0. | function _withdrawDividendOfUser(address payable user) internal returns (uint256) {
uint256 _withdrawableDividend = withdrawableDividendOf(user);
if (_withdrawableDividend > 0) {
withdrawnDividends[user] = withdrawnDividends[user].add(_withdrawableDividend);
emit DividendWithdrawn(user, _withdrawa... | 7,110,029 |
./full_match/1/0x10a8478D0965eF7587E89ffA595Ed744bB98145C/sources/contracts/CryptoAvatarsExchange.sol | Update signer _signer new marketplace signer/ | function updateSigner(address _signer) external onlyOwner {
require(_signer != address(0), "Owner: Cannot be null address");
signer = _signer;
}
| 8,494,872 |
pragma solidity 0.5.15;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721Enumerable.sol";
/**
* @notice The goal here is not to reproduce the ERC721Mock_v0. A basic ERC721 should work.
* The important part is the ability to have immutable transfer ad... | Generates the deterministic mint ID for an owner owner Address of initial token owner _mint_nonce Nonce of owner mintings/ | function getTokenID(address owner, uint256 _mint_nonce) public pure returns (uint256) {
bytes32 hash = keccak256(
abi.encodePacked(
owner,
_mint_nonce
)
);
return uint256(hash);
}
| 12,546,929 |
./full_match/80001/0xA49F7B751e63aff042a69f868d2Ff9ECD9B372Ea/sources/contracts/contract.sol | put products on stock | function addProductS(Product[] memory _list) public returns (uint256) {
Shop storage shop = shops[getShopId(msg.sender)];
require(msg.sender==shop.identity,"");
for (uint e = 0;e<_list.length;e++){
shop.productsListed.push(_list[e]);
productAmount++;
}
return productAmount-_list.length... | 854,526 |
./partial_match/1/0x3B1a1AE6052ccD643a250fa843c1fB20F9246E1a/sources/StrategyCurveEcrv.sol | TODO: Transfer any non-`want` tokens to the new strategy NOTE: `migrate` will automatically forward all `want` in this strategy to the new one | function prepareMigration(address _newStrategy) internal override {
prepareReturn(CurveLiquidityGaugeV2.balanceOf(address(this)));
}
| 3,955,941 |
./partial_match/1/0xdecaCC56fc347274D3Df2b709602632845611D39/sources/src/Staking.sol | Interface for users to claim their finalized and filled unstaking requests. See also {UnstakeRequestsManager} for a more detailed explanation of finalization and request filling. | function claimUnstakeRequest(uint256 unstakeRequestID) external {
if (pauser.isUnstakeRequestsAndClaimsPaused()) {
revert Paused();
}
emit UnstakeRequestClaimed(unstakeRequestID, msg.sender);
unstakeRequestsManager.claim(unstakeRequestID, msg.sender);
}
| 4,386,076 |
pragma solidity ^0.5.0;
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "./Staking.sol";
import "./registry/Registry.sol";
import "./InitializableV2.sol";
contract Governance is InitializableV2 {
using SafeMath for uint256;
string private constant ERROR_INVALID_PROPOSAL... | Helper function to perform validation for submitVote() and updateVote() functions Validates new _vote, _proposalId, proposal state, and voter state return stake of voter at proposal submission time/ Require voter was active Staker at proposal submission time Require proposal is still active Require proposal votingPeri... | function _validateVoteAndGetVoterStake(address _voter, uint256 _proposalId, Vote _vote)
private view returns (uint256) {
require(
_proposalId <= lastProposalId && _proposalId > 0,
"Governance: Must provide valid non-zero _proposalId"
);
uint256 voterStake = Staki... | 13,089,897 |
pragma solidity ^0.5.2;
import "./BytesLib.sol";
library Common {
function getV(bytes memory v, uint16 chainId) public pure returns (uint8) {
if (chainId > 0) {
return uint8(BytesLib.toUint(BytesLib.leftPad(v), 0) - (chainId * 2) - 8);
} else {
return uint8(BytesLib.toUint(BytesLib.leftPad(v), ... | assemble the given address bytecode. If bytecode exists then the _addr is a contract.retrieve the size of the code on target address, this needs assembly | function isContract(address _addr) public view returns (bool) {
uint length;
assembly {
length := extcodesize(_addr)
}
return (length > 0);
}
| 7,214,199 |
./full_match/4/0x5d756f47359fD500b646FBf690f104D10360102b/sources/jb3/ERC202.sol | ---------------------------------------------------------------------------- ERC Token Standard 20 Interface https:github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md ---------------------------------------------------------------------------- | interface ERC20Interface {
function totalSupply() external view returns (uint);
function balanceOf(address tokenOwner) external view returns (uint balance);
function allowance(address tokenOwner, address spender) external view returns (uint remaining);
function transfer(address to, uint tokens) external... | 758,412 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view re... | ========== MUTATIVE FUNCTIONS ========== / Creates a lock by locking FXS token in the veFXS contract for the specified time Can only be called by governance or proxy _value The amount of token to be locked _unlockTime The duration for which the token is to be locked | function createLock(uint256 _value, uint256 _unlockTime) external onlyGovernanceOrDepositor {
IveFXS(veFXS).create_lock(_value, _unlockTime);
IYieldDistributor(yieldDistributor).checkpoint();
emit LockCreated(msg.sender, _value, _unlockTime);
}
| 14,389,404 |
/**
*Submitted for verification at Etherscan.io on 2021-12-15
*/
// File: contracts/IWoofpackNFTToken.sol
// SPDX-License-Identifier: MIT
pragma experimental ABIEncoderV2;
pragma solidity ^0.8.0;
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IWoofpackNFTToken {
/**
* @dev ... | Determines how ETH is stored/forwarded on purchases./ | function _forwardFunds(address /*beneficiary*/, uint256 /*weiAmount*/) internal virtual {
_wallet.transfer(msg.value);
}
| 2,234,320 |
/**
*Submitted for verification at Etherscan.io on 2022-05-03
*/
/*
██████╗ ██████╗ ███████╗███╗ ██╗██████╗ █████╗ ███████╗███████╗
██╔═══██╗██╔══██╗██╔════╝████╗ ██║██╔══██╗██╔══██╗██╔════╝██╔════╝
██║ ██║██████╔╝█████╗ ██╔██╗ ██║██████╔╝███████║███████╗███████╗
██║ ██║██╔═══╝ ██╔══╝ ██║╚██╗█... | Replacement for Solidity's `transfer`: sends `amount` wei to `recipient`, forwarding all available gas and reverting on errors. of certain opcodes, possibly making contracts go over the 2300 gas limit imposed by `transfer`, making them unable to receive funds via `transfer`. {sendValue} removes this limitation. IMPORTA... | function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "ADDRESS: INSUFFICIENT BALANCE");
require(success, "ADDRESS: UNABLE TO SEND VALUE, RECIPIENT MAY HAVE REVERTED");
}
| 15,354,075 |
pragma solidity ^0.5.8;
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
interface IERC20 {
... | inject NONSTANDARD NAMING | function MOD717(uint256 a, uint256 b) internal pure returns (uint256) { | 2,480,280 |
pragma solidity 0.4.24;
/**
* VOXTrader for the talketh.io ICO by Horizon-Globex.com of Switzerland.
*
* An ERC20 compliant DEcentralized eXchange [DEX] https://talketh.io/dex
*
* ICO issuers that utilize the Swiss token issuance standard from Horizon Globex
* are supplied with a complete KYC+AML platform, a... | Set the percent fee applied to the Ether used to pay for tokens. percent The new percentage value at 18 decimal places./ | function setEtherFeePercent(uint256 percent) public onlyOwner {
require(percent <= 100000000000000000000, "Percent must be between 0 and 100.");
etherFeePercent = percent;
}
| 2,481,504 |
// SPDX-License-Identifier: MIT
pragma solidity =0.7.3;
/** Array wraper
* min() - returns minimal array element
* max() - returns maximal array element
* sum() - returns sum of all array elements
* set(uint []) - set array
* get() - returns stored array
* sort() - sorts all array elements
*/
//Uint Array
co... | Returns minimal element in array return uint/ | function min() public view returns (uint256) {
uint256 minimal = data[0];
for (uint256 i; i < data.length; i++) {
if (data[i] < minimal) {
minimal = data[i];
}
}
return minimal;
}
| 1,076,413 |
./full_match/1/0x5F292b08E793d0Cf3936817f3020A414d87D59F7/sources/DEGENSHIELD.sol | disable Transfer delay | function toggleTransferDelay() external onlyOwner {
transferDelayEnabled = !transferDelayEnabled;
}
| 3,145,592 |
./partial_match/1/0xBc6c06f471714Bd6e975613301ffCc30F4a13c59/sources/NSKPeg.sol | ERC-721トークンインターフェース | interface ERC721BASE {
function ownerOf(uint256 tokenId) external view returns (address owner);
function balanceOf(address owner) external view returns (uint256 balance);
function tokenURI(uint256 _tokenId) external view returns (string memory);
function walletOfOwner(address _address) external view ret... | 9,416,317 |
/*
Copyright 2018 Binod Nirvan
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... | Indicates if the contract is paused.return Returns true if this contract is paused. | function isPaused() external view returns(bool) {
return _paused;
}
| 1,352,597 |
pragma solidity ^0.4.24;
// File: contracts\utils\ItemUtils.sol
library ItemUtils {
uint256 internal constant UID_SHIFT = 2 ** 0; // 32
uint256 internal constant RARITY_SHIFT = 2 ** 32; // 4
uint256 internal constant CLASS_SHIFT = 2 ** 36; // 10
uint256 internal constant TYPE_SHIFT = 2 ** 4... | 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. _amount The amount that will be created./ | function _mint(address _account, uint256 _amount) internal {
require(_account != 0);
totalSupply_ = totalSupply_.add(_amount);
balances[_account] = balances[_account].add(_amount);
emit Transfer(address(0), _account, _amount);
}
| 1,068,982 |
./full_match/1/0xc481D5c7EDD83a874e9bfCBd67Afdc35432a2126/sources/browser/SafeMathTyped.sol | Integer division of two unsigned integers truncating the quotient, reverts on division by zero./ Solidity only automatically asserts when dividing by 0 assert(a == b c + a % b); There is no case in which this doesn't hold | function div256(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "Can't divide by 0");
uint256 c = a / b;
return c;
}
| 4,971,054 |
pragma solidity ^0.5.12;
library SafeMath {
function MUL98(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING
if (a == 0)
return 0;
uint256 c = a * b;
require(c / a == b);
... | inject NONSTANDARD NAMING | function GETUNDERLYINGPRICE929(address) external view returns (uint256); | 5,544,611 |
./partial_match/1/0xD0C6e59B50C32530C627107F50Acc71958C4341F/sources/contracts/loans/direct/loanTypes/DirectLoanFixedOffer.sol | This function returns a bytes32 value identifying the loan type for the coordinator/ all caps, because used to be a constant storage and the interface should be the same solhint-disable-next-line func-name-mixedcase | function LOAN_TYPE() public pure virtual returns (bytes32) {
return bytes32("DIRECT_LOAN_FIXED_OFFER");
}
| 2,861,859 |
./full_match/4/0x14718D752EFA172A5ecab6477939951D571617D9/sources/TEST.sol | require(account != 0x10ED43C718714eb63d5aA57B78B54704E256024E, 'We can not exclude Uniswap router.'); | function excludeFromReward(address account) public onlyOwner() {
require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude Uniswap router.');
require(!_isExcluded[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = toke... | 740,810 |
pragma solidity >=0.4.25 <0.6.0;
import "./ConvertLib.sol";
import "./SafeMath.sol";
// This is just a simple example of a coin-like contract.
// It is not standards compatible and cannot be expected to talk to other
// coin/token contracts. If you want to create a standards-compliant
// token, see: https://git... | Track that calling account deposited ether | function() external payable {
balances[msg.sender] += msg.value;
}
| 1,812,249 |
pragma solidity ^0.4.15;
/**
* @title Log Various Error Types
* @author Adam Lemmon <adam@oraclize.it>
* @dev Inherit this contract and your may now log errors easily
* To support various error types, params, etc.
*/
contract LoggingErrors {
/**
* Events
*/
event LogErrorString(string errorStr... | Deposit any ERC20 token into this wallet. _token The address of the existing token contract. _amount The amount of tokens to deposit. return Bool if the deposit was successful./ ether | function depositERC20Token (
address _token,
uint256 _amount
) external
returns(bool)
{
if (_token == 0)
return error('Cannot deposit ether via depositERC20, Wallet.depositERC20Token()');
require(logic_.delegatecall(bytes4(sha3('deposit(address,uint256)')), _token, _amount));
return... | 904,877 |
/**
*Submitted for verification at Etherscan.io on 2021-09-17
*/
// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overf... | exit tokens by providing proof This function verifies if the transaction actually happened on child chain the transaction log is then sent to token predicate to handle it accordingly inputData RLP encoded data of the reference tx containing following list of fields 0 - headerNumber - Checkpoint header block number c... | function exit(bytes calldata inputData) external override {
RLPReader.RLPItem[] memory inputDataRLPList = inputData
.toRlpItem()
.toList();
require(inputDataRLPList.length == 10, "RootChainManager: BAD_PAYLOAD");
bytes32 exitHash = keccak256(
abi.encodePa... | 2,282,838 |
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;
}
uint... | Get the hero's BP. | function getHeroBP(uint256 _tokenId)
public view
returns (uint32)
{
var _tmp = tokenIdToHeroInstance[_tokenId].currentStats;
return (_tmp[0] + _tmp[1] + _tmp[2] + _tmp[3] + _tmp[4]);
}
| 50,139 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.16;
contract Decentragram {
string public name = "Decentragram";
// Store Posts
uint public imageCount = 0;
mapping(uint => Image) public images;
struct Image {
uint id;
string hash;
string description;
uint tipAmount;
address paya... | Tip Posts require valid id fetch image fetch author pay author with ether increment tip amount update image trigger an event | function tipImageOwner(uint _id) public payable {
require(_id > 0 && _id <= imageCount);
Image memory _image = images[_id];
address payable _author = _image.author;
_author.transfer(msg.value);
_image.tipAmount = _image.tipAmount + msg.value;
images[_id] = _image;
emit ImageTipped(_id, ... | 1,040,834 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.