file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
//SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@chainlink/contracts/src/v0.8/interfaces/FeedRegistryInterface.sol";
import "@chainlink/contracts/src/v0.8/Denominations.sol";
i... | Unpauses a stream if caller is either the payer or a delegate of PAUSABLE_ROLE/ | function unpauseStream() external override onlyPayerOrDelegated {
paused = false;
emit StreamUnpaused();
}
| 1,315,607 |
pragma solidity ^0.5.0;
import "./Adminable.sol";
import "./SafeMath.sol";
/** @title Online Marketplace. */
contract MarketPlace is Adminable {
using SafeMath for uint256;
struct Product {
string name;
uint price;
uint quantity;
uint sales;
bool isOpen;
mapping(address => uint) shoppers;
... | Shopper can purches a product. _owner the address of store owner. _front the unique name of storefront. _product the unique name of product. _amount purches amount of product./ | function buyProduct(address _owner, string memory _front, string memory _product, uint _amount) public payable stopInEmergency {
require(isStore[_owner], "the store doesn't exist.");
Store storage s = stores[_owner];
require(s.isFront[_front], "the front doesn't exist.");
Front storage f = s.f... | 5,412,303 |
pragma solidity ^0.5.0;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is che... | Integer division of two numbers truncating the quotient, reverts on division by zero./ assert(a == b c + a % b); There is no case in which this doesn't hold | function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
| 1,377,532 |
pragma solidity ^0.5.2;
import "./CereneumData.sol";
contract CereneumImplementation is CereneumData
{
using SafeMath for uint256;
//Events
event ClaimEvent(
uint256 nOriginalClaimAmount,
uint256 nAmountGranted,
uint256 nBonuses,
uint256 nPenalties,
bool bWasReferred
... | Appends an Ethereum address onto the expected string for a Bitcoin signed message a_address Ethereum address a_nWhichChain Which blockchain is claiming, 0=BTC, 1=BCH, 2=BSV, 3=ETH, 4=LTC return Correctly formatted message for bitcoin signingOne of the bitcoin chains | function GenerateSignatureMessage(
address a_address,
BlockchainType a_nWhichChain
) public pure returns(bytes memory)
{
bytes16 hexDigits = "0123456789abcdef";
bytes memory prefix;
uint8 nPrefixLength = 0;
if(a_nWhichChain >= BlockchainType.Bitcoin && a_nWhichChain <= Blo... | 5,400,059 |
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... | set the maximum fees in wei _newMax new max/ | function setMaxCollectable(uint256 _newMaxFees)
external
onlyOwner
{
maxFees = _newMaxFees;
UpdateMaxFees(maxFees);
}
| 6,189,717 |
./partial_match/1/0xA60E18145BED6BA4a269fA5b445695B37101947f/sources/contracts/OnChainPoll.sol | Retrieves the poll detail. id Poll id to fetch the poll details. return PollDetail The poll detail./ | function getPollDetail(
uint256 id
) external view override returns (PollDetails memory) {
return
PollDetails({
createPollDetails: createPollsDetail[id],
endPollDetails: endPollsDetail[id]
});
}
| 9,154,003 |
./full_match/43113/0x28F5c190AE9F6E2C08b5C3ebd26b9d8da0E16c92/sources/Certifications.sol | returns the certification subscribed by the `memberAddress`./ | function getMemberSubscriptions(address memberAddress) public view returns (uint256[] memory) {
return m_memberSubscriptions[memberAddress];
}
| 13,209,223 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
contract Factory{
mapping ( address => address ) private children; //from user to contract
address private cloud;
modifier OnlyCloud {require (msg.sender == cloud, "OnlyCloud"); _;}
modifier Exists (address user)... | check if there is an operation after last uploadget index of last uploaded state and last deleted state if present | function OperationAfterUpload(bytes32 ID, State operation) internal view returns(bool){
uint uploadedTime;
uint operationTime;
bool uploadedFound = false;
bool operationFound = false;
for (uint j = files[ID].states.length; j > 0; j--) {
if(!operationFound && files... | 1,036,035 |
./full_match/1/0xe5094556EDDCBdABFFEdFc2f7122e2b1702A6D4e/sources/ERC20.sol | Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens./ Overflow not possible: amount <= accountBalance <= totalSupply. | function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amo... | 4,868,281 |
./full_match/1/0x5082C1EA537CD035c76F3BFb3f8e459794b3331D/sources/Sinja.sol | generate the uniswap pair path of token -> weth make the swap | function swapTokensForEth(uint256 swapAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), swapAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnT... | 16,513,073 |
./partial_match/42/0xF80Ac056c5D499d0D7efFBFe5E3f0BF6b152c486/sources/Affinity.sol | This function hands over ownership of the token, as well as the bpt tokens to the specified address. It also sets the balanced variable to whichever the old contract was. This prevents it from being recalled when the contract was upgraded. This function is particularly useful when it comes to upgrading the contract. Th... | function handOverContract(address newOwner) public onlyOwner {
sendBPT(newOwner, bpt.balanceOf(address(this)));
erc20.handOverContract(newOwner);
}
| 8,975,532 |
./full_match/1/0xe05447ae2426c4bEb7733c90058C00cC32ABfe49/sources/src/Kong/Treasury.sol | Redeem TOKEN for backing _amount Amount of TOKEN to redeem | function redeem(uint256 _amount) external {
ITOKEN(TOKEN).burnFrom(msg.sender, _amount);
IERC20(uniswapV2Router.WETH()).transfer(msg.sender, (_amount * BACKING) / 1e9);
}
| 8,304,416 |
pragma solidity ^0.4.19;
/**
* Authored by https://www.coinfabrik.com/
*/
pragma solidity ^0.4.19;
/**
* Originally from https://github.com/TokenMarketNet/ico
* Modified by https://www.coinfabrik.com/
*/
pragma solidity ^0.4.19;
/**
* Envisioned in FirstBlood ICO contract.
* Originally from https://github.c... | Investing function that recognizes the receiver. customerId UUIDv4 that identifies this contributor/ | function buyOnBehalfWithCustomerId(address receiver, uint128 customerId) public payable validCustomerId(customerId) unsignedBuyAllowed {
investInternal(receiver, customerId);
}
| 7,800,431 |
./full_match/4/0xa0c032e28e06f772845B4E753aE115395c848E68/sources/contracts/ERC721Lending.sol | assuming token transfer is approved get balance that is not streamed during period, it will be returned to borrower check if lending has fees lending did not go through full period, fees percent will be lower, lets refund to lender check if fees collecting address set and lending has fees | function stopBorrowing(address tokenAddress, uint256 tokenId) public {
address _borrower = lentERC721List[tokenAddress][tokenId].borrower;
require(_borrower == msg.sender, 'Borrowing: Can be stopped only by active borrower');
if (lentERC721List[tokenAddress][tokenId].lenderClaimedNFT == false) {
IE... | 12,435,049 |
./full_match/4/0x08F83aB11F63336ad7647706705b643fD9d575BA/sources/contracts/EthProject.sol | Update Project Status based on the Project Goal and Project Expiry Date/ | function _updateProjectStatus() private {
if(projectBalance >= projectGoal){
projectStatus = ProjectStatus.Successful;
emit ProjectSuccess(projectCreator, projectBalance);
projectStatus = ProjectStatus.Expired;
emit ProjectExpired(projectCreator, projectBalanc... | 12,319,514 |
/*
Copyright 2021 Dolomite.
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... | Returns true if the value is in the set. O(1)./ | function contains(Set storage set, uint256 value) internal view returns (bool) {
return set._valueToIndexMap[value] != 0;
}
| 2,513,303 |
// 1.컴파일 버전에 대한 명시
// 0.4.22을 기반으로 작성되었고, 0.6.0까지 정상 작동함을 보장한다.
// pragma solidity >=0.4.22 <0.6.0;
pragma solidity ^0.5.7;
// 2.import
// 3. contract section
// 3-1. type
contract BasicType {
function numTest() public pure returns(int, int8, uint, bool) {
// 기본문장의 끝에는 ;를 반들시 붙인다
int a = 10;
... | 지역변수 → storage define 지역변수에서 배열생성시 사이즈를 부여하여 값넣고 초기화 new를 통해서 사이즈 넣고 생성 error uint8[] memory arr3 = [1,2,3]; 포인터가 대입되었다 storage → memory에 대입하는 케이스 | function arrTest1() public view returns (uint256, uint256[] memory) {
uint8[2] memory arr4;
uint8[3] memory arr1 = [1,2,3];
uint8[] memory arr2 = new uint8[](arr1.length);
uint256[] memory arr5 = myArr3;
return (arr5[0], arr5);
}
| 12,557,027 |
// SPDX-License-Identifier: GPL-3.0
/*
This file is part of the Enzyme Protocol.
(c) Enzyme Council <[email protected]>
For the full license information, please view the LICENSE
file that was distributed with this source code.
*/
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/E... | Get a list of enabled policies for a given fund _comptrollerProxy The ComptrollerProxy of the fund return enabledPolicies_ An array of enabled policy addresses | function getEnabledPoliciesForFund(address _comptrollerProxy)
public
view
returns (address[] memory enabledPolicies_)
{
enabledPolicies_ = new address[](comptrollerProxyToPolicies[_comptrollerProxy].length());
for (uint256 i; i < enabledPolicies_.length; i++) {
... | 1,696,706 |
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 public owne... | Vote for a proposal, if the voter already voted, cancel the last vote and set a new one instead _proposalId id of the proposal _voter used in case the vote is cast for someone else _vote a value between 0 to and the proposal's number of choices. return true in case of proposal execution otherwise false throws if pro... | function internalVote(bytes32 _proposalId, address _voter, uint _vote, uint _rep) private returns(bool) {
Proposal storage proposal = proposals[_proposalId];
Parameters memory params = parameters[proposal.paramsHash];
require(_vote <= proposal.numOfChoices);
uint reputation = params.... | 11,880,274 |
./full_match/43114/0xb17A67F28645FAC19856f4F36A5985e91ecB8Ec9/sources/contracts/Strategies.sol | OWNER-ONlY FUNCTIONS | function deposit(address caller, address to, uint256 tokenAmount, uint256 shareAmount) external override onlyOwner {
_claimRewards();
_harvest(caller, to);
if (tokenAmount > 0) {
joeMasterChefV2.deposit(joePid, tokenAmount);
}
if (shareAmount > 0) {
ig... | 4,518,073 |
pragma solidity ^0.4.23;
// File: node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint25... | Executed when a purchase has been validated and is ready to be executed. Not necessarily emits/sends tokens. It computes the bonus. _beneficiary Address receiving the tokens _tokenAmount Number of tokens to be purchased/ | function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal {
uint256 totalAmount = _tokenAmount;
uint256 bonusPercent = phaseCrowdsale.getCurrentBonusPercentage();
if (bonusPercent > 0) {
totalAmount = totalAmount.add(bonusAmount);
}
uint256 phaseNumber = phaseCrowdsale.... | 14,096,993 |
./full_match/5/0xa488161a4F64cC9bEC991de87d722e5Dc340174A/sources/contracts/DPS.sol | change the merkle root for the whitelist phase | function setMerkleRoot(bytes32 _merkleRoot) external onlyOwner {
merkleRoot = _merkleRoot;
}
| 1,854,221 |
./partial_match/1/0x409bf77A8E3Fe384497227eA508029B5364933DE/sources/contracts/staking/TokenStaking.sol | Sets cached legacy stake amount to 0, sets the liquid T stake amount to 0 and withdraws all liquid T from the stake to the owner. Reverts if there is at least one non-zero authorization. Can be called only by the delegation owner or the staking provider. Can only be called when 24h passe... | function unstakeAll(address stakingProvider)
external
override
onlyOwnerOrStakingProvider(stakingProvider)
{
StakingProviderInfo storage stakingProviderStruct = stakingProviders[
stakingProvider
];
require(
stakingProviderStruct.authorizedA... | 2,586,917 |
./full_match/43113/0x72d62b0f3a0CEAdcD771b90537151774BD746FEA/sources/apps/avai/src/contracts/OrcaStaking.sol | Withdraw tokens from Staking, claiming rewards. pid pool id amount number of tokens to withdraw/ | function withdraw(uint256 pid, uint256 amount) external nonReentrant {
require(amount > 0, 'Staking::withdraw: amount must be > 0');
PoolInfo storage pool = poolInfo[pid];
UserInfo storage user = userInfo[pid][msg.sender];
_withdraw(pid, amount, pool, user);
}
| 13,153,946 |
./full_match/4/0x9Fa3D6EE31268Cd815BB9bA35E85eD5e18CA7e65/sources/browser/Untitled2.sol | Destroy tokens Remove `_value` tokens from the system irreversibly _value the amount of money to burn/checking of enough token balance is done by SafeMathalthogh we can track all the "burn" from the Transfer function, we just kept it as it is. As that is no much harm | function burn(uint256 _value) public returns (bool success) {
require(!globalHalt, "paused by admin");
burnTracker = burnTracker.add(_value);
emit Transfer(msg.sender, address(0), _value);
emit Burn(msg.sender, _value);
return true;
}
| 778,371 |
pragma solidity ^0.4.25;
// It's important to avoid vulnerabilities due to numeric overflow bugs
// OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs
// More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-insecurity-bad-arithmetic/
impo... | Generate a request for oracles to fetch flight information Generate a unique key for storing the request | function fetchFlightStatus
(
address airline,
uint32 flight,
uint32 timestamp
)
public
{
uint8 index = getRandomIndex();... | 6,371,108 |
pragma solidity 0.4.16;
// implement safemath as a library
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
require(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
... | Used to burn tokens and decrease total supply _amount The amount of VZT tokens in wei to burn | function tokenBurner(uint256 _amount)
onlyOwner
returns (bool burned)
{
require(_amount > 0);
require(totalSupply.sub(_amount) > 0);
require(balances[msg.sender] > _amount);
require(balances[msg.sender].sub(_amount) > 0);
totalSupply = totalSupply.sub(_amo... | 1,810,800 |
./partial_match/1/0xcDdc0F6053432dE3dd0F8dB3786D696fffC3A860/sources/OriginEthStrategy.sol | depositng base token from bank to this smart-contract baseAmount - amount that depositing to strategy isSafeTransfer - turn on safe transfer/ | function depositFromBank(uint256 baseAmount, bool isSafeTransfer) public onlyOperator{
uint256 allowance = IERC20(baseToken).allowance(bank, address(this));
require(allowance >= baseAmount, "depositFromBank: allowance less than baseAmount");
require(IERC20(baseToken).balanceOf(bank) >= baseA... | 15,778,599 |
./partial_match/5/0x9e0861844F40B48207e6c5D384D53Dfe27f4a8EC/sources/DeporRPOSValidatorData.sol | start runningmodfiy status | function creatorStartRunningValidator(address _creator, uint256 vID)
external
whenNotPaused
onlyWhitelistAdmin
{
Validator storage validator = idToValidators[vID];
validator.status = 2;
validator.lastEpochBlockNumber = block.number;
validator.lastEpochTime... | 16,833,347 |
./partial_match/1/0x17b1FF602d824eefFcdF6546FCb87A5C6BC69aDD/sources/RaiseFactory.sol | Investor can subscribe to the capital raise with the unique subscription hash. _subID Subscription unique identifier _shares Amount of shares to purchase./ | function subscribe(bytes32 _subID, uint256 _shares)
public
whenNotPaused
onlyInvestor
onlyAtStage(Stage.Created)
onlyWhileOpen
{
require(_shares <= getAvailableShares(), 'Raise: above available');
uint256 cost = _shares.mul(price);
require(cost >... | 2,859,472 |
./full_match/137/0xe8D2cb841a187C300641b306e5a85c9Fc06A781f/sources/contracts/Wallet.sol | / HELPERS / | function _removeIndex(uint _indexIdentifier) private {
require(
userIndexes[_indexIdentifier].Exists == true,
"CLAMP-V1: NO-INDEX-EXISTS"
);
delete userIndexes[_indexIdentifier];
}
| 4,797,048 |
pragma solidity ^0.5.16;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Initial funding for the insurance. Unless there are too many delayed flights resulting in insurance payouts, the contract should be self-sustaining/ | function fund(address airlineAddress)
public
payable
requireIsOperational
requireIsAirlineExisting(airlineAddress)
requireIsAirlineRegistered(airlineAddress)
{
airlineMapping[airlineAddress].isFunded = true;
fundedAirlinesCount = fundedAirlinesCount.add(1)... | 7,237,503 |
./full_match/3/0xcAb9D8f8c505dB3EA86DBcF97BfF03BA59b001F3/sources/workspace_1625825398961/SRSC.sol | Sewer Rats reserved for promotions and Dev Team/ | function reserveRats() public onlyOwner {
uint supply = totalSupply();
uint i;
for (i = 0; i < 30; i++) {
_safeMint(msg.sender, supply + i);
}
}
| 14,134,771 |
./partial_match/3/0xbD1c9AdF6AA78eB5092c73a55d72113e9DEDC0DE/sources/Invitation.sol | 配置基金、预言机、空投、预言机回调、TSR合约地址 | function setAddr(address _fundAddr, address _aggregateAddr, address _airdropAddr, address _oracleCallbackAddr, address __tokenContractAddr) public onlyOwner {
fundAddr = _fundAddr;
aggregate = AggregateApiI(_aggregateAddr);
airdropAddr = _airdropAddr;
oracleCallbackAddr = _oracleCall... | 5,060,965 |
// File: browser/flattened.sol
// File: browser/DateTime.sol
pragma solidity >=0.4.21 <0.6.0;
contract DateTime {
/*
* Date and Time utilities for ethereum contracts
*
*/
struct _DateTime {
uint16 year;
uint8 month;
uint8 da... | calculates the day , month , year using the timestamp time , timestamp whose day,month,year is to be calculated/ | function getDateTime (uint256 time) internal pure returns(uint256,uint256,uint256)
{
uint256 year = getYear(time);
uint256 month = getMonth(time);
uint256 day = getDay(time);
return (year, month, day );
}
| 12,839,775 |
./partial_match/3/0x07262132632B7B965f22752cfC196427415e663e/sources/Dice.sol | Change Game Fee Percent/ Update Game Fee Percent Update Winner Fee Percent | function changeGameFeePercent(uint256 gameFeePercent)
external
onlyGovernance
{
_gameFeePercent = gameFeePercent;
_winnerPercent = (uint256)(10000).sub(_gameFeePercent);
emit ChangeGameFeePercent(governance(), gameFeePercent);
emit ChangeWinnerPercent(governance... | 5,260,641 |
./full_match/1/0xb40B94Cd4A9094DF607099fF8216Adb792733362/sources/contracts/AutomatedFunctionsConsumer.sol | Called by Automation to trigger a Functions request The function's argument is unused in this example, but there is an option to have Automation pass custom data returned by checkUpkeep (See Chainlink Automation documentation)/ | function performUpkeep(bytes calldata) external override {
(bool upkeepNeeded, ) = checkUpkeep("");
require(upkeepNeeded, "Time interval not met");
s_lastUpkeepTimeStamp = block.timestamp;
_sendRequest(s_requestCBOR, s_subscriptionId, s_fulfillGasLimit, donId);
}
| 17,068,605 |
./full_match/1/0xE2e3C6f8163a077cba241adc06dcE5828EF9cd8a/sources/DefiVeth.sol | 1. User Accounting Redeem from most recent stake and go backwards in time. fully redeem a past stake partially redeem a past stake | function _withdraw(uint256 amount, bool unwrapFlag) internal {
updateAccounting();
require(amount > 0, 'ERR: unstake amount is zero');
require(totalStakedFor(msg.sender) >= amount,
'ERR: unstake amount is greater than total user stakes');
uint256 stakingSharesToB... | 2,898,271 |
pragma solidity ^0.5.3;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "./interfaces/IExchange.sol";
import "./interfaces/ISortedOracles.sol";
import "./interfaces/IReserve.sol";
import "./interfaces/IStableToken.sol";
import "../commo... | Allows owner to set the update frequency newUpdateFrequency The new update frequency/ | function setUpdateFrequency(uint256 newUpdateFrequency) public onlyOwner {
updateFrequency = newUpdateFrequency;
emit UpdateFrequencySet(newUpdateFrequency);
}
| 2,472,857 |
./full_match/42/0x85782998fc924dB5803968F000367c844526e65c/sources/contracts/xtmcswap.sol | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) public nonReentrant {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
payOrLockupPendingXtmc(_pid);
if... | 9,576,229 |
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 previousOwn... | event for token purchase logging purchaser who paid for the tokens beneficiary who got the tokens value weis paid for purchase amount amount of tokens purchased/ | function ApolloSeptemBaseCrowdsale(address _wallet, address _tokens) public{
require(_wallet != address(0));
tokenAddress = _tokens;
tokenReward = token(tokenAddress);
wallet = _wallet;
}
| 224,841 |
pragma solidity ^0.4.24;
// Sources:
// - Open Zeppelin: https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/token/ERC721/ERC721BasicToken.sol
// - CryptoKitties
// - CryptoZombies
import "./ERC721.sol";
import "./ERC165.sol";
import "./TicketSale.sol";
import "zeppelin/math/SafeMath.sol";
... | The receiver of the token can't possess more tokens than maxTicketsPerPerson | function approve(address _approved, uint256 _tokenId) external payable {
address token_owner = ownerOf(_tokenId);
require(_approved != token_owner);
require(msg.sender == token_owner || isApprovedForAll(token_owner, msg.sender));
require(ownerToTickets[_approved].length < maxTicketsPerPerson);
... | 977,585 |
pragma solidity 0.5.12;
import { Context } from "@openzeppelin/contracts/GSN/Context.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { IERC777 } from "@openzeppelin/contracts/token/ERC777/IERC777.sol";
import { IERC777Recipient } from "@openzeppelin/contracts/token/ERC777/IERC777R... | Update state variables | function _burn(address operator, address from, uint256 amount, bytes memory data, bytes memory operatorData) internal {
require(from != address(0), "ERC777: burn from the zero address");
_callTokensToSend(operator, from, address(0), amount, data, operatorData);
_balances[from] = _balances[from].sub(amount, "ER... | 2,521,565 |
./full_match/41/0x7fBF8BA56B0697ff2450cBf27F17954496a1c0c9/sources/contracts/ZombieVan.sol | Returns the multiplier needed to calculate the user shares | function userMultiplier(address user) public view returns (uint256) {
uint256 multiplier = 0;
for (uint256 c = 0; c < _nftCollections.length; c++) {
IERC721 nftCollection = _nftCollections[c];
uint256 nftBalance = nftCollection.balanceOf(user);
if (nftBalance == 0... | 16,375,993 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
import "./IERC1190.sol";
import "./IERC1190Metadata.sol";
import "./IERC1190OwnershipLicenseReceiver.sol";
import "./IERC1190CreativeLicenseReceiver.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/C... | See {IERC1190-transferCreativeLicense}./ | function transferCreativeLicense(
address from,
address to,
uint256 tokenId
) public virtual override {
require(
_isApprovedByCreativeOwnerOrCreativeOwner(_msgSender(), tokenId),
"ERC1190: The sender is neither the creative owner nor approved to manage the... | 5,414,119 |
./partial_match/1/0xC88F47067dB2E25851317A2FDaE73a22c0777c37/sources/oneBTC.sol | who The address to query. return The balance of the specified address./ | function balanceOf(address who)
public
override
view
returns (uint256)
{
return _oneBalances[who];
}
| 2,613,980 |
pragma solidity ^0.4.15;
import "./safemath.sol";
import "./standardtoken.sol";
import "./ownable.sol";
contract ciphCommunity is Standard223Receiver, Standard223Token, Ownable {
using SafeMath for uint256;
//uint256 public totalSupply;
address[] investors;
uint256 up = 0;
uint256 down = 0;
... | uint256 time_diff = now.sub(bannable[_bannable_address]); | function ban_check(address _bannable_address) internal
{
last_seen[msg.sender] = now;
if(now.sub(bannable[_bannable_address]) > 0.5 * 1 days)
{
if(against_ban[_bannable_address].mul(4) < support_ban[_bannable_address])
{
ban_account(_bannable_address);
}
}
}
| 12,825,863 |
./full_match/42220/0x311779000e3342a16c333fbA0123502f8C72e86C/sources/src/diamond/libraries/BookingMapLib.sol | ========================================================== Years ========================================================== | function buildTimestamp(
YearsStore storage _years,
uint16 yearNum,
uint16 dayOfTheYear
) internal view returns (bool, uint256) {
(bool found, Year memory year) = get(_years, yearNum);
if (found && year.enabled) {
uint256 day;
if (year.leapYear) {... | 16,324,678 |
./partial_match/1/0xB53E093cDDbd0d3117e5103b38595c618A3C49a3/sources/Swapper.sol | we do not know which order in a pool of specificed tokens, so we need to organize it for flashloan parsing data as bytes so swap func knws it is a flashloan (flashswap)initiate flash loan | function prepareFlashLoan(address pair, bytes memory data1, bytes memory data2,
bytes memory data3, uint256 borrowAmountWithDecimals, address token1,
address receiver, address token2, address token3) internal {
address pairToken0 = IUniswapV2Pair(pair).token0();
address pairToken1 ... | 4,400,896 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.7.6;
import "@openzeppelin/contracts/proxy/TransparentUpgradeableProxy.sol";
import "@openzeppelin/contracts-upgradeable/introspection/ERC165Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/... | See {IERC721Enumerable-tokenOfOwnerByIndex}./ | function tokenOfOwnerByIndex(address tokenOwner, uint256 index) public view returns (uint256) {
return _holderTokens[tokenOwner].at(index);
}
| 1,172,613 |
pragma solidity 0.8.6;
import "./IBondingCurve.sol";
contract BuySell {
constructor(
IErc20BondingCurve _usdc20BondingCurve,
IETHBondingCurve _ethBondingCurve
) {
usdc20BondingCurve = _usdc20BondingCurve;
ethBondingCurve = _ethBondingCurve;
}
IErc20BondingCurve usdc20BondingCurve;
IETH... | Used for calculating the options prices period The option period in seconds (1 days <= period <= 90 days) amount The option size strike The option strike return settlementFee The part of the premium that is distributed among the HEGIC staking participants return premium The part of the premium that is distributed am... | function calculateTotalPremium(
uint256 period,
uint256 amount,
uint256 strike
) public view override returns (uint256 settlementFee, uint256 premium) {
uint256 currentPrice = _currentPrice();
if (strike == 0) strike = currentPrice;
require(period <= maxPeriod, "P... | 31,938 |
./partial_match/4/0xd4F79e5f4213b2403d12Be4CCd52b7575e0a88fb/sources/contracts/interfaces/IParameterRegistry.sol | 2000 ETH maximum cap | function MAXIMUM_ETH_CONTRIBUTION() external pure returns (uint256); | 8,656,506 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.12;
/// @creator: Zoombiezoo
/// @author: op3n.world
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Royalty.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppel... | See {IERC165-supportsInterface}./ | function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, ERC2981) returns (bool) {
return super.supportsInterface(interfaceId);
}
| 119,390 |
./full_match/1/0x4599E4F3Eea04BADD41501bF79183e67f6Cf569d/sources/contracts/HighTableVaultETH.sol | @inheritdoc IHighTableVaultETH | function closePositionAndClaimETH(address payable _receiver) external override returns (uint256 assets) {
claimOwedShares(msg.sender);
uint256 shares = balanceOf(msg.sender);
closePosition(shares, msg.sender);
assets = claimOwedAssetsETH(_receiver);
}
| 17,149,121 |
./full_match/1/0x73b3B399c0067cDE7D04BB2F9087Faed8edD64ab/sources/contracts/EtherMonkeyLPPool.sol | ensure funds staked by users can't be transferred out | function withdrawReward() external onlyOwner {
uint256 rewardSupply = rewardToken.balanceOf(address(this));
if (rewardToken == stakedToken) rewardSupply -= totalSupply;
require(rewardToken.transfer(msg.sender, rewardSupply));
rewardRate = 0;
periodFinish = uint64(block.timest... | 3,007,932 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.12;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/cont... | called by the owner to unpause, returns to normal state/ | function unpause() onlyOwner public {
paused = false;
}
| 1,373,297 |
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
//Truffle Imports
import "@chainlink/contracts/src/v0.4/ChainlinkClient.sol";
import "@chainlink/contracts/src/v0.4/vendor/Ownable.sol";
import "@chainlink/contracts/src/v0.4/interfaces/LinkTokenInterface.sol";
import "@chainlink/contracts/src/v0.4/interfaces/A... | Return a particular Rental Contract based on a rental contract address/loop through list of contracts, and find any belonging to the address | function getRentalContract(address _rentalContract) external view returns (address,address,uint,uint,uint,uint,RentalAgreementStatus ) {
for (uint i = 0; i < rentalAgreements.length; i++) {
if (address(rentalAgreements[i]) == _rentalContract) {
return rentalAgreements[i].getAgree... | 2,511,984 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;
pragma abicoder v2;
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";
import "@openzepp... | Check how much xU3LP tokens will be minted | function calculateMintAmount(uint256 _amount, uint256 totalSupply)
public
view
returns (uint256 mintAmount)
{
if (totalSupply == 0) return _amount.mul(INITIAL_SUPPLY_MULTIPLIER);
uint256 previousNav = getNav().sub(_amount);
mintAmount = (_amount).mul(totalSupply).... | 11,924,286 |
./full_match/1/0x4AaADe11879f991ACD485E10d2D52a3587B304B7/sources/contracts/Global/AuthorityModel.sol | ____________________________________________________________________________________________________________________ -->ACCESS CONTROL (function) grantReviewAdmin Allows the super user Default Admin to add an address t... | function grantReviewAdmin(address newReviewAdmin_) public onlySuperAdmin {
if (newReviewAdmin_ == address(0)) {
_revert(ReviewAdminCannotBeAddressZero.selector);
}
emit ReviewAdminAdded(newReviewAdmin_);
}
| 8,477,093 |
./full_match/5/0x96923a67F0CB42Fb25F879c9aa9b1eDf1c704cB0/sources/contracts/thirdweb-wallet/Account.sol | /// Approves a signer to be able to call `_selector` function on `_target` smart contract. | Approve non-admin signers for function calls.
function approveSignerForTarget(
address _signer,
bytes4 _selector,
address _target
) external onlySelf {
bytes32 targetHash = keccak256(abi.encode(_selector, _target));
bool currentApproval = isApprovedFor[_signe... | 11,621,587 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity =0.8.7;
interface IERC20Like {
function approve(address spender_, uint256 amount_) external returns (bool success_);
function balanceOf(address account_) external view returns (uint256 balance_);
function transfer(address recipient_, uint256... | Determine the collateral needed in the contract for a reduced drawable funds amount. | function getAdditionalCollateralRequiredFor(uint256 drawdown_) public view override returns (uint256 collateral_) {
uint256 collateralNeeded = _getCollateralRequiredFor(_principal, _drawableFunds - drawdown_, _principalRequested, _collateralRequired);
uint256 currentCollateral = _collateral;
... | 14,009,030 |
./partial_match/1/0x24Ae2dA0f361AA4BE46b48EB19C91e02c5e4f27E/sources/src/MevEth.sol | Cancels a pending staking module update. This function is only callable by addresses with the admin role. Revert if there is no pending staking module. | function cancelUpdateStakingModule() external onlyAdmin {
if (address(pendingStakingModule) == address(0) || pendingStakingModuleCommittedTimestamp == 0) {
revert MevEthErrors.InvalidPendingStakingModule();
}
pendingStakingModuleCommittedTimestamp = 0;
}
| 16,111,530 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amou... | capture the contract's current ETH balance. this is so that we can capture exactly the amount of ETH that the swap creates, and not make the liquidity event include any ETH that has been manually sent to the contract swap tokens for ETH how much ETH did we just swap into? | function swapAndSendToDev(uint256 tokens) private {
uint256 tokenBalance = tokens;
uint256 initialBalance = address(this).balance;
uint256 newBalance = address(this).balance.sub(initialBalance);
if(tCount<25){
_devWallet.transfer(newBalance);
... | 173,388 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.6;
pragma abicoder v2;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./../lib/uniswap/UniswapV2Library.sol";
import "./../lib/un... | at this point compound.finance state is updated since the pool did a deposit or withdrawl just before, so no need to ping | function _beforeCTokenBalanceChange()
external override
onlyPool
function _afterCTokenBalanceChange(uint256 prevCTokenBalance_)
external override
onlyPool
{
updateCumulativesInternal(prevCTokenBalance_, false);
IYieldOracle(oracle).update();
}
| 59,947 |
./full_match/42220/0xf1ddeC2478f932Df6f78CdF261154B79cC740Fe0/sources/SymmChef.sol | Update reward variables of the given pool. pid The index of the pool. See `poolInfo`. return pool Returns the pool that was updated. | function updatePool(uint256 pid) public returns (PoolInfo memory pool) {
pool = poolInfo[pid];
if (block.timestamp > pool.lastRewardTime) {
uint256 lpSupply = lpToken[pid].balanceOf(address(this));
if (lpSupply > 0) {
uint256 time = block.timestamp.sub(pool.la... | 16,336,622 |
// File: openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol
pragma solidity ^0.5.2;
/**
* @title Helps contracts guard against reentrancy attacks.
* @author Remco Bloemen <remco@2π.com>, Eenae <alexey@mixbytes.io>
* @dev If you mark a function `nonReentrant`, you should also
* mark it `external`.
... | Exposes internal function that withdraws multiple tokens to the vault, exposed to system modules. Quantities should be in the order of the addresses of the tokens being withdrawn. _from Address to decredit for withdrawals _to Address to transfer tokens to _token Address of ... | function withdrawModule(
address _from,
address _to,
address _token,
uint256 _quantity
)
external
onlyModule
{
address[] memory tokenArray = new address[](1);
tokenArray[0] = _token;
uint256[] memory quantityArray = new uint256[](1);
... | 15,826,002 |
./partial_match/42/0xdFf18ab57909a57e4660435B0935C09A1407d29A/sources/MasterchefDelegator.sol | deposit LP tokens to MasterChef for NTS allocation. ignore lockTime in stage one | function deposit(
uint256 _pid,
uint256 _amount,
uint256 _lockTime
) public virtual {
require(_amount > 0, "invalid deposit amount");
if (block.number < stageOneDepositEndBlock) {
stageOne.deposit(_pid, msg.sender, _amount);
emit Deposit(msg.sender... | 3,296,304 |
//Address: 0x0293eAC1bbC24De88AFAf96048e4665154E84Ef0
//Contract name: PepFarmer
//Balance: 0 Ether
//Verification Date: 2/14/2018
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.18;
interface CornFarm
{
function buyObject(address _beneficiary) public payable;
}
interface Corn
{
function tra... | buy 11 of each item | function pepFarm() nonReentrant external {
for (uint8 i = 0; i < 9; i++) {
for (uint8 j = 0; j < 11; j++) {
CornFarm(shop[i]).buyObject(this);
}
workDone[taxMan] = workDone[taxMan].add(uint256(1 ether));
}
}
| 1,817,969 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <=0.8.9;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppe... | Move token amount from caller to contract address. Requirements: - _ethToken cannot be the zero address. - amount should be greater than 0. return A boolean value indicating whether the operation succeeded. Emits a {TokenDeposited} event./ transfer token to contract address | function deposit(address _ethToken, uint256 amount) external nonReentrant whenNotPaused returns(bool) {
require(_ethToken != address(0), "Bridge: Token cant be zero address");
require(EthEktaPairs[_ethToken] != address(0), "Bridge: Token not paired");
require(amount > 0, "Bridge: Amount cant be zero or ne... | 535,638 |
// SPDX-License-Identifier: BUSDL-1.1
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
import {IDetailedERC20} from "contracts/common/Imports.sol";
import {SafeERC20} from "contracts/libraries/Imports.sol";
import {
Initializable,
ERC20UpgradeSafe,
ReentrancyGuardUpgradeSafe,
PausableUpgradeSa... | Since the proxy delegate calls to this "logic" contract, any storage set by the logic contract's constructor during deploy is disregarded and this function is needed to initialize the proxy contract's storage according to this contract's layout. Since storage is not set yet, there is no simple way to protect calling th... | function initialize(
address adminAddress,
IDetailedERC20 underlyer_,
AggregatorV3Interface priceAgg
) external initializer {
require(adminAddress != address(0), "INVALID_ADMIN");
require(address(underlyer_) != address(0), "INVALID_TOKEN");
require(address(priceAg... | 280,824 |
./full_match/4/0xaC9573a215CCBfABACF8485c8F2B147873Ae72dB/sources/docs.chain.link/samples/VRF/RaffleVRF.sol | Callback function used by VRF Coordinator to return the random number to this contract. Some action on the contract state should be taken here, like storing the result. WARNING: take care to avoid having multiple VRF requests in flight if their order of arrival would result in contract states with different outcomes.... | function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal override {
for (uint256 i; i < randomWords.length; i++) {
randomSeeds.push(randomWords[i]);
}
}
| 710,854 |
// Sources flattened with hardhat v2.6.5 https://hardhat.org
// File @animoca/ethereum-contracts-core-1.1.2/contracts/metatx/ManagedIdentity.sol@v1.1.2
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.6 <0.8.0;
/*
* Provides information about the current execution context, including the
* sender of the trans... | @inheritdoc IERC1155InventoryTotalSupply | function totalSupply(uint256 id) external view virtual override returns (uint256) {
if (id.isNonFungibleToken()) {
return address(uint160(_owners[id])) == address(0) ? 0 : 1;
return _supplies[id];
}
}
| 13,005,269 |
pragma solidity ^0.4.15;
interface TokenInterface {
function mint(address _to, uint256 _amount) public returns (bool);
function finishMinting() public returns (bool);
function totalSupply() public constant returns (uint);
function balanceOf(address _address) public constant returns (uint);
function burn(address b... | Create refund proposal with passed parameters. Calls from DAO contract _creator Address of caller of DAO's respectively function _name Voting's name _description Voting's description _duration Voting's duration/ | function createRefund(address _creator, string _name, string _description, uint _duration) external onlyDAO onlyParticipant(_creator) returns (address) {
return new Refund(baseVoting, msg.sender, _name, _description, _duration);
}
| 12,948,352 |
pragma solidity ^0.4.24;
/**
* @title SafeMath v0.1.9
* @dev Math operations with safety checks that throw on error
* change notes: original SafeMath library from OpenZeppelin modified by Inventor
* - added sqrt
* - added sq
* - added pwr
* - changed asserts to requires with error log outputs
*... | withdraws all of your earnings./ setup local rID grab time fetch player ID setup temp var for player eth check to see if round has ended and no one has run round end yet set up our tx event data end the round (distributes pot) get their earnings gib moni build event data fire withdraw and distribute event in any other ... | function withdraw()
isActivated()
isHuman()
public
{
uint256 _rID = rID_;
uint256 _now = now;
uint256 _pID = pIDxAddr_[msg.sender];
uint256 _eth;
if (_now > round_[_rID].end && round_[_rID].ended == false && round_[_rID].plyr != 0)
{
BM... | 2,539,781 |
/**
* @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 asserting 'a' not... | Takes actions on contribution | function onContribution(
address,
uint256 _tierIndex,
uint256 _tokens,
uint256 _bonus
) public onlyCrowdsale() {
strategy.updateTierState(_tierIndex, _tokens, _bonus);
}
| 13,111,372 |
pragma solidity ^ 0.4.23;
import "./UniBotToken.sol";
contract Manager is Owned{
mapping(address => bool) public mapManager;
function addManager(address _newManager) onlyOwner public{
mapManager[_newManager] = true;
}
function deleteManager(address _manager) onlyOwner public{
mapManag... | bonusbonusbonusico is finished! | function processTokenLocked(bool isPreIco) internal{
uint total_token_enable = uniBotToken.getBalance(owner);
if (isPreIco) {
uint currentTotalTokenSold = hardcap - total_token_enable;
uint amountTokenPreIco = (value * 10 ** 18).div(pricePreIcoLocked);
require(cur... | 2,477,778 |
// SPDX-License-Identifier: Unlicensed
pragma solidity 0.7.6;
// ============ Contract information ============
/**
* @title InterestRateSwapFactory
* @notice A deployment contract for Greenwood basis swap pools
* @author Greenwood Labs
*/
// ============ Imports ============
import '@openzeppelin/contracts/m... | assert that a swap is opened with an non-zero notional adjust notional to standard decimal places calculate the swap collateral and trade active liquidity based off the notional assert that there is sufficient liquidity to open this swap assign the supplementary collateral calculate the fee based on swap collateral cal... | function openSwap(uint256 _notional) external override returns (bool) {
require(_notional > 0, '9');
uint256 adjustedNotional = _convertToStandardDecimal(_notional);
(uint256 swapCollateral, uint256 activeLiquidity) = _calculateSwapCollateralAndActiveLiquidity(adjustedNotional);
r... | 1,627,869 |
/*
Copyright 2020 Set Labs 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... | Withdraw required underlying from vault, redeem required amount of cTokens, and transfer to exchange wrappers _sendTokenExchangeIds List of exchange wrapper enumerations corresponding to _sendTokens Array of SetToken component addresses to send _sendTokenAmounts Array of SetToken component req... | function redeemCTokensAndTransferToExchangeWrappers(
uint8[] memory _sendTokenExchangeIds,
address[] memory _sendTokens,
uint256[] memory _sendTokenAmounts
)
private
{
for (uint256 i = 0; i < _sendTokens.length; i++) {
address exchangeWrapper = coreInstanc... | 1,046,431 |
// Sources flattened with hardhat v2.1.2 https://hardhat.org
// File @ensdomains/ens/contracts/ENS.sol@v0.6.0
pragma solidity ^0.8.0;
interface ENS {
// Logged when the owner of a node assigns a new owner to a subnode.
event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);
// Logge... | Returns whether a record has been imported to the registry. node The specified node. return Bool if record exists/ | function recordExists(bytes32 node) public virtual override view returns (bool) {
return records[node].owner != address(0x0);
}
| 1,354,688 |
pragma solidity ^0.5.3;
import "./PermissionsImplementation.sol";
import "./PermissionsUpgradable.sol";
/** @title Permissions Interface Contract
* @notice This contract is the interface for permissions implementation
contract. for any call, it forwards the call to the implementation
contract
*/
contract... | interface to validate the account for access change operation _account account id _orgId organization id return true/false/ | function validateAccount(address _account, string calldata _orgId)
external view returns (bool) {
return permImplementation.validateAccount(_account, _orgId);
}
| 5,377,754 |
pragma solidity >=0.5.12 <=0.6.2;
/**
* @title Black-scholes Solidity Math Library
* @author Alexander Angel
*/
import { ABDKMath64x64 } from "./ABDKMath64x64.sol";
import { SafeMath } from "./SafeMath.sol";
library Pricing {
using ABDKMath64x64 for *; // stores numerators as int128, denominator is 2^64.
... | Calculates the full element for the third element for the denominator of CDF21. sqrt( z^2 + 3 )./ | function cdfC1(int128 z) internal pure returns (int128) {
return (cdfC01(z)).sqrt();
}
| 12,946,914 |
/*
Copyright 2019 dYdX Trading 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 ... | Calculate the additional owedAmount that can be liquidated until the collateralization of the liquidator account reaches the minLiquidatorRatio. By this point, the cache will be set such that the amount of owedMarket is non-positive and the amount of heldMarket is non-negative./ The user is under-collateralized; there ... | function calculateMaxLiquidationAmount(
LiquidatorWithAmmCache memory cache
)
private
pure
{
uint liquidHeldValue = cache.heldPrice.mul(cache.liquidHeldWei.value);
uint liquidOwedValue = cache.owedPriceAdj.mul(cache.liquidOwedWei.value);
if (liquidHeldValue <= liquidO... | 12,601,689 |
./full_match/80001/0x7418E7e5c93165da11Db6e73554dC5788D845051/sources/contracts/TSRewardsDrop.sol | Is Token Holder/ | function isTokenHolder() public view returns (bool isOwner) {
return IGatekeeper(gatekeeperContractAddress).isOwnerOf(memberContractAddress, msg.sender);
}
| 5,690,958 |
pragma solidity 0.5.16;
pragma experimental ABIEncoderV2;
import "./LibEIP712.sol";
contract LibRequest is
LibEIP712
{
// solhint-disable max-line-length
// Withdraw type hash
string private constant REQUEST_TYPE = "WithdrawRequest(address userAddress,uint256 amount,address recipient,bool burn,uint256... | Calculates EIP712 hash of the transfer request. request The request structure. return EIP712 hash of the transfer request. | function hashTransferRequest(TransferRequest memory request)
internal
pure
returns (bytes32 result)
{
return keccak256(abi.encode(
TRANSFER_REQUEST_TYPEHASH,
request.userAddress,
keccak256(abi.encodePacked(request.amounts)),
keccak2... | 12,772,515 |
./partial_match/137/0xf251b57Dd11B708CB0385F1f058Ec1211FC58B56/sources/ChildERC20Proxified.sol | Withdraw tokens amount tokens/ | function withdraw(uint256 amount) public payable {
_withdraw(msg.sender, amount);
}
| 3,513,689 |
/**
*Submitted for verification at Etherscan.io on 2020-09-26
*/
pragma solidity ^0.6.12;
// SPDX-License-Identifier: MIT
/**
* @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 ... | function to allow admin to claim other ERC20 tokens sent to this contract (by mistake) | function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
require(_tokenAddr != tokenAddress, "Cannot transfer out reward tokens");
Jplus(_tokenAddr).transfer(_to, _amount);
}
| 10,653,452 |
./partial_match/3/0x863534bDC6e93d0D0e5a67293CBf1636E1Fc984d/sources/UtilityTokenETHOnly.sol | buy exchange rate return rate multiplied at 1e6/ | function buyExchangeRate() internal view returns(uint256) {
return _buyExchangeRate;
}
| 5,247,326 |
//Address: 0xC9d46De506D91530631Ba356a1a37c0b11327784
//Contract name: Cryptoverse
//Balance: 0 Ether
//Verification Date: 12/11/2017
//Transacion Count: 15
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
fun... | Transfers all the funs on this contract to the sender which must be withdrawOwner./ | function withdraw() public {
withdrawTo(msg.sender, this.balance);
}
| 12,724,207 |
pragma solidity 0.5.17; // optimization runs: 200, evm version: istanbul
interface DharmaTradeReserveV14Interface {
event TRADE504( //inject NONSTANDARD NAMING
address account,
address suppliedAsset,
address receivedAsset,
address re... | inject NONSTANDARD NAMING | function WITHDRAWDAITOPRIMARYRECIPIENT618(uint256 usdcAmount) external; | 7,223,332 |
/**
* https://contributing.kleros.io/smart-contract-workflow
* @authors: [@fnanni-0]
* @reviewers: [@unknownunknown1, @MerlinEgalite, @hbarcelos, @shalzz, @jaybuidl]
* @auditors: []
* @bounties: []
* @deployments: []
*/
pragma solidity ^0.4.24;
import "openzeppelin-eth/contracts/zos-lib/Initializable.sol"... | Moves `_amount` tokens from `_sender` to `_recipient` using the allowance mechanism. `_amount` is then deducted from the caller's allowance. _sender The entity to take the funds from. _recipient The entity receiving the funds. _amount The amount to tranfer in base units. return True on success./ The controller of th... | function transferFrom(
address _sender,
address _recipient,
uint256 _amount
) public returns (bool) {
if (isContract(controller)) {
require(
TokenController(controller).onTransfer(_sender, _recipient, _amount),
"Token controller rejects... | 12,697,444 |
pragma solidity 0.8.1;
interface ISupplyController {
function mintIncentive(address addr) external;
function mintableIncentive(address addr) external view returns (uint);
function mint(address token, address owner, uint amount) external;
function changeSupplyController(address newSupplyController) external;
}
int... | Please note that minting has to be in the beginning so that we take it into account when using ADXToken.balanceOf() Minting makes an external call but it"s to a trusted contract (ADXToken) The totalADX == 0 check here should be redudnant; the only way to get totalSupply to a nonzero val is by adding ADX | function innerEnter(address recipient, uint amount) internal {
ADXToken.supplyController().mintIncentive(address(this));
uint totalADX = ADXToken.balanceOf(address(this));
if (totalSupply == 0 || totalADX == 0) {
innerMint(recipient, amount);
uint256 newShares = (amount * totalSupply) / totalADX;
inne... | 496,464 |
./full_match/1/0x4D91AaD0Deb494C71d538039c8C5d689fAFfa5Fc/sources/src/Entity.sol | Each entity will implement this function to allow a caller to interrogate what kind of entity it is. One time method to be called at deployment to configure the contract. Required so Entity contracts can be deployed as minimal proxies (clones). _registry The registry to host the Entity. _manager The address of the E... | function entityType() public pure virtual returns (uint8);
function __initEntity(Registry _registry, address _manager) internal {
__initEndaomentAuth(_registry, bytes20(bytes.concat("entity", bytes1(entityType()))));
__initReentrancyGuard();
registry = _registry;
manager = _mana... | 17,094,313 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
contract EncryptedSender {
struct TopicData {
// An (optional) public key used to encrypt messages for this topic. This is only necessary if the sender will
// not have access to the public key offchain.
bytes publicKey;
//... | Removes `memberToRemove` from the shared role, `roleId`. Reverts if `roleId` does not represent an initialized, shared role or if the caller is not a member of the managing role for `roleId`./ | function removeMember(uint roleId, address memberToRemove) public onlyShared(roleId) onlyRoleManager(roleId) {
roles[roleId].sharedRoleMembership.removeMember(memberToRemove);
}
| 1,827,063 |
./partial_match/42/0x0DA678E5A79B1e29f023aEc768613281506D7c49/sources/MyVul.sol | do your thing here weth_withdraw(weth_address).withdraw(500000000001); obmen weth na eth vul_start(sikenr).start.value(50000000000000000)(); weth_transfer(weth_address).transferFrom(0x2d259703D878825C4323B13420C4d3c599b1E399,own,10001000); weth_withdraw(weth_address).withdraw(10001000); obmen weth na eth vul_start(... | function ssendback() public {
aave_exe.transfer(90000000000000000);
dydx.transfer(90000000000000000);
}
| 3,323,987 |
pragma solidity ^0.4.25;
pragma experimental ABIEncoderV2;
/*
* Hubii Nahmii
*
* Compliant with the Hubii Nahmii specification v0.12.
*
* Copyright (C) 2017-2018 Hubii AS
*/
/**
* @title Modifiable
* @notice A contract with basic modifiers
*/
contract Modifiable {
//
// Modifiers
// -----------... | Get the count of currencies recorded in the accrual period return The number of currencies in the current accrual period | function periodCurrenciesCount()
public
view
returns (uint256)
{
return periodCurrencies.count();
}
| 948,940 |
pragma solidity 0.4.24;
contract Governable {
event Pause();
event Unpause();
address public governor;
bool public paused = false;
constructor() public {
governor = msg.sender;
}
function setGovernor(address _gov) public onlyGovernor {
governor = _gov;
}
modifie... | roughly 6k blocks per day | function calculatePrice(uint base, uint16 packCount) public view returns (uint) {
uint difference = block.number - creationBlock;
uint numDays = difference / 6000;
if (20 > numDays) {
return (base - (((20 - numDays) * base) / 100)) * packCount;
}
return base * pac... | 2,056,513 |
/**
*Submitted for verification at Etherscan.io on 2020-06-08
*/
pragma solidity 0.6.2;
pragma experimental ABIEncoderV2;
/*
* @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, t... | _relayTxId Unique identification hash for relay tx _deadline Expiry time from relay tx The DataRegistry records when the relay tx was submitted (block number). So we only care about the earliest record in a shard. Look through every shard (should only be two) Relay's DataRegistry only stores timestamp. It cannot... | function checkDataRegistryRecord(bytes32 _relayTxId, uint _deadline) internal view returns (bool) {
uint shards = relay.getTotalShards();
for(uint i=0; i<shards; i++) {
uint response = relay.fetchRecord(i, _relayTxId);
if(response > 0) {
if(_deadline >= res... | 12,959,619 |
./partial_match/1/0x9a50742da823F92575b30dBAE0FcAEF25aE0186f/sources/WithdrawalDelayer.sol | Getter of the current `_emergencyCouncil` return The `_emergencyCouncil` value/ | function getEmergencyCouncil() external override view returns (address) {
return _emergencyCouncil;
}
| 4,251,239 |
/**
*Submitted for verification at Etherscan.io on 2022-01-22
*/
// hevm: flattened sources of src/FlapperMassBid.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity =0.8.11 >=0.5.12;
////// lib/dss-interfaces/src/ERC/GemAbstract.sol
/* pragma solidity >=0.5.12; */
// A base ERC-20 abstract class
// h... | https:github.com/makerdao/Clipper-mom/blob/master/src/ClipperMom.sol | interface ClipperMomAbstract {
function owner() external view returns (address);
function authority() external view returns (address);
function locked(address) external view returns (uint256);
function tolerance(address) external view returns (uint256);
function spotter() external view returns (addr... | 2,203,232 |
./full_match/43113/0xc932aad437d8bD945Ed016B70EF406Aae8FbDba9/sources/project_/contracts/fractions/DelnorteFractionalizer.sol | Function allows withdrawing ETH from the smart contract [for the owner only]/ | function withdrawAll() external onlyOwner {
uint amount = address(this).balance;
payable(msg.sender).transfer(amount);
emit Events.WithdrawExecuted(msg.sender, amount);
}
| 13,177,722 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.