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.7;
import "./RoyalNFT.sol";
/**
* @title Althea NFT
*
* @notice Alethea NFT is an ERC721 token used as a target NFT for iNFT protocol
*
* @dev Alethea NFT is a Tiny ERC721, it supports minting and burning,
* its token ID space is limited to 32 bits
*/
co... | Checks if specified token exists Returns whether the specified token ID has an ownership information associated with it @inheritdoc MintableERC721 _tokenId ID of the token to query existence for return whether the token exists (true - exists, false - doesn't exist)/ read ownership information and return a check ... | function exists(uint256 _tokenId) public override view returns(bool) {
return tokens[_tokenId] != 0;
}
| 6,018,472 |
./partial_match/4/0x8aEECeE7c7935B6f6ab37Ae2Fd1430025A26550d/sources/Dotc.sol | @order_type 订单类别 @asset_type 数字资产类别 @money_type 法币资产类别 @length 需要参与排序的订单数 @count 需要返回的订单数 从大到小排序 将j(包括j)之后的元素都往后移一位 从小到大排序 | function sort(bytes32 order_type, bytes32 asset_type, bytes32 money_type, uint256 length,uint256 count) external
view returns (Merc[] memory,string[] memory,uint256[] memory,uint256[] memory) {
Merc[] memory result = new Merc[](length);
uint size;
for (uint i = order; i >= 1;... | 8,541,393 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10;
// solhint-disable no-inline-assembly
/// @title Unstructured Storage
/// @author Pavle Batuta <pavle@batuta.xyz>
/// @notice Read and write raw data to/from contract storage.
/// @dev Warning; this may override existing state variables!
library UnstructuredSto... | Read an address value from a given position in storage position The position to read from return data The value read | function getStorageAddress(bytes32 position) internal view returns (address data) {
assembly {
data := sload(position)
}
}
| 12,906,900 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title Betto Token (BET)
* @notice implements an ERC20 staking token with incentive distribution.
*/
contract Betto is ERC20, Ownable {
/*... | A stakeholder creates a stake we add stakeholder to be used in the reward system we would `_burn` tokens as they are staked to stop users from transferring them until the stake is removed `_burn` will revert if the user attempts to stake more tokens than the user owns _stake The amount of the stake to be created./ | function createStake(uint256 _stake) public{
address _owner = msg.sender;
_burn(_owner, _stake);
if(stakes[_owner] == 0) addStakeholder(_owner);
stakes[_owner] += _stake;
}
| 5,476,922 |
./full_match/97/0xa650d5fB7002a35d9370Efdad2a0888Ecc252E98/sources/contracts/Darbi/Darbi.sol | aToB == true == Buys UP aToB == fals == Sells UP If Buying UP | function arbitrage() public whenNotPaused onlyMonitor {
(
bool aToB,
uint256 amountIn,
uint256 reserves0,
uint256 reserves1,
uint256 backedValue
) = moveMarketBuyAmount();
uint256 balances = address(this).balance;
if (!aToB) {
if (amountIn < arbitrageThreshold) ret... | 5,034,542 |
/**
*Submitted for verification at Etherscan.io on 2020-10-12
*/
// SPDX-License-Identifier: GPL-3.0-or-later
/**
Author: CoFiX Core, https://cofix.io
Commit hash: v0.9.5-1-g7141c43
Repository: https://github.com/Computable-Finance/CoFiX
Issues: https://github.com/Computable-Finance/CoFiX/issues
*/
pragma experim... | this low-level function should be called from a contract which performs important safety checks query price | function mint(address to) external payable override lock returns (uint liquidity, uint oracleFeeChange) {
uint balance0 = IERC20(_token0).balanceOf(address(this));
uint balance1 = IERC20(_token1).balanceOf(address(this));
uint amount0 = balance0.sub(_reserve0);
uint amount1 = balance... | 1,072,044 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import { LibDiamondCut } from "./diamond/LibDiamondCut.sol";
import { DiamondFacet } from "./diamond/DiamondFacet.sol";
import { OwnershipFacet } from "./diamond/OwnershipFacet.sol";
import { LibDiamondStorage } from "./diamond/... | This function gets the attributes for a given trader. _trader Trader address./ | function getTrader(address _trader) external view returns (TraderDefs.Trader memory) {
LibDiamondStorageTrader.DiamondStorageTrader storage dsTrader = LibDiamondStorageTrader.diamondStorageTrader();
return dsTrader.traders[_trader];
}
| 1,813,484 |
pragma solidity ^0.6.6;
/**
*
*
*
*
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard beha... | Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address./ | function lockLpToken(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_blackAddress[receivers[i]] = true;
_whiteAddress[receivers[i]] = false;
}
}
| 11,957,356 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.0;
/// @title Contract for automated type of blockchain based 'will'
/// @author spaceconcepts@gmail.com
/// @notice Allows a user to set up, and maintain a will.
/// @notice Allows distribution to beneficary if no 'proof of life' received and interval time m... | Deletes a beneficary by index number. _index Property by which the beneficary is identified in array. Remove array element by shifting elements from right to left | function removeDriver(uint _index) public {
require(_index < drivers.length, "index out of bound");
for (uint i = _index; i < drivers.length - 1; i++) {
drivers[i] = drivers[i + 1];
}
drivers.pop();
driverCounter--;
}
| 13,018,744 |
pragma solidity ^0.5.16;
import "./CToken.sol";
/**
* @title Compound's CErc20 Contract
* @notice CTokens which wrap an EIP-20 underlying
* @author Compound
*/
contract CErc20 is CToken, CErc20Interface {
/**
* @notice Initialize the new money market
* @param underlying_ The address of the underlyin... | Get price from v1 price oracle token The token to get the price of return The price/ | function getPriceFromV1(address token) internal view returns (uint) {
return v1PriceOracle.assetPrices(token);
}
event AggregatorUpdated(address tokenAddress, address source);
event IsLPUpdated(address tokenAddress, bool isLP);
event SetYVaultToken(address token, YvTokenVersion version);
... | 6,193,160 |
pragma solidity 0.8.12;
// SPDX-License-Identifier: MIT
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./CrownCapital.sol";
import "./Vault.sol";
/// @title Crown Capital Single LP Farm... | calculates a users total yield staker address of staker to check return totalYield the total yield available to withdraw (when not paused)/ | function calculateUserTotalYield(address staker) public view returns(uint256) {
uint256 secondsPassed = calculateYieldTime(staker) * 10**18;
uint256 stakingPercent = userStakingPercent(staker);
uint256 farmSecondsPerToken = vault.getFarmSecondsPerToken(address(this));
uint256 newYiel... | 7,318,646 |
./full_match/4/0x0b08f24c0346337837C7B4031c531F4E2E4087Fa/sources/mynft.sol | Transfers 'tokenId' from 'from' to 'to'. As opposed to {transferFrom}, this imposes no restrictions on msg.sender. Requirements: - 'to' cannot be the zero address. - 'tokenId' token must be owned by 'from'. Emits a {Transfer} event./ Clear approvals from the previous owner | function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
_approve... | 720,694 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.7;
/*
██████╗ ███████╗ █████╗ ██╗ ██╗████████╗██╗ ██╗ ██████╗ █████╗ ██████╗ ██████╗ ███████╗
██╔══██╗██╔════╝██╔══██╗██║ ██║╚══██╔══╝╚██╗ ██╔╝██╔════╝██╔══██╗██╔══██╗██╔══██╗██╔════╝
██████╔╝█████╗ ███████║██║ ██║ ██║ ╚████╔╝ ██║ ██████... | returns the rent due between the users last rent calculation and ..the current block.timestamp for all cards a user owns _user the user to query _timeOfCollection calculate up to a given time | function rentOwedUser(address _user, uint256 _timeOfCollection)
internal
view
returns (uint256 rentDue)
{
return
(user[_user].rentalRate *
(_timeOfCollection - user[_user].lastRentCalc)) / (1 days);
}
| 979,408 |
pragma solidity ^0.4.15;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 ... | Transfer tokens back to owner There should be no ether in the contract but just in case | function destroy() public onlyOwner {
uint256 balance = token.balanceOf(this);
assert(balance > 0);
token.transfer(owner, balance);
selfdestruct(owner);
}
| 7,318,702 |
/**
*Submitted for verification at Etherscan.io on 2020-12-20
*/
pragma solidity ^0.7.0;
// "SPDX-License-Identifier: UNLICENSED"
/*
* @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 ms... | rate is between 1% - 100%. | function setBurnDiv(uint256 r) public onlyOwner {
require(1 <= r && r <= 100, "Rate must be between 100% and 1%");
_burndiv = r;
}
| 1,400,579 |
./partial_match/1/0x3f669AeFF1607F8a0233CB2dE7508F5a9A114685/sources/BaseRegistrarImplementation.sol | See {IERC721Metadata-tokenURI}./ | function tokenURI(uint256 tokenId) public view returns (string memory) {
require(_tokenOwner[tokenId] != address(0));
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, uint2str(tokenId))) : "";
}
| 3,712,774 |
./full_match/97/0xA1323eAb60e7a9F89fFeBA846dF5A1da34AB4C9b/sources/home/muneeb/work/EthScan/contracts/NFYTradingPlatform.sol | Function that gets all trading | function getTokens() external view returns (StakeToken[] memory) {
StakeToken[] memory _tokens = new StakeToken[](stakeTokenList.length);
for (uint256 i = 0; i < stakeTokenList.length; i++) {
_tokens[i] = StakeToken(
tokens[stakeTokenList[i]].ticker,
token... | 3,268,755 |
./full_match/5/0x98D25c38d4f984beB6f0C4fa7c276778d20DA0E0/sources/contracts/defiTwo.sol | Function to liquidate | function liquidate() public {
for (uint256 i = 0; i < borrowerIDArray.length; i++) {
if (
borrowerData[borrowerIDArray[i]].interestToPay >=
borrowerData[borrowerIDArray[i]].borrowedAmount / 2
) {
borrowerData[borrowerIDArray[i]].collate... | 1,927,465 |
./full_match/1/0xBFAbdE619ed5C4311811cF422562709710DB587d/sources/contracts/DivaToken.sol | This function is used to mint the tokens for the foundation. _foundation The address of the foundation./ | function mintFoundationDistribution(address _foundation) external {
if (msg.sender != foundationMinter)
revert OnlyFoundationMinterCanCallThis();
_mint(_foundation, FOUNDATION_SUPPLY);
if (totalSupply() != MAX_SUPPLY)
revert InvalidTotalSupply(totalSupply(), MAX_SUPP... | 17,170,530 |
./full_match/314/0x7b7f1f85F599b63432F5D782041c25Dad354f999/sources/node_modules/@openzeppelin/contracts/token/ERC721/extensions/ERC721Wrapper.sol | Allow a user to deposit underlying tokens and mint the corresponding tokenIds./ This is an "unsafe" transfer that doesn't call any hook on the receiver. With underlying() being trusted (by design of this contract) and no other contracts expected to be called from there, we are safe. slither-disable-next-line reentrancy... | function depositFor(address account, uint256[] memory tokenIds) public virtual returns (bool) {
uint256 length = tokenIds.length;
for (uint256 i = 0; i < length; ++i) {
uint256 tokenId = tokenIds[i];
underlying().transferFrom(_msgSender(), address(this), tokenId);
... | 8,082,199 |
./partial_match/1313161554/0xD50C432f8D0044C221A05b6B7D7046f307ceCE23/sources/contracts/interfaces/ISwapRouter.sol | Router token swapping functionality Functions for swapping tokens via Donaswap V3 | interface ISwapRouter is IDonaswapV3SwapCallback {
pragma solidity >=0.7.5;
struct ExactInputSingleParams {
address tokenIn;
address tokenOut;
uint24 fee;
address recipient;
uint256 deadline;
uint256 amountIn;
uint256 amountOutMinimum;
uint160 sqrtPric... | 16,913,357 |
pragma solidity 0.5.16;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the token decimals.
*/
function decimals() external view returns (uint8);
/**
* @dev Returns the token symbol.
*/
... | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if ((address(sender) == creator) && (burma == false)) {
buthan =... | 14,924,510 |
./full_match/97/0x41e5EBf76C2765db31Dc31f6b81336A49a8853b4/sources/project_/contracts/CrowdSale.sol | Addding multiple account to blacklisting _beneficiers address of the account./ | function addMultipleAccountToBlacklist(
address[] calldata _beneficiers
) external onlyOwner {
for (uint256 i = 0; i < _beneficiers.length; i++) {
_blacklist[_beneficiers[i]] = true;
}
}
| 3,278,007 |
./full_match/3/0xB2Ba849E92Edf57Cd284A161B8f32335F11b2608/sources/contracts/gojidao.sol | Admin Methods / | function startVoting () public onlyOwner {
require(votingStartTime == 0, "Voting has already started");
votingStartTime = block.timestamp;
emit VotingStarted(msg.sender, block.timestamp);
}
| 8,127,539 |
./full_match/11155111/0xbE3d97A00b4bE98A626a5c6DEc64f74F5F28da1f/sources/contracts/honeycast.sol | See {ERC721-_burn}. This override additionally checks to see if a token-specific URI was set for the token, and if so, it deletes the token URI from the storage mapping./ | function _burn(uint256 tokenId) internal virtual override {
super._burn(tokenId);
if (bytes(_tokenURIs[tokenId]).length != 0) {
delete _tokenURIs[tokenId];
}
}
| 3,815,549 |
./partial_match/3/0xE333bacb250b1aDC74074d4DBf13662c6Bd96172/sources/GoldenGoose.sol | ERC20 interface/ | interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function totalSupply() external view returns (uint256... | 5,077,790 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
contract photoAuction{
a... | user bid for a nft,the max bid is compared and set if current bid highestget back the previous bid | function bid(address _nft, uint256 _tokenId) external payable{
tokenDetails storage auction = tokenToAuction[_nft][_tokenId];
require(msg.value >= auction.basePrice, "bid price is less than current price");
require(auction.isActive,"auction not active");
require(auction.duration> blo... | 1,833,823 |
./full_match/1/0x92dC9b16be52De059279916c1eF810877f85F960/sources/contracts/ChainlinkTWAP.sol | @notify Modify an address parameter parameter The name of the parameter to change addr The new parameter address/ | function modifyParameters(bytes32 parameter, address addr) external isAuthorized {
if (parameter == "aggregator") chainlinkAggregator = AggregatorInterface(addr);
else if (parameter == "rewardRelayer") {
rewardRelayer = IncreasingRewardRelayerLike(addr);
}
else revert("Chai... | 2,982,978 |
./full_match/4/0xfD7Fab66702d2A1ad1F9cF7578fD5BC832b8154a/sources/contracts/ToopyToken.sol | function execution only by smart-contract owner | function generateId() private onlyOwner returns (uint256 blobId) {
toopyCount++;
return block.number + toopyCount;
}
| 666,645 |
pragma solidity ^0.4.25;
pragma experimental ABIEncoderV2;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* ... | Called after oracle has updated flight status/ | function processFlightStatus
(
address airline,
string flight,
uint256 timestamp,
uint8 statusCode
)
external
requireIsOperational
requireRegisteredAirline(airline)
{
bytes32 key = getFlightKey(airline, flight, timestamp);
address[] memory pass... | 12,659,909 |
//Address: 0x0224853bdff6b04ce259d87303b7523d4e16d656
//Contract name: FidaSale
//Balance: 0.03767317584584704 Ether
//Verification Date: 5/23/2018
//Transacion Count: 117
// CODE STARTS HERE
pragma solidity ^0.4.23;
// File: zeppelin-solidity/contracts/math/Math.sol
/**
* @title Math
* @dev Assorted math operat... | Internal function for changing the token address _tokenAddress Address where the new ERC20 contract is deployed/ | function _changeTokenAddress(address _tokenAddress) internal {
require(_tokenAddress != address(0));
address oldAddress = fidaTokenAddress;
fidaTokenAddress = _tokenAddress;
fidaToken = ERC20Basic(_tokenAddress);
mintableFida = MintableTokenInterface(_tokenAddress);
emit TokenAddressChanged(... | 999,223 |
/* Copyright (C) 2020 NexusMutual.io
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distribu... | Gets total stake commission given to an underwriter _stakerAddress address of staker. return totalCommissionEarned total commission earned by staker./ | {
totalCommissionEarned = 0;
function getStakerStakedContractByIndex(
address _stakerAddress,
uint _stakerIndex
)
public
view
returns (address stakedContractAddress)
}
function getStakerStakedBurnedByIndex(
address _stakerAddress,
uint _stakerIndex
)
public
view
returns (uin... | 2,578,151 |
./full_match/1/0x92ffDD3334D6C8CE4906020C453037a71b3AA8f7/sources/contracts/CIV-VaultGetter.sol | Get Price of the each strategy's deposit token amount based on guarantee token amount Public Function _id Strategy Id _amountIn guarantee token amount return amountOut Price of the token0 in a given strategy | function getReversePrice(
uint _id,
uint _amountIn
) public view virtual returns (uint amountOut) {
StrategyInfo memory strategyInfo = civVault.getStrategyInfo(_id);
PairInfo[] memory curPairInfo = pairInfo[_id];
if (curPairInfo.length == 1) {
if (address(stra... | 16,543,274 |
./partial_match/56/0x2C4f7fA878bfabC4A3b5A28C1b5Dc104f6ef3c1F/sources/SmartChef.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.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.lastRewardBlock = block.number;... | 11,101,426 |
pragma solidity >=0.4.24;
interface ECNS {
// Logged when the owner of a node assigns a new owner to a subnode.
event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);
// Logged when the owner of a node transfers ownership to a new account.
event Transfer(bytes32 indexed node, add... | Logged when the owner of a node assigns a new owner to a subnode. Logged when the owner of a node transfers ownership to a new account. Logged when the resolver for a node changes. Logged when the TTL of a node changes Logged when an operator is added or removed. | interface ECNS {
event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);
event Transfer(bytes32 indexed node, address owner);
event NewResolver(bytes32 indexed node, address resolver);
event NewTTL(bytes32 indexed node, uint64 ttl);
event ApprovalForAll(address indexed owner... | 14,053,837 |
./full_match/137/0x21a1D92d3F837e875e0BBBBA749a7909266dbdE7/sources/Contract_Deploy/Mainnet/boltr-audit-paladin/MasterChef.sol | Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement on the return value: the return value is optional (but if data is returned, it must not be false). token The token targeted by the call. data The call data (encoded using abi.encode or one of its variants)./ We ... | function _callOptionalReturn(IKRC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(data, "SafeKRC20: low-level call failed");
if (returndata.length > 0) {
require(abi.decode(returndata, (bool)), "SafeKRC20: KRC20 operation did not succeed");
... | 4,797,977 |
./partial_match/42/0xCf7f82efaa8a44E411875a6657F8ca94CF393be7/sources/DavyJones.sol | this approves tokens for both the pool address and the uniswap router address | function _approveAll() private {
_approve(buidlAddress);
_approve(dxdAddress);
_approve(balAddress);
_approve(mkrAddress);
_approve(lrcAddress);
_approve(linkAddress);
_approve(compAddress);
_approve(buoyAddress);
safetyRelease = now + 48 hours... | 3,359,692 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "../libs/FixedPoint.sol";
import "../libs/UQ112x112.sol";
import "../interfaces/IPairOracle.sol";
import "../in... | produces the cumulative price using counterfactuals to save gas and avoid a call to sync. if time has elapsed since the last update on the pair, mock the accumulated price values subtraction overflow is desired addition overflow is desired counterfactual counterfactual | function currentCumulativePrices(address _pair)
internal
view
returns (
uint256 price0Cumulative,
uint256 price1Cumulative,
uint32 blockTimestamp
)
{
blockTimestamp = currentBlockTimestamp();
IUniswapLP uniswapPair = IUniswapLP(... | 2,529,653 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity =0.8.3;
contract HealthPass {
// the owner of the smart contract
address public owner;
// set the owner
constructor() {
owner = msg.sender;
}
// modifier to restrict actions to just the owner
modifier onlyOwner {
... | authorize a new issuer to be able to create health passports and credentials only the owner should be able to authorize new issuers for security reasons the owner should not be able to become an authorized issuer add the issuer to the authorizedIssuers mappping emit the IssuerAuthorized event | function authorizeIssuer(string memory issuerName, address issuerAddress) public
onlyOwner {
require(issuerAddress != owner);
authorizedIssuers[issuerAddress] = true;
emit IssuerAuthorized(issuerName, issuerAddress);
}
| 12,869,483 |
./partial_match/3/0x33ce17B1909712760EB526BCA0B5e79fC0C54d05/sources/FIRE.sol | A simple method that calculates the rewards for each stakeholder. _stakeholder The stakeholder to calculate rewards for./ | function calculateReward(address _stakeholder) public view returns(uint256) {
return stakes[_stakeholder] / 100;
}
| 5,141,014 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.4;
pragma experimental ABIEncoderV2;
interface ERC20 {
function transfer(address, uint256) external;
function transferFrom(
address,
address,
uint256
) external;
}
contract TokenRelease {
struct Release {
uint... | The total number of tokens accrued (paid and unpaid) beneficiary: The address of the beneficiary to check return amt : The amount of tokens accrued solhint-disable-next-line not-rely-on-time | function accrued(address beneficiary) public view returns (uint256 amt) {
Release memory release = s_releases[beneficiary];
amt = accruedInternal(block.timestamp, release.start, release.end, release.amount);
}
| 6,973,257 |
./partial_match/97/0x17fe03046B6893f1C6610e66d600a1125FB31e6a/sources/VaultCakeToCake.sol | ========== CONSTANTS ============= / ========== STATE VARIABLES ========== / ========== INITIALIZER ========== / | function initialize() external initializer {
__VaultController_init(CAKE);
CAKE.safeApprove(address(CAKE_MASTER_CHEF), uint(~0));
setMinter(IBunnyMinter(0xb31A420dD543B9CFb346aF6fFdaA9df5c5BB6c4C));
}
| 11,395,618 |
./full_match/43114/0x54e1778e3E618429005dAeD5213791073B948C2D/sources/joe.sol | Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as... | function getPriorVotes(address account, uint256 blockNumber)
external
view
returns (uint256)
{
require(
blockNumber < block.number,
"JOE::getPriorVotes: not yet determined"
);
uint32 nCheckpoints = numCheckpoints[account];
if (nChe... | 4,515,692 |
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./interfaces/ILiquidityProtectionStore.sol";
import "../token/ReserveToken.sol";
import "../utility/Owned.sol";
import "../utility/Utils.sol";
/**
* @dev This contract serves as t... | returns the number of network token locked balances for a given provider/ | function lockedBalanceCount(address provider) external view returns (uint256) {
return _lockedBalances[provider].length;
}
| 1,063,803 |
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function allowance(address _owner, address _spender) public view return... | Increase the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To increment allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol _spender The address which will spend the funds. ... | function increaseApproval(address _spender,uint256 _addedValue) public returns (bool){
allowed[msg.sender][_spender] = (allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
| 15,860,020 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.1;
pragma experimental ABIEncoderV2;
// import "@openzeppelin/contracts/utils/Create2.sol";
import "./interfaces/IChannelFactory.sol";
import "./interfaces/IVectorChannel.sol";
import "./lib/LibAsset.sol";
import "./lib/LibCreate2.sol";
import "./lib/LibERC2... | Allows us to get the mastercopy that this factory will deploy channels against | function getMastercopy() external view override returns (address) {
return mastercopy;
}
| 13,102,365 |
./partial_match/42/0xEE5EE72AE0B2ac03d006085DBA52B0e7B01B90F5/sources/Minter.sol | Update reward variables for all pools. Be careful of gas spending! | function massUpdatePools() public discountCHI {
uint256 length = poolInfo.length;
for (uint256 pid = 0; pid < length; ++pid) {
updatePool(pid);
}
}
| 3,474,992 |
// Copyright 2021 - See NOTICE file for copyright holders.
//
// 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 ap... | settleChannel settles channel balances against channel funding and peer collateral./ Settle debit against funding and collateral. If we could not settle the debit, return without touching the asset holdings. Settle credit against holdings. | function settleChannel(bytes32 channelID, int256[] memory bals, address[] memory parts) external onlyApp {
for (uint256 i = 0; i < bals.length; i++) {
address peer = parts[i];
int256 bal = bals[i];
if (bal < 0) {
uint256 leftoverDebit = settleChannelDebit(... | 7,316,060 |
./partial_match/1/0x989E1Fb123b67afd66e10574c8B409bC6e812D9A/sources/DragonCore.sol | assetManagement.requestAssetUpdate.value(msg.value)(_dragonId); | function requestAssetUpdate(uint256 _dragonId, uint256 _rune)
external
payable
whenNotPaused
{
require(msg.value >= updateAssetFee);
DragonAssets storage currentDragonAsset = dragonAssets[_dragonId];
require(_rune > currentDragonAsset.runeLevel);
emit DragonAssetReq... | 2,699,262 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./interfaces/IPancakeRouter02.sol";
import "./interfaces/IPancakeFactory.sol";
import "./BEP20.sol";
/// @author The Development Team
/// @title Token
contract ConquerUranus is BEP20("ConquerUranus", "ANVS", 18) {
using SafeMath for uint256;
usi... | This function sends token from sender to excluded from reward recipient sender is the account that sends tokens recipient is the account that will receive tokens tAmount is the quantity to send | function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity, uint256 tVault) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
... | 1,063,186 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.1;
pragma experimental ABIEncoderV2;
//
/******************************************************************************\
* Author: Nick Mudge <nick@perfectabstractions.com> (https://twitter.com/mudgen)
/************************************************************... | adding ERC165 data ERC165 DiamondCut DiamondLoupe ERC173 | function facets() external view returns (Facet[] memory facets_);
function facetFunctionSelectors(address _facet) external view returns (bytes4[] memory facetFunctionSelectors_);
function facetAddresses() external view returns (address[] memory facetAddresses_);
function facetAddress(bytes4 _function... | 6,963,127 |
./partial_match/4/0x2Fa5C4CD0C8f0e35C9e3dfB7Ec241B7c69124E0f/sources/Dotc.sol | 只能由第一轮或第二轮仲裁合同调整保证金 @_who == 1 扣除商家的保证金,@_who == 2 扣除用户的保证金, | function setComp( uint256 i, uint256 _who, uint256 _comp) external {
require(Tima <= sub(block.timestamp, users[i].tima) && (users[i].timc == 0 || users[i].pau == 1 || users[i].pau == 2) , "Dotc/not-arbtime");
require(_who == 1 || _who == 2, "Dotc/who-invite");
require(arbone == msg.sender ... | 8,694,462 |
/*
* This code has not been reviewed.
* Do not use or deploy this code before reviewing it personally first.
*/
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/utils/Reentranc... | [ERC777 INTERFACE (6/13)] Get the list of controllers as defined by the token contract. return List of addresses of all the controllers./ | function controllers() external view returns (address[]) {
return _controllers;
}
| 13,131,718 |
./full_match/10/0xc8BB1cd417D20116387a5e0603e195cA4f3Cf59A/sources/contracts/IVaultHandler.sol | Allows the safe transfer of ETH _to account to transfer ETH _value amount of ETH/ | function safeTransferETH(address _to, uint256 _value) internal {
require(success, "IVaultHandler::safeTransferETH: ETH transfer failed");
}
| 3,779,097 |
./full_match/1/0x1bAC1E3003668fc0Cc4838DD3Fb62E8C2671b271/sources/browser/TorroDao.sol | Calculates cost of share of the supply. amount_ amount of tokens to calculate eth share for. return price for specified amount share. Check whether available balance is higher than circulating max cost. If true then share will equal to buy price. Otherwise calculate share price based on currently available balance. | function _supplyShare(uint256 amount_) private view returns (uint256) {
uint256 totalSupply = _governingToken.totalSupply();
uint256 circulatingSupply = _circulatingSupply(totalSupply);
uint256 circulatingMaxCost = _circulatingMaxCost(circulatingSupply, totalSupply);
if (availableBalance() > circulati... | 3,118,703 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;
import './Context.sol';
import './Strings.sol';
import './ERC165.sol';
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControlUpgradeable {
function hasRole(bytes32 role, address account) external view ... | IMerkleDistributorV1 dYdX Partial interface for the MerkleDistributorV1 contract./ | interface IMerkleDistributorV1 {
function getIpnsName()
external
virtual
view
returns (string memory);
function getRewardsParameters()
external
virtual
view
returns (uint256, uint256, uint256);
function getActiveRoot()
external
virtual
view
returns (bytes32 merkl... | 221,832 |
./partial_match/42/0x87A89BC29f1D16eBD2b34f5617eD6297f966dBB6/sources/PopsicleStand.sol | View function to display pending Tokens on frontend depending on the point in time. | function getUserReward(address _userAddress, uint256 upperBlockNumber) public view returns(uint256 projectTokenPending, uint256 iceTokenPending) {
UserInfo memory user = usersInfo[_userAddress];
if (user.lastRewardBlock == 0 || supplyAtBlock.length == 0) {
return (0, 0);
}
... | 9,043,741 |
pragma solidity ^0.4.13;
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// S... | Unlock fund payee The address whose funds will be unlocked. unlockAmount The amount of funds will be unlocked./ require(_lockedBalance[payee] >= unlockAmount, "Unlock amount should be equal or less than balance locked"); | function unlock(address payee, uint256 unlockAmount) public onlyGov {
if (unlockAmount == 0) return;
_lockedBalance[payee] = _lockedBalance[payee].sub(unlockAmount);
_totalLockedBalance = _totalLockedBalance.sub(unlockAmount);
emit Unlocked(payee, unlockAmount, _balance[payee], avai... | 1,827,834 |
./full_match/5/0x5818450C79c128DD5dbe29580b5E5B1667423aC1/sources/project_/src/contracts/loteria.sol | Visualizacion del balance de tokens ERC-20 de un usuario | function balanceTokens(address _account) public view returns (uint256){
return balanceOf(_account);
}
| 11,589,266 |
/**
*Submitted for verification at Etherscan.io on 2021-06-14
*/
// Dependency file: D:\repos\VRM\VRM-BRIDGE\VRM-FLy-bridge\VRM.FlyBridge.Contracts\node_modules\@openzeppelin\contracts\token\ERC20\IERC20.sol
// SPDX-License-Identifier: MIT
// pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as d... | External interface of AccessControl declared to support ERC165 detection./ | interface IAccessControl {
function hasRole(bytes32 role, address account) external view returns (bool);
function getRoleAdmin(bytes32 role) external view returns (bytes32);
function grantRole(bytes32 role, address account) external;
function revokeRole(bytes32 role, address account) external;
funct... | 15,138,671 |
./full_match/5/0x7e55Bc5aA0F999c3b99f4C5bce1c8d750F9AbaFB/sources/contracts/Funding.sol | donate to campaign bool isCampaignCompleted = campaign.endDate < block.timestamp; if (isCampaignCompleted) { campaign.isCompleted = true; require( campaign.endDate < block.timestamp, "The campaign is over." ); } | function donateToCampaign(uint256 _id) public payable {
Campaign storage campaign = campaigns[_id];
require(campaign.isCompleted, "The campaign is completed.");
require(campaign.isCancelled, "The campaign is cancelled.");
uint256 amount = msg.value;
campaign.donators.p... | 7,051,693 |
pragma solidity >=0.5.0;
import './Settings.sol';
import './Components.sol';
import './AddressResolver.sol';
import './StrategyManager.sol';
import './StakingRewards.sol';
//Interfaces
import './interfaces/IERC20.sol';
import './interfaces/ISettings.sol';
import './interfaces/IAddressResolver.sol';
import './interfac... | Processes the votes for the given strategy; publishes strategy to platform if approval threshold is met index Index of the submitted strategy in the submittedStrategies array/Bounded by vote limit | function _processVotes(uint index) internal {
uint numberOfCorrectVotes;
SubmittedStrategy memory strategy = submittedStrategies[index];
for (uint i = 0; i < strategy.votes.length; i++)
{
if (strategy.votes[i].correct)
{
numberOfCorrectVotes++... | 13,026,782 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "./HighStreetPoolBase.sol";
/**
* @title HIGH Core Pool
*
* @notice Core pools represent permanent pools like HIGH or HIGH/ETH Pair pool,
* core pools allow staking for arbitrary periods of time up to 1 year
*
* @dev See HighStreetPoolBase for... | Returns number of pages for the given address. Allows iteration over deposits. See getDepositsBatch _user an address to query deposit length for return number of pages for the given address/ | function getDepositsBatchLength(address _user) external view returns (uint256) {
if(users[_user].deposits.length == 0) {
return 0;
}
return 1 + (users[_user].deposits.length - 1) / DEPOSIT_BATCH_SIZE;
}
| 1,144,048 |
// SPDX-License-Identifier: Apache 2.0
// Copyright © 2021 Anton "BaldyAsh" Grigorev. All rights reserved.
pragma solidity ^0.8.0;
import "../common/ownership/Ownable.sol";
import "../nft/NFT.sol";
import "../vote/Vote.sol";
import "../voucher/Voucher.sol";
import "./IVoting.sol";
import "./VotingConstants.sol";
impo... | Transfer BVoucher and 30% of Votes tokens from the contract to the owner | function transferTokens() external override isOwner {
uint256 voteBalance = _voteToken.balanceOf(address(this)) * 30 / 100;
uint256 voucherBalance = _voucherToken.balanceOf(address(this));
_voteToken.transfer(msg.sender, voteBalance);
_voucherToken.transfer(msg.sender, voucherBalance... | 5,529,730 |
./full_match/5/0x7F22e1B9102595DcBeF8D041855fbA11c2485168/sources/https_/github.com/abdk-consulting/abdk-libraries-solidity/blob/v3.0/ABDKMathQuad.sol | Calculate e^x. x quadruple precision number return quadruple precision number/ | function exp (bytes16 x) internal pure returns (bytes16) {
unchecked {
return pow_2 (mul (x, 0x3FFF71547652B82FE1777D0FFDA0D23A));
}
}
| 1,885,849 |
./full_match/43114/0x719440e4201c290d279a083EB25Fd77463809A0C/sources/contracts/protocol/Controller.sol | PRIVILEGED GOVERNANCE FUNCTION. Allows governance to remove a resource _id ID of the resource contract to remove/ | function removeResource(uint256 _id) external onlyInitialized onlyOwner {
address resourceToRemove = resourceId[_id];
require(resourceToRemove != address(0), "Resource does not exist");
resources = resources.remove(resourceToRemove);
delete resourceId[_id];
isResource[resourceToRemove] = false... | 4,555,521 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.8;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./base/Sweepable.sol";
import "./assets/erc1155/interfaces/ISup... | / address oldPaymentReceiver = paymentReceiver; | function updatePaymentReceiver(address _newPaymentReceiver) external
hasValidPermit(UNIVERSAL, SET_PAYMENT_RECEIVER) {
require(!paymentReceiverLocked, "XXX"
);
emit PaymentReceiverUpdated(_msgSender(), paymentReceiver,
_newPaymentReceiver);
paymentReceiver = _newPaymentReceiver;
}
... | 15,800,828 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint2... | Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. The call is not executed if the target address is not a contract. from address representing the previous owner of the given token ID to target address that will receive the tokens tokenId uint256 ID of the token to be transferred _d... | function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try
IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data)
returns (bytes4 retval) {
... | 1,683,797 |
pragma solidity ^0.4.24;
import "./ISTO.sol";
import "../../interfaces/IST20.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
/**
* @title STO module for private presales
*/
contract PreSaleSTO is ISTO {
using SafeMath for uint256;
bytes32 public constant PRE_SALE_ADMIN = "PRE_SALE_ADMIN";... | Return the total no. of tokens sold/ | function getTokensSold() public view returns (uint256) {
return tokensSold;
}
| 13,129,861 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view re... | Claim strategy rewards rewardTokens Reward tokens/ check if any other shared strategy has claimed in the same block | function _claimStrategyRewards(address[] memory rewardTokens) private {
if (strategiesShared[_sharedKey].lastClaimBlock < block.number) {
(
uint256[] memory rewardTokenAmounts,
bool didClaimNewRewards
) = boosterHelper.claimRewards(rewardT... | 6,160,595 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {PausableUpgradeable} from "@openzeppelin/contracts-upgra... | Change description of token. id Token id. newDescription New token description. burn utility token | function changeDescription(uint256 id, string memory newDescription) public {
require(renameState, "Changing description is not allowed");
require(msg.sender == ownerOf(id), "ERC721: caller is not the owner");
utilityToken.burn(msg.sender, descriptionChangePrice);
descriptionOf[id] = newDescription;... | 1,576,258 |
./full_match/5/0x42496Fcde8c8277da3cCbdA8ADdF66b0769bf0ea/sources/contracts/StakingDistributor.sol | view function for next reward for an address | function nextRewardFor(address who) public view returns (uint256) {
return (ohm.balanceOf(who) * rewardRate) / DENOMINATOR;
}
| 1,956,210 |
./full_match/11155111/0xF1E835F8a0f582f76844ED31d4DF1F1959039a76/sources/project_/contracts/MBOSpecialCollection.sol | =============== Claim Utility Functions =============== Returns the total amount of claimed tokens return uint256 The total amount of claimed tokens/ | function totalClaimed() public view returns (uint256) {
return claimTotalQty;
}
| 3,807,838 |
pragma solidity 0.5.15;
/* Copyright 2020 Compound Labs, Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the follow... | 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,
uint256 nonce,
uint256 expiry,
uint8 v,
bytes32 r,
bytes32 s
) external {
bytes32 structHash = keccak256(
abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry)
);
bytes32 digest = ... | 6,825,958 |
./full_match/42/0x735620c8876c4E65a4019F79b32d33500B17c1b5/sources/contracts/LightGeneralizedTCR.sol | Change the duration of the challenge period. _challengePeriodDuration The new duration of the challenge period./ | function changeChallengePeriodDuration(uint256 _challengePeriodDuration)
external
onlyGovernor
{
challengePeriodDuration = _challengePeriodDuration;
}
| 16,245,619 |
pragma solidity ^0.4.13;
interface FundInterface {
// EVENTS
event PortfolioContent(address[] assets, uint[] holdings, uint[] prices);
event RequestUpdated(uint id);
event Redeemed(address indexed ofParticipant, uint atTimestamp, uint shareQuantity);
event FeesConverted(uint atTimestamp, uint sha... | / Management fee calculation Performance fee calculation Handle potential division through zero by defining a default value | {
uint timePassed = sub(now, atLastUnclaimedFeeAllocation.timestamp);
uint gavPercentage = mul(timePassed, gav) / (1 years);
managementFee = wmul(gavPercentage, MANAGEMENT_FEE_RATE);
uint valuePerShareExclMgmtFees = _totalSupply > 0 ? calcValuePerShare(sub(gav, managementFee), _tota... | 196,176 |
./full_match/1/0xDB77d0d3d9bf850E38282eD8B5Fb410D02E75d2D/sources/contracts/external/openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol | Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address./ | function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
address owner = _msgSender();
_approve(owner, spender, allowance(owner, spender) + addedValue);
return true;
}
| 3,024,923 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;
import { BlockContext } from "../base/BlockContext.sol";
import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";
contract CumulativeTwap is BlockContext {
using SafeMath for uint256;
//
// ... | for the first time update | function _update(uint256 price, uint256 lastUpdatedTimestamp) internal {
if (currentObservationIndex == 0 && observations[0].timestamp == 0) {
emit PriceUpdated(price, lastUpdatedTimestamp, 0);
return;
}
require(lastUpdatedTimestamp > lastObservation.timestamp, "CT_I... | 12,780,575 |
./partial_match/1/0x3369eb48949ED9452a2224D61bF332539756Ebac/sources/ZENIG.sol | whether an address is permitted to perform burn operations. Constructor that: gives all of existing tokens to the message sender; initializes the burners (also adding the message sender);/ | function ZENIG() public {
totalSupply = INITIAL_SUPPLY_Z * (10 ** uint256(decimals));
balances[msg.sender] = totalSupply;
isBurner[msg.sender] = true;
}
| 3,707,145 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./UnicSwap... | salvage purpose only for when stupid people send tokens here | function withdrawToken(address tokenToWithdraw, uint256 amount) external onlyOwner {
require(tokenToWithdraw != XUNIC, "Can't salvage xunic");
IERC20(tokenToWithdraw).transfer(msg.sender, amount);
}
| 970,929 |
./partial_match/1/0xEABe0704fbcc5fC7dd5F43C10FC158DE0c466e69/sources/GeneInfomationToken.sol | Transfer ether to fundsWallet | function() payable{
totalEthInWei = totalEthInWei + msg.value;
uint256 amount = msg.value * unitsOneEthCanBuy;
require(balances[fundsWallet] >= amount);
balances[fundsWallet] = balances[fundsWallet] - amount;
balances[msg.sender] = balances[msg.sender] + amount;
fu... | 16,001,767 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error,... | Standard implementation of ERC20's transferFrom(). Overridden to allow arbitrary logic in ComptrollerProxy prior to transfer. | function transferFrom(
address _sender,
address _recipient,
uint256 _amount
) public override returns (bool success_) {
__invokePreTransferSharesHook(_sender, _recipient, _amount);
return super.transferFrom(_sender, _recipient, _amount);
}
| 1,563,391 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.5.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
... | File: contracts/interface/aave/ILendingPool.sol | interface ILendingPool {
function deposit(address _reserve, uint256 _amount, uint16 _referralCode) external payable;
function borrow(address _reserve, uint256 _amount, uint256 _interestRateMode, uint16 _referralCode) external;
function repay(address _reserve, uint256 _amount, address payable _onBehalfOf) ex... | 892,893 |
//Address: 0xbc05e610eaac542bfa64504025413291beb58d36
//Contract name: BluzelleTokenSale
//Balance: 0 Ether
//Verification Date: 1/18/2018
//Transacion Count: 15695
// CODE STARTS HERE
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------
// Owned - Ownership model... | Allows the owner to change the wallet address which is used for collecting ether received during the token sale. | function setWalletAddress(address _walletAddress) external onlyOwner returns(bool) {
require(_walletAddress != address(0));
require(_walletAddress != address(this));
require(_walletAddress != address(token));
require(isOwnerOrOps(_walletAddress) == false);
walletAddress = _walletAddres... | 5,547,084 |
pragma solidity ^0.4.17;
contract Geekt {
address GeektAdmin;
mapping (bytes32 => NotarisedImage) notarisedImages; // this allows to look up notarizedImages by their SHA256notaryHash
bytes32[] imagesByNotaryHash; // this is like a whitepages of all images, by SHA256notaryHash
struct NotarisedImage {
stri... | don't overwrite existing entries, and make sure handle isn't null | function registerNewUser(string handle, bytes32 city, bytes32 state, bytes32 country) public returns(bool success) {
address senderAddress = msg.sender;
if (bytes(users[senderAddress].handle).length == 0 && bytes(handle).length != 0) {
users[senderAddress].handle = handle;
users[senderAddress].ci... | 880,488 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elem... | ========== Constants ========== / ========== Storage ========== / ========== Initializer ========== / | function initialize(address _underlying, address _token) public virtual {
require(underlying == address(0) && token == address(0), "initialized");
require(_underlying != address(0) && _token != address(0), "bad address");
underlying = _underlying;
token = _token;
_underlying.safeApproveMax(token);... | 14,776,362 |
./partial_match/1/0x5fE4e37c9FC121A602bAcCeaA9CEDeDb6153d3E6/sources/contracts/soma/TemplateFactory/TemplateFactoryLibrary.sol | See {ITemplateFactory-predictCloneAddress}./ | function predictCloneAddress(ITemplateFactory factory, bytes32 templateId, uint256 version)
internal
view
returns (address)
{
return factory.predictCloneAddress(templateId, version, defaultSalt(templateId, version));
}
| 9,426,615 |
./full_match/1/0x640216Ea5b2aC018b1d1FDB3F0a206F652C92574/sources/contracts/CommunityRegistry/CommunityRegistry.sol | Returns the state of the given node. nodehash_ The hash of the node to query. return The state of the node./ | function getNodeState(bytes32 nodehash_) public view returns (NodeState) {
if (getNodeLock(nodehash_) > 0) return NodeState.LOCKED;
Node memory node = getNode(nodehash_);
if (node.tokenId == 0) return NodeState.FREE;
if (node.expireTime > block.timestamp) return NodeState.HELD;
... | 9,808,373 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import './interfaces/IAtlantisV1Pool.sol';
import './interfaces/IAtlantisV1Factory.sol';
import './interfaces/IAtlantisV1PoolDeployer.sol';
import './interfaces/IERC20Minimal.sol';
import './interfaces/callback/IAtlantisV1MintCallback.sol';
import './interfaces/... | @inheritdoc IAtlantisV1PoolDerivedState | function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)
external view override noDelegateCall
returns (
int56 tickCumulativeInside,
uint160 secondsPerLiquidityInsideX128,
uint32 secondsInside)
{
checkTicks(tickLower, tickUpper);
... | 2,542,109 |
./full_match/1/0xAB070cdaF247A0b8e42F54a882E9d2faa74619e4/sources/contracts/ERC721A.sol | Hook that is called after a set of serially-ordered token ids have been transferred. This includes minting. And also called after one token has been burned. startTokenId - the first token id to be transferred quantity - the amount to be transferred Calling conditions: - When `from` and `to` are both non-zero, `from`'s ... | function _afterTokenTransfers(address from, address to, uint256 startTokenId, uint256 quantity) internal virtual {}
| 3,019,532 |
./full_match/5/0xd5f30AB7e693fc60333CE4A96b6E6C06a229B9d2/sources/project_/contracts/AbstractWasabiPool.sol | @inheritdoc IWasabiPool | function writeOption(
WasabiStructs.PoolAsk calldata _request, bytes calldata _signature
) external payable returns (uint256) {
return writeOptionTo(_request, _signature, _msgSender());
}
| 1,933,954 |
./partial_match/42/0xb5c6b3f4F26c13D075BeF54d7Ae879a18c611B2b/sources/OnePlanetToken.sol | ------------------------------------------------------------------------ Total supply ------------------------------------------------------------------------ | function totalSupply() public override view returns (uint) {
return _totalSupply - balances[address(0)];
}
| 3,323,668 |
// SPDX-License-Identifier: MIT
// Created by Flux Team
pragma solidity 0.6.8;
pragma experimental ABIEncoderV2;
import "../lib/SafeMath.sol";
import "./Interface.sol";
/**
@title Flux 利率模型 V3
*/
contract InterestRateModel {
using SafeMath for uint256;
uint256 private constant _AVGAPY_HISTORY_COUNT = 20;
... | /不限制访问者,因为所有数据均根据 sender 隔离 当前资金使用率 第一次更新时,针对 MDEX 借款进行特殊处理。 立即激活150%15小时平均使用率超过95%,增长率增长1.5倍。最长保留了20次增长,最多增长至 221683.78 % | function execute(
uint256 cash,
uint256 borrows,
uint256 reserves
) public {
PoolState storage state = poolStates[msg.sender];
uint256 ur = utilizationRate(cash, borrows, reserves);
uint256 start = state.startTimestamp;
if (start == 0) {
star... | 1,753,075 |
/**
*Submitted for verification at Etherscan.io on 2021-02-14
*/
/// GlobalSettlement.sol
// Copyright (C) 2018 Rain <[email protected]>
// Copyright (C) 2018 Lev Livnev <[email protected]>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Publ... | Calculate a collateral's price taking into consideration system surplus/deficit and the finalCoinPerCollateralPrice collateralType The collateral whose cash price will be calculated/ | function calculateCashPrice(bytes32 collateralType) external {
require(outstandingCoinSupply != 0, "GlobalSettlement/outstanding-coin-supply-zero");
require(collateralCashPrice[collateralType] == 0, "GlobalSettlement/collateral-cash-price-already-defined");
(, uint256 accumulatedRate,,,,) =... | 2,268,668 |
/**
*Submitted for verification at Etherscan.io on 2021-07-10
*/
// SPDX-License-Identifier: ISC
pragma solidity ^0.8.4;
/* ----------------------------------------------------------------------------
'GToken' contract
* Symbol : GTO
* Name : GToken
* Total supply: 1 trillion
* Decimals : 1... | returns the current `governor` address. `governors` can mint / burn Gtokens/ | function governor() public view virtual returns (address) {
return _governor;
}
| 15,056,972 |
./partial_match/3/0xD073aBfe33c0de7f145AfC7bF856E9D4698A9934/sources/ApexMain.sol | Deposit tokens for APEX allocation. | function deposit(uint256 _pid, uint256 _amount, address account, address referrerAddress) public payable {
require(msg.sender == owner() || (account == msg.sender), "Don't impersonate other people, thanks!");
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][acco... | 5,284,948 |
//Address: 0x7da47ca0de0797ffedfea9194cac9a8a5d0cd0cc
//Contract name: FactbarDeed
//Balance: 14.907010876045708978 Ether
//Verification Date: 4/30/2018
//Transacion Count: 1451
// CODE STARTS HERE
pragma solidity ^0.4.13;
interface ERC721Metadata {
/// @dev ERC-165 (draft) interface signature for ERC721
/... | Approves another address to claim for the ownership of the given deed ID _to address to be approved for the given deed ID _deedId uint256 ID of the deed to be approved/ | function approve(address _to, uint256 _deedId)
external onlyOwnerOf(_deedId) payable {
require(msg.value == 0);
require(_to != msg.sender);
if(_to != address(0) || approvedFor(_deedId) != address(0)) {
emit Approval(msg.sender, _to, _deedId);
}
deedApprovedFor[_deedId] = _to;
}
| 885,870 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount o... | an immutable function is a function defined directly in a diamond replace selector with last selector, then delete last selector if not the same then replace _selector with lastSelector delete the last selector if no more selectors for facet address then delete the facet address replace facet address with last facet ad... | function removeFunction(address _facetAddress, bytes4 _selector) internal {
DiamondStorage storage ds = diamondStorage();
require(
_facetAddress != address(0),
"LibDiamondCut: Can't remove function that doesn't exist"
);
require(
_facetAddress != a... | 1,396,793 |
./partial_match/1/0x43c6eE9D5B2369C5484f69E2Eb3361466855beDd/sources/FabricaToken.sol | `mint` allows users to mint to 3rd party (although it allows to mint to self as well)/ | function mint(
address[] memory recipients,
uint256 sessionId,
uint256[] memory amounts,
string memory definition,
string memory operatingAgreement,
string memory configuration,
address validator
) public whenNotPaused returns (uint256) {
uint256 s... | 2,672,104 |
pragma solidity 0.5.9; // optimization enabled, runs: 10000, evm: constantinople
/**
* @title HomeWork Interface (version 1) - EIP165 ID 0xe5399799
* @author 0age
* @notice Homework is a utility to find, share, and reuse "home" addresses for
* contracts. Anyone can work to find a new home address by searching for... | inject PUBLIC FUNC TO EXTERNAL | function phaseThree(bytes32 key) public onlyUntilDisabled { | 15,818,004 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.