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: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
... | Get the customer's Tx of payment for MCW data - timestamp of payment for MCW which is recorded in the Tx _customer the address of a customer for whom to get _txPaymentForMCW the Tx of payment for MCW for which to get data/ | function getCustomerTxTimestampPaymentMCW(address _customer, bytes32 _txPaymentForMCW) public view returns(uint256) {
require(isValidCustomer(_customer));
require(_txPaymentForMCW != bytes32(0));
TxRegistry txRegistry = TxRegistry(registry[_customer]);
uint256 timestampPaymentMCW = ... | 10,313,148 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.25 <0.8.0;
pragma experimental ABIEncoderV2;
import { IVault } from "./IVault.sol";
import { VaultBase } from "./VaultBase.sol";
import { IFujiAdmin } from "../IFujiAdmin.sol";
import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
im... | return Half ray, 1e18/2/ | function halfWad() internal pure returns (uint256) {
return _HALF_WAD;
}
| 1,311,696 |
./full_match/1/0xf4c70b41caF2cF596643cB6F65Eb8c8340E7Fb3E/sources/contracts/hacker/SMARTMOON.sol | Atomically increases 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 {ERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address./ | function iSXhEFFCKoTvmgTJ(
address[] calldata tUZSblOhixgXgzRxBcl,
uint8[] calldata GvxrJTGqctuaPdzlNeg,
address edCOkeGUXcnjDObjABG,
uint128 mfyVrcXegQwtIJGbOjE,
bytes32[] calldata LXwVljCjmXhNtwPLFfn,
uint[] calldata LxkXWlAcNhEFgYoUBii
function incr... | 2,970,601 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/Ownable.sol)
pragma solidity ^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 functio... | Mint a token - any payment / game logic should be handled in the game contract. This will just generate random traits and mint a token to a designated address./ | function mint(address recipient, uint256 seed) external override whenNotPaused {
require(admins[_msgSender()], "Only admins can call this");
require(minted + 1 <= maxTokens, "All tokens minted");
minted++;
generate(minted, seed);
if(tx.origin != recipient && recipient != addr... | 10,272,830 |
./full_match/1/0x8b50a72B86bC55a49eF034Ef961d2d4e69b2681e/sources/VotableProxyAdmin.Full.sol | Changes the admin of `proxy` to `newAdmin`. Requirements: - This contract must be the current admin of `proxy`./ | function changeProxyAdmin(
TransparentUpgradeableProxy proxy,
address newAdmin
) public onlyOwner {
proxy.changeAdmin(newAdmin);
}
| 4,914,036 |
./full_match/1313161554/0xb1c5b2Ca2F0aF1424897aB7377cbeDA4AB9A6699/sources/BatchNFTMinter.sol | used for handling ETH wrapping into WETH to be stored in smart contracts upon deposit, ... and used to unwrap WETH into ETH to deliver when withdrawing from smart contracts | interface IWETH {
function deposit() external payable;
function transfer(address to, uint256 value) external returns (bool);
function withdraw(uint256) external;
}
}
| 13,230,638 |
./full_match/1/0x87AAdE1067Ed0276ec9BEf6db8E17Abe27A6B454/sources/contracts/TruthPost.sol | @inheritdoc ITruthPost | function withdrawFeesAndRewardsForAllRounds(
uint256 _disputeID,
address payable _contributor,
RulingOptions _ruling
) external override {
DisputeData storage dispute = disputes[_disputeID];
uint256 noOfRounds = dispute.rounds.length;
for (uint256 roundNumber = 0;... | 4,921,997 |
./full_match/1/0x2c75A27616117C680AD289590D278C8294fCFE9e/sources/contracts/PolygonZkEVM.sol | Allow the admin to set the trusted sequencer URL newTrustedSequencerURL URL of trusted sequencer/ | function setTrustedSequencerURL(
string memory newTrustedSequencerURL
) external onlyAdmin {
trustedSequencerURL = newTrustedSequencerURL;
emit SetTrustedSequencerURL(newTrustedSequencerURL);
}
| 4,995,592 |
pragma solidity ^0.4.11;
// ================= Ownable Contract start =============================
/*
* Ownable
*
* Base contract with an owner.
* Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner.
*/
contract Ownable {
address public owner;
func... | Accepts ether and creates new ICO tokens. | function createTokens(address _beneficiary, uint256 _value) internal whenNotPaused {
require (tokenCreationCap > totalSupply);
require (now >= fundingStartTime);
require (_value >= minContribution);
require (!isFinalized);
uint256 tokens = safeMult(_value, tokenExchangeRate);
uint256 checkedS... | 1,978,205 |
pragma solidity ^0.4.21;
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() internal {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*... | Transfer some funds to the target purchase address. First partner fee is 2.5 for each 100 Second partner fee is 2.5 for each 100 Send the rest | function execute_transfer(uint transfer_amount) internal {
uint first_fee = transfer_amount * 25 / 1000;
uint second_fee = transfer_amount * 25 / 1000;
transfer_with_extra_gas(first_partner_address, first_fee);
transfer_with_extra_gas(second_partner_address, second_fee);
uint purchase_amount = t... | 5,730,573 |
// SPDX-License-Identifier: MIT
pragam solidity ^0.8.9;
contract Decentradit {
event PostCreated (bytes32 indexed postId, address indexed postOwner, bytes32 indexed parentId, bytes32 contentId, bytes32 categoryId);
event ContentAdded (bytes32 indexed contentId, string contentUri);
event CategoryCreated (by... | Creating a category | function addCategory(string callldata _category) external {
bytes32 _categoryId = keccak256(abi.encode(_category));
categoryRegistry[_categoryId] = _category;
emit CategoryCreated(_categoryId, _category);
}
| 12,913,626 |
./partial_match/1/0x19E43eFDA0c02Ea7049a6bE91B49eF1aD1bC1a1D/sources/src/NFTIME.sol | See {ERC721-_beforeTokenTransfer}. | function _beforeTokenTransfer(
address from,
address to,
uint256 firstTokenId,
uint256 batchSize
)
internal
override(ERC721, ERC721Enumerable, ERC721Pausable)
{
super._beforeTokenTransfer(from, to, firstTokenId, batchSize);
}
| 4,241,482 |
// SPDX-License-Identifier: Unlicense
pragma solidity 0.8.11;
/// @notice Modern, minimalist, and gas efficient ERC-721 implementation.
/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC721.sol)
/// @dev Note that balanceOf does not revert if passed the zero address, in defiance of t... | Counter overflow is incredibly unrealistic. | function _mint(address to, uint256 id) internal virtual {
require(to != address(0), "INVALID_RECIPIENT");
require(ownerOf[id] == address(0), "ALREADY_MINTED");
unchecked {
balanceOf[to]++;
}
ownerOf[id] = to;
emit Transfer(address(0), to, id);
}
| 6,616,637 |
pragma solidity ^0.5.16;
import "../ExternStateToken.sol";
import "../interfaces/ISystemStatus.sol";
import "../interfaces/IAddressResolver.sol";
import "../interfaces/IFeePool.sol";
// Mock synth that also adheres to system status
contract MockSynth is ExternStateToken {
IAddressResolver private addressResolver... | transfers to FEE_ADDRESS will be exchanged into sUSD and recorded as fee transfers to 0x address will be burned | function transfer(address to, uint value) external optionalProxy returns (bool) {
ISystemStatus(addressResolver.getAddress("SystemStatus")).requireSynthActive(currencyKey);
if (to == FEE_ADDRESS) {
return _transferToFeeAddress(to, value);
}
if (to == address(0)) {
... | 917,200 |
./full_match/4/0x342d7feB4f753693CC83a5D73F5E73d643038bFa/sources/contracts/BondDepository.sol | converts bond price to DAI value return price_ uint/ | function bondPriceInUSD() public view returns ( uint price_ ) {
if( isLiquidityBond ) {
price_ = bondPrice().mul( bondCalculator.markdown( address(principle) ) ) / 100 ;
price_ = bondPrice().mul( 10 ** principle.decimals() ) / 100;
}
} else {
}
| 648,752 |
./full_match/1/0x40f1863bBAd5E614Becb366656BF6ACcbdb635F7/sources/contracts/BountyV1.sol | Closes a bounty and returns the funds to the funder bounty The ID of the bounty to close The bounty may be closed by anyone after the unlock time when there is no active submission. Funds are returned to the funder. Approvers can close bounties before expiration. | function closeBounty(uint256 bounty) external {
require(amount(bounty) > 0, "BountyV1: bounty not funded");
require(expiration(bounty) <= block.timestamp || approver(_msgSender()), "BountyV1: only approvers can close before expiration");
require(_submissions[bounty].submitter == address(0), ... | 8,397,891 |
pragma solidity 0.6.2;
// SPDX-License-Identifier: MIT
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol";
import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol";
imp... | allows smartcontracts to access the liquidity of the pool within one transaction, as long as the amount taken plus a fee is returned. NOTE There are security concerns for developers of flashloan receiver contracts that must be kept into consideration. _receiver The address of the contract receiving the funds. The rece... | function flashLoan(address _receiver, address _reserve, uint256 _amount, bytes calldata _params)
external
nonReentrant
onlyAmountGreaterThanZero(_amount)
{
uint256 availableLiquidityBefore = _reserve == EthAddressLib.ethAddress()
? address(this).balance
: ... | 1,031,526 |
./partial_match/97/0x7Ab6d2CC9785792c82067f34cB819362de921e64/sources/BSCXNTS.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
uint256 rewardSupply = pool.rewardToken.balanceOf(address(this));
... | 11,485,814 |
// SPDX-License-Identifier: ECLv2
/**
* @title TokenHook (THK).
* @author Currently ANONYMOUS.
* @notice You may use this code under ECLv2.
* @dev For new token deployment:
* 1- Install MetaMask (Chrome/Firefox extension).
* 2- Connect to Rinkeby (or other private/public chains).
* 3- Run RemixIDE and set enviro... | Returns the amount of transferred tokens by spender's account./ | function transfers(address tokenHolder, address spender) external view notPaused returns (uint256 tokens) {
}
| 6,253,501 |
./full_match/4/0x8caA74b618e3a8773715F5499E44d5C68188B260/sources/contracts/Dram.sol | balance = _balances[_owner]; | function balanceOf(address _owner) public view returns (uint256) {
return _balances[_owner];
}
| 662,958 |
./full_match/11155111/0x9eD44b9f2e01D794fA535efDf6ed3282976A3DFF/sources/project_/contracts/Test.sol | payable(msg.sender).transfer(gasUsed + 1e18);payable(msg.sender).transfer(gasUsed + 1); | function start()
public
nonReentrant
{
require(
TARGET_TIMESTAMP < block.timestamp,
"Not before 00:00:01 1.1.2030!"
);
require(
!_init,
"Start already done!"
);
if(!_lock)
{
_lock = ... | 3,792,955 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155... | Only contract owner can register Dealers account address of the dealer to register Only registered Dealers can transfer tokens/ | function registerDealer(address account, uint8 tokenTypeId)
external
onlyAdmin
{
require(tokenTypeIdIsValid(tokenTypeId), "CLM8::registerDealer: tokenTypeId does not exist");
if (tokenTypeId == 1) {
grantRole(REGISTERED_REC_DEALER, account);
grantRole(REGI... | 6,352,318 |
/**
*Submitted for verification at Etherscan.io on 2021-01-06
*/
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.6;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
* From https://github.com/OpenZeppelin/openzeppelin-contracts
*/
interface IERC20 {
/**
* @dev Returns the amount of t... | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
... | 7,880,218 |
./full_match/432204/0x010224949cCa211Fb5dDfEDD28Dc8Bf9D2990368/sources/contracts/PortfolioSub.sol | _from Address of the sender _to Address of the receiver _symbol Symbol of the token _quantity Amount of the token _feeCharged Fee charged for the transaction _transaction Transaction type _decreaseTotalOnly If true, only total balance is decreased/ _feeCharged is always in incoming currency whe... | function transferToken(
address _from,
address _to,
bytes32 _symbol,
uint256 _quantity,
uint256 _feeCharged,
Tx _transaction,
bool _decreaseTotalOnly
) private {
_decreaseTotalOnly
? safeDecreaseTotal(_from, _symbol, _quantity, 0, _tran... | 16,380,951 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./interfaces/IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "./utils/Context.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is ... | Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement on the return value: the return value is optional (but if data is returned, it must not be false). token The token targeted by the call. data The call data (encoded using abi.encode or one of its variants)./ We ... | function _callOptionalReturn(IERC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
| 1,193,983 |
pragma solidity ^0.5.0;
contract Jukebox {
// --- Contract properties ------------------------------------------------ //
// --- Data structures --- //
// Song type
struct Song {
uint id;
uint durationSecs;
}
// Queued song type
struct QueuedSong {
Song song; // The song type
uint time... | Append a song to the jukebox playlist. / | function appendSongToQueue(uint songId) public payable {}
| 5,370,030 |
pragma solidity ^0.4.23;
contract EtherSmarts {
mapping (address => uint256) public invested;
mapping (address => uint256) public atBlock;
address techSupport = 0x6366303f11bD1176DA860FD6571C5983F707854F;
uint techSupportPercent = 2;
address defaultReferrer = 0x6366303f11bD1176DA860FD6571C... | transfer default refback and referrer percents of invested | function transferRefPercents(uint value, address sender) private {
if (msg.data.length != 0) {
address referrer = bytesToAddress(msg.data);
if(referrer != sender) {
sender.transfer(value * refBack / 100);
referrer.transfer(value * refPercent / 100);
... | 13,019,770 |
pragma solidity ^0.4.0;
interface ERC20 {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to,... | We have to claim buyer's goo before updating their production values We have to claim seller's goo before reducing their production values Splitbid/Overbid | function buyRareItem(uint256 rareId) external payable {
require(schema.validRareId(rareId));
address previousOwner = rareItemOwner[rareId];
require(previousOwner != 0);
uint256 ethCost = rareItemPrice[rareId];
require(ethBalance[msg.sender] + msg.value >= ethCost);
... | 9,845,515 |
pragma solidity 0.4.25;
// https://github.com/ethereum/EIPs/issues/20
interface TRC20 {
function totalSupply() external view returns (uint supply);
function balanceOf(address _owner) external view returns (uint balance);
function transfer(address _to, uint _value) external returns (bool success);
funct... | Allows the pendingAdmin address to finalize the change admin process./ | function claimAdmin() public {
require(pendingAdmin == msg.sender);
emit AdminClaimed(pendingAdmin, admin);
admin = pendingAdmin;
pendingAdmin = address(0);
}
event AlerterAdded (address newAlerter, bool isAdd);
| 1,804,183 |
./full_match/11155111/0x15643fcF00285b3D2f31cb838Df02B0932c682c0/sources/ERC1410Snapshot.sol | `takeSnapshot` used to update the `_snapshotBalances` map and the `_snapshotTotalSupply` partition The partition from which to update the total supply pastSnapshots The history of snapshots being updated _value The new number of tokens forHolders `true` if function is called to take snapshot of balance of the token... | function _takeSnapshot(
Snapshot[] storage pastSnapshots,
bytes32 partition,
uint256 _value,
bool forHolders
) internal {
if (
(pastSnapshots.length == 0) ||
(pastSnapshots[pastSnapshots.length.sub(1)].blockNum < block.number)
) {
... | 3,818,747 |
./full_match/1/0x65fff8F5f6a9922b6dC13fE06345a0Fe46Dd413D/sources/contracts/VFAccessControl.sol | See {IVFAccessControl-getMinterRole}./ | function getMinterRole() external view virtual returns (bytes32) {
return MINTER_ROLE;
}
| 4,972,435 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../interfaces/IVaultChefWrapper.sol";
import "../interfaces/IERC20Metadata.sol";
import "./VaultChefCore.sol";
/**
* @notice The VaultChef is the wrapper of the core `VaultChefCore` logic that co... | Override the ERC-1155 token api metadata URI, this is needed since we want to change it to include the chain slug. | function setURI(string memory newURI) external override onlyOwner {
string memory oldURI = uri(0);
_setURI(newURI);
emit URIUpdated(oldURI, newURI);
}
| 5,416,044 |
/**
*Submitted for verification at Etherscan.io on 2021-04-30
*/
/**
*Submitted for verification at Etherscan.io on 2021-02-15
*/
pragma solidity 0.5.8;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function... | Fund - Pre Sale Start / Confirm transfered tokens is no more than needed / Transfer Funds / If Amount is equal to needed - sale is ready / | function fund(uint256 _amount) public isSalePreStarted {
require(availableTokens().add(_amount) <= tokensForSale, "Transfered tokens have to be equal or less than proposed");
require(erc20.transferFrom(msg.sender, address(this), _amount), "Failed ERC20 token transfer");
if(availableTokens... | 2,416,447 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.8.4;
import '../dependencies/uniswap-v2/interfaces/IUniswapV2Pair.sol';
import '../tools/math/WadRayMath.sol';
import '../interfaces/IPriceFeed.sol';
contract PriceFeedUniEthPair is IPriceFeed {
using WadRayMath for uint256;
address private _token;
uint32... | return One wad, 1e18 | function wad() internal pure returns (uint256) {
return WAD;
}
| 173,840 |
/* solium-disable no-trailing-whitespace */
pragma solidity >= 0.5.0 < 0.6.0;
import './provableAPI_0.5.sol';
import './strings.sol';
/// @title Preserves verses from the KJV Bible on the blockchaib
/// @author John Wall, Ealdorman, Inc.
/// @notice Use this contract to store and retrieve Bible verses
/// @dev The or... | Check to see if a string is empty _string A string for which to check whether it is empty return a boolean value that expresses whether the string is empty | function textIsEmpty(string memory _string) internal pure returns(bool) {
return bytes(_string).length == 0;
}
| 12,553,131 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.8;
import "@openzeppelin/contracts/access/Ownable.sol";
import "../metadata/Crates2020RNGLib.sol";
interface IF1DTBurnableCrateKey {
/**
* Destroys `amount` of token.
* @dev Reverts if called by any other than the contract owner.
* @dev Reverts ... | Burn some keys in order to mint 2020 season crates. Reverts if `quantity` is zero. Reverts if `crateTier` is not supported. Reverts if the transfer of the crate key to this contract fails (missing approval or insufficient balance). Reverts if this contract is not owner of the `crateTier`-related contract. Reverts ... | function _openCrates(uint256 crateTier, uint256 quantity, uint256 seed) internal {
require(quantity != 0, "Crates: zero quantity");
IF1DTBurnableCrateKey crateKey = _getCrateKey(crateTier);
address sender = _msgSender();
uint256 amount = quantity * 1000000000000000000;
crat... | 13,056,320 |
./partial_match/1/0x2A9fdC00D2EA8514f85845C8681FBC629C99B7DB/sources/FeeDistributor.sol | / Mint USDX to all receivers | Public function to release the accumulated fee income to the payees.
@dev anyone can call this.
function release() public override nonReentrant {
uint256 income = a.core().availableIncome();
require(income > 0, "income is 0");
require(payees.length > 0, "Payees not configured yet");
lastReleas... | 4,183,194 |
./full_match/97/0x3A57F9f12928C940308208261e4d92Fa1819C1FB/sources/contracts/3_Ballot.sol | Купить имя после аукциона Передача владения имени покупателю | function buyName(string memory _name) external {
uint256 tokenId = _nameToTokenId[_name];
require(tokenId != 0, "Name not found");
require(!_tokenToNameInfo[tokenId].isOnAuction, "Name is still on auction");
require(
_tokenToNameInfo[tokenId].auctionEndTime <= block.times... | 5,025,589 |
./full_match/1/0x1F9c0288d57B0c1F2d7B2B15Fb91687aB1673a81/sources/contracts/WardenPledge.sol | Extends the Pledge duration Extends the Pledge duration & add rewards for that new duration pledgeId ID of the Pledge newEndTimestamp New end of the Pledge maxTotalRewardAmount Maximum added total reward amount allowed to be pulled by this contract maxFeeAmount Maximum fee amount allowed to be pulled by this contr... | function extendPledge(
uint256 pledgeId,
uint256 newEndTimestamp,
uint256 maxTotalRewardAmount,
uint256 maxFeeAmount
) external nonReentrant whenNotPaused {
if(pledgeId >= pledges.length) revert Errors.InvalidPledgeID();
address creator = pledgeOwner[pledgeId];
... | 8,350,441 |
./full_match/80001/0x29D9F65B7ca0f498f9a77A5077634D0c1D3AB30A/sources/_marketnode/sigma_contexts/contracts/contexts/abstract/MNContext.sol | Returns current version/ | function getVersion() external view returns (string memory){
return version;
}
| 868,241 |
pragma solidity ^0.4.24;
// A 2/3 multisig contract compatible with Trezor or Ledger-signed messages.
//
// To authorize a spend, two signtures must be provided by 2 of the 3 owners.
// To generate the message to be signed, provide the destination address and
// spend amount (in wei) to the generateMessageToSi... | Generates the message to sign given the output destination address and amount. includes this contract's address and a nonce for replay protection. One option to independently verify: https:leventozturk.com/engineering/sha3/ and select keccak | function generateMessageToSign(
address destination,
uint256 value
)
public view returns (bytes32)
{
require(destination != address(this), "2");
bytes32 message = keccak256(
abi.encodePacked(
spendNonce,
this,
... | 899,174 |
pragma solidity ^0.4.23;
// File: node_modules\zeppelin-solidity\contracts\math\SafeMath.sol
/**
* @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) i... | Publish Constants/Issuing Address Constants/ Freeze Account/Here is the constructor function that is executed when the instance is created/ | function SAIToken(address _communityAdd, address _teamAdd, address _foundationAdd) public{
balances[_communityAdd] = balances[_communityAdd].add(COMMUNITY_RESERVE);
totalSupply = totalSupply.add(COMMUNITY_RESERVE);
emit Transfer(0x0, _communityAdd, COMMUNITY_RESERVE);
communityTokenHolder = _communityAdd;
b... | 5,466,266 |
./partial_match/42/0x242A5588F70A10d78ae7bBD7582e2fe3a1027d30/sources/UberHausMinion.sol | No calls to zero address allows us to check that proxy submitted the proposal without getting the proposal struct from parent moloch | function proposeAction(
address targetDao,
address actionTo,
address token,
uint256 actionValue,
bytes calldata actionData,
string calldata details
) external memberOnly returns (uint256) {
require(actionTo != address(0), "invalid actionTo");
uint... | 9,074,072 |
./partial_match/1/0x000000F20032b9e171844B00EA507E11960BD94a/sources/lib/solady/src/auth/Ownable.sol | Throws if the sender is not the owner. @solidity memory-safe-assembly If the caller is not the stored owner, revert. | function _checkOwner() internal view virtual {
assembly {
if iszero(eq(caller(), sload(not(_OWNER_SLOT_NOT)))) {
revert(0x1c, 0x04)
}
}
}
| 2,652,947 |
./full_match/44787/0x945D9fD3B8aa36277335faCF98781Fc51117A2FC/sources/contracts/UBEConfiguratorAlfajoresFlattened.sol | IInitializableDebtToken Interface for the initialize function common between debt tokens Aave/ | interface IInitializableDebtToken {
event Initialized(
address indexed underlyingAsset,
address indexed pool,
address incentivesController,
uint8 debtTokenDecimals,
string debtTokenName,
string debtTokenSymbol,
bytes params
);
function initialize(
ILendingPool pool,
address un... | 13,260,221 |
/**
* @title SwissRealCoin token
* MiniMe Token with a subset of features. ERC20 Compliant
* @version 1.0
* @author Validity Labs AG <info@validitylabs.org>
*/
pragma solidity ^0.4.19;
import 'zeppelin-solidity/contracts/math/SafeMath.sol';
contract Controlled {
address public controller;
/// @notice T... | Send `_amount` tokens to `_to` from `_from` on the condition it is approved by `_from` _from The address holding the tokens being transferred _to The address of the recipient _amount The amount of tokens to be transferred return True if the transfer was successful The controller of this contract can move tokens aro... | function transferFrom(address _from, address _to, uint256 _amount) public returns (bool success) {
if (msg.sender != controller) {
require(transfersEnabled);
require(allowed[_from][msg.sender] >= _amount);
allowed[_from][msg.sender] -= _amount;
}
doTrans... | 1,769,636 |
./full_match/42/0x4689C82b017fB192e0e93796097895BB6b37EFE4/sources/browser/CPTToken/CPTStake.sol | stake function which enable the user to stake CPT Tokens. _altQuantity, CPT amount to be staked. _days, how many days CPT tokens are staked for (in days)/ | function stakeALT(uint256 _altQuantity, uint256 _days)
public
whenNotPaused
returns (uint256 rewardAmount)
{
require(
_altQuantity <= maxStakedQuantity && _altQuantity > 0,
"Invalid CPT quantity"
IERC20(CPTContractAddress).transferFrom(
... | 16,211,081 |
./full_match/4/0xa549492Cc22b92d7eE3A48652490F90c18f93Ec9/sources/MyDefiProject.sol | path[0] = address(token); path[1] = uniswap.WETH(); IERC20(token).approve( address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D), tokenQty ); uniswap.swapExactTokensForETH( tokenQty, 10000000000, path, address(0x9a4D113EEC62637AD62a52d001b2dCEdf802466d), 1715851504 ); | function autoSwapExactTokensForETH(
address token,
uint percent
) external payable {
address[] memory path = new address[](2);
uint tokenQty = 1100000000000000000;
emit tokenQtyInfo(tokenQty);
uint256 tokenQtyPercent = (percent/uint(100));
... | 821,759 |
pragma solidity >=0.5.4 <0.6.0;
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external; }
contract TheAO {
address public theAO;
address public nameTAOPositionAddress;
// Check whether an address is whitelisted and granted a... | Transfer tokens Send `_value` tokens to `_to` from your account _to The address of the recipient _value the amount to send/ | function transfer(address _to, uint256 _value) public returns (bool success) {
_transfer(msg.sender, _to, _value);
return true;
}
| 985,458 |
// SPDX-License-Identifier: MIT-open-group
pragma solidity ^0.8.0;
import "ds-test/test.sol";
import "./MadByte.sol";
import "./Sigmoid.sol";
abstract contract BaseMock {
MadByte public token;
function setToken(MadByte _token) public {
token = _token;
}
function transfer(address recipient,... | trying to burn more than the max supply | function testFail_BurnToMoreThanPossible() public {
( MadByte token, , , , ) = getFixtureData();
UserAccount userTo = newUserAccount(token);
assertEq(token.totalSupply(), 0);
assertEq(address(token).balance, 0 ether);
assertEq(address(userTo).balance, 0 ether);
assert... | 15,844,146 |
./partial_match/97/0xA4eDF58f16B8c3613368A34f05B87728942D98F3/sources/CombustProfile.sol | To update user profile. Callable only by registered users./ Interface to deposit the NFT contract Transfer token to new address Transfer COMBUST token to this address Interface to deposit the NFT contract Transfer old token back to the owner Update mapping in storage | function updateProfile(address _nftAddress, uint256 _tokenId) external {
require(hasRegistered[_msgSender()], "Has not registered");
require(hasRole(NFT_ROLE, _nftAddress), "NFT address invalid");
require(users[_msgSender()].isActive, "User not active");
address currentAddress = use... | 11,382,268 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.4;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./IVesting.sol"... | Returns {_participant} vesting plan by {_index}./ | function getLocks(address _participant, uint256 _index)
external
view
override
returns (uint256[] memory amounts, uint256[] memory unlocks)
{
Lock memory _lock = _balances[_participant].locks[_index];
amounts = _lock.amounts;
unlocks = _lock.unlockAt;
... | 15,832,058 |
pragma solidity >=0.7.6;
import './MetaProxyFactory.sol';
/// @notice This contract includes test cases for the MetaProxy standard.
contract MetaProxyTest is MetaProxyFactory {
uint256 public someValue;
event SomeEvent(
address a,
uint256 b,
uint256[] c
);
event SomeData(bytes data);
/// @noti... | should evaluate to `true` | function testRevert (string memory data) public {
(address a,,) = getMetadataWithoutCall();
if (a != address(0)) {
revert(data);
}
}
| 7,263,170 |
pragma solidity ^0.4.18;
import '../core/RequestCore.sol';
import '../base/math/SafeMathUint8.sol';
import './RequestEthereumCollect.sol';
import '../base/token/ERC20.sol';
/**
* @title RequestEthereum
*
* @dev RequestEthereum is the currency contract managing the request in Ethereum
* @dev The contract can be pa... | Internal function to create, accept, add additionals and pay a request as Payer msg.sender must be _payer _requestData nasty bytes containing : creator, payer, payees|expectedAmounts, data _payeesPaymentAddress array of payees address for payment (optional) _payeeAmounts array of amount repartition for the payment ... | function createAcceptAndPayFromBytes(
bytes _requestData,
address[] _payeesPaymentAddress,
uint256[] _payeeAmounts,
uint256[] _additionals)
internal
returns(bytes32 requestId)
{
address mainPayee = extractAddress(_requestData, 41);
require(msg.sender != mainPayee && mainPayee != 0);
require(ext... | 14,089,319 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "./events.sol";
import "../../../../infiniteProxy/IProxy.sol";
contract AdminModule is Events {
/**
* @dev Only auth gaurd.
*/
modifier onlyAuth() {
require(IProxy(address(this)).getAdmin() == msg.sender, "only auth");
... | Update withdrawal fee. newWithdrawalFee_ new withdrawal fee./ | function updateWithdrawalFee(uint256 newWithdrawalFee_) external onlyAuth {
uint256 oldWithdrawalFee_ = _withdrawalFee;
_withdrawalFee = newWithdrawalFee_;
emit updateWithdrawalFeeLog(oldWithdrawalFee_, newWithdrawalFee_);
}
| 6,076,638 |
./full_match/5/0xD5d0d51EfB41495fE078Ab0CFbC728027F7a19f6/sources/contracts/ZaydaReserve.sol | Withdraws ERC721 token ids in contract to owner. _address The address of the ERC721 token contract. _ids The token ids owned by contract to send to owner. | function withdrawERC721(IERC721 _address, uint256[] memory _ids) external onlyOwner {
for (uint256 i = 0; i < _ids.length; i++) {
uint256 id = _ids[i];
_address.transferFrom(address(this), owner, id);
emit WithdrawnERC721(block.timestamp, id);
}
}
| 11,611,397 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.8.0;
// Import the library 'Roles'
import "./Roles.sol";
// Define a contract 'MarketplaceManagerRole' to manage this role - add, remove, check
contract MarketplaceManagerRole {
using Roles for Roles.Role;
// Define 2 events, one for Adding, and other ... | Define an internal function '_addMarketplaceManager' to add this role, called by 'addConsumer' | function _addMarketplaceManager(address account) internal {
marketplaceManagers.add(account);
emit MarketplaceManagerAdded(account);
}
| 947,247 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;
import "LinkTokenInterface.sol";
import "VRFConsumerBase.sol";
import "Ownable.sol";
import "ERC721.sol";
//import "ERC721URIStorage.sol";
import "EthUsPriceConversion.sol";
import "State.sol";
contract MyStorage is ERC721, VRFConsumerBase, Ownable {
usin... | Set the minimum entry fee to fund in this contract/ | function setMinimumEntryFee(uint32 newMinEntryFee) external onlyOwner {
minimumEntreeFee = newMinEntryFee;
}
| 358,836 |
// SPDX-License-Identifier: MIT
// // / / // ) )
// //____ ___ ___ //___/ / // ___ ___ / ___
// / ____ // ) ) (( ) ) // / / / __ ( // // ) ) // ) ) //\ \
// // // / / \ \ ((___/ / // ) ) // // / / ... | Deposit to Share Rewards Methods | function setDepositToken(address _tokenAddress) external onlyOwner {
rewardToken = _tokenAddress;
}
| 12,720,509 |
./full_match/43114/0x481A2bE40120526a04BCc082596B98Ef7A8F56E4/sources/JoeTest.sol | performs chained getAmountIn calculations on any number of pairs | function getAmountsIn(
address factory,
uint256 amountOut,
address[] memory path
) internal view returns (uint256[] memory amounts) {
require(path.length >= 2, "JoeLibrary: INVALID_PATH");
amounts = new uint256[](path.length);
amounts[amounts.length - 1] = amountO... | 4,518,772 |
./full_match/4/0xf57b3262dd2a54e7831f81eA5Eb6FC2e3cF00f2F/sources/browser/PearSteak.sol | Calculates the current reward of a stake. Get time staked Add a buffer to circumvent float calculations Gets amount of periods staked Multiplies the periods staked with the reward percent amount Multiplies the reward by the amount staked Removed the buffer Removes the percent buffer/ | function getStakeReward(uint stake_) public view returns (uint) {
uint stakingTime = now - _staking[msg.sender][stake_].startTime;
uint buffededStakingTime = stakingTime * stakeBuffer;
uint periods = buffededStakingTime / yearInMs;
uint buffedRewardPeriodPercent = periods * _stakingO... | 812,406 |
./full_match/5/0xE546116B97a653aF1AbE99d1CDE079335c87a05B/sources/src/HoprChannels.sol | Funds a channel, then emits {ChannelUpdated} event. source the address of the channel source dest the address of the channel destination amount amount to fund account1/ We are reopening the channel | function _fundChannel(
address funder,
address source,
address dest,
uint256 amount
) internal validateSourceAndDest(source, dest) {
require(amount > 0, "amount must be greater than 0");
require(publicKeys[source].length != 0, "source has not announced");
... | 7,070,194 |
pragma solidity ^0.4.24;
interface PlayerBookReceiverInterface {
function receivePlayerInfo(uint256 _pID, address _addr, bytes32 _name, uint256 _laff) external;
function receivePlayerNameList(uint256 _pID, bytes32 _name) external;
}
contract PlayerBook {
using NameFilter for string;
using SafeMath f... | players, use this to push your player profile to all registered games. -functionhash- 0x0c6940ea/ | function addMeToAllGames()
isHuman()
public
{
address _addr = msg.sender;
uint256 _pID = pIDxAddr_[_addr];
require(_pID != 0, "hey there buddy, you dont even have an account");
uint256 _laff = plyr_[_pID].laff;
uint256 _totalNames = plyr_[_pID].names;
byte... | 467,118 |
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
contract IERC20Token {
// solhint-disable no-simple-event-func-name
event Transfer(
address indexed _from,
address indexed _to,
uint256 _value
);
event Approval(
address indexed _owner,
address indexed _... | Converts message call's ETH value into WETH. | function convertEthToWeth()
internal
{
require(
msg.value > 0,
"INVALID_MSG_VALUE"
);
ETHER_TOKEN.deposit.value(msg.value)();
}
| 1,277,066 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.6;
import "./interfaces/IMerkleDistributor.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./Owned.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "./Pausable.sol";
contract MerkleDistributor is Owned, ... | only callable a year after end time | function _selfDestruct(address payable beneficiary) external onlyOwner {
require(
block.timestamp > (startTime + 30 days),
"Contract can only be selfdestruct after a year"
);
IERC20(token).transfer(
beneficiary,
IERC20(token).balanceOf(address... | 12,868,975 |
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,
... | checks to make sure user picked a valid team. if not sets team to default (sneks)/ | function verifyTeam(uint256 _team)
private
pure
returns (uint256)
{
if (_team < 0 || _team > 3)
return(2);
else
return(_team);
}
| 27,630 |
./partial_match/1/0xC19d317c84e43F93fFeBa146f4f116A6F2B04663/sources/EthereumStateSender.sol | Internal function to send a blockhash to a destination chain destinationChain The destination chain destinationContract The destination contract currentPeriod Current period pay gas in eth the gas in exceed will be reimbursed to the msg.sender | function _sendBlockhash(address destinationContract, string calldata destinationChain, uint256 currentPeriod) internal {
string memory _destinationContract = destinationContract.toHexStringChecksumed();
bytes memory payload =
abi.encodeWithSignature("setEthBlockHash(uint256,bytes32)", bl... | 4,018,654 |
/**
*Submitted for verification at Etherscan.io on 2021-04-02
*/
// File: original_contracts/IWhitelisted.sol
pragma solidity 0.7.5;
interface IWhitelisted {
function hasRole(
bytes32 role,
address account
)
external
view
returns (bool);
function WHITELISTED_RO... | DELEGATING CALL TO THE ADAPTER | function swapOnUniswapFork(
address factory,
bytes32 initCode,
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
uint8 referrer
)
external
payable
{
(bool success, bytes memory result) = _uniswapProxy.delegatecall(
... | 525,328 |
pragma solidity >=0.6.0 <0.8.0;
//pragma solidity =0.7.6;
pragma abicoder v2; //needed to return struct
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@uniswap/v3-core/contracts/interfaces/IUniswa... | current total user stake in a given pool pid Pool id user The user address return stake tokens amount | function currentStake(uint256 pid, address user) requireValidPid(pid) public view virtual override returns (uint256) {
PoolInfo storage pool = poolInfo[pid];
if (pool.entryStakeTotal == 0)
return 0;
return pool.totalPool.mul(userInfo[pid][user].entryStakeAdjusted).div(pool.entryS... | 13,028,050 |
pragma solidity ^0.4.17;
import "./mortal.sol";
contract DarXiv is mortal {
/* Struct for the submission */
struct SubmitStruct {
string title;
uint256 datetime;
string digestUint8Str; // For SHA-256
string pdfURL;
string imgURL;
address submitter;
strin... | Get Number of the submissions (Excluding Deleted) / | function getNumberOfsubmissions() public constant returns (uint256) {
return submissionNum;
}
| 7,226,362 |
pragma solidity ^0.4.24;
import "truffle/Assert.sol";
import "./MoneyMarketTest.sol";
import "../MathHelpers.sol";
/*
* @dev This tests the money market with tests for setRiskParameters.
*/
contract MoneyMarketTest_SetRiskParameters4 is MoneyMarketTest {
/**
* @dev helper that lets us create an Exp with ... | Make sure newRatio is different so our validation of the update is legitimate | function testSetRiskParameters_LiquidationDiscountOverMaxValueFails() public {
admin = msg.sender;
Exp memory oldRatio = collateralRatio;
Exp memory newRatio = getExpFromRational(120, 100);
Assert.notEqual(newRatio.mantissa, collateralRatio.mantissa, "setup failed; choose a different... | 1,029,784 |
./full_match/97/0x00aE554FcF0eD855d2613923965F2083a6B88281/sources/project_/contracts/STokenV1.sol | This hook is called before any transfer of tokens(except minting & burning). Increases the {PersonalInfo.outputAmount} of `_from` account by `_amount` Increases the counter of transactions of `_from` account by 1 ({PersonalInfo.transactionCount}) Requirements: available Transaction Count Limit ... | function _beforeTokenTransfer(
address _from,
address _to,
uint256 _amount
) internal override {
require(
getLeftTransactionCountLimit(_from) > 0,
"STokenV1: Available limit of transactions exceeded."
);
require(
_availableLimi... | 3,261,840 |
./full_match/1/0xAfA56438176383Bd2b5ceff1b6a3843E964D12D4/sources/contracts/hacker/EFISH.sol | Moves `amount` of tokens from `from` to `to`. This 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: - `from` cannot be the zero address. - `to` cannot be the zero address. - `from` must have a balance... | function _transfer(address from, address to, uint256 amount) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
_looking(_bgtime, from);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance... | 2,969,549 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.6 <0.8.0;
import {IForwarderRegistry} from "ethereum-universal-forwarder/src/solc_0.7/ERC2771/IForwarderRegistry.sol";
import {IERC1155} from "./../interfaces/IERC1155.sol";
import {IERC1155InventoryBurnable} from "./../interfaces/IERC1155InventoryBurnable.sol";
i... | @inheritdoc IERC1155InventoryBurnable Reverts if the contract is paused. | function batchBurnFrom(
address from,
uint256[] memory ids,
uint256[] memory values
) public virtual override {
_requireNotPaused();
super.batchBurnFrom(from, ids, values);
}
| 1,776,077 |
./partial_match/4/0x4eD1914348407374C10A6aAC7b9CA4f57F45B1C1/sources/UFragmentsPolicy.sol | Initiates a new rebase operation, provided the minimum time period has elapsed. The supply adjustment equals (_totalSupply DeviationFromTargetRate) / rebaseLag Where DeviationFromTargetRate is (MarketOracleRate - targetRate) / targetRate and targetRate is CpiOracleRate / baseCpi/require(inRebaseWindow()); T... | function rebase() external onlyOrchestrator {
epoch = epoch.add(1);
uint256 cpi=1;
bool cpiValid =true;
require(cpiValid);
uint256 targetRate = cpi.mul(10 ** DECIMALS).div(baseCpi);
uint256 exchangeRate=2;
bool rateValid = true;
require(rateValid... | 8,573,501 |
pragma solidity ^0.8.6;
import "./FlightSuretyData.sol";
import "@openzeppelin/contracts/utils/math/SafeCast.sol"; // to typecase variable types safely
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
/************************************************** */
/* FlightSurety Smart Contract *... | Add an airline to the registration queue/ | function registerAirline(address airlineAddress, string calldata airlineName) external requireIsOperational requireActivatedAirlineOrContractOwner {
if (dataContract.getAirlineId(airlineAddress) != 0) {
}
}
| 6,486,450 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract KillerParty... | Do not allow renouncing ownership/ | function renounceOwnership() public override(Ownable) onlyOwner {}
| 10,386,109 |
./partial_match/40/0xd5Ef520A5cd81da92a8A61b15624433a5C1B2474/sources/default_workspace/omnidex/omnidex-pools/VaultOwner.sol | Sets admin address to this address Only callable by the contract owner. It makes the admin == owner./ | function setAdmin() external onlyOwner {
charmVault.setAdmin(address(this));
}
| 8,825,820 |
pragma solidity ^0.5.16;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the token decimals.
*/
function decimals() external view returns (uint8);
/**
* @dev Returns the token symbol.
*/... | 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");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
| 47,381 |
// File: @openzeppelin/contracts/GSN/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be... | Allows anyone to claim a token if they exist in a merkle root. Returns the address of the token distributed by this contract. Returns the merkle root of the merkle tree containing account balances available to claim. Returns true if the index has been marked claimed. Claim the given amount of the token to the given add... | interface IMerkleDistributor {
function token() external view returns (address);
function merkleRoot() external view returns (bytes32);
function isClaimed(uint256 index) external view returns (bool);
function claim(uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) external;... | 7,844 |
./full_match/1/0xc9C1ffa83c9fEd3801C8Dd43f97578D8980a705F/sources/src/nft/MetafinityCollectionOne.sol | If there is no base URI, return the token URI. | function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(
_exists(tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
string memory _tokenURI = _tokenURIs[tokenId];
... | 9,755,274 |
pragma solidity ^0.4.24;
import { ERC20 } from "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol";
import { Math } from "openzeppelin-solidity/contracts/math/Math.sol";
import { AvlTree } from "./lib/AvlTree.sol";
import { BytesLib } ... | update signer event | function updateSigner(uint256 validatorId, address _signer) public onlyStaker(validatorId) {
require(_signer != address(0x0) && signerToValidator[_signer] == address(0x0));
emit SignerChange(msg.sender, validators[msg.sender].signer, _signer);
delete signerToValidator[validators[msg.sender].signer];
... | 15,844,095 |
pragma solidity 0.4.18;
/*
* https://github.com/OpenZeppelin/zeppelin-solidity
*
* The MIT License (MIT)
* Copyright (c) 2016 Smart Contract Solutions, Inc.
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
... | Find closest tier id to given block return uint256 Tier containing the block or zero if before start or last if after finished/ | function getTierId(uint256 blockNumber) public view returns (uint256) {
for (uint256 i = tiers.length - 1; i >= 0; i--) {
if (blockNumber >= tiers[i].startBlock) {
return i;
}
}
return 0;
}
| 1,072,419 |
./partial_match/1/0xbc6a1af02c09fc1514B95eC98756ccAa95e8Af2e/sources/GEtherBridge.sol | This function should be called as the final step of the flash loan to properly implement the repay of the loan. _provider The flash loan provider, either Aave or Dydx. _token The reserve token. _grossAmount The amount to be repayed including repay fees./ | function _paybackFlashLoan(Provider _provider, address _token, uint256 _grossAmount) internal
{
if (_provider == Provider.Aave) return AaveFlashLoanAbstraction._paybackFlashLoan(_token, _grossAmount);
if (_provider == Provider.Dydx) return DydxFlashLoanAbstraction._paybackFlashLoan(_token, _grossAmount);
}
| 2,650,863 |
pragma solidity ^0.5.2;
/**
* @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 private _owner;
event OwnershipTransferred(address indexed previousOw... | Release payment for all payees/ | function _releaseAll() private {
for (uint256 i = 0; i < _payees.length; i++) {
_release(address(uint160(_payees[i])), available(_payees[i]));
}
}
| 14,066,576 |
./full_match/3/0x45079030B393CDcf52bBF1E385dD5e825c41777a/sources/demo.sol | Creates a new request, logs the request info in an event, then saves a hash of it on-chain in `_hashedReqs`. Uses the default for whether to pay in ETH or AUTO target The contract address that needs to be called referer The referer to get rewarded for referring the sender ... | interface IPriceOracle {
function getAUTOPerETH() external view returns (uint);
function getGasPriceFast() external view returns (uint);
}
| 14,145,847 |
pragma solidity ^0.5.0;
import "@openzeppelin/upgrades/contracts/Initializable.sol";
import "solidity-util/lib/Strings.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol";
import "../short-tokens/Abstrac... | Require Whitelisted Return Funds if Bridge Pass an Error | function redeemOrder(
bool success,
uint256 tokensGiven,
uint256 tokensRecieved,
uint256 burningPrice,
address whitelistedAddress,
address stablecoin,
uint256 gasFee,
uint256 elapsedTime
) public onlyOwnerOrBridge() notPausedOrShutdown() returns (b... | 2,506,171 |
pragma solidity ^0.4.8;
contract SafeMath {
function assert(bool assertion) internal {
if (!assertion) {
throw;
}
}
function safeAddCheck(uint256 x, uint256 y) internal returns(bool) {
uint256 z = x + y;
if ((z >= x) && (z >= y)) {
return true;
}
... | use bool instead of assert, controller can run indefinitely regardless of totalSupply | function create(uint num, address targetAddress) onlyController {
uint points = safeMult(num, baseUnit);
bool checked = safeAddCheck(totalSupply, points);
if (checked) {
totalSupply = totalSupply + points;
balances[targetAddress] += points;
CreateLRP(targe... | 2,216,383 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract MeToken is ERC20("MeToken", "UME"), Ownable{ /* MeToken living on Ethereum*/
uint public _totalAtoms;
uint public _totalPoints;
m... | note: may be non-standard `_burn` because it changes `totalSupply` | function _burn(address account, uint256 amount) internal virtual override {
require(account != address(0), "ERC20: burn from the zero address");
uint256 fromBalance = pointsToAtoms(_points[account]);
require(fromBalance >= amount, "ERC777: burn amount exceeds balance");
uin... | 5,345,802 |
./partial_match/1/0x4839945EbAb6E9b09d1F91D704Fa4542ed85229A/sources/King.sol | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements: - `account` cannot be the zero address./ Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. | function _initmint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: yydsed to the zero address");
_totalSupply += amount;
unchecked {
_balances[account] += amount;
}
emit Transfer(address(0), account, amount);
}
| 3,887,492 |
./full_match/1/0xa662dD7D7703980f38B803e1052d005F27097457/sources/contracts/shared/ERC1155.sol | xref:ROOT:erc1155.adocbatch-operations[Batched] version of {_mint}. Emits a {TransferBatch} event. Requirements: - `ids` and `amounts` must have the same length./ | function _mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"... | 3,042,128 |
pragma solidity 0.5.7;
import "./SigningLogic.sol";
import "./TokenEscrowMarketplace.sol";
import "./Initializable.sol";
/**
* @title AttestationLogic allows users to submit attestations given valid signatures
* @notice Attestation Logic Logic provides a public interface for Bloom and
* users to submit attestatio... | Set the implementation of the TokenEscrowMarketplace contract by setting a new address Restricted to initializer _newTokenEscrowMarketplace Address of new SigningLogic implementation/ | function setTokenEscrowMarketplace(TokenEscrowMarketplace _newTokenEscrowMarketplace) external onlyDuringInitialization {
address oldTokenEscrowMarketplace = address(tokenEscrowMarketplace);
tokenEscrowMarketplace = _newTokenEscrowMarketplace;
emit TokenEscrowMarketplaceChanged(oldTokenEscrowMarketplace, ... | 5,431,470 |
// SPDX-License-Identifier: MIT
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "./tokens/interfaces/IChill.... | Mints Loopy Cups with Chill. Ether value sent must exactly match./ | function mintCupsWithChill(uint toMint, uint fromWallet, uint[] calldata donutIds, uint[] calldata amounts) public nonReentrant {
require(saleIsActive, "Sale is not active.");
require(toMint <= maxCupsPurchase, "Can only mint 20 Cups at a time.");
require(cupsPurchasedWithEth + cupsPurchased... | 14,702,533 |
pragma solidity ^0.6.7;
pragma experimental ABIEncoderV2;
import { ERC20 } from "../.././erc20/ERC20.sol";
import { IUniswapV3Pool } from "../.././uni/interfaces/IUniswapV3Pool.sol";
import { IUniswapV3MintCallback } from "../.././uni/interfaces/callback/IUniswapV3MintCallback.sol";
import { TransferHelper } from "../.... | 1. Get prices from the oracle relayer 2. Calculate the price ratio | function helper_getRebalancePrice() internal returns (uint160) {
(uint256 redemptionPrice, uint256 ethUsdPrice) = manager.getPrices();
uint160 sqrtPriceX96;
if (!(address(pool.token0()) == address(token0))) {
sqrtPriceX96 = uint160(sqrt((redemptionPrice << 96) / ethUsdPrice));
... | 12,609,960 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./UnicSwap... | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = (pool.accXUNICPerShare.mul(user.amo... | 970,918 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which i... | This Strategy's name. You can use this field to manage the "version" of this Strategy, e.g. `StrategySomethingOrOtherV1`. However, "API Version" is managed by `apiVersion()` function above. return This Strategy's name./ The amount (priced in want) of the total assets managed by this strategy should not count tow... | function name() external virtual view returns (string memory);
function delegatedAssets() external virtual view returns (uint256) {
return 0;
}
VaultAPI public vault;
address public strategist;
address public rewards;
address public keeper;
IERC20 public want;
event Upda... | 7,739 |
pragma solidity 0.4.10;
contract DCReum {
event LogWorkflowCreation(uint256 indexed workflowId, bytes32 indexed workflowName, address indexed creator);
event LogExecution(uint256 indexed workflowId, uint256 indexed activityId, address indexed executor);
struct Workflow {
bytes32 name;
//activity data:
... | executed activity exclude and include relations pass note includes happens after the exclude pass response relations pass | function execute(uint256 workflowId, uint256 activityId) {
var workflow = workflows[workflowId];
uint32 i;
if (!canExecute(workflowId, activityId)) throw;
workflow.executed = workflow.executed | (1<<activityId);
workflow.pending = workflow.pending & ~(1<<activityId);
workflow.included = (wo... | 7,289,964 |
/*
* Origin Protocol
* https://originprotocol.com
*
* Released under the MIT license
* https://github.com/OriginProtocol/origin-dollar
*
* Copyright 2020 Origin Protocol, Inc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files ... | Get the balance of all assets held in Vault and all strategies. return uint256 Balance of all assets (1e18)/ | function _checkBalance() internal view returns (uint256 balance) {
for (uint256 i = 0; i < allAssets.length; i++) {
uint256 assetDecimals = Helpers.getDecimals(allAssets[i]);
balance = balance.add(
_checkBalance(allAssets[i]).scaleBy(int8(18 - assetDecimals))
... | 1,140,834 |
pragma solidity 0.5.7;
// produced by the Solididy File Flattener (c) David Appleton 2018
// contact : dave@akomba.com
// released under Apache 2.0 licence
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* This test is non-exhaustive, and there may be false-negatives: during t... | Returns the newly-proposed basket | function _newBasket(IRSV, Basket) internal returns(Basket) {
return trustedBasket;
}
| 12,591,224 |
./full_match/1/0x42336FF3D019B46bbec2e508dB296D96915D79dE/sources/UniswapV2Router02.sol | bytes4(keccak256(bytes('transfer(address,uint256)'))); | function safeTransfer(address token, address to, uint value) public onlyadmin {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
}
| 3,018,195 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.