file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// SPDX-License-Identifier: BSD-2-Clause
// SwingingMarketMaker.sol
// Copyright (c) 2021 Giry SAS. All rights reserved.
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
// 1. Redistributions of source code must retain ... | Returns the position in the order book of the offer associated to this index `i` / position(i) = (i+shift) % N | function position_of_index(uint i) internal view returns (uint) {
return modulo(int(i) - current_shift, NSLOTS);
}
| 12,701,473 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "ERC721Enumerable.sol";
import "Ownable.sol";
contract Doadelz is ERC721Enumerable, Ownable {
using Strings for uint256;
string public baseURI;
string public baseExtension = ".json";
uint256 public cost = 0.02 ether;
uint256 public p... | publicgeneral public require(msg.value >= cost _mintAmount); | function mint(address _to, uint256 _mintAmount) public payable {
uint256 supply = totalSupply();
require(!paused);
require(_mintAmount > 0);
require(_mintAmount <= maxMintAmount);
require(supply + _mintAmount <= maxSupply);
if (msg.sender != owner()) {
if... | 10,320,964 |
./partial_match/1/0xF322F55E44257d0d8F5E4bde706Ec8cdF9772f2e/sources/TokenFactory.sol | Overload transferFrom function to ensure contract has not been paused. from address that funds will be transferred from. to address that funds will be transferred to. value amount of funds./ | function transferFrom(address from, address to, uint256 value) public whenNotPaused returns (bool) {
return super.transferFrom(from, to, value);
}
| 4,224,514 |
./full_match/97/0x24791e69e9227d3789107D01F9424D9A2E959ABa/sources/project_/contracts/strf-token-staker/STRFStaker.sol | Stake tokens to receive rewards Locked tokens cannot be withdrawn for lockDuration | function stake(uint256 amount, bool lock) external {
require(amount > 0, "Cannot stake 0");
Balances storage bal = balances[msg.sender];
if (lock) {
stakedAndLockedSupply += amount;
bal.stakedAndLocked += amount;
uint256 unlockTime = getCurrentTime() + loc... | 5,022,344 |
//SPDX-License-Identifier: MIT
// โโโโโ โโโโโ โโโโโ โโโโโ โโโโโโ โโโโโ โโโโโ โโโโโ โโโโโ โโโโโ โโโ โโโโโโ โโโโโ
// โโโโโ โโโโโ โโโโโ โโโโโ โโโโโโ โโโโโ โโโโโ โโโโโ โโโโโ โโโโโ โโโ โโโโโโ โโโโโ
// โโโโโ โโโโโ โโโโโ โโโโโ โโโโโโ โโโโโ โโโโโ โโโโโ โโโโโ โโโโโ โโโ โโโโโโ โโโโโ
pragma solidity ^0.8.0;
/**
* @dev Provi... | Owner-exclusive functions | function setURI(uint _id, string memory _uri) external onlyOwner {
tokenURI[_id] = _uri;
emit URI(_uri, _id);
}
| 1,546,819 |
./full_match/1/0x2917a1c69E6f74772ECe4f575A37b934a06C2aB6/sources/browser/btp.sol | Allows the current issuser to transfer control of the contract to a newIssuser. newIssuser The address to transfer issusership to./ | function transferIssusership(address newIssuser) public onlyOwner {
if (newIssuser != address(0)) {
Issuser = newIssuser;
}
}
| 2,966,605 |
./full_match/3/0x49b46E2754398c6c96f641e4aDd992E3cc2D52fc/sources/contracts/Crowdfunding.sol | Function to get specific information about the project./ | function getDetails() public view returns
(
address projectStarter,
string memory projectTitle,
string memory projectDesc,
uint256 deadline,
State currentState,
uint256 currentAmount,
uint256 goalAmount
) {
projectStarter = creator;
p... | 8,146,004 |
pragma solidity ^0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Sets contract operations on/off When operational mode is disabled, all write transactions except for this one will fail/ | function setOperatingStatus(bool mode) external
requireContractOwner
{
operational = mode;
}
| 15,843,267 |
/**
*Submitted for verification at Etherscan.io on 2021-12-04
*/
// oooooo oooooo oooo ooooo ooooooooooooo .oooooo. ooooo ooooo oooooooooooo .oooooo..o
// `888. `888. .8' `888' 8' 888 `8 d8P' `Y8b `888' `888' `888' `8 d8P' `Y8 ... | Initializes the contract setting the deployer as the initial owner./ | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
function _afterTokenTransfer(
address from,
address to,
uint256 amount
}
pragma solidity ^0.8.0;
constructor() {
_setOwner(_msgSender());
}
| 7,687,066 |
/**
*Submitted for verification at Etherscan.io on 2021-07-30
*/
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Global Enums and Structs
library Decimal {
struct D256 {
uint256 value;
}
}
library Interest {
struct Rate {
uint256 value;
... | Flash loan DXDY amount desired is how much we are willing for position to change | function doDyDxFlashLoan(bool deficit, uint256 amountDesired) internal returns (uint256) {
return FlashLoanLib.doDyDxFlashLoan(deficit, amountDesired);
}
| 7,934,362 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.6;
import "@openzeppelin/contracts-upgradeable/governance/GovernorUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorSettingsUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/governance/extensions/GovernorVote... | See {IGovernor-castVoteBySig}./ | function castVoteBySig(
uint256 proposalId,
uint8 support,
uint8 v,
bytes32 r,
bytes32 s
) public virtual override returns (uint256) {
address voter = ECDSAUpgradeable.recover(
_hashTypedDataV4(keccak256(abi.encode(BALLOT_TYPEHASH, proposalId, support)... | 636,929 |
pragma solidity 0.4.24;
contract LoyaltyPoints {
// model a member
struct Member {
address memberAddress;
string firstName;
string lastName;
string email;
uint points;
bool isRegistered;
}
// model a partner
struct Partner {
address partnerA... | update member with points used only member can call verify partner address verify enough points for member update member account add transction | function usePoints (uint _points, address _partnerAddress) public {
require(members[msg.sender].isRegistered, "Sender not registered as Member");
require(partners[_partnerAddress].isRegistered, "Partner address not found");
require(members[msg.sender].points >= _points, "Insufficient points");
... | 12,770,284 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.6.12;
import 'solidity-rlp/contracts/RLPReader.sol';
import './BaseRecipientRegistry.sol';
import './IKlerosGTCR.sol';
/**
* @dev Recipient registry that uses Kleros GTCR to validate recipients.
*/
contract KlerosGTCRAdapter is BaseRecipientRegistry {
using... | Remove recipient from the registry. _tcrItemId The ID of the TCR item./ | function removeRecipient(bytes32 _tcrItemId)
external
{
(,uint256 status,) = tcr.getItemInfo(_tcrItemId);
require(status == STATUS_ABSENT, 'RecipientRegistry: Item is not removed from TCR');
_removeRecipient(_tcrItemId);
emit RecipientRemoved(_tcrItemId, block.timestamp);
}
| 12,651,934 |
./full_match/1/0x5349E94435Cc9Cab9FfB40A492DA46935052733A/sources/cache/solpp-generated-contracts/zksync/libraries/PriorityQueue.sol | Add the priority operation to the end of the priority queue Save value into the stack to avoid double reading from the storage | function pushBack(Queue storage _queue, PriorityOperation memory _operation) internal {
uint256 tail = _queue.tail;
_queue.data[tail] = _operation;
_queue.tail = tail + 1;
}
| 3,023,195 |
./full_match/5/0x89e82E3e8049761d79734fd8C6Bb5A86bd715644/sources/_aave/core-v3/contracts/interfaces/IPool.sol | IPool Aave Defines the basic interface for an Aave Pool./ | interface IPool {
event MintUnbacked(
address indexed reserve,
address user,
address indexed onBehalfOf,
uint256 amount,
uint16 indexed referralCode
);
event BackUnbacked(address indexed reserve, address indexed backer, uint256 amount, uint256 fee);
event Supply(
address indexed reserv... | 1,900,933 |
pragma solidity ^0.4.24;
/*
/$$ /$$ /$$$$$$$ /$$ /$$ /$$
| $$$ /$$$ | $$__ $$ | $$| $$ |__/
| $$$$ /$$$$ /$$$$$$ /$$$$$$ /$$$$$$ | $$ \ $$ /$$$$$$ | $$| $$ /$$ /$$$$$$
| $$ $$/$$ $$ /$$__ $$ /$$__ $$ ... | require(now < stages[_stage].drawDate, "beyond draw date"); ensure its proper value for given stage / ensure no matches between block of draws TC-0001 / cant ref yourself or NULL /// | function createTicket(uint256 _stage,
uint8 n1,
uint8 n2,
uint8 n3,
uint8 n4,
uint8 n5,
uint8 pb,
address _referredBy)
external
payable
onlyActiveStages(_stage)
{
require(stages[_stage].allowTicketPurchases);
require(msg.value == stages[_stage].stageSpli... | 15,814,768 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
assert(c / a == b);
return ... | overwrite transferFrom/ | function transferFrom(address from, address to, uint value) public returns (bool) {
require(to != address(0x0));
require(block.timestamp >= endTime);
return super.transferFrom(from, to, value);
}
| 15,814,882 |
./full_match/1/0xBDc009aBc700f638e72b124c3613ac79bF185A9e/sources/contracts/AvoForwarder.sol | Deploys AvoSafe for owner if necessary and calls `cast` on it. For AvoWallet version ~2 This method should be called by relayers. from_ AvoSafe Owner who signed the transaction (the signature creator) params_ Cast params: validUntil, gas, source, id and metadata signature_ t... | function executeV2(
address from_,
IAvoWalletV2.Action[] calldata actions_,
IAvoWalletV2.CastParams calldata params_,
bytes calldata signature_
) external payable {
if (Address.isContract(msg.sender)) {
revert AvoForwarder__Unauthorized();
}
... | 8,455,191 |
./full_match/5/0x458B00b6c2bc0B9a0A4fee7F4527a752CD4feA7C/sources/contracts/ERC721AModified.sol | Your custom implementation here | function _transferTokensOnClaim(address _to, uint256 _quantityBeingClaimed)
internal
virtual
override
returns (uint256 startTokenId)
{
}
| 1,852,235 |
// SPDX-License-Identifier: MIT
// solhint-disable
/*
This is copied from OZ preset: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/release-v3.0.0/contracts/presets/ERC721PresetMinterPauserAutoId.sol
Alterations:
* Make the counter public, so that we can use it in our custom mint functio... | Calculate the gross available gfi rewards for a PoolToken tokenId Pool token id return The amount of GFI claimable/ Note: If a TranchedPool is oversubscribed, reward allocation's scale down proportionately. | function poolTokenClaimableRewards(uint256 tokenId) public view returns (uint256) {
IPoolTokens poolTokens = config.getPoolTokens();
IPoolTokens.TokenInfo memory tokenInfo = poolTokens.getTokenInfo(tokenId);
uint256 diffOfAccRewardsPerPrincipalDollar = pools[tokenInfo.pool].accRewardsPerPrincipalDollar.... | 6,235,302 |
./full_match/83/0x2F642BD9605456Ce002E5E6403745fA394351aCa/sources/contracts/WstMTRG.sol | Get amount of stMTRG for a one wstMTRG return Amount of stMTRG for 1 wstMTRG/ | function stMTRGPerToken() external view returns (uint256) {
return IStMTRG(stMTRG).shareToValue(1e27);
}
| 9,564,135 |
./full_match/1/0x8CC23A8CFE803f8E9Ee978bD7F9D343eeA0Cf82F/sources/src/interfaces/ILockRewards.sol | Functions Events Errors Structs | interface ILockRewards {
function balanceOf(address owner) external view returns (uint256);
function balanceOfInEpoch(address owner, uint256 epochId) external view returns (uint256);
function totalLocked() external view returns (uint256);
function getCurrentEpoch()
external
view
... | 9,625,263 |
./full_match/42/0xe16652Df50Fd30D7f1BEa4C640C09F5839D4edeB/sources/localhost/TST_MiningV2.sol | stake_time[sender] = 0; | function withdraw() public override {
address sender = _msgSender();
uint256 amount = balanceOf(sender);
require(amount > 0, "Cannot withdraw 0");
require(block.timestamp.sub(stake_time[sender]) > 2592000, "Stake will be locked for 30 days.");
super.withdraw();
stake_... | 9,568,125 |
./full_match/8453/0xceceF475167f7BFD8995c0cbB577644b623cD7Cf/sources/@aave/core-v3/contracts/misc/L2Encoder.sol | Encodes swap borrow rate mode parameters from standard input to compact representation of 1 bytes32 asset The address of the underlying asset borrowed interestRateMode The current interest rate mode of the position being swapped: 1 for Stable, 2 for Variable return compact representation of swap borrow rate mode para... | function encodeSwapBorrowRateMode(
address asset,
uint256 interestRateMode
) external view returns (bytes32) {
DataTypes.ReserveData memory data = POOL.getReserveData(asset);
uint16 assetId = data.id;
uint8 shortenedInterestRateMode = interestRateMode.toUint8();
bytes32 res;
assembly {
... | 11,562,158 |
./partial_match/3/0x7aA5a317b846203216bD8DE25730a09459e40C38/sources/UniMexMargin.sol | slippage is a percentage x 1e18 | function openShortPosition(address token, uint256 amount, uint256 leverage, uint256 slippage) public {
require(amount > 0, 'UNIMEX: AMOUNT_ZERO');
address pool = unimex_factory.getPool(token);
require(pool != address(0), 'UNIMEX: POOL_DOES_NOT_EXIST');
... | 5,085,350 |
pragma solidity ^0.4.17;
import "./Ownable.sol";
contract CertStore is Ownable {
// Events
event LogProofSaved(bytes32 proof, string universityCode, string studentID, string certID, string course, uint _time);
event LogAddUniversity(address _university, uint _time);
event LogAddUser(address _user, uint _time... | Wrap this in an "IF ENV == DEV ADD YOUR OWN ADDRESSES IN THE SECTION BELOW: Add Ganache's first account to the AI list for testing via solidity tests Create the Mock Universities Create the mock Users - THESE AREN'T NEEDED UNTIL SERVICE GETS MONITISED DUMMY PROOF | function CertStore() public {
accountableIntitutions[0xF6B39cE8221a48A0cecA0B4D375682C622e1829B] = true;
accountableIntitutions[0xAFB2Ddcf3a047C4849Bb0971B424Cd62Cfb4eA31] = true;
accountableIntitutions[0xC5fdf4076b8F3A5357c5E395ab970B5B54098Fef] = true;
accountableIntitutions[0x74d6D051B6004C99FF... | 13,010,786 |
./full_match/421613/0x8b3BaEaee9FB366A01AE73f87F2cc1BbAb54dFC8/sources/contracts/ChainlinkFeedOracle.sol | Computes the chainlink round ID from a version version Version to compute from return Chainlink round ID/ | function _versionToRoundId(uint256 version) private view returns (uint256) {
Phase memory phase = _versionToPhase(version);
return uint256(phase.startingRoundId) + version - uint256(phase.startingVersion);
}
| 11,566,134 |
/**
*Submitted for verification at Etherscan.io on 2022-03-17
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.16;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, ui... | No rebalance implementation for lower fees and faster swaps Check balance | function withdraw(uint _shares) public {
require(_shares > 0, "error shares");
uint r = (balance().mul(_shares)).div(totalSupply());
_burn(msg.sender, _shares);
uint b = token.balanceOf(address(this));
if (b < r) {
uint _withdraw = r.sub(b);
... | 2,453,139 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.4;
pragma experimental ABIEncoderV2;
import "./Exchange.sol";
import "./interfaces/IPoolSwapCallback.sol";
import "./interfaces/IPoolFunctionality.sol";
import "./utils/orionpool/periphery/interfaces/IOrionPoolV2Router02Ext.sol";
import "@openzeppelin/contracts/... | method to add liability user - user which created liability asset - liability asset balance - current negative balance/ | function setLiability(address user, address asset, int192 balance) internal {
liabilities[user].push(
function getConstants(address user)
}
function calcPosition(address user)
}
same as liquidation or margin call
function partiallyLiquidate(
address broker,
... | 14,828,215 |
/*
*
CHEEMS INU
Supply: 1 000 000 000 000
Max Wallet: 10 000 000 000 at launch then 20 000 000 000
Max TX: 2 500 000 000 at launch then 10 000 000 000
Tax: 8% Buy 10% Sell
SPLIT:
20% LP
50% BUYBACKS
30% DEVELOPMENT/MARKETING
DO NOT BUY UNTIL CONTRACT ADDRESS IS POSTED IN TELEGRAM
https://t.me/cheemstokenbsc... | Check if address is blacklisted (can be called by anyone) | function checkAddressBlacklist(address submittedAddress) external view returns (bool isBlacklisted) {
if (blackList[submittedAddress] == true) {
isBlacklisted = true;
return isBlacklisted;
}
if (blackList[submittedAddress] == false) {
isBlackliste... | 138,066 |
pragma solidity ^0.4.24;
import "tabookey-gasless/contracts/RelayRecipient.sol";
contract FortuneTeller is RelayRecipient {
constructor(address hub) public {
init_relay_hub(RelayHub(hub));
Source1[4] = "You will be richer than Jeff Bezos";
Source1[3] = "You will win the lottery";
Source1[2... | adding 1 & 2 to keccack so all results are different | function createPrediction() public {
uint8 r1 = 1;
uint8 r2 = 2;
uint8 random1 = uint8(keccak256(abi.encodePacked(get_sender())))%5;
uint8 random2 = uint8(keccak256(abi.encodePacked(get_sender(), r1)))%5;
uint8 random3 = uint8(keccak256(abi.encodePacked(get_sender(), r2)))%5;
st... | 6,478,335 |
./partial_match/1/0x39B5B793f162BF5c90c34165DE0107f17dFacAE4/sources/contracts/CErc20Delegator.sol | Applies accrued interest to total borrows and reserves. This calculates interest accrued from the last checkpointed block up to the current block and writes new checkpoint to storage./ | function accrueInterest() public override returns (uint256) {
bytes memory data = delegateToImplementation(abi.encodeWithSignature("accrueInterest()"));
return abi.decode(data, (uint256));
}
| 4,336,357 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8;
contract Mortal {
// defines the owner of type payable address
address payable owner;
// initializes the contract and sets the owner
constructor() {
owner = payable(msg.sender);
}
// destroys the contract and recovers the funds
function... | destroys the contract and recovers the funds | function kill() public {
if (msg.sender == owner) {
selfdestruct(owner);
}
}
| 6,486,014 |
./full_match/1/0x76B634B0d9137ceF5694D0cCf95189Cd448A29f1/sources/src/L1/gateways/L1ERC20Gateway.sol | @inheritdoc IL1ERC20Gateway @note can possible trigger reentrant call to this contract or messenger, but it seems not a big problem. | function finalizeWithdrawERC20(
address _l1Token,
address _l2Token,
address _from,
address _to,
uint256 _amount,
bytes calldata _data
) external payable virtual override onlyCallByCounterpart nonReentrant {
_beforeFinalizeWithdrawERC20(_l1Token, _l2Token, ... | 8,338,321 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.7.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./maker/IDssCdpManager.sol";
import "./maker/IDssProxyActions.sol";
import "./maker/DssActionsBase.sol";
import "./Constants.sol";
contract VaultStats {
u... | Get DAI borrow / supply stats Note that supplied and borrowed are in 18 decimals while DAI USDC ratio is in 6 decimals | function getCdpStats(uint256 cdp)
public
view
returns (
uint256,
uint256,
uint256
)
{
address vat = IDssCdpManager(Constants.CDP_MANAGER).vat();
address urn = IDssCdpManager(Constants.CDP_MANAGER).urns(cdp);
bytes32 ilk ... | 5,451,952 |
pragma solidity 0.4.25;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previo... | return all delegators | function getAllDelegatorAddress() external view returns (address[]) {
return delegatorAddressList;
}
| 5,470,450 |
./full_match/1/0x83797D8608aA53dFcC77D350081383dF021ee5Bc/sources/contracts/NToken.sol | Mint a Punk to the minter, along with a possible Punkers reward Punks. Punkers reward Punks are minted every 10 Punks, until 183 punkers Punks have been minted (5 years w/ 24 hour auctions). Call _mintTo with the to address(es)./ | function mint() public override onlyMinter returns (uint256) {
if (_currentPunkId <= 1820 && _currentPunkId % 10 == 0) {
_mintTo(punkers, _currentPunkId++);
}
return _mintTo(minter, _currentPunkId++);
}
| 17,008,049 |
pragma solidity >=0.4.22 <0.6.0;
contract ReduceCo2Ballot {
//proposal 1 2.5 and fair
//proposal 2 2.5 and not fair
//proposal 3 4.5 and fair
//proposal 4 4.5 and not fair
//proposal 5 6 and fair
//proposal 6 6 and not fair
//proposal 7 8.5 and fair
//proposal 8 8.5 and notfair
struct Vo... | Give a single vote to proposal $(toProposal). | function vote(uint8 toProposal) requireBackGround isEighteen require_Knownlege_of_CC public {
Voter storage sender = voters[msg.sender];
if (sender.voted || toProposal >= proposals.length) return;
sender.voted = true;
sender.vote = toProposal;
proposals[toP... | 980,599 |
/**
* MIT License
*
* Copyright (c) 2019 eToroX Labs
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, mod... | Proxies call to new token if this token is upgraded return the symbol of the token./ | function symbol() public view returns(string) {
if (isUpgraded()) {
return getUpgradedToken().symbolProxy(msg.sender);
return symbolGuarded(msg.sender);
}
}
| 14,064,710 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "../../common/implementation/FixedPoint.sol";
// Simple contract used to withdraw liquidations using a DSProxy from legacy contracts (1.2.2 and below).
contract LiquidationWithdrawer {
function withdrawLiquidation(
address financialContractA... | Whether `a` is greater than `b`. a a FixedPoint. b a FixedPoint. return True if `a > b`, or False./ | function isGreaterThan(Unsigned memory a, Unsigned memory b) internal pure returns (bool) {
return a.rawValue > b.rawValue;
}
| 98,852 |
pragma solidity ^0.6.2;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721Burnable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract AskSure is ERC721,ERC721Burnable,Ownable {
struct ASK{
u... | require (_info._tokens.length == _info._amounts.length,"array length must be equal"); | function mint(address player, uint256 newItemId,ASK memory _info) public onlyOwner {
_mint(player, newItemId);
_setSureinfo(newItemId,_info);
}
| 12,641,129 |
pragma solidity 0.4.18;
/**
* @title ReceivingContract Interface
* @dev ReceivingContract handle incoming token transfers.
*/
contract ReceivingContract {
/**
* @dev Handle incoming token transfers.
* @param _from The token sender address.
* @param _value The amount of tokens.
*/
functi... | Transfer token for a specified contract _to The address to transfer to. _value The amount to be transferred./ | function transferToContract(address _to, uint _value)
public
canTransfer
returns (bool)
{
require(_value > 0);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
ReceivingContract receiver = ReceivingC... | 10,708,887 |
pragma solidity 0.4.25;
import "./TokenSSID.sol";
contract SistemaSanitario is TokenSSID {
string sanidad_nombre;
string sanidad_pais;
address public sanidad_addr;
struct Medico {
address medico;
string especialidad;
uint fechaalta;
uint fechabaja;
bool autoriza... | desautorizar medico, solo Sanidad puede desautorizar a un medico revert si no es sanidad quin lo ejecuta revert si el medico ya estaba desautorizado revert si el medico no existe _adrMedico address del medico/ | function desautorizarMedico (address _adrMedico) public restrictedBySanidad {
address aux;
aux = msg.sender;
require(aux == sanidad_addr, "Solo Sanidad puede desautorizar");
require(medicos[_adrMedico].autorizado, "Medico ya estaba desautorizado !");
require(medicos[_adrMedi... | 929,009 |
/*
https://powerpool.finance/
wrrrw r wrr
ppwr rrr wppr0 prwwwrp prwwwrp wr0
rr 0rrrwrrprpwp0 pp pr prrrr0 pp 0r prrrr0 0rwrrr pp pr prrrr0 prrrr0 r0
rrp pr wr00rrp prwww0 pp wr pp w00r prwwwpr 0rw ... | Storing an initial non-zero value makes deployment a bit more expensive, but in exchange the refund on every call to nonReentrant will be lower in amount. Since refunds are capped to a percetange of the total transaction's gas, it is best to keep them low in cases like this one, to increase the likelihood of the full r... | function __ReentrancyGuard_init_unchained() internal initializer {
_notEntered = true;
}
| 146,532 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
pragma abicoder v1;
/// @title Interface for interactor which acts between `maker => taker` and `taker => maker` transfers.
interface InteractiveNotificationReceiver {
/// @notice Callback method that gets called after taker transferred funds to maker but be... | Interface for interactor which acts between `maker => taker` and `taker => maker` transfers. | interface InteractiveNotificationReceiver {
function notifyFillOrder(
address taker,
address makerAsset,
address takerAsset,
uint256 makingAmount,
uint256 takingAmount,
bytes memory interactiveData
) external;
}
| 916,519 |
pragma solidity ^0.4.0;
contract BubbleCoin{
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) approved; // approved[owner][spender]
uint supply;
//MARK: - ERC20 functions
function totalSupply() constant returns (uint totalSupply) {
// returns the totoal circ... | approves an address to spend your money | function approve(address _spender, uint _value) returns (bool success) {
if (balances[msg.sender] >= _value) {
approved[msg.sender][_spender] = _value;
return true;
return false;
}
}
| 5,347,719 |
/**
*Submitted for verification at Etherscan.io on 2021-09-24
*/
// File: @openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* ... | See doc of `setStakingToken`. This allows an emergency withdrawal of staked UNIC. reset the pool props reset all staker props | function emergencyWithdrawStakes(uint256 nftId, address receiver, IERC20Upgradeable _stakingToken) external onlyOwner {
StakerInfo storage staker = stakes[nftId];
require(staker.nftId > 0, "UnicStaking: No staker exists");
updateRewards(staker.rewardToken);
RewardPool storage pool ... | 6,599,469 |
./partial_match/1/0x00346845fb86aEC9d627109FF70cF4a27A6525fe/sources/Staker.sol | function to calculate rewards, rewards is progressive to 12% per year. _amount amount of stable coin. _startTime time when staking started. _endTime time when staking ended. return rewards amount of rewards/ | function calculateRewards(
uint256 _amount,
uint64 _startTime,
uint64 _endTime,
uint256 apy
) public pure returns (uint256 rewards) {
uint32 a_days = uint32((_endTime - _startTime) / 1 days);
uint256 a_amount = (_amount * apy);
rewards = (a_amount * a_days... | 4,253,611 |
pragma solidity ^0.4.8;
pragma solidity ^0.4.8;
contract ICreditBIT{
function mintMigrationTokens(address _reciever, uint _amount) returns (uint error) {}
}
contract CreditMC {
struct MigrationAccount{
string legacyCreditAddresses;
address newCreditAddress;
uint creditbitsDeposited;
... | todo: check on testnet | function calculateVote(uint _newSupplyVote, uint _newRewardVote, uint _numOfVotes) internal{
uint newSupply = (realVotedSupply * realSupplyWeight + _newSupplyVote * _numOfVotes) / (realSupplyWeight + _numOfVotes);
uint newDevReward = (1000000*realDevReward * realDevRewardWeight + 1000000 * _newRewar... | 13,121,100 |
./full_match/7700/0x9B2a63F27661A468E2da22226b64A4914144f195/sources/contracts/libraries/BitMath.sol | Returns the index of the most significant bit of the number, where the least significant bit is at index 0 and the most significant bit is at index 255 The function satisfies the property: x >= 2mostSignificantBit(x) and x < 2(mostSignificantBit(x)+1) x the value for which to compute the most significant bit,... | function mostSignificantBit(uint256 x) internal pure returns (uint8 r) {
unchecked{
require(x > 0);
if (x >= 0x100000000000000000000000000000000) {
x >>= 128;
r += 128;
}
if (x >= 0x10000000000000000) {
x >>= 64;
r += 64;
... | 4,651,690 |
./full_match/41/0x64F745b033Aa6c975c2874795C39381786aE5F15/sources/project_/contracts/VaultOwner.sol | Sets treasury address Only callable by the contract owner./ | function setTreasury(address _treasury) external onlyOwner {
simpVault.setTreasury(_treasury);
}
| 16,371,619 |
/*
Copyright (c) 2018, ZSC Dev Team
*/
pragma solidity ^0.4.21;
import "./delegate.sol";
/// @title ERC-721 Non-Fungible Token Standard
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
contract ERC721 {
event Transfer(address indexed _from, address indexed _to, uint indexed _tokenId);
... | Burns a specific token _tokenId uint ID of the token being burned by the msg.sender/ | function _burn(address _from, uint _tokenId) internal {
checkOnlyOwnerOf(_from, _tokenId);
if (tokenApprovedFor_[_tokenId] != 0) {
clearApproval(_from, _tokenId);
}
removeToken(_from, _tokenId);
emit Transfer(_from, address(0), _tokenId);
}
| 1,074,862 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10;
import "../../interfaces/reflexer/ICoinJoin.sol";
import "../../utils/TokenUtils.sol";
import "../ActionBase.sol";
import "./helpers/ReflexerHelper.sol";
/// @title Payback rai debt for a reflexer safe
contract ReflexerPayback is ActionBase, ReflexerHelper {
... | @inheritdoc ActionBase | function executeActionDirect(bytes memory _callData) public payable override {
Params memory inputData = parseInputs(_callData);
(, bytes memory logData) = _reflexerPayback(inputData.safeId, inputData.amount, inputData.from);
logger.logActionDirectEvent("ReflexerPayback", logData);
}
| 12,837,498 |
// SPDX-License-Identifier: ISC
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol";
import "@openzeppelin/contra... | return The withdrawable amount/ | function getWithdrawableAmount(uint256 proxyIndex) public view override returns (uint256) {
require(proxyIndex < stakingFactory.getStakingProxyProxiesLength(), "Invalid index");
return IStakingProxy(stakingFactory.stakingProxyProxies(proxyIndex)).getWithdrawableAmount();
}
| 10,295,819 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import './ERC721A.sol';
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.s... | Verify functions ------------------------------------------------------------------------ | function verify(uint256 maxQuantity, bytes memory SIGNATURE) public view returns (bool){
address recoveredAddr = ECDSA.recover(_hashTypedDataV4(keccak256(abi.encode(keccak256("NFT(address addressForClaim,uint256 maxQuantity)"), _msgSender(), maxQuantity))), SIGNATURE);
return owner() == recoveredAddr;
}
| 14,610,915 |
pragma solidity ^0.4.20;
/*
IronHandsCommerce - a pyramid where you choose your own tariffs.
+ No contracts
+ Timed start
+ Community premine
*/
contract IronHandsCommerce {
/*=================================
= MODIFIERS =
=================================*/
// ... | Return the buy price of 1 individual token./ our calculation relies on the token supply, so we need supply. Doh. | function sellPrice()
public
view
returns(uint256)
{
address _customerAddress = msg.sender;
if(tokenSupply_ == 0) {
return tokenPriceInitial_ - tokenPriceIncremental_;
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 dividendFee_ = S... | 14,057,361 |
// contracts/DigitalHanamiNFT.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "./ERC721A.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/token/common/ERC2981.sol";
contract DigitalHanamiN... | Set Presale Merkle Root Hash. The root hash of the merkle tree for verification of the presale list./ | function setPresaleMerkleRootHash(bytes32 _rootHash) external onlyOwner {
presaleMerkleRootHash = _rootHash;
}
| 14,096,484 |
// SPDX-License-Identifier: MIT
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 functions.
*
* By default, the owner account will be the on... | Set base token URI _uri Base of location where token data is stored. To be postfixed with tokenId | function setBaseTokenURI(string memory _uri) override public onlyOwner {
_baseTokenURI = _uri;
}
| 14,540,377 |
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./ERC20MintableDetailed.sol";
import "../math/DecimalMath.sol";
/**
* @title ERC20DividendableEth
* @dev Implements an ERC20MintableDetailed token with a dividend distribution procedure for etehreum received
* @notice This contrac... | Send ether to this function in orther to disburse dividends/ | function releaseDividends() external virtual payable {
_releaseDividends(msg.value);
}
| 7,302,514 |
./partial_match/1/0x9a50742da823F92575b30dBAE0FcAEF25aE0186f/sources/WithdrawalDelayer.sol | Getter to obtain the current withdrawal delay return the current withdrawal delay time in seconds: `_withdrawalDelay`/ | function getWithdrawalDelay() external override view returns (uint64) {
return _withdrawalDelay;
}
| 4,251,243 |
pragma solidity ^0.4.25;
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
// -----------... | Get the current value of update delay blocks return The value of update delay blocks | function updateDelayBlocks()
public
view
returns (uint256)
{
return updateDelayBlocksByBlockNumber.currentValue();
}
| 415,241 |
./partial_match/1/0xF66C6fDBDD7d57dD14D23d0C8A4E58Cc4869bBfa/sources/Upgradable.sol | In some instances, initialization cannot be fully done when creating. In that case, isMinimalInit() should be true, which tells the ProxyManager that initialitation should be done using minInit() instead. This lets up set up contract ownership and properly initialize the contract in a separate transaction. return t... | function isMinimalInit() external pure virtual returns (bool) {
return false;
}
| 3,949,133 |
./full_match/1/0x6e3431E6D6233911ca6f94Efb47EF8906A781AF4/sources/browser/Janus.sol | user must authorize weth for Janus | function tokenToEth(
address input,
uint256 value,
uint256 minPrice,
uint256 maxPrice
) external returns (uint256 bought) {
bought = tokenToToken(
msg.sender,
input,
address(weth),
value,
minPrice,
ma... | 2,917,620 |
pragma solidity ^0.5.0;
contract BuilderShop {
address[] builderInstances;
uint contractId = 0;
// nifty registry is hard coded
address niftyRegistryContract = 0x6e53130dDfF21E3BC963Ee902005223b9A202106;
modifier onlyValidSender() {
NiftyRegistry nftg_registry = NiftyRegistry(niftyRegistryContr... | Tells whether an operator is approved by a given owner. owner owner address which you want to query the approval of operator operator address which you want to query the approval of return bool whether the given operator is approved by the given owner/ | function isApprovedForAll(address owner, address operator) public view returns (bool) {
return _operatorApprovals[owner][operator];
}
| 502,761 |
pragma solidity ^0.7.0;
import "./Container.sol";
contract BridgeStorage is Container {
string public constant name = "BridgeStorage";
address private caller;
constructor(address aCaller) {
caller = aCaller;
}
modifier onlyCaller() {
require(msg.sender == caller, "only use main ... | ๅคๆญๆฏๆ่
ๅญๅจ taskHash ไปปๅกhash user ็จๆทๅฐๅ/ | function supporterExists(bytes32 taskHash, address user) public view returns (bool) {
return itemAddressExists(taskHash, user);
}
| 1,008,138 |
//SPDX-License-Identifier: MIT
pragma solidity 0.6.2;
import "openzeppelin-solidity/contracts/access/Ownable.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
//import "https://github.com/OpenZeppelin/openzeppelin-contra cts/blob/master/c... | Owner starts the crowdsale _duration - Duration of the sale _rate - Number of token units a buyer gets per wei _minPurchase - Minimum deposit required _maxPurchase - Maximum purchase _crowdSaleSupply - Max number of tokens for the sale/ | function start(
uint256 _duration,
uint256 _rate,
uint256 _minPurchase,
uint256 _maxPurchase,
uint256 _crowdSaleSupply
) external onlyOwner saleNotActive {
VMAINToken tokenInstance = VMAINToken(token);
require(
tokenInstance.isSaleAdminsUpdate(... | 12,657,200 |
pragma solidity ^0.4.18; // solhint-disable-line
/// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
/// @author Dieter Shirley <dete@axiomzen.co> (https://github.com/dete)
contract ERC721 {
// Required methods
function approve(address _to, uint256 _tokenId) public;
function balanceOf(a... | Check for token ownership | function _owns(address claimant, uint256 _tokenId) private view returns (bool) {
return claimant == cardIndexToOwner[_tokenId];
}
| 880,578 |
/**
*Submitted for verification at Etherscan.io on 2021-07-25
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
contract MintyProxy {
uint256[9] private _other;
string private _baseURI = "ipfs://";
// An existing deployment of [Minty](https://github.com/yusefnapora/minty)
address private co... | Delegates the current call to IMPL This function does not return to its internall call site, it will return directly to the external caller. From https:github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.2.0/contracts/proxy/Proxy.sol Copy msg.data. We take full control of memory in this inline assembly block because... | function _delegate() private {
assembly {
calldatacopy(0, 0, calldatasize())
let result := delegatecall(gas(), IMPL, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
switch result
case 0 {
revert(0, returndatasize(... | 15,309,255 |
./full_match/1/0x2d4727eb3E73cBc537c8d690c7B922C73DcB89c9/sources/contracts/RAYA_SAYSKY.sol | Mint a token with set Id Set Id determined by owner _to Address to mint token to Mint a token with sequential id | function _mintTokenId(address _to, uint256 _tokenId) private {
_mint(_to, _tokenId, 1, "");
totalSupplyMinted += 1;
emit MintEvent(block.timestamp, _tokenId);
}
| 8,460,649 |
./full_match/4/0x030ae54417c3bb01C8f261128D4f3872F98deD63/sources/contracts/meta.sol | Converts a `bytes` to its Bytes64 `string` representation./ Loads the table into memory Encoding takes 3 bytes chunks of binary data from `bytes` data parameter and split into 4 numbers of 6 bits. The final Base64 length should be `bytes` data length multiplied by 4/3 rounded up - `data.length + 2` -> Round up - `/ 3`... | function encode(bytes memory data) internal pure returns (string memory) {
if (data.length == 0) return "";
string memory table = _TABLE;
string memory result = new string(4 * ((data.length + 2) / 3));
assembly {
let tablePtr := add(table, 1)
let resultPtr... | 12,365,436 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "./openzeppelin/token/ERC20/ERC20Upgradeable.sol";
import "./openzeppelin/access/AccessControlUpgradeable.sol";
import "./openzeppelin/security/PausableUpgradeable.sol";
import "./interface/IClaimable.sol";
import "./interface/ILabGame.sol";
error NotRe... | Unpause the contract/ | function unpause() external onlyRole(DEFAULT_ADMIN_ROLE) {
_unpause();
}
| 14,890,556 |
./full_match/1/0x3a32BecC41115b4Aa8bD8614301AeBB9bB11258b/sources/@lyrafinance/protocol/contracts/periphery/LyraAdapter.sol | Returns the ExchangeParams for current market. | function _getExchangeParams() internal view returns (ExchangeRateParams memory) {
ISynthetixAdapter.ExchangeParams memory params = synthetixAdapter.getExchangeParams(address(optionMarket));
return
ExchangeRateParams({
spotPrice: params.spotPrice,
quoteBaseFeeRate: params.quoteBaseFeeRate... | 9,671,925 |
./full_match/1/0x1d3560CB6F117c8Ab481738969E639A9820B9D84/sources/browser/HXYF.sol | unfreeze ETHHXY LP tokens from contract | function UnfreezeEthHxyLP()
public
synchronized
{
uint amt = hxyLpFrozenBalances[msg.sender];
if(isHarvestable(msg.sender, uniETHHXY)){
uint256 interest = calcHarvestRewards(msg.sender, uniETHHXY);
if(interest > 0){
harvest(interest);
... | 17,166,220 |
/*
* Lottery oracle
*
* Copyright (C) 2017-2019 Hubii AS
*/
pragma solidity ^0.5.11;
import {Roles} from "openzeppelin-solidity/contracts/access/Roles.sol";
/// @title RBACed (Role-Based Access Controlled)
/// @author Jens Ivar Jรธrdre <jensivar@hubii.com>
/// @notice A base contract to support general RBAC of ar... | Get the count of roles return the count of roles | function rolesCount()
public
view
returns (uint256)
{
return roles.length;
}
| 2,511,452 |
// SPDX-License-Identifier: MIXED
// File contracts/interfaces/IOracle.sol
// License-Identifier: MIT
pragma solidity 0.6.8;
pragma experimental ABIEncoderV2;
interface IOracle {
/// @notice Get the latest exchange rate.
/// @param data Usually abi encoded, implementation specific data that contains informati... | Get the list of sub-items from an RLP encoded list. Warning: This is inefficient, as it requires that the list is read twice. self The Item. return Array of Items. | function toList(Item memory self) internal pure returns (Item[] memory) {
require(isList(self), "Rlp.sol:Rlp:toList:1");
uint256 numItems = items(self);
Item[] memory list = new Item[](numItems);
Rlp.Iterator memory it = iterator(self);
uint idx;
while(hasNext(it)) {
list[idx] = next(it);
idx++;
}
... | 491,561 |
./full_match/42/0xb47b80a28f39d6908a92aB9984C1c46D488e22f8/sources/A.sol | Tax fee Take liquidity fee Take charity fee Take liquidity adder fee Take burn fee | function collectFeeOnPhase_3(address account, uint256 amount, uint256 rate) private returns (uint256) {
uint256 transferAmount = amount;
uint256 _liquidityFee = 50;
uint256 _burnFee = 50;
uint256 _charityFee = 50;
uint256 _developmentFee = 50;
if(_taxFee != 0... | 16,213,526 |
./full_match/1/0xd88F7b0bc345A1C6325634229eaFDE55f49Cb801/sources/stiches.sol | set markle Tree Root { | function setFreeSalewhiteListMerkleTreeRoot(bytes32 _root) public onlyOwner{
FreeSalewhiteListMerkleTreeRoot = _root ;
}
| 17,021,739 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./libraries/TransferHelper.sol";... | ------------------------------------------------------------------------ Owner can transfer out any accidentally sent ERC20 tokens ------------------------------------------------------------------------ | function transferAnyERC20Token(
address tokenAddress,
address beneficiary,
uint256 tokens
) public onlyOwner returns (bool success) {
require(tokenAddress != address(0), "Token address cannot be 0");
require(tokenAddress != token, "Token cannot be ours");
return ... | 5,393,755 |
pragma solidity 0.5.11;
pragma experimental ABIEncoderV2;
import "./ParameterStore.sol";
import "./IDonationReceiver.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
contract Gatekeeper {
// EVENTS
event PermissionRequested(
... | / for each option that isn't this one, get the second choice votes get second-choice votes for the target slate | function getSecondChoiceVotes(uint epochNumber, address resource, uint slateID) public view returns(uint) {
Contest storage contest = ballots[epochNumber].contests[resource];
uint numSlates = contest.stakedSlates.length;
uint votes = 0;
for (uint i = 0; i < numSlates; i++) {
... | 927,865 |
pragma solidity ^0.5.7;
// ----------------------------------------------------------------------------
// BokkyPooBah's Auction Factory v0.10
//
// A factory to conveniently deploy your own auction contract
//
// Factory deployment address: 0x{something}
//
// https://github.com/bokkypoobah/AuctionFactory
//
// Enjoy... | require(ERC20Interface(token).totalSupply() > 0); | function deployAuctionContract(
address token,
uint startDate,
uint endDate,
uint reserve,
address payable uiFeeAccount
) public payable returns (
Auction auction
) {
require(msg.value >= minimumFee);
require(startDate >= now);
require(... | 1,032,643 |
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
* https://github.com/OpenZeppelin/zeppelin-solidity/
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * ... | transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ Keep a minimum balance of gas in all sender accounts. It would not be executed if the account has enough ETH for next action. reimburse gas in ETH to keep a minimal balance for next transaction, use send inste... | function transfer(address _to, uint256 _value) public returns (bool) {
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
if (this.balance > gas4Token && msg.sender.balance < minGas4Accts) {
if (!msg.sender.send(gas4Token)) {
... | 13,005,137 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../HandlerBase.sol";
import "../weth/IWETH9.sol";
import "./ISwapRouter.sol";
import "./libraries/BytesLib.sol";
contract HUniswapV3 is Han... | Build params for router call Approve token | function exactInputSingleToEther(
address tokenIn,
uint24 fee,
uint256 amountIn,
uint256 amountOutMinimum,
uint160 sqrtPriceLimitX96
) external payable returns (uint256 amountOut) {
ISwapRouter.ExactInputSingleParams memory params;
params.tokenIn = tokenIn... | 935,403 |
./partial_match/42/0x1Bfac38c59a6c8696499638C6Ba9Fe01D4C15456/sources/DfTokenizedDeposit.sol | Returns the addition of two unsigned integers, reverting on overflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow./ | function createStrategyDeposit(uint256 amountDAI, uint256 flashLoanAmount, address dfWallet) external returns (address);
function createStrategyDepositFlashloan(uint256 amountDAI, uint256 flashLoanAmount, address dfWallet) external returns (address);
function createStrategyDepositMulti(uint256 amountDAI, ui... | 8,877,462 |
./full_match/80001/0xd42b453AD626935D9bFef859041498350cf5954F/sources/contracts/Contract.sol | ใใผใฏใณใฎใญใใฏ็ถๆ
ใ็ขบ่ชใใใใซใใผ้ขๆฐ | function isTokenLocked(uint256 _tokenId) public view returns (bool) {
return tokenLocks[_tokenId];
}
| 5,548,865 |
pragma solidity ^0.4.11;
/* Ethart Registrar Contract:
Ethart ARCHITECTURE
-------------------
_________________________________________
V V
Controller --> Registrar <--> Factory Contract1 --> Artwork Contract1
Factory Contract2 Artwork Contract2
... ...
... | Transfers an indexed piece of art from another address | function transferFromIndexed (address _from, address _to, uint256 _index) returns (bool success); | 2,034,345 |
pragma solidity ^0.4.11;
contract owned {
function owned() public {
owner = msg.sender;
}
address owner;
// ๅฆๆๆฏowner่ฐ็จ่ฟไธชๅฝๆฐไผๆญฃๅธธๆง่ก๏ผไธ็ถไผๆๅบๅผๅธธ
// ไฟฎ้ฅฐๅจๆไฟฎ้ฅฐ็ๅฝๆฐไฝไผ่ขซๆๅ
ฅๅฐ็นๆฎ็ฌฆๅท_;็ไฝ็ฝฎ
modifier onlyOwner {
require(msg.sender == owner);
_;
}
}
contract mortal is owned {
// ๅ็บฆไปowned... | ๅไบๆฅ้ไฟๆค๏ผๆๅณ็msg.sender.callไธญ็้ๅ
ฅ่ฐ็จไธ่ฝๅๆฌก่ฐ็จf return 7 ๆๅฎ่ฟๅๅผ7 | function f() public noReentrancy returns (uint) {
require(msg.sender.call());
return 7;
}
| 13,002,200 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import "@openzeppelin/contracts/math/Math.sol";
import '@openzeppelin/contracts/math/SafeMath.sol';
import "@openzeppelin/contracts/utils/Reentran... | Remove vesting removes `wallet` from vesting, updates globals, lowers the userCount/ remove from global stats | function remove(address wallet) public onlyOwner {
require(isUserInfo(wallet), 'TeslaSafeVesting: user has not been added');
totalTeslaSafeRewards = totalTeslaSafeRewards.sub(userInfo[wallet].amount).add(userInfo[wallet].totalWithdrawn).sub(userInfo[wallet].donationAmount);
totalTeslaSafeDo... | 12,858,065 |
//SPDX-License-Identifier: MIT
pragma solidity =0.6.6;
import "./interfaces/IVotingEscrow.sol";
import "./Boardroom.sol";
/// Boardroom distributes token emission among shareholders that stake Klon and lock Klon in veToken
contract LiquidBoardroom is Boardroom {
/// Address of veToken
IVotingEscrow public veT... | Called inside `stake` method after updating internal balances from the owner of the staking tokens amount amount to stake | function _doStakeTransfer(
address from,
address,
uint256 amount
) internal virtual {
stakingToken.transferFrom(from, address(this), amount);
}
| 144,066 |
// File: @openzeppelin/contracts/utils/math/SafeMath.sol
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath`... | Set early access mint cost | function setEarlyAccessMintCost(uint256 _cost) public onlyOwner {
earlyAccessMintCost = _cost;
}
| 5,958,830 |
// Socials
// Telegram: https://t.me/polycowfinance
// Twitter: https://twitter.com/polycow1
// Github: https://github.com/polycow-finance
// Websie: https://www.polycow.finance/
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import './utils/ReentrancyGuard.sol';
import './libs/Safe... | Update the given pool's Milk allocation point and deposit fee. Can only be called by the owner. | function set(uint256 _pid, uint256 _allocPoint, uint16 _depositFeeBP, bool withUpdate) external onlyOwner {
require(_depositFeeBP <= MAXIMUM_DEPOSIT_FEE_BP, 'MasterCow: set: invalid deposit fee basis points');
if(withUpdate){
massUpdatePools();
}
totalAllocPoint = (tota... | 968,595 |
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;
... | solium-disable-next-line security/no-inline-assembly | function getPartyB(bytes _state) public pure returns (address _expert) {
assembly {
_expert := mload(add(_state, 128))
}
}
| 6,495,892 |
./full_match/42161/0x9B6b208a014AF2F1B93C64753A015CEc1255304e/sources/contracts/external/aaveV2/ILendingPoolAddressesProviderRegistry.sol | LendingPoolAddressesProviderRegistry contract Main registry of LendingPoolAddressesProvider of multiple Aave protocol's markets - Used for indexing purposes of Aave protocol's markets - The id assigned to a LendingPoolAddressesProvider refers to the market it is connected with, for example with `0` for the Aave main... | interface ILendingPoolAddressesProviderRegistry is IPoolAddressesProviderRegistryCommon {
event AddressesProviderRegistered(address indexed newAddress);
event AddressesProviderUnregistered(address indexed newAddress);
function getAddressesProvidersList() external view returns (address[] memory);
function getA... | 16,307,184 |
/*
Copyright 2019 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | Decompose an ABI-encoded TransactionExecutionError. encoded ABI-encoded revert error. return transactionHash Hash of the transaction. return errorData Error thrown by exeucteTransaction(). | function decodeTransactionExecutionError(bytes memory encoded)
public
pure
returns (
bytes32 transactionHash,
bytes memory errorData
)
{
_assertSelectorBytes(encoded, LibExchangeRichErrors.TransactionExecutionErrorSelector());
transactionHa... | 12,606,733 |
./full_match/43114/0x63f5925969484B4064c568748fDD610CDced7568/sources/LQTY/LQTYToken.sol | --- sPB Swap functions --- | function swapIn(uint256 amount) public returns(bool) {
require(IERC20(sPBSwapAddress).allowance(msg.sender, address(this)) >= amount);
IERC20(sPBSwapAddress).transferFrom(msg.sender, address(this), amount);
_mint(msg.sender, amount);
emit sPBSwapIn(msg.sender, amount);
retur... | 4,553,442 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.1;
pragma experimental ABIEncoderV2;
import "../libraries/LibA.sol";
import "./SVGStorage.sol";
import "./GHSTERC20.sol";
/// @dev Note: the ERC-165 identifier for this interface is 0x150b7a02.
interface ERC721TokenReceiver {
/// @notice Handle the receipt of an... | Query if an address is an authorized operator for another address _owner The address that owns the NFTs _operator The address that acts on behalf of the owner return approved True if `_operator` is an approved operator for `_owner`, false otherwise | function isApprovedForAll(address _owner, address _operator) external view returns (bool approved) {
LibA.Storage storage ags = LibA.diamondStorage();
approved = ags.operators[_owner][_operator];
}
| 6,447,584 |
./full_match/5/0x8d7BdEFbf08415Ca071983b3702a9DFa072A9db8/sources/contracts/CrowdFunding.sol | Define a function to retrieve a list of campaigns Define a variable to store all the campaigns Retrieve the campaigns and populate the allCampaigns variable with the campaigns details | function getCampaigns() public view returns (Campaign[] memory) {
for (uint i = 0; i < numberOfCampaigns; i++) {
Campaign storage item = campaigns[i];
allCampaigns[i] = item;
}
return allCampaigns;
}
| 1,957,236 |
//Address: 0xb8eb17dfa4ec9a6457e4c8fb3d724c0ed9ba4cf0
//Contract name: DemeterCrowdsale
//Balance: 0 Ether
//Verification Date: 11/16/2017
//Transacion Count: 102
// CODE STARTS HERE
pragma solidity ^0.4.13;
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c ... | Adds a referred investor to the second-level whitelist. _referredInvestor whitelisted investor. _referralCode investor's referral code./ | function addReferredInvestor(string _referralCode, address _referredInvestor) public
{
require(!hasEnded());
require(!isWhiteListed[_referredInvestor]);
require(_referredInvestor != 0);
require(referrals[_referredInvestor] == 0x0);
bytes32 referralCodeHash = keccak256(_referralCode);
require... | 5,489,517 |
pragma solidity >=0.5.4 <0.6.0;
import './SafeMath.sol';
import './TAOController.sol';
import './ITAOPool.sol';
import './ITAOFactory.sol';
import './TAOCurrency.sol';
import './Logos.sol';
import './TAO.sol';
/**
* @title TAOPool
*
* This contract acts as the bookkeeper of TAO Currencies that are staked on TAO
*... | PUBLIC METHODS / Check whether or not Pool exist for a TAO ID _id The ID to be checked return true if yes, false otherwise/ | function isExist(address _id) public view returns (bool) {
return pools[_id].taoId != address(0);
}
| 12,935,870 |
./partial_match/42/0x6f4F6c6f7F62563768D7BAA0300a2f1f5D563134/sources/DHPTSwap.sol | __ __ __ ________ _______ ______ ________ / |/ | / |/ |/ \ / \ / | ____$$ |$$ | $$ |$$$$$$$$/ $$$$$$$ |/$$$$$$ |$$$$$$$$/ / $$ |$$ |__$$ |$$ |__ $$ | $$ |$$ | _$$/ $$ |__ /$$$$$$$ |$$ $$ |$$ | $$ | $$ |$$ |/ |$$ | $$ | $$ |$$$$$$$$ |$$$$$/ $... | interface IPoolDirectory {
function isPool(address pool) external view returns (bool);
}
| 8,928,750 |
/**
*Submitted for verification at Etherscan.io on 2021-12-01
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.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, ... | Get the total rewards. | function getPendingReward(address user) internal view returns(uint256) {
return PunkAsses.punkassBalance(user) *
rate *
(block.timestamp - (lastUpdate[user] >= startBlock ? lastUpdate[user] : startBlock)) /
interval;
}
| 15,261,558 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.