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.5.0;
import "./lib/RLP.sol";
import "./lib/ECRecovery.sol";
contract Blocks {
using RLP for RLP.RLPItem;
using RLP for RLP.Iterator;
using RLP for bytes;
using RLP for bytes;
///* Storage *///
address internal Operator;
mapping(uint64 => BlockHeader) internal Headers;
... | ensure that a height of submitted block is expected value ensure that a signer of submitted blocks is equal to the operator | function verifySubmission(
Submission memory submission
) internal view returns(bool valid) {
require(lastBlockNumber + 1 == submission.height, "unexpected height is submitted");
bytes32 headersHash = makeHashFromHeaders(submission.headers);
return ECRecovery.recover(headersHash,... | 14,107,360 |
pragma solidity ^0.4.21;
/**xxp 校验防止溢出情况
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
funct... | Allocate initial balance to the owner | function EchoChainToken() public {
name = "EchoChain";
symbol = "ECO";
decimals = 18;
totalSupply = 1000000000 * 10 ** uint256(decimals);
balances[msg.sender] = totalSupply;
}
| 6,709,612 |
/**
*Submitted for verification at Etherscan.io on 2019-09-13
*/
pragma solidity ^0.5.0;
/**
* @title Tellor Transfer
* @dev Contais the methods related to transfers and ERC20. Tellor.sol and TellorGetters.sol
* reference this library for function's logic.
*/
library TellorTransfer {
using SafeMath for uint256;
... | Helps initialize a dispute by assigning it a disputeId when a miner returns a false on the validate array(in Tellor.ProofOfWork) it sends the invalidated value information to POS voting _requestId being disputed _timestamp being disputed _minerIndex the index of the miner that submitted the value being disputed. Sin... | function beginDispute(uint _requestId, uint _timestamp,uint _minerIndex) external {
tellor.beginDispute(_requestId,_timestamp,_minerIndex);
}
}
| 15,869,232 |
pragma solidity ^0.5.0;
import "../UpgradeableToken.sol";
/**
* A sample token that is used as a migration testing target.
*
* This is not an actual token, but just a stub used in testing.
*/
contract TestMigrationTarget is StandardToken, UpgradeAgent {
UpgradeableToken public oldToken;
uint public original... | Mint new tokens to the migrator | function upgradeFrom(address _from, uint256 _value) public {
totalSupply = totalSupply.add(_value);
balances[_from] = balances[_from].add(_value);
emit Transfer(address(0), _from, _value);
}
| 12,648,536 |
./partial_match/42/0xdFf18ab57909a57e4660435B0935C09A1407d29A/sources/MasterchefDelegator.sol | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid) public virtual {
if (block.number <= stageOneDepositEndBlock) {
(uint256 amount, , , ) = stageOne.getUserInfo(_pid, msg.sender);
stageOne.withdraw(_pid, msg.sender);
emit Withdraw(msg.sender, _pid, amount);
return;
}
... | 3,296,309 |
./full_match/11155111/0xaFE9d35157E0B54cB8A56e970635959Ee88d882D/sources/contracts/Ticketing.sol | Function to mark ticket as used and can only be called by the contract deployer | function useTicket(uint256 _ticketId) external onlyOwner {
require(tickets[_ticketId].confirmTicketUse, "Ticket use not confirmed by owner");
require(!tickets[_ticketId].used, "Ticket has already been used");
require(block.timestamp <= tickets[_ticketId].validUntil, "Ticket validity has expi... | 3,809,656 |
pragma solidity ^0.5.0;
// ----------------------------------------------------------------------------
// 'FLETA' 'Fleta Token' token contract
//
// Symbol : FLETA
// Name : Fleta Token
// Total supply: 2,000,000,000 (Same as 0x7788D759F21F53533051A9AE657fA05A1E068fc6)
// Decimals : 18
//
// Enjoy.
//
// (c) Sam J... | ------------------------------------------------------------------------ Token owner can approve for `spender` to transferFrom(...) `tokens` from the token owner's account. The `spender` contract function `receiveApproval(...)` is then executed ------------------------------------------------------------------------ | function approveAndCall(address spender, uint tokens, bytes memory data) public returns (bool success) {
require(msg.sender != spender);
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data);
... | 373,992 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;
import "./MockMessageVerifier.sol";
import "./MockInboundLane.sol";
import "../interfaces/IOnMessageDelivered.sol";
contract MockOutboundLane is MockMessageVerifier {
struct ConfirmInfo {
address sender;
bool result;
}
address remoteI... | call target contract | function send_message(address targetContract, bytes calldata encoded) external payable returns (uint256) {
bool result = MockInboundLane(remoteInboundLane).mock_dispatch(msg.sender, targetContract, encoded);
nonce += 1;
responses[nonce] = ConfirmInfo(msg.sender, result);
return encod... | 12,582,553 |
./partial_match/1/0x76EA2186182E3Ec27C2D9C7394b83E5C8F2cf6C4/sources/NFTRewardsVault.sol | Update the given pool's allocation point. | function set(
uint256 _pid,
uint256 _allocPoint,
bool _withUpdate
) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(
_allocPoint
);
poolInfo[_pid].allocPoint = _allocPoint;
}
| 3,677,090 |
./full_match/5/0xB3fF7D09c4871cfCfea4e1520e6565092B213AaB/sources/contracts/utilities/Sweepable.sol | sweep native token to the owner | function sweepNative() external onlyOwner {
uint256 amount = address(this).balance;
require(success, "Transfer failed.");
emit SweepNative(amount);
}
| 1,862,406 |
./full_match/4/0x77a6680ACc029609F658cf2064b4356143DC860C/sources/browser/IERC721Metadata.sol | ERC-721 Non-Fungible Token Standard, optional metadata extension/ | interface IERC721Metadata {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function tokenURI(uint256 tokenId) external view returns (string memory);
}
| 670,072 |
./full_match/44787/0x774263E01b21FE6eE0133e749Ec8811135400a1B/sources/project_/contracts/UnergyData.sol | holder initialization; | function setHolders(
address projectAddr,
address holder_
)
public
whenNotPaused
hasRoleInPermissionGranter(
msg.sender,
"setHolders"
)
{
DataStructure.Holders[] storage holders;
DataStructure.Holders memory holder = Dat... | 13,277,184 |
./partial_match/56/0x97a32B4f8486735075f2cBEcff64208fBF2e610A/sources/contracts/libraries/Transfer.sol | Transfers tokens from msg.sender to a recipient Errors with ST if transfer fails token The contract address of the token which will be transferred to The recipient of the transfer value The value of the transfer | function safeTransfer(
address token,
address to,
uint256 value
) internal {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transfer.selector, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), "ST");
}
| 11,291,606 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.6;
import "./GMsDerivativeBase.sol";
contract GenerativemasksGirl is GMsDerivativeBase {
constructor(
string memory baseURI,
address _derivedFrom
)
GMsDerivativeBase(
"Generativemasks Girl",
"GMGIRL",
baseURI,
... | Allow a GMs token holder to bulk mint tokens with id of their GMs tokens' id tokenIds Ids to be minted/ If no reserved allowance we respect total supply contraint To avoid wasting gas we want to check all preconditions beforehand If reserved allowance is active we track mints count | function multiMintWithGMsTokenIds(uint256[] memory tokenIds) public payable virtual nonReentrant {
uint256 maxTokensToMint = tokenIds.length;
require(maxTokensToMint <= MAX_MULTI_MINT_AMOUNT, "GMsPass:TOO_LARGE");
require(
(reservedAllowance == 0 && mintedCount + maxTokensToMint ... | 12,077,803 |
./partial_match/1/0x3368E0DE8aB2B087771ee9Aa1e44777e45Ca9dCD/sources/contracts/ERC20/libraries/ERC20Pausable.sol | Pause the contract Access restriction must be overriden in derived class/ | function pause() external virtual {
_pause();
}
| 16,079,206 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, s... | Interface for the Doodles contract/ | interface IDoodles {
function balanceOf(address owner) external view returns(uint256);
function ownerOf(uint256 tokenId) external view returns(address);
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns(uint256);
}
| 6,906,494 |
./full_match/4/0xD6ee9785A54BFeb2bC9923DFA1E531c92c651F1c/sources/contracts/AuctionRaffle.sol | Selects one Golden Ticket winner from a random number. Saves the winner at the beginning of _raffleWinners array and sets bidder WinType to GOLDEN_TICKET. participantsLength The length of current participants array randomNumber The random number to select raffle winner from return participantsLength New participants ... | function selectGoldenTicketWinner(uint256 participantsLength, uint256 randomNumber)
private
returns (uint256, uint256)
{
uint256 winnerIndex = winnerIndexFromRandomNumber(participantsLength, randomNumber);
uint256 bidderID = _raffleParticipants[winnerIndex];
addGoldenTic... | 12,381,090 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* qu... | public Only charge if all free mints have been minted Free mint! | function mint(uint256 _mintAmount) public payable {
uint256 supply = totalSupply();
require(!paused);
require(_mintAmount > 0);
require(_mintAmount <= maxMintAmount);
require(supply + _mintAmount <= maxSupply);
if (supply >= freeMints){
require(msg.value... | 1,343,396 |
pragma solidity ^0.8.0;
// SPDX-License-Identifier: MIT
import "ERC721URIStorage.sol";
import "ERC721Enumerable.sol";
import "IERC2981.sol";
import "Ownable.sol";
import "Address.sol";
/**
* @title Sample NFT contract
* @dev Extends ERC-721 NFT contract and implements ERC-2981
*/
contract Token is Ownable, ERC72... | Called with the sale price to determine how much royalty is owed and to whom. _tokenId - the NFT asset queried for royalty information _salePrice - sale price of the NFT asset specified by _tokenId return receiver - address of who should be sent the royalty payment return royaltyAmount - the royalty payment ... | function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view
returns (address receiver, uint256 royaltyAmount) {
uint256 _royalties = (_salePrice * royaltiesPercentage) / 10000;
return (_royaltiesReceiver, _royalties);
}
| 13,802,641 |
./partial_match/42/0x936E65F7b1a2E06515729d71df28Dc926263906D/sources/PopsicleStand.sol | Changes Project token reward per block. Use this function to moderate the `lockup amount`. Essentially this function changes the amount of the reward which is entitled to the user for his LP staking by the time the `endBlock` is passed. However, the reward amount cannot be less than the amount of the previous token rew... | function changeProjectTokenPerBlock(uint _projectTokenPerBlock) external onlyOwner {
require(_projectTokenPerBlock > projectTokenPerBlock, "Project Token: New value should be greater than last");
projectTokenPerBlock = _projectTokenPerBlock;
}
| 8,875,072 |
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 pre... | The actual fill logic that is used internally by multiple operations. transfer amountToFill in fillAsset from filler to maker deduct amountToTake in takeAsset from offer | function _fill(
address _filler,
bytes32 _offerHash,
uint256 _amountToTake,
address _feeAsset,
uint256 _feeAmount
)
private
{
require(
_amountToTake > 0,
"Invalid input"
);
Offer storage offer = offers[_offerHas... | 956,526 |
./full_match/8453/0x5Ba641A1Fa1E6A7D033c9f6A8108d52B92b78257/sources/contracts/HATVaultsRegistry.sol | See {IHATVaultsRegistry-swapAndSend}. / Needed to avoid a "stack too deep" error hacker gets her reward via vesting contract solhint-disable-next-line not-rely-on-time solhint-disable-next-line not-rely-on-time | function swapAndSend(
address _asset,
address[] calldata _beneficiaries,
uint256 _amountOutMinimum,
address _routingContract,
bytes calldata _routingPayload
) external onlyOwner {
SwapData memory _swapData;
_swapData.hackerRewards = new uint256[](_benefici... | 11,548,682 |
pragma solidity ^0.4.11;
contract Pixel {
/* This creates an array with all balances */
struct Section {
address owner;
uint256 price;
bool for_sale;
bool initial_purchase_done;
uint image_id;
string md5;
uint last_update;
address sell... | Set the for sale flag and a price for a section to a specific address / Set a single section as for sale at the provided price in wei only to the supplied address. | function setSectionForSaleToAddress(
uint _section_index,
uint256 _price,
address _to
) {
if (_section_index >= sections.length) throw;
Section section = sections[_section_index];
if(section.owner != msg.sender) throw;
section.price = _price;
secti... | 12,839,874 |
./partial_match/1/0xa75Ee0A9A57B9f4badD3F8D64271A386d07d2B3b/sources/PositionTokenLogic.sol | reset approval to 0 | function _tradeUserAsset(
address sourceTokenAddress,
address destTokenAddress,
address receiver,
uint256 sourceTokenAmount,
bool throwOnError)
internal
returns (uint256 destTokenAmountReceived, uint256 sourceTokenAmountUsed)
{
address oracleAddres... | 2,863,097 |
pragma solidity ^0.4.16;
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
owner = newOwner;
}
}
i... | Buy tokens from contract by sending ether向合约的拥有者转移以太币 | function buy() payable public {
if(!owner.send(msg.value) ){
revert();
}
}
| 5,764,845 |
./partial_match/56/0xBE1e0536D99053ca046773B54E429996cBF81E02/sources/MasterChef.sol | See {BEP20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {BEP20}; Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for ... | function transferFrom (address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].BBNO(amount, 'BEP20: transfer amount exceeds allowanc... | 11,112,797 |
pragma solidity 0.7.5;
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import "@openzeppelin/contracts/access/AccessControl.sol";
import './Node.sol';
contract HeadNode is AccessControl {
bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
address[] public nodes;
mapping (address => bool)... | Can be called only by the account defined in constructor: DEFAULT_ADMIN_ROLE | function removeAdminNode (address _node, address _admin) public returns (bool) {
Node node = Node(_node);
node.revokeRole(ADMIN_ROLE, _admin);
return true;
}
| 1,003,690 |
//"SPDX-License-Identifier: UNLICENSED"
pragma solidity 0.6.6;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contrac... | create new hiring with default percentage for both renting and tiketing limit | function createHiring(address nftContract, uint256 buildingItem)
public
nonReentrant
{
_hiringIds.increment();
uint256 hiringId = _hiringIds.current();
idToHiring[hiringId] = Hiring(
hiringId,
nftContract,
rentPercentageLimit,
... | 13,552,316 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
interface IERC677 is IERC20, IERC20Metadata {
function transferAndCall(address recipient, uint amount, bytes memory data) ex... | min 8 hours, max 30 days | function setExecutionPeriodBlocks(uint256 _executionPeriodBlocks)
external
override
onlyThis
{
require(
_executionPeriodBlocks >= 1920 && _executionPeriodBlocks <= 172800
);
executionPeriodBlocks = _executionPeriodBlocks;
}
| 14,059,755 |
contract RobinHoodPonzi {
// Robin Hood Ponzi
//
// Payout from 1 Finney to 10 Finney 300%
// Payout from 10 Finney to 100 Finney 200%
// Payout from 100 Finney to 1 Ether 180%
// Payout from 1 Ether to 10 Ether 150%
// Payout from 10 Ether to 100 Ether 125%
// Payout from 100 Ether to 500... | this function is executed at initialization and sets the owner of the contract | function RobinHoodPonzi() {
owner = msg.sender;
}
| 5,528,610 |
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/helpers/PointerLibraries.sol | Reads the bytes31 at `rdPtr` in returndata. | function readBytes31(
ReturndataPointer rdPtr
) internal pure returns (bytes31 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
| 4,300,405 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of... | MAKE AN OFFER TO A BUYER IF BUYER HAS AN OFFER ALREADY, MAKE SURE IT IS NOT CLAIMED YET IF ABOVE CONDITIONS WERE MET, REGISTER OFFER | function makeOffer(address _toBuyer, uint256 _tokenAmount, uint256 _atPrice, uint32 _claimableUntil, uint32 _lockedUntil) public onlyOwner {
if(offers[_toBuyer].purchasePrice > 0){
require(offers[_toBuyer].tokenAmount > 0 && offers[_toBuyer].claimableUntil > 0, "Buyer already claimed the offer!... | 14,828,522 |
// contracts/mocks/TestStrategy.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../mocks/interfaces/IMMintableERC20.sol";
... | A real strategy would prepare to upgrade (remove tokens from farm) Transfer tokens A real strategy would finish to upgrade (send tokens to farm) | function upgradeFrom(
address _strat,
uint256 _sharesTotal,
uint256 _depositAmt,
uint256 _earnedAmt
) external onlyOwner {
require(_strat != address(0), "!strat");
IERC20(depositToken).safeTransferFrom(_strat, address(this), _depositAmt);
depositTotal = I... | 12,776,738 |
/**
*Submitted for verification at Etherscan.io on 2022-02-05
*/
// SPDX-License-Identifier: MIT
// # Runes.sol
// This is a ERC-20 token that is ONLY meant to be used as a extension for the Mysterious World NFT Project
// The only use case for this token is to be used to interact with The Mysterious World.
// This t... | getUnclaimedRunes returns the total amount of unclaimed runes a wallet has/ | function getUnclaimedRunes(address inhabitant) external view returns(uint256) {
return getPendingRunes(inhabitant);
}
| 7,739,791 |
./full_match/1/0x341AFE99daB6566E4bFe9fAcB6cf258Aa5619912/sources/contracts/rebase_engine/RebaseEngine.sol | This method calculates the user reward generated till now based on current accumulated pool weight and user staked amount/ | function _rebaseStake(address user) internal {
Stake memory stake = database.getUserStake(user);
uint currentAccumulatedWeight = database.getAccumulatedPoolWeight();
uint lastAccumulatedWeight = stake.lastStakingAccumulatedWeight;
uint256 distributedAmount = ((currentAccumulatedWe... | 17,038,662 |
/**
*Submitted for verification at Etherscan.io on 2021-09-28
*/
/**
*Submitted for verification at Etherscan.io on 2021-09-28
*By @Thrasher66099
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// File: @openzeppelin/contracts/utils/Context.sol
/*
* @dev Provides information about the current execu... | Mint Crypto Kaijus by owner/Mint address, 0 on first mintSupply is 1 so mint tokenId = 1 (which is the 2nd token) | function reserveCryptoKaijus(address _to, uint256 _numberOfTokens) external onlyOwner {
require(_to != address(0), "Invalid address to reserve.");
uint256 supply = totalSupply();
uint256 i;
for (i = 0; i < _numberOfTokens; i++) {
_safeMint(_to, supply + i);
... | 2,447,385 |
./partial_match/1313161554/0x0A60Bef6b2d3ADDFDC6d9d0cf11CD702AED8B209/sources/AriesPriceOracle.sol | never overflows, and + overflow is desired | function getPriceCumulativeCurrent(address uniswapV2Pair) internal view returns (uint256 priceCumulative) {
priceCumulative = IUniswapV2Pair(uniswapV2Pair).price0CumulativeLast();
(uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast) = IUniswapV2Pair(uniswapV2Pair).getReserves();
u... | 16,937,222 |
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal... | Get Users Lenght | function getUsersCount()
external
view
returns(uint) {
return allUsers.length;
}
| 12,785,230 |
./full_match/4/0x53F9d97EaA8dA97d85266fcd6d3b9013DcF57cD6/sources/contracts-v2/contracts/v2/ArtToken.sol | Creates a NFT _metaDataURI for the new token _metaData metadata JSONified string _marketplace address _encodedCallData of the create call in dst marketplace/ Create the new asset and allow marketplace to manage it Use this to override the msg.sender here. execute create order in destination marketplace | function createPub(
string calldata _metaDataURI,
string calldata _metaData,
address _marketplace,
bytes calldata _encodedCallData
)
external
{
this.approve(
_marketplace,
_create(address(this), _metaDataURI, _metaData)
);
... | 12,290,711 |
./partial_match/1/0x46C9CFB32627B74F91e0B5ad575c247AEc7e7847/sources/contracts/NftfiBundler.sol | Override validation if it is a transfer from the airdropFlashLoan contract giving back the flashloan. Validates the data from a child transfer and receives it otherwise _from The owner of the child token _childContract The ERC721 contract of the child token _childTokenId The token that is being transferred to the pa... | function _validateAndReceiveChild(
address _from,
address _childContract,
uint256 _childTokenId,
bytes memory _data
) internal virtual override {
if (_from == airdropFlashLoan) {
return;
super._validateAndReceiveChild(_from, _childContract, _childT... | 9,403,868 |
./full_match/43114/0x562BdcEff7aA89936e52E16EB52ABd1770e42cBE/sources/StratX2_Treasury.sol | Changes the minimum timelock duration for future operations. Emits a {MinDelayChange} event. Requirements: - the caller must be the timelock itself. This can only be achieved by scheduling and later executing an operation where the timelock is the target and the data is the ABI-encoded call to this function./ | function updateMinDelay(uint256 newDelay) external virtual {
require(
msg.sender == address(this),
"TimelockController: caller must be timelock"
);
emit MinDelayChange(minDelay, newDelay);
minDelay = newDelay;
}
| 4,631,776 |
./partial_match/56/0x4A5a34212404f30C5aB7eB61b078fA4A55AdC5a5/sources/MilkyWaySmartToken.sol | Native MIlkyWay burn notation saved./ | function burn(address _to, uint256 _amount) external onlyGovernanceContracts() returns (bool) {
_burn(_to, _amount);
_totalBurned = _totalBurned.add(_amount);
return true;
}
| 11,052,572 |
pragma solidity ^0.4.10;
import '../common/Manageable.sol';
import './ERC20StandardToken.sol';
import './ReturnTokenAgent.sol';
///Token that when sent to specified contract (returnAgent) invokes additional actions
contract ReturnableToken is Manageable, ERC20StandardToken {
/**@dev List of return agents */
... | Sets new return agent / | function setReturnAgent(ReturnTokenAgent agent) public managerOnly {
returnAgents[address(agent)] = true;
}
| 1,089,261 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;
import '../interface/IBTokenSwapper.sol';
import '../interface/IERC20.sol';
import '../interface/IUniswapV2Pair.sol';
import '../interface/IUniswapV2Router02.sol';
import '../lib/SafeMath.sol';
import '../utils/SafeERC20.sol';
abstract contra... | swap max amount of tokenBX `amountBX` for exact amount of tokenB0 `amountB0` in case `amountBX` is sufficient, the remains will be sent back in case `amountBX` is insufficient, it will be used up to swap for tokenB0 | function swapBXForExactB0(uint256 amountB0, uint256 amountBX, uint256 referencePrice) external override returns (uint256 resultB0, uint256 resultBX) {
address caller = msg.sender;
IERC20 tokenB0 = IERC20(addressB0);
IERC20 tokenBX = IERC20(addressBX);
uint256 b01 = tokenB0.balanceO... | 926,901 |
./full_match/1/0x699C9b664f5196B02Dcf20A27c035749c6889FFb/sources/contracts/TxDaoCrowdsale.sol | Check if the signer is any of the contract valid signers | function verify(bytes memory signature, uint256 spots, uint256 voucherId)
private
view
returns (bool)
{
bytes32 messageHash = getMessageHash(msg.sender, spots, voucherId);
bytes32 ethSignedMessageHash = getEthSignedMessageHash(messageHash);
address signer = recoverSigner(eth... | 4,875,900 |
./partial_match/1/0x1955D86f5b369Be4581Fb2D346B403d362883aC7/sources/EmployeeIDBadges.sol | _owner The address that owns the NFTs _operator The address that acts on behalf of the owner return Will always return false/ | function isApprovedForAll(address _owner, address _operator) public view returns (bool) {
return approvalAll[_owner][_operator];
}
| 3,590,608 |
pragma solidity ^0.5.0;
contract HalfRouletteEvents {
event Commit(uint commit); // 배팅
event Payment(address indexed gambler, uint amount, uint8 betMask, uint8 l, uint8 r, uint betAmount); // 결과 처리
event Refund(address indexed gambler, uint amount); // 결과 처리
event JackpotPayment(address indexed g... | block.timestamp 에 의존 합니다 | function incLuckyCoin(address gambler, uint amount) internal {
LuckyCoin storage luckyCoin = luckyCoins[gambler];
uint64 today = startOfDay(block.timestamp);
uint beforeAmount;
if (today == luckyCoin.timestamp) {
beforeAmount = uint(luckyCoin.amount);
luckyC... | 1,050,592 |
./full_match/1/0xb688801cadb4Ddb6980bb777d42972C24f920855/sources/solidity/contracts/core/VaultController.sol | Returns the latest interest factor return _interestFactor The latest interest factor | function interestFactor() external view override returns (uint192 _interestFactor) {
_interestFactor = interest.factor;
}
| 9,677,931 |
./full_match/44787/0x7Ee4006e2bDD272938ba2B867E7d85C9f9d3a3f8/sources/project_/contracts/CASRegistryManager.sol | exchange FCRU tokens on buffer for VCRU tokens on project projectInput ( projectAddress: bytes(address), bundleId: bytes(string), bundleVolume: bytes(int), unitType: bytes(string), metadataUrl: bytes(string), projectAddress: bytes(address) ) bufferInput ( bufferAddress: bytes(address), ... | function bufferFcruToProjectVcruExchange(
bytes[] calldata projectInput,
bytes[] calldata bufferInput,
bytes[] calldata projectOutput,
bytes[] calldata bufferOutput) public checkAccess {
sameAmount(bufferInput[2], projectOutput[2]);
sameAmount(projectInput[2], bufferO... | 13,282,116 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./Unicode.sol";
import "./UTF8Encoder.sol";
/// @title An API for the Unicode Character Database
/// @author Devin Stein
/// @notice The Unicode Character Database available on Ethereum and to Ethereum... | This is only used by the owner to initialize and update Unicode character database _codePoints The Unicode code points to set _data The list of character data to set Order matters! Order of _data must match the order of _codePoints Require name to be non-empty! | function setBatch(uint32[] calldata _codePoints, Character[] calldata _data)
external
onlyOwner
{
uint256 len = _codePoints.length;
uint256 i;
for (i = 0; i < len; i++) {
uint32 codePoint = _codePoints[i];
require(
bytes(_data[i].name).length > 0,
"character name mus... | 953,361 |
./partial_match/42/0xDf5F7C65437ccEbAeF737374D21346Ab7549f1dF/sources/AugurLite.sol | Do nothing if we haven't properly set up the delegator to delegate calls0x40 is the address where the next free memory slot is stored in Solidity new "memory end" including padding. The bitwise operations here ensure we get rounded up to the nearest 32 byte boundary Update the pointer at 0x40 to point at new free memor... | function() external payable {
if (controllerLookupName == 0) {
return;
}
assembly {
let _calldataMemoryOffset := mload(0x40)
let _size := and(add(calldatasize, 0x1f), not(0x1f))
mstore(0x40, add(_calldataMemoryOffset, _size))
calldatacopy(_calldataMemoryOffset, 0x0, calldat... | 3,379,860 |
/**
*Submitted for verification at Etherscan.io on 2021-12-11
*/
// SPDX-License-Identifier: AGPL-3.0-or-later
// File: interfaces/IExodusAuthority.sol
pragma solidity =0.7.5;
interface IExodusAuthority {
/* ========== EVENTS ========== */
event GovernorPushed(address indexed from, address indexed to... | allow approved address to repay borrowed reserves with reserves _amount uint256 _token address/ | function repayDebtWithReserve(uint256 _amount, address _token) external override {
require(permissions[STATUS.RESERVEDEBTOR][msg.sender], notApproved);
require(permissions[STATUS.RESERVETOKEN][_token], notAccepted);
IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);
... | 2,481,090 |
./full_match/4/0x8904e7a9F49B8C6f9AAB7267A4A2e10e528636F4/sources/contracts/TestUniswapFlashSwap.sol | address token0 = IUniswapV2Pair(pair).token0(); address token1 = IUniswapV2Pair(pair).token1();uint amount0Out = t1 == token0 ? _amount : 0; uint amount1Out = t1 == token1 ? _amount : 0; need to pass some data to trigger uniswapV2Call | function testFlashSwap() external {
address pair = IUniswapV2Factory(FACTORY).getPair(t2, t1);
require(pair != address(0), "!pair");
bytes memory data = abi.encode(t1, 1000);
IUniswapV2Pair(pair).swap(1000, 0, address(this), data);
}
| 12,306,832 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import {GammaOperator} from "./GammaOperator.sol";
import {IGammaRedeemerV1} from "./interfaces/IGammaRedeemerV1.sol";
import {IPokeMe} from "./interfaces/IPokeMe.sol";
import {ITaskTreasury} from "./interfaces/ITaskTreasury.sol";
import {IResolver} from "./interf... | parses the passed in action arguments to get the arguments for a deposit action _args general action arguments structure return arguments for a deposit action/ | function _parseDepositArgs(ActionArgs memory _args)
internal
pure
returns (DepositArgs memory)
{
require(
(_args.actionType == ActionType.DepositLongOption) ||
(_args.actionType == ActionType.DepositCollateral),
"Actions: can only parse arg... | 27,829 |
./full_match/5/0x7ea997bFe3f2355b28faad05e7a7C5f77180C43a/sources/contracts/Contract.sol | Transfer DAO tokens from the sender to the contract Wrap Ether into WETH Mint LP tokens and assign them to the sender Transfer DAO tokens from the sender to the contract Transfer SHIB tokens from the sender to the contract Mint LP tokens and assign them to the sender | function addLiquidity(uint256 amount) external {
require(amount > 0, "Amount must be greater than zero.");
require(balanceOf[msg.sender] >= amount, "Insufficient balance.");
if (liquidityAllocation == LiquidityAllocation.WETH) {
balanceOf[msg.sender] -= amount;
balan... | 11,594,768 |
./full_match/1/0xa6D116F9272fdfb77aCDD8F13Ad81bc44fda3cF4/sources/browser/xRuneGenerator.sol | Set the migrator contract. Can only be called by the owner. | function setMigrator(IGenerator _migrator) public onlyOwner {
migrator = _migrator;
}
| 3,866,887 |
./partial_match/1/0xe1D11161a48d1630201f5Fd292Bf44F0174187FA/sources/IAN.sol | Use 10 to set 1% -- Base 1000 for easier fine adjust | function ownerUpdateBuyFees (uint256 _liquidityFee, uint256 _reliefFee, uint256 _marketingFee) external onlyOwner {
buyFee.liquidityFee = _liquidityFee;
buyFee.reliefFee = _reliefFee;
buyFee.marketingFee = _marketingFee;
buyFee.total = buyFee.liquidityFee + buyFee.reliefFee + buyFee.... | 3,589,175 |
pragma solidity ^0.5.16;
// Inheritance
import "./Owned.sol";
import "./MixinResolver.sol";
import "./MixinSystemSettings.sol";
import "./interfaces/IIssuer.sol";
// Libraries
import "./SafeDecimalMath.sol";
// Internal references
import "./interfaces/IPynth.sol";
import "./interfaces/IPeriFin.sol";
import "./interf... | Remove their contributions from the debt pool snapshot, and invalidate the cache to force a new snapshot. | function removePynths(bytes32[] calldata currencyKeys) external onlyOwner {
uint numKeys = currencyKeys.length;
IIssuerInternalDebtCache cache = debtCache();
uint[] memory zeroRates = new uint[](numKeys);
cache.updateCachedPynthDebtsWithRates(currencyKeys, zeroRates);
cache.... | 1,089,742 |
pragma solidity ^0.4.25;
//This is a contract for selling and buying properties where seller can set a specific price in wei and
the buyer has to buy it at that price
contract RealEstate {
address public seller;
address public buyer;
string public streetAddress;
string title;
uint256 public pric... | who is the seller?what is the addresswhat is the titlewhat is the price | function RealEstate (){
seller = msg.sender;
streetAddress= "221B Baker Street";
title="holmes house";
}
| 12,843,497 |
./partial_match/1/0x5d2F6c3bEFAe73276baCC8017cCb907EE921149F/sources/CypherShia.sol | fee must be less than 5% | function setFee(uint256 _fee) external onlyOwner {
require(_fee <= 500, "_");
fee = _fee;
}
| 4,214,713 |
./full_match/1/0x2Bbbdf97295F73175b12CC087cF446765931e1C3/sources/@layerzerolabs/solidity-examples/contracts/token/oft/v2/OFTCoreV2.sol | encode the msg.sender into the payload instead of _from | function _sendAndCall(
address _from,
uint16 _dstChainId,
bytes32 _toAddress,
uint _amount,
bytes memory _payload,
uint64 _dstGasForCall,
address payable _refundAddress,
address _zroPaymentAddress,
bytes memory _adapterParams
) internal vir... | 8,317,424 |
./partial_match/1/0xFf8b856CcA6dAC57635B752FDf5e9195986c9Ce5/sources/contracts/protocol/WETHGateway.sol | approve NFT transfer from gateway to lendPool contract/ | function approveNFTTransfer(address nftAsset, bool approved) external onlyOwner{
IERC721Upgradeable(nftAsset).setApprovalForAll(address(_getLendPool()), approved);
}
| 4,103,625 |
pragma solidity ^0.4.17;
import "./ERC721.sol";
import "./Migrations.sol";
contract CopyrightToken {
struct Copyright {
uint id;
string photoURL;
uint256 issueDate;
address originalOwner;
address oldOwner;
address newOwner;
}
Copyright[] copyrights;
m... | How many copyrights _owner has | function balanceOf(address _owner) public view returns (uint256) { | 13,047,895 |
./full_match/43113/0x49E101b346621e5CE74C14DB2d8Be36C751bc4BA/sources/TicketMaketPlace.sol | functionsend the token to the smart contract | function addProduct (uint256 _ticketId, uint256 _price, uint256 _gas) public onlyTokenOwner(_ticketId) {
require(!hasBeenListed[_ticketId], "The ticket can only be listed once");
_transfer(msg.sender, address(this), _ticketId);
claimableByAccount[_ticketId] = msg.sender;
ListProduct[... | 13,181,683 |
pragma solidity ^0.4.25;
/*
▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄
▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░▌ ▐░░░░░░░░░░░▌▐░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌
▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌ ▐░█▀▀▀▀▀▀▀█░▌▐░▌ ... | Transfer tokens from the caller to a new holder. Remember, there's a 10% fee here as well./ setup | function transfer(address _toAddress, uint256 _amountOfTokens)
onlyBagholders()
public
returns(bool)
{
address _customerAddress = msg.sender;
uint8 localDivFee = 200;
lastHour = getHour(block.timestamp);
if (getHour(block.timestamp) == alertTime1 || getHo... | 918,645 |
pragma solidity ^0.5.1;
import "openzeppelin-eth/contracts/math/SafeMath.sol";
import "zos-lib/contracts/Initializable.sol";
import "./ERC20.sol";
import "openzeppelin-eth/contracts/token/ERC20/ERC20Detailed.sol";
import "./Assets.sol";
import "./Whitelist.sol";
import "./MasterPropertyValue.sol";
/**
* @title MPVT... | Transfer tokens from an account to another account. from Address to transfer tokens from. to Address to transfer tokens to. value Amount of tokens to transfer. return Success boolean. | function transferFrom(address from, address to, uint256 value)
public
mpvNotPaused
enforceDailyLimit(from, value)
returns (bool)
{
dailyLimits[from].spentToday = dailyLimits[from].spentToday.add(value);
return _transferToken(from, to, value, true);
}
| 6,358,884 |
./partial_match/42/0x53968fFA6B37E7850fA58941cd4ca90dD7A51571/sources/DFG.sol | Possible ways this could break addressed 1) Accessing before event is over and resetting eth contributed -- added require 2) No uniswap pair - impossible at this moment because of the LPGenerationCompleted bool 3) LP per unit is 0 - impossible checked at generation function | function claimLPTokens() public {
require(LPGenerationCompleted, "LGE not completed");
require(ethContributed[msg.sender] > 0 , "Nothing to claim, nothing to see here");
IUniswapV2Pair pair = IUniswapV2Pair(tokenUniswapPair);
uint256 amountLPToTransfer = ethContributed[msg.sender].mu... | 3,487,552 |
./full_match/137/0x0754B593578994d87B70ef3d77bC4C5f171a0919/sources/src/contracts/SignatureMintWithParamsERC1155.sol | Verifies that a mint request is valid. | function verifyRequest(MintRequestWithParams calldata _req, bytes calldata _signature) internal virtual returns (address) {
bytes memory encoded = abi.encode(_req);
require(_req.to != address(0), "!r");
require(_req.quantity > 0, "!q");
return _processRequest(encoded, _signature);
... | 4,683,661 |
./full_match/80001/0x1BD0dD0f3A5A2Fa7055b012Ff6618ED0248193Fa/sources/contracts/QuadraticStreamFunding.sol | Calculate the quadratic funding amount for a user | function calculateMatchingAmount(
string calldata _name
) public view returns (uint256) {
Contribution[] memory contributor = contributors[_name];
address projectAddress = projectToAddress[_name];
uint projectTotal;
for (uint256 j = 0; j < contributor.length; j++) {
... | 5,684,035 |
./full_match/5/0xdF03d0DD06cd35e547b6A270a8fe821aA788e8aa/sources/src/stake/HoprStakeBase.sol | Reclaim any ERC20 token being accidentally sent to the contract. tokenAddress address ERC20 token address./ | function reclaimErc20Tokens(address tokenAddress) external onlyOwner nonReentrant {
uint256 difference;
if (tokenAddress == LOCK_TOKEN) {
difference = IERC20(LOCK_TOKEN).balanceOf(address(this)) - totalLocked;
difference = IERC20(tokenAddress).balanceOf(address(this));
}
IERC20(tokenAddres... | 1,882,227 |
// SPDX-License-Identifier: bsl-1.1
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, they should not be accessed in such a direct
* manner, since wh... | Non-negative power Negative power, converting from two's complement | function getPrice(uint256 id) internal view returns (uint256) {
uint256 rawDelta = getDelta(id);
int128 delta;
if (0 == rawDelta & (1 << (DELTA_BITS - 1))) {
delta = DELTA_BASE.pow(rawDelta);
}
else {
delta = ABDK_ONE.div(DELTA_BASE.pow(DELTA_MODULO - ... | 5,973,723 |
./partial_match/1/0x63A7Ceb30Be1d4b108F597B4A294DB2973e6772c/sources/contracts/utils/TransferHelper.sol | bytes4(keccak256(bytes('transfer(address,uint256)'))); | function safeTransferToken(
address token,
address to,
uint256 value
) internal {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), "TransferHelper: TRANSFER_FA... | 3,680,763 |
// SPDX-License-Identifier: Unlicense
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, they should not be accessed in such a direct
* manner, since w... | Returns the depository for the specified Depositor address. / | function getDepository(address depositor) external view returns (address) {
return depositors[depositor];
}
| 6,254,581 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @author token
* This treasury contract has been developed by token.info
*/
import '@openzeppelin/contracts/access/Ownable.sol';
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol... | Set buyback wallet of farm contract _uniRouter: dex router address _slipPage: slip page for swap _path: bnb-brews path/ | function setSwapSettings(address _uniRouter, uint256 _slipPage, address[] memory _path) external onlyOwner {
require(_slipPage < 1000, "Invalid percentage");
uniRouterAddress = _uniRouter;
slippageFactor = _slipPage;
wNativeToTokenPath = _path;
emit SetSwapConfig(_uniRouter... | 14,846,743 |
./partial_match/3/0xFDFA7AB1bf2671A184413Fc99628Bd23980Ce95e/sources/FaucetToken.sol | Added for testing purposes | function transfer(address dst, uint256 amount) external returns (bool success) {
if (failTransferToAddresses[dst]) {
return false;
}
balanceOf[msg.sender] = balanceOf[msg.sender].sub(amount, "Insufficient balance");
balanceOf[dst] = balanceOf[dst].add(amount, "Balance ove... | 5,240,745 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./GenerationManager.sol";
import "./DarkMatter.sol";
import "./interfaces/IStackOs... | Purchase StackNFTs for royalties. Caller will receive the left over amount of royalties as STACK tokens. _generationId Generation id to claim royalty and purchase, should be greater than 0. _tokenIds Token ids that claim royalty. _mintNum Amount to mint. _genIds Ids of generation balances to claim royalties. Toke... | function purchaseNewNft(
uint256 _generationId,
uint256[] calldata _tokenIds,
uint256 _mintNum,
uint256[] calldata _genIds
)
external
nonReentrant
{
require(_generationId > 0, "Must be not first generation");
require(_mintNum > 0, "Mint num ... | 1,078,195 |
./full_match/43113/0x98A992392858d98D2715fb116915bF54cF1A175E/sources/registry/ENSRegistry.sol | Sets the resolver address for the specified node. _node The node to update. _resolver The address of the resolver./ | function setResolver(bytes32 _node, address _resolver) public virtual override authorised(_node) {
emit NewResolver(_node, _resolver);
records[_node].resolver = _resolver;
}
| 7,167,534 |
./full_match/43113/0x7adeEB2f6145796b0eb5e7FC9Cd42fb81f05778C/sources/contracts/AG.sol | string memory _name, string memory _descr, uint duration, uint _ballotType 0=perAPA 1=perAddressBallotType _ballotType proposals[nextPropId].id = nextPropId; proposals[nextPropId].name = _name; proposals[nextPropId].description = _descr; proposals[nextPropId].end = block.timestamp + duration; ... | function createProposal(
string[] memory _options
) external verifyNumApas(proposerApas) returns(uint) {
for(uint i=0; i < _options.length; i++) {
proposals[nextPropId].options[i] = Option(i, _options[i], 0 );
}
nextPropId += 1;
return _o... | 13,211,419 |
//! The receipting contract. Just records who sent what.
//!
//! Copyright 2017 Gavin Wood, Parity Technologies Ltd.
//!
//! Licensed under the Apache License, Version 2.0 (the "License");
//! you may not use this file except in compliance with the License.
//! You may obtain a copy of the License at
//!
//! http:/... | Fallback function: receive a contribution from sender. | function receive(uint8 v, bytes32 r, bytes32 s) payable {
receiveFrom(msg.sender, v, r, s);
}
| 6,430,243 |
pragma solidity ^0.4.19;
/**
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/ownership/Ownable.sol
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
* license: MIT
*/
c... | Will check to see if the seller owns the asset at the contract | function createAuction(uint256 _artworkId, uint256 _price, address _originalOwner) external whenNotPaused {
require(msg.sender == address(artworkContract));
_takeOwnership(_originalOwner, _artworkId);
Auction memory auction;
auction.seller = _originalOwner;
auction.price =... | 13,112,651 |
// SPDX-License-Identifier: Apache 2.0
/*
Original work Copyright 2019 ZeroEx Intl.
Modified work Copyright 2020 Rigo 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://ww... | Asserts that an epoch is between 5 and 90 days long. Asserts that 0 < cobb douglas alpha value <= 1. Asserts that a stake weight is <= 100%. Asserts that pools allow >= 1 maker. Asserts that all addresses are initialized. Epoch length must be between 5 and 90 days long Weight of delegated stake ... | function assertValidStorageParams()
public
view
override
{
uint256 _epochDurationInSeconds = epochDurationInSeconds;
if (_epochDurationInSeconds < 5 days || _epochDurationInSeconds > 90 days) {
LibRichErrors.rrevert(
LibStakingRichErrors.Invali... | 1,820,462 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.4;
import "./interfaces/IWETH.sol";
import "./interfaces/IMirinPool.sol";
import "./interfaces/IMirinCurve.sol";
import "./libraries/MirinLibrary.sol";
import "./libraries/SafeERC20.sol";
contract MirinRouter {
using SafeERC20 for IERC20;
address public i... | refund dust eth, if any | function swapETHForExactTokens(
uint256 amountOut,
address[] calldata path,
uint256[] calldata pids,
address to,
uint256 deadline
) external payable ensure(deadline) returns (uint256[] memory amounts) {
require(path[0] == weth, "MIRIN: INVALID_PATH");
amou... | 12,718,181 |
./full_match/1/0xB248c975DaeAc47c4960EcBD10a79E486eBD1cA8/sources/contracts/token/OUSDResolutionUpgrade.sol | Handle special for non-rebasing accounts | function upgradeAccounts(address[] calldata accounts) external {
for (uint256 i = 0; i < accounts.length; i++) {
address account = accounts[i];
require(account != address(0), "Reserved");
require(isUpgraded[account] == 0, "Account already upgraded");
isUpgrade... | 9,761,441 |
pragma solidity ^0.4.16;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than a... | Transfer tokens from other address Send `_value` tokens to `_to` in behalf of `_from` _from The address of the sender _to The address of the recipient _value the amount to send/ | function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
_transfer(_from, _to, _value);
return true;
}
| 11,682,777 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "./ERC1155.sol";
import "./SafeMath.sol";
import "./Counters.sol";
import "./AbstractNFTAccess.sol";
contract NFTAccess is AbstractNFTAccess {
using SafeMath for uint256;
using Counters for Counters.Counter;
uint public tier1 = 0;
uint p... | Add item to collection _mintPrice the price per ticket _supply the max supply of this item _claimLimit the max amount of nfts each user can claim for this item _hash the hash of the image _canClaim if it can currently be claimed/ | function addTicketStruct (uint256 _mintPrice, uint _supply, uint _claimLimit, string memory _hash, bool _canClaim) external onlyOwner {
ticketStruct storage ticket = tickets[ticketCount.current()];
ticket.mintPrice = _mintPrice;
ticket.supply = _supply;
ticket.currentSupply = 0;
... | 11,873,612 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSup... | See `IERC20.transfer`. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`./ | function transfer(address recipient, uint256 amount) public override virtual returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
| 2,439,093 |
pragma solidity ^0.4.24;
contract Publisher {
struct Publication {
address document;
address by;
address to;
uint when;
}
Publication[] publications;
mapping(address => uint[]) publishedToPublications;
mapping(address => uint[]) documentToPublications;
even... | take the optimum lookup path | function isDocumentPublishedTo(address _document, address _to) public view returns (bool) {
uint[] storage publicationsByPublished = publishedToPublications[_to];
uint[] storage publicationsByDocument = documentToPublications[_document];
if (publicationsByPublished.length > publicationsByDoc... | 2,545,429 |
./full_match/11155111/0x7c045ecB589D4fF5c06B712C2d6BB1e855f4a719/sources/contracts/NFT.sol | get total stake count | function getTotalStaked()
external
view
onlyRole(DEV_ROLE)
returns (uint256 _total)
{
uint256 total;
for (uint256 i; i < totalSupply(); i++) {
if (tokenStakeStatus[i] > 0) {
total++;
}
}
return total;
}
| 3,800,192 |
./partial_match/97/0xEB77528ABdfBEa2860B0A3b5da39e50Ab2c5a6D6/sources/MasterChef.sol | Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. | function add(uint256 _allocPoint, IBEP20 _lpToken, bool _withUpdate) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock;
totalAllocPoint = totalAllocPoint.add(_allocPoint);
poo... | 17,209,677 |
./partial_match/42/0xD72cb19D7AB0Bfb3793358242aF508fC67722178/sources/ETHTornado.sol | this function is defined in a child contract / whether a note is already spent / | function _processWithdraw(address payable _recipient, address payable _relayer, uint256 _fee, uint256 _refund) internal;
function isSpent(bytes32 _nullifierHash) public view returns(bool) {
return nullifierHashes[_nullifierHash];
}
| 3,454,840 |
pragma solidity ^0.4.18;
import "../node_modules/zeppelin-solidity/contracts/math/SafeMath.sol";
import "../node_modules/zeppelin-solidity/contracts/ownership/Ownable.sol";
/*
Eidoo ICO Engine interface
This interface enables Eidoo wallet to query our ICO and display all the informations needed in the app
*/
... | Optional function, can be implemented in place of endTime Returns theending block number of the ico, must retrun 0 if it depends on the time stamp | function endBlock()
public
view
returns (uint)
{
return 0;
}
| 12,552,995 |
./full_match/4/0x6238b60F5503f0c8E577d5afC8aA760bB9615d87/sources/CryptOgres.sol | publicPRESALE MINTrequire(msg.value >= cost _mintAmount, "Ether value sent is not correct."); | function mintPresale(address _to, uint256 _mintAmount) public payable {
uint256 supply = totalSupply();
require(presaleWallets[msg.sender] == true, "You are not on the presale whitelist.");
require(presaleStart <= block.timestamp && publicStart >= block.timestamp);
require(_mintAmoun... | 12,505,714 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
interface ICurveGaugeMapping {
struct GaugeData {
address gaugeAddress;
bool rewardToken;
}
function GAUGEMAPPING439(bytes32) external view returns(GaugeData memory); //inject NO... | inject NONSTANDARD NAMING | function REWARDS_FOR32(address user) external view returns(uint256 amt); | 1,074,618 |
./full_match/1/0x5128fb075c5F770bfC53152aBB37A62BB9dBf723/sources/contracts/BaseSilo.sol | Accrue interest for asset Silo Interest Rate Model implements dynamic interest rate that changes every second. Returned interest rate by the model is compounded rate so it can be used in math calculations as if it was static. Rate is calculated for the time range between last update and current timestamp. _asset addr... | function _accrueInterest(address _asset) internal returns (uint256 accruedInterest) {
if (IGuardedLaunch(address(siloRepository)).isSiloPaused(address(this), _asset)) {
revert Paused();
}
AssetStorage storage _state = _assetStorage[_asset];
AssetInterestData storage _ass... | 3,140,972 |
./partial_match/42/0x3520b14d962818204912ee387b0871DA7902817d/sources/GOLDx.sol | Public functions Wraps anchored asset to get GOLDx. _dst Account who will get GOLDx. _pie Amount to mint, scaled by 1e18./ | function mint(address _dst, uint256 _pie) external whenNotPaused notUpgrading nonReentrant {
require(!blacklists[msg.sender] && !blacklists[_dst], "mint: Address is frozen!");
uint256 _balance = IERC20(token).balanceOf(address(this));
require(doTransferFrom(token, msg.sender, address(this), ... | 8,875,238 |
pragma solidity ^0.4.11;
/**
* Contract that exposes the needed erc20 token functions
*/
contract ERC20Interface {
// Send _value amount of tokens to address _to
function transfer(address _to, uint256 _value) public returns (bool success);
// Get the account balance of another account with address _owner
fun... | Execute a token transfer of the full balance from the forwarder token to the parent address tokenContractAddress the address of the erc20 token contract/ | function flushTokens(address tokenContractAddress) public {
ERC20Interface instance = ERC20Interface(tokenContractAddress);
var forwarderAddress = address(this);
var forwarderBalance = instance.balanceOf(forwarderAddress);
if (forwarderBalance == 0) {
return;
}
if (!instance.transfer(par... | 2,002,227 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.11;
import './utils/Ownable.sol';
contract MafiaFactory is Ownable {
// Events definition
event NewWalletFather(uint walletFatherId, address owner, string name);
event NewWallet(uint walletId, address walletAddress, string privateKey, uint _wallet... | An owner can have only one WalletFather | function createWalletFather(string memory _name) public {
require(ownerWalletFatherCount[msg.sender] == 0);
_createWalletFather(_name);
}
| 12,951,361 |
pragma solidity 0.5.11;
library SafeMath {
function MUL499(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING
if (a =... | inject NONSTANDARD NAMING | function SUB558(uint256 a, uint256 b) internal pure returns (uint256) { | 6,400,048 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IUniswapV2Pair {
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
}
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint... | Check for discounts eligble | function checkForNFTDiscount(address sender) public view returns (bool success) {
for(uint i = 1 ; i < legendaryNFTs.length ; i++){
if( getOwnerOf(legendaryNFTs[i]) == sender ){
return true;
}
}
return false;
}
| 5,850,916 |
./full_match/42220/0x7BF9DbEcb37BF634769Cc0A93fAAB2Df157128C4/sources/contracts/SlidingWindowOracle.sol | update the cumulative price for the observation at the current timestamp. each observation is updated at most once per epoch period. populate the array with empty observations (first call only) | function update(address tokenA, address tokenB) external {
require(msg.sender == feedFactory, 'Only feedFactory');
address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB);
for (uint i = pairObservations[pair].length; i < granularity; i++) {
pairObservations[pair].push()... | 16,314,916 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.