file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/1/0x98b7893C5717aF41d3e351c6e3445Be02a062A90/sources/contracts/MapleLoan.sol | Clears all state variables to end a loan, but keep borrower and lender withdrawal functionality intact. | function _clearLoanAccounting() internal {
_refinanceCommitment = bytes32(0);
_gracePeriod = uint256(0);
_paymentInterval = uint256(0);
_interestRate = uint256(0);
_closingRate = uint256(0);
_lateFeeRate = uint256(0);
_... | 3,924,822 |
// <ORACLIZE_API>
/*
Copyright (c) 2015-2016 Oraclize SRL
Copyright (c) 2016 Oraclize LTD
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 limitati... | Step 2: the unique keyhash has to match with the sha256 of (context name + queryId) Step 3: we assume sig1 is valid (it will be verified during step 5) and we verify if 'result' is the prefix of sha256(sig1) Step 4: commitment match verification, keccak256(delay, nbytes, unonce, sessionKeyHash) == commitment in storage... | function oraclize_randomDS_proofVerify__main(bytes proof, bytes32 queryId, bytes result, string context_name) internal returns (bool){
bool checkok;
uint ledgerProofLength = 3 + 65 + (uint(proof[3 + 65 + 1]) + 2) + 32;
bytes memory keyhash = new bytes(32);
copyBytes(proof, ledgerPr... | 7,323,302 |
/**
*Submitted for verification at Etherscan.io on 2021-07-04
*/
//SPDX-License-Identifier: SourceLibre
/**
* Elysium
* Powered by Diemlibre.
* A SourceLibre Product.
* DApp for buying Diemlibre $DLB.
*
* This file includes:
* 1) interface IERC20.
* 2) library SafeMath.
* 3) contract BuyDiemlibre.
*
* N... | ERC Interface for Diemlibre Token./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256)... | 10,710,575 |
pragma solidity 0.5.16;
import "../base/Owned.sol";
/**
* @title Timelock
* @author Authereum Labs, Inc.
* @dev Used to make changes to contracts with a known time lock.
* @dev The goal of this contract is to make the public aware of contract changes made
* @dev by the contract owners. This will keep the owners ... | Initiate change _data Data that will be the change _changeAddress Address that will receive the data | function initiateChange(bytes memory _data, address _changeAddress) public onlyOwner {
require(getCurrentChangeState(_data, _changeAddress) == ChangeState.Uninitialized, "T: Change not able to be initiated");
changes[_data][_changeAddress].unlockTime = timelock + block.timestamp;
changes[_da... | 12,724,787 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.7.6;
pragma abicoder v2;
import './interfaces/IUniswapV3Staker.sol';
import './libraries/IncentiveId.sol';
import './libraries/RewardMath.sol';
import './libraries/NFTPositionInfo.sol';
import './libraries/TransferHelperExtended.sol';
import '@uniswap/v... | @inheritdoc IUniswapV3Staker issue the refund note we never clear totalSecondsClaimedX128 | function endIncentive(IncentiveKey memory key) external override returns (uint256 refund) {
require(block.timestamp >= key.endTime, 'UniswapV3Staker::endIncentive: cannot end incentive before end time');
bytes32 incentiveId = IncentiveId.compute(key);
Incentive storage incentive = incentive... | 1,056,750 |
./full_match/1/0x959D3DdC42740F13A2de31Fb21642B0D332f7203/sources/HoldefiV1.1/Holdefi.sol | The collateral reserve amount for buying liquidated collateral collateral Address of the given collateral return reserve Liquidation reserves for the given collateral | function getLiquidationReserve (address collateral) public view returns(uint256 reserve) {
address market;
uint256 assetValue;
uint256 totalDebtValue = 0;
address[] memory marketsList = holdefiSettings.getMarketsList();
for (uint256 i = 0 ; i < marketsList.length ; i++) {
market = marketsList[i];
asse... | 4,911,616 |
// 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... | Mint Start & End Functions | function isStartPreSummon() public view returns (bool) {
return _startPreSummon;
}
| 6,043,063 |
./full_match/44787/0x82D062DE292987581e348a5Edb1011321DEA994B/sources/project_/contracts/CASProject.sol | Function to change end date parameter bytesParams ( projectAddress: bytes(address), end_date: bytes(string) ) All parameters must be passed in bytes and opened in the contract as the required type/ | function changeProjectEndDate(bytes[] memory bytesParams) external checkAccess {
address projectAddress = BytesLib.toAddress(bytesParams[0], 0);
projects[projectAddress].endDate = BytesLib.toUint256(bytesParams[1], 0);
}
| 13,263,958 |
pragma solidity ^0.5.0;
// Copyright 2019 OpenST Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applica... | Used for testing of redeem feature. This method spy on co-gateway redeem. _amount Redeem amount that will be transferred from redeemer account. _beneficiary The address in the origin chain where the value tok ens will be released. _gasPrice Gas price that redeemer is ready to pay t... | function redeem(
uint256 _amount,
address _beneficiary,
uint256 _gasPrice,
uint256 _gasLimit,
uint256 _nonce,
bytes32 _hashLock
)
external
payable
returns(bytes32)
{
amount = _amount;
benefici... | 5,478,589 |
./full_match/1/0xB5cE6c18E7c9B3f0a223641Ef84889df878f42B3/sources/src/Gatekeeper.sol | helper function to reset all gates for a particular token Currently a hacky way but need to clear out if the proofs were used. Step through all proofs from a particular gate. | function resetAllGates(uint256 bundleId) external onlyRole(Constants.GAME_ADMIN) {
uint256 numGates = tokenToGates[bundleId].length;
Gate[] storage tokenGates = tokenToGates[bundleId];
uint256 numProofs;
for (uint256 i = 0; i < numGates; i++) {
tokenGates[i].claimedCount... | 4,819,924 |
./full_match/137/0x7fF77Fb241F1E2021b3542F1F96D0788b25c4Db8/sources/contracts/NOF/NOF-SC.sol | Devuelve un arrary con los albums disponibles | function getSeasonAlbums(string memory name) public view returns(uint[] memory) {
return seasons[name].albums;
}
| 3,754,637 |
/**
*Submitted for verification at Etherscan.io on 2022-01-31
*/
// SPDX-License-Identifier: UNLICENSED
// *@@ ... | Check that proper amount of cards was suppliedCheck that different cards are suppliedCheck that caller owns all supplied cardsIf minting ok - burn supplied cards | function upgrade(uint256[] calldata tokens) external {
require(tokens.length == 3, "Wrong number of cards was provided");
require((tokens[0] != tokens[1])&&(tokens[0] != tokens[2])&&(tokens[1] != tokens[2]),"Duplicate cards were supplied");
for (uint i = 0; i<tokens.length; i++) {
... | 10,656,366 |
/**
*Submitted for verification at Etherscan.io on 2022-02-18
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Counters.sol
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that... | you made double time the same require | function mint(uint256 _mintAmount)
public
payable
mintCompliance(_mintAmount)
whenNotPaused
{
if (msg.sender != owner()) {
require(msg.value >= cost * _mintAmount, "insufficient funds");
}
_mintLoop(msg.sender, _mintAmount);
}
| 10,682,790 |
/**
*Submitted for verification at Etherscan.io on 2021-06-02
*/
pragma solidity 0.8.2;
interface IUniswapV3SwapRouter {
struct ExactInputSingleParams {
address tokenIn;
address tokenOut;
uint24 fee;
address recipient;
uint256 deadline;
uint256 amountIn;
u... | liquidates stkAave rewards earned by the Aave integration contracts: - Redeems Aave for stkAave rewards - swaps Aave for bAsset using Uniswap V2. eg Aave for USDC - for each Aave integration contract - if from a mAsset - mints mAssets using bAssets. eg mUSD for USDC - deposits mA... | function triggerLiquidationAave() external {
require(tx.origin == msg.sender, "Must be EOA");
require(totalAaveBalance > 0, "Must claim before liquidation");
IStakedAave(stkAave).redeem(address(this), type(uint256).max);
uint256 totalAaveToLiquidate = IERC20(aaveToken).balanceOf(ad... | 2,070,371 |
./partial_match/1/0xAFc9125f472DbF35D170201EF6A25863dacB341b/sources/SiargaoStaking.sol | The SC owner uses this function to withdraw deposited funds if necessary | function withdrawRewardsToken(uint256 _amount) public onlyOwner {
require(_amount <= rewardsToken.balanceOf(address(this)), "Can't withdraw more than existing funds!");
rewardsToken.safeTransfer(msg.sender,_amount);
}
| 3,691,384 |
/*
___ ___ ___ ___ ___ ___ ___
/\ \ /\ \ /\ \ /\ \ |\__\ /\ \ ___ /\ \
/::\ \ /::\ \ /::\ \ \:\ \ |:| | /::\ \ /\ \ /::... | Finalize the state of the auction Emits a Finalized event upon success; callable by anyone/ finalize auction if it hasn't already been done if the auction was won, record totalSpent, send ETH fees to PartyDAO, fractionalize the Token send Token fees to PartyDAO & split proceeds to split recipient | function finalize() external nonReentrant {
require(
partyStatus == PartyStatus.ACTIVE,
"PartyBid::finalize: auction not active"
);
if (!marketWrapper.isFinalized(auctionId)) {
marketWrapper.finalize(auctionId);
}
partyStatus = _owner == ad... | 888,242 |
./partial_match/1/0x26238D311066e23709e248C89A98C286a03CdD64/sources/ROP.sol | once enabled, can never be turned off | function theBattleShallCommence() external onlyOwner {
tradingActive = true;
swapEnabled = true;
launchTimestamp = block.timestamp;
previousRingBearer = block.timestamp;
}
| 15,652,712 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.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 o... | @inheritdoc IGovernanceActions | function setGovernance(address account) external override onlyGovernance {
require(account != address(0));
governance = account;
emit SetGovernance(account);
}
| 416,950 |
pragma solidity >= 0.5.0 < 0.6.0;
import "./Token.sol";
import "https://github.com/oraclize/ethereum-api/oraclizeAPI_0.5.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/math/SafeMath.sol";
contract Bank is usingOraclize {
using SafeMath for uint;
string ... | / check whether _source can cover buyBack updateRate - Oracalize calculate amount of ETH deduct tokens deduct coinTotal send ETH to _recv emit event returns true if succeed | function redeemToken(address payable _recv, uint amount) external payable returns (bool) {
require(balances[msg.sender] >= amount, "msg.sender doesn't have enough token.");
updateRate();
uint eth_tx;
eth_tx = amount.mul(rate);
require(eth_tx <= address(this).balance,... | 5,366,578 |
./full_match/80001/0x2E2788307B40C7220209d1C1ED870940f4490274/sources/contracts/Contract.sol | withdraw Kado_ERC20 tokens | function withdraw() public onlyOwner {
Kado_ERC20.transfer(msg.sender, Kado_ERC20.balanceOf(address(this)));
}
| 841,286 |
pragma solidity ^0.7.0;
// SPDX-License-Identifier: MIT
import "./interfaces/IManaging.sol";
import "../core/DaoConstants.sol";
import "../core/DaoRegistry.sol";
import "../adapters/interfaces/IVoting.sol";
import "../guards/MemberGuard.sol";
import "../utils/SafeMath.sol";
/**
MIT License
Copyright (c) 2020 Openla... | is there a way to check if the new module implements the module interface properly? | function createModuleChangeRequest(
DaoRegistry dao,
bytes32 moduleId,
address moduleAddress
) external override onlyMember(dao) returns (uint256) {
require(moduleAddress != address(0x0), "invalid module address");
require(
dao.isNotReservedAddress(moduleAddr... | 919,919 |
pragma solidity ^0.4.11;
import "./DAOLib.sol";
import "./CrowdsaleDAOFields.sol";
import "../Common.sol";
import "./Owned.sol";
import "./DAOProxy.sol";
contract CrowdsaleDAO is CrowdsaleDAOFields, Owned {
address public stateModule;
address public paymentModule;
address public votingDecisionModule;
... | Delegates parameters which describe conditions of crowdsale to the crowdsale module. _softCap The minimal amount of funds that must be collected by DAO for crowdsale to be considered successful _hardCap The maximal amount of funds that can be raised during the crowdsale _etherRate Amount of tokens that will be minte... | function initCrowdsaleParameters(uint _softCap, uint _hardCap, uint _etherRate, uint _DXCRate, uint _startTime, uint _endTime, bool _dxcPayments, uint _lockup) public {
DAOProxy.delegatedInitCrowdsaleParameters(crowdsaleModule, _softCap, _hardCap, _etherRate, _DXCRate, _startTime, _endTime, _dxcPayments, _l... | 946,554 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/ERC20Burnable.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "./lib/SafeMath8.sol";
import "./owner/Operator.sol";
import "./interfaces/IOracle.sol";
/*
Juice Finance - its a juicer ... | distribute to reward pool (only once)/ | function distributeReward(
address _genesisPool,
address _juicePool,
address _airdropWallet
) external onlyOperator {
require(!rewardPoolDistributed, "only can distribute once");
require(_genesisPool != address(0), "!_genesisPool");
require(_juicePool != address(0... | 12,743,314 |
pragma solidity ^0.5.0;
// Copyright 2019 OpenST Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applica... | Approves Gateway for the minted BTs, calls Gateway.stake after BrandedToken.acceptStakeRequest execution is successful. Function requires: - stake request hash is valid - successful execution of ValueToken transferFrom - successful execution of ValueToken approve - BrandedTo... | function acceptStakeRequest(
bytes32 _stakeRequestHash,
bytes32 _r,
bytes32 _s,
uint8 _v,
bytes32 _hashLock
)
external
returns (bytes32 messageHash_)
{
StakeRequest memory stakeRequest = stakeRequests[_stakeRequestHash];
delete stakeRe... | 1,089,399 |
./partial_match/1/0xa94310AeeD50687f7c39ACdAA5FCd311AEDB25f8/sources/contracts/erc721/ERC721EditionsDFS.sol | Get URI for given token id tokenId token id to get uri for return base64-encoded json metadata object/ | function tokenURI(uint256 tokenId) public view override returns (string memory) {
require(_exists(tokenId), "!exists");
uint256 editionId = getEditionId(tokenId);
return _editionURI[editionId];
}
| 3,645,423 |
pragma solidity
^0.4.21;
/*
http://www.cryptophoenixes.fun/
CryptoPhoenixes: Civil War Edition
Original game design and website development by Anyhowclick.
Art design by Tilly.
*/
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simp... | Set bag holders from version 1.0 | function setPhoenixOwners(address[19] _owners) onlyOwner public {
for (uint256 i = 0; i < 19; i++) {
Phoenix storage phoenix = PHOENIXES[i];
phoenix.previousOwner = _owners[i];
phoenix.currentOwner = _owners[i];
}
}
| 4,814,110 |
pragma solidity >=0.8.9 <0.9.0;
//SPDX-License-Identifier: MIT
import "../node_modules/@openzeppelin/contracts/interfaces/IERC20Metadata.sol";
import "../node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "../node_modules/@openzeppelin/contracts/access/Ownable.sol";
import "./ISwapper.sol";
import ".... | Burns LEASH to the default LEASH pool amount the amount of LEASH to be burnt/ | function burnLeash(uint256 amount) external {
burnToken(leashAddress, amount);
}
| 12,569,959 |
./full_match/4/0xDC750c9a411e3BfA0fB0Dd1248251D5831321352/sources/cache/solpp-generated-contracts/ZkSync.sol | Process one block commit using previous block StoredBlockInfo, returns new block StoredBlockInfo NOTE: Does not change storage (except events, so we can't mark it view) Check timestamp of the new block | function commitOneBlock(StoredBlockInfo memory _previousBlock, CommitBlockInfo memory _newBlock)
internal
returns (StoredBlockInfo memory storedNewBlock)
{
{
bool timestampNotTooSmall = block.timestamp - COMMIT_TIMESTAMP_NOT_OLDER <= _newBlock.timestamp;
bool tim... | 749,369 |
pragma solidity 0.4.24;
// File: openzeppelin-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 pu... | upgrade an existing PoaCrowdsale proxy to what is stored in ContractRegistry | function upgradeCrowdsale(PoaProxy _proxyToken)
external
onlyOwner
returns (bool)
{
_proxyToken.proxyChangeCrowdsaleMaster(
registry.getContractAddress("PoaCrowdsaleMaster")
);
return true;
}
| 7,300,827 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.8.4;
import "@prb/contracts/access/Ownable.sol";
import "@prb/contracts/token/erc20/IErc20.sol";
import "./IFintroller.sol";
import "../h-token/IHToken.sol";
/// @notice Fintroller
/// @author Hifi
contract Fintroller is
IFintroller, // one dependency
... | @inheritdoc IFintroller | function getLiquidationIncentive(IErc20 collateral) external view override returns (uint256) {
return collaterals[collateral].liquidationIncentive;
}
| 6,480,432 |
pragma solidity ^0.4.24;
contract Ownable {
address public owner;
function Ownable()
public
{
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner)
public
... | Buy a token. Execute the trade (at most fullfilling volume) Since our balance before trade was 0. What we bought is our current balance. We make sure that something was traded Used ethers are: balance_before - balance_after. And since before call balance=0; then balance_before = msg.value IMPORTANT: Check that: effecti... | function buy(
ITradeable tradeable,
uint volume,
bytes ordersData,
address destinationAddr,
address affiliate
) external payable
{
require(tradingEnabled);
trade(
false,
tradeable,
volume,
ordersData,
affiliate
);
uint volumeEffective = tradeabl... | 972,175 |
./full_match/80001/0x71ac01342909DFb970E536EB8bB0DDA41C65F345/sources/src/YAGMIController.sol | If number of payment out of range, return 0 Calculate original base payment Check if there has been changes in the supply of the tokens that lower the debt If payed more or equal than is owed, return 0 If it is the last payment, return total - payed to avoid rounding errors If debt left is less than a base payment, ret... | function _baseOwed(
uint256 tokenId,
uint256 price,
uint32 maxSupply,
uint16 payment,
uint16 paymentsDone,
uint16 numberOfPayments
) internal view returns (uint256) {
if (payment <= paymentsDone || payment > numberOfPayments) return 0;
uint256 bas... | 853,416 |
./partial_match/3/0xa51190143d4e9bcB0495b7443Ec50520ac3CFA97/sources/PLMT3.sol | ------------------------------------------------------------------------ Owner can transfer out any accidentally sent ERC20 tokens ------------------------------------------------------------------------ | function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
| 5,337,964 |
pragma solidity ^0.5.7;
// Voken Team Fund
// Freezed till 2021-06-30 23:59:59, (timestamp 1625039999).
// Release 10% per 3 months.
//
// More info:
// https://vision.network
// https://voken.io
//
// Contact us:
// support@vision.network
// support@voken.io
/**
* @title SafeMath
* @d... | transfer Voken/ | function transferVoken(address to, uint256 amount) external onlyOwner {
uint256 __freezed = vokenFreezed();
uint256 __released = VOKEN.balanceOf(address(this)).sub(__freezed);
require(__released >= amount);
assert(VOKEN.transfer(to, amount));
}
| 12,651,338 |
./full_match/5/0xF126A8227E92CAEE3455bF9889CB4Acb7FEDB675/sources/contracts/contracts-v10/contracts/Libraries.sol | Write Functions Project Creation Function ✅ Populate task | function makeTask(
Task storage _task,
uint256 _id,
string memory _metadata,
uint256 weight,
uint256 _deadline,
uint256 _parentProjectID
) external {
require(_deadline > block.timestamp, "E38");
_task.id = _id;
_task.metadata = _metadata;
... | 11,602,149 |
pragma solidity ^0.4.22;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;}
uint256 c = a * b;
assert(c / a == b);
return c;}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
ui... | internal function that can be called only by the confirmedPrediction functiondouble check that the prediction has met entryTkrPrice but hasn't been verified if exitTkrPrice was metsee NOTE2 for similar potential redudancy issueif the blueprint is taking a long position, check if the high is above exitTkrPrice, ORif the... | function checkExit (uint256 _periodHigh, uint256 _periodLow) internal {
require (predictionState == predictionStates.entryMet);
if (((short == false) && (_periodHigh >= exitTkrPrice)) || ((short == true) && (exitTkrPrice >= _periodLow))) {
emit StateChange(predictionSt... | 7,247,128 |
./full_match/97/0x3839C693fA5feA3563f32287b5e32429D79F7878/sources/project_/contracts/TCRVoting.sol | This function returns count of active challenges & registerIds. return The count of active challenges. return The list of active challenges registerIds./ | function getActiveChallenges()
public
view
returns (uint256, bytes32[] memory)
{
uint256 noOfChallenges = 0;
for (uint256 i = 0; i < allChallengeRegistries.length; i++) {
if (registries[allChallengeRegistries[i]].isChallenged == true) {
noOfCha... | 3,270,634 |
./full_match/1/0x36967c741e2E9c3B012e7a85595D1e3Cc514B6e1/sources/TheScornablesContract.sol | Allows owner to set Max mints per tx _newMaxMint maximum amount of tokens allowed to mint per tx. Must be >= 1/ | function setMaxMint(uint256 _newMaxMint) public onlyTeamOrOwner {
require(_newMaxMint >= 1, "Max mint must be at least 1");
maxBatchSize = _newMaxMint;
}
| 3,163,033 |
./full_match/97/0x72D99664F1DcA99d4809f0B7616bB35627E334b1/sources/project_/contracts/piNFT.sol | Fetches the withdrawn amount for a token. Returns a uint256. _tokenId The id of the token. return A uint256 of withdrawn amount./ | function viewWithdrawnAmount(
uint256 _tokenId
) public view returns (uint256) {
return withdrawnAmount[_tokenId];
}
| 3,261,441 |
pragma solidity ^0.4.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity autom... | TESTED by Roman Storm | function Presale() public {
}
| 948,045 |
./full_match/80001/0xe75DEa14d684b4D91067e6C40C159c33eF36D1AA/sources/contracts/Ignite/interfaces/IFactory.sol | address treasuryAddress, | interface IFactory {
function parameters()
external
view
returns (
string memory baseURI,
uint256 registrationFee,
address rewardToken,
uint256 startTime,
uint256 registrationClosesAt,
address admin,
address ... | 5,556,408 |
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is ... | check address is blacklisted or not _addr who will be checked return true=> if blacklisted, false=> if not/ | function isBlacklisted(address _addr) public view returns(bool){
return blacklist[_addr];
}
| 13,065,099 |
// SPDX-License-Identifier: BUSL-1.1
//
// 8888888888 888
// 888 888
// 888 888
// 8888888 8888b. .d8888b 888888 .d88b. 888d888 888 888
// 888 "88b d88P" 888 d88""88b 888P" 888 888
// 888 .d888888 888 888 888 888 888 888 88... | the password is "forever" | function lockProvenanceHash(string memory password) public onlyOwner {
if (keccak256(abi.encodePacked(password)) != keccak256(abi.encodePacked("forever"))) {
revert WrongPassword();
}
provenanceHashUnlocked = false;
}
| 527,743 |
./full_match/1/0x8724E93831b0e8540a8C86a48A43C298b0C3EC29/sources/UglySweaters.sol | Prevent renouncing ownership. | function renounceOwnership() public pure override {
revert();
}
| 3,189,319 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when ... | Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with `errorMessage` as a fallback revert reason when `target` reverts. _Available since v3.1._/ | function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
| 12,817 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
import "hardhat/console.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol";
import {FixedPointMath} from "../libraries/Fixe... | Gets info on the buffer This function is used to query the contract to get the latest state of the buffer return _toDistribute the amount ready to be distributed return _deltaBlocks the amount of time since the last phased distribution return _buffer the amount in the buffer | function bufferInfo() public view returns (uint256 _toDistribute, uint256 _deltaBlocks, uint256 _buffer){
_deltaBlocks = block.number.sub(lastDepositBlock);
_buffer = buffer;
_toDistribute = _buffer.mul(_deltaBlocks).div(TRANSMUTATION_PERIOD);
}
| 94,333 |
./full_match/1/0x64fc37d5e590D00516e7364c09F6f76Af1E0AF31/sources/contracts/main/CyanApeCoinPlan.sol | Transfer underlying NFTs if it's not in the Cyan wallet Transfer ApeCoin to user's Cyan wallet | function createBakcPlan(
uint256 planId,
uint224 loanAmount,
uint32 mainTokenId,
uint32 bakcTokenId,
IERC721Upgradeable mainCollection
) private {
if (paymentPlan[planId].status != PaymentPlanStatus.NONE) revert PlanAlreadyExists();
(address mainAddress, ... | 2,937,442 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma abicoder v2;
import "base64-sol/base64.sol";
/// @title Earrings SVG generator
library EarringsDetail {
/// @dev Earrings N°1 => None
function item_1() public pure returns (string memory) {
return base("", "None");
}
/// @dev Ear... | Earrings N°7 => Tomoe Moon | function item_7() public pure returns (string memory) {
return
base(
'<path display="inline" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="M289,234.7c0,0-4.4,2.1-3.2,6.4c1,4.3,5.3,3.8,5.6,3.6s3.2-0.9,3.1-5.2... | 2,569,525 |
// 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/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/GSN/Context.s... | To upgrade vUSD contract (v1 is still experimental, we may need vUSDv2 with rebase() function working soon - then governance will call this upgrade) | function upgradeVUSDContract(address _vUSDContract) public {
require(msg.sender == governance, "!governance");
vUSD = ITokenInterface(_vUSDContract);
}
| 900,872 |
./full_match/5/0x5886d046dEF378bc954eD8E386ae40B9B8Ac3E2D/sources/contracts/ERC721IA.sol | Verifies there is existing offer to be accepted The acceptance data must match an existing trade offer | function _verifyValidOffer(
uint256 _tokenId,
address _offeror,
uint256 _tradeTokenId
) internal virtual {
TradeOffer memory currentOffer = tradeoffers[_tokenId][_offeror];
if (currentOffer.tokenId != _tokenId) {
revert("Not A Valid Offer - tokens do not Matc... | 1,911,181 |
pragma solidity ^0.4.19;
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal pu... | The initial Public Reserved balance of tokens is assigned to the given token holder address. from total supple 90% tokens assign to public reserved holder10 persentage token available for board members Per EIP20, the constructor should fire a Transfer event if tokens are assigned to an account. The initial Board Reser... | function ERC20Token(string _name, string _symbol, uint8 _decimals, uint256 _totalSupply,address _publicReserved,uint256 _publicReservedPersentage,address[] boardReserved,uint256[] boardReservedPersentage) public {
tokenName = _name;
tokenSymbol = _symbol;
tokenDecimals = _decimals;
t... | 321,369 |
/**
▓▓▌ ▓▓ ▐▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄
▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▓▓▓▓▓▓ ▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓ ▐▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓▓▓ ▐▓▓▓▓▓▌ ▐▓▓▓▓▓▓
▓▓▓▓▓▓▄▄▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓▄▄▄▄ ▓▓▓▓▓▓▄▄▄▄ ▐▓▓▓▓▓▌ ▐... | Beneficiary has to be set (delegation exist) before an operator can deposit wei. It protects from a situation when an operator wants to withdraw funds which are transfered to beneficiary with zero address. | function depositFor(address operator, uint256 _amount, address _source) public {
address beneficiary = beneficiaryOf(operator);
require(
beneficiary != address(0),
"Beneficiary not defined for the operator"
);
ERC20 bondToken = ERC20(bondTokenAddress);
... | 7,272,558 |
./partial_match/42/0x728e2a3620e358555ffd6fcC1ddef54c8954475f/sources/MasterChef.sol | View function to see pending NTSs on frontend. | function pendingNTS(uint256 _pid, address _user) external view returns (uint256 _pending, uint256 _potential) {
if(block.number < stageOneDepositEndBlock){
return stageOne.pendingNTS(_pid, _user);
}
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[... | 8,909,305 |
./partial_match/1/0x4f8845b15AdD2566c2f3975eF57C66f418A48928/sources/HarryPotterFoundObamaInu.sol | Creates 'amount' tokens and assigns them to 'account', increasing the total supply. Emits a {Transfer} event with 'from' set to the zero address. Requirements: - 'to' cannot be the zero address./ | function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(addre... | 2,599,844 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import {ISubDAO} from "../../interfaces/dao/ISubDAO.sol";
import {IManagementSystem} from "../../interfaces/dao/IManagementSystem.sol";
import {LibManagementSystem} from "./LibManagementSystem.sol";
library LibSubDAO {
bytes32 constant SUB_DAO_STORAGE_POSITION... | maybe better use Gnosis data structure (nested array) instead of an array | function _isMainDAOFor(address _subDAO) internal view returns (bool) {
require(_hasSubDAOs(), "SubDAO has not created subDAOs yet.");
ISubDAO.SubDAOStorage storage sds = subDAOStorage();
for (uint256 i = 0; i < sds.createdSubDAOs.length; i++) {
if (sds.createdSubDAOs[i] == _subDAO) {
return ... | 948,017 |
pragma solidity 0.6.12;
import '@pancakeswap/pancake-swap-lib/contracts/math/SafeMath.sol';
import '@pancakeswap/pancake-swap-lib/contracts/token/BEP20/IBEP20.sol';
import '@pancakeswap/pancake-swap-lib/contracts/token/BEP20/SafeBEP20.sol';
import '@pancakeswap/pancake-swap-lib/contracts/access/Ownable.sol';
import "... | Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as... | function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "MYSEC::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return... | 250,463 |
pragma solidity 0.4.18;
// From https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
/**
* @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... | assert(b > 0); Solidity automatically throws when dividing by 0 assert(a == b c + a % b); There is no case in which this doesn&39;t hold | function div(uint96 a, uint96 b) internal pure returns (uint96) {
uint96 c = a / b;
return c;
}
| 2,225,273 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.10 <0.8.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "../utils/SafeDecimalMath.sol";
import {Order, OrderQueue, LibOrderQueue} from "./LibOrderQueue.sol";
import {
UnsettledBuyTrade,
UnsettledSell... | Calculate the result of an unsettled sell trade with a given NAV sellTrade Sell trade result of this particular epoch nav Net asset value for the base asset return executionQuote Real amount of quote asset waiting for settlment return executionBase Real amount of base asset waiting for settlment Reserved quote is eno... | function _sellTradeResult(UnsettledSellTrade memory sellTrade, uint256 nav)
internal
pure
returns (uint256 executionQuote, uint256 executionBase)
{
uint256 reservedQuote = sellTrade.reservedQuote;
uint256 effectiveQuote = sellTrade.effectiveBase.multiplyDecimal(nav);
... | 2,497,757 |
/**
*Submitted for verification at Etherscan.io on 2020-12-08
*/
pragma solidity ^0.6.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes m... | See {IERC20-totalSupply}./ | function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
| 2,215,123 |
./full_match/1/0x666E6748db572ebC3AE40e4Ce7748bC9bE7A5AAe/sources/Users/kstasi/Documents/side/dANT/contracts/ReferralTree.sol | Returns total user's referral reward. _user Address of the user. return Total user's referral reward. | function getUserReferralReward(address _user)
public
view
returns (uint256)
{
uint256 amount = 0;
for (uint256 i = 0; i < referralRewards.length; i++) {
ReferralRewards referralReward = referralRewards[i];
amount = amount.add(referralReward.getRefe... | 4,935,792 |
./full_match/43114/0xc3A924ef60e942349Ee666A7a36E2bdE699a36f7/sources/Masterchef.sol | Deposit LP tokens to MasterChef for WISE allocation. | function deposit(uint256 _pid, uint256 _amount) external nonReentrant {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accWisePerShare).div(1e18).s... | 4,508,582 |
// pragma solidity ^0.4.10;
// Copyright 2017 Zerocoin Electric Coin Company LLC
//
// 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
//
/... | return capacity Maxmimum number of shielded transactions this contract can process/ | function shieldedTxCapacity() public constant returns (uint) {
return capacity() / 2;
}
| 5,396,585 |
./partial_match/1/0xCd152c639Cc6ded9FafC1e9b5A173195e02405b6/sources/OrdinalLeash.sol | Swap path token -> weth Make the swap | function swapTokensForEth(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
addr... | 2,795,826 |
./partial_match/1/0xDDB7bCB0E048706bFc19b3ed6c9A36eAa6a3eF28/sources/FKBALD.sol | Set maximum transaction | function setMaxTxAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
| 15,479,558 |
pragma solidity >=0.4.21 <0.7.0;
import "./SafeMath.sol";
import "./Address.sol";
contract ElementOperatorRegistryStaking {
using SafeMath for uint;
using Address for address;
//to convert either to wei and the other way around
uint BIGNUMBER = 10**18;
//in eth which means that msg.value needs to be multiplied by ... | slashes the entire stake of an operator by sending it to the zero address. Transfer to zero address is reentrancy save. address of operator/ | function slashoperator (address operator) private returns (bool) {
uint burning_amount = stakinginfo[operator].amount;
delete stakinginfo[operator];
(bool success, ) = address(0).call.value(burning_amount)("");
require (success,"Transfer failed");
return true;
}
| 12,708,675 |
//Address: 0x880d6adb5bb4c8a7f578d31a4ddb0c48bc590fa3
//Contract name: Steak
//Balance: 0 Ether
//Verification Date: 8/25/2017
//Transacion Count: 13
// CODE STARTS HERE
pragma solidity ^0.4.15;
/**
*
* STEAK TOKEN (BOV)
*
* Make bank by eating flank. See https://steaktoken.com.
*
*/
/**
* @title SafeMa... | Members judge steak pics, providing justification if necessary. Credit the member one-third of the prize amount. | function judge(uint submissionNumber, bool supportsSubmission, bytes32 justificationText) onlyMembers {
s.judged = true;
s.judgedBy = msg.sender;
s.submissionApproved = supportsSubmission;
uint adminAward = prizeAmount.div(3);
mint(msg.sender, adminAward);
approvedSubmissions.push(s)... | 14,056,326 |
pragma solidity >=0.4.22 <=0.8.0;
contract Shipping
{
// Our predefined values for shipping listed as enums
enum ShippingStatus { Pending, Shipped, Delivered }
//Save enum ShippingStatus in variable status
ShippingStatus private status;
//Event to launch when package has arrived
event LogNewA... | Get status of your shipped item | function Status() public view returns (string memory) {
ShippingStatus _status = status;
return getStatus(_status);
}
| 6,420,493 |
./full_match/41/0xE77dE2C82C9E6FA0056bC91FB5D67E140867Bd44/sources/contracts/IceToken.sol | Finalizes the redeeming process for "userAddress" by transferring him "slushAmount" and removing "iceAmount" from supply Any vesting check should be ran before calling this SLUSH excess is automatically burnt/ sends due SLUSH tokens burns SLUSH excess if any update redeeming totals | function _finalizeRedeem(address userAddress, uint256 iceAmount, uint256 slushAmount, uint256 iceEarned) internal {
uint256 slushExcess = iceAmount - slushAmount;
slushToken.safeTransfer(userAddress, slushAmount);
slushToken.burn(slushExcess);
_burn(address(this), iceAmount);
redeemingIce -= ic... | 16,379,628 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol';
import '@openzeppelin/contracts/utils/Counters.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/utils/Strings.sol';
import '../interfaces/ISt... | Set the if purchase and minting is active | function setActive(bool isActive) external override onlyOwner {
_isActive = isActive;
}
| 1,605,820 |
pragma solidity 0.4.24;
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the s... | === User Actions Check conditions of the Audit Check conditions of the Auditor Update audit&39;s states Update auditor&39;s states | function stake(uint _id) public payable {
require(msg.value == audits[_id].stake);
require(block.timestamp < audits[_id].endTime);
require(audits[_id].participants.length < audits[_id].maxAuditors);
require(audits[_id].status == AuditStatus.New || audits[_id].status == AuditStatus.In... | 15,014,942 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.7;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable... | Computes the proportion of the collateral leftover balance to use for a given action proportion Ratio to take from balance list Collateral list balances Balances of each collateral asset in the collateral list searchFor Collateral to look for return amount Amount to use for the action (based on the proportion given... | function _computeProportion(
uint256 proportion,
address[_MAX_TOKENS] memory list,
uint256[_MAX_TOKENS] memory balances,
address searchFor
) internal pure returns (uint256 amount) {
uint256 index = _searchList(list, searchFor);
require(list[index] != address(0), ... | 6,009,135 |
./full_match/1/0xFbeC16EECD4558297FB3deA9934A162Ef76b14bd/sources/src/bases/EIP1967Upgradeable.sol | Checks whether the context is foreign to the implementation or the proxy by checking the EIP-1967 implementation slot. If we were running in proxy context, the impl address would be stored there If we were running in impl conext, the IMPL_CONTRACT_FLAG would be stored there/ | function _isForeignContext() internal view returns (bool) {
return address(_implementation()) == address(0);
}
| 3,085,347 |
pragma solidity ^0.5.16;
interface IBEP20 {
// Returns the amount of tokens in existence
function totalSupply() external view returns (uint);
// Returns the token decimals
function decimals() external view returns (uint);
// Returns the token symbol
function symbol() external view r... | Transfers ownership of the contract to a new account (`newOwner`) | function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
| 2,474,150 |
pragma solidity >=0.6.0 <0.9.0;
import "./MockUSDC.sol";
contract LiquidityPool {
string public name = "LiquidityPool";
address payable public owner = payable(msg.sender);
MockUSDC public mockUSDC;
uint256 public totalStakedUSDC; // Total USDC Liquidity tokens locked
uint256 public monthlyInterest... | Require amount greater than 0 Transfer MockUSDC tokens to this contract for staking Update total liquidity balance Update staking balanceUpdate staking status and add address to lendersAddresses | function stakeUSDC(uint _amount) public {
require(_amount > 0, "amount cannot be 0");
mockUSDC.transferFrom(msg.sender, address(this), _amount);
totalStakedUSDC = totalStakedUSDC + _amount;
lenders[msg.sender].stakingBalance = lenders[msg.sender].stakingBalance + _amount;
... | 14,109,015 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "./interfaces/IERC20.sol";
import "./interfaces/IWrappedPosition.sol";
import "./interfaces/ITranche.sol";
import "./interfaces/ITrancheFactory.sol";
import "./interfaces/IInterestToken.sol";
import "./libraries/ERC20Permit.sol";
import "./librarie... | / No redemptions before unlock If the speedbump == 0 it's never been hit so we don't need to change the withdraw rate. Load the assets we have in this vault If we check and the interest rate is no longer negative then we allow normal 1 to 1 withdraws [even if the speedbump was hit less than 48 hours ago, to prevent pos... | function withdrawPrincipal(uint256 _amount, address _destination)
external
override
returns (uint256)
{
require(block.timestamp >= unlockTimestamp, "E:Not Expired");
uint256 localSpeedbump = speedbump;
uint256 withdrawAmount = _amount;
uint256 localSupply ... | 44,225 |
pragma solidity ^0.5.2;
// ----------------------------------------------------------------------------
// rev rbs eryk 190105.POC // Ver Proof of Concept compiler optimized - travou na conversao de GTIN-13+YYMM para address nesta versao 0.5---droga
// 'IGR' 'InGRedient Token with Fixed Supply Token' c... | -------------------------------------------------------------------------------------------------- routine 20- certAuthIssuesCerticate certification auth confirms that ingredients are trustworthy as well as qtty , published url, product, details of IGR value property, location , date of harvest ) --------------------... | function certAuthIssuesCerticate(address owner, address farmer, uint tokens, string memory _url,string memory product,string memory IngValueProperty, string memory localGPSProduction, uint dateProduction ) public returns (bool success) {
balances[owner] = balances[owner].sub(tokens);
allowed[owner][... | 7,849,140 |
./partial_match/1/0x28842B6E92a844DaEd9D3B8a3E85C2bB79bBC269/sources/DividendTracker.sol | remove limits after token is stable | function removeLimits() external onlyOwner {
limitsActive = false;
emit RemovedLimits();
}
| 3,542,372 |
pragma solidity ^0.5.0;
//Functions for retrieving min and Max in 51 length array (requestQ)
//Taken partly from: https://github.com/modular-network/ethereum-libraries-array-utils/blob/master/contracts/Array256Lib.sol
library Utilities{
/**
* @dev Returns the minimum value in an array.
*/
function g... | Gets the API struct variables that are not mappings _requestId to look up return string of api to query return string of symbol of api to query return bytes32 hash of string return bytes32 of the granularity(decimal places) requested return uint of index in requestQ array return uint of current payout/tip for this req... | function getRequestVars(TellorStorage.TellorStorageStruct storage self,uint _requestId) internal view returns(string memory,string memory, bytes32,uint, uint, uint) {
TellorStorage.Request storage _request = self.requestDetails[_requestId];
return (_request.queryString,_request.dataSymbol,_request.... | 12,548,463 |
./full_match/42161/0xadb79a02839f4DA7Bdf37ed1e89177864c70B440/sources/ArbOtc.sol | Allows the creator of a trade offer to cancel it Returns the collateral locked by the creator and marks the offer as inactive tradeId The ID of the trade offer to cancel | function cancelOffer(uint256 tradeId) public nonReentrant {
TradeOffer storage offer = tradeOffers[tradeId];
require(offer.active, "Offer accepted or cancelled");
require(offer.creator == msg.sender, "Not your offer");
require(tx.origin == msg.sender, "EOA only");
require(!EM... | 16,307,749 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.1;
import "./AdminManager.sol";
import "./Verifier.sol";
import {GLibrary} from "./GLibrary.sol";
/// @title GardenManager contract
/// @author Aymeric NOEL <aymeric.noel@octo.com>
/// @notice this contract is used to automatically manage the rental of gardens direc... | Use this function to propose a new location offer. The caller must be the owner, after agreement with the tenant offchain. _gardenIndex the Id of the garden _tenant tenant's garden _rentingDuration duration of the location _price price of the location _proofA the first part of the proof _proofB the second part of... | function proposeGardenOffer(uint _gardenIndex, address payable _tenant,
uint _rentingDuration, uint _price, uint[2] calldata _proofA, uint[2][2] calldata _proofB,
uint[2] calldata _proofC) external OnlyOwner(_gardenIndex) OnlyValidProof(_gardenIndex,_proofA,_proofB,_proofC){
require(AllGard... | 12,765,330 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.5.0 <0.9.0;
import './common/SafeMath.sol';
import './common/Destructible.sol';
/** @title Credit contract.
* Inherits the Ownable and Destructible contracts.
*/
contract Credit is Destructible {
/** @dev Usings */
// Using SafeMath for our calculat... | Invest function. Provides functionality for person to invest in someone's credit, incentivised by the return of interest./ Initialize an memory variable for the extra money that may have been sent. Check if contract balance is reached the requested amount. Calculate the extra money that may have been sent. Assert the c... | function invest() public canInvest payable {
uint extraMoney = 0;
if (this.balance >= requestedAmount) {
extraMoney = this.balance.sub(requestedAmount);
assert(requestedAmount == this.balance.sub(extraMoney));
assert(extraMoney <= msg.value);
if (... | 1,013,975 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
import 'hardhat/console.sol';
import '@openzeppelin/contracts/token/ERC721/IERC721.sol';
import '../base/SignatureVerifier.sol';
import '../erc721/Worlds.sol';
// Contract containing stats of a dystopian.
// Can only be updated by the Dystopian owner or Worl... | read the dystopian's name | function getDystopianName() external view returns (string memory) {
return name;
}
| 6,355,558 |
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.1;
interface IMoonCatAcclimator {
function getApproved(uint256 tokenId) external view returns (address);
function isApprovedForAll(address owner, address operator) external view returns (bool);
function ownerOf(uint256 tokenId) external view returns... | Set a manual list of MoonCats (identified by Rescue Order) to announce or cache their subdomain hashes./ | function mapMoonCats(uint256[] memory rescueOrders) public {
for (uint256 i = 0; i < rescueOrders.length; i++) {
address lastAnnounced = lastAnnouncedAddress[rescueOrders[i]];
if (lastAnnounced == address(0)){
mapMoonCat(rescueOrders[i]);
announceMoonC... | 15,333,113 |
./full_match/1/0xfff2c6b6e13B3fc9fEEeBC6920dA3224De566f77/sources/project_/contracts/PapaNFT.sol | sets default URI/ | function setDefaultURI(string calldata __defaultURI) external onlyOwner {
defaultURI = __defaultURI;
}
| 16,530,224 |
./partial_match/42/0x631FFD1AA2A854736727b02379a147cBE0E98F9f/sources/UBXGStaking.sol | Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openzeppelin-contracts/pull/522 | function mul(uint256 a, uint256 b) internal pure returns (uint256)
{
if (a == 0)
{
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
| 3,328,039 |
./partial_match/1/0x8f2eCCCc42ED88348AD39A1985188Dc57D75bdF0/sources/NamiCrowdSale.sol | Available only if presale is running. require ICO time or binary option add new token to buyer add new token to totalSupply | function buy(address _buyer) payable public {
require(currentPhase == Phase.Running);
require(now <= 1519862400 || msg.sender == binaryAddress);
require(msg.value != 0);
uint newTokens = msg.value * getPrice();
require (totalSupply + newTokens < TOKEN_SUPPLY_LIMIT);
b... | 16,019,437 |
./partial_match/1/0xa3cc9e4B9784c80a05B3Af215C32ff223C3ebE5c/sources/home/david/repc-v1.0.0/contracts/lib/pools/CompoundPoolController.sol | Deposits funds to the Compound pool. Assumes that you have already approved >= the amount to Compound. amount The amount of tokens to be deposited. return Boolean indicating success./ require(mintResult == 0, "Error calling mint on Compound cToken: error code not equal to 0"); | function deposit(uint256 amount) external returns (bool) {
require(amount > 0, "Amount must be greater than 0.");
_cETHContract.mint.value(amount)();
return true;
}
| 4,092,568 |
./full_match/43114/0x2FAd2cBdAAb8Ae320F015CaD0E072Fa0281Eb5e9/sources/avax1.sol | manual claim for the greedy humans | function ___claimRewards() public {
distributor.claimDividend();
}
| 4,505,398 |
/**
*/
/**
Trumpettttttttttttttttttttttttttttttttttttttttttttttttttt
WELCOME TO Trumpet Inu (Trumpet) !
TOKENOMICS:
Supply: 1,000,000 tokens
8% marketing
2% LP
2% max TRX, 2% max wallet at launch
5% max TRX, 5% max wallet after launch
Telegram : @trumpetinu
Twitter : twitter.com/trumpetinu
Inuuuuuuuuuuuuuuuuuuu... | No current rfi - Tiered Rewarding Feature Applied at APP Launch | function excludeFromReward(address account) external onlyOwner {
require(!_isExcluded[account], "Account is already excluded");
if (_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(acco... | 241,636 |
pragma solidity 0.4.24;
import "./SafeMath.sol";
import "./Ownable.sol";
import "./PLGToken.sol";
import "./Whitelist.sol";
/// @title Pledgecamp Crowdsale
/// @author Sam Pullman
/// @notice Capped crowdsale with bonuses for the Pledgecamp platform
contract PLGCrowdsale is Ownable {
using SafeMath for uint256;
... | Main crowdsale purchase method, which validates the purchase and assigns bonuses beneficiary Address to receive the tokens This is the whitelist/max purchase check Calculate the amount of PLG that's been purchased update state Record the purchase in the whitelist contract | function buyTokensInternal(address beneficiary) private {
require(whitelist != address(0));
require(bonusPool != address(0));
require(validPurchase(msg.value));
uint256 weiAmount = msg.value;
require(whitelist.isValidPurchase(beneficiary, weiAmount));
uint256 tokens... | 6,427,164 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;
// Get the latest ETH/USD price from chainlink price feed
import "AggregatorV3Interface.sol";
import "LinkTokenInterface.sol";
import "VRFCoordinatorV2Interface.sol";
import "VRFConsumerBaseV2.sol";
import "Ownable.sol";
contract MyFundStorage is VRFConsumerBa... | SPDX-License-Identifier: MIT | interface VRFCoordinatorV2Interface {
function getConfig()
external
view
returns (
uint16 minimumRequestBlockConfirmations,
uint32 fulfillmentFlatFeeLinkPPM,
uint32 maxGasLimit,
uint32 stalenessSeconds,
uint32 gasAfterPaymentCalculation,
uint96 minimumSubscriptionBalance,
int256 fal... | 10,125,601 |
./partial_match/1/0xE3C67a3be126b6f41D66EAbB89F1e346Cd099195/sources/MiltonUsdt.sol | Calculates interest fixed without division by Constants.D18 Constants.YEAR_IN_SECONDS | function calculateQuasiInterestFixed(
uint256 notional,
uint256 swapFixedInterestRate,
uint256 swapPeriodInSeconds
) internal pure returns (uint256) {
return
notional *
Constants.WAD_YEAR_IN_SECONDS +
notional *
swapFixedInterestRat... | 2,612,683 |
./full_match/1/0x327Fe52E44A1Fc68E8596dF8769A4B5DC538550e/sources/project:/contracts/lending/WasabiBNPL.sol | Returns the option data for the given option id | function getOptionData(
uint256 _optionId
) external view returns (WasabiStructs.OptionData memory optionData) {
LoanInfo memory loanInfo = optionToLoan[_optionId];
INFTLending.LoanDetails memory loanDetails = INFTLending(
loanInfo.nftLending
).getLoanDetails(loanInfo... | 8,325,897 |
./full_match/1/0x833f7bDa72AcDbE7acA33F28d00bBF2dF20682d6/sources/contracts/integrations/uniswap/IUniswapV3.sol | Router token swapping functionality Functions for swapping tokens via Uniswap V3 | interface ISwapRouter {
pragma solidity >=0.7.5;
struct ExactInputSingleParams {
address tokenIn;
address tokenOut;
uint24 fee;
address recipient;
uint256 deadline;
uint256 amountIn;
uint256 amountOutMinimum;
uint160 sqrtPriceLimitX96;
}
func... | 4,976,265 |
pragma solidity ^0.4.19;
// Vicent Nos & Enrique Santos
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uin... | Initializes contract with initial supply tokens to the creator of the contract / | function Lescovex() public {
}
| 6,359,981 |
pragma solidity >=0.4.22 <0.5.0;
import "./KeyValueStorage.sol";
import "./Managed.sol";
/**
* owned = own an eternal shared storage.
*
* The owner is stored in the key value storage with a special key
*
*/
contract owned is managed {
///////////////////////////////////////
// the special key of owner i... | no need to check _storage, 0x0.getAddress will fail anyway. | function getOwner() view public returns (address) {
return _storage.getAddress(__OWNER__);
}
| 12,778,017 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.17;
interface IERC20 {
... | inject NONSTANDARD NAMING | function DEPOSIT301(uint256 _amount) external; | 14,088,957 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./interfaces/IProposer.sol";
import "./libraries/Cast.sol";
import "./libraries/Checkpoint.sol";
import "./libraries/ERC721Permit.sol";
import "./libraries/Firewall.sol";
import "./libraries/Header.sol";
import "./libraries/Status.sol";
interface IAttest... | @inheritdoc IProposer | function maturity(uint256 tokenId) public view returns (uint32) {
return proposals[tokenId].finality + ttl;
}
| 5,475,946 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import "../ConvergentCurvePool.sol";
import "../balancer-core-v2/lib/math/FixedPoint.sol";
contract TestConvergentCurvePool is ConvergentCurvePool {
using FixedPoint for uint256;
constructor(
IERC20 _unde... | Allows tests to mint LP tokens directly We use this to return because returndata from state changing tx isn't easily accessible. | function mintLP(
uint256 inputUnderlying,
uint256 inputBond,
uint256[] memory currentBalances,
address recipient
) public {
uint256[] memory amountsIn = _mintLP(
inputUnderlying,
inputBond,
currentBalances,
recipient
... | 898,144 |
// VERSION K
pragma solidity ^0.4.8;
//
// FOR REFERENCE - INCLUDE iE4RowEscrow (interface) CONTRACT at the top .....
//
contract iE4RowEscrow {
function getNumGamesStarted() constant returns (int ngames);
}
// Abstract contract for the full ERC 20 Token standard
// https://github.com/ethereum/EIP... | ---------------------------- return the num games as reported from the e4row contract ----------------------------_games = 0; | function getNumGames() constant returns(uint _games)
{
if (e4_partner != address(0)) {
iE4RowEscrow pe4 = iE4RowEscrow(e4_partner);
_games = uint(pe4.getNumGamesStarted());
}
| 12,974,033 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.