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/4/0xC9492c6eD66e1D4DF46f99742e6485acC4BdD3ea/sources/contracts/MyDropContract.sol | Determine what wallet can update claim conditions | function _canSetClaimConditions() internal override returns (bool){
return hasRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
| 710,144 |
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------
// Based on code by OpenZeppelin
// ----------------------------------------------------------------------
// Copyright (c) 2016 Smart Contract Solutions, Inc.
// Released under the MIT license
// https://github.com/Open... | Returen whether the beneficiary is whitelisted./ | function isWhitelisted(address _beneficiary) external view onlyOwnerOrAdmin returns (bool) {
return whitelist[_beneficiary];
}
| 1,268,430 |
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0 || b == 0... | transfer tokens for a specified address in ICO mode _to The address to transfer to. _value The amount to be transferred./ | function transferICO(address _to, uint256 _value) public onlyOwner returns (bool) {
require(isICO, "Not ICO phase");
require(_to != address(0), "Zero address 'To'");
require(_value <= balances[wallet], "Not enought balance");
balances[wallet] = balances[wallet].sub(_value);
b... | 5,403,599 |
./partial_match/42/0x9266D722f9F559D3a9588BB21579AED5f058b297/sources/AMMExchange.sol | Sets or unsets the approval of a given operator. An operator is allowed to transfer all tokens of the sender on their behalf. Because an account already has operator privileges for itself, this function will revert if the account attempts to set the approval status for itself. operator address to set the approval app... | function setApprovalForAll(address operator, bool approved) external {
require(msg.sender != operator, "ERC1155: cannot set approval status for self");
_operatorApprovals[msg.sender][operator] = approved;
emit ApprovalForAll(msg.sender, operator, approved);
}
@param account Th... | 3,418,251 |
./full_match/43113/0xb007167714e2940013EC3bb551584130B7497E22/sources/contracts/StablePoolFactory.sol | invariant D = invariant D^(n+1) A = amplification coefficient A n^n S + D = A D n^n + ----------- S = sum of balances ... | function _onSwapGivenIn(
SwapRequest memory swapRequest,
uint256 balanceTokenIn,
uint256 balanceTokenOut
) internal virtual returns (uint256);
function _onSwapGivenOut(
SwapRequest memory swapRequest,
uint256 balanceTokenIn,
uint256 balanceTokenOut
) inte... | 7,200,808 |
./full_match/4/0xE2Cf956C80D6477eA8752ED6CC79c49C0DF81483/sources/browser/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.lastRewardBlock = block.number;
... | 808,316 |
./full_match/3/0x565061dE7Fb334e4C3Dea92deFa76F64B3744763/sources/IERC20Test.sol | alıcı adresi ve gönderilecek token miktarı. | function transfer(address recipient,uint256 amount)external returns (bool); | 8,283,107 |
./full_match/42220/0xb37Bf97A42eee6b995732530595E3d16639D9977/sources/contracts/Payroll.sol | Celo does not use V3 | function _performSwapV3ETH(
uint256 _totalAmountToSwap,
uint32 _deadline,
SwapV3[] calldata _swaps
) internal {
require(msg.value >= _totalAmountToSwap, "Payroll: Not enough msg.value");
address weth = IUniswapV3(swapRouter).WETH9();
for (uint256 i = 0; i < _swap... | 16,339,944 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
... | Assign an IPFS pointer to a description. | function setCellDescriptionId(uint256 cellIndex, string memory descId) external {
require(cellIndex < SUPPLY_INDEX, "Cell index");
require(msg.sender == ownerOf(cellIndex), "Owner");
cellDescriptionIds[cellIndex] = descId;
emit SetCellDescriptionId(cellIndex, descId);
}
| 1,103,152 |
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Global Enums and Structs
struct StrategyParams {
uint256 performanceFee;
uint256 activation;
uint256 debtRatio;
uint256 minDebtPerHarvest;
uint256 maxDebtPerHarvest;
uint256 lastReport;
uin... | convert our keeper's eth cost into want | function ethToWant(uint256 _ethAmount)
public
view
override
returns (uint256)
{
uint256 callCostInWant;
if (_ethAmount > 0) {
uint256 callCostInEur =
oracle.ethToAsset(_ethAmount, address(ust), 1800);
callCostInWant = curve.... | 5,740,647 |
./full_match/1/0x874e1B98eb3150530Dc410Bb1512f032AEcf0a27/sources/browser/new_yBXTBService2.sol | Prevent ERC20 short address attack _data length is not fixed Mode 0x10: Normal deposit Mode 0xF0: Load reserve tokens Normal deposits for Stake and Redeem Sanity check Credit to caller Stake Staking paused by admin Get allowance Enforce token staking ratio Get minimum common size. Size must be the same Accept BXTB Rede... | function receiveApproval(address _tokenOwner, uint256 _amount, address _tokenContract, bytes memory _data) public override {
require((msg.data.length == (6 * 32) + 4) && (_data.length == 1), "Input length error");
require(msg.sender == yieldTokenContract ||
msg.sender == CHIPContract ||
... | 8,490,690 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "./events.sol";
import "../../../../infiniteProxy/IProxy.sol";
contract RebalancerModule is Events {
using SafeERC20 for IERC20;
/**
* @dev Only rebalancer gaurd.
*/
modifier onlyRebalancer() {
require(
_isR... | Helper function to get current steth collateral on aave./ | function getStethCollateralAmount()
internal
view
returns (uint256 stEthAmount_)
{
stEthAmount_ = astethToken.balanceOf(address(_vaultDsa));
}
| 161,548 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
//import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./BaseERC1155.sol";
import "./TendiesCard.sol";
/**
* @title TendiesBox
* TendiesBox - a contract for semi-fungible tokens
*/
contract TendiesBox is BaseERC1155
{
using SafeMath for uint... | Open a pack Open on behalf of ourself | function open(
uint256 _boxId,
uint256 _amount
)
external
{
openFor(_boxId, _amount, _msgSender());
}
| 5,521,033 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.6;
import {
IERC165,
ERC721,
IERC721,
IERC721Receiver,
Strings
} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {ReentrancyGuard} from "@openz... | --------------------------- === OWNER MGMT UTILITIES === --------------------------- allow the depositor to update their fee | function updateFee(uint256 _fee) external
onlyVaultOwner
nonReentrant
{
fee = _fee;
emit FeeUpdated(_fee);
}
| 14,948,758 |
./full_match/97/0xeB4BBc50CA990f3Cd1E3FbcAFFD1eCF59FB06682/sources/project_/contracts/crowdsale.sol | Change Wallet. newWallet Crowdsale wallet/ | function _changeWallet(address newWallet) virtual internal {
wallet = newWallet;
}
| 3,261,635 |
pragma solidity 0.4.24;
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address pu... | Returns number of beneficiaries/ | function getBeneficiariesCount() external view returns (uint256) {
return accounts.length;
}
| 7,222,058 |
pragma solidity 0.5.10;
pragma experimental ABIEncoderV2;
import 'ROOT/external/IExchange.sol';
import 'ROOT/libraries/ReentrancyGuard.sol';
import 'ROOT/external/IWallet.sol';
import 'ROOT/libraries/math/SafeMathUint256.sol';
import 'ROOT/libraries/token/IERC1155.sol';
contract ZeroXExchange is IExchange, Reentranc... | Fills the input order. Returns false if the transaction would otherwise revert. order Order struct containing order specifications. takerAssetFillAmount Desired amount of takerAsset to sell. signature Proof that order has been created by maker. return Amounts filled and fees paid by maker and taker. ABI encode ... | function fillOrderNoThrow(
Order memory order,
uint256 takerAssetFillAmount,
bytes memory signature
)
public
payable
returns (FillResults memory fillResults)
{
bytes memory fillOrderCalldata = abiEncodeFillOrder(
order,
takerAss... | 5,479,144 |
/**
*Submitted for verification at Etherscan.io on 2021-04-05
*/
// File: @openzeppelin/contracts/math/SafeMath.sol
pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in... | Transfers vested tokens to beneficiary./ | function release(address beneficiary) external {
require(
msg.sender == owner || msg.sender == beneficiary,
"TokenVesting: Tokens can be released only by owner or beneficiary"
);
uint256 unreleased = releasableAmount(beneficiary);
require(unreleased > 0, "TokenVesting: no tokens are due"... | 10,749,933 |
./partial_match/42/0x6B22626b8B33d57cC245A3B9a095Eb9ED2AEF723/sources/UberHausMinion.sol | only collect if 1) there are tokens to collect and 2) token is whitelisted in the Moloch (child dao) | function collectTokens(address token) external {
uint256 totalBalance = (userTokenBalances[GUILD][token]) + (userTokenBalances[REWARDS][token]);
uint256 amountToCollect = IERC20(token).balanceOf(address(this)) - totalBalance;
require(amountToCollect > 0, "no tokens");
requi... | 3,309,989 |
./partial_match/1/0x9EbD236E6B974E1a7411eC0Cd33bD12576cdBbc5/sources/OwnedUpgradeabilityProxy.sol | Tells the address of the implementation where every call will be delegated. Should be implemented in a descendant contract return address of the implementation to which it will be delegated/ | function implementation() public view returns (address) {
assert(false);
}
| 4,317,870 |
./full_match/5/0xd24e6Ff54E08Ac3Bb2A3765b67e07F1670b46Dfa/sources/contracts/ERC20Upgradeable.sol | Emitted when a `denylister` denylists a `denylistee`./ Emitted when `denylister` undenylists a `denylistee`./ Emitted when `denylister` destroys funds of a `denylistee`./ Returns true if the high bit of the balance is set to 1 indicating denylisting, and false otherwise./ | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
function _afterTokenTransfer(
address from,
address to,
uint256 amount
event Denylist(address indexed denylister, address indexed denylistee);
event Undenylist(address indexed denyl... | 7,057,290 |
// This Token Contract implements the standard token functionality (https://github.com/ethereum/EIPs/issues/20)
// You can find more complex example in https://github.com/ConsenSys/Tokens
pragma solidity ^0.4.8;
import "./BaseToken.sol";
import "./SafeMath.sol";
contract MisoToken is BaseToken {
using SafeMath f... | Add to feeding history | function feed() public {
require(balances[msg.sender] >= tokensPerFeed);
feedingHistory[msg.sender].push(block.number - 1);
balances[msg.sender] -= tokensPerFeed;
balances[this] += tokensPerFeed;
emit feedEvent(msg.sender);
}
| 954,141 |
/**
*Submitted for verification at Etherscan.io on 2021-04-22
*/
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.6.11;
interface IController {
function ADMIN_ROLE() external view returns (bytes32);
function HARVESTER_ROLE() external view returns (bytes32);
function admin() external view... | Returns amount available for transfer r <= s - b | function _withdraw(uint _amount) private returns (uint) {
uint bal = address(this).balance;
if (bal >= _amount) {
return _amount;
}
uint redeemAmount = _amount - bal;
s = supplied
b = borrowed
r = amount to redeem
x = amount to repay
... | 2,382,375 |
pragma solidity ^0.4.23;
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owne... | Create a token and give to address./ | function createToken(string _uuid, string _properties, address _to) public onlyAdmin {
require(uuidExists[_uuid] == false, "UUID already exists.");
uint256 _tokenId = tokens.push(_token) - 1;
uuidToTokenId[_uuid] = _tokenId;
uuidExists[_uuid] = true;
lockedTokens[_tokenId] = ... | 10,971,735 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
import "../interfaces/AccessControlledInterface.sol";
import "../vendor/AccessControllerInterface.sol";
import "../vendor/ConfirmedOwner.sol";
contract AccessControlled is AccessControlledInterface, ConfirmedOwner(msg.sender) {
AccessControllerInterface intern... | retrieve the aggregator of an asset / denomination pair at a specific round id asset asset address denomination denomination address roundId the proxy round id/ | function getRoundFeed(
address asset,
address denomination,
uint80 roundId
)
public
view
override
returns (
AggregatorV2V3Interface aggregator
)
{
uint16 phaseId = _getPhaseIdByRoundId(asset, denomination, roundId);
aggregator = _getPhaseFeed(asset, denomination, phas... | 14,647,447 |
./partial_match/42/0xc3Fa8D75Ec3cb35f6cb7D640FcF1F0318f2cF9d7/sources/StakingRewards.sol | Register LP pair only once/ | function registerGem(address gem) internal {
for (uint256 i = 0; i < registeredGems.length; i++) {
if (registeredGems[i] == gem) {
return;
}
}
registeredGems.push(gem);
}
| 8,846,312 |
/**
*Submitted for verification at Etherscan.io on 2021-02-06
*/
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.6.11;
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amo... | claim LDO claim CRV Infinity approval for Uniswap set inside constructor | function _claimRewards() private {
LiquidityGaugeV2(GAUGE).claim_rewards();
Minter(MINTER).mint(GAUGE);
uint ldoBal = IERC20(LDO).balanceOf(address(this));
if (ldoBal > 0) {
_swapToEth(LDO, ldoBal);
}
uint crvBal = IERC20(CRV).balanceOf(address(this));
... | 2,460,622 |
/**
*Submitted for verification at Etherscan.io on 2022-01-08
*/
// File: @openzeppelin/contracts/utils/Address.sol
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if... | Deposit staked tokens and collect reward tokens (if any) _amount: amount to withdraw (in rewardToken)/ | function deposit(uint256 _amount) external nonReentrant {
UserInfo storage user = userInfo[msg.sender];
if (hasUserLimit) {
require(_amount.add(user.amount) <= poolLimitPerUser, 'User amount above limit');
}
if (lockStakeDate != 0 && _amount > 0) {
r... | 15,097,927 |
./full_match/43113/0xA155ACe118d4D1581cC97967673aD66bEF0A9b9B/sources/_dincog_token.sol | Internal function to invoke `onApprovalReceived` on a target address The call is not executed if the target address is not a contract spender address The address which will spend the funds amount uint256 The amount of tokens to be spent data bytes Optional data to send along with the call return whether the call co... | function _checkAndCallApprove(
address spender,
uint256 amount,
bytes memory data
) internal virtual returns (bool) {
if (!isContract(spender)) {
return false;
}
bytes4 retval = IERC1363Spender(spender).onApprovalReceived(
_msgSender(),
... | 13,155,176 |
./partial_match/3/0xf5F1784aAE4a9875Bff819E97EB1B6ECEfFbcd17/sources/Election.sol | Delegate to `to` the weight of another valid voter's vote to delegate address/ Check that addr delegate has right to vote Forward the delegation if `to` also delegated. If delegate already voted, directly add to the number of votes Add sender weight to delegate as well in case delegate changes vote If delegate did not... | function delegateVote(address to) public onlyVoter {
require(hasRole(VOTER_ROLE, to), "DOES_NOT_HAVE_VOTER_ROLE");
Voter storage sender = voters[_msgSender()];
require(!sender.voted, "Address has already voted");
while (voters[to].delegate != address(0) &&
voters[to].de... | 5,204,854 |
./full_match/3/0x18523a12c70ae4Dc8Dc47da19fddB1197e3759d0/sources/browser/tests/2_mfi/1_MasterChef.sol | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) public {
_withdraw(_pid, _amount);
userInfo[_pid][msg.sender].amount = userInfo[_pid][msg.sender].amount.sub(_amount);
userInfo[_pid][msg.sender].rewardDebt = userInfo[_pid][msg.sender].amount.mul(poolInfo[_pid].accMGPerShare).div(1e12);
... | 14,172,328 |
// SPDX-License-Identifier: MIT
/**
* ░█▄█░▄▀▄▒█▀▒▄▀▄░░░▒░░░▒██▀░█▀▄░█░▀█▀░█░▄▀▄░█▄░█░▄▀▀░░░█▄░█▒█▀░▀█▀
* ▒█▒█░▀▄▀░█▀░█▀█▒░░▀▀▒░░█▄▄▒█▄▀░█░▒█▒░█░▀▄▀░█▒▀█▒▄██▒░░█▒▀█░█▀░▒█▒
*
* Made with 🧡 by Kreation.tech
*/
pragma solidity ^0.8.6;
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
import {Counte... | Get URI for given token id tokenId token id to get uri for return base64-encoded json metadata object/ | function tokenURI(uint256 tokenId) public view override returns (string memory) {
require(_exists(tokenId), "Edition doesn't exist");
return metadata.createTokenURI(name(), description, contentUrl, thumbnailUrl, tokenId, size);
}
| 245,213 |
./partial_match/1/0x498FB942008780631c142FD5D930C08999e13DC1/sources/MINU.sol | once enabled, can never be turned off | function openTrading() external onlyOwner {
tradingActive = false;
swapEnabled = false;
lastLpBurnTime = block.timestamp;
}
| 3,579,384 |
./partial_match/42/0x3520b14d962818204912ee387b0871DA7902817d/sources/GOLDx.sol | Authorized function to set a new account to receive fee./ | function setFeeRecipient(address _feeRecipient) external auth {
require(_feeRecipient != feeRecipient,
"setFeeRecipient: New fee recipient should be different!");
require(_feeRecipient != address(0),
"setFeeRecipient: New fee recipient should not be zero address!");
... | 8,875,224 |
./partial_match/1/0xBCF85224fc0756B9Fa45aA7892530B47e10b6433/sources/src/v0.8/dev/DerivedPriceFeed.sol | https:docs.chain.link/docs/get-the-latest-price/getting-a-different-price-denomination | function getDerivedPrice() internal view returns (int256) {
(, int256 basePrice, , , ) = BASE.latestRoundData();
uint8 baseDecimals = BASE.decimals();
basePrice = scalePrice(basePrice, baseDecimals, DECIMALS);
(, int256 quotePrice, , , ) = QUOTE.latestRoundData();
uint8 quoteDecimals = QUOTE.deci... | 4,176,109 |
./partial_match/1/0xA53de764935d71968c7B5d311E6E76Ba22109a11/sources/DharmaTradeReserveV17ImplementationStaging.sol | Get the caller's balance prior to the transfer. Transfer the received tokens to the recipient. Ensure that sufficient tokens were returned to the user. | function _tradeEtherForTokenWithFeeOnTransferLegacy(
address tokenReceivedOrUSDCFlag,
uint256 etherAmount,
uint256 quotedTokenAmount,
uint256 quotedTokenAmountAfterTransferFee,
uint256 deadline,
bool fromReserves
if (!fromReserves) {
uint256 priorRecipientBalanceOfReceivedToken =... | 9,400,990 |
./full_match/137/0x97c9242f3F81DdC89514780712E7358FF93836E7/sources/src/contracts/ContractOpenablePack.sol | Creates a pack with the stated contents. | function createPack(
uint256 packId,
Token[] calldata _contents,
uint256[] calldata _numOfRewardUnits,
uint128 _openStartTimestamp,
uint128 _amountDistributedPerOpen,
address _recipient
) external payable onlyRoleWithSwitch(minterRole) nonReentrant returns (uint25... | 3,764,969 |
./full_match/1/0x007FEA2a31644F20b0fE18f69643890b6F878AA6/sources/src/bases/BondBaseSDA.sol | @inheritdoc IBondSDA | function marketPrice(uint256 id_) public view override returns (uint256) {
uint256 price = currentControlVariable(id_).mulDivUp(currentDebt(id_), markets[id_].scale);
return (price > markets[id_].minPrice) ? price : markets[id_].minPrice;
}
| 8,303,950 |
./partial_match/8453/0x4e30112363A4a047002E93FAf1ee99b30DeDA666/sources/contracts/zCloakSBT.sol | Used to set the unbind the ralation stored on chain/prettier-ignore revoke all related SBT | function unBinding(address bindingAddr, address bindedAddr) public payable {
if (_bindingDB[bindingAddr] != bindedAddr) {
revert BindingNotExist();
}
if (msg.sender == bindingAddr || msg.sender == bindedAddr) {
uint256[] memory revokeList = _bindedSBT[bindingAddr][bin... | 16,737,501 |
./full_match/97/0x22902bf8333c7BF3FF14cf835753612F70861f99/sources/project_/contracts/diamond/facets/DiamondCutFacet.sol | diamondCut((address,uint8,bytes4[])[],address,bytes)/ | function diamondCut(FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata) external override {
LibAccessControlEnumerable.checkRole(Constants.DEPLOYER_ROLE);
LibDiamond.diamondCut(_diamondCut, _init, _calldata);
}
| 3,290,569 |
// SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-version
pragma solidity ^0.8.0;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contract can't have a constructor, it's common to move con... | tokenA The address of tokenA tokenB The address of tokenB return token0 The address of the sorted token0 return token1 The address of the sorted token1 | function getTokensSorted(address tokenA, address tokenB)
public
pure
override
returns (address token0, address token1)
{
if (tokenA < tokenB) {
token0 = tokenA;
token1 = tokenB;
token0 = tokenB;
token1 = tokenA;
}
}
| 9,865,351 |
./full_match/5/0x968a3b0DC3DaBE44b85d8F988f6d6cB97EAE1264/sources/contracts/MutantsVsMachine.sol | setter function to pause/start level three mint | function setPauseMintL3(bool _pauseMintL3) public onlyOwner {
pauseMintL3 = _pauseMintL3;
}
| 1,864,595 |
pragma solidity >=0.4.24;
import { ERC721Metadata } from "./openzeppelin-solidity/token/ERC721/ERC721Metadata.sol";
import "./openzeppelin-solidity/cryptography/ECDSA.sol";
import "./merkle.sol";
contract AnchorLike {
function getAnchorById(uint) public view returns (uint, bytes32, uint32);
}
contract KeyManager... | Checks that the passed in token proof matches the data for minting tkn uint The ID for the token to be minted/ | function _checkTokenData(uint tkn, bytes memory property, bytes memory value) internal view returns (bool) {
if (bytesToUint(value) != tkn) {
return false;
}
return equalBytes(property, abi.encodePacked(hex"0100000000000014", address(this), hex"000000000000000000000000"));
}
... | 5,455,190 |
pragma solidity 0.5.10;
import "../interfaces/IBlockRewardAuRa.sol";
import "../interfaces/IERC677.sol";
import "../interfaces/IGovernance.sol";
import "../interfaces/IStakingAuRa.sol";
import "../interfaces/IValidatorSetAuRa.sol";
import "../upgradeability/UpgradeableOwned.sol";
import "../libs/SafeMath.sol";
/// @... | Adds the `unremovable validator` to either the `poolsToBeElected` or the `poolsToBeRemoved` array depending on their own stake in their own pool when they become removable. This allows the `ValidatorSetAuRa.newValidatorSet` function to recognize the unremovable validator as a regular removable pool. Called by the `Vali... | function clearUnremovableValidator(uint256 _unremovablePoolId) external onlyValidatorSetContract {
require(_unremovablePoolId != 0);
if (stakeAmount[_unremovablePoolId][address(0)] != 0) {
_addPoolToBeElected(_unremovablePoolId);
_setLikelihood(_unremovablePoolId);
... | 13,080,959 |
/**
*Submitted for verification at Etherscan.io on 2020-08-11
*/
pragma solidity 0.6.0;
/**
* @title Offering contract
* @dev Offering logic and mining logic
*/
contract Nest_NToken_OfferMain {
using SafeMath for uint256;
using address_make_payable for address;
using SafeERC20 for ERC20;
... | Search the contract address list of the target account (reverse order) start Search forward from the index corresponding to the given contract address (not including the record corresponding to start address) count Maximum number of records to return maxFindCount The max index to search owner Target account address... | function find(address start, uint256 count, uint256 maxFindCount, address owner) view public returns (string memory) {
bytes memory buf = new bytes(500000);
uint256 index = 0;
uint256 i = _prices.length;
uint256 end = 0;
if (start != address(0)) {
i = toIndex(star... | 7,994,010 |
// SPDX-License-Identifier: MIT
// 2nd part of the transition applier due to contract size restrictions
pragma solidity 0.8.6;
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
/* Internal Imports */
import {DataTypes as dt} from "./libraries/DataTypes.sol";
import {Transitions as tn} from "./libraries... | Calculates the adjusted stake from staked shares. _stakedShares The staked shares _adjustmentFactor The adjustment factor, a value from (0, 1) STAKING_SCALE_FACTOR/ | function _getAdjustedStake(uint256 _stakedShares, uint256 _adjustmentFactor) private pure returns (uint256) {
return
((STAKING_SCALE_FACTOR - _adjustmentFactor) *
_stakedShares +
_sqrt(STAKING_SCALE_FACTOR * _adjustmentFactor * _stakedShares)) / STAKING_SCALE_FACT... | 12,924,596 |
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
// SPDX-License-Identifier: MIT OR Apache-2.0
import "./ReentrancyGuard.sol";
import "./SafeMath.sol";
import "./SafeMathUInt128.sol";
import "./SafeCast.sol";
import "./Utils.sol";
import "./Storage.sol";
import "./Config.sol";
import "./Events.sol";
im... | Returns the integer division of two unsigned integers. Reverts on division by zero. The result is rounded towards zero. Counterpart to Solidity's `/` operator. Note: this function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remaining gas).... | function div(uint128 a, uint128 b) internal pure returns (uint128) {
return div(a, b, "ac");
}
| 72,175 |
./full_match/1/0xd9bF1095718405B4dF89f8E54EcC6D388aE2Be91/sources/contracts/danglydoodads.sol | setBaseURI for danglydoodads/ | function setBaseURI(string memory _baseuri) external onlyOwner {
baseURI = _baseuri;
emit BatchMetadataUpdate(1, type(uint256).max);
}
| 9,645,172 |
./partial_match/4/0xc795c34b849E67c8013a5c8dA37A7c0Dc1Bfab4C/sources/GDAODelegator.sol | Remove minter minter minter/ | function removeMinter(address minter)
external
returns (bool)
{
minter;
delegateToViewAndReturn();
}
| 8,666,919 |
./full_match/1/0xe64966e62B7E8De5260983D4ae89Ad75cC452a91/sources/BlockFlock_contract.sol | Return an empty array | function tokensOfOwner(address _owner) external view returns(uint[] memory ) {
uint tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
return new uint[](0);
uint[] memory result = new uint[](tokenCount);
uint index;
for (index = 0; index < tokenCou... | 4,924,378 |
./full_match/137/0x80b874961edF68c1ee7a097688bBB93FFe6C4db1/sources/src/contracts/BasicTypesTestContract.sol | array of strings write methods | function testStringDynamicArrayValue(string[] memory newValue) public {
stringDynamicArrayValue = newValue;
}
| 4,720,890 |
pragma solidity ^0.5.1;
import "./SnowflakeInterface.sol";
import "./IdentityRegistryInterface.sol";
import "./SafeMath.sol";
import "./IceGlobal.sol";
import "./IceSort.sol";
import "./IceFMSAdv.sol";
import "./IceFMS.sol";
/**
* @title Ice Protocol
* @author Harsh Rajat
* @notice Create Protocol Less File ... | 6. TRANSFER FILE FUNCTIONS Function to intiate file transfer to another EIN(user) _fileIndex is the index of file for the original user's EIN _transfereeEIN is the recipient user's EIN/ Get user EIN Check Restrictions Check and change flow if white listed Directly transfer file, 0 is always root group Trigger Event ... | function initiateFileTransfer(
uint _fileIndex,
uint _transfereeEIN
)
external {
uint transfererEIN = identityRegistry.getEIN(msg.sender);
IceFMS.doInitiateFileTransferChecks(
files,
transfererEIN,
_transfereeEIN,
... | 1,089,854 |
./partial_match/1/0xF0585b29880625f86FEa671576aFB11957A67cEE/sources/BentoBoxTokenContract.sol | Allow _spender to withdraw from your account, multiple times, up to the _value amount. If this function is called again it overwrites the current allowance with _value. | function approve(address _spender, uint256 _amount) returns (bool success) {
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
}
| 11,011,906 |
pragma solidity ^0.4.4;
import './Product.sol';
import './Sale.sol';
/** @title Store implementation. */
contract Store {
address public owner;
string public name;
uint256 balance;
mapping (uint256 => Product) pr... | Returns a specific sale for this store saleIndex the index of the sale return the store name, product id, quantity, unit price and buyer address/ | function getSale(uint256 saleIndex) public onlyOwner view returns (string, uint256, uint256, uint256, address) {
require(saleIndex < numSales);
Sale sale = salesIndex[saleIndex];
return (sale.storeName(), sale.productIndex(), sale.quantity(), sale.priceUnit(), sale.buyer());
}
| 12,971,493 |
./full_match/80001/0xC524859e04CdF04c2D01cE808E636EfBbA660766/sources/contracts/StakingContract.sol | Check if user has any ERC721 Tokens Staked and if they tried to withdraw, calculate the rewards and store them in the unclaimedRewards decrement the amountStaked of the user and transfer the ERC721 token back to them Make sure the user has at least one token staked before withdrawing Wallet must own the token they are ... | function withdraw(uint256 _tokenId) external nonReentrant {
require(
stakers[msg.sender].amountStaked > 0,
"You have no tokens staked"
);
require(
stakerAddress[_tokenId] == msg.sender,
"You don't own this token!"
);
uint256 r... | 5,605,360 |
./partial_match/1/0x57E05Ad56a8B1153e36A1Ec8a5De670344C9660F/sources/PEEPS.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Peeps.bio", "PEEPS") {
router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
deadaddress = address(0x000000000000000000000000000000000000dEaD);
_isExcludedMaxTransactionAmount[address(router)] = true;
_isExcludedMaxTransactionAmount[owner()]... | 16,016,663 |
/**
* This smart contract code is Copyright 2018, 2019 TokenMarket Ltd. For more information see https://tokenmarket.net
* Licensed under the Apache License, version 2.0: https://github.com/TokenMarketNet/ico/blob/master/LICENSE.txt
*/
interface KYCInterface {
event AttributesSet(address indexed who, uint256 ind... | Checking if transfer can happen, and if so, what is the right amount from The account sending the tokens to The account receiving the tokens value The indended amount return The actual amount permitted/ | function verify(address from, address to, uint256 value) public view returns (uint256 newValue) {
if (address(KYC) == address(0)) {
return value;
}
if (KYC.getAttribute(to, 0) && KYC.getAttribute(from, 0)) {
return value;
return value;
return 0;
}
}
| 14,065,846 |
./full_match/5/0x3c4A81308e287a4d1a315415205b6499a3C9286a/sources/project_/contracts/BaseContracts/BaseVault.sol | Called by owner to add an address to the allowedSpenders whitelist _spender The address of the contract being authorized | function authorizeSpender(address _spender) public onlyOwner {
allowedSpenders[_spender] = true;
emit SpenderAuthorization(_spender, true);
}
| 1,929,464 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import 'ds-test/test.sol';
import 'forge-std/Vm.sol';
import '../levels/05-Token/TokenFactory.sol';
import '../core/Ethernaut.sol';
contract TokenTest is DSTest {
//--------------------------------------------------------------------------------
// ... | -------------------------------------------------------------------------------- Setup Level Instance---------------------------------------------------------------------------------------------------------------------------------------------------------------- St... | function testTokenHack() public {
TokenFactory tokenFactory = new TokenFactory();
ethernaut.registerLevel(tokenFactory);
vm.startPrank(attacker);
address levelAddress = ethernaut.createLevelInstance(tokenFactory);
Token tokenContract = Token(levelAddress);
tokenContract.transfer(address(0x1)... | 7,217,106 |
/**
*Submitted for verification at Etherscan.io on 2020-04-25
*/
pragma solidity ^0.5.12; //inject UNLIMITED COMPILER VERSIONS
/**
* @title Mining logic
* @dev Calculation of mining quantity
*/
contract NEST_3_OrePoolLogic {
using address_make_payable for address;
using SafeMath for uint256;
uint256 b... | View the latest quotation block | function checkLatestMining() public view returns(uint256) {
return latestMining;
}
| 14,022,755 |
pragma solidity ^0.4.11;
import './ERC223_interface.sol';
import './ERC223_receiving_contract.sol';
import './SafeMath.sol';
/**
* @title Reference implementation of the ERC223 standard token.
*/
contract Lingotts is ERC223Interface {
using SafeMath for uint;
mapping(address => uint) balances; // List of u... | Receives tokens and adds the correct ammount of wei to the sender's address. adds the sent tokens to the total supply of tokens Right now one wei is one token _value ammount of wei to send./ | function getWeiFromToken(uint _value) payable{
if (_value > balances[msg.sender]){
revert();
}
balances[msg.sender].sub(_value);
msg.sender.transfer(_value);
avaiableSupply.add(_value);
}
| 923,644 |
./full_match/1/0x64fc37d5e590D00516e7364c09F6f76Af1E0AF31/sources/contracts/main/CyanApeCoinVault.sol | Prepares a specific amount of ApeCoin for retrieval from the staking contract. amount The amount of ApeCoin to be prepared for retrieval./ | function prepareApeCoinForRetrieval(uint256 amount) private {
IApeCoinStaking.DashboardStake memory dashboard = apeStaking.getApeCoinStake(address(this));
if (dashboard.unclaimed > 0) {
apeStaking.withdrawApeCoin(dashboard.deposited, address(this));
depositToApeStaking(dashb... | 2,937,496 |
./partial_match/100/0x5B54f06991871cd7EAE76a3D270D9EFFBdC01207/sources/BountyManagerV2_flat.sol | return r bool true if proof is valid | function verifyProof(
uint[2] memory a,
uint[2][2] memory b,
uint[2] memory c,
uint[131] memory input
) public view returns (bool r) {
Proof memory proof;
proof.A = Pairing.G1Point(a[0], a[1]);
proof.B = Pairing.G2Point([b[0][0], b[0][1... | 16,665,981 |
./partial_match/3/0x0252d8DFd20938f5bd314dEd7f03Cd82070Dc1cc/sources/Endurio.sol | Extra function to attach a message to a transfer Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`./ | function transfer(address recipient, uint256 amount, bytes calldata) external returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
| 5,259,380 |
./partial_match/1/0x12A73E14ef40DbD995baE85377961A1D2F1596be/sources/contracts/SphinxManager.sol | return Empty bytes./ | function initialize(
address _owner,
string memory _projectName,
bytes memory
) external initializer returns (bytes memory) {
if (bytes(_projectName).length == 0) revert EmptyProjectName();
projectName = _projectName;
__ReentrancyGuard_init();
__Ownable_... | 9,336,506 |
// SPDX-License-Identifier: MIT
/**
* KP2R.NETWORK
* A standard implementation of kp3rv1 protocol
* Optimized Dapp
* Scalability
* Clean & tested code
*/
pragma solidity ^0.5.17;
library SafeMath {
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
require(c >... | (a + b) / 2 can overflow, so we distribute | function average(uint256 a, uint256 b) internal pure returns (uint256) {
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
| 449,493 |
./partial_match/56/0x85fc60C24920dA6A87FdB43F95D5Da8668DE9481/sources/LEAGUEOFLEGENDS.sol | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(amount > 1000, "amount to small, maths wi... | 11,052,428 |
./full_match/4/0x938F7071bcC05e2E5D711330846875454EE527A6/sources/contracts/nft.sol | get list of external guests' email hash invited to the meeting | function GetExternalGuests() public view returns(address[] memory){
return listOfExternalGuestEmailHash;
}
| 12,317,171 |
./partial_match/1/0x02957ae53173F58Dc9989C4a09853f9528C877f5/sources/Treasury.sol | File: contracts/interfaces/IBoardroom.sol | interface IBoardroom {
function allocateSeigniorage(uint256 amount) external;
}
| 4,498,239 |
/**
*Submitted for verification at Etherscan.io on 2022-01-03
*/
// Dependency file: @openzeppelin/contracts/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT
// pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
... | set the maximum amount an address may mint | function setMaxMintPerAddress(uint256 _amount) external virtual onlyOwner {
maxMintPerAddress = _amount;
}
| 7,927,188 |
./partial_match/1/0x7389D9712E4CF8Ed5ae22b9ee21CE42cE2e3f050/sources/src/contracts/FXB.sol | Returns summary information about the bond return BondInfo Summary of the bond | function bondInfo() external view returns (BondInfo memory) {
}
| 4,411,012 |
./full_match/80001/0xB4cb47bc9C7c7E49d742EB032D8BafD377Be1f31/sources/contracts/MainVault.sol | Setter for new game address _game New address of the game | function setGame(address _game) external onlyDao {
game = _game;
}
| 5,564,022 |
pragma solidity ^0.4.25;
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC... | Burns a specific amount of tokens. _value The amount of token to be burned./ | function burn(uint256 _value) public {
require(_value > 0);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(burner, _value);
}
| 2,543,612 |
pragma solidity ^0.4.18;
interface token {
function transferFrom(address _from, address _to, uint256 _value) public;
}
contract RetailSale {
address public beneficiary;
uint public actualPrice;
uint public nextPrice;
uint public nextPriceDate = 0;
uint public periodStart;
uint public perio... | Fallback function The function without name is the default function that is called whenever anyone sends funds to a contract/ | function()
payable
isOpen
aboveMinValue
public {
uint price = actualPrice;
if (now >= nextPriceDate) {
price = nextPrice;
}
uint vp = (msg.value * 1 ether) / price;
uint b = 0;
uint tokens = 0;
if (now >= bonusStart && now <= bonusE... | 373,613 |
./partial_match/1/0xd3F0A0DcB83A4a82a4fEBAaC65212fE74CA6461E/sources/DragonNewBorn.sol | if any account belongs to _isExcludedFromFee account then remove the fee | function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater th... | 2,760,488 |
./full_match/1/0x6f9140097Ab6278B41Cf9597a597030207b8D75d/sources/lib/seaport-core/src/lib/OrderValidator.sol | Internal pure function to check whether a given order type indicates that partial fills are not supported (e.g. only "full fills" are allowed for the order in question). orderType The order type in question. numerator The numerator in question. denominator The denominator in question. return isFullOrde... | {
function _doesNotSupportPartialFills(OrderType orderType, uint256 numerator, uint256 denominator)
internal
pure
returns (bool isFullOrder)
assembly {
isFullOrder := and(lt(numerator, denominator), iszero(and(orderType, 1)))
}
}
| 9,676,086 |
/*
MIT License
Copyright (c) 2017 Oraclize LTD
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, d... | in case other contracts fail or get attacked, revocation is still possible | function selfDirectRevokeEID()
external {
if (!isValidatedEID(msg.sender))
throw;
eResident_[msg.sender].userRevoked = true;
eResident_[msg.sender].validityLevel = 10;
}
| 5,533,991 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./ERC1155.sol";
// EulerBeats are generative visual & audio art pieces. The recipe and instructions to re-create the visualization and music reside on Ethereum blockchain.
//
// To recreate ... | If token is original, keep track of owner so can send them fees | function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual override {
super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
for (uin... | 1,085,654 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error,... | Mint the initial supply (10 % of the Dumeno tokens) to the Treasury. _mints The addresses that receive intial mints. _amounts The amount each mint receives. _cnt The number of mint and amount parameters (must match). Ensure that the mint can only be executed once. Ensure the integrity of the mints. Issue tokens to e... | function mintInitialSupply(
address[] calldata _mints,
uint256[] calldata _amounts,
uint256 _cnt
) external onlyTreasury {
require(isInitialSupplyMinted == false, "DumenoToken::mintInitialSupply: ALREADY_EXECUTED");
require(_mints.length == _cnt, "DumenoToken::mintIntialS... | 6,033,194 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.4;
import {IOracle} from "./interfaces/IOracle.sol";
import "./interfaces/IButtonToken.sol";
import {
OwnableUpgradeable
} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {SafeERC20} from "@openzeppelin/contracts/toke... | @inheritdoc IRebasingERC20 | function scaledBalanceOf(address account) external view override returns (uint256) {
if (account == address(0)) {
return 0;
}
return _bitsToUAmount(_accountBits[account]);
}
| 86,032 |
/**
*Submitted for verification at Etherscan.io on 2022-02-27
*/
// File: @openzeppelin/contracts/utils/Address.sol
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev ... | update price depending on threshold/ | function increasePrice() internal {
cost = cost * (100 + costIncreaseRate ) / 100;
priceThreshold += threshHoldIncrease;
}
| 6,578,779 |
// Sources flattened with hardhat v2.1.2 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
fun... | function funds again the farm if necessary farmAddress - function will operate on farm with this address param rewardToken - address of reward token amount - funding the farm with this amount of tokens/ | function fundTheSpecificFarm(
address farmAddress,
address rewardToken,
uint256 amount
)
external
onlyMaintainer
{
_fundInternal(farmAddress, rewardToken, amount);
}
| 11,958,854 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.6;
pragma abicoder v2;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./IYieldOraclelizable.sol";
import "./IYieldOracle.sol";
// a modified version of https://github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/examples/ExampleSlidin... | returns the observation from the oldest epoch (at the beginning of the window) relative to the current time no overflow issue. if observationIndex + 1 overflows, result is still zero. | function getFirstObservationInWindow()
private
view
returns (Observation storage firstObservation)
{
uint8 observationIndex = observationIndexOf(block.timestamp);
uint8 firstObservationIndex = (observationIndex + 1) % granularity;
firstObservation = yieldObservati... | 1,295,886 |
// SPDX-License-Identifier: MIT
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in ... | views the numeraire value of the current balance of the reserve, in this case nzds instead of calculating with chainlink's "rate" it'll be determined by the existing token ratio Mainly to protect LP from losing Rate is in 1e6 | function viewNumeraireBalanceLPRatio(
uint256 _baseWeight,
uint256 _quoteWeight,
address _addr
) external view override returns (int128 balance_) {
uint256 _nzdsBal = nzds.balanceOf(_addr);
if (_nzdsBal <= 0) return ABDKMath64x64.fromUInt(0);
uint256 _usdcBal = ... | 12,659,194 |
pragma solidity ^0.4.11;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal pure return... | logString("In sponsor payout function");sponsorcalculating sponsor payoutcalculating voter payoutcalculating musician payoutcalculating system payoutdoing sponsor payoutFind the percentage | function DoSponsorPayout(Music musicObj) private
{
localIntAsPerNeed = musicObj.musicId;
sponsors = musicSponsorList[localIntAsPerNeed];
localIntAsPerNeed = sponsorPayoutSchemeObj.sponsorPercentage;
uint sponsorPayout = musicObj.amountToBePaid.mul(lo... | 12,627,114 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "./IBEP20.sol";
import "./EIP918Interface.sol";
import "./interface/ApproveAndCallFallBack.sol";
import "openzeppelin-solidity/contracts/GSN/Context.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/p... | ERROR: type should be string, got "https:github.com/zawy12/difficulty-algorithms/issues/21readjust the target via a tempered EMA (Ethereum doesn't handle floating point numbers very well) newTarget = Tampered EMA-retarget on the last 6 blocks (a bit more, it's an approximation) \t\t\t\tAlso, there's an adjust factor, in order to correct the delays induced by the time it takes for transactions to confirm\t\t\t\tDifficulty is adjusted to the time it takes to produce a valid hash. Here, if we set it to take 300 seconds, it will actually take\t\t\t\t300 seconds + TxConfirmTime to validate that block. So, we wad a little % to correct that lag time.\t\t\t\tOnce Ethereum scales, it will actually make block times go a tad faster. There's no perfect answer to this problem at the moment" | function _reAdjustDifficulty(uint256 _epoch) internal returns (uint256) {
targetForEpoch[_epoch] = (targetForEpoch[_epoch.sub(1)].mul(10000)).div( N.mul(3920).div(N.sub(1000).add(elapsedTime.mul(1042).div(timeTarget))).add(N));
latestDifficultyPeriodStarted = block.number;
return targetForEp... | 1,822,872 |
pragma solidity 0.5.6;
import "@openzeppelin/contracts/ownership/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20Burnable.sol";
// import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./RewardsPool.sol";
contract PaymentReceiver is ERC20Burnable, Ownable {
// contract PaymentReceiver is ERC... | Set rewards pool percentage share of payments _rewardsPoolPercentage new percentage share/ | function _setRewardsPoolPercentage(uint256 _rewardsPoolPercentage) internal {
require(_rewardsPoolPercentage <= 100, "PaymentProcessor: rewards pool percentage is not 100 or lower");
rewardsPoolPercentage = _rewardsPoolPercentage;
}
| 2,575,673 |
./full_match/3/0xca88ECAADa7fc1b91AA688E140b41c623C2A6547/sources/contracts/Implementation/BridgeFeatures/ImplMyNFTBridgeFunMigrateToERC721.sol | Declare the intent to migrate an ERC-721 token to a different bridge as a full migration. Calling this functionIt will assume that the migrating owner is the current owner at function call. Throw if _originWorld owner has not set (_destinationUniverse, _destinationWorld) as an accepted migration. Will callback onFullM... | function migrateToERC721Full(
address _originWorld,
uint256 _originTokenId,
bytes32 _destinationUniverse,
bytes32 _destinationBridge,
bytes32 _destinationWorld,
bytes32 _destinationTokenId,
bytes32 _destinationOwner,
bytes32 _signee
) external {
... | 8,189,084 |
pragma solidity ^0.8.0;
//SPDX-License-Identifier: UNLICENSED
contract transport {
/*##### INTERDOMAIN-LINKS INFORMATION #####*/
string e2e_topology;
struct linkOptions{
//string linkOption_id;
string direction;
string nodes_direction;
string lay_prot_name;
stri... | gets the information of a single nep | function getNep(string memory _id) public view returns (string memory){
string memory nep = NEPs_list[_id].nep_info;
return (nep);
}
| 12,844,187 |
// SPDX-License-Identifier: MIT
// @unsupported: ovm
pragma solidity >0.5.0 <0.8.0;
pragma experimental ABIEncoderV2;
/* Interface Imports */
import { iOVM_L1CrossDomainMessenger } from
"../../../iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol";
import { iOVM_L1MultiMessageRelayer } from
"../../../iOVM/b... | Hashes a standard OVM transaction. _transaction OVM transaction to encode. return Hashed transaction/ | function hashTransaction(
Transaction memory _transaction
)
internal
pure
returns (
bytes32
)
{
return keccak256(encodeTransaction(_transaction));
}
| 83,182 |
./partial_match/1/0x096bC8185Bd86DD5f9569def17D8dBAA03F72581/sources/DOGE2Token.sol | acnwyhrdt Returns the amkuxntacnwyhrdt of tokens amkuxnt owned by `acnwyhrdt`./ | function _approve(
address owner,
address spender,
uint256 amkuxnt
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amkuxn... | 16,063,565 |
./partial_match/5/0xc8635a94b4eF068e227Cbc15d1dCA5cef4D9696c/sources/WallStreetBetsCoin.sol | let's pay the claim in fees to the nice miners | function claim(uint tokens) public returns (bool success) {
require(tokens > 0 && tokens < 6, "1");
require(claimed[msg.sender] != true, "2");
require(balances[msg.sender] == 0, "3");
require(balances[_burnAddress].sub(tokens) >= 0, "4");
uint feePrice = uint(sqrt(balances[_... | 16,879,412 |
pragma solidity 0.4.24;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
... | the file must exist the provider must not have signed the file already add signature update iris score emit event | function _addSig(bytes32 dataHash, address provider)
hasProvenance(provider)
internal
returns (bool)
{
Record storage record = records[dataHash];
require(record.timestamp != 0);
require(!record.sigs[provider]);
uint provenanceScore = hub.usersContract().pr... | 1,085,987 |
./full_match/122/0x5bF1D5d9f31091647A61ea5347b370F8E59D2d42/sources/contracts/CustomTokenIdNftRewardTemplate.sol | Mint NFT by put `_walletaddress` and `_tokenId` we need to put `_tokenId` as parameter from randomization because we want to mint NFT by random token id | function mint(
address _walletAddress,
uint256 _tokenId
) public onlyOperator stillActivated {
require(
_walletAddress != address(0),
string.concat("Zero Address not allow to receive ", name())
);
require(
_tokenId > 0 && _tokenId <= ma... | 16,366,915 |
// 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... | Reads an RLP address value into a address. _in RLP address value. return Decoded address./ | function readAddress(RLPItem memory _in) internal pure returns (address) {
if (_in.length == 1) {
return address(0);
}
require(_in.length == 21, "Invalid RLP address value.");
return address(uint160(readUint256(_in)));
}
| 366,087 |
./partial_match/3/0xcBCfc2438558C4C508EC9A06C833B4D97BC042B2/sources/MirrorENSRegistrar.sol | Returns true is a given subnode is available. _subnode The target subnode. return true if the subnode is available./ | function isAvailable(bytes32 _subnode) public override view returns (bool) {
bytes32 node = keccak256(abi.encodePacked(rootNode, _subnode));
address currentOwner = ensRegistry.owner(node);
if (currentOwner == address(0)) {
return true;
}
return false;
}
| 5,196,637 |
/**
*Submitted for verification at BscScan.com on 2021-10-28
*/
/**
*Submitted for verification at arbiscan.io on 2021-09-22
*/
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.2;
interface ISushiswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
eve... | Swaps `amounts[path.length-1]` `path[path.length-1]` to `to` on this chain Triggered by `anySwapOutExactTokensForNative` | function anySwapInExactTokensForNative(
bytes32 txs,
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline,
uint fromChainID
) external onlyMPC virtual ensure(deadline) returns (uint[] memory amounts) {
require(path[p... | 1,038,080 |
./partial_match/4/0xC8be655fBE8750beF55fe1896dbDF5aEA8dfCAcA/sources/DeBase.sol | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient,... | 8,559,718 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../access/Controllable.sol";
import "../interfaces/INFTGemFeeManager.sol";
contract NFTGemFeeManager is Controllable, INFTGemFeeManager {
address private operator;
uint256 public constan... | transfer tokens from this contract to the to given recipient/ | function transferToken(
address token,
address recipient,
uint256 amount
) external override onlyController {
IERC20(token).transfer(recipient, amount);
}
| 12,576,971 |
pragma solidity ^0.4.16;
// Ultroneum tokens Smart contract based on the full ERC20 Token standard
// https://github.com/ethereum/EIPs/issues/20
// Verified Status: ERC20 Verified Token
// Ultroneum tokens Symbol: XUM
contract ULTRONEUMToken {
/* This is a slight change to the ERC20 base standard.
function t... | Saftey Checks for Divison Tasks | function div(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b > 0);
uint256 c = a / b;
assert(a == b * c + a % b);
return c;
}
| 527,680 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.