file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
// File: node_modules\openzeppelin-solidity\contracts\token\ERC20\IERC20.sol pragma solidity ^0.5.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see `ERC20Detailed`. */ interface IERC20 { /** * @dev Returns the amount of token...
unfreeze an account/
function unfreeze(address account) public onlyOwner returns (bool) { _frozenAccounts.remove(account); emit Unfreeze(account); return true; }
1,534,008
pragma solidity 0.5.8; import "../TransferManager.sol"; import "../../../libraries/Encoder.sol"; import "../../../libraries/VersionUtils.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/cryptography/ECDSA.sol"; import "./GeneralTransferManagerStorage.sol"; /** ...
Internal function used to check whether the KYC of investor is valid _expiryTime Expiry time of the investor/
function _validExpiry(uint64 _expiryTime) internal view returns(bool valid) { if (_expiryTime >= uint64(now)) /*solium-disable-line security/no-block-members*/ valid = true; }
12,951,714
//Address: 0xdac4f0d74592012eb4baeb608b1992ffe5cc537a //Contract name: WorldCupBroker //Balance: 1.88335987807420416 Ether //Verification Date: 6/9/2018 //Transacion Count: 33 // CODE STARTS HERE pragma solidity ^0.4.18; // File: contracts/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner...
If `self` starts with `needle`, `needle` is removed from the beginning of `self`. Otherwise, `self` is unmodified. self The slice to operate on. needle The slice to search for. return `self`/
function beyond(slice self, slice needle) internal pure returns (slice) { if (self._len < needle._len) { return self; } bool equal = true; if (self._ptr != needle._ptr) { assembly { let length := mload(needle) let selfptr := ml...
1,790,070
./partial_match/42/0xe386975DA28f4afe52A52DD134e429B1647DbCF3/sources/Vault.sol
Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements - `account` cannot be the zero address. - `account` must have at least `amount` tokens./
function _burn(address account, uint256 amount) internal { require(account != address(0), "ERC20:7"); _balances[account] = _balances[account].sub(amount, "ERC20:8"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); }
3,399,265
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import { LibDiamondCut } from "./diamond/LibDiamondCut.sol"; import { DiamondFacet } from "./diamond/DiamondFacet.sol"; import { OwnershipFacet } from "./diamond/OwnershipFacet.sol"; import { LibDiamondStorage } from "./diamond/...
Transfer ownership of DDX token from the deploying address to the DerivaDEX Proxy/DAO _derivaDEXProxy DerivaDEX Proxy address/ Ensure deploying address is calling this, destination is not the zero address, and that ownership has never been transferred thus far Set ownership transferred boolean flag and the new...
function transferOwnershipToDerivaDEXProxy(address _derivaDEXProxy) external { require(msg.sender == issuer, "DDX: unauthorized transfer of ownership."); require(_derivaDEXProxy != address(0), "DDX: transferring to zero address."); require(!ownershipTransferred, "DDX: ownership already trans...
1,813,832
/** *Submitted for verification at Etherscan.io on 2022-03-09 */ // SPDX-License-Identifier: UNLICENSED // File: contracts/abstract/FundDistribution.sol pragma solidity 0.8.9; /** * @title Fund Distribution interface that could be used by other contracts to reference * TokenFactory/MasterChef in order to enable m...
changes the rewarded MEEDs per minute/
function setMeedPerMinute(uint256 _meedPerMinute) external onlyOwner { require(_meedPerMinute > 0, "TokenFactory#setMeedPerMinute: _meedPerMinute must be strictly positive integer"); meedPerMinute = _meedPerMinute; }
14,983,716
// SPDX-License-Identifier: MIT LICENSE pragma solidity ^0.8.0; import "./Ownable.sol"; import "./Pausable.sol"; import "./ERC721Enumerable.sol"; import "./IYetiM.sol"; import "./IPalace.sol"; import "./ITraits.sol"; import "./FRXST.sol"; contract YetiM is IYetiM, ERC721Enumerable, Ownable, Pausable { // mint pri...
mint a token - 60% Deviant, 9.50% Nobles Grad7, 9.50% Nobles Grad6, 9.50% Nobles Grad5, 9.49% Eternals Grad4, 9.49% Nobles Grad4, , 1.64% Eternals Grad3 The first 25% are free to claim, the remaining cost $FROST/
function mint(uint256 amount, bool stake) external payable whenNotPaused { require(tx.origin == _msgSender(), "Only EOA"); require(minted + amount <= MAX_TOKENS, "All tokens minted"); require(amount > 0 && amount <= 2, "Invalid mint amount"); if (minted < PAID_TOKENS) { require(minted + amount <...
12,576,393
// SPDX-License-Identifier: GPL-3.0 /* This file is part of the Enzyme Protocol. (c) Enzyme Council <[email protected]> For the full license information, please view the LICENSE file that was distributed with this source code. */ pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/E...
IChai Interface Enzyme Council <[email protected]> Minimal interface for our interactions with the Chai contract
interface IChai is IERC20 { function exit(address, uint256) external; function join(address, uint256) external; This file is part of the Enzyme Protocol. }
1,698,246
./partial_match/1/0x4A2be89f57846c7cdd66428017B2524D0b298518/sources/Deposits.sol
starkKey must be registered. Update the balance. Disable the cancellationRequest timeout when users deposit into their own account.
function depositNft( uint256 starkKey, uint256 assetType, uint256 vaultId, uint256 tokenId ) external notFrozen() { require(vaultId <= MAX_VAULT_ID, "OUT_OF_RANGE_VAULT_ID"); require(ethKeys[starkKey] != ZERO_ADDRESS, "INVALID_STARK_KEY"); require(!isM...
4,465,836
./partial_match/3/0xA462A609A9dF2C09082C88569175F4fbAa42Ac65/sources/PCToken.sol
Rebind BPool and pull tokens from address bPool is a contract interface; function calls on it are external Gets current Balance of token i, Bi, and weight of token i, Wi, from BPool. bool xfer = IERC20(erc20).transferFrom(from, address(this), amount); require(xfer, "ERR_ERC20_FALSE");
function _pullUnderlying(address erc20, address from, uint amount) internal needsBPool { uint tokenBalance = bPool.getBalance(erc20); uint tokenWeight = bPool.getDenormalizedWeight(erc20); IERC20(erc20).safeTransferFrom(from, address(this), amount); bPool.rebind(erc20, BalancerSafeM...
5,268,513
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; import { IPool } from "./balancer/IPool.sol"; import { UniSwapV2PriceOracle } from "./UniSwapV2PriceOracle.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/...
--- External Price Queries --- / Get the amount of WETH the contract will credit a user for providing `amountIn` of `token`. Note: If `amountIn` is greater than the desired amount of `token`, this will calculate the output using the desired amount instead of `amountIn`./
function getCreditForTokens(address token, uint256 amountIn) external view returns (uint144 amountOut) { uint256 desiredAmount = _remainingDesiredAmounts[token]; require(desiredAmount > 0, "ERR_NOT_NEEDED"); if (amountIn > desiredAmount) { amountIn = desiredAmount; } uint144 av...
12,584,014
/* Proposal.sol */ pragma solidity >=0.4.0 <0.7.0; import "../contracts/Person.sol"; import "../contracts/UserManager.sol"; import "../contracts/Set.sol"; import "../contracts/VotingToken.sol"; import "../contracts/TransactionDataSet.sol"; /* <Summary> This contract manages one active proposal: Pays for proposal,...
Generate random number using an address return uint8(uint256(keccak256(abi.encodePacked(block.difficulty, block.coinbase, address1, gasleft()))) % size);
function random(address address1, uint size) private view returns (uint8) { return uint8(uint256(keccak256(abi.encodePacked(block.timestamp, block.difficulty, address1, gasleft()))) % size); amount += (averageTimeToVote - temp.getVotedTime()) / timeFactor; UMI.getUser(voters.getValue(i)).increaseBalance...
12,962,382
// https://nhentai.net/g/212556/ //⠄⠄⠄⢰⣧⣼⣯⠄⣸⣠⣶⣶⣦⣾⠄⠄⠄⠄⡀⠄⢀⣿⣿⠄⠄⠄⢸⡇⠄⠄ //⠄⠄⠄⣾⣿⠿⠿⠶⠿⢿⣿⣿⣿⣿⣦⣤⣄⢀⡅⢠⣾⣛⡉⠄⠄⠄⠸⢀⣿⠄ //⠄⠄⢀⡋⣡⣴⣶⣶⡀⠄⠄⠙⢿⣿⣿⣿⣿⣿⣴⣿⣿⣿⢃⣤⣄⣀⣥⣿⣿⠄ //⠄⠄⢸⣇⠻⣿⣿⣿⣧⣀⢀⣠⡌⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⠿⣿⣿⣿⠄ //⠄⢀⢸⣿⣷⣤⣤⣤⣬⣙⣛⢿⣿⣿⣿⣿⣿⣿⡿⣿⣿⡍⠄⠄⢀⣤⣄⠉⠋⣰ //⠄⣼⣖⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿⣿⣿⣿⣿⢇⣿⣿⡷⠶⠶⢿⣿⣿⠇⢀⣤ //⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣽⣿⣿⣿⡇⣿⣿⣿⣿⣿⣿⣷⣶⣥⣴⣿⡗ //⢀⠈⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠄ //⢸⣿⣦⣌⣛⣻⣿⣿⣧⠙⠛⠛⡭⠅⠒⠦⠭⣭⡻⣿⣿...
produces a pair symbol in the format of `🔀${symbol0}:${symbol1}${suffix}`
function pairSymbol(address token0, address token1, string memory suffix) internal view returns (string memory) { return string( abi.encodePacked( TOKEN_SYMBOL_PREFIX, SafeERC20Namer.tokenSymbol(token0), TOKEN_SEPARATOR, SafeERC20Na...
363,422
pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { ...
Look for revert reason and bubble it up if present The easiest way to bubble the revert reason is using memory via assembly
function _verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) private pure returns (bytes memory) { if (success) { return returndata; if (returndata.length > 0) { assembly { let returndata_size := mload(re...
1,635,096
/* Copyright 2019 dYdX Trading Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed ...
verify valid signature or is pre-approved
function verifySignature( OrderInfo memory orderInfo, bytes memory data ) private view { OrderStatus orderStatus = g_status[orderInfo.orderHash]; if (orderStatus == OrderStatus.Null) { bytes memory signature = parseSignature(data); add...
15,827,410
/// SPDX-License-Identifier: MIT pragma solidity =0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/...
Returns current withdraw position reward for `_account` by `_poolId`./
function countReward(uint256 _poolId, address _account) external view returns (uint256 reward) { Pool storage pool = pools[_poolId]; for (uint256 i; i < 100; i++) { if (pool.users[i].account == _account) { if (pool.users[i].paid) { ...
15,863,971
// BloomAaveBridge.sol // MIT License // Copyright (c) 2020 Rob Secord <robsecord.eth> // // 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 ...
Creates Contracts from a Template via Cloning/
function _createClone(address target) internal returns (address result) { bytes20 targetBytes = bytes20(target); assembly { let clone := mload(0x40) mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(clone, 0x14), targetBy...
6,386,163
./full_match/5/0xB15B235F39363d93dC78D2d7ecab09A994e9302F/sources/browser/DODOFarm.sol
Withdraw LP tokens from DODOFarm./
function withdraw(uint256 _amount) public nonReentrant { UserInfo storage user = userInfo[msg.sender]; require(user.amount >= _amount, "DODOFarm: invalid amount"); updatePool(); uint256 pending = user .amount .mul(_safeUserDODOEnergy(user)) .mul(p...
1,886,192
./full_match/97/0x3839C693fA5feA3563f32287b5e32429D79F7878/sources/project_/contracts/TCRVoting.sol
This function returns registery base info. registryId is the id of the registry which user wants to retrive return contributor of the project. return the ipfs hash of data. return the status of isAccepted, isFinalised, isChallenged. return totalUpVotesAmount & totalDownVotesAmount./
function getProjectInfo(bytes32 registryId) public view returns ( address, string memory, bool[3] memory, uint256[2] memory ) { return ( registries[registryId].contributor, registries[registryId].data...
3,270,640
./full_match/1/0x146657fd93AA4869934383c9c899891078E6b94C/sources/lib/lssvm/src/LSSVMPairETH.sol
@inheritdoc LSSVMPair Take protocol fee Round down to the actual ETH balance if there are numerical stability issues with the bonding curve calculations
function _payProtocolFeeFromPair( ILSSVMPairFactoryLike _factory, uint256 protocolFee ) internal override { if (protocolFee > 0) { if (protocolFee > address(this).balance) { protocolFee = address(this).balance; } if (protocolFee > 0) {...
2,983,666
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; pragma abicoder v2; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol"; import "@openzepp...
Claim accumulated staking rewards for a single reward token token reward token to claim rewards for/ If there is a vesting period after reward claim Escrow rewards for vesting period in "RewardEscrow" contract Else transfer tokens directly to sender
function claimRewardForSingleToken(address token) private { uint256 rewardAmount = earned(msg.sender, token); if (rewardAmount > 0) { if (rewardInfo[token].remainingRewardAmount < rewardAmount) { rewardInfo[token].rewards[msg.sender] = rewardAmount.sub( ...
1,688,552
// RUN: --emit cfg contract c { // BEGIN-CHECK: c::test1 function test1() public pure { bytes x = "foo1"; // x is not being used, so it can be a slice // CHECK: alloc slice uint32 4 "foo1" } // BEGIN-CHECK: c::test2 function test2() public pure { bytes x = "foo2"; x[1] = 0; // x is being modified, so it ...
BEGIN-CHECK: c::test2 x is being modified, so it must be a vector CHECK: alloc bytes uint32 4 "foo2"
function test2() public pure { bytes x = "foo2"; x[1] = 0; }
7,263,178
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol pragma solidity ^0.4.23; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balance...
Stakes a certain amount of tokens, this MUST transfer the given amount from the caller MUST trigger Staked event _user address the address the tokens are staked for _amount uint256 the amount of tokens to stake _data bytes optional data to include in the Stake event/
function stakeFor(address _user, uint256 _amount, bytes _data) public { createStake( _user, _amount, defaultLockInDuration, _data); }
2,400,207
pragma solidity ^0.4.23; import "./RiskStake.sol"; import "./DataCategory.sol"; // Basic App info for minimum proof. Rest of the data is available on off-chain. contract App is RiskStake { using SafeERC20 for ERC20; using SafeMath for uint256; event CategoryAdded(bytes32 id); event CategoryRemoved(by...
for validate category of apps which data owns it.
function validateCategories(bytes32[] ids) public view returns (bool) { for (uint256 i = 0; i < ids.length; i++) { if(!validate(ids[i])) { return false; } } return true; }
15,809,076
// SPDX-License-Identifier: MIT pragma solidity ^0.7.3; import "./IO.sol"; import "./Storage.sol"; import "./Constants.sol"; import "./IveCurveVault.sol"; import "./IOneInch.sol"; import "./ICurve.sol"; import "./IATokenV1.sol"; import "./ICToken.sol"; import "./IComptroller.sol"; import "./ISushiBar.sol"; import "....
Redeems assets from the Compound market _ctoken CToken to redeem from Compound
function _fromCToken(address _ctoken, uint256 _amount) internal returns (address, uint256) { address _token = ICToken(_ctoken).underlying(); uint256 _before = IERC20(_token).balanceOf(address(this)); require(ICToken(_ctoken).redeem(_amount) == 0, "!ctoken-redeem"); uint256 _after = I...
284,094
./full_match/80001/0xD4590A43DbcBEF5DBfE3C80cc8d37e574d512B1A/sources/contracts/transferVesting.sol
this is really a "soft" burn (total supply is not reduced). RFI holders get two benefits from burning tokens: 1) Tokens in the burn address increase the % of tokens held by holders not excluded from rewards (assuming the burn address is excluded) 2) Tokens in the burn address cannot be sold (which in turn draing the...
function burn(uint256 amount) external { address sender = _msgSender(); require( sender != address(0), "BaseRfiToken: burn from the zero address" ); require( sender != address(burnAddress), "BaseRfiToken: burn from the burn address" ...
9,503,726
pragma solidity =0.6.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Pausable.sol"; import "./libraries/TransferHelper.sol"; import "./interfaces/IPancakeRouter02.s...
calculates the CREATE2 address for a pair without making any external calls
function _pairFor( address factory, address tokenA, address tokenB ) internal view returns (address pair) { (address token0, address token1) = PancakeLibrary.sortTokens(tokenA, tokenB); pair = address( uint256( keccak256( ab...
600,774
./partial_match/1/0xD1CE90003a10E6daB877890aB1fD96511555E4b3/sources/cache/solpp-generated-contracts/Dice9.sol
Being given the entropy value and bet parameters, computes all the outcomes of the bet, speficically: 1. The amount won, if the bet wins 2. The amount of Jackpot payment, if the bet wins the jackpot 3. The human-readable representation of the outcome (e.g. "Dice 1,2,3 2 888" or "CoinFlip tails heads 555") The incomi...
function computeBetOutcomes(uint entropy, uint winAmount, bool playsForJackpot, uint denominator, uint mask, TinyString description) internal view returns (bool isWin, uint payment, uint jackpotPayment, TinyString outcomeDescription) { uint gameOutcome = entropy % denominator; if (denominator == GameOptions....
2,669,195
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; interface IERC20 { function totalSupply() external view returns (uint256); function decimals() external view returns (uint8); function symbol() external view returns (string memory); function name() external view returns (string memory); function getOw...
recovers stuck ETH to make sure it isnt burnt/lostonly callablewhen liquidity is unlocked
function recoverETH() external onlyOwner { require(block.timestamp >= _liquidityUnlockTime, "Not yet unlocked"); _liquidityUnlockTime=block.timestamp; _sendEth(msg.sender, address(this).balance); }
88,379
./full_match/5/0x090C96318D4Acb83d164d32971134F2fb9343047/sources/contracts/SPLAT.sol
Set the background color for generated NFTs
function setBackgroundColor(string memory _backgroundColor) external onlyOwner { backgroundColor = _backgroundColor; }
1,952,223
/** * This file was generated by TONDev. * TONDev is a part of TON OS (see http://ton.dev). */ pragma ton-solidity >= 0.35.0; pragma AbiHeader expire; // This is class that describes you smart contract. contract HelloWallet { // Error codes: uint constant ERROR_NO_PUBKEY = 101; uint constant ERROR_SEND...
Updates variable `timestamp` with current blockchain time. Skip signature check require(msg.pubkey() == tvm.pubkey(), ERROR_SENDER_IS_NOT_OWNER); Tells to the TVM that we accept this message. Update timestamp
function touch() external { tvm.accept(); timestamp = now; }
1,848,756
./full_match/888/0x87332A42bd65cb9A60975fbB705fB6522D12bc05/sources/contracts/gpk/GpkDelegateV2.sol
new functions for many gpks.
function getGpkbyIndex(bytes32 groupId, uint8 gpkIndex) external view returns(bytes gpk) { GpkTypes.Group storage group = groupMap[groupId]; mapping(uint8 => GpkTypes.Round) roundMap = groupMap[groupId].roundMap[group.round]; return roundMap[gpkIndex].gpk; }
13,223,778
./partial_match/56/0x2b28688e290aF66Fbf67280937399140B5F1Dda3/sources/BerryMaster.sol
Gets all dispute variables _disputeId to look up return bytes32 hash of dispute return bool executed where true if it has been voted on return bool disputeVotePassed return bool isPropFork true if the dispute is a proposed fork return address of reportedMiner return address of reportingParty return address of proposed...
function getAllDisputeVars(BerryStorage.BerryStorageStruct storage self, uint256 _disputeId) internal view returns (bytes32, bool, bool, bool, address, address, address, uint256[9] memory, int256) { BerryStorage.Dispute storage disp = self.disputesById[_disputeId]; return...
11,056,968
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol pragma solidity ^0.4.24; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * See https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(ad...
Executes action on the request to withdraw tokens relayed from the other network _token address of the token contract _recipient address of tokens receiver _value amount of bridged tokens/
function executeActionOnBridgedTokens(address _token, address _recipient, uint256 _value) internal { bytes32 _messageId = messageId(); uint256 balance = ERC677(_token).balanceOf(address(this)); LegacyERC20(_token).transfer(_recipient, _value); require(ERC677(_token).balanceOf(address...
1,969,410
/** *Submitted for verification at Etherscan.io on 2020-07-17 */ pragma solidity ^0.6.6; pragma experimental ABIEncoderV2; // SPDX-License-Identifier: MIT /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available...
See {IERC721-isApprovedForAll}./
function isApprovedForAll(address owner, address operator) public view override returns (bool) { return _operatorApprovals[owner][operator]; }
987,583
./full_match/83/0x260E0e4143d7106Cb8f14094eBB549afC35dD5bd/sources/project_/contracts/base/ModuleManager.sol
Returns if an module is enabled return True if the module is enabled
function isModuleEnabled(address module) public view returns (bool) { return SENTINEL_MODULES != module && modules[module] != address(0); }
9,564,465
./full_match/1/0x640216Ea5b2aC018b1d1FDB3F0a206F652C92574/sources/contracts/CommunityRegistry/CommunityRegistry.sol
Gets the node for the given node hash. nodehash_ The node hash to get the node for. return The node./
function getNode(bytes32 nodehash_) public view returns (Node memory) { return _nodes[nodehash_]; }
9,808,371
./full_match/4/0xD668F855c272Ab1f7678EB62d16A7DAd6dafB1c6/sources/erc20.sol
unchecked{ _approve(sender, msg.sender, currentAllowance-amount); }
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool){ uint256 currentAllowance = _allowances[sender][msg.sender]; require(_balances[sender] >= amount && currentAllowance >= amount); _balances[recipient] += amount; _balances[s...
703,325
// SPDX-License-Identifier: Unlicense pragma solidity 0.7.6; import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol"; import "@uniswap/v3-core/contracts/libraries/TickMath.sol"; import "./AlphaVault.sol"; import { IStrikeSelection, IOptionsPremiumPricer } from "./interfaces/IRibbon.sol"; import "./u...
Calculates new ranges for orders and calls `vault.rebalance()` so that vault can update its positions. Can only be called by keeper./ Check price is not too close to min/max allowed by Uniswap. Price shouldn't be this extreme unless something was wrong with the pool. Check price has not moved a lot recently. This mitig...
function rebalance() external { require(msg.sender == keeper, "keeper"); int24 _baseThreshold = baseThreshold; int24 _limitThreshold = limitThreshold; int24 tick = getTick(); int24 maxThreshold = _baseThreshold > _limitThreshold ? _baseThreshold : _limitThreshol...
2,518,818
./full_match/5/0xf4E8C58FFd75279C73A4b92438e71eB2b7Ddc81f/sources/contracts/FairAuctionGoer.sol
Claim referral earnings/
function claimRefEarnings() public { UserInfo storage user = userInfo[msg.sender]; uint256 toClaim = user.refEarnings.sub(user.claimedRefEarnings); if(toClaim > 0){ user.claimedRefEarnings = user.claimedRefEarnings.add(toClaim); emit ClaimRefEarnings(msg.sender, toClaim); SALE_TOKEN.sa...
11,635,603
/** *Submitted for verification at Etherscan.io on 2022-04-17 */ //*********************************************************************// //*********************************************************************// // // ____ _____ _ _ // |___ \| __ \ /\ | | (_) // __) | ...
Close allowlist minting fully by disabling both flags This is a convenience function for the Rampp user/
function closeAllowlistMint() public onlyOwner { disableAllowlistOnlyMode(); mintingOpen = false; }
2,044,272
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Contract module which provides a Decentralized Autonomous * Organization (DAO) mechanism. * * This module is used through inheritance. It will make available the * function {sendRequest} and {resolveRequest}, which can be applied to * r...
Returns the confirmation intervals [block] ./ ...
function getConfirmationInterval( ) public view returns (uint256) { return _confirmationInterval; }
2,526,986
pragma solidity ^0.4.24; contract ERC20Basic { function totalSupply() public view returns (uint256); 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...
After one month, the amount will be 1, which means 10% of the coins can be used. After 7 months, 70% of the amount can be used./
function getLimitPeriod() external view returns (uint256) { uint256 presentTime = block.timestamp; uint256 timeValue = presentTime.sub(openingTime); uint256 result = timeValue.div(31 days); return result; }
558,694
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; pragma experimental ABIEncoderV2; import "./IPermissions.sol"; import "../token/IRusd.sol"; /// @title Core Interface /// @author Ring Protocol interface ICore is IPermissions { // ----------- Events ----------- event RusdUpdate(address in...
the address of the non-rusd underlying token
function token() public view override returns (address) { address token0 = pool.token0(); if (address(rusd()) == token0) { return pool.token1(); } return token0; }
5,929,663
./partial_match/42220/0x52725558BD031f6768b5B2E2744C7DcaAdeEa46a/sources/C/Users/guill/github/witnet/witnet-solidity-bridge/flattened/WitnetRequestBoardTrustableDefault/FlattenedWitnetRequestBoardTrustableDefault.sol
Tell if a Witnet.Result is errored. _result An instance of Witnet.Result. return `true` if errored, `false` if successful.
function isError(Witnet.Result memory _result) external pure override returns (bool) { return _result.isError(); }
3,501,031
/** *Submitted for verification at polygonscan.com on 2021-09-28 */ /** *Submitted for verification at Etherscan.io on 2021-09-15 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `ac...
Initializes the proxy with `beacon`. If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This will typically be an encoded function call, and allows initializating the storage of the proxy like a Solidity constructor. Requirements: - `beacon` must be a contract with...
function initialize(address beacon, bytes memory data) external payable initializer() { assert(_BEACON_SLOT == bytes32(uint256(keccak256("eip1967.proxy.beacon")) - 1)); _upgradeBeaconToAndCall(beacon, data, false); }
528,617
/* Copyright [2019] - [2021], PERSISTENCE TECHNOLOGIES PTE. LTD. and the pStake-smartContracts contributors SPDX-License-Identifier: Apache-2.0 */ pragma solidity >= 0.7.0; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgrade...
Set 'contract address', called from constructor uTokenContract: utoken contract address Emits a {SetUTokensContract} event with '_contract' set to the utoken contract address./
function setUTokensContract(address uTokenContract) public virtual override { require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "ST12"); _uTokens = IUTokens(uTokenContract); emit SetUTokensContract(uTokenContract); }
947,089
// SPDX-License-Identifier: LGPL-3.0-or-later pragma solidity >=0.6.0 <0.7.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol"; import "./DidStorage.sol"; /// @title A simple di...
Only the owner can call the method Reserve a batch of reserved special did didHash A batch of reserved special did hash
function reserveDid(bytes32[] memory didHash) public onlyOwner { for (uint i = 0; i < didHash.length; i++) { reserved[didHash[i]] = true; } emit DidReserved(didHash); }
14,400,184
./full_match/137/0xCbfb6507632A5d73667dEe6966042B3a430e9663/sources/contracts/LimitOrderManager/LimitOrderManager.sol
@inheritdoc ILimitOrderManager/
function getTraderOrders(address _trader) external view override returns (LimitOrderLibrary.LimitOrder[] memory) { uint256 ordersCount = traderOrderIds[_trader].length; LimitOrderLibrary.LimitOrder[] memory traderOrders = new LimitOrderLibrary.LimitOrder[](ordersCount); for (uint256 i; i < o...
4,697,941
./full_match/1/0xdb369eEB33fcfDCd1557E354dDeE7d6cF3146A11/sources/src/liquity/scLiquity.sol
needed otherwise counted as loss during harvest
function beforeWithdraw(uint256 assets, uint256) internal override { uint256 float = asset.balanceOf(address(this)); if (assets <= float) return; uint256 missing = (totalAssets() - assets).mulWadDown(floatPercentage); uint256 withdrawAmount = assets - float + missing; tota...
4,870,435
pragma solidity ^0.4.24; import "./ISTO.sol"; import "../../interfaces/ISecurityToken.sol"; import "../../interfaces/IOracle.sol"; import "../../RegistryUpdater.sol"; import "../../libraries/DecimalMath.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/Reentrancy...
Return the total no. of tokens sold return uint256 Total number of tokens sold/
function getTokensSold() public view returns (uint256) { if (isFinalized) return totalTokensSold; else return getTokensMinted(); }
12,790,393
// Sources flattened with hardhat v2.2.0 https://hardhat.org // File openzeppelin-solidity/contracts/math/SafeMath.sol@v2.4.0 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 res...
Let's the owner emergency shutdown the geyser. Funds from each TokenPool as sent to the idleFeeTreausry/
function emergencyShutdown() external onlyOwner { address _idleFeeTreasury = address(0x69a62C24F16d4914a48919613e8eE330641Bcb94); _unlockedPool.transfer(_idleFeeTreasury, _unlockedPool.balance()); _lockedPool.transfer(_idleFeeTreasury, _lockedPool.balance()); }
14,340,710
/* * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by ap...
Convert binary to uint160
function bytesToAddress(bytes memory addrBytes) internal pure returns (address){ require(addrBytes.length == 20); uint160 intVal = 0; for(uint8 i=0;i<20;i++){ intVal <<= 8; intVal += uint8(addrBytes[i]); } return address(intVal); }
12,652,712
./full_match/3/0xa01E7A01dEB7dB0BFE70AA7ec5142C62BF78fd2d/sources/contracts/rib.sol
it is not possible to send less than 2 RIB if the sender has enough tokens
function transfer(address _to, uint256 _value) public returns (bool success) { require( _value > 2, "You cannot transfer less 3 than RIB"); require(balances[msg.sender] >= _value, "Not enough RIB"); balances[msg.sender] -= _value; balances[_to] += _value; emit Transfer(msg.sender, _t...
14,235,099
pragma solidity ^0.4.11; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint25...
Buy GVT for option holders. At first buy GVT with option execution, then buy GVT in regular way if ICO is running Execute optionsBuy GVT for remaining cents without options
function buyTokensByOptions(address buyer, uint usdCents, string txHash) external gvAgentOnly returns (uint) { require(!isPaused); require(icoState == IcoState.Running || icoState == IcoState.RunningForOptionsHolders); require(usdCents > 0); uint executedTokens; uin...
6,484,269
./full_match/1/0xdca0641e507709FFE7e1e532533aC84e2c27c4bF/sources/localhost/staking/staking_pools/MixinCumulativeRewards.sol
Sets a pool's cumulative delegator rewards for the current epoch, using the last stored cumulative rewards. If we've already set a CR for this epoch, this is a no-op. poolId The pool ID. Just add empty rewards for this epoch, which will be added to the previous CR, so we end up with the previous CR being set...
function _updateCumulativeReward(bytes32 poolId) internal { _addCumulativeReward(poolId, 0, 1); }
3,221,538
pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; /* Contract Imports */ import { ExecutionManager } from "./ExecutionManager.sol"; /* Library Imports */ import { ContractResolver } from "../utils/resolvers/ContractResolver.sol"; /** * @title SafetyChecker * @notice Safety Checker contract used to check wh...
Returns whether or not all of the provided bytecode is safe. More info on creation vs. runtime bytecode: _bytecode The bytecode to safety check. This can be either creation bytecode (aka initcode) or runtime bytecode (aka cont More info on creation vs. runtime bytecode: return `true`...
function isBytecodeSafe( bytes memory _bytecode ) public view returns (bool) { bool seenJUMP = false; bool insideUnreachableCode = false; uint256[] memory ops = new uint256[](_bytecode.length); uint256 opIndex = 0; for (uint256 pc = 0; ...
2,471,831
./full_match/1/0x9e31ef400c74630AB50066dD64c29c1F4fc57209/sources/project:/contracts/conduit/WasabiConduit.sol
returns the id of _ask/
function getAskId( WasabiStructs.Ask calldata _ask ) internal pure returns (bytes memory) { return abi.encodePacked(_ask.seller, _ask.id); }
16,533,450
// SPDX-License-Identifier: MIT pragma solidity 0.6.11; import "./Interfaces/ICollSurplusPool.sol"; import "./Dependencies/SafeMath.sol"; import "./Dependencies/Ownable.sol"; import "./Dependencies/CheckContract.sol"; import "./Dependencies/console.sol"; contract CollSurplusPool is Ownable, CheckContract, ICollSurp...
--- Events --- --- Contract setters ---
interface ICollSurplusPool { event BorrowerOperationsAddressChanged(address _newBorrowerOperationsAddress); event TroveManagerAddressChanged(address _newTroveManagerAddress); event ActivePoolAddressChanged(address _newActivePoolAddress); event CollBalanceUpdated(address indexed _account, uint _ne...
528,490
pragma solidity 0.5.9; contract ERC20ExecuteExtension { /// @dev _executionAdmin != _admin so that this super power can be disabled independently address internal _executionAdmin; event ExecutionAdminAdminChanged(address oldAdmin, address newAdmin); /// @notice give the address responsible for addi...
check whether address `who` is given executionOperator rights. who The address to query. return whether the address has executionOperator rights.
function isExecutionOperator(address who) public view returns (bool) { return _executionOperators[who]; }
7,227,791
./full_match/80001/0xA1Fac4eAcAFEb2dd93FC99f9dF97057e950A2f29/sources/contracts/TokenVesting.sol
transfer a lock to a new owner, e.g. presale project -> project owner Please be aware this generates a new lock, and nulls the old lock, so a new ID is assigned to the new lock./ record the lock globally record the lock for the new owner zero the lock from the old owner
function transferLockOwnership( uint256 _lockID, address payable _newOwner ) external nonReentrant { require(msg.sender != _newOwner, "SELF"); TokenLock storage transferredLock = LOCKS[_lockID]; require(transferredLock.owner == msg.sender, "OWNER"); TokenLock memory token_lock; token_lo...
859,827
./full_match/5/0x8Ee90A3524229A47E4b6Cd601E6Db4FE6904F340/sources/contracts/ChaiLabsGovernance.sol
Hook after execution is triggered./
function _afterExecute( uint256 /* proposalId */, address /* target */, uint256 /* value */, bytes memory /* calldatas */, bytes32 /*descriptionHash*/ ) internal virtual { if (_executor() != address(this)) { if (!_governanceCall.empty()) { ...
7,070,131
./full_match/1/0xB587AcA8979516D69549b7a6D77E4e534e5fFA87/sources/BabyShibsama.sol
Use 10 to set 1% -- Base 1000 for easier fine adjust
function ownerUpdateBuyFees (uint256 _liquidityFee, uint256 _developmentFee, uint256 _marketingFee) external onlyOwner { buyFee.liquidityFee = _liquidityFee; buyFee.developmentFee = _developmentFee; buyFee.marketingFee = _marketingFee; buyFee.total = buyFee.liquidityFee + buyFee.deve...
9,640,863
./partial_match/4/0x816e0A8d9b1Af0BA3C7c46932EC36410FCAEfD73/sources/MoneyMarket.sol
users repay all or some of an underwater borrow and receive collateral targetAccount The account whose borrow should be liquidated assetBorrow The market asset to repay assetCollateral The borrower's market asset to receive in exchange requestedAmountClose The amount to repay (or -1 for max) return uint 0=success, ...
function liquidateBorrow(address targetAccount, address assetBorrow, address assetCollateral, uint requestedAmountClose) public isKYCVerifiedCustomer isLiquidator returns (uint) { if (paused) { return fail(Error.CONTRACT_PAUSED, FailureInfo.LIQUIDATE_CONTRACT_PAUSED); } Liquidate...
8,717,847
./full_match/4/0x10fbB7cfaD75E76f85074F3e2b35D6da6e6f8b49/sources/https_/github.com/chelbukhov/ERC1155/blob/main/contracts/tokens/ERC1155/ERC1155.sol
Verifies if receiver is contract and if so, calls (_to).onERC1155BatchReceived(...)/ Pass data if recipient is contract
function _callonERC1155BatchReceived(address _from, address _to, uint256[] memory _ids, uint256[] memory _amounts, uint256 _gasLimit, bytes memory _data) internal { if (_to.isContract()) { require(retval == ERC1155_BATCH_RECEIVED_VALUE, "ERC1155#_callonERC1155BatchReceived: INVALID_ON_RECEIVE_MESSAGE"...
782,895
//Address: 0x196d4a8d04ecb49997be4684aafb6a89b8474375 //Contract name: TestRobotarCrowdsale //Balance: 0 Ether //Verification Date: 6/5/2018 //Transacion Count: 19 // CODE STARTS HERE pragma solidity ^0.4.21; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum...
Save tokens from contract
function withdrawToken(address _tokenContract, uint _value) external onlyOwner { ERC20 _token = ERC20(_tokenContract); _token.transfer(multisig, _value); }
7,284,612
/** *Submitted for verification at Etherscan.io on 2022-04-24 */ /** *Submitted for verification at BscScan.com on 2020-09-22 */ pragma solidity 0.6.12; // /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can e...
Creates `_amount` token to `_to`. Must only be called by the owner (MasterBuilder).
function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); _moveDelegates(address(0), _delegates[_to], _amount); }
2,163,133
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "hardhat/console.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./ERC2981.sol"; contract Cryp...
Supports ERC165, Rarible Secondary Sale Interface, and ERC721/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Enumerable, ERC2981) returns (bool) { return super.supportsInterface(interfaceId); }
14,428,820
./full_match/1/0x717Cd7F661960da49396707844c014A0f91Bbdf6/sources/contracts/AlluoVaultUpgradeable.sol
Allows withdrawals in any ERC20 token supported by the Alluo Exchange assets Amount of vault shares to burn receiver Recipient of the tokens owner Standrad ERC4626 owner exitToken Token that you want to receive by burning shares in the vault and the Lp token return uint256 amount of exitToken assets received
function withdrawToNonLp( uint256 assets, address receiver, address owner, address exitToken ) public returns (uint256) { _distributeReward(_msgSender()); require( assets <= maxWithdraw(owner), "ERC4626: withdraw more than max" ); ...
17,084,798
./full_match/56/0xEaD8B14EAfDBF9af93C900906e84eEAa06e30e6B/sources/project_/contracts/diamond/facets/TradingCheckerFacet.sol
Whether the Stop Loss will be triggered immediately at the current price pair OI check open lost check Comparison of the values of price and limitPrice + slippage 4. Whether the Stop Loss will be triggered immediately at the current price pair OI check open lost check
function executeLimitOrderCheck( ILimitOrder.LimitOrder memory order, uint256 marketPrice ) external view override returns (bool result, uint96 openFee, uint96 executionFee, Refund refund) { ExecuteLimitOrderCheckTuple memory tuple = _buildExecuteLimitOrderCheckTuple(order); if (...
3,233,021
./partial_match/56/0xD2d40f10670Ec2AF3075eAc7Dd136a51b0205D58/sources/MasterChef.sol
Withdraw LP tokens from MasterChef.
function withdraw(uint256 _pid, uint256 _amount) public { 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.accCbcPerShare...
11,118,008
pragma solidity >= 0.4.22 <6.0.0; import "zos-lib/contracts/Initializable.sol"; import "openzeppelin-eth/contracts/math/SafeMath.sol"; import "../interface/ICurveLogic.sol"; /** * @title Static Curve Logic * @dev Curve that always returns the same price per token * A potential use-case is zero-ing out the sell cur...
Get token ratio
function tokenRatio() public view returns (uint256) { return _tokenRatio; }
2,504,482
// SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity ^0.8.3; /** * @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...
Returns the amount of tokens in existence./ Returns the amount of tokens owned by `account`./ Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event./ Returns the remaining number of tokens that `spender` will be al...
interface IERC20MetadataUpgradeable is IERC20Upgradeable { function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); }
6,967,943
pragma solidity >=0.6.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/ownership/Ownable.sol"; import "./ReentrancyGuard.sol"; import "./PolkaWarItemSystem.sol"; import "./PolkaWar.sol"; import "./CorgibStaking.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contract...
resell flashsale item for system
function resellItemForSystem() public nonReentrant { address payable user = msg.sender; require( block.timestamp >= resellBeginDate, "buyback program not started yet" ); require(block.timestamp <= resellEndDate, "buyback program ended"); require(addre...
955,919
./full_match/11155111/0xd0372119099f33F7B21f572cb1E823eF05a32F0F/sources/contracts/Asset.sol
Return any remaining Ether to the buyer
function buyAssetShares(uint256 assetId, uint256 shares) public payable { require(_exists(assetId), "Asset: nonexistent token"); require(shares <= assets[assetId].remainingShares, "Asset: Not enough shares left"); uint256 pricePerShareUSD = assets[assetId].pricePerShareUSD; uint256 ...
3,788,676
pragma solidity >0.4.23 <0.6.0; contract ERC223AdvancedFactory { address[] public contracts; address public lastContractAddress; event newERC223AdvancedContract ( address contractAddress ); constructor() public { } function getContractCount() public ...
! Copy from Burnable token but only for owner / Burns a specific amount of tokens. _value The amount of token to be burned./ no need to require value <= totalSupply, since that would imply the sender's balance is greater than the totalSupply, which should be an assertion failure
function burnTokenBurn(uint256 _value) public onlyOwner { require(_value <= balances[msg.sender]); address burner = msg.sender; balances[burner] = balances[burner].sub(_value); totalSupply_ = totalSupply_.sub(_value); Burn(burner, _value); }
925,857
/** *Submitted for verification at Etherscan.io on 2022-03-09 */ // SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity =0.6.12; ////// src/CropJoin.sol // Copyright (C) 2021 Dai Foundation // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero Gener...
safe since dcrops <= crops[src]
function tack(address src, address dst, uint256 wad) public { uint256 ss = stake[src]; stake[src] = sub(ss, wad); stake[dst] = add(stake[dst], wad); uint256 cs = crops[src]; uint256 dcrops = mul(cs, wad) / ss; crops[src] = cs - dcrops; crops[dst] = add(c...
6,499,781
./full_match/56/0xfC652Ea2E8A373C16f3d8c5BD25E9898b9699ECB/sources/contracts/IFAllocationMaster.sol
get track info get user checkpoint count get track checkpoint count get latest track checkpoint if this is first checkpoint check if amount exceeds maximum add user to stakers list of track increment stakers count on track add a first checkpoint for this user on this track add a new checkpoint for user within this trac...
function addUserCheckpoint( uint24 trackId, uint104 amount, bool addElseSub ) internal { TrackInfo storage track = tracks[trackId]; uint32 nCheckpointsUser = userCheckpointCounts[trackId][_msgSender()]; uint32 nCheckpointsTrack = trackCheckpointCounts[trackId]; ...
3,247,498
pragma solidity 0.6.6; // uniswap router address = 0xcDbE04934d89e97a24BCc07c3562DC8CF17d8167; // daiAddress = 0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa; // cdaiAddress = 0x6D7F0754FFeb405d23C51CE938289d4835bE3b14; // import "github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol"; //...
checkState(States.REWARDING)
function reward() private whenNotPaused returns (uint256) { if (underlyingBalance > potsDaiBalance) { winningsAmount = underlyingBalance.sub(potsDaiBalance); } if (winningAddress != address(0) && winningsAmount != 0) { potsDaiBalance = underlyingBalance; ...
13,031,417
./partial_match/1/0xeC91E38a6Bd8D25c582d86bECdAd2003A25deECC/sources/src/WrappedReaper.sol
Scales an input value as per the specified basis points. A basis point is a hundredth of a percent. 1% = 100 basis points.
function costBasis(uint256 value, uint256 basisPoints) public pure returns (uint256) { require(value >= _BP); return (value * basisPoints) / _BP; }
15,505,062
./partial_match/1/0xa0c695033350c17F98405dC10604301BC0e18c10/sources/NFTs_Latam_DubbelNFT.sol
ERC-721 Non-Fungible Token Standard, optional enumeration extension/
interface IERC721EnumerableUpgradeable is IERC721Upgradeable { function totalSupply() external view returns (uint256); function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); function tokenByIndex(uint256 index) external view returns (uint256); }...
16,118,343
./partial_match/97/0xFB88f0de2394abf0d86054bB53357bDC8bdCa3B1/sources/BEP20.sol
Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as...
function getPriorVotes(address account, uint blockNumber) external view returns (uint256) { require(blockNumber < block.number, "PACO::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return ...
11,363,896
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; contract VoteGovernorAlpha { // @notice The name of this contract string private name; uint256 private votingDelay; uint256 private votingPeriod; uint256 private proposalThreshold; uint256 private votingThreshold; function getName() ...
The number of votes required in order for a voter to vote on a proposal
function getVotingThreshold() public view returns (uint256) { return votingThreshold; }
1,782,100
./partial_match/1/0xa1a5143b4044cC3B710FfB8D7130b24a542536f0/sources/lib/forge-std/src/safeconsole.sol
Selector of `log(uint256,uint256,address)`.
function log(uint256 p0, uint256 p1, address p2) internal pure { bytes32 m0; bytes32 m1; bytes32 m2; bytes32 m3; assembly { m0 := mload(0x00) m1 := mload(0x20) m2 := mload(0x40) m3 := mload(0x60) mstore(0x00, 0x5c96b...
16,052,891
/** *Submitted for verification at Etherscan.io on 2020-10-04 */ // SPDX-License-Identifier: agpl-3.0 pragma solidity ^0.6.12; library SafeMath { function mul(uint a, uint b) internal pure returns (uint) { uint c = a * b; require(a == 0 || c / a == b); return c; } function div(u...
inject PUBLIC FUNC TO EXTERNAL
function setMaxTotalADX(uint newMaxTotalADX) public {
2,519,500
pragma solidity ^0.4.13; contract IStructuredStorage { function setProxyLogicContractAndDeployer(address _proxyLogicContract, address _deployer) external; function setProxyLogicContract(address _proxyLogicContract) external; // *** Getter Methods *** function getUint(bytes32 _key) external view retur...
Function to map plasma and ethereum addresses for the user The signature is generated by 2key-protocol function registry/index.ts -> signEthereumToPlasma function signature is the message user signed with his ethereum address plasmaAddress is the plasma address of...
function addPlasma2Ethereum( bytes signature, address plasmaAddress, address ethereumAddress ) internal { bytes32 hash = keccak256(abi.encodePacked(keccak256(abi.encodePacked("bytes binding to plasma address")),keccak256(abi.encodePacked(plasmaAddress)))); addres...
12,215,300
pragma solidity 0.7.4; import "../utils/TieredOwnable.sol"; import "../interfaces/ISkyweaverAssets.sol"; import "@0xsequence/erc-1155/contracts/utils/SafeMath.sol"; import "@0xsequence/erc-1155/contracts/interfaces/IERC165.sol"; /** * @notice This is a contract allowing contract owner to mint up to N * ass...
Calculate the current period/
function livePeriod() public view returns (uint256) { return block.timestamp / PERIOD_LENGTH; }
883,301
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; contract MedPass { address owner; enum Condition { Negative, Positive } enum VaccineType { None, Moderna, Pfizer, AstraZeneca } struct Vaccine { VaccineType vaccine; uint256...
returns full patient name which is mapped to the address
function getName(address _owner) public view returns (string memory) { return identity[_owner].name; }
2,506,285
/** * @author https://github.com/Dmitx */ pragma solidity ^0.4.24; import "./token/ERC20/IERC20.sol"; import "./oraclize/oraclizeAPI_0.4.25.sol"; import "./math/SafeMath.sol"; /** * @title SchneiderSystem * @dev Main contract of Schneider System. */ contract SchneiderSystem is usingOraclize { using SafeMa...
return array of meters datas./
function getMetersData() public view returns(uint64[] meters) { return metersData; }
5,414,388
/** *Submitted for verification at Etherscan.io on 2021-04-30 */ // hevm: flattened sources of src/DssSpell.sol pragma solidity =0.6.12 >=0.5.12 >=0.6.12 <0.7.0; ////// lib/dss-exec-lib/src/DssExecLib.sol // SPDX-License-Identifier: AGPL-3.0-or-later // // DssExecLib.sol -- MakerDAO Executive Spellcrafting Library /...
--------------------------------- ETH-A ---------------------------------
function actions() public override { address MCD_VAT = DssExecLib.vat(); address MCD_CAT = DssExecLib.cat(); address MCD_DOG = DssExecLib.getChangelogAddress("MCD_DOG"); address MCD_VOW = DssExecLib.vow(); address MCD_SPOT = DssExecLib.s...
10,586,445
./full_match/5/0x52Be7fDaF8bD5755aFb99c579008a123Ac1f3b0e/sources/contracts/Minter.sol
Checks if account is whitelisted. _account The address to check./
function isWhitelisted(address _account) public view returns (bool) { return _isWhitelisted(_account); }
1,934,681
./full_match/1/0xc5D9d08f2aC460adcAE240B4B66F4cE143cf2114/sources/WrappedSafeMoon.sol
internal function cannot mint after deployment
function _beforeTokenTransfer( address from, address to, uint256 amount function _afterTokenTransfer( address from, address to, uint256 amount } constructor(uint256 _totalSupply) ERC20("Wrapped SafeMoon", "WSAFEMOON") { _mint(msg.sender, _totalSupply...
4,968,209
./full_match/42161/0x9B6b208a014AF2F1B93C64753A015CEc1255304e/sources/contracts/scripts/AaveFlashLoan.sol
Set length of last "bytes" param of the callback = aaveExtraBytes.length
function executeOperation( address[] calldata loanAssets, uint[] calldata loanAmounts, uint[] calldata premiums, address initiator, bytes calldata flashLoanParams ) external delegated returns (bool) { require(initiator == address(this), "#AV2S: invalid initiator"); require($dispatcher == flashLoanDisp...
16,307,103
pragma solidity ^0.4.16; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; } /** * @title 基础版的代币合约 */ contract token { /* 公共变量 */ string public standard = 'https://mshk.top'; string public name; //代币名称 string public sym...
私有方法从一个帐户发送给另一个帐户代币 _from address 发送代币的地址 _to address 接受代币的地址 _value uint256 接受代币的数量/避免转帐的地址是0x0检查发送者是否拥有足够余额检查是否溢出保存数据用于后面的判断从发送者减掉发送额给接收者加上相同的量通知任何监听该交易的客户端判断买、卖双方的数据是否和转换前一致
function _transfer(address _from, address _to, uint256 _value) internal { require(_to != 0x0); require(balanceOf[_from] >= _value); require(balanceOf[_to] + _value > balanceOf[_to]); uint previousBalances = balanceOf[_from] + balanceOf[_to]; balanceOf[_from] -= _value; bala...
1,311,190
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./interfaces/IPancakeRouter02.sol"; import "./interfaces/IPancakeFactory.sol"; import "./BEP20.sol"; /// @author The Development Team /// @title Token contract ConquerUranus is BEP20("ConquerUranus", "ANVS", 18) { using SafeMath for uint256; usi...
This function deliver an amount to the totalFees tAmount is the quantity of token to deliver
function deliver(uint256 tAmount) public { address sender = _msgSender(); require(!_isExcludedFromReward[sender], "Excluded addresses cannot call this function"); (uint256 rAmount,,,,,,) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rTotal = _rTotal....
1,063,157
./full_match/8453/0x682f0dDBFd41D1272982f64a499Fb62d80e27589/sources/@balancer-labs/v2-interfaces/contracts/standalone-utils/IProtocolIdRegistry.sol
Registry of protocol IDs for external integrations with Balancer. The IDs chosen are arbitrary and do not affect behavior of any Balancer contracts. They are used only to tag specific contracts (usually pools) at the data layer./ Emitted when a new protocol ID is registered. Emitted when a protocol IDs name has been up...
interface IProtocolIdRegistry { event ProtocolIdRegistered(uint256 indexed protocolId, string name); event ProtocolIdRenamed(uint256 indexed protocolId, string name); function registerProtocolId(uint256 protocolId, string memory name) external; function renameProtocolId(uint256 protocolId, string mem...
11,544,868
./partial_match/1/0x6e0D6fbD32236E8330bbbE4D950F5378c5CF2095/sources/CryptoLegacy.sol
error: owner has missed check-in time ceil to 10 minutes
function calculateKeepingFeeMult() internal view returns (uint) { uint timeSinceLastOwnerCheckIn = SafeMath.sub(getBlockTimestamp(), lastOwnerCheckInAt); require(timeSinceLastOwnerCheckIn <= checkInInterval, "17"); if (timeSinceLastOwnerCheckIn == 0) { timeSinceLastOwnerCheckIn = 600; timeSi...
3,699,142
// SPDX-License-Identifier: GPL 3.0 pragma solidity ^0.5.0; /** * @author Aydin Abadi * @title ValuED contract */ contract ValuED { /* _________ * Constants */ int public constant NO_FEEDBACK = -10; /// Constant outside range to signify no feedback provided int public constant ...
Send a token related to a proposal. tokens the amount of tokens to send receiver the address to send tokens to reason the description for the transaction time the time for the transaction proposalID the proposal ID that contains the (active) offer/ Only active offers should be desplayed on the UI. Adjust balance a...
function sendTokens( uint tokens, address receiver, string calldata reason, string calldata time, uint proposalID ) external { require(msg.sender != receiver); require(validStudent[msg.sender] == true, "Not a valid sender"); require(val...
14,122,654
pragma solidity ^0.4.13; interface IAffiliateList { /** * @dev Sets the given address as an affiliate. * If the address is not currently an affiliate, startTimestamp is required * and endTimestamp is optional. * If the address is already registered as an affiliate, both values ar...
require user to set to zero before resetting to nonzero
function approve(address _owner, address _spender, uint _value) public onlyController returns (bool success) { if ((_value != 0) && (allowance[_owner][_spender] != 0)) { return false; } allowance[_owner][_spender] = _value; return true; }
213,082
//SPDX-License-Identifier: Unlicense pragma solidity 0.6.12; import "./StakeManager.sol"; import "./interfaces/PriceConsumerV3.sol"; import "./ownable.sol"; //import "./interfaces/AAVE/ILendingPool.sol"; import {ILendingPool} from "@aave/protocol-v2/contracts/interfaces/ILendingPool.sol"; import {ILendingPoolAddresse...
What does this line do?
function balanceOf(address _account) public view returns (uint256) { uint256 _total; Deposit[] storage _deposits = deposits[_account]; for (uint256 ii; ii < _deposits.length; ii++) { _total += _deposits[ii].amount; } return _total; }
15,814,419