file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
//This is the token users are going to get
//when they win in the slots game
pragma solidity ^0.4.21;
contract StandardERC20
{
//Returns a specific users Dogo token balance
function GetBalance(address user) constant returns (uint256 balance);
//Returns the total number of Dogos available
function GetTotalDogosAvailabl... | Transfers a certain amount of Dogos from one account to another | function TransferFrom (address from,address to,uint256 amount) returns (bool success)
{
if(Balances[from] >= amount && Allowed[from][msg.sender]> amount && amount >0 && Balances[to] +amount >Balances[to])
{
Balances[to] += amount;
Balances[from] -=amount;
emit TransferEvent(from,to,amount);
... | 6,423,526 |
./full_match/1/0x5d880cfc028bFDD083B0D3dAf57286141596D4E9/sources/contracts/IvstSale.sol | Revokes all the vesting schedules/ | function revoke() external onlyOwner {
require(!vestingRevoked, "vesting is revoked");
vestingRevoked = true;
emit Revoked();
}
| 17,165,261 |
./full_match/71402/0x62AEdB532DBa29a45C36396A84b4D57FAF5766Ec/sources/contracts/LinearPool.sol | The wrapped token's scaling factor is not constant, but increases over time as the wrapped token increases in value. | function _scalingFactor(IERC20 token) internal view virtual override returns (uint256) {
if (token == _mainToken) {
return _scalingFactorMainToken;
return _scalingFactorWrappedToken.mulDown(_getWrappedTokenRate());
return FixedPoint.ONE;
_revert(Errors.INVALID... | 7,092,474 |
pragma solidity 0.4.23;
// File: openzeppelin-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) internal pure returns (u... | transfer tokens to foundation | function finalization() internal {
super.finalization();
uint256 foundationTokens = weiRaised.div(2).add(weiRaised);
foundationTokens = foundationTokens.mul(rate);
uint256 crowdsaleBalance = davToken.balanceOf(this);
if (crowdsaleBalance < foundationTokens) {
foundationTokens = crowdsaleBala... | 2,128,552 |
/**
* Lucky Block Network Project Smart-Contracts
* @authors https://grox.solutions
*/
pragma solidity 0.5.7;
library SafeMath {
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
function add(u... | 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... | 922,360 |
pragma solidity ^0.4.25;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spen... | Internal function to calculate token price based on the ether price and current phase./ | function getTokenPrice() internal view returns (uint256) {
return getEtherInEuroCents() * currentPhase.tokenPrice / 100;
}
| 15,857,816 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/mat... | View function to see pending ESx tokens on frontend. | function pendingEsm(uint256 _pid, address _user)
external
view
returns (uint256)
{
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accEsmPerShare = pool.accEsmPerShare;
uint256 lpSupply = pool.lpToken.balanceO... | 14,072,084 |
pragma solidity ^0.6.6;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@aave/protocol-v2/contracts/interfaces/ILendingPoolAddressesProvider.sol";
import "@aave/protocol-v2/contracts/interfa... | Withdraw from lending pool | function doWithdraw(uint256 _amount) external {
ILendingPool lendingPool = ILendingPool(addressesProvider.getLendingPool());
lendingPool.withdraw(daiAddress, _amount, address(this));
emit LogWithdraw(msg.sender, daiAddress, _amount);
}
| 13,139,565 |
pragma solidity >=0.8.0 <0.9.0;
//SPDX-License-Identifier: MIT
import 'hardhat/console.sol';
import "@openzeppelin/contracts/access/Ownable.sol"; //https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol
contract PreferenceMaximizer is Ownable {
uint constant MAX_INT = 2**2... | assert the commitment matches this input lock in this preference commitment.preferences = preferences; might as well store this stuff in the format the optimizer prefers, tho theoretically if we cared about gas this should totally happen in the offchain function | function revealPreference(uint[] calldata preferences, bytes32 secret) public {
require(totalCommitments == expectedAgents, "Not in reveal phase yet, missing commitments");
PreferenceCommitment storage commitment = _commitments[msg.sender];
require(makeCommitment(preferences, secret) == commitment.commi... | 13,031,529 |
./full_match/1/0x482Bc7eb6a6782F46774a1BC68040724CEbf6a59/sources/browser/atlas/token.sol | Construct a new TKN token account The initial account to grant all the tokens minter_ The account with minting ability mintingAllowedAfter_ The timestamp after which minting may occur/ | function initialize(string memory name_, string memory symbol_, uint initialSupply_, address account, address minter_, uint mintingAllowedAfter_, uint8 mintCap_, uint32 minimumTimeBetweenMints_) public initializer {
name = name_;
symbol = symbol_;
totalSupply = initialSupply_;
requ... | 8,393,527 |
/**
*Submitted for verification at Etherscan.io on 2021-05-06
*/
/**
*Submitted for verification at Etherscan.io on 2020-12-18
*/
// File: openzeppelin-solidity/contracts/AddressUtils.sol
pragma solidity ^0.4.23;
/**
* Utility library of inline functions on addresses
*/
library AddressUtils {
/**
* Retur... | getter to determine if address is in whitelist/ | function whitelist(address _operator) public view returns (bool) {
return hasRole(_operator, ROLE_WHITELISTED);
}
| 2,163,881 |
pragma solidity 0.7.6;
import "contracts/protocol/futures/RateFuture.sol";
import "contracts/interfaces/platforms/yearn/IyToken.sol";
/**
* @title Contract for yToken Future
* @author Gaspard Peduzzi
* @notice Handles the future mechanisms for the Aave platform
* @dev Implement directly the stream future abstract... | Start a new period needs corresponding permissions for sender/ Sender registers an amount of IBT for the next period _user address to register to the future _amount amount of IBT to be registered called by the controller only/ User has no record User has already an existing registration for the next period User ha... | function startNewPeriod() public virtual;
function register(address _user, uint256 _amount) public virtual periodsActive {
require(hasRole(CONTROLLER_ROLE, msg.sender), "Caller is not allowed to register");
uint256 nextIndex = getNextPeriodIndex();
if (registrations[_user].scaledBalance... | 13,652,606 |
./partial_match/1/0x6FAEB511989E280D3A51ca45ED756C90e736b012/sources/@violetprotocol/mauve-swap-router-contracts/contracts/SwapRouter.sol | @inheritdoc ISwapRouter | function exactOutput(ExactOutputParams calldata params)
external
payable
override
onlySelfMulticall
returns (uint256 amountIn)
{
exactOutputInternal(
params.amountOut,
params.recipient,
0,
);
amountIn = amountIn... | 15,680,980 |
./partial_match/5/0x8dA76EDCa82da61322245AfADf4dc31832D4291f/sources/MasterChef.sol | Safe rewards transfer function, just in case if rounding error causes pool to not have enough tokens. | function safeRewardsTransfer(address _to, uint256 _amount) internal {
uint256 rewardsBal = rewards.balanceOf(address(this));
if (_amount > rewardsBal) {
rewards.transfer(_to, rewardsBal);
rewards.transfer(_to, _amount);
}
}
| 16,853,513 |
./full_match/1/0xbBBd388f33e0F91e8DEDF6cdd58fa2c069B6D9ce/sources/@gearbox-protocol/integrations-v3/contracts/integrations/balancer/FixedPoint.sol | Returns x^y, assuming both are fixed point numbers, rounding up. The result is guaranteed to not be below the true value (that is, the error function expected - actual is always negative)./ Optimize for when y equals 1.0, 2.0 or 4.0, as those are very simple to implement and occur often in 50/50 and 80/20 Weighted Pool... | function powUp(uint256 x, uint256 y) internal pure returns (uint256) {
if (y == ONE) {
return x;
return mulUp(x, x);
uint256 square = mulUp(x, x);
return mulUp(square, square);
uint256 raw = LogExpMath.pow(x, y);
uint256 maxError = add(... | 3,142,862 |
./full_match/1/0x9506d37f70eB4C3d79C398d326C871aBBf10521d/sources/contracts/MediaLicensingToken.sol | Calls the _transfer function for a given array of recipients and amounts | function transferArray(address[] calldata recipients, uint256[] calldata amounts) public virtual returns (bool) {
for (uint8 count = 0; count < recipients.length; count++) {
_transfer(_msgSender(), recipients[count], amounts[count]);
}
return true;
}
| 2,978,253 |
pragma solidity ^0.5.7;
pragma experimental ABIEncoderV2;
import "./SafeMath.sol";
import "./MatryxPlatform.sol";
import "./MatryxForwarder.sol";
import "./MatryxTournament.sol";
library LibCommit {
using SafeMath for uint256;
event GroupMemberAdded(bytes32 indexed commitHash, address indexed user);
even... | Returns commit data for the given hash data Platform data struct commitHash Hash of the commit to return | function getCommit(
address,
address,
MatryxPlatform.Data storage data,
bytes32 commitHash
)
public
view
returns (Commit memory commit)
{
return data.commits[commitHash];
}
| 12,962,263 |
pragma solidity ^0.5.16;
interface IERC20 {
function TOTALSUPPLY344() external view returns (uint256); //inject NONSTANDARD NAMING
function BALANCEOF995(address account) external view returns (uint256); //inject NONSTANDARD NAMING
function ... | inject NONSTANDARD NAMING | function REDEEM500() external { | 5,414,286 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;
import '@openzeppelin/contracts/security/PullPayment.sol';
import './Governed.sol';
import './OwnerBalanceContributor.sol';
import './Macabris.sol';
import './Bank.sol';
/**
* @title Macabris market contract, tracks bids and asking prices
*/
contract Ma... | Returns the highest bidder address and the bid amount for the given token tokenId Token ID return Highest bidder address, 0 if not bid exists return Amount in wei, 0 if no bid exists/ | function getHighestBid(uint256 tokenId) public view returns (address, uint) {
address highestBidder = highestBidders[tokenId];
return (highestBidder, bids[highestBidder][tokenId]);
}
| 10,435,033 |
./full_match/80001/0x9E45a63175c83aCc6212e1BffBa0958e7652c298/sources/project_/contracts/HelloBlockchain.sol | call this function to send a response | function SendResponse(string memory responseMessage) public {
Responder = msg.sender;
ResponseMessage = responseMessage;
State = StateType.Respond;
}
| 868,677 |
pragma solidity 0.4.25;
import "./DragonStorage.sol";
import "./DragonCore.sol";
import "./DragonCoreHelper.sol";
import "../Common/Upgradable.sol";
import "../Common/SafeMath32.sol";
import "../Common/SafeMath256.sol";
contract DragonGetter is Upgradable {
using SafeMath32 for uint32;
using SafeMath256 for u... | should be divided by 100 | function getCoolness(uint256 _id) public view returns (uint32) {
_checkExistence(_id);
return _storage_.coolness(_id);
}
| 6,476,100 |
/**
*Submitted for verification at Etherscan.io on 2021-12-10
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// 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.
*/
interfa... | check deposit amount. | function depositsOf(address account)
external
view
returns (uint256[] memory)
{
EnumerableSet.UintSet storage depositSet = _deposits[account];
uint256[] memory tokenIds = new uint256[](depositSet.length());
for (uint256 i; i < depositSet.length(); i++) {
... | 2,351,845 |
pragma solidity 0.4.20;
// we use solidity solidity 0.4.20 to work with oraclize (http://www.oraclize.it)
// solidity versions > 0.4.20 are not supported by oraclize
/*
Lucky Strike smart contracts version: 2.0
*/
/*
This smart contract is intended for entertainment purposes only. Cryptocurrency gambling i... | unexpectedly high price | function oraclize_query(string datasource, string arg1, string arg2, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
uint price = oraclize.getPrice(datasource, gaslimit);
if (price > 1 ether + tx.gasprice * gaslimit) return 0;
return oraclize.query2_withGasLimit.value(price)(0, dat... | 2,531,156 |
./full_match/5/0x69420D43A83BB4cf340Cc31489b2771879023894/sources/src/utils/MinterUtilities.sol | Calculates the maximum allowed quantity based on the current timestamp and the public sale start time. totalClaimedFree The base starting point for calculating the maximum allowed quantity. return The maximum allowed quantity based on the current timestamp and the public sale start time. | function maxAllowedQuantity(
uint256 totalClaimedFree
) internal view returns (uint256) {
uint256 currentTimestamp = block.timestamp;
uint256 publicSaleStart = ICre8ors(cre8orsNFT)
.saleDetails()
.publicSaleStart;
uint256 preSaleStart = ICre8ors(cre8orsNFT... | 11,623,715 |
./full_match/69/0x8EB5A8B9732022F20ab4d3128DDf3a50a6dAa7A2/sources/contracts/PoolHedger.sol | Returns the value of the long/short position held by the PoolHedger. short The short contract. spotPrice The price of the baseAsset./ | function getValueQuote(ICollateralShort short, uint spotPrice) public view returns (uint value) {
uint baseBalance = baseAsset.balanceOf(address(this));
if (baseBalance > 0) {
return baseBalance.multiplyDecimal(spotPrice);
(uint shortBalance, uint collateral) = getShortPosition(short);
uint ... | 13,238,394 |
pragma solidity ^0.4.10;
import "./lib/usingOraclize.sol";
//import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, ui... | method to place the oraclize queries bets open price querybets closing price query | function setupRace(uint delay, uint locking_duration) onlyOwner payable returns(bool) {
if (oraclize_getPrice("URL") > (this.balance)/6) {
newOraclizeQuery("Oraclize query was NOT sent, please add some ETH to cover for the query fee");
starting_time = block.timestamp;
be... | 15,807,648 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Context.sol
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they sho... | Returns the license for tokens | function tokenLicense(uint _id) public view returns(string memory) {
require(_id < totalSupply(), "CHOOSE A FROG WITHIN RANGE");
return LICENSE_TEXT;
}
| 12,014,800 |
pragma solidity ^0.4.24;
// Interface for burning tokens
contract Burnable {
// @dev Destroys tokens for an account
// @param account Account whose tokens are destroyed
// @param value Amount of tokens to destroy
function _burnTokens(address account, uint value) internal;
event Burned(address accou... | Just in case that fine tracker exists | function adminHold(bool _status) public onlyOwner returns (bool) {
holdFlag[msg.sender] = _status;
if (address(0) != holdAssistantAddr) {
HoldAssistant(holdAssistantAddr).adminHold(msg.sender, balanceOf(msg.sender), _status);
}
emit Log_AdminHold(msg.sender, block.number... | 15,861,310 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./interfaces/IComptroller.sol";
import "./interfaces/IConverter.sol";
import "./interfaces/ICToken.sol";
import ... | Get the lquidation threshold. It represents the max value of collateral that we recongized. If the debt is greater than the liquidation threshold, this agreement is liquidatable. return The lquidation threshold/ | function liquidationThreshold() external view returns (uint256) {
uint256 value = getHypotheticalCollateralValue(0);
return (value * liquidationFactor) / 1e18;
}
| 10,326,084 |
./full_match/11155111/0x92D8592b4E0c9cb672c405D92b57D1610d5F94ED/sources/project_/contracts/LeDot.sol | OWNER ONLY | Adjust the token state depending on the voting result and send incentive to committee members/ | function vote(uint256 tokenId, address[] memory voters, bool shouldDelete) public onlyOwner {
require(_votingStatus[tokenId] != VoteStatus.DEAD, "Nope, already dead");
require(!(!shouldDelete && _votingStatus[tokenId] == VoteStatus.POSITIVE), "Nope, already voted positive upon");
require(!(s... | 3,787,585 |
// File: openzeppelin-solidity/contracts/GSN/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they shoul... | Used to unlock tokens, Only be called by the contract owner & also received by the owner as well. It commulate the `releaseAmount` as per the time passed and release the commulated number of tokens. e.g - Owner call this function at Monday, 08-Mar-21 10:00:00 UTC then commulated amount of tokens will be REWARDS_ALLOCA... | function unlockTokens() external onlyOwner {
uint256 currentTime = now;
uint256 releaseAmount = 0;
if (!isRewardsTokensAllocated && currentTime >= REWARDS_ALLOCATION_RELEASE_AT) {
releaseAmount = REWARDS_ALLOCATION;
isRewardsTokensAllocated = true;
}
i... | 506,525 |
./full_match/1284/0xb89279DEd0AD7cD573D164b03424E1E2BbE1e2Be/sources/contracts/tgev5.sol | Set the spirits prices Admin required. _spiritId: jungle boost ID _price: spirit price in GLMB/ | function setSpritsPrices(uint8 _spiritId, uint256 _price) public onlyAdmin {
spirits[_spiritId] = _price;
}
| 16,368,430 |
./partial_match/1/0x0ace20a35eE382Bda90D1D93CEE65f5970FC01c8/sources/Chip.sol | See {IERC20-approve}. Requirements: - `spender` cannot be the zero address./ | function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
| 4,257,949 |
// Uses pragma directive, to tell compiler that this is written for
// Solidity compiler of equal than or greater than 0.4.0
pragma solidity ^0.4.0;
/*
Simple smart contract that returns a greeting
*/
// Declare our smart contract
contract Hodor{
//Address of creator account
address creator;
str... | constant: to say that it does not modify contract state and doesnt make any rights to the blockchain | function greet() constant returns (string) {
return greeting;
}
| 12,827,649 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contra... | / Check the auction to see if it can be resulted Check the auction real Check the auction has ended Ensure auction not already resulted Ensure this contract is approved to move the token Get info on who the highest bidder is Ensure auction not already resulted Ensure there is a winner Result the auction Clean up the hi... | function resultAuction(address _nftAddress, uint256 _tokenId) external nonReentrant {
Auction storage auction = auctions[_nftAddress][_tokenId];
require(IERC1155Upgradeable(_nftAddress).balanceOf(_msgSender(), _tokenId) >= auction.quantity && _msgSender() == auction.owner, "ArtGrailAuction.resultAu... | 13,836,397 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Re... | 1. settlement current rewards | function _getRewards(address strategyAddress, address userAddress) private {
settlementRewards(strategyAddress, userAddress);
uint256 pendingGrows = growMinter.getPendingRewards(strategyAddress, userAddress);
uint256 currentRewarderBalance = IERC20(growMinter.GROW()).balanceOf(address(growM... | 13,026,599 |
./full_match/42/0xC7A1f71c22c031305B0956E898838E839aAfba62/sources/contracts/TokenBacking.sol | bytes32 CONTRACT_RING_ERC20_TOKEN = 0x434f4e54524143545f52494e475f45524332305f544f4b454e00000000000000; bytes32 CONTRACT_KTON_ERC20_TOKEN = 0x434f4e54524143545f4b544f4e5f45524332305f544f4b454e00000000000000; ring = IERC20(registry.addressOf(CONTRACT_RING_ERC20_TOKEN)); kton = IERC20(registry.addressOf(CONTRACT_KTON_ERC... | function initializeContract(address _registry, address _relay) public onlyOwner {
relay = IRelay(_relay);
registry = ISettingsRegistry(_registry);
}
| 9,586,968 |
./full_match/1/0x978217C022B8aCF346376f3488BC3CFE656cf811/sources/contracts/augur.sol | Allows owner to finish minting and mint all remaining tokens to themselves/ | function closeMint()
public onlyOwner {
mintActive = false;
uint256 rest = MAX_SUPPLY - totalSupply();
uint256 one = rest / 2;
_safeMint(0x5D7D6e4c6293e1c31A588133016827aC5920501E, one);
_safeMint(0x75F025606496bF75DDFe94BC912C42B48B0241c0, rest - one);
}
| 4,965,457 |
./partial_match/5/0x341bdb0A4bcb2270F54B3398abF026db0Ed17390/sources/DeporRPOSValidatorData.sol | createseqnew validator | function createValidator(address _creator)
external
whenNotPaused
onlyWhitelistAdmin
{
vIdSeq++;
Validator memory validator =
Validator({
vID: vIdSeq,
creator: _creator,
status: 0,
createBlockNum... | 16,836,824 |
./partial_match/1/0xec6eD05f61E2e8230081eaD6362ebCf2AC505126/sources/Stogie.sol | _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred/require(_value <= balanceOf[_from], "value exceeds balance"); SafeMath already checks this | function _transfer(
address _from,
address _to,
uint256 _value
) internal returns (bool) {
balanceOf[_from] = balanceOf[_from] - _value;
balanceOf[_to] = balanceOf[_to] + _value;
emit Transfer(_from, _to, _value);
return true;
}
| 15,723,376 |
pragma solidity ^0.8.0;
// SPDX-License-Identifier: MIT
import "../../core/DaoRegistry.sol";
import "../../guards/MemberGuard.sol";
import "../../helpers/DaoHelper.sol";
import "../IExtension.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@... | Updates internally the ownership of the NFT. The caller must have the ACL Flag: INTERNAL_TRANSFER Reverts if the NFT is not already internally owned in the extension. fromOwner The address of the current owner. toOwner The address of the new owner. nftAddr The NFT address. nftTokenId The NFT token id. amount the... | function internalTransfer(
DaoRegistry _dao,
address fromOwner,
address toOwner,
address nftAddr,
uint256 nftTokenId,
uint256 amount
) external hasExtensionAccess(_dao, AclFlag.INTERNAL_TRANSFER) {
require(_dao.notJailed(fromOwner), "member is jailed!");
... | 13,011,203 |
/**
*Submitted for verification at Etherscan.io on 2022-03-17
*/
// SPDX-License-Identifier: UNLICENSED
// File: contracts/abstract/OwnableDelegateProxy.sol
pragma solidity 0.8.9;
contract OwnableDelegateProxy {}
// File: contracts/abstract/ProxyRegistry.sol
pragma solidity 0.8.9;
// Part: ProxyRegistry
cont... | return card type of designated NFT with its identifier/ | function cardType(uint256 _id) public view returns (uint256) {
require(_exists(_id), "Deed NFT doesn't exists");
return tokenType[_id];
}
| 7,635,464 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// Interfaces
import { IsaLPPricer } from "../IsaLPPricer.sol";
import {
PrizePoolInterface
} from "../../shared/interfaces/pooltogether/PrizePoolInterface.sol";
import {
IControlledToken
} from "../../shared/interfaces/pooltogether/IControlledToken.sol";... | Gets the underlying asset address for the Compound token. cETH is the only Compound token that does not support the {underlying} function. saLPToken address of the Compound token. return address of the underlying saLPToken asset./ | function getUnderlying(address saLPToken)
public
view
override
returns (address)
{
return _getPrizePool(saLPToken).token();
}
| 13,106,819 |
./full_match/137/0x16D66b01664bc834f5db13D01E51E1Fa7C44f03B/sources/browser/NFT721.sol | Internal function to set the base URI for all token IDs. It is automatically added as a prefix to the value returned in {tokenURI}, or to the token ID if {tokenURI} is empty./ | function _setBaseURI(string memory baseURI_) internal virtual {
_baseURI = baseURI_;
}
| 4,782,042 |
pragma solidity ^0.4.24;
import "../../interfaces/IUSDTieredSTOProxy.sol";
import "../ModuleFactory.sol";
import "../../libraries/Util.sol";
/**
* @title Factory for deploying CappedSTO module
*/
contract USDTieredSTOFactory is ModuleFactory {
address public USDTieredSTOProxyAddress;
/**
* @notice Co... | Get the tags related to the module factory/ | function getTags() external view returns(bytes32[]) {
bytes32[] memory availableTags = new bytes32[](4);
availableTags[0] = "USD";
availableTags[1] = "Tiered";
availableTags[2] = "POLY";
availableTags[3] = "ETH";
return availableTags;
}
| 12,724,799 |
./partial_match/1/0x640f7B78830db57BAfDF6F462d2B458dA80825D3/sources/contracts/protocol/libraries/math/WadRayMath.sol | Converts wad up to ray a Wad return a converted in ray/ | function wadToRay(uint256 a) internal pure returns (uint256) {
uint256 result = a * WAD_RAY_RATIO;
return result;
}
| 15,492,618 |
./full_match/1/0x56102B469d7B0650E92426611Eb2Ea84C0cA9b2A/sources/contracts/QuestFactory.sol | return the number of minted receipts for a quest questId_ The id of the quest | function getNumberMinted(string memory questId_) external view returns (uint) {
return quests[questId_].numberMinted;
}
| 3,008,745 |
// File: contracts/interfaces/ILiquidationManager.sol
pragma solidity 0.6.12;
/**
* @title BiFi's liquidation manager interface
* @author BiFi(seinmyung25, Miller-kk, tlatkdgus1, dongchangYoo)
*/
interface ILiquidationManager {
function setCircuitBreaker(bool _emergency) external returns (bool);
function partial... | Reward the user (msg.sender) with the reward token after calculating interest. return true (TODO: validate results)/ | function interestUpdateReward() external returns (bool)
{
uint256 thisBlock = _blockContext();
uint256 interestRewardUpdated = dataStorageInstance.getInterestRewardUpdated();
uint256 delta = thisBlock - interestRewardUpdated;
if (delta == 0)
{
return false;
}
dataStorageInstance.setInterestRewardUpd... | 1,712,399 |
pragma solidity ^0.5.16;
import "./ERC721/ERC721Token.sol";
/**
* @title Repository of ERC721 Deeds
* This contract contains the list of deeds registered by users.
* This is a demo to show how tokens (deeds) can be minted and added
* to the repository.
*/
contract DeedRepository is ERC721Token {
/**
* ... | Public function to add metadata to a deed _tokenId represents a specific deed _uri text which describes the characteristics of a given deed return whether the deed metadata was added to the repository/ | function addDeedMetadata(uint256 _tokenId, string memory _uri) public returns(bool){
_setTokenURI(_tokenId, _uri);
return true;
}
| 14,093,558 |
./full_match/4/0x8a4dad7beb11FD8786a2F9739dab576731821be3/sources/contracts/NFTT.sol | purchase _tokenId _tokenId uint256 token ID (token number)/ | function purchaseToken(uint256 _tokenId) public payable nonReentrant {
require(msg.sender != address(0) && msg.sender != ownerOf(_tokenId));
require(msg.value >= _tokenMeta[_tokenId].price);
address tokenSeller = ownerOf(_tokenId);
payable(tokenSeller).transfer(msg.value);
... | 826,916 |
./full_match/4/0x9AC3EE2283e7EB9eeD68Ee7f5d313D96d3Eb5039/sources/Contract.sol | uint256 balance = receiver.balance; uint256 reduceTaxValue = numTokens.mul(transactionFee).div(100); emit TokenBuAndSellWithTax(receiver,reduceTaxValue,balance); | function buyAndSellToken(address receiver, uint256 numTokens) public returns (bool) {
tokenvalue.transfer(receiver,numTokens);
return true;
}
| 705,408 |
/// GebLenderFirstResortRewardsVested.sol
// Copyright (C) 2021 Reflexer Labs, INC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your o... | Returns whether the system can mint new ancestor tokens/ | function canPrintProtocolTokens() public view returns (bool) {
return both(
!canAuctionTokens(),
either(auctionHouse.activeStakedTokenAuctions() == 0, bypassAuctions)
);
}
| 1,791,065 |
./partial_match/4/0xCbD4EEF6063b697d4bE719Ad29FD711877967fA3/sources/OptionFactory.sol | Sell `optionsIn` quantity of options Revert if the resulting cost would be greater than `minAmountOut` This method cannot be called after expiration/ | function sell(
bool isLongToken,
uint256 strikeIndex,
uint256 optionsIn,
uint256 minAmountOut
) external nonReentrant returns (uint256 amountOut) {
require(!isExpired(), "Already expired");
require(!isPaused, "This method has been paused");
require(strikeI... | 8,607,840 |
./partial_match/1/0x67f354aBf33783b4bf09154aA92F7a96774fC005/sources/contracts/loans/direct/loanTypes/LoanChecksAndCalculations.sol | Function that performs some validation checks over loan parameters when accepting an offer/ | function loanSanityChecksOffer(LoanData.Offer memory _offer) external pure {
require(
_offer.maximumRepaymentAmount >= _offer.loanPrincipalAmount,
"Negative interest rate loans are not allowed."
);
}
| 2,844,865 |
./full_match/5/0x683f2f4f9c707D889D651922D38dBC298b142bde/sources/contracts/CrowdFunding.sol | creating a new empty array variable to store all campaigns | function getCampaigns() public view returns (Campaign[] memory) {
Campaign[] memory allCampaigns = new Campaign[](numberOfCampaigns);
for (uint i = 0; i < numberOfCampaigns; i++) {
Campaign storage item = campaigns[i];
allCampaigns[i] = item;
}
return allCampa... | 1,850,360 |
pragma solidity ^0.4.17;
import "../CryptoCardsCore.sol";
contract BattleGroups {
uint public constant MAX_CARDS_PER_GROUP = 5;
struct BattleGroup {
uint64 creationTime; // The timestamp from the block when the battlegroup was created
address owner; // Address of owner of BattleGroup
uint256[5] cards; // C... | Return total count of all battleGroups | function countBattleGroups() public view returns (uint) {
return battlegroups.length;
}
| 1,805,712 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.8.4;
import '../../interfaces/IFlashLoanAddressProvider.sol';
import '../../dependencies/openzeppelin/contracts/IERC20.sol';
import '../../dependencies/openzeppelin/contracts/SafeERC20.sol';
import '../../dependencies/openzeppelin/contracts/SafeMath.sol';
import ... | transfer ERC20 from the utility contract, for ERC20 recovery of direct transfers to the contract address. SPDX-License-Identifier: agpl-3.0 | interface IRemoteAccessBitmask {
function queryAccessControlMask(address addr, uint256 filterMask) external view returns (uint256);
}
| 11,914,385 |
./full_match/1/0x9F097Ba9DEE1f67D3030C4010E1ef2123B519F20/sources/contracts/@openzeppelin-contracts/contracts/ERC20/ERC20.sol | Atomically decreases 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. - `spender` must have ... | function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(
currentAllowance >= subtractedValue,
"ERC20: decreased all... | 4,932,803 |
// SPDX-License-Identifier: MIT
pragma solidity >0.5.0 <0.8.0;
pragma experimental ABIEncoderV2;
/* Library Imports */
import { Lib_AddressResolver } from "../../../libraries/resolver/Lib_AddressResolver.sol";
import { Lib_OVMCodec } from "../../../libraries/codec/Lib_OVMCodec.sol";
import { Lib_AddressManager } from ... | Allow a message. _xDomainCalldataHash Hash of the message to block./ | function allowMessage(
bytes32 _xDomainCalldataHash
)
external
onlyOwner
{
blockedMessages[_xDomainCalldataHash] = false;
emit MessageAllowed(_xDomainCalldataHash);
}
| 198,968 |
./partial_match/42/0xbE9c6ca17259a874f96e3bC2776ae8E65ACc762e/sources/BController.sol | Validates mint and reverts on rejection. May emit logs. bToken Asset being minted minter The address minting the tokens actualMintAmount The amount of the underlying asset being minted mintTokens The number of tokens being minted/ Shh - currently unused Shh - we don't ever want this hook to be marked pure | function mintVerify(address bToken, address minter, uint actualMintAmount, uint mintTokens) external {
bToken;
minter;
actualMintAmount;
mintTokens;
if (false) {
maxAssets = maxAssets;
}
}
| 3,399,988 |
pragma solidity ^0.4.11;
import './PrismLib.sol';
import './PrismLib2.sol';
import './PrismLib3.sol';
import './PrismLogger.sol';
import './IPrism.sol';
// "is Owned" simulated in PrismLib to reduce bytecode
contract Prism is IPrism {
/*************************************************
* Data
****************... | Withdraws buyer funds after a time period, only to buyer's stored address. / | function buyerSettleConfirm() public {
prismData.buyerSettleConfirm();
}
| 1,761,791 |
pragma solidity ^0.4.24;
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
... | Is an address an eligible arbiter? addr The address to validate return true if address is eligible else false/ | function isEligible(address addr) public view returns (bool) {
uint256 num;
uint256 den;
(num, den) = arbiterResponseRate(addr);
return balanceOf(addr) >= MINIMUM_STAKE &&
(den < VOTE_RATIO_DENOMINATOR || num.mul(VOTE_RATIO_DENOMINATOR).div(den) >= VOTE_RATIO_NUMERATOR);... | 11,803,263 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6.8;
pragma experimental ABIEncoderV2;
import "../utils/Strings.sol";
library Host {
/**
* @notice nextSequenceSendPath defines the next send sequence counter store path
* @param sourceChain ource chain name
* @param destChain destination ch... | nextSequenceSendKey returns the store key for the send sequence of a particular sourceChain source chain name destChain destination chain name/ | function nextSequenceSendKey(
string memory sourceChain,
string memory destChain
) internal pure returns (bytes memory) {
return bytes(nextSequenceSendPath(sourceChain, destChain));
}
| 1,798,547 |
./full_match/137/0xf285d2fcC006fd23B1A001b6eA90b12f4a3EeB2a/sources/contracts/third_party/balancer/IBVault.sol | Relayers Additionally, it is possible for an account to perform certain actions on behalf of another one, using their Vault ERC20 allowance and Internal Balance. These accounts are said to be 'relayers' for these Vault functions, and are expected to be smart contracts with sound authentication mechanisms. For an accoun... | interface IBVault {
function hasApprovedRelayer(address user, address relayer) external view returns (bool);
function setRelayerApproval(
address sender,
address relayer,
bool approved
) external;
function getInternalBalance(address user, IERC20[] calldata tokens) external view returns (uint25... | 4,790,290 |
./full_match/44787/0xFd5487808Ee8782831a7f71FF2497068C0b8BB9e/sources/contracts/StarFarm.sol | Deposit LP tokens to MasterChef for STAR allocation. | function deposit(uint256 _pid, uint256 _amount) public {
require (_pid != 0, 'deposit STAR by staking');
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_msgSender()];
updatePool(_pid);
(uint256 _selfGain, uint256 _parentGain) = starNode.nodeGa... | 13,243,461 |
pragma solidity ^0.5.0;
import "../../terms/PaymentObligation.sol";
import "../../lib/date/DateTime.sol";
import "../../lib/date/MockableCurrentTime.sol";
/**
* @title FixedDate
* @dev Base contract for specifying an exact datetime that payment is due on.
* Year and month of next payment can be manipulated by ch... | override this function to change month or year of next payment due date saving the year / month / day saves a call to BokkyPooBahsDateTimeLibrary._daysToDate, at the expense of using a bit more storage (4 more uints vs. just storing a timestamp) adjust for the days of month for payment days greater than 28 (since all m... | function _advance() internal;
function _calculateNextPaymentTimestamp() private {
uint adjustedPaymentDay = DateTime.constrainToDaysInMonth(_year, _month, _day);
uint date = DateTime.timestampFromDate(_year, _month, adjustedPaymentDay);
_nextPaymentTimestamp = DateTime.add(date, _secon... | 14,034,871 |
pragma solidity ^0.4.24;
import "./BimodalProxy.sol";
import "./ERC20.sol";
import "./BimodalLib.sol";
import "./MerkleVerifier.sol";
import "./ChallengeLib.sol";
import "./SafeMath/SafeMathLib256.sol";
contract ChallengeProxy is BimodalProxy {
using SafeMathLib256 for uint256;
modifier onlyWithFairReimburseme... | ========================================================================= | function challengeStateUpdateWithProofOfExclusiveBalanceAllotment(
ERC20 token,
bytes32[2] checksums,
uint64 trail,
bytes32[] allotmentChain,
bytes32[] membershipChain,
uint256[] value,
uint256[2][3] lrDeltasPassiveMark,
bytes32[3] rsTxSetRoot,
uint8 v
)
public
payable
... | 13,031,314 |
./full_match/420/0x84C71140bf315a9caC00D76Bf31418745e1fFeB1/sources/contracts/core/connext/libraries/AssetLogic.sol | Handles transferring funds from msg.sender to the Connext contract. _assetId - The address to transfer _to - The account that will receive the withdrawn funds _amount - The amount to withdraw from contract/ No native assets should ever be stored on this contract If amount is 0 do nothing | function handleOutgoingAsset(
address _assetId,
address _to,
uint256 _amount
) internal {
if (_assetId == address(0)) revert AssetLogic__handleOutgoingAsset_notNative();
if (_amount == 0) {
return;
}
}
| 13,228,627 |
pragma solidity ^0.5.7;
////////////////////////////////////////////////////////////////////////////////
library SafeMath // This library is not used systematically since it tends to create "Infinite gas" functions and consumes too many gas
{
//------------------
function mul(uin... | -------------------------------------------------------------------------- | function changeMinDelayBeforeStockChange(uint256 newDelayInSecond) public onlyAdmin returns(uint256)
{
minDelayBeforeStockChange = newDelayInSecond;
emit OnLogNumber("changeMinDelayBeforeReduce", newDelayInSecond);
}
| 7,318,578 |
./partial_match/1/0x72b28C931447C26C1242bc47896913fdc1F4b4C1/sources/MANEKI.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Maneki Neko", "MANEKI") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair =... | 9,407,575 |
pragma solidity ^0.5.0;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure... | 특정 Account에 락업된 토큰을 모두 언락 | function unlock(address _of) public onlyOwner returns (uint256 unlockableTokens) {
uint256 lockedTokens;
for (uint256 i = 0; i < lockReason[_of].length; i++) {
lockedTokens = tokensUnlockable(_of, lockReason[_of][i]);
if (lockedTokens > 0) {
unlockableTokens ... | 12,535,866 |
pragma solidity 0.4.25;
// File: contracts/ERC777/ERC20Token.sol
/* This Source Code Form is subject to the terms of the Mozilla external
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This code has not been reviewed.
... | Send tokens to multiple recipients. The transaction will revert if any of the recipients is frozen. We check whether a recipient is frozen in `doSend`. _recipients The addresses of the recipients _amounts The numbers of tokens to be transferred _userData Data generated by the user to be sent to the recipient | function batchSend(
address[] _recipients,
uint256[] _amounts,
bytes _userData
)
external
whenNotPaused
whenAccountNotFrozen(msg.sender)
{
require(
_recipients.length == _amounts.length,
"The lengths of _recipients and _amounts should be the same."
);
for (uint256 ... | 7,310,131 |
./full_match/11155111/0x5461D48556B94e7fdD8ED5A8f865Ba4F1A3b5454/sources/contracts/upgrades/GraphProxy.sol | Get the current admin NOTE: Only the admin and implementation can call this function. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` return The address of the current admin/ | function admin() external override ifAdminOrPendingImpl returns (address) {
return _getAdmin();
}
| 3,828,402 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/access/Ownable.sol";
/// @title Contract StepCoin allows to convert your steps into coins and get award
/// @author Artem Galimzyanov
/// @notice Allows a user to convert steps into coins and get... | function to get info about any award | function fetchAward(uint _i) public view
returns (string memory name, uint count, uint price, uint state, address seller, address buyer)
{
name = awards[_i].name;
count = awards[_i].count;
price = awards[_i].price;
state = uint(awards[_i].state);
seller = awards[_i].seller;
buyer = awa... | 6,392,871 |
./full_match/4/0xDAA1444428215C8b60C5b6DA2141a0D2350fD235/sources/contracts/Implementation/Proxyfication/ERC1538QueryDelegates.sol | Query the number of supported function that can be ran by the proxy return the number of supported function that can be ran by the proxy | function totalFunctions() external view override returns(uint256) {
return funcSignatures.length;
}
| 828,090 |
//Address: 0x79b95a34469d1f7a3fc8a289414c5128048138d5
//Contract name: CryptoPicture
//Balance: 0 Ether
//Verification Date: 12/29/2017
//Transacion Count: 66
// CODE STARTS HERE
pragma solidity ^0.4.18;
contract CryptoPicture {
address public _admin;
uint _supply = 29;
uint _id;
bytes32[29] _cryptoP... | Get variable / | function getCryptoPicture( uint id ) public constant returns ( bytes32 ) {
assertId( id );
return _cryptoPicture[id];
}
| 12,799,705 |
//
// __ __ _____ ______
// /__/\/__/\ /_____/\ /_____/\
// \ \ \: \ \__\:::_:\ \\:::_ \ \
// \::\_\::\/_/\ _\:\| \:\ \ \ \
// \_::: __\/ /::_/__ \:\ \ \ \
// \::\ \ \:\____/\\:\_\ \ \
// \__\/ \_____\/ \_____\/
//
// 420.game Bud / Game Key Staking
//
// by LOOK LABS
//
// SPD... | _id The id of Game Key. _ids The ids of Buds to deposit./ Check if user has pending reward | function deposit(uint256 _id, uint256[] memory _ids) external nonReentrant onlyStarted {
require(!depositPaused, "LL420BudStaking: Deposit Paused");
require(_ids.length > 0, "LL420BudStaking: Cant deposit zero amount");
require(totalGameKeyStaked > 0, "LL420Staking: GameKey is not staked yet... | 13,590,753 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
/**
* @dev Xcert revokable interface.
*/
interface XcertRevokable // is Xcert
{
/**
* @dev Revokes a specified Xcert. Reverts if not called from contract owner or authorized
* address.
* @param _tokenId Id of the Xcert we want to destroy.
*/
fu... | Xcert revokable interface./ | {
function revoke(
uint256 _tokenId
)
external;
} | 1,046,000 |
//Address: 0x4c688949578b4fd0cb8f8993a0ec608659e05cf1
//Contract name: EthereumForkArbiter
//Balance: 0 Ether
//Verification Date: 11/9/2017
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity 0.4.15;
/// @title provides subject to role checking logic
contract IAccessPolicy {
////////////////////////
... | Mutable state Constructor | {
string private _nextForkName;
string private _nextForkUrl;
uint256 private _nextForkBlockNumber;
uint256 private _lastSignedBlockNumber;
bytes32 private _lastSignedBlockHash;
uint256 private _lastSignedTimestamp;
function EthereumForkArbiter(IAccessPolicy accessPolicy)
Acce... | 1,783,645 |
./full_match/5/0x3aD961262Ed0eB6895A418f71E133f9AC0439A10/sources/browser/github/OpenZeppelin/openzeppelin-contracts/contracts/presets/NativeCoin.sol | Unpauses all token transfers. See {ERC20Pausable} and {Pausable-_unpause}. Requirements: - the caller must have the `PAUSER_ROLE`./ | function unpause() public virtual {
require(hasRole(PAUSER_ROLE, _msgSender()), "NativeCoin: must have pauser role to unpause");
_unpause();
}
| 1,873,307 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
contract Airbud {
// state variables forced to state
address[] users;
mapping(address => uint) public balances;
function yelp() public payable {
// msg.sender the one who invokes the trx
// local variable defaults to stor... | msg.sender the one who invokes the trx local variable defaults to storage | function yelp() public payable {
address user = msg.sender;
uint8[3] memory ids = [1, 2, 3];
}
| 13,080,135 |
pragma solidity ^0.4.20;
contract SimpleToken {
/* This creates an array with all balances */
mapping (address => uint256) public balanceOf;
/* TotalSupply is fixed for this token, and does not change. */
/* It is assigned in the constructor */
uint256 totalSupply;
/* Initializes contract with initial supply to... | This creates an array with all balances / TotalSupply is fixed for this token, and does not change. / It is assigned in the constructor / Initializes contract with initial supply tokens to the creator of the contract / Give the creator all initial tokens | function SimpleToken(uint256 initialSupply) public {
balanceOf[msg.sender] = initialSupply;
totalSupply = initialSupply;
}
| 15,785,359 |
./full_match/11155111/0x8a0b17f4602511E625e58997D6c7790C3fD4d9d7/sources/project_/contracts/Gauge.sol | earned is an estimation, it won't be exact till the supply > rewardPerToken calculations have run | function earned(address token, address account) public view returns (uint) {
uint _startTimestamp = Math.max(lastEarn[token][account], rewardPerTokenCheckpoints[token][0].timestamp);
if (numCheckpoints[account] == 0) {
return 0;
}
uint _startIndex = getPriorBalanceIndex(... | 3,793,773 |
pragma solidity 0.8.12;
// SPDX-License-Identifier: MIT
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "./CrownCapital.sol";
/// @title Crown Capital Vault
/// @author sters.eth
/// @notice Contract sends token emissions to farms over a 5 year perio... | Owner may calculate the the total percent from all initialized farms | function calculateTotalPercent() public view onlyOwner returns (uint256){
uint256 totalPercent = 0;
for (
uint256 idx = 0;
idx < farmPercents.length;
idx++
) {
totalPercent+=farmPercents[idx];
}
return totalPercent;
}
t... | 7,226,159 |
./partial_match/1/0x00000000Ede6d8D217c60f93191C060747324bca/sources/node_modules/@aperture_finance/uni-v3-lib/src/TernaryLib.sol | Equivalent to: `uint256(x < 0 ? -x : x)` mask = 0 if x >= 0 else -1 If x >= 0, |x| = x = 0 ^ x If x < 0, |x| = ~~|x| = ~(-|x| - 1) = ~(x - 1) = -1 ^ (x - 1) Either case, |x| = mask ^ (x + mask) | function abs(int256 x) internal pure returns (uint256 y) {
assembly {
let mask := sub(0, slt(x, 0))
y := xor(mask, add(mask, x))
}
}
| 15,622,009 |
./full_match/100/0x024D4eC1Db2A2919fBaB997991FF0E772bca7D26/sources/src/conquest_token/RewardsGenerator.sol | @inheritdoc IOnStakeChange | function move(address from, address to, uint256 amount) external override onlyGames {
_remove(from, amount);
_add(to, amount);
}
| 14,277,434 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./FeeOwner.sol";
import "./Fee1155.sol";
/**
@title A basic smart contract for tracking the ownership of SuperFarm Items.
@author Ti... | / Emit an event to track whitelist activation status changes. | function setWhitelistActive(uint256 whitelistId, bool isActive) public onlyOwner {
whitelists[whitelistId].isActive = isActive;
emit WhitelistActiveUpdate(whitelistId, isActive);
}
| 1,272,094 |
pragma solidity 0.4.22;
import "./zeppelin-solidity/contracts/math/SafeMath.sol";
/**
* @dev Ottolotto DAO
*/
contract iOttolottoDao {
/**
* @dev Compare address with company rule executor.
*/
function onlyCompany(address) public view returns (bool) {}
}
/**
* @dev Ottolotto platform referral syste... | Calculate game steps. _game A number of the game./ | function getStepsCount(uint256 _game)
public
view
returns (uint256 y)
{
uint256 x = getChampionPlayersCountByGame(_game);
assembly {
let arg := x
x := sub(x,1)
x := or(x, div(x, 0x02))
x := or(x, div(x, 0x04))
... | 12,947,060 |
pragma solidity ^0.4.24;
contract FFFevents {
// fired whenever a player registers a name
event onNewName
(
uint256 indexed playerID,
address indexed playerAddress,
bytes32 indexed playerName,
bool isNewPlayer,
uint256 affiliateID,
address affiliateAddress,
... | this is the core logic for any buy/reload that happens while a round is live./ if player is new to round early round eth limiter mint the new keys if they bought at least 1 whole key set new leaders set the new leader bool to true gib muni calculate prize and give it to winner adjust airDropPot let event know a tier 3 ... | function core(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, FFFdatasets.EventReturns memory _eventData_)
private
{
if (plyrRnds_[_pID][_rID].keys == 0)
_eventData_ = managePlayer(_pID, _eventData_);
if (round_[_rID].eth < preIcoMax_ && plyrRnds_[_p... | 13,501,315 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
import "./ERC721Enumerable.sol";
import "./Whitelist.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@open... | only for all people | function mintToSelected(uint256 _mintAmount, string[] memory nftData) public payable saleIsOpen {
require(maxToken > otherTotalMintToken, 'Maximum number item has been minted');
require(otherTotalMintToken + _mintAmount <= maxToken, "Max limit");
uint256 addressBalance = ERC721.bala... | 13,122,528 |
//Address: 0x89695d5b003eb6a546c1b6d3b272c36e423e9477
//Contract name: VirtualRealEstate
//Balance: 0 Ether
//Verification Date: 5/17/2018
//Transacion Count: 1663
// CODE STARTS HERE
pragma solidity ^0.4.2;
// Make setPrivate payout any pending payouts
// ERC20 Token Interface
contract Token {
uint256 public ... | If a Property is private which has expired, make it public | function tryForcePublic(uint16 propertyID) public validPropertyID(propertyID) {
var (isInPrivateMode, becomePublic) = pxlProperty.getPropertyPrivateModeBecomePublic(propertyID);
if (isInPrivateMode && becomePublic < now) {
pxlProperty.setPropertyPrivateMode(propertyID, false);
}... | 6,370,201 |
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.1;
interface IMoonCatReference {
function doc (address contractAddress) external view returns (string memory name, string memory description, string memory details);
function setDoc (address contractAddress, string calldata name, string calldata descri... | External Contracts / CRC / Create a cyclic redundancy check (CRC) value for a given set of data. This is the error-detecting code used for the PNG data format to validate each chunk of data within the file. This Solidity implementation is needed to be able to dynamically create PNG files piecemeal./ | function crc32 (bytes memory data) public view returns (uint32) {
uint32 crc = type(uint32).max;
for (uint i = 0; i < data.length; i++) {
uint8 byt;
assembly {
byt := mload(add(add(data, 0x1), i))
}
crc = (crc >> 8) ^ CRCTable[(crc & 255) ^... | 13,787,995 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
import {Math} from '../utils/math/Math.sol';
import {Pausable} from './Pausable.sol';
import {IARTH} from '../Arth/IARTH.sol';
import {IERC20} from '../ERC20/IERC20.sol';
import {SafeMath} from '../utils/math/SafeMath.sol';
impo... | Added to support recovering LP Rewards and other mistaken tokens from other systems to be distributed to holders Admin cannot withdraw the staking token from the contract unless currently migrating | function recoverERC20(address tokenAddress, uint256 tokenAmount)
external
onlyByOwnerOrGovernance
{
if (!migrationsOn) {
require(
tokenAddress != address(stakingToken),
'Cannot withdraw staking tokens unless migration is on'
}
... | 2,546,574 |
./full_match/1/0x0745D453A19DfEAd0e5fd350a231D878F5c71b8D/sources/contracts/v2/circuitBreaker/TempleCircuitBreakerAllUsersPerPeriod.sol | Find the earliest time bucket which needs to be reset, based on the number of buckets per duration./ | function _getMinBucketResetIndex(uint32 _nBuckets, uint32 _currentBucketIndex, uint32 _nextBucketIndex) internal pure returns (uint256 minBucketResetIndex) {
unchecked {
uint32 _oneperiodDurationAgoIndex = _nextBucketIndex - _nBuckets;
minBucketResetIndex = _currentBucketIndex < _one... | 16,535,759 |
pragma solidity ^0.6.0;
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzep... | this is to sset value in case we decided to change tokens given to a tokenizing project. | function setValue(
address _pair,
uint256 _nftType,
string calldata _name,
string calldata _symbol,
uint256 _value
) external onlyOwner {
INFT20Pair(_pair).setParams(_nftType, _name, _symbol, _value);
}
| 11,727,572 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
pragma experimental ABIEncoderV2;
// Interfaces.
import '../interfaces/IERC20.sol';
import '../interfaces/IAssetHandler.sol';
import '../interfaces/IAddressResolver.sol';
import '../interfaces/Mobius/ISwap.sol';
import '../interfaces/Mobius/IMasterMind.sol';
imp... | Sets the equivalent Ubeswap asset for the given asset. Using an equivalent asset helps to calculate the price of the Mobius asset by assuming the denomination asset is pegged to the Ubeswap asset. Only the contract owner can call this function. _denominationAsset Address of the asset the Mobius asset is priced ... | function setEquivalentUbeswapAsset(address _denominationAsset, address _ubeswapAsset) external onlyOwner {
require(_denominationAsset != address(0), "MobiusAdapter: invalid denomination asset address.");
require(_ubeswapAsset != address(0), "MobiusAdapter: invalid Ubeswap asset address.");
... | 12,727,002 |
./full_match/80001/0x24f51617c1ad2120CCd1c238AED2f770A772630E/sources/src/AllowListDrop.sol | ,-. `-' /|\ | ,----------. / \ |ERC721Drop| Caller `----+-----' | setOwner() | | ------------------... | function setOwner(address newOwner) public onlyAdmin {
_setOwner(newOwner);
}
| 851,113 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functio... | Commit to IRO, capped to remaining hardCap Cap contribution to remaining goal | function commit(uint256 amount) public onlyStatus(Status.FUNDING) {
require(amount > 0, "NO_COMMIT");
uint256 remaining = hardCap - committed;
if (amount > remaining) {
amount = remaining;
}
_walletCommitAmounts[msg.sender] += amount;
fundingToken.safe... | 255,504 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "./MedShareToken.sol";
import "./utils/StringsAndBytes.sol";
contract MedShare is MedShareToken {
// Biblical Principles
address storeHouseAddress = 0x7125fc5F7B09330a37D863fAb18aeBFdDf9f5382; // Genesis4149
// Maps every family addr... | Invest in my Family/ Exchanging ETH for USD Getting hTAG from XAG price and Exchanging USD for hTAG (MDST) | function invest() public payable returns (address) {
require(msg.sender != address(0x0), "MDST: It cannot invest to the zero address");
require(_registeredUsers[msg.sender], "MDST: You are not yet registered in a Family");
uint256 usd = (msg.value * uint256(getEthUsdPrice())) / 10**getEthUs... | 6,465,909 |
/**
*Submitted for verification at Etherscan.io on 2021-02-27
*/
pragma solidity 0.6.12;
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-own... | Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as... | function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "IKOMP::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return... | 2,392,761 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.