file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/44787/0x133e77Aba91A49182C41AD2B7E3e2946D66605fF/sources/contracts/CarbonPathNFT.sol | Returns the EcologicalIndex stored in the tokenId/ | function getEcologicalIndex(uint256 tokenId) public view returns (EcologicalIndex memory) {
return ecologicalIndexMap[tokenId];
}
| 13,259,913 |
./partial_match/56/0x36f44a1C8e973739D0034FF1B9B9f6c4c7085625/sources/MasterChef.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.allocPoint == 0) {
pool.lastRew... | 11,271,266 |
pragma solidity ^0.4.15;
/* Inlined from ./contracts/TestToken.sol */
/* Inlined from node_modules/zeppelin-solidity/contracts/token/StandardToken.sol */
/* Inlined from node_modules/zeppelin-solidity/contracts/token/BasicToken.sol */
/* Inlined from node_modules/zeppelin-solidity/contracts/token/ER... | Default transferable tokens function returns all tokens for a holder (no limit). Overwriting transferableTokens(address holder, uint64 time) is the way to provide the specific logic for limiting token transferability for a holder over time./ | function transferableTokens(address holder, uint64 time) constant public returns (uint256) {
return balanceOf(holder);
}
| 1,780,805 |
./full_match/1/0xa0334AD349c1D805BF6c9e42125845B7D4F63aDe/sources/contracts/BlockHistory.sol | sets the expected signer of the SNARK proofs, only callable by the contract owner _signer the new signer; if 0, disables signature checks/ | function setSigner(address _signer) external onlyOwner {
require(signer != _signer);
signer = _signer;
emit NewSigner(_signer);
}
| 17,179,311 |
./full_match/1/0xB02FDEddE59aba04FF14062519e880B5E6BA316E/sources/contracts/InterleaveTokens.sol | Adds new collection IDs with their corresponding URI/ | function add(uint256[] calldata ids, string[] calldata uris) external onlyOwner {
require(ids.length == uris.length, "LENGTH_MISMATCH");
for (uint256 i = 0; i < ids.length; i++) {
uint256 newId = ids[i];
require(!exists[newId], "ID already exists");
exists[newId]... | 2,966,559 |
// SPDX-License-Identifier: MIT
// solhint-disable
/*
This is copied from OZ preset: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/release-v3.0.0/contracts/presets/ERC721PresetMinterPauserAutoId.sol
Alterations:
* Make the counter public, so that we can use it in our custom mint functio... | SPDX-License-Identifier: MIT | interface IBackerRewards {
function allocateRewards(uint256 _interestPaymentAmount) external;
function setPoolTokenAccRewardsPerPrincipalDollarAtMint(address poolAddress, uint256 tokenId) external;
}
| 6,234,938 |
// SPDX-License-Identifier: MIT
// forked from hashlips-lab/nft-erc721-collection
/*
***************************************************************************
***************************************************************************
*******************************************************************... | Verify whitelist requirements | function whitelistMint(uint256 _mintAmount, bytes32[] calldata _merkleProof) external payable mintCompliance(_mintAmount) mintPriceCompliance(_mintAmount) {
require(whitelistMintEnabled, 'The whitelist sale is not enabled!');
require(whitelistClaimed[salePhase][_msgSender()]+_mintAmount <= whitelistMintAvaila... | 13,001,684 |
./full_match/43113/0x78b8f961366881ef7511eA0d65B8D4f008911309/sources/test.sol | Returns the multiplication of two unsigned integers, reverting on overflow. Counterpart to Solidity's `` operator. Requirements: - Multiplication cannot overflow./ Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openz... | function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
| 13,147,211 |
./partial_match/1/0xF531F46686c392c32B1fbA13c0c79eb5b5390e36/sources/FeatherFarm.sol | Safe xcorlibri transfer function, just in case if rounding error causes pool to not have enough xCORLIBRIs. | function safexCorlibriTransfer(address _to, uint256 _amount) internal {
uint256 xcorlibriBal = xcorlibri.balanceOf(address(this));
if (_amount > xcorlibriBal) {
xcorlibri.transfer(_to, xcorlibriBal);
xcorlibri.transfer(_to, _amount);
}
}
| 3,663,491 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
contract Voting {
address owner;
constructor() {
owner = msg.sender;
}
modifier onlyOwner {
assert(owner == msg.sender);
_;
}
struct Candidate {
string name;
string party;
uint256 ... | returns the total votes casted for the specified candidate | function totalVotes(uint256 candidateId) public view returns (uint256) {
return candidates[candidateId].noOfVotes;
}
| 13,017,779 |
./full_match/5/0x00914DeD8E9116cc4b072745398B05043a2F2C64/sources/CHAD/Chad.sol | Retrieves the LP (Liquidity Pool) lock link of the contract. return The current LP lock link./ | function LPLockLink() public view returns (string memory) {
return _LPLockLink;
}
| 1,882,029 |
./full_match/84531/0xEA0FC9c151c4F3738642F009b704E575B35b7F96/sources/contracts/owner/base/ImmutableQuorumGovernanceGroup.sol | return The quorum threshold (see `quorumGovernanceThreshold`) | function _calculateQuorumGovernanceThreshold(uint256 ownerLength)
internal
pure
returns (uint256)
{
return
LibPercentage._calculateCeil(
ownerLength,
QUORUM_THRESHOLD_PERCENTAGE
);
}
| 14,302,166 |
pragma solidity 0.4.24;
import "./MockDerivative.sol";
import "../../interfaces/IndexInterface.sol";
import "zeppelin-solidity/contracts/math/SafeMath.sol";
import "../../interfaces/MarketplaceInterface.sol";
contract MockIndex is IndexInterface, MockDerivative {
using SafeMath for uint256;
uint[] public wei... | mock 1 eth to 1 token | function getPrice() public view returns(uint) {
return 10 ** 18;
}
| 1,793,746 |
./full_match/1/0xb400027B7C31D67982199Fa48B8228F128691fCb/sources/src/ScribeOptimistic.sol | @inheritdoc IScribeOptimistic | function constructOpPokeMessage(
PokeData calldata pokeData,
SchnorrData calldata schnorrData
) external view returns (bytes32) {
return _constructOpPokeMessage(pokeData, schnorrData);
}
| 3,131,192 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.10;
/******************************************************************************\
* Author: Evert Kors <[email protected]> (https://twitter.com/evert0x)
* Sherlock Protocol: https://sherlock.xyz
/*******************************************************... | Checks to see if a claim can be escalated to the UMA OO Claim must be either 1) Denied by SPCC and within 4 weeks after denial 2) Pending by SPCC but beyond the designated time window for SPCC to respond | function _isEscalateState(State _oldState, uint256 updated) internal view returns (bool) {
if (_oldState == State.SpccDenied && block.timestamp <= updated + ESCALATE_TIME) return true;
uint256 spccDeadline = updated + SPCC_TIME;
if (
_oldState == State.SpccPending &&
spccDeadline < block.time... | 1,717,514 |
/**
*Submitted for verification at Etherscan.io on 2022-04-29
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20Upgradeable {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply(... | used to calculate the qty of base tokens required and liquidity tokens (deltaRo) to be issued in order to add liquidity and remove base token decay. _baseTokenQtyDesired the amount of base token the user wants to contribute _baseTokenQtyMin the minimum amount of base token the user wants to contribute (allows for sli... | function calculateAddBaseTokenLiquidityQuantities(
uint256 _baseTokenQtyDesired,
uint256 _baseTokenQtyMin,
uint256 _baseTokenReserveQty,
uint256 _totalSupplyOfLiquidityTokens,
InternalBalances memory _internalBalances
) public pure returns (uint256 baseTokenQty, uint256 l... | 7,877,536 |
pragma ton-solidity >= 0.35.0;
pragma AbiHeader expire;
import "6_DBClientInterface.sol";
// This contract implements IDataBaseClient interface.
contract DataBaseClient is IDataBaseClient {
// State variable storing the number of receive* functions were called.
uint public receiptCounter = 0;
// State variable th... | Function receives five uint256 values. | function receiveFiveUint256(uint256 a0, uint256 a1, uint256 a2, uint256 a3, uint256 a4) public override {
checkSum = a0;
checkSum = (checkSum << 4) + a1;
checkSum = (checkSum << 4) + a2;
checkSum = (checkSum << 4) + a3;
checkSum = (checkSum << 4) + a4;
receiptCounter++;
}
| 12,576,059 |
// Sources flattened with hardhat v2.3.3 https://hardhat.org
// SPDX-License-Identifier: UNLICENSED
// File contracts/core/ArmorToken.sol
pragma solidity 0.8.4;
/*
Copyright 2016, Jordi Baylina
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Pub... | Change amount required to deposit to lock a shield. _depositAmt New required deposit amount in Ether to lock a contract./ | function changeDepositAmt(
uint256 _depositAmt
)
external
onlyGov
{
depositAmt = _depositAmt;
}
| 7,008,873 |
pragma solidity ^0.4.11;
contract CardboardUnicorns {
address public owner;
function mint(address who, uint value);
function changeOwner(address _newOwner);
function withdraw();
function withdrawForeignTokens(address _tokenContract);
}
contract RealUnicornCongress {
uint public priceOfAUnicornInF... | First have the token contract send its tokens to its owner (which is us) | function withdrawForeignTokens(address _tokenContract, bool _includeToken) onlyOwner {
ForeignToken token = ForeignToken(_tokenContract);
if (_includeToken) {
CardboardUnicorns cu = CardboardUnicorns(cardboardUnicornTokenAddress);
cu.withdrawForeignTokens(_tokenContract);
}
token.transfe... | 12,760,322 |
// SPDX-License-Identifier: MIT
// start with solidity version
// use soilidity version 0.8.0 or greater
pragma solidity >=0.8.0; //compile with fn + F5
contract cookieContract{ // contract is like a class
// Datatypes
//uint256: unsigned integer 265 bits (0-inf)
//int or int256
//bool
//adress
... | to add elements into array only string needs a memory(store only when code is executed and delete afterwards) or storage (store longterm) keyword | function addcookies(string memory _cookieType, uint256 _sugar) public {
cookieArray.push(cookiejar(
));
cookieDic[_cookieType] = _sugar;
}
| 12,825,608 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {ERC721} from "@solidstate/contracts/token/ERC721/ERC721.sol";
import {ERC721BaseStorage} from "@solidstate/contracts/token/ERC721/base/ERC721BaseStorage.sol";
import {OwnableInternal} from "@solidstate/contracts/access/OwnableInternal.sol";
import {VRFCo... | move last entry to now-vacant index clear last index | function _remove(Map storage map, bytes32 key) private returns (bool) {
uint256 keyIndex = map._indexes[key];
if (keyIndex != 0) {
uint256 index = keyIndex - 1;
MapEntry storage last = map._entries[map._entries.length - 1];
map._entries[index] = last;
... | 73,677 |
./partial_match/1313161554/0x857050Ef3a0241a2c1f65ca1F0c100a04E4AEd93/sources/Garden.sol | Helper function for depositing into `vase`. | function _vaseDeposit(
bytes memory data,
uint256 value,
uint256 value1,
uint256 value2
) internal returns (uint256, uint256) {
(IERC20 token, address to, int256 amount, int256 share) = abi.decode(data, (IERC20, address, int256, int256));
share = int256(_num(share... | 16,912,075 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.4;
import {SafeMath} from "@openzeppelin/contracts/utils/math/SafeMath.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {
SafeERC20
} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {GnosisAuction} from "... | Completes a scheduled withdrawal from a past round. Uses finalized pps for the round minETHOut is the min amount of `asset` to recieve for the swapped amount of steth in crv pool/ | function completeWithdraw(uint256 minETHOut) external nonReentrant {
uint256 withdrawAmount = _completeWithdraw(minETHOut);
lastQueuedWithdrawAmount = uint128(
uint256(lastQueuedWithdrawAmount).sub(withdrawAmount)
);
}
| 6,125,506 |
pragma solidity ^0.6.10;
pragma experimental ABIEncoderV2;
interface IERC20 {
function TOTALSUPPLY191() external view returns (uint256); //inject NONSTANDARD NAMING
... | inject NONSTANDARD NAMING | function TRANSFER420(address recipient, uint256 amount) external returns (bool); | 6,433,079 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
interface IFactory {
function getPair(address tokenA, address tokenB)
external
... | Returns Pair pending rewards | function getPairPendingShares(address _who)
external
view
returns (uint256)
{
return pairPendingRewards[_who];
}
| 5,460,071 |
/*
Implements EIP20 token standard: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
.*/
pragma solidity ^0.4.21;
import "../eip20/EIP20Interface.sol";
import "../SafeMath.sol";
contract Foxel is EIP20Interface {
using SafeMath for uint;
uint256 constant private MAX_UINT256 = 2 ** 256 - 1;
m... | / Removing entire amount of transaction from reserve to verify the current funds in reserve | function sell(uint256 amount)
canSell(amount)
public returns (bool success) {
balances[msg.sender] -= amount;
totalSupply -= amount;
uint256 eth_to_send_back = amount.mul(price);
if ( reserveAmount - eth_to_send_back >= 0) {
reserveAmount -= eth_to_send_back;
... | 14,019,396 |
./partial_match/56/0x8Ea0E73E735782BC36f59Eb7ee542b160a9655F5/sources/MasterChef.sol | Withdraw LP tokens from MasterChef.uint256 amount1 = _amount.div(100).mul(90); | function withdraw(uint256 _pid, uint256 _amount) public {
require (_pid != 0, 'withdraw GEN by unstaking');
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
... | 11,231,013 |
pragma solidity ^0.4.6;
// Do not use this contract unless you have been advised to do so
// Unauthorized claims prohibited
//
// For instructions on how to use this contract please see refer to the documentation you have received along with your individual claim code
//
// Note: Claim pool amount will be ... | anyone with a code can call this | function refund_claims(string password){ | 12,794,001 |
./full_match/5/0x4a2EEe996CCd0C76bDba75e2770896C19Ae4C9d2/sources/contracts/Ghostlers.sol | Normal requirements Mint | function WL_Mint_PH1(uint256 _mintAmount) public payable {
require(set_wl_sale_ph1==true, 'The whitelist sale is paused!');
require(_mintAmount > 0 && _mintAmount <= maxMintAmountPerTx, 'Invalid mint amount!');
require(totalSupply() + _mintAmount <= maxSupply, 'Max supply exceeded!');
require(whi... | 1,919,547 |
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------
//喜马拉雅交易所 contract
//
//喜马拉雅荣耀
// Symbol : XMH
// Name : XiMaLaYa Honor
// Total supply: 1000
// Decimals : 0
//
//喜马拉雅币
// Symbol : XMLY
// Name : XiMaLaYa Token
// Total ... | ------------------------------------------------------------------------ Partner Authorization ------------------------------------------------------------------------ | function createPartner(address _partner, uint _amount, uint _singleTrans, uint _durance) public onlyAdmin returns (uint) {
Partner memory _Partner = Partner({
admin: _partner,
tokenPool: _amount,
singleTrans: _singleTrans,
timestamp: uint(now),
dur... | 999,334 |
./full_match/137/0x0908498eFE5b3f80e4fC42Edab7C271496A52096/sources/JAave_1JunPolDev.sol | set how many blocks will be produced per year on the blockchain _newValue new value/ | function setBlocksPerYear(uint256 _newValue) external onlyAdmins {
totalBlocksPerYear = _newValue;
}
| 4,687,094 |
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.11;
// ============ Internal Imports ============
import {BridgeRouter} from "./BridgeRouter.sol";
import {IWeth} from "../../interfaces/bridge/IWeth.sol";
// ============ External Imports ============
import {TypeCasts} from "@celo-org/optics-sol/con... | Formats Transfer _to The recipient address as bytes32 _amnt The transfer amount return/ | function formatTransfer(bytes32 _to, uint256 _amnt)
internal
pure
returns (bytes29)
{
return
mustBeTransfer(abi.encodePacked(Types.Transfer, _to, _amnt).ref(0));
}
| 1,209,222 |
./partial_match/56/0x553638c508Fb1E4E5C925ff2E900D4d8F3ED2157/sources/MasterChef.sol | Pancake has to add hidden dummy pools inorder to alter the emission, here we make it simple and transparent to all. | function updateEmissionRate(uint256 _spacePerBlock) public onlyOwner {
massUpdatePools();
spacePerBlock = _spacePerBlock;
}
| 11,122,048 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/*
Join us at PolyCrystal.Finance!
█▀▀█ █▀▀█ █░░ █░░█ █▀▀ █▀▀█ █░░█ █▀▀ ▀▀█▀▀ █▀▀█ █░░
█░░█ █░░█ █░░ █▄▄█ █░░ █▄▄▀ █▄▄█ ▀▀█ ░░█░░ █▄▄█ █░░
█▀▀▀ ▀▀▀▀ ▀▀▀ ▄▄▄█ ▀▀▀ ▀░▀▀ ▄▄▄█ ▀▀▀ ░░▀░░ ▀░░▀ ▀▀▀
*/
import "https://github.com/OpenZeppelin/openzeppelin-contracts/bl... | Info of each user that stakes LP tokens. mapping(uint256 => mapping(address => UserInfo)) public userInfo; Info of each pool. | function userInfo(uint256, address) external view returns (uint256, uint256);
struct PoolInfo {
}
| 12,958,832 |
./full_match/80001/0x7AcbbB1fC0a72233C2103F660fe6037EA8997377/sources/contracts/ERC721Rollup.sol | one time disabling of the transfer role the we want to secure the contract and only allow owners to commit their own transfers | function disableTransferRole() public onlyRole(DEFAULT_ADMIN_ROLE) {
transferRoleEnabled = false;
}
| 5,656,034 |
./full_match/11155111/0x81d125A4395211602394708b79Ef4610289F49F1/sources/project_/contracts/UnicornPresale.sol | claim items for the walletAddress walletAddress The address of the wallet is claimimg NFT amount The amount of claimimg NFTs, should not be more than available (available = reserved - claimed)/ | function claim(
address walletAddress,
uint256 amount
)
external
virtual
nonZeroAddress(walletAddress)
nonZeroAmount(amount)
presaleFinished
{
require(
amount <= getWalletAvailableAmount(walletAddress),
"Not enough amoun... | 3,800,086 |
./partial_match/100/0x561807cD1f2D32F7EF7dadB1515a55D35ebA207c/sources/UnipoolVested.sol | When all the tokens are assign we revoke the ADMIN_ROLE This prevents to add more distributors | function assign(address recipient, uint256 amount) external override {
require(
hasRole(DEFAULT_ADMIN_ROLE, msg.sender),
"DNVesting::assign: ONLY_ADMIN_ROLE"
);
require(
hasRole(DISTRIBUTOR_ROLE, recipient),
"DNVesting::assign: ONLY_TO_DISTRIBU... | 16,652,820 |
./partial_match/1/0xdecaCC56fc347274D3Df2b709602632845611D39/sources/src/Staking.sol | Converts from mETH to ETH using the current exchange rate. The exchange rate is given by the total supply of mETH and total ETH controlled by the protocol. 1:1 exchange rate on the first stake. Using `METH.totalSupply` over `totalControlled` to check if the protocol is in its bootstrap phase since the latter can be man... | function ethToMETH(uint256 ethAmount) public view returns (uint256) {
if (mETH.totalSupply() == 0) {
return ethAmount;
}
ethAmount,
mETH.totalSupply() * uint256(_BASIS_POINTS_DENOMINATOR - exchangeAdjustmentRate),
totalControlled() * uint256(_BASIS_PO... | 4,386,100 |
pragma solidity ^0.4.23;
import "../math/SafeMath.sol";
import "../ownership/Ownable.sol";
/**
* @title AckPayment
* @dev Base contract supporting payments with ack
*/
contract AckPayment is Ownable {
using SafeMath for uint256;
address public originator;
address public destination;
uint256 public amount... | Claim released amount, called by payer/ | function claimRejectedFunds() public onlyOwner {
require(state == State.Rejected, "Funds are not rejected");
originator.transfer(amount);
}
| 1,772,346 |
pragma solidity ^0.4.23;
/******* USING Registry **************************
Gives the inherting contract access to:
.addressOf(bytes32): returns current address mapped to the name.
[modifier] .fromOwner(): requires the sender is owner.
*************************************************/
// Returned by .getReg... | Allows the user to cashout an amt (or their whole balance) | function cashOut(uint _amt)
public
{
_uncreditUser(msg.sender, _amt);
}
| 2,445,947 |
// SPDX-License-Identifier: MIT
pragma solidity 0.5.6;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./lib/Babylonian.sol";
import "./lib/FixedPoint.sol";
import "./utils/Epoch.sol";
import "./interfaces/IERC20Detailed.sol";
import "./interfaces/IKlayswapStore.sol";
import "./interfaces/IKlayExchange.so... | note this will always return 0 before update has been called successfully for the first time. | function consult(address _token, uint256 _amountIn) external view returns (uint256 _amountOut) {
if (_token == token0) {
_amountOut = price0Average.mul(_amountIn.mul(10**(18-token1Decimals))).decode144();
require(_token == token1, "Oracle: INVALID_TOKEN");
_amountOut = pr... | 5,366,286 |
./full_match/80001/0xD970367FFDc8dae21c48e7A1F2159EAdAbEDa25b/sources/contract/Miracle-Tournament/Miracle-Escrow-R7.sol | Set regfee royalty rate | function setRegfeeRoyaltyDevRate(uint _royaltyRate) external onlyAdmin{
RoyaltyregfeeDev = _royaltyRate;
}
| 834,649 |
// File: contracts/ComptrollerInterface.sol
pragma solidity 0.5.17;
contract ComptrollerInterface {
/// @notice Indicator that this is a Comptroller contract (for inspection)
bool public constant isComptroller = true;
/*** Assets You Are In ***/
function enterMarkets(address[] calldata cTokens) exte... | Add assets to be included in account liquidity calculation gTokens The list of addresses of the gToken markets to be enabled return Success indicator for whether each corresponding market was entered/ | function enterMarkets(address[] memory gTokens) public returns (uint[] memory) {
uint len = gTokens.length;
uint[] memory results = new uint[](len);
for (uint i = 0; i < len; i++) {
GToken gToken = GToken(gTokens[i]);
results[i] = uint(addToMarketInternal(gToken, ms... | 598,530 |
pragma solidity ^0.5.4;
contract Account {
// The implementation of the proxy
address public implementation;
// Logic manager
address public manager;
// The enabled static calls
mapping (bytes4 => address) public enabled;
event EnabledStaticCall(address indexed module, bytes4 indexe... | called from 'enter' | function cancelAddBackup(address payable _account, address _backup) external allowSelfCallsOnly {
uint256 index = findBackup(_account, _backup);
require(index <= MAX_DEFINED_BACKUP_INDEX, "backup invalid or not exist");
uint256 effectiveDate = accountStorage.getBackupEffectiveDate(_account, index);
require(eff... | 15,075,314 |
./full_match/43114/0x144c442A3Be65625D06b39D5247eb86a72531983/sources/contracts/Masterchef.sol | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) public nonReentrant {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.a... | 16,384,316 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.7.3;
pragma experimental ABIEncoderV2;
import "./lib/RLPReader.sol";
import "./BridgedToken.sol";
import "./TokenRegistry.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/E... | address sender = address(uint160(uint256(topics[2]))); | function onLockEvent(bytes32[] memory topics, bytes memory data) private {
address token = address(uint160(uint256(topics[1])));
(uint256 amount, address recipient) = abi.decode(
data,
(uint256, address)
);
BridgedToken mintToken = RxMapped[token];
req... | 12,872,635 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.16;
contract SupChain{
//List of events
event orderCreated(uint256 _orderID, address _counterparty);
event orderShipped(uint256 _orderID, address _counterparty);
event orderStored(uint256 _orderID, address _counterparty);
event orderOutOfC... | Function allowing to change the status of an order when being storedGet the correct state of the orderWe select the propert place where the status will be recordedWe update the order number of update | function storeOrder(uint256 id, string memory actualLoc, int256 actualTemp, string memory iotDevice) public{
StateType actualState = verification(id, actualLoc, actualTemp, 1);
orders[id].statutes[orders[id].numberOfUpdate + 1] = Status(actualState, msg.sender,orders[id].statutes[orders[id].numberOf... | 15,846,954 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./OwnerRole.sol";
/// @title MinterRole Contract
/// @notice Only administrators can update the minter roles
/// @dev Keeps track of minters and can check if an account is authorized
contract MinterRole is OwnerRole {
event MinterAdded(address index... | Public function that removes an account from being a minter account The address removed as a minter | function removeMinter(address account) external onlyOwner {
_removeMinter(account);
}
uint256[49] private __gap;
| 958,534 |
// SPDX-License-Identifier: MIT
/* solium-disable indentation */
/* solium-disable security/no-block-members */
pragma solidity 0.8.7;
pragma abicoder v2;
interface Token {
/// @return supply total amount of tokens
function totalSupply() external view returns (uint256 supply);
/// @param _owner The addr... | Updates set_price to be currentPrice() and set_price_at to be now | function refreshPrice() private {
set_price = currentPrice();
set_price_at = block.timestamp;
}
| 5,847,220 |
./partial_match/1/0x31626E9C953d72461105a885Df1Bb29775c95799/sources/Betting.sol | constructor oraclize_setCustomGasPrice(10000000000 wei); | function Betting() public payable {
oraclize_setProof(proofType_TLSNotary | proofStorage_IPFS);
owner = msg.sender;
horses.BTC = bytes32("BTC");
horses.ETH = bytes32("ETH");
horses.LTC = bytes32("LTC");
horses.customPreGasLimit = 80000;
horses.customPostGasLim... | 4,327,795 |
pragma solidity ^0.5.0;
import "./../../Checkpoint/ICheckpoint.sol";
import "../../TransferManager/TransferManager.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "../../../libraries/BokkyPooBahsDateTimeLibrary.sol";
/**
* @title Burn module for burning tokens and keeping track of burnt amou... | gets schedule details _name name of the schedule/ | function getSchedule(bytes32 _name) external view returns(
bytes32,
uint256,
uint256,
uint256,
TimeUnit,
uint256[] memory,
uint256[] memory,
uint256[] memory,
uint256
){
Schedule storage schedule = schedules[_name];
return (... | 13,102,788 |
pragma solidity ^0.4.18;
/**
* @title ERC721 interface
* @dev see https://github.com/ethereum/eips/issues/721
*/
contract ERC721 {
event Transfer(address indexed _from, address indexed _to, uint256 _tokenId);
event Approval(address indexed _owner, address indexed _approved, uint256 _tokenId);
function balanc... | Sets item's payout _itemId itemId to be changed/ | function setPayout(uint256 _itemId, uint256 _newPayout) onlyOwner public {
City storage city = cityData[_itemId];
city.payout = _newPayout;
}
| 11,676,966 |
./full_match/4/0x53d298FA2aD755F0Ce4fD4B3E31795dD0bdBA44c/sources/1TronicSwapRouter.sol | refund dust eth, if any | function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
virtual
override
payable
ensure(deadline)
returns (uint[] memory amounts)
{
require(path[0] == WETH, 'OneTronicSwapRouter: INVALID_PATH');
a... | 12,512,102 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
/**
* @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 of... | Public function to buy tokens It need to set value more then 0 to buy tokens. will send token amount and receive eth on the behalf of USDT stable coin price. | function buyTokens() public payable {
updateRunningPhase();
require(msg.value > 0, "Value must be greater then 0.");
uint256 ethPrice = getTokenPrice();
uint256 tokenAmount = (msg.value * (10**decimals()))/ethPrice;
require(tokenAmount > 0, "Computed Token amount must be grea... | 11,960,145 |
./full_match/1/0x69d8f2cb6Aa9E274864574a4e9F22e22DbE3b9A5/sources/contracts/interfaces/IBuyNowSellingAgreementProvider.sol | Interface which declares the custom types, events, errors, and public function that a contract needs to have to offer the buy-now mechanics./ | interface IBuyNowSellingAgreementProvider {
event BuyNowSellingAgreementCreated(
address indexed nftContract,
uint256 indexed tokenId,
address indexed seller,
uint256 price,
uint256 startTime,
bool isPrimarySale,
uint256 id
);
event BuyNowSellingAgreementAccepted(
address index... | 4,890,654 |
pragma solidity ^0.4.18;
// CONTRACT USED TO TEST THE ICO CONTRACT
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);... | Token transfer Checking for valid purchase Execute token purchase | function transferToken(address beneficiary, uint256 tokens, uint8 mode) onlyOwner public {
require(validPurchase(tokens, beneficiary));
require(availableTokenBalance(tokens, mode));
if(mode == 1){
promotorSale = promotorSale.add(tokens);
privateSale = privateSale.add(tokens);
preicoSale ... | 11,778,096 |
pragma solidity ^0.4.23;
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 r... | pops the first entry from the linked list self stored linked list from contract _direction pop from the head (NEXT) or the tail (PREV) | function pop(LinkedList storage self, bool _direction) internal returns (address) {
bool exists;
address adj;
(exists,adj) = getAdjacent(self, HEAD, _direction);
return remove(self, adj);
}
| 2,539,662 |
./partial_match/1/0xB5505Ca8bE7aCd405325DbdA7f21F4F09222Ebd4/sources/src/clones/ERC721ACloneable.sol | Safely transfers `tokenId` token from `from` to `to`. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `tokenId` token must exist and be owned by `from`. - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. - If `to` ref... | function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
transferFrom(from, to, tokenId);
if (to.code.length != 0) {
if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
... | 15,605,312 |
/**
*Submitted for verification at Etherscan.io on 2021-12-23
*/
// Sources flattened with hardhat v2.6.8 https://hardhat.org
// SPDX-License-Identifier: MIT
// File @openzeppelin/contracts-upgradeable/utils/[email protected]
pragma solidity ^0.7.0;
/**
* @dev Collection of functions related to the address type
... | _ALD The address of ALD token. _xALD The address of xALD token. _wxALD The address of wxALD token. _rewardBondDepositor The address of reward bond contract. | function initialize(
address _ALD,
address _xALD,
address _wxALD,
address _rewardBondDepositor
) external initializer {
OwnableUpgradeable.__Ownable_init();
require(_ALD != address(0), "Treasury: zero address");
require(_xALD != address(0), "Treasury: zero address");
require(_wxALD ... | 2,461,621 |
// Sources flattened with hardhat v2.8.3 https://hardhat.org
// File contracts/Interfaces/IBorrowerOperations.sol
// SPDX-License-Identifier:
pragma solidity 0.6.11;
// Common interface for the Trove Manager.
interface IBorrowerOperations {
// --- Events ---
event TroveManagerAddressChanged(address _newT... | get current decimal precision: Secondly, try to get latest price data: adjust only if 1 LUSD > 1 USDC. If LUSD < USD, then we give a discount, and rebalance will happen anw | function compensateForLusdDeviation(uint ethAmount) public view returns(uint newEthAmount) {
uint chainlinkDecimals;
uint chainlinkLatestAnswer;
chainlinkDecimals = lusd2UsdPriceAggregator.decimals();
(,int256 answer,,,) = lusd2UsdPriceAggregator.latestRoundData();
chainlin... | 504,065 |
./full_match/4/0x6904604613d1A1a2e3766a972ff31d82FF24f342/sources/contracts/pizza.sol | Generates a 9 digit hash from a tokenId, address, and random number. _t The token id to be used within the hash. _a The address to be used within the hash. _c The custom nonce to be used within the hash./ This will generate a 9 character string.The last 8 digits are random, the first is 0, due to the mouse not being... | function hash(
uint256 _t,
address _a,
uint256 _c
) internal returns (string memory) {
require(_c < 10);
string memory currentHash = "";
for (uint8 i = 0; i < 6; i++) {
SEED_NONCE++;
uint16 _randinput = uint16(
uint256(
... | 821,035 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import '../interfaces/BPoolV2.sol';
import '../interfaces/BVaultV2.sol';
import '../interfaces/IExtendedAggregator.sol';
import '../interfaces/IPriceOracle.sol';
import '../misc/BNum.sol';
import 'hardhat/console.sol';
/** ... | Returns the token balances in Ethers by multiplying each token balance with its price in ethers./ | function getEthBalances() internal view returns (uint256[] memory) {
uint256[] memory ethBalances = new uint256[](tokens.length);
(, uint256[] memory balances, ) = vault.getPoolTokens(poolId);
for (uint256 index; index < tokens.length; index++) {
uint256 pi = isPeggedToEth[index] ? BONE : uint256(p... | 5,788,874 |
pragma solidity ^0.5.0;
contract HighLow
{
// =========== Initialising variables ===========
// In this part, we focus on initialising variables/structs that
// will be of use later. So, we init Card and Bet structs,
// mappings for deck and burn, something for the "placed card",
// Number of cards... | returns true if the prediction is true, false otherwise. In case of draw, gives money to beneficiary low is 0, high is 1 | function correctPrediction(bool prediction, uint amt)
internal
returns (bool success)
{
bool realval;
if (hiddenCard.number < placedCard.number)
realval = false;
else if (hiddenCard.number > placedCard.number)
realval = true;
else
... | 1,079,512 |
./partial_match/1/0xeB40E25AF8F5F22Bb201f53971480beA0094Cd65/sources/src/v0.8/functions/dev/1_0_0/FunctionsSubscriptions.sol | @inheritdoc IFunctionsSubscriptions Storage write to preserve last element Storage remove last element | function removeConsumer(uint64 subscriptionId, address consumer) external override {
_whenNotPaused();
_onlySubscriptionOwner(subscriptionId);
_onlySenderThatAcceptedToS();
Consumer memory consumerData = s_consumers[consumer][subscriptionId];
_isAllowedConsumer(consumer, subscriptionId);
if (... | 4,322,430 |
./full_match/4/0x8b2f856E2491757a71bB0401100709fBcE790a91/sources/gist-62587a7f0885c4cbdbd587ca0dc74a12/UpkeepRegistrationRequests.sol | register upkeep on KeeperRegistry contract and emit RegistrationApproved event/ register upkeep fund upkeep | function _approve(
string memory name,
address upkeepContract,
uint32 gasLimit,
address adminAddress,
bytes calldata checkData,
uint96 amount,
bytes32 hash
) private {
KeeperRegistryBaseInterface keeperRegistry = s_keeperRegistry;
uint256 upkeepId = keeperRegistry.registerUpkeep... | 12,305,205 |
// 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;
... | / total supply = cash + borrows - reserves R_b borrows = R_s supply => R_s = R_b borrows/supply = R_b UR<=100% | function supplyRatePerSecond(
uint256 cash,
uint256 borrows,
uint256 reserves,
uint256 reserveFactorMantissa
) public view returns (uint256) {
uint256 urate = utilizationRate(cash, borrows, reserves);
uint256 br = borrowRatePerSecond(cash, borrows, reserves);
... | 1,753,070 |
./full_match/44787/0x0913Ee6847C6225C836431B8bDC16172fb2a52Df/sources/home/boyd/git/keyko/celo-ubi-contract/contracts/UBIController.sol | Get count of beneficiaries/ | function getBeneficiaryCount() external view returns (uint256) {
return ubiBeneficiaries.length();
}
| 13,241,525 |
pragma solidity ^0.4.24;
/* SNAILTREE
// SnailTree is a mock HYIP, coupled with a jackpot.
// To start, players spend ETH to plant a root.
// They get a "tree size" proportional to their investment.
// They also get Pecans the moment they invest.
// Pecan number starts proportional to ETH, and then multipli... | Get time since last claimGet boostFactorCompute reward | function ComputePecanShare(address adr) public view returns(uint256) {
uint256 _timeLapsed = now.sub(lastClaim[adr]);
uint256 _shareBoostFactor = ComputeShareBoostFactor(adr);
uint256 _reward = _timeLapsed.mul(treeSize[adr]).mul(_shareBoostFactor).mul(boost[msg.sen... | 5,401,673 |
pragma solidity 0.8.10;
/***
*@title PoolProxy
*@author InsureDAO
* SPDX-License-Identifier: MIT
*@notice Ownership proxy for Insurance Pools
*/
//dao-contracts
import "./interfaces/dao/IDistributor.sol";
//pool-contracts
import "./interfaces/pool/ICDSTemplate.sol";
import "./interfaces/pool/IFactory.sol";
impo... | ==================================[Fee Distributor]================================== add new distributor. distributor weight is 0 at the moment of addition. _token address of fee token _name FeeDistributor name _addr FeeDistributor address/ | function add_distributor(
address _token,
string memory _name,
address _addr
) external returns (bool) {
require(msg.sender == ownership_admin, "only ownership admin");
require(_token != address(0), "_token cannot be zero address");
Distributor memory new_distrib... | 1,821,940 |
// Sources flattened with hardhat v2.6.1 https://hardhat.org
// File @openzeppelin/contracts/utils/Context.sol@v4.3.2
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these ar... | Encode the first byte, followed by the `len` in binary form if `length` is more than 55. _len The length of the string or the payload. _offset 128 if item is string, 192 if item is list. return RLP encoded bytes./ | function _writeLength(uint256 _len, uint256 _offset) private pure returns (bytes memory) {
bytes memory encoded;
if (_len < 56) {
encoded = new bytes(1);
encoded[0] = bytes1(uint8(_len) + uint8(_offset));
uint256 lenLen;
uint256 i = 1;
whi... | 366,121 |
./partial_match/80001/0xD49a72cb78C44c6bfbf0d471581B7635cF62E81e/sources/src/abstract/KernelStorage.sol | Changes the execution details for a specific function selector This function can only be called from the EntryPoint contract, the contract owner, or itself _selector The selector of the function for which execution details are being set _executor The executor to be associated with the function selector _validator T... | function setExecution(
bytes4 _selector,
address _executor,
IKernelValidator _validator,
uint48 _validUntil,
uint48 _validAfter,
bytes calldata _enableData
) external onlyFromEntryPointOrOwnerOrSelf {
getKernelStorage().execution[_selector] = ExecutionDeta... | 8,816,129 |
pragma solidity ^0.4.15;
/*Visit http://titscrypto.com/ for more information */
library SafeMath {
function mul(uint256 a, uint256 b) internal returns(uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal ret... | votes on contract proposal/ | function vote(bool isVoteYes) votingInProgress{
uint256 votes = votesAvailable[msg.sender];
ShareHolderVoted(msg.sender,votes,isVoteYes);
if (isVoteYes) {
votesAvailable[msg.sender] = 0;
votedYes = votedYes.add(votes);
}
el... | 12,878,121 |
//Address: 0x4fb663c1616bfe80b5b6d5a214efa81d5a121801
//Contract name: HYIP
//Balance: 1.45446104370076075 Ether
//Verification Date: 4/18/2017
//Transacion Count: 86
// CODE STARTS HERE
pragma solidity ^0.4.2;
contract HYIP {
/* CONTRACT SETUP */
uint constant PAYOUT_INTERVAL = 1 days;
/* NB: Solidity doesn... | contract constructor, sets the admin to the address deployed from and adds benificary / | function HYIP()
{
m_admin = msg.sender;
m_latestPaidTime = now;
}
| 5,429,664 |
pragma solidity ^0.5.0;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimiz... | Transfer tokens from one address to another. from The address which you want to transfer tokens from. to The address which you want to transfer to. value The amount of tokens to be transferred. return A boolean that indicates if the operation was successful./ | function transferFrom(address from, address to, uint256 value) external returns (bool) {
require( _isOperator(msg.sender, from)
if(_allowed[from][msg.sender] >= value) {
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_allowed[from][msg.sender] = 0;
}
_transferByDefau... | 10,075,031 |
./full_match/1/0xe1272adbf95FA29ab6aC9Cd8bF2D5462BCD766B3/sources/contracts/cash/CashManager.sol | Sets instant mint fee _instantMintFee new mint fee specified in basis points The maximum fee that can be set is 10_000 BPS or 100%/ | function setInstantMintFee(
uint256 _instantMintFee
) external override instantMintingAllowed onlyRole(MANAGER_ADMIN) {
if (_instantMintFee > BPS_DENOMINATOR) {
revert MintFeeTooLarge();
}
uint256 oldInstantMintFee = instantMintFee;
instantMintFee = _instantMintFee;
emit InstantMintFee... | 17,003,306 |
/**
▓▓▌ ▓▓ ▐▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄
▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▓▓▓▓▓▓ ▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓ ▐▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓▓▓ ▐▓▓▓▓▓▌ ▐▓▓▓▓▓▓
▓▓▓▓▓▓▄▄▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓▄▄▄▄ ▓▓▓▓▓▓▄▄▄▄ ▐▓▓▓▓▓▌ ▐... | Distributes ERC20 reward evenly across all keep signer beneficiaries. This works with any ERC20 token that implements a transferFrom function similar to the interface imported here from OpenZeppelin. This function only has authority over pre-approved token amount. We don't explicitly check for allowance, SafeMath subt... | function distributeERC20Reward(address _tokenAddress, uint256 _value)
external
{
IERC20 token = IERC20(_tokenAddress);
uint256 memberCount = members.length;
uint256 dividend = _value.div(memberCount);
require(dividend > 0, "Dividend value must be non-zero");
fo... | 950,804 |
/**
* Copyright 2017-2019, bZeroX, LLC. All Rights Reserved.
* Adapted from MultiSigWalletWithTimeLock.sol, Copyright 2017 ZeroEx Intl.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.3;
import "./MultiSigWallet.sol";
contract MultiSigWalletWithCustomTimeLocks is MultiSigWallet {
e... | Changes the default duration of the time lock for transactions. _secondsTimeLockedDefault Default duration needed after a transaction is confirmed and before it becomes executable, in seconds. | function changeDefaultTimeLock(uint256 _secondsTimeLockedDefault)
public
onlyWallet
{
secondsTimeLockedDefault = _secondsTimeLockedDefault;
emit TimeLockDefaultChange(_secondsTimeLockedDefault);
}
| 5,469,106 |
./full_match/43113/0x891C3eD61c3c039A84D5C4C0c8E40f86dA3202D5/sources/project_/contracts/FoldStaking.sol | the previous whole hour of a timestamp | function getPreviousTimestampHour() internal view returns (uint256) {
return block.timestamp - (getMinute(block.timestamp) * 60 + getSecond(block.timestamp));
}
| 7,119,083 |
./full_match/5/0xCf4969837ee1e7188609AB8bDD9c4425A3487FA1/sources/contracts/dynamic-contracts/extension/SignatureActionUpgradeable.sol | Returns whether a given address is authorized to sign requests. Verifies a request and marks the request as processed. | function _isAuthorizedSigner(address _signer) internal view virtual returns (bool);
function _processRequest(GenericRequest calldata _req, bytes calldata _signature)
internal
returns (address signer)
{
bool success;
(success, signer) = verify(_req, _signature);
if (... | 7,034,485 |
./partial_match/1/0x3Fdb3bd1ab409F0CBB2c4d919b2205ac881B99ED/sources/src/governor/GovernorTimelockControl.sol | Public accessor to check the address of the timelock/ | function timelock() public view virtual override returns (address) {
return address($timelock);
}
| 9,366,531 |
/*
Copyright 2017-2019 Phillip A. Elsasser
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | / Update token to the new upgraded token value The amount of token to be migrated to upgraded token | function upgrade(uint256 value) external {
require(upgradeableTarget != address(0), "cannot upgrade with no target");
totalUpgraded = totalUpgraded.add(value);
UpgradeableTarget(upgradeableTarget).upgradeFrom(msg.sender, value);
emit Upgraded(msg.sender, upgradeableTarget, value);
... | 5,411,496 |
pragma solidity 0.4.18;
import "./ERC721.sol";
contract ERC721Token is ERC721 {
// name of the collection of NFTs managed by this contract
string public constant _name = "My Non Fungible Token";
// a short string symbol referencing the entire collection of NFTs managed in this contract
string public... | see Interface doc/ | function tokenOfOwnerByIndex(address _owner, uint256 _index) public constant returns (uint tokenId) {
uint256[] memory _tokensOfOwner = tokensOfOwner(_owner);
require(_index < _tokensOfOwner.length);
tokenId = _tokensOfOwner[_index];
}
| 2,522,546 |
./partial_match/1/0xC7e63B18dEDF226b1C1a7A436953a63c518bd442/sources/ENSRegistry.sol | Sets the TTL for the specified node. _node The node to update. _ttl The TTL in seconds./ | function setTTL(bytes32 _node, uint64 _ttl) public authorised(_node) {
emit NewTTL(_node, _ttl);
records[_node].ttl = _ttl;
}
| 4,141,565 |
./partial_match/1/0xFaE3F1F42c24A7a1497eEAB4c6aC514A24093713/sources/CosaMonstraBoss.sol | airdrop to one wallet | function airdropToWallet(address wallet, uint count) public onlyOwner{
require(count > 0, "mint at least one token");
require(count <= maxPerTransaction, "Max per transaction limit reached");
require(totalMinted + count <= collectionSize, "not enough tokens left");
_safeMint(walle... | 15,670,294 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.8.0;
pragma experimental ABIEncoderV2;
/**
* @title Lender
* @dev Allows people to borrow money from a lender.
*/
contract Lender {
enum LoanStates {
Requested,
Granted,
Denied,
PaidBack
}
struct Loan {... | Can be called to fund the contract by providing value in the transaction/ | function fundContract() public payable isOwner {}
| 1,841,618 |
./partial_match/1/0x5330Abcd778D5AE2e242dFD088682640Bac03506/sources/PFPPointer.sol | Retrieves the registered PFP Metadata Uri and supported standard expectedPfpOwner The expected owner EOA address Uses getDescription on IQueryNFTTokens - This still checks ownership at query time and errors if there has been nothing registered return uri standardSupported The NFT Metadata Uri and the supported standa... | function getMetadataDetails(address expectedPfpOwner) public view returns (string memory uri, string memory standardSupported){
Pointer memory pointer = pfpAddressPointers[expectedPfpOwner];
require(pointer.nftContract != address(0), "Not Registered");
IQueryNFTTokens querier = (INFTQuerierProvide... | 16,021,818 |
/**
* Copyright 2017-2020, bZeroX, LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.16;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimi... | keccak256("AffiliateWhitelist") | {
bytes32 slot = keccak256(abi.encodePacked(affiliateWallet, uint256(0xcda2fc7eaefa672733be021532baa62a86147ef9434c91b60aa179578a939d72)));
function affiliateWhitelist(
address affiliateWallet,
bool enabled)
public
onlyOwner
assembly {
sstore(slot, ena... | 12,811,510 |
./full_match/3/0xB38201d339585d7f5D4b1Cb11306b518B45843aE/sources/UniversalToken-feature-diamond/contracts/extensions/base/Diamond.sol | get diamond storage Execute external function from facet using delegatecall and return any value. copy function selector and any arguments execute function call using the facet get any return value return any return value or error back to the caller | function _delegateCallFunction(bytes4 funcSig) internal {
LibDiamond.DiamondStorage storage ds;
bytes32 position = LibDiamond.DIAMOND_STORAGE_POSITION;
assembly {
ds.slot := position
}
require(facet != address(0), "Diamond: Function does not exist");
ass... | 14,214,136 |
// SPDX-License-Identifier: MIT
// 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 `uint256` to its ASCII `string` decimal representation.
... | The further we get, the more likely we assign the next scar (i.e. decrease the divisor) | function _assignScars(uint surfaceCount, IBear3Traits.ScarColor[] memory scars, bytes22 genes, uint256 tokenId) internal pure returns (IBear3Traits.ScarColor[] memory initializedScars) {
initializedScars = new IBear3Traits.ScarColor[](surfaceCount);
uint scarIndex = scars.length;
for (uint i... | 10,008,292 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
function hasRole(bytes32 role, ad... | change the credit limit for the given adapter. _adapter the address of the keeper _limitInBips the spending limit of the adapter | function updateAdapterLimit(address _adapter, uint256 _limitInBips) external onlyOperator {
require(_limitInBips <= BIPS_BASE, "limit should be between 0 and BIPS_BASE");
adapterLimits[_adapter] = _limitInBips;
_checkCreditLimit(_adapter);
emit AdapterLimitChanged(_adapter, adapterLi... | 7,323,830 |
./partial_match/42/0x2097364Ba2ec75bcE70Ef498B476Bb40A167057F/sources/assignmentToken.sol | TODO: return total supply | function totalSupply() public view returns (uint256) {
return totalsupply;
}
| 8,870,732 |
pragma solidity ^0.4.25;
// It's important to avoid vulnerabilities due to numeric overflow bugs
// OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs
// More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-insecurity-bad-arithmetic/
impo... | Register a future flight for insuring./ | function registerFlight(string flightNumber, string timeStamp)
external
isOperational
onlyRegisteredAirline
{
bool canParticipate;
(,,canParticipate,) = flightData.getAirlineData(msg.sender);
require(canParticipate, "Airline is not fully funded and can't participate");
... | 12,750,148 |
./full_match/4/0x0c0Fcd0e4a5C9dB60b59F8B113ADe8f0244513eF/sources/contracts/randomness/Seeder.sol | Returns req for a given batch | function getReqByBatch(uint256 batch) external view returns (bytes32) {
return _batchToReq[batch];
}
| 787,641 |
./partial_match/1/0x76d5cd5f0003A0b327e0c408aAA2D8467c138Ff4/sources/PepeLivesMatterInu.sol | Pepe's magic in calculating tax fee | function calculateTaxFee(uint256 _amount) private view returns (uint256) {
return _amount.mul(_taxFee).div(
10**2
);
}
| 9,411,820 |
./full_match/1/0x7c804b088109C23d9129366a8C069448A4b219F8/sources/src/extension/ExtensionsInternal.sol | if removing extension not at the end of the array, swap extension with last in array | function _removeExtension(bytes4 selector) internal {
ExtensionsStorage.Layout storage layout = ExtensionsStorage.layout();
ExtensionsStorage.ExtensionData memory oldExtension = layout._extensions[selector];
if (oldExtension.implementation == address(0)) revert ExtensionDoesNotExist(selector... | 8,351,617 |
pragma solidity 0.4.25;
/*
* https://EtheriumToken.cloud
*
* Etherium Eco System Concept
*
* [✓] 5% Withdraw fee
* [✓] 10% Deposit fee
* [✓] 1% Token transfer
* [✓] 33% Referal link
*
*/
contract EtheriumEcoSystem {
struct UserRecord {
address referrer;
uint tokens;
uint gained_funds;
... | Reinvest all dividends/ get all dividends make correction, dividents will be 0 after that apply fee apply referral bonus | function reinvest() public {
uint funds = dividendsOf(msg.sender);
require(funds > 0, "You have no dividends");
UserRecord storage user = user_data[msg.sender];
user.funds_correction = user.funds_correction.add(int(funds));
(uint fee_funds, uint taxed_funds) = fee_purchase... | 432,765 |
// Sources flattened with hardhat v2.8.3 https://hardhat.org
// File @openzeppelin/contracts/utils/[email protected]
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sen... | Performs transfer between two accounts that are both included in receiving reward./ | function _transferStandard(address sender, address recipient, ValuesFromAmount memory values) private {
_reflectionBalances[sender] = _reflectionBalances[sender] - values.rAmount;
_reflectionBalances[recipient] = _reflectionBalances[recipient] + values.rTransferAmount;
}
| 8,020,328 |
pragma solidity ^0.4.21;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
retu... | transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ SafeMath.sub will throw if there is not enough balance. | function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value)... | 2,001,674 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./GlobalsAndUtility.sol";
import "./helpers/IERC20Burnable.sol";
contract Staking is GlobalsAndUtility {
using... | Allow grace time before penalties accrue / | function _calcLatePenalty(
uint256 lockedDayParam,
uint256 stakedDaysParam,
uint256 unlockedDayParam,
uint256 rawStakeReturn
)
private
pure
returns (uint256)
{
uint256 maxUnlockedDay = lockedDayParam + stakedDaysParam + LATE_PENALTY_GRACE_DAYS;... | 116,097 |
pragma solidity 0.6.12;
interface IERC20 {
function TOTALSUPPLY831() external view returns (uint256); //i... | inject NONSTANDARD NAMING | function LOG714(bool p0, uint p1, bool p2, string memory p3) internal view { | 14,087,864 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.