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.18;
// BlackBox2.0 - Secure Ether & Token Storage
// Rinkeby test contract: 0x21ED89693fF7e91c757DbDD9Aa30448415aa8156
// token interface
contract Token {
function balanceOf(address _owner) constant public returns (uint balance);
function allowance(address _user, address _spender) constan... | lock - store a proof-set _hash Hash Key used to index the proof _operator A derived operator to encode the intended recipient _check A derived operator to check recipient, or a decode the token address protect invalid entries on value transfer | function lock(
bytes32 _hash,
bytes32 _operator,
bytes32 _check
) public payable {
if (msg.value > 0) {
require(_hash != 0 && _operator != 0 && _check != 0);
}
proofs[_hash].operator = _operator;
proofs[_hash].check = _check;
Locked(_ha... | 1,498,954 |
./partial_match/97/0xc2af23aA2A87D916cd989C6f6c48307142abE403/sources/LucaxUtilityToken.sol | Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address.... | function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowed[owner][spender] = amount;
emit Approval(owner, spender, ... | 11,384,467 |
/**
*Submitted for verification at Etherscan.io on 2022-03-30
*/
// SPDX-License-Identifier: MIT
// ................................................................................
// ..........................................................................
// ............8888............................ | Set the Merkle Root for the Tiered Whitelist./ | function setTieredWhitelistMerkleRoot(bytes32 _root) public onlyOwner
{
tieredWhitelistRoot = _root;
}
| 6,711,482 |
pragma solidity ^0.4.2;
contract XG4KCrowdFunding {
// data structure to hold information about campaign contributors
struct Funder {
address addr;
uint amount;
}
// Campaign data structure
struct Campaign {
address beneficiary;
uint fundingGoal;
uint numFunde... | checks if the goal or time limit has been reached and ends the campaign | function checkGoalReached(uint campaignID) returns (bool reached) {
Campaign c = campaigns[campaignID];
if (c.amount >= c.fundingGoal){
c.beneficiary.send(c.amount);
clean(campaignID);
return true;
}
if (c.deadline <= block.number){
uint j... | 1,012,844 |
./full_match/11155111/0xef13FaAe57356Caa68e046c69E8Eb533f880C192/sources/contracts/NewContracts/721A(R,PS).sol | Changes the price to mint a token. Only the contract owner can call this function. | function changePrice(uint256 newMintPrice) public onlyOwner {
mintPrice = newMintPrice;
}
| 3,805,622 |
./partial_match/1/0xBA51AAAA95aeEFc1292515b36D86C51dC7877773/sources/src/interfaces/IWellFunction.sol | IWellFunction Defines a relationship between token reserves and LP token supply. Well Functions can contain arbitrary logic, but should be deterministic if expected to be used alongside a Pump. When interacing with a Well or Well Function, always verify that the Well Function is valid./ | interface IWellFunction {
error InvalidJArgument();
function calcReserve(
uint256[] memory reserves,
uint256 j,
uint256 lpTokenSupply,
bytes calldata data
) external view returns (uint256 reserve);
function calcLpTokenSupply(
uint256[] memory reserves,
b... | 4,363,059 |
./full_match/5/0x94571FA1995B3052302fd027CC7a3ABAca1Ab358/sources/browser/WXMR.sol | Sets `amount` as the allowance of `spender` over the `owner` s tokens. This internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address./ | function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from 0x0 address");
require(spender != address(0), "ERC20: approve to 0x0 address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);... | 1,904,846 |
./full_match/97/0x5a05f17Da7e3897DC2d03ED616333Fad85607CE6/sources/project_/contracts/HeartBall.sol | Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5.05` (`505 / 10 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the default value returned by this... | function decimals() public view virtual returns (uint8) {
return 18;
}
| 3,270,134 |
./full_match/5/0x1a147b572DF9ca1d1d78Cfdbaa0375037C8559Ff/sources/src/SmoothlyPool.sol | Register n amount of validators to the pool indexes Validator indexes Backend verifies ownership of the validators This is intended to be called from the front-end, double checking for ownership. Anyone registering unowned validators will lose their staking funds and those will be distributed amongst the pool registr... | function registerBulk(uint64[] calldata indexes) external payable {
if (msg.value != (STAKE_FEE * indexes.length)) revert NotEnoughEth();
emit Registered(msg.sender, indexes);
}
| 7,066,373 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
import './libraries/SafeMath.sol';
import './libraries/Address.sol';
import './libraries/ERC20.sol';
import './libraries/ERC20Capped.sol';
import './libraries/AccessControl.sol';
// XPZ with Governance.
contract XPZToken is ERC20, ERC20Capped, AccessControl {
... | Remove an account from the minter role. Restricted to admins. | function revokeMinterRole(address account) public {
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), 'XPZ: DEFAULT_ADMIN_ROLE required');
revokeRole(MINTER_ROLE, account);
}
| 10,013,548 |
pragma solidity ^0.4.24;
import "zeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "zeppelin-solidity/contracts/token/ERC721/ERC721Token.sol";
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
import "zeppelin-solidity/contracts/math/SafeMath.sol";
import "./IronHandsInterface.sol";
import "./Hourgla... | Total number of bonds issued in the lifetime of the contract./ | function totalBondsIssued() public view returns (uint256){
return participants.length;
}
| 1,073,508 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
* ApeSwapFinance
* App: https://apeswap.finance
* Medium: https://ape-swap.medium.com
* Twitter: https://twitter.com/ape_swap
* Telegram: https://t.me/ape_swap
* Announcements: https://t.me/ape_swap_news
* GitHub: ... | Lock multiple tokens so they can't be transferred from the contract. Once locked it can't be unlocked/ | function lockTokens(address[] memory tokens) public onlyOwner {
for (uint256 i = 0; i < tokens.length; i++) {
lockToken(tokens[i]);
}
}
| 5,438,824 |
pragma solidity >=0.4.21 <0.7.0;
contract Certification {
address payable public owner;
address payable public contractAddress = address(this);
mapping(address => Class[]) public enrolledClass;
mapping(address => uint) public classCount;
mapping(uint => Certificate) public publishedCertificate... | require(address(this).balance == _value); | function enrollClass(uint _value, string memory classId) public {
classCount[msg.sender]++;
enrolledClass[msg.sender].push(Class(classId, now));
emit ClassPaid(msg.sender, owner, _value);
owner.transfer(_value);
}
| 936,295 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "hardhat/console.sol";
contract ERC721LendWrapper is
ERC7... | As a recipient of ERC721.safeTransfer(); | function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external override returns (bytes4) {
require(msg.sender == address(wrappedToken), "Can only receive wrapped ERC721");
return IERC721Receiver(operator).onERC721Receive... | 5,522,905 |
//SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;
/**
* @dev An unstructured storage library
*
* This library can be used to replace the native Solidity storage layout by
* introducing helper functions to get/set storage variables. This can also
* be done with inline assembly more efficiently. This library ... | Get uint256 slot storage slot return v/ | function getUInt256(bytes32 slot) internal view returns (uint256 v) {
assembly {
v := sload(slot)
}
}
| 12,792,237 |
./partial_match/1/0xeeC92c01c5BA99620cC801F8c3D50Af7DdEffd49/sources/RoseMaster.sol | View function to see pending ROSEs on frontend. pool2 hold 30% rewards. | function pendingRose2(uint256 _pid, address _user)
public
view
returns (uint256)
{
PoolInfo2 storage pool = poolInfo2[_pid];
UserInfo storage user = userInfo2[_pid][_user];
uint256 accRosePerShare = pool.accRosePerShare;
uint256 lpSupply = pool.lockedAmoun... | 9,185,427 |
./full_match/3/0xe0904A342A48D73aef712003236aF66fe0a4cf9E/sources/browser/ProofHolder.sol | Record a new proof to the smart contract./ | function recordProof(bytes32 _hash, string memory _root, string memory _timestamp) public onlyOwner {
require(!proofMapping[_hash].isSet, "Proof already exists");
proofMapping[_hash].hash = _hash;
proofMapping[_hash].root = _root;
proofMapping[_hash].timestamp = _timestamp;
p... | 8,101,867 |
pragma solidity ^0.4.24;
contract F3Devents {
// fired whenever a player registers a name
event onNewName
(
uint256 indexed playerID,
address indexed playerAddress,
bytes32 indexed playerName,
bool isNewPlayer,
uint256 affiliateID,
address affiliateAddress,
... | ends the round. manages paying out winner/splitting up pot/ setup local rID grab our winning player and team id's grab our pot amount calculate our winner share, community rewards, gen share, p3d share, and amount reserved for next pot calculate ppt for round mask | function endRound(F3Ddatasets.EventReturns memory _eventData_)
private
returns (F3Ddatasets.EventReturns)
{
uint256 _rID = rID_;
uint256 _winPID = round_[_rID].plyr;
uint256 _winTID = round_[_rID].team;
uint256 _pot = round_[_rID].pot;
uint256 _win = (_... | 5,726,421 |
//Address: 0xe63760e74ffd44ce7abdb7ca2e7fa01b357df460
//Contract name: DividendDistributorv2
//Balance: 0 Ether
//Verification Date: 2/5/2018
//Transacion Count: 9
// CODE STARTS HERE
pragma solidity ^0.4.0;
contract Ownable {
address public owner;
function Ownable() public {
owner = msg.sender;
}
modi... | no need to test, this will throw if amount > investment | function divest(uint amount) public {
if ( investors[msg.sender].investment == 0 || amount == 0)
throw;
investors[msg.sender].investment -= amount;
sumInvested -= amount;
this.loggedTransfer(amount, "", msg.sender, owner);
}
| 12,596,085 |
/**
*Submitted for verification at Etherscan.io on 2021-10-02
*/
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure the... | Registers respective shares of prop or registry fee to affiliate and protocol/ | function _registerFeesFromProp(address _affiliate, uint256 _amount) private {
if(_affiliate == address(0)){
protocolClaimableFees = protocolClaimableFees.add(_amount);
uint256 protocolShare = _amount.div(5);
affiliateOrCuratorFeesClaimable[_affiliate] = affiliateOrCurator... | 2,218,586 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
/**
* @dev Interface ... | Returns an Ethereum Signed Message, created from a `hash`. This produces hash corresponding to the one signed with the JSON-RPC method as part of EIP-191. See {recover}./ 32 is the length in bytes of hash, enforced by the type signature above | function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
| 7,007,971 |
./full_match/1/0xA5983DD1E55574d501E40272D62c91142962fE07/sources/contracts/GenerativeCollection/GenerativeCollection.sol | Set new base URI. Admin only. baseUri New string of the base URI for NFT | function setBaseURI(string memory baseUri)
external
onlyRole(DEFAULT_ADMIN_ROLE)
{
_metadataBaseURI = baseUri;
}
| 17,056,473 |
./full_match/5/0xC89511CFB3e8cbAA9470a9fE50184EAF7204c175/sources/contracts/TFOP.sol | Update the base token URI/ | function setBaseURI(string calldata _newBaseURI) external onlyOwner {
baseURI = _newBaseURI;
}
| 1,899,936 |
pragma solidity ^0.4.24;
/// @title The interface of permission
/// @author ["Rivtower Technologies <contact@rivtower.com>"]
interface IPermission {
/// @notice only permission management
function addResources(address[] _conts, bytes4[] _funcs) external returns (bool);
/// @notice only permission manageme... | The interface of permission ["Rivtower Technologies <contact@rivtower.com>"] | interface IPermission {
function addResources(address[] _conts, bytes4[] _funcs) external returns (bool);
function deleteResources(address[] _conts, bytes4[] _funcs) external returns (bool);
function updateName(bytes32 _name) external returns (bool);
function close() external;
function inPermiss... | 7,212,955 |
./full_match/100/0x086B5A16D7Bd6B2955fCC7d5F9AA2a1544b67e0d/sources/contracts/core/connext/facets/ProposedOwnableFacet.sol | Use to assign an address Router role Address with Router has permission to add new router Can only be called by Owner or Role.RouterAdmin requested address will be whitelisted as Role.RouterAdmin under mapping roles _router - The address to be assigned as Role.RouterAdmin under roles/ Use contract as source of truth ... | function assignRoleRouterAdmin(address _router) public onlyOwnerOrAdmin {
if (s.roles[_router] != Role.None || _router == address(0))
revert ProposedOwnableFacet__assignRoleRouter_invalidInput();
s.roles[_router] = Role.RouterAdmin;
emit AssignRoleRouter(_router);
}
| 14,289,737 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
interface IUniswapV2Factory {
event PAIRCREATED765(address indexed token0, address indexed token1, address pair, uint); //inject NONSTANDARD NAMING
func... | inject NONSTANDARD NAMING | function INITIALIZE744(address, address) external; | 12,917,635 |
./full_match/3/0x319624Af24c4a4737649639c6CA8655D5dBc05D8/sources/browser/MyShop.sol | Function to add a new item Requirements: msg.sender is the owner Contract is not paused itemID cannot be lower than 0 | function addItem(uint _itemID, string memory _itemName, string memory _description, uint
_inventory, uint _price) public onlyOwner pausable
{
require(_itemID >= 0,"Item ID cannot be negative.");
require(_itemID != items[_itemID].itemID,"The item ID already exists.");
Item storage ne... | 8,268,559 |
pragma solidity 0.5.4;
//import {Ownable} from "./ownable.sol";
import "./accessible.sol";
import "./access_indexor.sol";
import "./user_space.sol";
/* -- Revision history --
Editable20190222140100ML: First versioned released
Editable20190315141800ML: Migrated to 0.4.24
Editable20190515103600ML: Modified rights restr... | This function is meant to be overloaded. By default the owner is the only editor | function canEdit() public view returns (bool) {
return hasEditorRight(msg.sender);
}
| 5,401,432 |
pragma solidity 0.4.15;
/// @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 {
// EVENTS
event OwnershipTransferred(address indexed previousOwner, address ... | Updates the values of the given record. Only the owner can update his record. | function updateUrl(address key, bytes32[5] url, address sender) onlyDaoOrOwner {
require(records[key].owner == sender);
records[key].url = url;
}
| 12,750,977 |
pragma solidity ^0.4.25;
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev give an account access to this role
*/
function add(Role storage role, address account) internal {
require(account != address(0));
require(!has(role, account));
role.beare... | Transfer token for a specified address to The address to transfer to. value The amount to be transferred. return A boolean that indicates if the operation was successful./ Call super's transfer, including event emission Adjust balance blocks Add to the token holders list | function transfer(address to, uint256 value)
public
returns (bool)
{
bool transferred = super.transfer(to, value);
if (transferred) {
addBalanceBlocks(msg.sender);
addBalanceBlocks(to);
if (!holdersMap[to]) {
holdersMap[to] = true;
... | 12,584,290 |
// SPDX-License-Identifier: Apache-2.0
/**
* Authors: Moonstream Engineering (engineering@moonstream.to)
* GitHub: https://github.com/bugout-dev/dao
*
* An ERC1155 implementation which uses the Moonstream DAO common storage structure for proxies.
* EIP1155: https://eips.ethereum.org/EIPS/eip-1155
*
* The Moonst... | See {IERC1155-balanceOfBatch}. Requirements: - `accounts` and `ids` must have the same length./ | function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
public
view
virtual
override
returns (uint256[] memory)
{
require(
accounts.length == ids.length,
"ERC1155WithTerminusStorage: accounts and ids length mismatch"
... | 1,796,019 |
// Sources flattened with hardhat v2.8.3 https://hardhat.org
// File @openzeppelin/contracts/access/IAccessControl.sol@v4.4.2
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC16... | / For native tokens, the token address is set to this contract to prevent overwriting storage - the address can be anything but address(this) safer Only set the token address and update the reward-to-bribe mapping if not yet set | function depositBribe(
bytes32 bribeIdentifier,
bytes32 rewardIdentifier,
address briber
) external payable onlyRole(DEPOSITOR_ROLE) {
require(bribeIdentifier != bytes32(0), "Invalid bribeIdentifier");
require(rewardIdentifier != bytes32(0), "Invalid rewardIdentifier");
... | 11,858,535 |
pragma solidity ^0.4.16;
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }
contract OysterPrePearl {
// Public variables of the token
string public name = "Oyster PrePearl";
string public symbol = "PREPRL";
uint8 public decim... | Constructor function Initializes contract/ | function OysterPrePearl() public {
owner = msg.sender;
}
| 15,139,938 |
./full_match/3/0xAd5cc3aF073ea9793cD8A52389598a884fe8E775/sources/contracts/MoonshotGarageProject.sol | payable(owner1).transfer(balance.div(10).mul(4)); payable(owner2).transfer(balance.div(5)); payable(owner3).transfer(balance.div(5)); payable(owner4).transfer(balance.div(5)); | function withdraw() public onlyOwner {
uint256 balance = address(this).balance;
payable(msg.sender).transfer(balance);
}
| 8,089,248 |
pragma solidity ^0.4.19;
contract GOOGToken {
string public name = "GOOGOL TOKEN";
string public symbol = "GOOG";
string public standard = "GOOG Token v1.0";
uint8 public constant decimals = 18;
uint256 public totalSupply;
event Transfer(
address indexed _from,
address index... | function buyTokens(uint256 _numberOfTokens) public payable {_numberOfTokens = divide(msg.value , tokenPrice);_numberOfTokens = multiply(_numberOfTokens,1e18);require(msg.value == multiply(_numberOfTokens, tokenPrice)); | function buyTokens() public payable {
uint256 _numberOfTokens;
_numberOfTokens = multiply(msg.value,tokenRate);
require(tokenContract.balanceOf(this) >= _numberOfTokens);
require(tokenContract.transfer(msg.sender, _numberOfTokens));
tokensSold += _numberOfTokens;
... | 18,773 |
// File: @openzeppelin/contracts/math/SafeMath.sol
// 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... | error message binary size optimization | function _validFee(uint32 fee) internal pure {
require(fee <= PPM_RESOLUTION, "ERR_INVALID_FEE");
}
| 1,735,937 |
// contracts/CustoMoose.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "./IToken.sol";
import "./Library.sol"... | Generates an 8 digit config/ This will generate an 9 character string. All of them will start as 0 | function config() internal pure returns (string memory) {
string memory currentConfig = "000000000";
return currentConfig;
}
| 6,255,423 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./interfaces/IBondCalculator.sol";
import "./interfaces/IERC20Extended.s... | Sets terms for multiple wallets | function setTermsMultiple(address[] calldata _vesters, uint[] calldata _amountCanClaims, uint[] calldata _rates ) external onlyOwner() returns ( bool ) {
for (uint i=0; i < _vesters.length; i++) {
terms[_vesters[i]].max = _amountCanClaims[i];
terms[_vesters[i]].initPercent = _rates[i... | 12,150,381 |
./partial_match/1/0x82895fE2945A8B19c5E511E5AA90Da3Aa27331eA/sources/CCPCyborgs.sol | Owner or Project Leader can set the restricted state of an address. Note: Restricted addresses are banned from moving tokens./ | function restrictAddress(address _user, bool _state) external {
require(msg.sender == owner() || msg.sender == projectLeader, "NOoPL");
restricted[_user] = _state;
}
| 2,700,857 |
pragma solidity ^0.4.16;
contract Owned {
address public owner;
address public signer;
function Owned() public {
owner = msg.sender;
signer = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
modifier onlySigner {
require(msg.sender == signer);
... | Reward tokens from delegated address Reward `_value` tokens to `_from` address _from The address of the sender _value the amount to send/ | function reward(address _from, uint256 _value)
public
onlySigner
{
require(contributions[_from]>=_value);
contributions[_from] = contributions[_from].sub(_value);
balances[_from] = balances[_from].add(_value);
Reward(_from, _value);
}
| 386,200 |
pragma solidity >=0.4.25 <0.6.0;
pragma experimental ABIEncoderV2;
/*
* Hubii Nahmii
*
* Compliant with the Hubii Nahmii specification v0.12.
*
* Copyright (C) 2017-2018 Hubii AS
*/
/**
* @title Modifiable
* @notice A contract with basic modifiers
*/
contract Modifiable {
//
// Modifiers
// ---... | Remove a proposal wallet The address of the concerned challenged wallet currency The concerned currency walletTerminated True if wallet terminated Get the proposal index Return gracefully if there is no proposal to remove Require that role that initialized (wallet or operator) can only cancel its own proposal Emit e... | function removeProposal(address wallet, MonetaryTypesLib.Currency memory currency, bool walletTerminated)
public
onlyEnabledServiceAction(REMOVE_PROPOSAL_ACTION)
{
uint256 index = proposalIndexByWalletCurrency[wallet][currency.ct][currency.id];
if (0 == index)
return;
... | 12,574,705 |
./full_match/4/0xec9fEeccfBDb3573e6502F8Cd04dC482BB87B0f0/sources/contracts/Tiktaalik.sol | _personalCoin.mint(tx.origin, _amount);personalCoins[tx.origin] = address(personalCoin); | function generatePersonalCoin(ERC20PresetMinterPauser _personalCoin, uint _amount) internal {
}
| 764,863 |
./full_match/3/0x8B5314762f59Afd7e97cc3Cb140958E0EB38d82E/sources/brid.sol | cashier.depositTo {value(msg.value)(_crosschainToken, _to, _amount); | function depositTo(address _crosschainToken, address _to, uint256 _amount) public payable {
require(_crosschainToken != address(0), "invalid token");
ERC20 token = ICrosschainToken(_crosschainToken).coToken();
require(safeTransferFrom(address(token), msg.sender, address(this), _amount), "fai... | 14,231,183 |
/**
*Submitted for verification at Etherscan.io on 2020-10-09
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It... | Only fall back when the sender is not the admin./ | function _willFallback() internal virtual override {
require(
msg.sender != _admin(),
"Cannot call fallback function from the proxy admin"
);
super._willFallback();
}
| 2,404,866 |
/**
* @dev Cryptolotto referral system interface.
*/
contract iCryptolottoReferral {
/**
* @dev Get partner by referral.
*/
function getPartnerByReferral(address) public view returns (address) {}
/**
* @dev Get partner percent.
*/
function getPartnerPercent(address) public view retu... | Start the new game. Checks ticket price changes, if exists new ticket price the price will be changed. Checks game status changes, if exists request for changing game status game status will be changed./ | function startGame() internal {
require(isActive);
game = block.number;
if (newPrice != 0) {
ticketPrice = newPrice;
newPrice = 0;
}
if (toogleStatus) {
isActive = !isActive;
toogleStatus = false;
}
emit Game(ga... | 4,804,676 |
// SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-version
pragma solidity ^0.8.0;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contract can't have a constructor, it's common to move con... | Add given address in feeWhitelist. _addressToAdd Address to add in feeWhitelist./ | function addToFeeWhitelist(address _addressToAdd) external onlyKeeper {
require(_feeWhitelist.add(_addressToAdd), Errors.ADD_IN_LIST_FAILED);
}
| 416,793 |
./partial_match/1/0x8E220b9D3F09C56DC306Cab1d7644b846066cC43/sources/PToken.sol | See {IERC777-operatorBurn}. Emits {Burned} and {IERC20-Transfer} events./ | function operatorBurn(address account, uint256 amount, bytes memory data, bytes memory operatorData) public {
require(isOperatorFor(_msgSender(), account), "ERC777: caller is not an operator for holder");
_burn(_msgSender(), account, amount, data, operatorData);
}
| 3,609,900 |
./full_match/137/0xBc344BA056D5878590c7Eb81693ce954B943146E/sources/contracts/zap/staking/SolidZapStaker.sol | @inheritdoc ISolidZapStaker | function stakeETH(
address hypervisor,
bytes calldata swap1,
bytes calldata swap2,
uint minShares,
address zapRecipient
) external payable nonReentrant returns (uint) {
_wrap(weth, msg.value);
return _stakeDoubleSwap(weth, msg.value, hypervisor, swap1, sw... | 3,766,341 |
./full_match/11155111/0x56192215791b87F4a3AdE556cd6BC81108D95768/sources/contracts/QapturProjectFactory.sol | Deploy a new qland smart contract revert if something gone wrong | function deployQlandSmartContract(
string calldata _name,
string calldata _uri
) internal returns (address) {
if (qlandMarketplaceAddress == address(0)) {
qlandMarketplaceAddress = stateContract
.getQlandMarketplaceAddress();
}
require(
... | 3,815,882 |
./partial_match/42/0x75ECFeB9f1EAf43eAa354D0c4211D0BCB917E8f6/sources/MasterChefStageOne.sol | View function to see pending NTSs on frontend. | function pendingNTS(uint256 _pid, address _user) external view override returns (uint256 _pending, uint256 _potential) {
UserInfo storage user = userInfo[_pid][_user];
if(user.amount == 0){
return (0, 0);
}
PoolInfo storage pool = poolInfo[_pid];
uint256 userStart... | 8,954,348 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is ch... | user can convert CarbonUSD umbrella token into a whitelisted stablecoin. stablecoin represents the type of coin the users wishes to receive for burning carbonUSD _amount Amount of CarbonUSD to convert. we credit the user's account at the sender address with the _amount minus the percentage fee we want to charge./ Sen... | function convertCarbonDollar(address stablecoin, uint256 _amount) public userNotBlacklisted(msg.sender) whenNotPaused {
require(isWhitelisted(stablecoin), "Stablecoin must be whitelisted prior to setting conversion fee");
WhitelistedToken whitelisted = WhitelistedToken(stablecoin);
require(... | 1,020,298 |
pragma solidity ^0.4.19;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
... | DebugRange(_a, _b, _aTeam.attack, _aTeam.defense, _aTeam.stamina, _bTeam.attack, _bTeam.defense, _bTeam.stamina, maxRangeA, maxRangeB);DebugRange2(maxRangeA, maxRangeB);DebugRange2(maxRangeA, maxRangeB);DebugRange2(maxRangeA, maxRangeB); | function _battleTeam(BattleInfo _battleInfo, uint8[4][31] _gameScores, uint8[3][3][31] _gameBalls,
uint8[5][11][32] _playerBalls) internal returns (uint8 scoreA, uint8 scoreB) {
BattleTeam memory _aTeam = _battleInfo.teamInfos[_battleInfo.indexA];
BattleTeam memory _bTeam = _battleInfo.... | 5,523,898 |
./full_match/1/0xF507733f260a42bB2c8108dE87B7B0Ce5826A9cD/sources/src/fixed-strike/FixedStrikeOptionTeller.sol | Some fancy math to convert a uint into a string, courtesy of Provable Things. Updated to work with solc 0.8.0. https:github.com/provable-things/ethereum-api/blob/master/provableAPI_0.6.sol | function _uint2str(uint256 _i) internal pure returns (string memory) {
if (_i == 0) {
return "0";
}
uint256 j = _i;
uint256 len;
while (j != 0) {
len++;
j /= 10;
}
bytes memory bstr = new bytes(len);
uint256 k = len;... | 3,858,776 |
contract SHA3_512 {
function hash(uint64[8]) pure public returns(uint32[16]) {}
}
contract TeikhosBounty {
SHA3_512 public sha3_512 = SHA3_512(0xbD6361cC42fD113ED9A9fdbEDF7eea27b325a222); // Mainnet: 0xbD6361cC42fD113ED9A9fdbEDF7eea27b325a222,
... | Constructor funciton, runs when contract is deployed | function TeikhosBounty() public { | 4,815,575 |
./full_match/11155111/0x4Ac3832d773FE6B6dcC8EB6241B83212F1a55096/sources/contracts/discovery/GNS.sol | Returns account and sequence ID for a legacy subgraph (created before subgraph NFTs). _subgraphID Subgraph ID return account Account that created the subgraph (or 0 if it's not a legacy subgraph) return seqID Sequence number for the subgraph/ | function getLegacySubgraphKey(uint256 _subgraphID)
public
view
override
returns (address account, uint256 seqID)
{
LegacySubgraphKey storage legacySubgraphKey = legacySubgraphKeys[_subgraphID];
account = legacySubgraphKey.account;
seqID = legacySubgraphKey... | 3,811,923 |
// SPDX-License-Identifier: MIT
//
// Copyright (c) 2021 Kentaro Hara
//
// This software is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
pragma solidity ^0.8.11;
import "../JohnLawCoin.sol";
//------------------------------------------------------------------------------
// [Joh... | The sender does not have enough coins. Calculate the amount of ETH and JLC to be exchanged. Send ETH to the sender. This may trigger any arbitrary operations in an external smart contract. This must be called at the very end of sellCoins(). | function sellCoins_v2(uint requested_coin_amount)
public whenNotPaused returns (uint, uint) {
require(coin_v2_.balanceOf(msg.sender) >= requested_coin_amount,
"OpenMarketOperation: Your coin balance is not enough.");
uint elapsed_time = getTimestamp() - current_epoch_start_v2_;
... | 13,078,090 |
pragma solidity ^0.4.20;
/**
* @author FadyAro
*
* 22.07.2018
*
*
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {... | get the total number of user subscriptions user the specific user return user rounds size/ | function userRounds(address user) public view returns (uint) {
return _history[user].size;
}
| 6,355,278 |
./partial_match/1/0xFb27de6Ed15E20d84D9a6eC92e784E40587de768/sources/contracts/modules/PropsERC721UConfigPools.sol | see {IERC721Metadata}/ | function tokenURI(uint256 _tokenId)
public
view
virtual
override
returns (string memory)
{
require(
_exists(_tokenId),
"no token"
);
return string(abi.encodePacked(baseURI_, _tokenId.toString(), ".json"));
}
| 2,751,199 |
./partial_match/1/0x79241Fd23F74a5587D22E24795776159f5455569/sources/Proposal22.sol | allows governance to assign delegate to self/ | function _acceptGov()
override
external
{
require(msg.sender == pendingGov, "!pending");
address oldGov = gov;
gov = pendingGov;
pendingGov = address(0);
emit NewGov(oldGov, gov);
}
| 4,022,556 |
./full_match/43114/0x21a5e0Fc127C246030Fe12fd8bad711a06601A9b/sources/contracts/libraries/IncentiveId.sol | Calculate the key for a staking incentive key The components used to compute the incentive identifier return incentiveId The identifier for the incentive | function compute(IUniswapV3Staker.IncentiveKey memory key) internal pure returns (bytes32 incentiveId) {
return keccak256(abi.encode(key));
}
| 4,602,603 |
// SPDX-License-Identifier: Apache-2.0
// Copyright 2017 Loopring Technology Limited.
pragma solidity ^0.7.0;
/// @title Poseidon hash function
/// See: https://eprint.iacr.org/2019/458.pdf
/// Code auto-generated by generate_poseidon_EVM_code.py
/// @author Brecht Devos - <brecht@loopring.org>
library ... | Role system used a bit differently here. | function isValidSignature(
bytes32 signHash,
bytes memory signature
)
public
view
override
returns (bytes4)
{
return hasAccessTo(
signHash.recoverECDSASigner(signature),
this.isValidSignature.selector
) ? ER... | 2,137,941 |
./full_match/56/0xf36f3204c9B2583dF57B0A044d643983E824f7d3/sources/project_/contracts/rules/interactionRules/InvestorHasNTT.sol | the Owner of the smart contract can set the list of NTTtokens to check | function setNTTsToCheck(address[] calldata _nttsToUse) external onlyOwner {
nttTokenContracts = _nttsToUse;
}
| 3,233,798 |
pragma solidity^0.4.19;
import "menlo-token/contracts/MenloToken.sol";
// assumption: token upgrades through DappHub, such as https://etherscan.io/address/0x642ae78fafbb8032da552d619ad43f1d81e4dd7c#code
// assumption: token upgrades are 1:1
interface Redeemer {
function redeem() external;
function undo() exte... | assumption: token upgrades through DappHub, such as https:etherscan.io/address/0x642ae78fafbb8032da552d619ad43f1d81e4dd7ccode assumption: token upgrades are 1:1 | interface Redeemer {
function redeem() external;
function undo() external;
function to() external view returns (MenloToken);
function from() external view returns (MenloToken);
}
| 14,033,313 |
./full_match/1/0x10d88Ae63188987799772813778e3B697a5AE64A/sources/contracts/MCFToken.sol | Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have ... | function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAl... | 8,492,110 |
pragma solidity ^0.5.11;
pragma experimental ABIEncoderV2;
import './ForceMoveApp.sol';
contract ForceMove {
struct Signature {
uint8 v;
bytes32 r;
bytes32 s;
}
struct FixedPart {
uint256 chainId;
address[] participants;
uint256 channelNonce;
addres... | The hash is constructed from left to right. Shift turnNumRecord 208 bits left to fill the first 48 bits logical or with finalizesAt padded with 160 zeros to get the next 48 bits logical or with the last 160 bits of the hash of the encoded storage | function _hashChannelStorage(ChannelStorage memory channelStorage)
internal
pure
returns (bytes32 newHash)
{
uint256 result;
uint16 cursor = 256;
result = uint256(channelStorage.turnNumRecord) << (cursor -= 48);
result |= (channelStorage.finalizesAt << (... | 6,404,704 |
pragma solidity ^0.4.16;
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
owner = ne... | This generates a public event on the blockchain that will notify clients / Initializes contract with initial supply tokens to the creator of the contract / | function YumeriumToken() public {
}
| 14,561,064 |
./partial_match/3/0xD9ef7Fbc3655fE0A18A27e54B7eAcB67D70ED290/sources/culaRewards.sol | Excecutes a substraction operation to check if it is possible to exectute transfer | function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
| 5,337,936 |
/**
*Submitted for verification at Etherscan.io on 2021-01-13
*/
// File: @openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in ex... | Public callable function for claiming INCH rewards/ | function getRewardExternal() external {
_getReward();
}
| 7,653,630 |
./full_match/43114/0xE487a3780D56F2ECD142201907dF16350bb09946/sources/DssProxyActions.sol | / Exits token amount to the user's wallet as a token | function freeGem(
address manager,
address gemJoin,
address end,
uint cdp,
address res
) public {
uint amt = _free(manager, end, cdp) / 10 ** (18 - GemJoin(gemJoin).dec());
if (res == address(0)) {
GemJoin(gemJoin).exit(msg.sender, amt);
... | 4,579,883 |
./full_match/1/0xF74480d927D3D34dE74C861841FCaFA2f7701617/sources/contracts/ERC1155D.sol | xref:ROOT:erc1155.adocbatch-operations[Batched] version of {_safeTransferFrom}. Emits a {TransferBatch} event. Requirements: - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value./ | function _safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(
ids.length == amounts.length,
"ERC1155: ids and amounts length mismatch"
);
... | 16,400,104 |
//! The simple registry contract.
//!
//! Copyright 2016 Gavin Wood, Parity Technologies 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/license... | ReversibleRegistry views | function hasReverse(bytes32 _name)
external
view
whenEntryRaw(_name)
returns (bool)
{
return entries[_name].reverse != 0;
}
| 928,852 |
./full_match/43113/0x3a7D90487F8E6c8631317E1B812d020CE5bB1288/sources/src/libraries/math/TreeMath.sol | Returns the first bit in the given leaves that is strictly higher than the given bit. It will return type(uint256).max if there is no such bit. leaves The leaves bit The bit return The first bit in the given leaves that is strictly higher than the given bit/ | function _closestBitLeft(bytes32 leaves, uint8 bit) private pure returns (uint256) {
unchecked {
return uint256(leaves).closestBitLeft(bit + 1);
}
}
| 7,117,589 |
./full_match/1/0x39F05c39902A9b265Dcb4c59418657cDb9913C23/sources/contracts/nfts/ParallelAlphaInvokeProxy.sol | Called by the LayerZero endpoint when a message is sent _from The address that will have its tokens locked when bridging _tokenIds TokenIds to bridge _amounts Amount of tokens to bridge/ | function _debitFrom(
address _from,
uint16,
bytes memory,
uint256[] memory _tokenIds,
uint256[] memory _amounts
) internal virtual override {
if (_tokenIds.length > batchSizeLimit) {
revert ExceedsBatchSizeLimit();
}
if (
_... | 16,440,181 |
/*
website: yiff.farm
This project was forked from SUSHI, YUNO and KIMCHI projects.
Unless those projects have severe vulnerabilities, this contract will be fine
*/
pragma solidity ^0.6.12;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data.... | View function to see pending YIFFs on frontend. | function pendingYiff(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accYiffPerShare = pool.accYiffPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
... | 1,355,856 |
./partial_match/1/0x3735DA3c3f1d2156a0965109eB452212155EC1fE/sources/Taxable.sol | Function enables public interface for tax enabled/disabled boolean. | function taxed() public view virtual returns (bool) { | 2,695,395 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
/**
* @dev Interfaces for converter.
*/
interface IConverter {
function convert(address _from, address _to, uint256 _fromAmount, uint256 _toAmount) external;
}
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts-upgradea... | Updates the access of the account. Only owner can update access./ | function updateAccess(address _account, bool _approved) external onlyOwner {
approved[_account] = _approved;
emit AccessUpdated(_account, _approved);
}
| 11,943,422 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "./ERC721.sol";
contract RealEstateBidding is ERC721 {
// struct for each bid
struct Bid {
address bidAddress;
uint256 bidAmount;
}
//Struct for each bid process
struct SingleBidProcess {
address realtor;
... | Function to assign a realtor by owner | function assignRealtor(uint256 tokenId, address realtor) public {
require(
ownerOf(tokenId) == msg.sender,
"RealStatebidding: Can not assign for others token"
);
require(
ownerOf(tokenId) != address(0),
"RealStatebidding: No such token"
... | 1,801,626 |
pragma solidity 0.4.21;
pragma experimental "v0.5.0";
interface Token {
function totalSupply() external returns (uint256);
function balanceOf(address) external returns (uint256);
function transfer(address, uint256) external returns (bool);
function transferFrom(address, address, uint256) external returns (bool... | Change the market status of DEX. | function changeMarketStatus(uint8 status_) external {
if (msg.sender != admin) revert();
marketStatus = status_;
emit ChangeMarketStatusEvent(status_);
}
| 6,262,517 |
pragma solidity ^0.4.23;
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "../../common/interfaces/ISettingsRegistry.sol";
import "../../common/SettingIds.sol";
contract Fr... | setup data update dividend tracker fire event | function withdrawDividends() public
{
address _customerAddress = msg.sender;
uint256 _dividends = dividendsOf(_customerAddress);
ringPayoutsTo[_customerAddress] += (int256) (_dividends * magnitude);
address ring = registry.addressOf(SettingIds.CONTRACT_RING_ERC20_TOKEN)... | 958,887 |
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity >=0.7.0 <0.9.0;
import "./base/ModuleManager.sol";
import "./base/OwnerManager.sol";
import "./base/FallbackManager.sol";
import "./base/GuardManager.sol";
import "./common/EtherPaymentFallback.sol";
import "./common/Singleton.sol";
import "./common/SignatureDe... | Marks a hash as approved. This can be used to validate a hash that is used by a signature. hashToApprove The hash that should be marked as approved for signatures that are verified by this contract./ | function approveHash(bytes32 hashToApprove) external {
require(owners[msg.sender] != address(0), "GS030");
approvedHashes[msg.sender][hashToApprove] = 1;
emit ApproveHash(hashToApprove, msg.sender);
}
| 431,264 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./SigToken.sol";
/**
* @title FeeAdminV1D... | Try to exchange SIG token for one of stablecoins sellSigAmount - amount of SigToken buyTokenId - number of stablecoins, by default 0,1 or 2 for DAI, USDC or USDT buyAtLeastAmount - if there's not enough balance, buy at least specified amount of stablecoin if it's 0 - transaction will be rev... | function sellSigForStablecoin(uint256 sellSigAmount, uint256 buyTokenId, uint256 buyAtLeastAmount) public {
uint256 sig1e18Price = getSig1e18Price(block.number, buyTokenId);
uint256 outputAmount = sellSigAmount.mul(sig1e18Price).div(1e18);
if (IERC20(coins[buyTokenId]).balanceOf(address(this... | 573,097 |
./full_match/80001/0xb897aeC5F100C906B859D7f1D307DdBeDE002F2A/sources/project_/contracts/NFTMarketPlace.sol | transferOwner payable(owner).transfer(); removed becuase we need to remove the fees from frontend | function transferOwner(
address nftContract,
address receiverAddress,
uint256 nftItemId
) public payable nonReentrant {
uint256 tokenId = idForMarketItem[nftItemId].tokenId;
IERC721(nftContract).transferFrom(
address(this),
receiverAddress,
... | 5,575,803 |
// SPDX-License-Identifier: MIT License
pragma solidity 0.8.10;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency sto... | Allows a CryptoPhunk owner to offer it for sale to a specific address / | function offerPhunkForSaleToAddress(uint phunkIndex, uint minSalePriceInWei, address toAddress) public whenNotPaused nonReentrant() {
if (phunkIndex >= 10000) revert();
if (phunksContract.ownerOf(phunkIndex) != msg.sender) revert('you are not the owner of this token');
phunksOfferedForSale[p... | 15,795,821 |
./partial_match/3/0xc7920b800569AC8895e1a0bA3869B6ddF56717e3/sources/PoR.sol | Extracts the value from the output in a tx Value is an 8-byte little-endian number _output The output return The output value | function extractValue(bytes memory _output) internal pure returns (uint64) {
bytes memory _leValue = extractValueLE(_output);
bytes memory _beValue = reverseEndianness(_leValue);
return uint64(bytesToUint(_beValue));
}
| 5,220,564 |
./full_match/1/0x29F933645F8086719236825A28d04D8A055D98dB/sources/_arbitrum/token-bridge-contracts/contracts/tokenbridge/ethereum/gateway/L1ArbitrumGateway.sol | Only excess gas is refunded to the _refundTo account, l2 call value is always returned to the _to account/ We make this function virtual since outboundTransfer logic is the same for many gateways but sometimes (ie weth) you construct the outgoing message differently. msg.value is sent, but 0 is set to the L2 call value... | function createOutboundTxCustomRefund(
address _refundTo,
address _from,
uint256, /* _tokenAmount */
uint256 _maxGas,
uint256 _gasPriceBid,
uint256 _maxSubmissionCost,
bytes memory _outboundCalldata
) internal virtual returns (uint256) {
return
... | 8,380,376 |
./full_match/4/0xb8dE86fEF02D3b5225DC71b3Ddc8ec01c0711853/sources/contracts/HauntooBreeding.sol | Internal check to see if a given sire and matron are a valid mating pair for breeding via auction (i.e. skips ownership and siring approval checks). | function _canBreedWithViaAuction(uint256 _matronId, uint256 _sireId)
internal
view
returns (bool)
{
Hauntoo storage matron = hauntoos[_matronId];
Hauntoo storage sire = hauntoos[_sireId];
return _isValidMatingPair(matron, _matronId, sire, _sireId);
}
| 12,509,906 |
./full_match/1/0xE0fC587E1F56b5968a7d5DC3667bA1f385fddb38/sources/contracts/TermRepoToken.sol | Calculates the total USD redemption value of all outstanding TermRepoTokens return totalRedemptionValue The total redemption value of TermRepoTokens in USD | function totalRedemptionValue() external view returns (uint256) {
uint256 totalValue = truncate(
mul_(
)
);
return totalValue;
}
| 9,687,058 |
/// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppe... | The starting point of the contract, which defines the initial values This is an upgradeable contract, DO NOT have constructor, and use this function for initialization of this and inheriting contracts | function initialize()
initializer
public
{
__Pausable_init();
__AccessControl_init();
__UUPSUpgradeable_init();
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
_setupRole(PAUSER_ROLE, msg.sender);
_setupRole(UPGRADER_ROLE, msg.sender);
downVo... | 7,267,473 |
./full_match/56/0xa83B3E821F6CF63Cde35c9aC7012c00bF57a438D/sources/contracts/NewAlver.sol | Disable the GREED mode | function disableGREED() external authorized {
GREEDTriggeredAt = 0;
}
| 3,245,854 |
pragma solidity ^0.4.24;
import "./Asset.sol";
import "./Events.sol";
contract StakeInterface {
function calculateStakeTokens(uint _itemCost) public returns (uint _stakeToken);
}
contract TokenInterface {
function transferFrom(address _from, address _to, uint _value) public returns (bool);
function balan... | Getter function. returns token contract address | function getBalance(address _wallet) public returns (uint) {
TokenInterface tokenContract = TokenInterface(satToken);
return tokenContract.balanceOf(_wallet);
}
| 2,565,415 |
./full_match/4/0x29d932Ccd887860f8f29c15fD7f09D5Bd82080e8/sources/util/ABDKMath64x64.sol | Calculate x - y. Revert on overflow. x signed 64.64-bit fixed point number y signed 64.64-bit fixed point number return signed 64.64-bit fixed point number/ | function sub (int128 x, int128 y) internal pure returns (int128) {
unchecked {
int256 result = int256(x) - y;
require (result >= MIN_64x64 && result <= MAX_64x64);
return int128 (result);
}
}
| 717,074 |
pragma solidity >=0.5.10;
import "ROOT/0x/utils/contracts/src/LibSafeMath.sol";
library LibFractions {
using LibSafeMath for uint256;
/// @dev Safely adds two fractions `n1/d1 + n2/d2`
/// @param n1 numerator of `1`
/// @param d1 denominator of `1`
/// @param n2 numerator of `2`
/// @param ... | Rescales a fraction to prevent overflows during addition if either the numerator or the denominator are > 2 127. numerator The numerator. denominator The denominator. return scaledNumerator The rescaled numerator. return scaledDenominator The rescaled denominator. | function normalize(
uint256 numerator,
uint256 denominator
)
internal
pure
returns (
uint256 scaledNumerator,
uint256 scaledDenominator
)
{
return normalize(numerator, denominator, 2 ** 127);
}
| 1,041,018 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import './Roc.sol';
import '@openzeppelin/contracts/utils/Strings.sol';
import './Randomize.sol';
import './Trignometry.sol';
/**
* @title RocRenderer
* @notice Renderer for roc-male-gen0
* @author Tfs128.eth (@trickerfs128)
*/
contract RocRenderer {
... | get skin by generating random Lines and filling with random colors/ | function _getSkin(Randomize.Random memory random)
internal
pure
returns(bytes memory) {
bytes memory lines = abi.encodePacked(
"<rect width='200' height='200' fill='hsl(",
random.next(1, 360).toString(),
" ",
random.next(1, 100).toString(),
... | 14,771,333 |
./full_match/4/0x8de75F203346bb6232478A40AC7E183a0C8E6A68/sources/contracts/test.sol | Send balance of contract to address referenced in `vault` | function withdraw() external payable onlyOwner {
require(vault != address(0), 'Vault Invalid');
require(payable(vault).send(address(this).balance));
}
| 673,818 |
./full_match/5/0x0840602fe76d523db09c1246FA5c021BF006de36/sources/contracts/CrowdFunding.sol | TODO write delete campaign | function deleteCampaign(uint256 campaignId) public returns(Campaign[] memory){
Campaign[] memory allCampaigns = new Campaign[](NumberOfCampaigns);
delete allCampaigns[campaignId];
NumberOfCampaigns--;
return allCampaigns;
}
| 7,064,252 |
./full_match/83/0xFFE4480A22eB3A42ECE67A196933eb2A180c4876/sources/contracts/BaseV1-periphery.sol | performs chained getAmountOut calculations on any number of pairs | function getAmountsOut(uint256 amountIn, route[] memory routes)
public
view
returns (uint256[] memory amounts)
{
require(routes.length >= 1, "BaseV1Router: INVALID_PATH");
amounts = new uint256[](routes.length + 1);
amounts[0] = amountIn;
for (uint256 i = ... | 9,560,990 |
./full_match/100/0xD3794DABFfcc9581B3c76b963e0A7e9e3e764EaE/sources/contracts/rollup/facets/RollupAdmin.sol | this skips deadline, staker and zombie validation | function forceConfirmNode(
uint256 nodeNum,
bytes32 beforeSendAcc,
bytes calldata sendsData,
uint256[] calldata sendLengths,
uint256 afterSendCount,
bytes32 afterLogAcc,
uint256 afterLogCount
) external override whenPaused {
confirmNode(
... | 14,280,776 |
./full_match/42/0x725DDa8A778B507bA02a7F56146a2D5D7f5740CE/sources/home/didi/src/sf/streaming-faucet/contracts/StreamingFaucet.sol | stops the stream to the message sender if open (useful for testing, otherwise not needed) | function stopStream() external {
address receiver = msg.sender;
_sfHost.callAgreement(
_cfa,
abi.encodeWithSelector(
_cfa.deleteFlow.selector,
token,
address(this),
receiver,
new bytes(0)
... | 9,598,164 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*pragma solidity >=0.6.0 <0.8.0;*/
import "contracts/IVote.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
/*import "IVote.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeMath.sol";
*/
/**
... | See {IVote} interface. | function Vote_Hashed(bytes32 key, bytes32 Hash) external override{
require(Ballots[key].Status == Ballot_Status.VOTE, "Not at voting stage");
require(!Ballots[key].Voters[msg.sender].Voted, "Already Voted");
require(Check_Voter_Address(key, msg.sender), "Address Not Allowed");
requir... | 1,043,587 |
./full_match/25/0xBf0Ca142dE65250c38B9C682c5Dd51d56E18dF6A/sources/gist-c1eb4b41642a69b5a7232840482b6e91/IERC721.sol | Required interface of an ERC721 compliant contract./ | interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
function ba... | 16,382,404 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.