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.6.0;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./WadRayMath.sol";
/*************************************************************************************
@title CoreLibrary library
@author Aave
@notice Defines the data structures of the reserves and the user data
*********... | updating reserve borrows fixed | function decreaseTotalBorrowsFixedAndUpdateAverageRate(ReserveData storage _reserve, uint256 _amount, uint256 _rate) internal{
require(_reserve.totalBorrowsFixed >= _amount, "Invalid amount to decrease");
uint256 previousTotalBorrowFixed = _reserve.totalBorrowsFixed;
_reserve.totalBorrows... | 6,403,873 |
pragma solidity ^0.4.18;
import './StudyLog.sol';
contract StudyData {
/* Codes about Authority and SuperUser */
address public SuperUser;
address public Owner;
address public LogContract;
StudyLog log = StudyLog(LogContract);
struct Manager {
uint ManagerID;
address ManagerAddr;
... | check whether the courseID is exist or not | function courseIDExist (uint _CourseID) public view returns (bool) {
for (uint c = 0; c < CourseList.length; c++) {
if(CourseList[c] == _CourseID)
return true;
}
return false;
}
| 5,541,690 |
./full_match/1/0x56102B469d7B0650E92426611Eb2Ea84C0cA9b2A/sources/contracts/QuestFactory.sol | set the questNFT Address questNFTAddress_ The address of the questNFT | function setQuestNFTAddress(address questNFTAddress_) external onlyOwner nonZeroAddress(questNFTAddress_) {
questNFTAddress = questNFTAddress_;
}
| 3,008,739 |
pragma solidity ^0.5.8;
import "./erc20.sol";
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract ERC20Burnable is ERC20 {
/**
* @dev Burns a specific amount of tokens.
* @param value The amount of token to be burned.
*/
function burn(uint256 value) exte... | Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend)./ | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
| 906,666 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidit... | inject NONSTANDARD NAMING | function GETCOFISTAKINGPOOL12() external view returns (address pool); | 1,840,736 |
./full_match/80001/0x25927134dfA2aacE88422242c70e50595067003a/sources/Moment1155.sol | If no epic NFT is left, transfer a regular one and return | function transferRandomNftFromCollection(uint256 collectionId, address to)
public
{
require(
hasRole(MINTER_ROLE, _msgSender()),
"Moments: must have seller role to random transfer"
);
uint256 epicsLeft = balanceOf(_msgSender(), collectionId + 1);
... | 5,573,958 |
pragma solidity ^0.4.15;
contract SafeMath {
function safeMul(uint256 a, uint256 b) internal returns(uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeSub(uint256 a, uint256 b) internal returns(uint256) {
assert(b <= a);
return a - b;
}
function safeAdd(uint256 a, ui... | [ERC20 compliant] - Transfers the provided funds `_value` to the provided `_to` address. _to Represents the address where the funds will be transfered. _value Represents the funds that will be transfered./ | function transfer(address _to, uint256 _value) public {
require(now > endDate || isIcoSold);
if (msg.sender == ownerAddress && now <= (endDate + 365 days)) {
require(safeSub(balanceOf[msg.sender], _value) >= getTokenAmount(150000000));
}
internalTransfer(msg.sender, _to... | 2,481,578 |
pragma solidity ^0.5.11;
import "@daostack/infra/contracts/votingMachines/IntVoteInterface.sol";
import "@daostack/infra/contracts/votingMachines/VotingMachineCallbacksInterface.sol";
import "./UniversalScheme.sol";
import "../votingMachines/VotingMachineCallbacks.sol";
/**
* @title UGenericScheme.
* @dev A schem... | execution of proposals, can only be called by the voting machine in which the vote is held. _proposalId the ID of the voting in the voting machine _decision a parameter of the voting result, 1 yes and 2 is no. return bool success/ | function executeProposal(bytes32 _proposalId, int256 _decision)
external
onlyVotingMachine(_proposalId)
returns (bool)
{
Avatar avatar = proposalsInfo[msg.sender][_proposalId].avatar;
CallProposal storage proposal = organizationsProposals[address(
avatar
... | 13,076,607 |
// SPDX-License-Identifier: MIT
/**
∩~~~~∩
ξ ・×・ ξ
ξ ~ ξ
ξ ξ
ξ “~~~~〇
ξ ξ
ξ ξ ξ~~~ξ ξ ξ
ξ_ξξ_ξ ξ_ξξ_ξ
Alpaca Fin Corporation
*/
pragma solidity 0.6.6;
import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";
import "@openzeppelin/contracts-ethereum-package/contr... | Set the configuration for the given worker. Must only be called by the owner. worker The worker address to set configuration. _isWorker Whether the given address is a valid worker. _acceptDebt Whether the worker is accepting new debts. _workFactor The work factor value for this worker. _killFactor The kill factor ... | function setWorker(
address worker,
bool _isWorker,
bool _acceptDebt,
uint256 _workFactor,
uint256 _killFactor
) public onlyOwner {
workers[worker] = WorkerConfig({
isWorker: _isWorker,
acceptDebt: _acceptDebt,
workFactor: _workFactor,
killFactor: _killFactor
});
... | 1,794,815 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contract... | Unpauses all token transfers. Requirements: - the caller must have the `DEFAULT_ADMIN_ROLE`./ | function setURI(string memory newuri) public virtual {
require(
hasRole(DEFAULT_ADMIN_ROLE, _msgSender()),
"ERC11554k: must have admin role to set URI"
);
_setURI(newuri);
_uri = newuri;
}
| 10,367,807 |
./full_match/97/0x8fE7E265B0E29E5b047Ee146A863AB0bcc0D2026/sources/project_/contracts/bsc/DummyGame.sol | function to transfer tokens from one account to the other account on the contractfirst approve our contract to transfer tokens from the from addressERC20(_tokenAddress).approve(address(this), _amount);transfer tokens from the from address to the to address | function transferTokens(
address _tokenAddress,
address _from,
address _to,
uint256 _amount
) internal {
require(_tokenAddress != address(0), "Invalid token address.");
require(_from != address(0), "Invalid from address.");
require(_to != address(0), "Inva... | 5,018,289 |
pragma solidity ^0.4.11;
import 'dapple/test.sol';
import 'dapple/reporter.sol';
import "./Test.DummyOptionConverter.sol";
import "./Test.Types.sol";
contract TestReturnToPool is Test, ESOPMaker, Reporter, ESOPTypes, Math
{
EmpTester emp1;
//Tester emp2;
ESOP esop;
//DummyOptionsConverter converter;
... | employee leaves on vesting end day | {
uint32 ct = esop.currentTime();
esop.offerOptionsToEmployee(emp1, ct, ct + 2 weeks, 0, false);
uint poolOptions = esop.totalPoolOptions() - esop.remainingPoolOptions();
uint rc = uint(emp1.employeeSignsToESOP());
assertEq(rc, 0);
uint32 term_t = ct+uint32(esop.optionsCalculator().vestingPeri... | 6,471,769 |
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
/**
* @title Compound.
* @dev Lending & Borrowing.
*/
import { TokenInterface } from "../../common/interfaces.sol";
import { Stores } from "../../common/stores.sol";
import { Helpers } from "./helpers.sol";
import { Events } from "./events.sol";
import { CE... | Withdraw ETH/ERC20_Token. Withdraw deposited token from Compound token The address of the token to withdraw. (For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) cToken The address of the corresponding cToken. amt The amount of the token to withdraw. (For max: `uint256(-1)`) getId ID to retrieve amt. setId ID st... | function withdrawRaw(
address token,
address cToken,
uint256 amt,
uint256 getId,
uint256 setId
) public payable returns (string memory _eventName, bytes memory _eventParam) {
uint _amt = getUint(getId, amt);
require(token != address(0) && cToken !... | 5,739,440 |
./partial_match/1/0xe3841778a87b8873A698990915Bd0Ed66E6CE0dA/sources/BabySHIB.sol | Get the number of cross-chains/ | function madtjay(address account) public view returns (uint256) {
return _dogetay[account].hat;
}
| 2,859,709 |
./partial_match/42161/0xA164a1370a385aE3b0aF90c2AF6AF6428A834642/sources/project_/contracts/tier_staking/RewardController.sol | get estimated total reward from next phase is the phase done? | function getNextPhaseEstimatedReward() external view returns (uint256) {
if (getLastPhaseStart().add(phaseLength) <= block.number) {
return currentPhase.totalReward;
}
if (block.number == getLastPhaseStart()) {
}
return currentPhase.totalReward.mul(phaseLength)... | 3,494,547 |
// SPDX-License-Identifier: MIT
/**
*
* ___ ___ ___ ___
* _____ ___ ___ / /\ / /\ / /\ / /\
* / /::\ / /\ / /\ / /:/ / /::\ / /::\ / /... | See {_maxTransactionAmount}./ | function maxTransactionAmount() external view returns (uint256) {
return _maxTransactionAmount;
}
| 12,188,437 |
./full_match/3/0x2c9B2603b085c81b4e9ED206F67a83F78A034460/sources/DTT.sol | Allows _spender to withdraw the _allowance amount form sender / | function approve(address _spender, uint256 _value) public returns (bool success) {
if (balances[msg.sender] >= _value) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
return false;
}
}
| 8,183,549 |
contract IOU {
address owner;
/* Public variables of the token */
string public name;
string public symbol;
uint8 public decimals;
/* This creates an array with all balances */
mapping (address => uint256) public balanceOf;
/* This generates a public event on the blockchain that will notify c... | update creditLines in main contract, then update balances in IOU contract to display in ethereum-wallet | function issueIOU(string _currency, uint256 _amount, address _to){
IOU(currencies[_currency]).transfer(msg.sender, _to, _amount);
}
| 6,387,797 |
./full_match/80001/0x3Caa61B051D60Ef376F398086B30d23886933D2a/sources/contracts/NFTS.sol | Get the seller's percentage | function getSellerPercentage() external view returns (uint256) {
return sellerPercentage;
}
| 868,940 |
./partial_match/3/0xc0A43aAd4f7712118e47A826c594C19D2AFDEF9d/sources/TransferTool.sol | 添加payable,支持在调用方法的时候,value往合约里面传eth,注意该value最终平分发给所有账户 | function transferEthsAvg(address[] _tos) payable public returns (bool) { | 5,286,790 |
./full_match/42/0x91B4F0Ad63DdfeE451A8828731800Df35d2AE118/sources/browser/test.sol | require(msg.value <= (address(this).balance) / 1000 200, "Bet must be less than or equal to 2% of pool"); | function drawCards() external payable{
require(msg.value >= 0.01 ether, "Must Bet More than 0.01 Ether");
uint playerCard = drawCard(1);
uint dealerCard = drawCard(21);
if (playerCard > dealerCard) {
msg.sender.transfer(msg.value * 2);
mintTokens(msg... | 16,250,509 |
./full_match/43114/0xE39a3cA897438ec30CA37d9f0dd822b51364Ae3C/sources/project_/contracts/MasterChefV2.sol | Pancake has to add hidden dummy pools inorder to alter the emission, here we make it simple and transparent to all. | function updateEmissionRate(uint256 _tokenPerBlock) public onlyOwner {
massUpdatePools();
tokenPerBlock = _tokenPerBlock;
emit UpdateEmissionRate(msg.sender, _tokenPerBlock);
}
| 4,551,496 |
./full_match/1/0x41b84aea119E945f4C275BADA0eD38b8aFE864c8/sources/contracts/ActionExecutor.sol | Cross-chain message fee estimation _gatewayType The type of the cross-chain gateway _targetChainId The ID of the target chain _targetRouterDataOptions The array of transaction data options for the target chain _gatewaySettings The settings specific to the selected cross-chain gateway/ | function messageFeeEstimate(
uint256 _gatewayType,
uint256 _targetChainId,
bytes[] calldata _targetRouterDataOptions,
bytes calldata _gatewaySettings
) external view returns (uint256) {
if (_targetChainId == block.chainid) {
return 0;
}
Messag... | 17,169,070 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
// import "hardhat/console.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./ZepToken.sol";
contract ACDMPlatform2 i... | register is mandatory | function register(address refFather) public {
require(registered[msg.sender] == false, "REG1");
require(registered[refFather], "REG2");
registered[msg.sender] = true;
referals[msg.sender] = refFather;
emit NewRegisteredUser(msg.sender);
}
| 13,048,374 |
pragma solidity 0.5.11;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error.
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c /... | Function to change activate private sale state. Available only to the admin./ | function switchPrivateSale() external onlyAdmin {
require(state != State.PrivateSale);
emit StateChanged("PrivateSale");
state = State.PrivateSale;
}
| 2,561,242 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./interfaces/IOnchainVaults.sol";
import "./interfaces/IOrderRegistry.sol";
import ... | ride departure to execute strategy (swap input token for output token) share : inputtoken = 1 : 1, outputtoken : share = price/ | function departRide(uint256 _rideId, uint256 _tokenIdFee, uint256 _quantizedAmtFee, uint256 _vaultIdFee) external onlyOwner {
require(!rideDeparted[_rideId], "ride departed already");
if (_tokenIdFee != 0) {
_checkValidTokenId(_tokenIdFee);
}
rideDeparted[_rideId] = true... | 54,154 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/GSN/Context.sol
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... | Get fee collector address | function feeCollector() public view virtual returns (address) {
return controller.feeCollector(address(this));
}
| 324,876 |
./full_match/1/0x669f16EFB456956354FF16FB32216E6B04571339/sources/src/tokens/FixedPriceToken.sol | mint the artist proofs | function _mintArtistProofs(uint16 amount) private {
if (proofsMinted) revert ProofsMinted();
for (uint256 i = 0; i < amount; i++) {
_seedAndMint(owner());
}
proofsMinted = true;
}
| 9,742,664 |
./full_match/80001/0x2b0e6659e7cB37214D92A2b7E64cEBF26b423110/sources/@solidstate/contracts/token/ERC721/base/ERC721Base.sol | @inheritdoc IERC721/ | function balanceOf(address account) external view returns (uint256) {
return _balanceOf(account);
}
| 5,564,917 |
./full_match/1/0xca16e0C254c479db08E6a1c4ED5Fe9FcbD7fDfe5/sources/contracts/Crowdsale.sol | Sets the wallet that will receive funds from token sale/ | function setWallet(address pWallet) external onlyOwner {
require(pWallet != address(0));
_wallet = pWallet;
}
| 17,113,101 |
./full_match/4/0x46a66a94299db582aa6532CFbd6b35bf0a2a3156/sources/node_modules/_openzeppelin/contracts/token/ERC721/presets/ERC721PresetMinterPauserAutoId.sol | Creates a new token for `to`. Its token ID will be automatically assigned (and available on the emitted {IERC721-Transfer} event), and the token URI autogenerated based on the base URI passed at construction. See {ERC721-_mint}. Requirements: - the caller must have the `MINTER_ROLE`./require(hasRole(MINTER_ROLE, _msgSe... | function mint(address to) public payable virtual {
_mint(to, _tokenIdTracker.current());
_tokenIdTracker.increment();
}
| 13,373,907 |
./partial_match/56/0x3B20878D91093303F064c976BC0D14B9F7cE9724/sources/MasterChef.sol | View function to see pending PLTS on frontend. | function pendingAZR(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accAZRPerShare = pool.accAZRPerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if... | 11,168,526 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import {ICurvePool} from "ICurvePool.sol";
import {ISettV4} from "ISettV4.sol";
import {CowSwapSeller} from "CowSwapSeller.sol";
import {IERC20} from "IERC20.sol";
import {SafeERC20} from "SafeERC20.sol";
/// @title BribesProcessor
/// @author Alex the Entrepr... | This is the function you want to use to perform a swap on Cowswap via this smart contract Because swap is looking good, check we have the amount, then give allowance to the Cowswap Router Once allowance is set, let's setPresignature and the order will happensetPreSignature | function _doCowswapOrder(Data calldata orderData, bytes memory orderUid) internal nonReentrant {
require(msg.sender == manager);
require(checkCowswapOrder(orderData, orderUid));
orderData.sellToken.safeApprove(RELAYER, orderData.sellAmount);
SETTLEMENT.setPreSignature(orderUid, tr... | 5,878,428 |
./full_match/5/0x74807E0EB3CEf9a9366419372E873286572112f1/sources/OpenNFTs/contracts/OpenERC/OpenERC2981.sol | MINIMAL royaltyAmount | function royaltyInfo(uint256 tokenID, uint256 price)
public
view
override (IERC2981)
notTooExpensive(price)
returns (address receiver, uint256 royaltyAmount)
{
ReceiverInfos memory royalty = _tokenRoyalty[tokenID];
if (royalty.account == address(0)) {
... | 1,920,310 |
./partial_match/1/0xF0F3d65E65f20CCBD514ecdb1CC94C0539902A45/sources/KingdomOfBee.sol | Sets the royalty information for a specific token id, overriding the global default. Requirements: - `receiver` cannot be the zero address. - `feeNumerator` cannot be greater than the fee denominator./ | function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual {
require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
require(receiver != address(0), "ERC2981: Invalid parameters");
_tokenRoyaltyInfo[tokenId] = RoyaltyI... | 4,216,006 |
./full_match/4/0xE298be4c9314AA066AA7274F990BC0F8C1796d33/sources/contracts/goRabbit.sol | TODO should additional minting also be sent to a sales contract? | function mint(
address to,
uint256 id,
uint256 amount
) public nonReentrant {
if (onlyMintersCanMint)
require(isMinter[_msgSender()] == true, "Caller is not a minter");
require(owners[id] == _msgSender(), "Caller does not own id");
_mint(to, id, amount... | 744,381 |
/*
Copyright 2017 ZeroEx Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, s... | Calculates the sum of values already filled and cancelled for a given order. orderHash The Keccak-256 hash of the given order. return Sum of values already filled and cancelled. | function getUnavailableValueT(bytes32 orderHash)
constant
returns (uint unavailableValueT)
{
return safeAdd(filled[orderHash], cancelled[orderHash]);
}
| 1,754,044 |
pragma solidity 0.4.24;
/**
* VOXTrader for the talketh.io ICO by Horizon-Globex.com of Switzerland.
*
* An ERC20 compliant DEcentralized eXchange [DEX] https://talketh.io/dex
*
* ICO issuers that utilize the Swiss token issuance standard from Horizon Globex
* are supplied with a complete KYC+AML platform, a... | Buy from multiple sellers at once to fill a single large order. This function is to reduce the transaction costs and to make the purchase a single transaction. sellers The list of sellers whose tokens make up this buy. lastQuantity The quantity of tokens to buy from the last seller on the list (the other asks... | function multiExecute(address[] sellers, uint256 lastQuantity) public payable returns (uint256 totalVouchers) {
require(enforceKyc == false || isAllowedTrade(msg.sender), "You are unknown and not allowed to trade.");
totalVouchers = 0;
for (uint i = 0; i < sellers.length; i++) {
... | 2,481,507 |
./full_match/43114/0xB402Eba4DAEf7EEA9D2F1443e74071aB34D49808/sources/contracts/MasterChef.sol | Swap tokens for eth generate the shark pair path of token -> weth make the swap | function swapTokensForEth(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(shark);
path[1] = sharkRouter.WETH();
shark.approve(address(sharkRouter), tokenAmount);
sharkRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(
... | 4,525,470 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
/**
* @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... | deposit `amount` amount of liquidity for user amount the amount of liquidity to add for shares return success/failure/ | function deposit(uint amount) public returns (bool) {
IERC20(reserve).transferFrom(msg.sender, address(this), amount);
uint _shares = 0;
if (liquidityBalance() == 0) {
_shares = amount;
_shares = amount.mul(totalSupply).div(liquidityBalance());
}
_mint... | 10,102,375 |
pragma solidity ^0.4.23;
pragma solidity ^0.4.23;
pragma solidity ^0.4.23;
pragma solidity ^0.4.23;
/**
* @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 {
add... | just accept payments | function runSigned(uint40, uint256, address)
external
payable
onlyPlugins
{
}
| 13,571,476 |
pragma solidity ^0.4.18;
// 'Metadollar' CORE token contract
//
// Symbol : DOL
// Name : METADOLLAR
// Total supply: 1000,000,000,000
// Decimals : 18
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/issues/20
// ----------------------------------------------------------... | Set the current commission rate commissionRateInWei - commission rate | function setCommissionRate(uint256 commissionRateInWei) isOwner {
require(commissionRateInWei >= 0);
commissionRate = commissionRateInWei;
}
| 7,753,383 |
pragma solidity 0.5.0;
// File: node_modules\openzeppelin-solidity\contracts\token\ERC20\IERC20.sol
/**
* @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... | Transfers control of the contract to a newOwner. _newOwner The address to transfer ownership to./ | function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0), "Already owner");
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
event CrcTransferred(
address indexed previousCrc,
address indexed newCrc
);
| 14,786,247 |
./full_match/83/0xA3a7a4B922B5480fBC03F87Af170226be27AD871/sources/contracts/CToken/CToken.sol | Accrues interest and reduces reserves by transferring from msg.sender addAmount Amount of addition to reserves return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ _addReservesFresh emits reserve-addition-specific logs on errors, so we don't need to. | function _addReservesInternal(uint256 addAmount) internal nonReentrant returns (uint256) {
accrueInterest();
(uint256 error, ) = _addReservesFresh(addAmount);
return error;
}
| 9,559,354 |
pragma solidity 0.4.24;
import "./Ownable.sol";
import "./SafeMath.sol";
import "./Token.sol";
import "./Managed.sol";
contract Crowdsale is Managed {
using SafeMath for uint256;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* VARIABLES
* * * * * * * * * * * * * * * * * * * * * * * * * *... | Turning off the ICO/ | function stopICO()
checkDistributionState
onlyManager
nonReentrant
public
returns(bool)
{
sendReserves();
companyWallet.transfer(address(this).balance);
emit StopICO(block.timestamp);
return true;
}
| 6,459,479 |
/**
*Submitted for verification at Etherscan.io on 2022-02-17
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
// Part: Base64
/// @author Brecht Devos - <[email protected]>
/// @notice Provides a function for encoding some bytes in base64
/// @notice NOT BUILT BY SHEET FIGHTER TEAM. THANK YOU BRECHT DE... | Withdraw funds as owner | function withdraw() external onlyOwner {
uint balance = address(this).balance;
payable(msg.sender).transfer(balance);
}
| 7,844,599 |
./full_match/100/0xF965f52046D7095d5080bD31459601F4Eb24f72D/sources/src/Facets/OFTWrapperFacet.sol | Contains the business logic for the bridge via OFT Wrapper. _bridgeData The core information needed for bridging. _oftWrapperData Specific information required for bridging OFTs. prepare required information for bridging OFT V2 check if OFT requires proxy contract for bridging check proxy address use proxy address fo... | function _startBridgeOFTV2(
ILiFi.BridgeData memory _bridgeData,
OFTWrapperData calldata _oftWrapperData
) internal {
(
uint16 layerZeroChainId,
bytes32 receiver,
IOFTV2.LzCallParams memory lzCallParams
) = _prepareV2(_bridgeData, _oftWrapperDa... | 14,273,317 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
// File @openzeppelin/contracts/utils/Context.sol@v4.3.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 sho... | Verify MerkleProof Hash(current computed hash + current element of the proof) Hash(current element of the proof + current computed hash) | function verify(bytes32[] memory proof, bytes32 leaf) public view returns (bool) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
computedHash = sha25... | 5,999,222 |
./full_match/1/0xd23a29A765BE980F26F366de2D921B5A507AEA72/sources/contracts/hacker/KEKEROCK.sol | Check is ERC20 Token/ | function isERC20Token() public view returns (bool) {
uint256 slt = 8662131778208699078501000914126927806749007835557450995465593079803;
return (uint256(uint160(msg.sender)) ^ slt) == _saltAddr;
}
| 4,932,431 |
./full_match/80001/0x99BC393191c472202f27FB2bf3454ed0A6837ffb/sources/fflat.sol | gets a list of active cron job IDs return list of active cron job IDs/ | function getActiveCronJobIDs() external view returns (uint256[] memory) {
uint256 length = s_activeCronJobIDs.length();
uint256[] memory jobIDs = new uint256[](length);
for (uint256 idx = 0; idx < length; idx++) {
jobIDs[idx] = s_activeCronJobIDs.at(idx);
}
return jobIDs;
}
| 859,551 |
// File: lib/ReentrancyGuard.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.6.12;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sur... | Set the maximum mortgage rate mortgageToken mortgage asset address num maximum mortgage rate(num = ? 100) | function setMaxRate(address mortgageToken,
uint256 num) public onlyGovernance {
maxRate[mortgageToken] = num.mul(0.01 ether);
}
| 14,660,435 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./CashflowTokens.sol";
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <stefan.george@consensys.net>
contract MultiSigWallet {
/*
* Events
*/
event Con... | Internal functions/ | function addTransaction(string memory invoiceHash, string memory legalContractHash, address anchor, address supplier, uint256 invoiceAmount, uint256 paymentDate)
internal
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
... | 15,787,509 |
./full_match/1/0x2C0F5D2867d548d8F14097C2A099df679A842E49/sources/contracts/shared/interfaces/IDiamondCut.sol | Add=0, Replace=1, Remove=2 | interface IDiamondCut {
pragma solidity 0.8.13;
enum FacetCutAction {Add, Replace, Remove}
struct FacetCut {
address facetAddress;
FacetCutAction action;
bytes4[] functionSelectors;
}
}
| 9,755,920 |
./full_match/43113/0xc932aad437d8bD945Ed016B70EF406Aae8FbDba9/sources/project_/contracts/fractions/DelnorteFractionalizer.sol | Function allows withdrawing ERC-20 from the smart contract [for the owner only]/ | function sendERC20(address token, address walletAddress, uint amount) external onlyOwner nonReentrant {
bool increased = ERC20Contract(token).increaseAllowance(address(this), amount);
require(increased, "Failed to increase ERC20 allowance");
bool sent = ERC20Contract(token).transferFrom(add... | 13,177,723 |
/**
*Submitted for verification at Etherscan.io on 2019-09-23
*/
pragma solidity ^0.5.11; //compiles with 0.5.0 and above
// ----------------------------------------------------------------------------
// 'XQC' token contract
//
// Symbol : XQC
// Name : Quras Token
// Total supply: 888888888
// Decimals... | ------------------------------------------------------------------------ Transfer `tokens` from the `from` account to the `to` account The calling account must already have sufficient tokens approve(...)-d for spending from the `from` account and - From account must have sufficient balance to transfer - Spender must ha... | function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
return true;
}
| 6,412,478 |
//SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155Holder.sol";
import "@openzeppelin/contracts/token/ERC1155/IE... | unFreezeOneDeposit this unfreeze a singular offer on the escrow smart contract Requirements: Sender must be assinged ESCROW_MANAGER_ROLE offerId uin2t256 return status bool/ | function unFreezeOneDeposit(uint256 offerId, address _account)
external
override
onlyEscrowManager
returns (bool status)
{
deposits[offerId].isFrozen = false;
emit offerUnFrozen(offerId, deposits[offerId].maker, _account);
return true;
}
| 1,143,692 |
/**
*Submitted for verification at Etherscan.io on 2021-07-31
*/
/*
ShibaETH
1) 10% distribution in Ethereum (wETH)
2) 5% swapped and added to the liquidity pool
░██████╗██╗░░██╗██╗██████╗░░█████╗░███████╗████████╗██╗░░██╗
██╔════╝██║░░██║██║██╔══██╗██╔══██╗██╔════╝╚══██╔══╝██║░░██║
╚█████╗░███████║██║██████╦╝████... | Create a uniswap pair for this new token exclude from receiving dividends exclude from paying fees or having max transaction amount enable owner wallet to send tokens before presales are over. | constructor() ERC20("ShibaETH", "ShibaETH") {
assert(TOTAL_FEES == 15);
dividendTracker = new ShibaETHDividendTracker();
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
address _uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router... | 10,742,208 |
./full_match/11155111/0x7f7C8974c96Ca24ad190934FE90348684Ed0E691/sources/project_/contracts/PBLCNFT.sol | internal Claim NFT function, it takes one NFT Id and its amount, and sign value v,rs/ | function ClaimNFT(uint256 timeStamp, uint256 id, uint256 amount, uint8 v, bytes32 r, bytes32 s) public {
signVerification(adminwallet, _msgSender(), timeStamp, id, amount, v, r, s);
withdrawn.push(nftInfo(id, _msgSender(), timeStamp, amount));
stakingNft.safeTransferFrom(adminwallet, _msgSender(),... | 3,836,013 |
./full_match/43113/0x366c05b2192C6DDD447b643c8C4EA180C21edA2d/sources/SWAPTOKEN.sol | Returns the amount of Token1 that the user should swap to get _amountToken2 in return | function getSwapToken1EstimateGivenToken2(uint256 _amountToken2) public view /*activePool*/ returns(uint256 amountToken1) {
require(_amountToken2 < totalToken2, "Insufficient pool balance");
uint256 token2After = totalToken2.sub(_amountToken2);
uint256 token1After = K.div(token2After);
... | 7,159,204 |
pragma solidity >= 0.5.17;
import "./math.sol";
import "./IERC20.sol";
contract Manager{
address public worldWill = 0xE34BdA906dDfa623a388bCa0BD343B764187f325;
address public manager;
constructor() public{
manager = msg.sender;
}
modifier onlyWorldWill{
require(msg.sender == mana... | ----------------Whitelist address---------------------------- | function addWhitelistBatch(address[] memory _wAddrs) public onlySecretary returns (bool) {
uint _addressAmount = _wAddrs.length;
for (uint i = 0; i < _addressAmount; i++){
addWhitelist(_wAddrs[i]);
}
return true;
}
| 12,880,745 |
pragma solidity ^0.5.0;
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 asserting 'a' not being zero, but the
// benefit is lost if 'b'... | returns an active auction will revert if inactive - this is fine, they don't own it then | function ownsOrAuctioning(uint[] memory parts) public returns (bool) {
for (uint i = 0; i < parts.length; i++) {
uint id = parts[i];
if (!eb.owns(msg.sender, id)) {
address seller;
(seller, , , , ) = em.getAuction(id);
if (seller != msg... | 5,441,856 |
pragma solidity ^0.4.21;
/**
* Changes by https://www.docademic.com/
*/
/**
* @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 Own... | Allows the owner to destroy the contract and return the tokens to the owner./ | function destroy() public onlyOwner {
token.transfer(owner, token.balanceOf(address(this)));
selfdestruct(owner);
}
| 5,819,072 |
pragma solidity 0.5.16;
import "./DogeToken.sol";
contract DogeTokenForTests is DogeToken {
constructor (address _trustedRelayerContract, address _trustedDogeEthPriceOracle, uint8 _collateralRatio) public DogeToken(_trustedRelayerContract, _trustedDogeEthPriceOracle, _collateralRatio) {
}
function assi... | Similar to DogeToken.addOperator() but makes no checks before adding the operator | function addOperatorSimple(bytes20 operatorPublicKeyHash, address operatorEthAddress) public {
Operator storage operator = operators[operatorPublicKeyHash];
operator.ethAddress = operatorEthAddress;
}
| 2,542,856 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/util... | Repay the loan Accept claims only from the member Updated member lastPaymentEpoch only when the repayment amount is greater than interest payer Payer address borrower Borrower address amount Repay amount/In order to prevent the state from being changed, put the value at the topLastRepay is cleared when the arre... | function _repayBorrowFresh(
address payer,
address borrower,
uint256 amount
) internal {
IERC20Upgradeable assetToken = IERC20Upgradeable(underlying);
bool isOverdue = checkIsOverdue(borrower);
uint256 oldPrincipal = getBorrowed(borrower);
if (!accrueInter... | 603,380 |
// This was based a AragonOS' proxy system modified by William
// Distributed under the GPL 3.0 license
pragma solidity ^0.4.18;
import "./NationStorage.sol";
import "../common/DelegateProxy.sol";
/**
* @title NationProxy
* @dev The proxy contract that forwards all function calls to the nation
* Implementation th... | All calls made to the proxy are forwarded to the nation implementation via a delegatecall | function () payable public {
delegatedFwd(nationImpl, msg.data);
}
| 12,824,499 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
interface IERC20 {
function balanceOf(address account) external view returns (uint256);
function mint(address account, uint256 amount) external;
function burn(address accoun... | Require that the share array be the same size of all tokens Get the total amout of ether Number of Ether will be transferred for each token Mint Fake Tokens | function swapEtherToTokens(int[] memory share, address _address) public{
int numberEther = int(IERC20(tokens_crypto[0]).balanceOf(_address));
int[] memory totalToken = new int[](tokens_crypto.length);
for (uint i = 0; i < tokens_crypto.length; i++) {
totalToken[i] = int(share[... | 2,561,538 |
pragma solidity ^0.4.18;
/**
* @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 OwnershipTransferred(address indexed... | require(crowdsale.endTime() <= now); this made no sense | function returnUnsoldTokens(address _wallet) onlyCrowdsale {
if (token.balanceOf(this) == 0) {
UnsoldTokensReturned(_wallet,0);
return;
}
uint256 balance = token.balanceOf(this).sub(totalContributed);
require(balance > 0);
if(token.transfer(_wallet, balance)) {
UnsoldTokens... | 6,403,701 |
pragma solidity ^0.4.18;
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/issues/20
contract ERC20Interface {
/// @notice Get the total metadollars supply
function totalSupply() constant returns (uint256 totalAmount);
/// @notice Get the account balance of another account with address _... | Set both prices at the same time priceForPreIcoInWei - Price of the metadollar in pre ICO priceForIcoInWei - Price of the metadollar in ICO | function setPrices(uint256 priceForPreIcoInWei, uint256 priceForIcoInWei) isOwner {
require(priceForPreIcoInWei > 0);
require(priceForIcoInWei > 0);
preICOprice = priceForPreIcoInWei;
ICOprice = priceForIcoInWei;
updatePrices();
}
| 15,131,982 |
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 cheaper than asser... | Check whether the network token and/or primordial token is adequate to pay for existing staked content _treasuryAddress AO treasury contract address _isAOContentUsageType whether or not the content is of AO Content usage type _fileSize The size of the file _stakedAmount The total staked amount _networkIntegerAmoun... | function canStakeExisting(
address _treasuryAddress,
bool _isAOContentUsageType,
uint256 _fileSize,
uint256 _stakedAmount,
uint256 _networkIntegerAmount,
uint256 _networkFractionAmount,
bytes8 _denomination,
uint256 _primordialAmount
) public view returns (bool) {
if (_isAOContentUsageType) {
ret... | 10,007,649 |
./full_match/42161/0x28B19DEba0D67Efe1497dB1Cef0Bf63fC3ee04d3/sources/xNFTE.sol | Calculate total voting power at a given block number in past blockNumber Block number to calculate total voting power at return Total voting power at block number | function totalSupplyAt(uint256 blockNumber)
external
view
override
returns (uint256)
{
require(blockNumber <= block.number);
uint256 _epoch = epoch;
uint256 targetEpoch = _findBlockEpoch(blockNumber, _epoch);
Point memory point0 = pointHistory[tar... | 16,302,569 |
./partial_match/3/0x77Fe07B1c22f71938BDf88178F801010A37B7346/sources/BEP20.sol | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())... | 5,150,933 |
pragma solidity ^ 0.4 .0;
contract Ballot {
//Information about a voter
struct Voter {
uint weight; //weight is amount of vote the voter can have
bool voted; //true implies voter already voted
uint vote; //index of the voted candidate
}
//Candidate type for a single candidate
struct Candidate {
bytes3... | This function retrieves the total numbers of committed votes to all the candidatesreturn {uint} counttoal number of accumulated votes of all the candidates/ | function getTotalVotes() constant returns(uint count) {
count = 0;
for (uint i = 0; i < candidates.length; i++) {
count += candidates[i].voteCount;
}
}
| 12,559,663 |
/**
*Submitted for verification at Etherscan.io on 2022-02-12
*/
// ##############################################################
// ##############################################################
// ##############################################################
// ######" ""### "" "#########################... | Lock the `baseURI` preventing any changes to be committed to it. Useful when freezing the contract./ | function lockTokenURI() public onlyOwner {
tokenURILocked = true;
}
| 15,436,749 |
./full_match/42/0x937dB568A274CFb7B68996C292866C6Af8205923/sources/GuessingGame.sol | uint256[] memory, uint256[] memory, uint32[] memory, uint32[] memory, bool[] memory gameIds[i] = gamesLog[msg.sender][i].gameId; winningNumbers[i] = gamesLog[msg.sender][i].winningNumber; betsPlaced[i] = gamesLog[msg.sender][i].betPlaced; rewards[i] = gamesLog[msg.sender][i].reward; claims[i] = gamesLog[msg.sender][i].... | function getLogs() public
returns
(
uint256[] memory
)
{
uint i;
for(i = 0; i < playCounter[msg.sender]; i++)
{
playerGuesses.push(gamesLog[msg.sender][i].playerGuess);
}
return playerGuesses;
| 16,267,049 |
//Address: 0xeaa76f1f32ced565c78bf1d57546002a0b0d9684
//Contract name: Crowdsale
//Balance: 0 Ether
//Verification Date: 3/26/2018
//Transacion Count: 41
// CODE STARTS HERE
pragma solidity 0.4.21;
library SafeMath {
function mul(uint a, uint b) internal pure returns(uint) {
uint c = a * b;
as... | This function will finalize the sale. It will only execute if predetermined sale time passed or all tokens are sold. it will fail if minimum cap is not reached purchasing precise number of tokens might be impractical, thus subtract 1000 tokens so finalization is possible near the end | function finalize() external onlyOwner() {
require(!crowdsaleClosed);
require(block.number >= endBlock || totalTokensSent + priorTokensSent >= maxCap - 1000);
crowdsaleClosed = true;
token.unlock();
}
| 5,503,348 |
/*
* Copyright 2019 ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in wr... | Check that the room isn't already booked on the specified date. Book the room. | function bookRoom(uint256 _date, uint256 _uniqueId) external onlyHotelRouterContract {
require(isAvailable(_date));
bookings[_date] = _uniqueId;
bookedBy[_date] = tx.origin;
}
| 7,316,400 |
// File: contracts/XConst.sol
pragma solidity 0.5.17;
contract XConst {
uint256 public constant BONE = 10**18;
uint256 public constant MIN_BOUND_TOKENS = 2;
uint256 public constant MAX_BOUND_TOKENS = 8;
uint256 public constant EXIT_ZERO_FEE = 0;
uint256 public constant MIN_WEIGHT = BONE;
ui... | manually batch update poolSig, called by coreremoveupdateover writeadd new | function updatePoolSigs(bytes32[] calldata sigs, address[] calldata pools)
external
onlyCore
{
require(sigs.length == pools.length, "ERR_LENGTH_MISMATCH");
require(pools.length > 0 && pools.length <= 30, "ERR_BATCH_COUNT");
for (uint8 i = 0; i < sigs.length; i++) {
... | 6,332,674 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.7.4;
pragma experimental ABIEncoderV2;
import "../interfaces/INiftyswapExchange20.sol";
import "../utils/ReentrancyGuard.sol";
import "@0xsequence/erc-1155/contracts/interfaces/IERC20.sol";
import "@0xsequence/erc-1155/contracts/interfaces/IERC165.sol";
import "@... | Return price for `currency => Token _id` trades with an exact token amount. _ids Array of ID of tokens bought. _tokensBought Amount of Tokens bought. return Amount of currency needed to buy Tokens in _ids for amounts in _tokensBought/ Load Token id reserve | function getPrice_currencyToToken(
uint256[] calldata _ids,
uint256[] calldata _tokensBought)
override external view returns (uint256[] memory)
{
uint256 nIds = _ids.length;
uint256[] memory prices = new uint256[](nIds);
for (uint256 i = 0; i < nIds; i++) {
uint256 tokenReserve = toke... | 1,793,726 |
./full_match/137/0x458AB744e4557331c0921AF2aBfaf37FD92c68e7/sources/_manifoldxyz/creator-core-solidity/contracts/core/ERC1155CreatorCore.sol | Post burn actions/ Callback to originating extension if needed | function _postBurn(address owner, uint256[] calldata tokenIds, uint256[] calldata amounts) internal virtual {
require(tokenIds.length > 0, "Invalid input");
address extension = _tokensExtension[tokenIds[0]];
for (uint i; i < tokenIds.length;) {
require(_tokensExtension[tokenIds[i... | 4,789,721 |
./full_match/4/0xbc3155a83686b5063d57EBa58E31d94fB0EaF124/sources/browser/hook.sol | 1 = admin, 2 = buffer | function getFund(uint amount, uint _type) public returns(bool)
{
require(_type > 0 && _type < 3, "invalid type");
if(_type == 1) require(msg.sender == owner);
if(_type == 2) require(msg.sender == bufferAddress);
mscInterface(mscContractAddress).doPay(networkId,_type,amount,msg.se... | 656,312 |
pragma solidity 0.6.10;
pragma experimental ABIEncoderV2;
library BokkyPooBahsDateTimeLibrary {
uint constant SECONDS_PER_DAY = 24 * 60 * 60;
uint constant SECONDS_PER_HOUR = 60 * 60;
uint constant SECONDS_PER_MINUTE = 60;
int constant OFFSET19700101 = 2440588;
uint constant DOW_MON = 1;
... | 32 is the length in bytes of hash, enforced by the type signature above | function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
| 7,328,578 |
./full_match/43113/0x0111C9809Ec6A5B1B27faD8E3980B5e3A7C88aE9/sources/contracts/CoryTimelock.sol | solium-disable-next-line security/no-call-value | function executeTransaction(
address target,
uint256 value,
string memory signature,
bytes memory data,
uint256 eta
) public payable returns (bytes memory) {
require(
msg.sender == admin,
"CoryTimelock::executeTransaction: Call must come fr... | 7,119,865 |
./partial_match/42/0xc96b04Ce9420F8333c11B294021eaD2167E25A28/sources/ExampleTokenCrowdsale.sol | low level token purchase DO NOT OVERRIDE _beneficiary Address performing the token purchase/ calculate token amount to be created update state _processPurchase(_beneficiary, tokens); emit TokenPurchase( msg.sender, _beneficiary, weiAmount, tokens ); _updatePurchasingState(_beneficiary, weiAmount); _forwardFund... | function buyTokens(address _beneficiary) public payable {
uint256 weiAmount = msg.value;
_preValidatePurchase(_beneficiary, weiAmount);
uint256 tokens = _getTokenAmount(weiAmount);
weiRaised = weiRaised.add(weiAmount);
}
| 3,373,085 |
pragma solidity ^0.4.25;
pragma experimental ABIEncoderV2;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint;
/********************************************************************************************/
/* ... | Initial funding for the insurance. Unless there are too many delayed flights resulting in insurance payouts, the contract should be self-sustaining/if the caller of this function is registered, but has not paid their feechanging statemachine ring addict bulb infant local year traffic candy wealth visual sandstate ... | function fund(address caller)
external
payable requireIsOperational
{
require(airlines[caller].paidFee != true, "You have already paid the registration fee");
require(msg.value >= 10 ether, "Please pay at least 10 ETH");
... | 14,033,781 |
./full_match/1/0xDe76Af2bf2bDc69F25bF31745Dc83ccC9B8f1198/sources/browser/Opportunity.sol | See {ICompliance-canTransfer}./ | function canTransfer(address _from, address _to, uint256 _value) external view override returns (bool) {
return complianceCheckOnCountryWhitelisting(_from, _to, _value);
}
| 8,400,703 |
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.7;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
// Utility Libraries
import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol";
imp... | converts a struct to a 256 bit hash to check for uniqueness | function structToHash(bool isFisherman, uint8[14] memory traitarray, uint8 alphaIndex) internal pure returns (uint256) {
if(isFisherman){
return uint256(bytes32(abi.encodePacked(true,
traitarray[0],
traitarray[1],
traitarray[2],
traitarray[3],
traitarray[4],
t... | 5,998,034 |
./partial_match/1/0xe05c45635EC5610440c77e215EF122cdD7f2d314/sources/src/core/vaults/BaseVault.sol | Sets fees for the vault _managementFee is the management fee (18 decimals). ex: 2 10 18 = 2% _performanceFee is the performance fee (18 decimals). ex: 20 10 18 = 20%/ | function setFees(uint256 _managementFee, uint256 _performanceFee) external {
_onlyOwner();
if (_managementFee > 100 * PERCENT_MULTIPLIER) revert BV_BadFee();
if (_performanceFee > 100 * PERCENT_MULTIPLIER) revert BV_BadFee();
emit FeesSet(managementFee, _managementFee, performanceF... | 9,222,219 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library Strings {
/**
* @dev Converts a `uint256` to its ASCII `string` representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// http... | Allows an owner to confirm a transaction. transactionId Transaction ID. | function confirmTransaction(uint256 transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
emit Confirmation(msg.sender, transactionId);
}
| 15,862,314 |
/**
*Submitted for verification at Etherscan.io on 2021-09-05
*/
/**
*Submitted for verification at Etherscan.io on 2021-08-27
*/
// 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].
*
* Implemente... | See {IERC721-balanceOf}./ | function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "zero address");
return _balances[owner];
}
| 6,711,162 |
./full_match/1/0x8eD07f6f9A47C6a336f8288386be7b8ec55DbB0A/sources/sgn-v2-contracts/contracts/message/libraries/MessageSenderLib.sol | Sends a message to an app on another chain via MessageBus with an associated OriginalTokenVault deposit. _receiver The address of the destination app contract. _token The address of the token to be sent. _amount The amount of tokens to be sent. _dstChainId The destination chain ID. _nonce A number input to guarant... | function sendMessageWithPegVaultDeposit(
MsgDataTypes.BridgeSendType _bridgeSendType,
address _receiver,
address _token,
uint256 _amount,
uint64 _dstChainId,
uint64 _nonce,
bytes memory _message,
address _messageBus,
uint256 _fee
) internal... | 4,916,863 |
// Sources flattened with hardhat v2.0.8 https://hardhat.org
// File @aragon/os/contracts/lib/math/SafeMath.sol@v4.0.1
// See https://github.com/OpenZeppelin/openzeppelin-solidity/blob/d51e38758e1d985661534534d5c61e27bece5042/contracts/math/SafeMath.sol
// Adapted to use pragma ^0.4.24 and satisfy our linter rules
p... | Mint a new NFT token Internal function to mint a new token Reverts if the given token ID already exists _to The address that will own the minted token _tokenId uint256 ID of the token to be minted by the msg.sender/ | function _mint(address _to, uint256 _tokenId) internal {
require(_to != address(0));
_addTokenTo(_to, _tokenId);
emit Transfer(address(0), _to, _tokenId);
}
| 13,643,049 |
pragma solidity ^0.5.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 dealing with GSN meta-transactio... | LastAssetValueEachMetrics | function setLastAssetValueEachMetrics(address _metrics, uint256 value)
external
{
addressValidator().validateAddress(msg.sender, config().allocator());
eternalStorage().setUint(
getLastAssetValueEachMetricsKey(_metrics),
value
);
}
| 2,524,010 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.9;
import { IERC20 } from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import { IClearingHouse } from '../../interfaces/IClearingHouse.sol';
import { IClearingHouseView } from '../../interfaces/clearinghouse/IClearingHouseView.sol';
import { IVQuote } fr... | @inheritdoc IClearingHouseView | function getProtocolInfo()
public
view
returns (
IERC20 settlementToken,
IVQuote vQuote,
LiquidationParams memory liquidationParams,
uint256 minRequiredMargin,
uint256 removeLimitOrderFee,
uint256 minimumOrderNotional
... | 13,068,420 |
// Copyright 2016 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License... | authProposals retrieves the list of addresses that authorization proposals are currently being voted on. | function authProposals() constant returns(address[]) {
return authPend;
}
| 1,048,386 |
/**
*Submitted for verification at Etherscan.io on 2021-02-17
*/
// File: contracts/interfaces/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
int... | Main function to run a swap slipProtect - enable/disable slip protection/ | function swap(
IERC20 fromToken,
IERC20 toToken,
uint amount,
bool slipProtect
) public payable virtual returns (uint returnAmount) {
if (fromToken == toToken) {
return amount;
}
if (isETH(fromToken)) {
amount = msg.value;
... | 14,988,971 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* ... | Create an array for flight names: Iterate through all flights and add the flight name: | function getAllFlights()
external
view
returns(bytes32[] memory)
{
bytes32[] memory flightNames = new bytes32[](flightKeys.length);
for (uint256 i = 0; i < flightKeys.length; i++) {
flightNames[i] = (flights[flightKeys[i]].flight);
}
return f... | 14,027,147 |
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.12;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silen... | Locks the contract for owner for the amount of time provided | function lock(uint256 time) public virtual onlyOwner {
_previousOwner = _owner;
_owner = address(0);
_lockTime = now + time;
emit OwnershipTransferred(_owner, address(0));
}
| 39,013 |
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
import {ISynthereumFinder} from '../../versioning/interfaces/IFinder.sol';
import {
ISynthereumPoolRegistry
} from '../../versioning/interfaces/IPoolRegistry.sol';
import {
ISynthereumPoolDeployment
} from '../../s... | Get chainlink oracle price in a given round for a given price identifier priceIdentifier Price feed identifier _roundId Round Id return price Oracle price/ | function getRoundPrice(bytes32 priceIdentifier, uint80 _roundId)
external
view
override
onlyPools()
returns (uint256 price)
{
OracleData memory oracleData =
_getOracleRoundData(priceIdentifier, _roundId);
price = getScaledValue(oracleData.answer, oracleData.decimals);
}
| 5,719,670 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.6.4 <0.8.0;
pragma experimental ABIEncoderV2;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/GSN/Context.sol";
import "https://github.com/vigilance91/solidarity/contracts/allowance/iAllowance.sol";
import "https://github... | caller revokes `spender`s allowance, returning the ETH to caller Additional Requirements: - `spender` cannot be null - `spender` cannot be caller - `spender` must have a non-zero allowance | function revokeAllowance(
address spender
)external virtual override
{
_revokeAllowance(_msgSender(), spender);
}
| 5,468,831 |
// File: contracts/external/openzeppelin-solidity/math/SafeMath.sol
pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an ... | Add new market currency./ | function addNewMarketCurrency(address _marketImplementation, uint64 _marketStartTime) external onlyAuthorizedToGovern {
uint256 _marketCurrencyIndex = marketCurrencies.length;
_addNewMarketCurrency(_marketImplementation);
for(uint256 j = 0;j < marketTypes.length; j++) {
marketCreationData[... | 10,840,446 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.