file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/84531/0x4771F4DCdCE3F51349B51B28968692713Df860C6/sources/BaseApes.sol | Gives permission to `to` to transfer `tokenId` token to another account. The approval is cleared when the token is transferred. Only a single account can be approved at a time, so approving the zero address clears previous approvals. Requirements: - The caller must own the token or be an approved operator. - `tokenId` ... | function setApproval(address to, uint256 tokenId) public payable virtual override {
address owner = ownerOf(tokenId);
if (_msgSenderERC721A() != owner)
if (!isApprovedForAll(owner, _msgSenderERC721A())) {
revert ApprovalCallerNotOwnerNorApproved();
}
... | 16,688,450 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IBasisAsset} from '../interfaces/IBasisAsset.sol';
import {IBoardroom} from '../interfaces/IBoardroom.sol';
import {IERC20} from '@openzeppelin/contracts/contracts/token/ERC20/IERC20.sol';
import {ISimpleERCFund} from '../interfaces/ISimpleERCFund.sol';
... | This function calculates how much bonds should be minted given an epoch The cap will be of the following size: ($1-1hTWAP)(Circ $BAC), where 1hTWAP is the 1h TWAP of the $ARTH price and “Circ $ARTH is the Circulating $ARTH supply. The cap will last for one hour; after an hour a new TWAP will be calculated and the cap i... | function _updateConversionLimit(uint256 cash1hPrice) private {
state.accumulatedBonds = 0;
state.cashToBondConversionLimit = estimateBondsToIssue(cash1hPrice);
}
event Migration(address indexed target);
event RedeemedBonds(address indexed from, uint256 amount);
event BoughtBonds(
... | 5,397,330 |
./full_match/1/0xDa5eD43B9B6E36b4f27cc6D8c1974532cdBd55F9/sources/PurgeableSynth.sol | Retrieves the exchange rate (sUSD per unit) for a given currency key/ | function rates(bytes32 code) public view returns(uint256) {
return getRateAndUpdatedTime(code).rate;
}
| 17,066,850 |
pragma solidity ^0.4.11;
import "./NettingChannelLibrary.sol";
contract NettingChannelContract {
string constant public contract_version = "0.1._";
using NettingChannelLibrary for NettingChannelLibrary.Data;
NettingChannelLibrary.Data public data;
event ChannelNewBalance(address token_address, addre... | Settle the transfers and balances of the channel and pay out to each participant. Can only be called after the channel is closed and only after the number of blocks in the settlement timeout have passed. | function settle() public {
data.settle();
ChannelSettled();
}
| 12,544,419 |
//Address: 0x2737e022e8bf733b05fa0706b0e80003a576ccb4
//Contract name: TokenValueRelayer
//Balance: 0 Ether
//Verification Date: 2/2/2018
//Transacion Count: 162
// CODE STARTS HERE
pragma solidity ^0.4.11;
/* The authentication manager details user accounts that have access to certain priviledges and keeps a perma... | Add a contract to our list of account minters / Fail if this account is already in the list Add the minter | function addAccountMinter(address _address) {
if (!isCurrentAdmin(msg.sender))
throw;
if (accountMinterAddresses[_address])
throw;
accountMinterAddresses[_address] = true;
AccountMinterAdded(msg.sender, _address);
accountMinterAudit.length++;... | 6,347,078 |
// Sources flattened with hardhat v2.4.1 https://hardhat.org
// File @openzeppelin/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a cont... | Function to deposit tokens to specified network's bridge | function depositTokens(
address token,
uint256 amount,
uint256 networkId
)
public
isBridgeNotFrozen
isAmountGreaterThanZero(amount)
isAssetNotFrozen(token)
{
require(isNetworkActive[networkId], "Error: Network with this id is not supported.");
IERC20(... | 13,838,096 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract PaperfaxIndex { // extends ERC1155?
enum Vote {
UP,
DOWN
}
enum Verdict {
ENDORSED,
NEEDS REVIEW
}
struct Audit {
uint paperfaxId;
Verdict verdict;
strin... | when you submit an audit,call the IPFS API/SDK to upload the comments and get the hash,then submit the ethereum tx with that hash | function createAudit(uint paperfaxID, Verdict _verdict, string memory ipfshash, uint32 _numMinorIssues, uint32 _numMajorIssues, uint32 _numReccomendations) external {
audits.push(Audit(paperfaxID, _verdict, ipfshash, _numMinorIssues, _numMajorIssues, _numReccomendations) );
uint id = audits.length -1;
... | 13,041,696 |
./partial_match/4/0xCEFfa7bBbF02c79a4757956A858e302F2A133e73/sources/GameeVouchers.sol | Mints some token. Reverts if `isBatch` is false and `to` is the zero address. Reverts if `id` represents a non-fungible collection. Reverts if `id` represents a non-fungible token and `value` is not 1. Reverts if `id` represents a non-fungible token which is owned by a non-zero address. Reverts if `id` represents ... | function _safeMint(
address to,
uint256 id,
uint256 value,
bytes memory data
) internal {
require(to != address(0), "Inventory: transfer to zero");
if (isFungible(id)) {
_mintFungible(to, id, value);
_mintNFT(to, id, value, false);
... | 8,606,219 |
// File: contracts/src/common/lifecycle/Killable.sol
pragma solidity ^0.5.0;
/**
* A module that allows contracts to self-destruct.
*/
contract Killable {
address payable public _owner;
/**
* Initialized with the deployer as the owner.
*/
constructor() internal {
_owner = msg.sender;
}
/**
* Self-des... | Release the authenticated asset./ | function deauthenticate(address _metrics)
external
onlyLinkedPropertyAuthor(_metrics)
{
bytes32 idHash = idHashMetricsMap[_metrics];
require(idMap[idHash], "not authenticated");
idMap[idHash] = false;
idHashMetricsMap[_metrics] = bytes32(0);
IMetricsFactory metricsFactory = IMetricsFactory(
config(... | 10,085,561 |
./partial_match/3/0x42064184332eB6334A2cb6E6C55745f361e76E6a/sources/Nexon.sol | Funtion to withdraw purchased token/ | function withdrawPurchasedToken() external returns(bool){
require(_myPurchasedTokens[msg.sender]>0,"You do not have any purchased token");
if(_referralWhitelist[msg.sender] == true){
address referree = _ReferalList[msg.sender];
_mint(_myPurchasedTokens[msg.sender].add(_myPurchasedTokens[msg.sender... | 5,117,055 |
./partial_match/42/0x526dBb7270DcE7982a957f5C159177f2474342aB/sources/DFG.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())... | 3,297,686 |
./partial_match/1/0x3b8E136eb3313b7372c7805044A918eed4c5A75E/sources/OhmAllocator.sol | Unstakes sOHM and moves it back to treasury Transfer Ohm back to treasury | function emergencyWithdraw() external onlyOwner {
IERC20(ohm).approve(address(treasury), ohmBalance);
treasury.deposit(ohmBalance, ohm, ohmBalance, false);
principleStaked = 0;
}
| 9,327,204 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
import "../interfaces/AccessControlledInterface.sol";
import "../vendor/AccessControllerInterface.sol";
import "../vendor/ConfirmedOwner.sol";
contract AccessControlled is AccessControlledInterface, ConfirmedOwner(msg.sender) {
AccessControllerInterface intern... | get block timestamp when an answer was last updated roundId the answer number to retrieve the updated timestamp for [deprecated] Use getRoundData instead. This does not error if no answer has been reached, it will simply return 0. Either wait to point to an already answered Aggregator or use the recommended getRoundD... | function getTimestamp(
uint256 roundId
)
public
view
virtual
override
returns (
uint256 updatedAt
)
{
if (roundId > MAX_ID) return 0;
(uint16 phaseId, uint64 aggregatorRoundId) = parseIds(roundId);
AggregatorProxyInterface aggregator = s_phaseAggregators[phaseId];
... | 14,647,500 |
./partial_match/42/0xd434a1bDD41689160ecd24F78df7C354f054166A/sources/FlexibleLeverageStrategyAdapter.sol | Calculate notional rebalance quantity, whether to chunk rebalance based on max trade size and max borrow. Invoke delever on CompoundLeverageModule. For ripcord, the slippage tolerance, and TWAP max trade size use the incentivized parameters./ Get total amount of collateral that needs to be rebalanced | function _delever(
uint256 _currentLeverageRatio,
uint256 _newLeverageRatio,
ActionInfo memory _actionInfo,
uint256 _slippageTolerance,
uint256 _twapMaxTradeSize
)
internal
{
uint256 totalRebalanceNotional = _currentLeverageRatio
.sub(_newL... | 3,425,720 |
/*
The MIT License (MIT)
Copyright 2017 - 2018, Alchemy Limited, LLC and Smart Contract Solutions.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, includi... | Transfer tokens from caller to another address _to address The address which you want to transfer to _value uint256 the amout of tokens to be transfered | function transfer(address _to, uint256 _value) public transferable returns (bool) {
return super.transfer(_to, _value);
}
| 624,290 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
/**
* @title ScryptFramework
* @author Christian Reitwiessner
*/
abstract contract ScryptFramework {
// The state object, can be used in both generating and verifying mode.
// In generating mode, only vars and fullMemory is used, in verifying
// mode ... | flips endianness for a 32-bit input x the 32-bit value to have its endianness flipped return the flipped value/ | function endianConvert32bit(uint x) pure internal returns (uint) {
return
(x & 0xff) * 0x1000000 +
(x & 0xff00) * 0x100 +
(x & 0xff0000) / 0x100 +
(x & 0xff000000) / 0x1000000;
}
| 15,824,407 |
//SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "@openzeppelin/contracts/utils/Strings.sol";
import "@rari-capital/solmate/src/utils/ReentrancyGuard.sol";
import "erc721a/contracts/ERC721A.sol";
import "./SignedAllowance.sol";
import "./MultisigOwnable.sol";
import "./BatchOffsets.sol";
/// @title Mar... | owner only function to activate or deactivate the Mars list | function setMarsList() public onlyRealOwner {
emit MarsListUpdated(!marsList);
marsList = !marsList;
}
| 12,764,933 |
./full_match/1/0x62BF548B95e48ff169C1bAcC59B9BC99B014e273/sources/contracts/TokenBridgeRegistryUpgradeable.sol | string memory token = tokenBridges[index]; | function removeBridge(string memory _tokenTicker) external onlyOwner {
require(BridgeUpgradeable(payable(bridgeUpgradeable)).totalLpLiquidity(_tokenTicker) == 0, "LIQ_PRESENT");
require(FeePoolUpgradeable(payable(feePoolUpgradeable)).totalFees(_tokenTicker) == 0, "FEE_PRESENT");
delete token... | 2,932,514 |
pragma solidity 0.6.12;
import '@nextechlabs/nexdex-lib/contracts/math/SafeMath.sol';
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import '@nextechlabs/nexdex-lib/contracts/access/Ownable.sol';
import "./Xp.sol";
import "./BoostBar.sol";
// impo... | Withdraw without caring about rewards. EMERGENCY ONLY. | function emergencyWithdraw(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
pool.lpToken.safeTransfer(address(msg.sender), user.amount);
emit EmergencyWithdraw(msg.sender, _pid, user.amount);
user... | 1,029,202 |
/**
*Submitted for verification at Etherscan.io on 2021-09-08
*/
pragma solidity ^0.4.24;
/**
* @dev SafeMath
* Math operations with safety checks that throw on error
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
library SafeMath {
function mul(uint256 a, uint... | Only Crowd Sale Type 864000 = 10 Days | function _unLock(address sender, uint8 tokenType) internal {
LockInfo storage lockInfo = _lockedInfo[sender][tokenType];
if(tokenType == 1 && lockInfo.remainUnLockCount == 6 && lockInfo.distributedTime.add(864000) <= now) {
lockInfo.distributedTime = lockInfo.distributedTime.add(864000)... | 10,918,298 |
pragma solidity ^0.4.23;
/**
* Utility library of inline functions on addresses
*/
library AddressUtils {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until after the ... | Clear metadata (if any) | function _burn(address _owner, uint256 _tokenId) internal {
super._burn(_owner, _tokenId);
if (bytes(tokenURIs[_tokenId]).length != 0) {
delete tokenURIs[_tokenId];
}
uint256 lastTokenIndex = allTokens.length.sub(1);
uint256 lastToken = allTokens[lastTokenIndex]... | 7,768,890 |
pragma solidity ^0.4.24;
import "./../helpers/Ownable.sol";
import "./../token/TokenInterface.sol";
import "./../bounty/BountyInterface.sol";
import "./../helpers/ListHelpers.sol";
import "./../helpers/StringHelpers.sol";
import "./../helpers/MathHelpers.sol";
import "./../ballot/BallotLib.sol";
import "./JudgeLib.sol... | when the last judge withdraws he has to transfer remain balance to valueCaptured address | function withdraw() public onlyInClosedState returns (bool) {
require(isJudged());
BallotLib.Ballot storage ballot = ballots[msg.sender];
require(ballot.isValid());
uint256 amount = judges[msg.sender].depositedAmount;
require(amount > 0);
uint256 remainBalance = TokenInterface(tokenAddress).ba... | 5,532,507 |
./full_match/1/0x610142Acd45672894bE44fB9C14376101Ec4Dc16/sources/contracts/ssp/card_with_card.sol | / console.log("data-->"); console.logBytes(cat); console.log("hash ->"); console.logBytes32(hash); ecrecover takes the signature parameters, and the only way to get them currently is to use assembly. | function verify(saleInfo calldata sp) internal view returns (bool) {
require(sp.token_address != address(0), "INVALID_TOKEN_ADDRESS");
bytes memory cat =
abi.encode(
sp.token_address,
sp.start,
sp.end,
sp.price,
... | 8,416,231 |
./full_match/56/0xF25Dc8b40D2CF98226eeFD390c6Ab69b023a87Bf/sources/project_/contracts/BUSDStakerV8.sol | If user is on tier 3,4,5 reward mxst tokens. | function claim(address investor, uint256 _apr) internal {
uint256 prevLockedAmount;
uint256 allClaimableAmount;
uint256[] memory userDeposits = ownedDeposits[investor];
for (uint256 i = 0; i < userDeposits.length; i++) {
DepositStruct memory _depState = depositState[userD... | 3,232,718 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.4;
import "./FuseGuardian.sol";
import "./IMasterOracle.sol";
contract FuseAdmin is FuseGuardian {
error ComptrollerError();
/// @param _core address of core contract
/// @param _comptroller the fuse comptroller
constructor(
a... | Revert with a standard message if `account` is missing `role`. The format of the revert reason is given by the following regular expression: /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$// | function _checkRole(bytes32 role, address account) internal view {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
Strings.toHexString(uint160(account), 20),
... | 4,136 |
./full_match/80001/0x8f4a5587E03c74D40F215de1a0c88E1349e73157/sources/project_/contracts/CoveyStaking.sol | break glass in case of emergency function to give back stakes to users for any reason | function emergencyDispense() external onlyOwnerOrDispenser {
uint256 numStakers = stakers.length() >= 100 ? 100 : stakers.length();
for(uint256 i = 0; i < numStakers; ++i) {
address staker = stakers.at(i);
uint256 fullStakedAmount = stakedAmounts[staker];
stakin... | 9,472,427 |
pragma solidity ^0.5.0;
// 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/
impor... | Register a future flight for insuring./ bytes32 key = getFlightKey(airline,flight,timestamp); | function registerFlight(address airline,string calldata flight , uint256 timestamp) external {
if(registeredAirline[airline] == true){
flightSuretyData.registerFlight(airline,flight,timestamp,true);
flightSuretyData.registerFlight(airline,flight,timestamp,true);... | 1,764,945 |
pragma solidity ^0.4.23;
import "./PausableDSAuth.sol";
import "./interfaces/ISettingsRegistry.sol";
import "./SettingIds.sol";
import "./interfaces/IInterstellarEncoderV3.sol";
import "./interfaces/IMintableERC20.sol";
import "./interfaces/INFTAdaptor.sol";
import "openzeppelin-solidity/contracts/token/ERC721/ERC721.... | if it is the first time to bridge in keep new mirror object in this contract before the owner has transferred his/her outerObject into this contract mirror object can not be transferred link objects_in and objects_out | function _bridgeIn(address _originNftAddress, uint256 _originTokenId, address _owner) internal returns (uint256) {
address adaptor = originNFT2Adaptor[_originNftAddress];
require(adaptor != address(0), "Not registered!");
require(INFTAdaptor(adaptor).ownerInOrigin(_originTokenId) == _owner,... | 2,552,134 |
pragma solidity >= 0.5.0 < 0.7.0;
// pragma experimental ABIEncoderV2; // To support struct as return value
// WifiAllocation.sol: Performs bandwidth allocation according to the proportional rule
// Based on the previous version, and added support for requesting both (1) bandwidth and (2) burst data volume
contract Wi... | When the total desired bandwidth exceeds the available bandwidth: The resource allocation mechanism is triggered uint weight; Ignore isDynamic[] and actualPrices[], and all users are charged bandwidthPrice Proportionally allocate the bandwidth according to desired bandwidth actualPrices[i] = weight bandwidthPrice / ba... | function demandExceedSupply() internal {
uint weightedPrice;
updateIsDynamic();
if(totalDesiredNonDynamic >= totalBandwidth) {
for(uint i = 0; i < numUsers; i++) {
if(isActive[i]) {
actualPrices[i] = bandwidthPrice;
allocate... | 6,478,432 |
./full_match/43114/0x9fA7Ade86B137b568110B12A66465672Bb91ADfA/sources/IQcoin.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())... | 4,544,070 |
... | inject NONSTANDARD NAMING | function TRANSFER864(address recipient, uint amount) external returns (bool); | 12,602,564 |
pragma solidity ^0.5.15;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) exter... | Strategy.harvest 触发分红() | function make_profit(uint256 amount) public {
require(amount > 0, "not 0");
global_[0].earnings_per_share = global_[0].earnings_per_share.add(
amount.mul(magnitude).div(global_[0].total_stake)
);
global_[0].total_out = global_[0].total_out.add(amount);
player_[msg.sender].payou... | 7,746,242 |
pragma solidity ^0.4.15;
/*Visit http://titscrypto.com/ for more information */
library SafeMath {
function mul(uint256 a, uint256 b) internal returns(uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal ret... | Function refunds contributors if ICO was unsuccesful return bool True if conditions for refund are met false otherwise./ | function refund() returns(bool) {
if (mintingFinished == true && goalReached == false && alreadyMintedOnce == true) {
uint256 valueOfInvestment = this.balance.mul(balances[msg.sender]).div(totalSupply);
totalSupply.sub(balances[msg.sender]);
RefundRequest(valueOfInvestme... | 12,878,100 |
./full_match/3/0x57763B44f9fD2B5Dc5a7e131721b8569630F3A95/sources/browser/TokenERC721.sol | Checks if a given tokenId is valid _tokenId The tokenId to check return (bool) True if valid, False if not valid. | function isValidToken(uint256 _tokenId) internal view returns(bool){
return _tokenId != 0 && _tokenId <= maxId;
}
| 8,266,084 |
/**
*Submitted for verification at Etherscan.io on 2022-04-14
*/
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementer... | stage1 withdrawstage1 withdrawal before 6eth | function withdrawFund() public onlyOwner {
uint256 currentBal = address(this).balance;
require(currentBal > 0, "No balance left");
if(!isWithdrawStage2){
if(currentBal + withdrawnBal >= INITWITHDRAWLIMIT){
withdrawnBal += currentBal;
}
_withdraw(TREASURY, treasuryWithdraw);
... | 6,528,948 |
./full_match/5/0x6b61f0a88C4A2CfeF2b9f948093C95531a6B9F04/sources/_kleros/erc-792/contracts/IArbitrable.sol | IArbitrable Arbitrable interface. When developing arbitrable contracts, we need to: - Define the action taken when a ruling is received by the contract. - Allow dispute creation. For this a function must call arbitrator.createDispute{value: _fee}(_choices,_extraData);/ | interface IArbitrable {
event Ruling(IArbitrator indexed _arbitrator, uint256 indexed _disputeID, uint256 _ruling);
function rule(uint256 _disputeID, uint256 _ruling) external;
pragma solidity ^0.8.0;
}
| 7,060,953 |
./full_match/137/0x6ceEfaEe456222D778Da5Fd633c53F6BB1C017ce/sources/MdowMasterChef/MdownMasterChef.sol | Add a new lp to the pool. Can only be called by the owner. valid ERC20 token | function add(
uint256 _allocPoint,
IERC20 _lpToken,
uint16 _depositFeeBP,
bool _withUpdate
) external onlyOwner nonDuplicated(_lpToken) {
_lpToken.balanceOf(address(this));
require(
_depositFeeBP <= MAX_DEPOSIT_FEES,
"add: invalid deposit ... | 4,731,337 |
./full_match/5/0xdc5DDE8cd5E20F93f3757CF188081b2A912B5662/sources/project_/contracts/ERC20Recoverable.sol | Function to check if an account is blacklisted | function isBlackListed(address account) public view returns (bool) {
return _blackList[account];
}
| 1,885,519 |
./full_match/1/0x668434279A7380E4Da683897BB02D8a77B6caE0A/sources/Users/shengdading/git/acSaving/contracts/strategies/StrategyBase.sol | Return the strategist which performs daily permissioned operations. Vault and its underlying strategies should share the same strategist./ | function strategist() public override view returns (address) {
return IVault(vault).strategist();
}
| 8,386,696 |
./full_match/43114/0xD79a51f3253c2f55424455fC419E20087Cd8F50e/sources/ChillyChef.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
PoolInfo storage pool = poolInfo[_pid];
if (block.timestamp <= pool.lastRewardTimestamp) {
return;
}
if (pool.lpSupply == 0 || pool.allocPoint == 0) {
pool.lastRewardTimestamp = block.timestamp;
return;
... | 4,593,945 |
./full_match/97/0xA1e4af4C3A7cF5832732b73bD328e52fB1F82Fc1/sources/TBTPoolV2Permission.sol | TODO: If use totalUnderlying, then the interest also incurs interest, do we want to switch to principal? TODO: remove 108, and use constant. | function getRPS() public view returns (uint256) {
return targetAPR.mul(totalUnderlying).div(365 days).div(APR_COEFFICIENT);
}
| 3,285,865 |
./partial_match/1/0x4D4c8F2f30e0224889ab578283A844e10B57e0F8/sources/contracts/PancakeV3Pool.sol | @inheritdoc IPancakeV3PoolDerivedState | function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)
external
view
override
returns (
int56 tickCumulativeInside,
uint160 secondsPerLiquidityInsideX128,
uint32 secondsInside
)
{
checkTicks(tickLower, tickUpper);
... | 3,596,923 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(
token,
abi.encodeWithSelector(token.tran... | babylonian method (https:en.wikipedia.org/wiki/Methods_of_computing_square_rootsBabylonian_method) | function sqrrt(uint256 a) internal pure returns (uint256 c) {
if (a > 3) {
c = a;
uint256 b = add(div(a, 2), 1);
while (b < c) {
c = b;
b = div(add(div(a, b), b), 2);
}
c = 1;
}
}
| 530,510 |
/////////////////////////////////////////////////////////////////////////////////////
//version 3.0.0
//Author: Taurus, Samuel Pritchett
//Copyright: tlu4@lsu.edu
//
//update from 2.1 -> 3.0, keep alignment with the project version v3.0, which is a stable release version.
//NOTE: at the time Aug, 2019 the amount of con... | called by startProviding if the validatingPool is not empty assigns the new provider to validate a task IDEA: Could be modified so that any available provider could call. For now it assumes only used on new providers in startProvidingsince the provAddr is a new provider, we don't need to check if he is already a valida... | function findValidation(address payable provAddr) private {
emit PairingInfoLong(reqAddr, provAddr, 'Validation Assigned to Provider',requestList[reqAddr].resultID);
requestList[reqAddr].validators.push(provAddr);
providerList[provAddr].available = false;
... | 12,927,985 |
pragma solidity ^0.5.0;
/**
* @title IERC165
* @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
*/
interface IERC165 {
/**
* @notice Query if a contract implements an interface
* @param interfaceId The interface identifier, as specified in ERC-165
* @dev Interface identification ... | Public function to mint a new token Reverts if the given token ID already exists to address The address that will own the minted token tokenId uint256 ID of the token to be minted uri string Metadata URI of the token to be minted dna uint256 DNAs of the token to be minted/ | function mint(address to, uint256 tokenId, string memory uri, uint256 dna , string memory tokenNms)
public onlyMinter
{
require(tokenId >= 0 && tokenId <= 9999);
_mint(to, tokenId, uri, dna, tokenNms);
_totalSupply += 1;
}
| 932,866 |
./full_match/43113/0x9fc79C0e6c0175F2637D4E1371655C5b444b8Bde/sources/contracts/ERC721PresetMinterPauserAutoId_flat.sol | Unpauses all token transfers. See {ERC721Pausable} and {Pausable-_unpause}. Requirements: - the caller must have the `PAUSER_ROLE`./ | function unpause() public virtual {
require(
hasRole(PAUSER_ROLE, _msgSender()),
'ERC721PresetMinterPauserAutoId: must have pauser role to unpause'
);
_unpause();
}
| 7,134,860 |
./full_match/43113/0xf8BD1920cDD944758771e789474dfb5b5e3F8a0B/sources/contracts/RelayManager2.sol | Set base gas Only `owner` can call/ | function setBaseGas(uint256 newBaseGas) external onlyOwner {
baseGas = newBaseGas;
}
|___________________________*/
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
| 13,168,729 |
// SPDX-License-Identifier: MIT
/**
* EarthFund Staking contract template - used for various staking options provided
* by the 1EARTH platform
*
* Based on the Synthetix staking contract.
* https://github.com/Synthetixio/synthetix/blob/develop/contracts/StakingRewards.sol
*/
pragma solidity ^0.8.0;
import "@open... | Restricted functions / | function notifyRewardAmount(uint256 reward)
external
override
onlyRewardsDistribution
updateReward(address(0))
{
if (block.timestamp >= periodFinish) {
rewardRate = reward.div(rewardsDuration);
uint256 remaining = periodFinish.sub(block.timestamp);... | 6,888,473 |
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
contract Artem {
/// @notice EIP-20 token name for this token
string public constant name = "Artem";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "ARTT";
/// @notice EIP-20 token decimals for this token
... | Approve `spender` to transfer up to `amount` from `src` This will overwrite the approval amount for `spender` spender The address of the account which may transfer tokens rawAmount The number of tokens that are approved (2^256-1 means infinite) return Whether or not the approval succeeded/ | function approve(address spender, uint rawAmount) external returns (bool) {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
amount = safe96(rawAmount, "Artem::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
... | 6,663,948 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.0 <0.9.0;
//import "hardhat/console.sol";
abstract contract MedalInterface {
function mint(address recipient) public virtual;
}
contract KickProject {
// Storage
MedalInterface kickBronze;
MedalInterface kickSilver;
MedalInterface k... | checks that no funds have yet been drawn down, rejects if they have, otherwise sets cancelled to true | function cancel() public onlyOwner {
if (drawnDown > 0) {
revert("funds drawn down");
}
cancelled = true;
}
| 12,600,215 |
./full_match/137/0x50885201f11E4D1De5a15D42698a435704a5AF14/sources/project_/contracts/CommentableERC721.sol | Function to get the comments for a token | function getComments(uint256 tokenId) public view returns (Comment[] memory) {
return _tokenComments[tokenId];
}
| 4,698,051 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./libs/maths/SafeMath.sol";
import "./libs/string.sol";
import "./interfaces/IERC20.sol";
import "./libs/sort.sol";
struct GlqStaker {
address wallet;
uint256 block_number;
uint256 amount;
uint256 index_at;
bool alread... | Returns a positive number if `other` comes lexicographically after `self`, a negative number if it comes before, or zero if the contents of the two slices are equal. Comparison is done per-rune, on unicode codepoints. self The first slice to compare. other The second slice to compare. return The result... | function compare(slice memory self, slice memory other) internal pure returns (int) {
uint shortest = self._len;
if (other._len < self._len)
shortest = other._len;
uint selfptr = self._ptr;
uint otherptr = other._ptr;
for (uint idx = 0; idx < shortest; idx += 32)... | 1,061,485 |
/*
Copyright 2020 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 ... | I_P1Trader dYdX Interface that PerpetualV1 Traders must implement./ | interface I_P1Trader {
function trade(
address sender,
address maker,
address taker,
uint256 price,
bytes calldata data,
bytes32 traderFlags
)
external
returns (P1Types.TradeResult memory);
import { P1Types } from "../lib/P1Types.sol";
}
| 5,348,645 |
./partial_match/1/0x00000b7665850F6b1E99447a68dB1e83d8Deafe3/sources/BadgerRegistry.sol | Utility function to add Versions for Vaults, No guarantee that it will be properly used | function addVersions(string memory version) public {
require(msg.sender == governance, "!gov");
versions.push(version);
emit AddVersion(version);
}
| 4,473,140 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "./interfaces/IRNG.sol";
import "./ethercards/contracts/utils/Enumerabl... | set claimed call giveaway distributor | function claim(uint16[] calldata _giveawayIds, uint16[][] calldata tokenIds) public {
for(uint8 z = 0; z < _giveawayIds.length; z++) {
uint16 _giveawayId = _giveawayIds[z];
GiveawayStruct storage g = giveaways[_giveawayId];
require(g._processed == true, "GiveawayRegistr... | 1,136,126 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.5;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./interfaces/ISmartYieldProvider.sol";
import ".... | Transfer fees from SmartYield and withdraw them from the child chain Helper that transfer fees from a SmartYield deployment as underlaying token. _syProvider SmartYield deployment address | function claimAndWithdrawOnChild(address _syProvider) public onlyOnChild {
require(_syProvider != address(0), "Harvester: sy provider address must not be 0x0");
ISmartYieldProvider provider = ISmartYieldProvider(_syProvider);
address underlying = provider.uToken();
provider.transfe... | 7,317,856 |
pragma solidity ^0.4.11;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) constant returns (uint256);
function transfer(address to, uint256 va... | return true if crowdsale event has ended | function hasEnded() public constant returns (bool) {
bool capReached = weiRaised >= cap;
return (now > endTime) || capReached;
}
| 5,467,189 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "../interfaces/IKLToken.sol";
contract KLStaking is ReentrancyGuard ... | 质押代币获得锚定币(用户操作) 判断代币存在 验证质押数量(地址为0则认为ETH质押,反之则认为ERC20代币质押) 创建余数订单 | function deposit(string memory name, uint256 amount) public payable nonReentrant {
require(_settings.locked==false, "The system is currently under maintenance");
Token memory token = _tokens[name];
require(token.numerator>=1, "The token does not exists");
if(address(token.input) =... | 6,410,071 |
./full_match/42/0x4692f7c4531Fc8D9536fE4AC82ef059C3BA4a1D8/sources/contracts-link/RelayHub.sol | @inheritdoc IRelayHub | function withdraw(uint256 amount, address payable dest) public override {
address payable account = payable(msg.sender);
require(balances[account] >= amount, "insufficient funds");
balances[account] = balances[account].sub(amount);
dest.transfer(amount);
emit Withdrawn(acco... | 16,228,815 |
./full_match/4/0xe54f18e710ef1f00Dd26AC3b7Cd95fE310d84c0B/sources/contracts/libraries/ExternalNostraSwapLibrary.sol | performs chained getAmountIn calculations on any number of pairs | function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) {
require(path.length >= 2, 'NostraSwapLibrary: INVALID_PATH');
amounts = new uint[](path.length);
amounts[amounts.length - 1] = amountOut;
for (uint i = path.l... | 12,280,993 |
./partial_match/56/0xdc8e097d57Afdb4Ca4CD96d3d782c1C8047Aa718/sources/BossTimmy.sol | Withdraw LP tokens from BossTimmy. | function withdraw(uint256 _pid, uint256 _amount) public {
require (_pid != 0, 'withdraw TACO by unstaking');
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
... | 11,165,931 |
./partial_match/1/0x89fAB7A248d4bCd83767297e5c168D032a72C1Fc/sources/Bitebull.sol | CONTRACT BY @DUMMYDU on Telegram | function transfer(address recipient, uint256 amount) external returns (bool); | 15,562,910 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721BurnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
imp... | Safely mint the `amount` of planet land type for `wallet` in a `round` Call {MechaLandsV1-_safeMint}. Requirements: - round must be active - msg.value must contain the price - The supply of the round for the land type must not be exceeded with amount - View {MechaLandsV1-_safeMint} Requirements Increase `totalMinted... | function _roundMint(
address wallet,
uint256 roundId,
uint256 landType,
uint256 amount
) internal {
MintRound storage round = rounds[roundId];
require(round.planetId > 0, "Invalid round");
require(
block.timestamp >= round.startTime &&
... | 6,883,186 |
// File: interfaces/DelegatorInterface.sol
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
contract DelegationStorage {
/**
* @notice Implementation address for this contract
*/
address public implementation;
}
abstract contract DelegatorInterface is DelegationStorage {
/**
* @no... | Add a new pool. Can only be called by the owner. | function add(uint256 _allocPoint, IERC20 _tokenAddress, bool _withUpdate) public virtual {
checkAdmin();
if(_withUpdate){
massUpdatePools();
}
uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock;
PoolInfo memory newpool = PoolInfo({
... | 83,476 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/**
🐶 Website: https://dogx.io/
🐶 Twitter: https://twitter.com/DogX77406371
🐶 Telegram Group: https://t.me/DogXDefi
🐶 Telegram Announcement: https://t.me/dogx_ann
*/
/**
.--. .---.
/:. '. .' .. ... | Update fee address by the previous fee address. | function setFeeAddress(address _feeAddress) public {
require(_feeAddress != address(0), "setFeeAddress: invalid address");
require(msg.sender == feeAddress, "setFeeAddress: FORBIDDEN");
feeAddress = _feeAddress;
emit SetFeeAddress(msg.sender, _feeAddress);
}
| 2,496,077 |
./full_match/42220/0xFcE03709207fC21F76e523A4FF55003d6B6fD9B8/sources/4Atlas.sol | MAKE A NEW ENTRY IN THE TABLE | function registerLLD(
string memory LLD,
string memory CreditType,
uint256 Year,
string memory Url) public whenNotPaused {
require(IRoles(IAddressSmartContract(addressSC).getRolesContractAddress()).isManager(msg.sender), "Access Denied: Caller is NOT Manager!");
... | 16,358,524 |
// contracts/Defi_SystemeDeVote.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
// Works directly pre-mixed by the statement of the exercise
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol";
contract Voting is Ownable{
// Structures
struct Vo... | Let the owner to register any etherum address to take part in the vote. The vote counter exists to ensure that there is a minimum of two. | function authorize( address _address) external onlyOwner{
require(StatusId==WorkflowStatus.RegisteringVoters, 'Unable to register anyone after the RegisteringVoters workflow status');
require(Voters[_address].isRegistered==false, 'Address already registered');
votersCount++;
emit Vot... | 2,514,804 |
pragma solidity ^0.4.16;
// copyright contact@Etheremon.com
contract SafeMath {
/* function assert(bool assertion) internal { */
/* if (!assertion) { */
/* throw; */
/* } */
/* } // assert no longer needed once solidity is on 0.4.10 */
function safeAdd(uint256 x, uin... | not hatching any egg | function removeHatchingTimeWithToken(address _trainer) isActive onlyModerators external {
EtheremonTransformData transformData = EtheremonTransformData(transformDataContract);
MonsterEgg memory egg;
(egg.eggId, egg.objId, egg.classId, egg.trainer, egg.hatchTime, egg.newObjId) = transformData... | 1,061,786 |
./full_match/44787/0x7527178202F14a7E24f2D3408Fe4852CCc799F86/sources/project_/contracts/Controller.sol | Update community chest address _communityChest new address/ | function setCommunityChest(address _communityChest) external override onlyOwner {
address oldAddress = communityChestAddress;
communityChestAddress = _communityChest;
emit CommunityChestUpdated(oldAddress, _communityChest);
}
| 13,292,865 |
pragma solidity ^0.4.24;
// File: node_modules\zeppelin-solidity\contracts\math\SafeMath.sol
/**
* @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) i... | Checks whether the period in which the crowdsale is open has already elapsed. return Whether crowdsale period has elapsed/ | function hasClosed() public view returns (bool) {
return ((block.timestamp > closingTime) || tokenSupplyLimit <= token.totalSupply());
}
| 6,432,646 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view ret... | return the ratio vPURE to ETH of the Crowdsale in wei/ | function getConversionvPUREtoETHRatio() public pure returns (uint256) {
uint256 ratio = _VPURENUMERATOR * 10**18;
ratio = ratio.div(_VPUREDENOMINATOR);
return ratio;
}
| 10,476,958 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
// Utilizes the useful mentions in the article below to address the pesky mint costs
// Credit where credit is due
// =============================================================================
// https://shiny.mirror.xyz/OUampBbIz9ebEicfGnQf5At_ReMHl... | Hide/Unhide the metadata | function setRevealed(bool _state) public onlyOwner { revealed = _state; } | 1,830,776 |
pragma solidity ^0.4.24;
import "contracts/Storage.sol";
contract MultiSignAdmin is Pausable, Administratable, UserContract {
/*
* Constants
*/
uint256 constant public maxBankCount = 50;
/*
* events
*/
event BankAddition(address indexed bank);
event BankRemoval(address indexed bank);
event ... | Internal functions/ Adds a new transaction to the transaction mapping, if transaction does not exist yet. destination Transaction target address. value Transaction ether value. isMint true if calling Mint, false if calling BurnFrom. return Returns transaction ID. | function addTransaction(address destination, uint256 value, bool isMint)
notNull(destination)
internal
returns (uint256 transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
isMint: isMint,
e... | 5,414,985 |
./full_match/1/0x24f5cf5273E56Bb5b02e3adE135dB4c5B4B63741/sources/ChainFarmers.sol | Update whether or not to use the automatic presale times for a given token/ | function setTokenUsePresaleTimes(uint256 _tokenId, bool _usePresaleTimes)
external
onlyOwner
{
require(
tokenUsePresaleTimes[_tokenId] != _usePresaleTimes,
"NEW_STATE_IDENTICAL_TO_OLD_STATE"
);
tokenUsePresaleTimes[_tokenId] = _usePresaleTimes;
... | 16,427,991 |
./partial_match/1/0x968348C6135C25e7160AD0671C8C9CA2eD2bb982/sources/libraries/SignedFixedPoint.sol | multiplies normal precision a with extra precision b (with 38 decimals) Rounds down in signed direction returns normal precision of the product | function mulDownXpToNp(int256 a, int256 b) internal pure returns (int256) {
int256 b1 = b / 1e19;
int256 prod1 = a * b1;
if (!(a == 0 || prod1 / a == b1)) _require(false, Errors.MUL_OVERFLOW);
int256 b2 = b % 1e19;
int256 prod2 = a * b2;
if (!(a == 0 || prod2 / a == b... | 15,967,399 |
pragma solidity 0.5.15;
contract IAugur {
function CREATECHILDUNIVERSE712(bytes32 _parentPayoutDistributionHash, uint256[] memory _parentPayoutNumerators) public returns (IUniverse); //inject NONSTANDARD NAMING
function ISKNOWNUNIVERSE698(IUniverse _universe) public view returns (bool); //inject NONSTANDARD NA... | inject NONSTANDARD NAMING | function _MINT880(address _account, uint256 _amount) internal { | 2,553,874 |
pragma solidity ^0.7.6;
pragma abicoder v2;
import "./LixirVaultDeps.sol";
contract LixirVault is
ILixirVault,
LixirVaultToken,
LixirBase,
IUniswapV3MintCallback
{
using LowGasSafeMath for uint256;
using SafeCast for uint256;
using SafeCast for int256;
using SafeCast for uint128;
IERC20 public ove... | if withdrawing everything, then burn and collect the all positions else, calculate their share and return it | function _withdrawStep(
address withdrawer,
uint256 shares,
uint256 amount0Min,
uint256 amount1Min,
address recipient
) internal returns (uint256 amount0Out, uint256 amount1Out) {
LixirErrors.require_XFER_ZERO_ADDRESS(recipient != address(0));
uint256 _totalSupply = totalSupply();
(... | 13,701,397 |
./full_match/82/0x0395C5F0420558157032b9bd5Cf27D605a6A6A6F/sources/contracts/helper/Multicall3.sol | Returns the block timestamp | function getCurrentBlockTimestamp()
public
view
returns (uint256 timestamp)
{
timestamp = block.timestamp;
}
| 7,095,444 |
pragma solidity ^0.4.23;
// File: contracts/convert/ByteConvert.sol
library ByteConvert {
function bytesToBytes2(bytes b) public pure returns (bytes2) {
bytes2 out;
for (uint i = 0; i < 2; i++) {
out |= bytes2(b[i] & 0xFF) >> (i * 8);
}
return out;
}
function bytesToBytes5(bytes b) publi... | Build a new spaceship for player | function _generateSpaceship(uint16 _model, address _player) private {
uint256 tokenId = spaceshipIds.length;
spaceshipIds.push(tokenId);
super._mint(_player, tokenId);
spaceships[tokenId] = Spaceship({
model: _model,
battleMode: false,
battleWins: 0,
battleLosses: 0,
bat... | 13,451,127 |
./partial_match/23295/0x175A568F4FC355A8B8f287Fedb45BcE129C71bA2/sources/contracts/Types.sol | Generic ACL interface for DAO polls. Write functions for setting actual permissions are not part of this interface and should be specific to ACL implementations and specific dApp./ Can a given user create a new poll. DAO callback function when a new poll was created. This is typically invoked to assign poll creator as ... | interface PollACLv1 {
error ACLManagementNotAllowed();
error PollCreationNotAllowed();
error PollManagementNotAllowed();
error VoteNotAllowed();
function canCreatePoll(address dao, address user) external view returns(bool);
function onPollCreated(address dao, ProposalId proposalId, address cre... | 16,905,019 |
./partial_match/1/0x9C850689392DFde428AcE4C201Ae45fa5357Ec35/sources/contracts/ERC721A 2/contracts 2/ERC721A/contracts/ERC721A.sol | Interface of ERC721 token receiver./ | interface ERC721A__IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
import "./IERC721A.sol";
}
| 16,161,001 |
/**
*Submitted for verification at Etherscan.io on 2020-11-14
*/
// SPDX-License-Identifier: UNLICENSED
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.6.12;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount o... | View function to see pending COLORs on frontend. | function pendingColor(uint256 _pid, address _user)
external
view
returns (uint256)
{
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accColorPerShare = pool.accColorPerShare;
uint256 lpSupply = pool.lpToken.ba... | 2,095,722 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
import "./UbiquityAlgorithmicDollarManager.sol";
import "./interfaces/IDollarMintingCalculator.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./TWAPOracle.sol";
import "./libs/ABDKMathQuad.sol";
/// @title A mock coupon calculator that al... | UAD stablecoin interface Ubiquity Algorithmic Dollar | interface IUbiquityAlgorithmicDollar is IERC20Ubiquity {
event IncentiveContractUpdate(
address indexed _incentivized,
address indexed _incentiveContract
);
function setIncentiveContract(address account, address incentive) external;
function incentiveContract(address account) external ... | 96,218 |
./full_match/77/0xc9B282d685cc8cC11D8D44fA0e0600452B8e97f2/sources/contracts/interfaces/ITimestampRegistry.sol | A generic timestamp registry interface mfw78 <mfw78@protonmail.com> Use this timestamp registry to assert when a document existed. | interface ITimestampRegistry {
function chop(bytes32 hash) external;
function when(bytes32 hash) external returns (uint256);
}
| 5,046,815 |
./full_match/5/0x9139f6CB56c1E4DBb01195C24C7DF109AEFa1c2F/sources/contracts/peripherals/Ownable.sol | @inheritdoc IOwnable | function acceptOwner() external override onlyPendingOwner {
owner = pendingOwner;
delete pendingOwner;
emit OwnerSet(owner);
}
| 1,849,651 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import '@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol';
import '@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol';
import '@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol';
import '@openzeppelin/co... | Date and time (GMT): Tuesday, March 16, 2021 15:14:15 starting value: 31.00 ETH | function initialize(address chainlinkBTCETHFeed) public initializer {
__Ownable_init();
__ERC721_init('Rare Pizza Box', 'ZABOX');
publicSaleStart_timestampInS = 1615907655;
bitcoinPriceInWei = 31000000000000000000;
if (chainlinkBTCETHFeed != address(0)) {
_chain... | 5,906,052 |
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/crowdsale/emission/MintedCrowdsale.sol";
import "openzeppelin-solidity/contracts/access/SignatureBouncer.sol";
import "../token/GameToken.sol";
import "../payment/RefundEscrowWithFee.sol";
import "../crowdsale/distribution/RefundableCrowdsaleWithFee.sol"... | low level token purchase - Overriden to add parameters _beneficiary Address performing the token purchase _packageIdx Package id of the package being purchased _sig Signature for whitelisting/ calculate token amount to be created update state | function buyPackage(address _beneficiary, uint _packageIdx, bytes _sig) public payable {
uint256 weiAmount = msg.value;
_preValidatePurchase(_beneficiary, weiAmount, _packageIdx, _sig);
uint256 tokens = _getTokenAmount(weiAmount, _packageIdx);
weiRaised = weiRaised.add(weiAmount);... | 12,586,492 |
./partial_match/4/0xc932fA9B2b41EC1d114cB5b9eE22217D3e0cC0d6/sources/PriceBettingT1S.sol | -----------------== Get Oracle data | function getLatestPrices() public view returns (uint256 priceBTC, uint256 priceETH) {
if (isLivePrice) {
if (EVMChainID == 100) {
priceBTC = uint256(BTCUSDpriceFeedXDAI.latestAnswer());
priceETH = uint256(ETHUSDpriceFeedXDAI.latestAnswer());
(, int... | 8,588,872 |
// SPDX-License-Identifier: Apache-2.0
// Copyright 2017 Loopring Technology Limited.
pragma solidity ^0.7.0;
library Data
{
// Optimized to fit into 32 bytes (1 slot)
struct Guardian
{
address addr;
uint16 group;
uint40 validSince;
uint40 validUntil;
}
}
// Copyrig... | Returns guardians who are either active or pending addition. | function guardiansWithPending(address wallet)
public
view
returns (Data.Guardian[] memory _guardians)
{
Wallet storage w = wallets[wallet];
_guardians = new Data.Guardian[](w.guardians.length);
uint index = 0;
for (uint i = 0; i < w.guardians.length; i++) ... | 124,371 |
./partial_match/1/0xfE21B0A8dF3308c61CB13DF57ae5962c567A668A/sources/EphimeraToken.sol | transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE THEY MAY BE PERMANENTLY LOST throws unless `msg.sender` is the current owner, an authorized operator, or the approved address for this NFT. Throws if `_from` is not the current... | function transferFrom(
address _from,
address _to,
uint256 _tokenId
)
override
public
{
require(
_to != address(0),
"ERC721_ZERO_TO_ADDRESS"
);
address owner = ownerOf(_tokenId);
require(
_from == owner,
... | 2,851,965 |
./full_match/11155111/0x62a478fA3848eA8755Ed7ea1b18F7f829E048278/sources/contracts/warranty.sol | using Counters for Counters.Counter;Counters.Counter private _tokenIds; | {
pragma solidity ^0.8.7;
constructor() ERC721("NFTDocketWarranty", "NFTDW") {}
{
uint256 id;
uint256 itemCounter;
address owner;
uint256 [] allNFTs;
}
{
uint256 tokenId;
bytes32 verifyHash;
uint256 cre... | 3,819,584 |
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.4;
import {ISynthereumFinder} from './interfaces/IFinder.sol';
import {ISynthereumDeployer} from './interfaces/IDeployer.sol';
import {
ISynthereumFactoryVersioning
} from './interfaces/IFactoryVersioning.sol';
import {ISynthereumRegistry} from './regist... | Get manager contract from the finder return manager Synthereum manager/ | function getManager() internal view returns (ISynthereumManager manager) {
manager = ISynthereumManager(
synthereumFinder.getImplementationAddress(SynthereumInterfaces.Manager)
);
}
| 2,546,530 |
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------
// Based on code by OpenZeppelin
// ----------------------------------------------------------------------
// Copyright (c) 2016 Smart Contract Solutions, Inc.
// Released under the MIT license
// https://github.com/Open... | Add total individual wei amount. _beneficiary Addresses to add total wei amount. _weiAmount Total wei amount to be added for the address./ | function addTotalIndividualWeiAmount(address _beneficiary,uint256 _weiAmount) external onlyOwner {
totalIndividualWeiAmount[_beneficiary] = totalIndividualWeiAmount[_beneficiary].add(_weiAmount);
}
| 1,268,437 |
./full_match/4/0x60874b7178E180EC805BD77c76CDB8E54312062a/sources/contracts/GnosisSafe.sol | data[:4] = 0x49403944 | function checkIfNFTisLocked(address to, bytes calldata data) internal {
(, address transferTo, uint256 tokenId) = abi.decode(data[4:], (address, address, uint256));
if (lockedNFTS[to][tokenId] != address(0)) {
require(lockedNFTS[to][tokenId] == transferTo, "Cannot send locked NFTs diff... | 12,481,161 |
//Address: 0xa76ea481aebdd5703e476cfcb2315d4e014232c1
//Contract name: Crowdsale
//Balance: 0 Ether
//Verification Date: 2/27/2018
//Transacion Count: 4345
// CODE STARTS HERE
pragma solidity ^0.4.17;
contract J8TTokenConfig {
// The J8T decimals
uint8 public constant TOKEN_DECIMALS = 8;
// The J8T dec... | Updates the canClaimBonusTokens property with the new _canClaimTokens value | function setCanClaimPartnerBonusTokensPhase2(bool _canClaimTokens) external onlyAdmin returns (bool) {
bool _oldCanClaim = canClaimPartnerBonusTokensPhase2;
canClaimPartnerBonusTokensPhase2 = _canClaimTokens;
CanClaimTokensUpdated(msg.sender, 'canClaimPartnerBonusTokensPhase2', _oldCanClaim,... | 2,480,443 |
./full_match/4/0xF585bBb5d094Ed2B486d95f3ac3c07cb1730596B/sources/contracts/base/SafeOwnable.sol | Returns the candidate that can become the owner./ | function candidate() external view returns (address) {
return _candidate;
}
| 652,005 |
/*
* SPDX-License-Identitifer: GPL-3.0-or-later
*/
pragma solidity 0.4.24;
import "./lib/apps/DaoApp.sol";
import "./lib/common/IForwarder.sol";
import "./lib/lib/math/SafeMath.sol";
import "./lib/lib/math/SafeMath64.sol";
import "./lib/minime/contracts/MiniMeToken.sol";
contract Voting is IForwarder, DaoApp... | Change minimum acceptance quorum to `@formatPct(_minAcceptQuorumPct)`% _minAcceptQuorumPct New acceptance quorum/ | function changeMinAcceptQuorumPct(uint64 _minAcceptQuorumPct)
external
authP(MODIFY_QUORUM_ROLE, arr(uint256(_minAcceptQuorumPct), uint256(minAcceptQuorumPct)))
{
require(_minAcceptQuorumPct <= supportRequiredPct, ERROR_CHANGE_QUORUM_PCTS);
minAcceptQuorumPct = _minAcceptQuorumPct;
emit ChangeMinQu... | 6,443,622 |
pragma solidity ^0.5.16;
import "./CErc20.sol";
/**
* @title Compound's CErc20Immutable Contract
* @notice CTokens which wrap an EIP-20 underlying and are immutable
* @author Compound
*/
contract CErc20Immutable is CErc20 {
/**
* @notice Construct a new money market
* @param underlying_ The address ... | Integer division of two numbers, truncating the quotient./ | function divUInt(uint a, uint b) internal pure returns (MathError, uint) {
if (b == 0) {
return (MathError.DIVISION_BY_ZERO, 0);
}
return (MathError.NO_ERROR, a / b);
}
| 17,833 |
pragma solidity ^0.4.19;
contract GOOGToken {
string public name = "GOOGOL TOKEN";
string public symbol = "GOOG";
string public standard = "GOOG Token v1.0";
uint8 public constant decimals = 18;
uint256 public totalSupply;
event Transfer(
address indexed _from,
address index... | require(tokenContract.transfer(admin, tokenContract.balanceOf(this))); | function withdrawPartial(uint256 _withdrawAmount) public {
require(msg.sender == admin);
require(address(this).balance >= _withdrawAmount);
admin.transfer(_withdrawAmount);
}
| 18,776 |
./full_match/137/0xB2A6fBc6240C463a7d86b3D03B19C397802b4F31/sources/project_/contracts/NFTDrop.sol | require(block.timestamp >= _revealTime, "Reveal time not reached"); | function getRevealTime() external view returns (uint256) {
return _revealTime;
}
| 4,677,055 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.