file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
// SPDX-License-Identifier: LGPL-3.0-or-later pragma solidity ^0.7.6; pragma abicoder v2; import "./GPv2VaultRelayer.sol"; import "./interfaces/GPv2Authentication.sol"; import "./interfaces/IERC20.sol"; import "./interfaces/IVault.sol"; import "./libraries/GPv2Interaction.sol"; import "./libraries/GPv2Order.sol"; imp...
Performs a swap with a single Pool. If the swap is 'given in' (the number of tokens to send to the Pool is known), it returns the amount of tokens taken from the Pool, which must be greater than or equal to `limit`. If the swap is 'given out' (the number of tokens to take from the Pool is known), it returns the amount ...
function swap( SingleSwap memory singleSwap, FundManagement memory funds, uint256 limit, uint256 deadline ) external payable returns (uint256); struct SingleSwap { bytes32 poolId; SwapKind kind; IERC20 assetIn; IERC20 assetOut; uint256...
5,512,691
/** *Submitted for verification at Etherscan.io on 2020-08-22 */ pragma solidity >=0.5.0; // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) library SafeMath { function add(uint x, uint y) internal pure returns (uint z) { require((z = x + y) >= x, 'd...
External function call This function will decreases user's productivity by value, and updates the global productivity it will record which block this is happenning and accumulates the area of (productivity time)
function decreaseProductivity(address user, uint value) external requireImpl returns (bool) { Productivity storage product = users[user]; require(value > 0 && product.total >= value, 'INSUFFICIENT_PRODUCTIVITY'); _updateProductivity(product, value, false); emit Productivity...
1,089,430
./full_match/80001/0x64Aa500f7aa45b20DfA59F41A50baDfd92316c08/sources/contracts/Contract.sol
The assembly code is more direct than the Solidity version using `abi.decode`.
function _msgSender() public view virtual override(MarketplaceV3) returns (address sender) { if (isTrustedForwarder(msg.sender)) { assembly { sender := shr(96, calldataload(sub(calldatasize(), 20))) } return msg....
854,379
pragma solidity ^0.4.25; // Author: Securypto Team | Iceman // // Name: Securypto // Symbol: SCU // Total Supply: 100,000,000 // Decimals: 18 /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two numbers, revert...
Gets the balance of the specified address. _owner The address to query the the balance of. return An uint256 representing the amount owned by the passed address./
function balanceOf(address _owner) public view returns (uint256) { return balances_[_owner]; }
902,059
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openze...
This issues initial rewards to V1 dice holders. It will reward holders from token _start (inclusive) to token _end (exclusive) Iterate through all V1 dice. If we hit the end, mark the airdrop completed.
function performAirdrop(uint256 _start, uint256 _end) external onlyOwner { require(!airdropped, "Yolo Chips: Airdrop already done"); require(_start == airdropOffset, "Yolo Chips: Incorrect airdrop start index"); uint max = Math.min(_end, diceV1.totalSupply()); for (uint256 tokenId =...
10,469,653
./full_match/80001/0xE2224F44829020EA89939b278DE7bee1f4B9C9AC/sources/project_/contracts/core/BufferRouter.sol
Silently fail if the signature doesn't match
function closeAnytime(QueuedCloseTradeParams[] calldata optionData) external for (uint32 i = 0; i < arrayLength; i++) { QueuedCloseTradeParams memory params = optionData[i]; TradeToClose storage tradeToClose = tradesToClose[params.closeId]; IBufferBinaryOptions o...
9,440,773
pragma solidity ^0.4.23; // produced by the Solididy File Flattener (c) David Appleton 2018 // contact : dave@akomba.com // released under Apache 2.0 licence contract Token { /* This is a slight change to the ERC20 base standard. function totalSupply() constant returns (uint256 supply); is replaced with: ...
same as above. Replace this line with the following if you want to protect against wrapping uints.require(balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(balances[_from] >= _value && allowed[_from][msg.sender] >= _value); balances[_to] += _value; balances[_from] -= _value; allowed[_from][msg.sender] -= _value; emit Transfe...
1,494,031
./partial_match/42220/0x553a2a1B70725C1042A0D76e16f4f5a683648dEB/sources/src/shared/message/MessageLib.sol
Decode a message from a bytes representation, checking the header and erroring if any bytes are left over. encoded The encoded message as a bytearray. return decoded The decoded message. @custom:reverts as expectHeader() @custom:reverts as decodeBody() @custom:reverts Overrun() If the encoded message is too sh...
function decode(bytes memory encoded) internal pure returns (Message memory decoded) { if (encoded.length < MINIMUM_ENCODED_LEN) revert Overrun(); expectHeader(MESSAGE_TYPE, encoded); uint256 consumed; (decoded, consumed) = decodeBody(encoded); if (consumed != encoded.length)...
3,498,048
./full_match/43113/0x805cF5EBB61a572c82340631f906f81d8D500a1E/sources/liquidityPool/LiquidityPool.sol
Shows the total of poolToken in the liquidity pool. return The total of poolToken in the liquidity pool.
function poolTokenBalance() public view returns(uint256) { return poolToken.balanceOf(address(this)); }
7,115,963
// Sources flattened with hardhat v2.8.0 https://hardhat.org // File @openzeppelin/contracts/token/ERC20/[email protected] // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interfac...
Interface of the ERC20 standard as defined in the EIP./
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint2...
13,573
./full_match/80001/0xB4cb47bc9C7c7E49d742EB032D8BafD377Be1f31/sources/contracts/Vault.sol
Set total balance in VaultCurrency in all underlying protocols
function setTotalUnderlying() public { uint totalUnderlying; uint256 latestID = controller.latestProtocolId(vaultNumber); for (uint i = 0; i < latestID; i++) { if (currentAllocations[i] == 0) continue; totalUnderlying += balanceUnderlying(i); } savedTotalUnderlying = totalUnderlying; ...
5,563,968
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721EnumerableLemon.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import ...
check if address minted presale/
function checkAddressOnPresaleMerkleWalletList(address wallet) public view returns (bool) { return presaleMerkleWalletList[wallet]; }
624,657
./full_match/5/0x3870Ca65Ef4204c89cD88eAdD631b092a32C405F/sources/src/minter/BurnCrosschainMinter.sol
calculates discount for relics burned target target for contract to calculate discount burnQuantity number of relics to burn
function calculateDiscountedPrice( address target, uint256 burnQuantity ) internal view returns (uint256) { require(burnQuantity < 89, "CRE8ORS: max burn 88"); uint256 price = IERC721Drop(target).saleDetails().publicSalePrice; uint256 discountPerRelic = (price / 88); ...
7,053,964
pragma solidity 0.4.19; /** * @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) { return 0; } uint25...
Returns 1.00% of the given price. Be sure to multiply before dividing to avoid decimals./
function getBonusFee(uint price) private pure returns (uint) { return price.mul(BONUS_NUMERATOR).div(BONUS_DENOMINATOR); }
1,306,716
pragma solidity 0.6.12; import "@pancakeswap/pancake-swap-lib/contracts/math/SafeMath.sol"; import "@pancakeswap/pancake-swap-lib/contracts/token/BEP20/IBEP20.sol"; import "@pancakeswap/pancake-swap-lib/contracts/token/BEP20/SafeBEP20.sol"; import "@pancakeswap/pancake-swap-lib/contracts/access/Ownable.sol"; // impor...
Stake BSCPAD tokens to PadStaking
function enterStaking(uint256 _amount) public { PoolInfo storage pool = poolInfo[0]; UserInfo storage user = userInfo[0][msg.sender]; updatePool(); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accBSCPADPerShare).div(1e12).sub( ...
12,704,366
pragma solidity 0.6.6; pragma experimental ABIEncoderV2; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol(...
SPDX-License-Identifier: agpl-3.0
interface IFlashLoanReceiver { function executeOperation( address[] calldata assets, uint256[] calldata amounts, uint256[] calldata premiums, address initiator, bytes calldata params ) external returns (bool); }
13,752,354
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {SafeMath} from '@openzeppelin/contracts/contracts/math/SafeMath.sol'; import '@openzeppelin/contracts/contracts/access/Ownable.sol'; import './UniswapOracle.sol'; import '../../lib/Babylonian.sol'; import '../../lib/FixedPoint.sol'; import '../../lib/Un...
Change the params as per new oracle.
function setUniswapOracle(address newOracle) public onlyOwner { require(newOracle != address(0), 'Tracker: invalid orcale'); require(address(uniswapOracle) != newOracle, 'Tracker: same oracle'); address oldOracle = address(uniswapOracle); uniswapOracle = UniswapOracle(newOracle); ...
5,540,018
pragma solidity ^0.4.18; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a / b; return c; ...
CONTRACT CONSTRUCTOR
function Map(address _bookerAddress) { bookerAddress = _bookerAddress; currentRound = 1; rounds[currentRound] = Round(Jackpot(address(0), 0), Jackpot(address(0), 0), Jackpot(address(0), 0), Jackpot(address(0), 0), Jackpot(address(0), 0), Jackpot(address(0), 0), 0, 0); rounds[currentR...
10,272,077
./partial_match/1/0x882dA60A19c67E481481BACE4c0aa93080CDe3D7/sources/MintedEthCappedCrowdsale.sol
Preallocate tokens for the early investors. Preallocated tokens have been sold before the actual crowdsale opens. This function mints the tokens and moves the crowdsale needle. Investor count is not handled; it is assumed this goes for multiple investors and the token distribution happens outside the smart contract flo...
function preallocate(address receiver, uint fullTokens, uint weiPrice) public onlyOwner { uint tokenAmount = fullTokens * 10**uint(token.decimals()); weiRaised = safeAdd(weiRaised,weiAmount); tokensSold = safeAdd(tokensSold,tokenAmount); investedAmountOf[receiver] = safeAdd(investedAmountOf[receive...
2,660,478
./partial_match/3/0xFc9c50345ab2be39a83E65CfB248967C0De470FF/sources/Crowdsale.sol
assert(b > 0); Solidity automatically throws when dividing by 0 assert(a == b c + a % b); There is no case in which this doesn't hold
function div(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a / b; return c; }
5,203,280
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...
Calculates the amount that has already vested but hasn't been released yet. _beneficiary Account which gets vested tokens/
function releasableAmount(address _beneficiary) public view returns (uint256) { return vestedAmount(_beneficiary).sub(released[_beneficiary]); }
7,222,041
pragma solidity ^0.4.18; contract Hurify { /* Public variables of the token */ string public name = "Hurify Token"; // Token Name string public symbol = "HUR"; // Token symbol uint public decimals = 18; // Token Decimal Point address public owner...
Default assumes totalSupply can't be over max (2^256 - 1).If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check requireit doesn't wrap.Replace the if with this one instead.
function transfer(address _to, uint256 _value) public returns (bool success) { require(!hault); require(balances[msg.sender] >= _value); balances[msg.sender] = safeSub(balances[msg.sender],_value); balances[_to] = safeAdd(balances[_to], _value); Transfer(msg.sender, _to, _value); return true; }
906,306
./full_match/80001/0x2f82d9A7460Ecc71B7919455C4176499A50e38fA/sources/project_/contracts/Product020802V01.sol
Product020802Lib.checkEndorsePolicyBusinessRules(endorsementParams, allPolicies[endorsementParams.onChainPolicyId].operationType ); if (endorsementParams.requestedCoverageStartDate != 0) { uint256 coverageStartDate = endorsementParams.requestedCoverageStartDate.computeCoverageStartDate( allPolicies[endorsem...
function endorsePolicy( Product020802Lib.EndorsementParams memory endorsementParams, bool updateSelectedOptions, bool updateCoverages ) external onlyPartnerOrWakam(allPolicies[endorsementParams.onChainPolicyId].partnershipCodeHash) { require(isPolicyExists[endorsementParams.onCha...
5,616,766
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.7.6; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../interfaces/IReign.sol"; import "../libraries/LibRewardsDistribution.sol"; contract GovRewards { // lib using SafeMath for uint2...
public method to harvest all the unharvested epochs until current epoch - 1 i = epochId compute distributed Value and do one single transfer at the end
function massHarvest() external returns (uint256) { uint256 totalDistributedValue; for ( uint128 i = lastEpochIdHarvested[msg.sender] + 1; i <= epochId; i++ ) { uint256 userRewards = _harvest(i); totalDistributedValue = totalDistri...
11,959,584
./full_match/137/0xF63f063280406FB694AAA70FF07B21CCe0dE30Bc/sources/src/LensCrossmintAdapter.sol
collect target Lens Publication profileId profile id of seller pubId publication id to collect data encoded collect data quantity number of tokens to mint to recipient of tokens Wrap MATIC to WMATIC Transfer the WMATIC to the user's wallet Collect First Publication Collect {X} Publications
function collect( uint256 profileId, uint256 pubId, bytes memory data, uint256 quantity, address to ) external payable returns (uint256) { wrapMatic(); address nftAddress = ILensHub(lensHubAddress).getCollectNFT( profileId, pubId ...
3,751,256
./full_match/1/0xcE9b49b0d4FE456aD6E4a1b7e4bBdD0699400Ef9/sources/src/abstracts/BaseVaultUpgradeable.sol
@inheritdoc PausableVault
function pause(VaultActions action) external virtual override hasRole(msg.sender, PAUSER_ROLE) { _pause(action); }
2,940,081
./full_match/5/0xB4aCa98AfF38435B26464B164a3e92d68B3f480B/sources/contracts/ERC721CDrop.sol
See {ERC721-_safeTransferFrom}.
function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public virtual override(ERC721C) onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId, data); }
1,889,802
./full_match/5/0x1C84F1262d53B6359E599490D24cbD28b6640c5c/sources/contracts/TypeCoin.sol
write a function to send the winning amount to the winner stored in this smart contract; _winnerAddress.transfer(winningAmount);
function sendEthToWinner() public returns (bool) { require(callSuccess, "Call failed"); return callSuccess; }
1,929,979
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library Memory { // Size of a word, in bytes. uint256 internal constant WORD_SIZE = 32; // Size of the header of a 'bytes' array. uint256 internal constant BYTES_HEADER_SIZE = 32; // Address of the free memory pointer. uint256 internal co...
Copy 'len' bytes from memory address 'src', to address 'dest'. This function does not check the or destination, it only copies the bytes. Copy word-length chunks while possible Reverse copy to prevent out of memory bound error
function copy( uint256 src, uint256 dest, uint256 len ) internal pure { src = src + len; dest = dest + len; for (; len >= WORD_SIZE; len -= WORD_SIZE) { dest -= WORD_SIZE; src -= WORD_SIZE; assembly { mstore(des...
12,744,205
./full_match/1/0xB7C1C63d84700C0FD57657B1137ae03bA8381A88/sources/contracts/forwarder/Forwarder.sol
@inheritdoc IForwarder/
function flushTokens(address tokenContractAddress) external virtual override nonReentrant { IERC20 instance = IERC20(tokenContractAddress); address forwarderAddress = address(this); uint256 forwarderBalance = instance.balanceOf(forwarderAddress); if (forwarderBala...
2,928,244
// File: contracts\lib\TransferHelper.sol // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.6; // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove(address token, address to, uint value) intern...
Modify configuration config Configuration object Get configuration return Configuration object Set DAO application addr DAO application contract address flag Authorization flag, 1 means authorization, 0 means cancel authorization Check DAO application flag addr DAO application contract address return Authorizati...
interface INToken { event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); function increaseTotal(uint256 value) external; function checkBlockInfo() external view returns(uint256 createBlock, uint...
52,618
// File: contracts/StringBuffer.sol //SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @notice Holds a string that can expand dynamically. */ struct StringBuffer { string[] buffer; uint numberOfStrings; uint totalStringLength; } library StringBufferLibrary { /** * @dev Copies 32 byte...
Adds someone to the whitelist./
function addToWhitelist(address[] memory addrs) external onlyAdmin { for (uint i = 0; i < addrs.length; ++i) { if (whitelist[addrs[i]] == 0) { whitelist[addrs[i]] = WHITELIST_PER + 1000; } } }
5,812,199
pragma solidity ^0.4.18; /** * @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) { return 0; } uint...
Internal function to clear current approval of a given token ID _tokenId uint256 ID of the token to be transferred/
function clearApproval(address _owner, uint256 _tokenId) private { require(ownerOf(_tokenId) == _owner); tokenApprovals[_tokenId] = 0; Approval(_owner, 0, _tokenId); }
50,077
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import {Modifiers, ListingListItem} from "../libraries/LibAppStorage.sol"; import {LibERC1155Marketplace, ERC1155Listing} from "../libraries/LibERC1155Marketplace.sol"; import {IERC20} from "../../shared/interfaces/IERC20.sol"; import {LibERC20} from "../../shared...
Allow the snowdrops diamond owner or DAO to set the category details for multiple ERC1155 NFTs _categories An array of structs where each struct contains details about each ERC1155 item //erc1155TokenAddress,erc1155TypeId and category
function setERC1155Categories(Category[] calldata _categories) external onlyItemManager { for (uint256 i; i < _categories.length; i++) { s.erc1155Categories[_categories[i].erc1155TokenAddress][_categories[i].erc1155TypeId] = _categories[i].category; } }
1,030,916
// File contracts/general/Ownable.sol pragma solidity ^0.6.6; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". * * @dev We've added a second owner to share control of the timeloc...
Unwrap wNxm tokens to be able to be used within the Nexus Mutual system. _amount Amount of wNxm tokens to be unwrapped./
function _unwrapWnxm(uint256 _amount) internal { IWNXM(address(wNxm)).unwrap(_amount); }
6,135,508
./full_match/1/0x403853493426fb50D48CfBDb0f29d38D751552F5/sources/contracts/FapFapFap.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("FAPFAPFAP", "FAPFAPFAP") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair ...
8,322,910
pragma solidity ^0.4.23; /** * @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) { return ...
Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend)./
function sub(uint256 a, uint256 b) internal pure returns(uint256) { assert(b <= a); return a - b; }
332,662
/** *Submitted for verification at Etherscan.io on 2021-06-10 */ // Website: https://goatgangster.com/ // Telegram: https://t.me/GoatGangterXXX // SPDX-License-Identifier: MIT // File: @uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol pragma solidity >=0.5.0; interface IUniswapV2Factory { event Pair...
Update the burn rate. Can only be called by the current operator./
function updateBurnRate(uint16 _burnRate) public onlyOperator { require(_burnRate <= 100, "updateBurnRate: Burn rate must not exceed the maximum rate."); emit BurnRateUpdated(msg.sender, burnRate, _burnRate); burnRate = _burnRate; }
2,078,289
pragma solidity ^0.6.0; import "../governance/Operator.sol"; import "../interface/IUserRegistry.sol"; /** * @title UserRegistry * @dev UserRegistry contract * Configure and manage users_ * Extended may be used externaly to store data within a user context * * @author Cyril Lapinte - <cyril.lapinte@gmail.com> ...
the userId associated to the provided address if the user is valid/
function validUserId(address _address) override public view returns (uint256) { uint256 addressUserId = walletOwners_[_address]; if (_isValidInternal(users_[addressUserId])) { return addressUserId; } return 0; }
12,676,350
//Address: 0x3934d88d7d049599e316d060c10a460ce4838508 //Contract name: forwardEth //Balance: 0 Ether //Verification Date: 6/21/2018 //Transacion Count: 4 // CODE STARTS HERE pragma solidity ^0.4.24; contract forwardEth { address public owner; address public destination; constructor() public { ...
1. transfer ownership
function setNewOwner(address _newOwner) public ownerOnly { owner = _newOwner; }
978,668
pragma solidity ^0.5.0; import "./interfaces/PhoenixInterface.sol"; import "./interfaces/PhoenixIdentityInterface.sol"; import "./zeppelin/ownership/Ownable.sol"; contract PhoenixIdentityResolver is Ownable { string public phoenixIdentityName; string public phoenixIdentityDescription; address public pho...
if callOnAddition is true, onAddition is called every time a user adds the contract as a resolver this implementation must use the senderIsPhoenixIdentity modifier returning false will disallow users from adding the contract as a resolver if callOnRemoval is true, onRemoval is called every time a user removes the contr...
function onAddition(uint ein, uint allowance, bytes memory extraData) public returns (bool); function onRemoval(uint ein, bytes memory extraData) public returns (bool); function transferPhoenixBalanceTo(uint einTo, uint amount) internal { PhoenixInterface phoenix = PhoenixInterface(PhoenixIdentity...
1,051,576
./partial_match/25/0xF771Abe345430f5831Bb5AF553C80A0483eFC039/sources/Grnstxg2.sol
Give a random NFT to a contest winner Checks Mint random NFTs for a winner
function randomGiveaway(address _winner, uint256 _amount) external onlyOwner { require(_winner != address(0), "Grnstxg2: zero address"); require(_amount > 0, "Grnstxg2: you have to mint at least one"); require(lastSupply != 0, "Grnstxg2: the collection is sold out"); ...
3,504,551
//Address: 0xcba65975b1c66586bfe7910f32377e0ee55f783e //Contract name: LavaWallet //Balance: 0 Ether //Verification Date: 6/11/2018 //Transacion Count: 46 // CODE STARTS HERE pragma solidity ^0.4.18; /* This is a token wallet contract Store your tokens in this contract to give them super powers Tokens can be ...
Requires approval so it can be public
function withdrawTokensFrom( address from, address to,address token, uint tokens) public returns (bool success) { balances[token][from] = balances[token][from].sub(tokens); depositedTokens[token] = depositedTokens[token].sub(tokens); allowed[token][from][to] = allowed[token][from][to].sub(tokens); ...
1,818,523
./full_match/1/0x96AdA1cd013b5A28548A5F8B8698f029A8DA30a2/sources/ShibWalletStaking.sol
Deposit LP tokens for reward allocation.
function deposit(uint256 _pid, uint256 _amount, address _to) public { require(_to != address(0), "ShibWalletStaking: Invalid receiver address"); require(_amount > 0, "ShibWalletStaking: Invalid deposit amount"); updatePool(_pid); PoolInfo storage pool = poolInfo[_pid]; User...
8,367,971
/** *Submitted for verification at Etherscan.io on 2020-10-11 */ /* B.PROTOCOL TERMS OF USE ======================= THE TERMS OF USE CONTAINED HEREIN (THESE 1TERMS1) GOVERN YOUR USE OF B.PROTOCOL, WHICH IS A DECENTRALIZED PROTOCOL ON THE ETHEREUM BLOCKCHAIN (the 1PROTOCOL1) THAT enables a backstop liquidity mechanis...
Receives ETH amount, converts it to WETH and joins it into the vat Locks WETH amount into the CDP
function lockETH( address manager, address ethJoin, uint cdp ) public payable { ethJoin_join(ethJoin, address(this)); VatLike(ManagerLike(manager).vat()).frob( ManagerLike(manager).ilks(cdp), ManagerLike(manager).urns(cdp), address(this...
982,529
pragma solidity ^0.4.16; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; } contract TokenERC20 { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; uint256 public...
AnimatedProject: Send Bonus To Contract
function owner_bonusSend () public payable { if (msg.sender == owner && bonusNum < 30){ bonusPool += msg.value; bonusNum ++; bonusPer[bonusNum] = msg.value/totalSupply; } }
12,581,611
pragma solidity ^0.4.23; // ---------------------------------------------------------------------------- // // VAR 'Varyon' token public sale contract // // For details, please visit: http://www.blue-frontiers.com // // ---------------------------------------------------------------------------- // -----------------...
return eth (no balances are modified)
function pReclaimEth(address _account) private { require(!thresholdReached() && atNow() > dateIcoDeadline, "too early"); require(ethPending[_account] > 0 || ethContributed[_account] > 0, "nothing to return"); require(!refundClaimed[_account], "refund already claimed"); uint eth_to_r...
6,363,047
pragma solidity ^0.5.0; import "../FixidityLib.sol"; /** * @dev */ contract FixidityLibMock { /** * @dev Number of positions that the comma is shifted to the right. */ function digits() public pure returns(uint8) { return FixidityLib.digits(); } /** * @dev This is 1 in...
Maximum value that can be converted to fixed point. Optimize for deployment. -(maxInt256()-1) / fixed1() Hardcoded to 24 digits./
function minNewFixed() public pure returns(int256) { return FixidityLib.minNewFixed(); }
1,787,900
/** *Submitted for verification at Etherscan.io on 2021-06-10 */ pragma solidity ^0.5.17; // Brought from https://github.com/aragon/aragonOS/blob/v4.3.0/contracts/lib/math/SafeMath.sol // Adapted to use pragma ^0.5.17 and satisfy our linter rules /** * @title SafeMath * @dev Math operations with safety checks tha...
Internal function to claim guardian share for a certain period _period Period being claimed _periodId Identification number of the period being claimed _guardian Address of the guardian claiming their share _token Address of the token being claimed _amount Amount of tokens to be transferred to the guardian/
function _claimGuardianShare( Period storage _period, uint256 _periodId, address payable _guardian, address _token, uint256 _amount ) internal { _period.claimedGuardians[_guardian][_token] = true; if (_amount > 0) { _transfer(_guard...
10,904,334
./partial_match/1/0x1bDC2A3711f8F8EFCD038718b5e85Bc19E23bB97/sources/AVENGERS.sol
Returns true if the contract is paused, and false otherwise./
function paused() public view virtual returns (bool) { return _paused; }
2,604,412
pragma solidity ^0.4.21; /** * @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 balanceOf(address who) public view returns (uint256); function transfer(add...
Creates the blacklist of tokens that are not able to be taken out of the contract; can only be done at the deployment, and the logic to add to the blacklist will be in the constructor of a child contract _token the token contract address that is to be blacklisted
function blacklistEscapeToken(address _token) internal { escapeBlacklist[_token] = true; EscapeHatchBlackistedToken(_token); }
583,088
./full_match/5/0x19A4010E859ca3d10F0d928C6665F9a9E3BE4B22/sources/contracts/interfaces/types/PrePosition.sol
Computes the fee incurred for opening or closing the pending-settlement position Must be called from a valid product to get the proper fee amounts self The struct to operate on latestOracleVersion The oracle version at which position was modified return The maker / taker fee incurred/
function computeFee( PrePosition memory self, IOracleProvider.OracleVersion memory latestOracleVersion ) internal view returns (Position memory) { Position memory positionDelta = self.openPosition.add(self.closePosition); (UFixed18 makerNotional, UFixed18 takerNotional) = ( ...
1,912,747
./full_match/42161/0x00B7F6b5d9C982e0A78BD18100856092C7d54c4e/sources/tenderly/project/contracts/Raffle.sol
@inheritdoc IRaffle/
function getPrizes(uint256 raffleId) external view returns (Prize[] memory prizes) { prizes = raffles[raffleId].prizes; }
16,303,068
// SPDX-License-Identifier: MIT pragma solidity ^0.5.17; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(addr...
Withdraw partial funds, normally used with a vault withdrawal
function withdraw(uint _amount) external { require(msg.sender == controller, "!controller"); uint _balance = IERC20(want).balanceOf(address(this)); if (_balance < _amount) { _amount = _withdrawSome(_amount.sub(_balance)); _amount = _amount.add(_balance); } ...
15,000,355
./full_match/4/0xBc9975EbC34617b5B82Cf7Aa9D5b199C2120cD85/sources/contracts/5_JokerCharlie.sol
Turn presale to be publi or private
function togglePresalePublic() external onlyOwner { isPresalePublic = !isPresalePublic; }
661,458
pragma solidity ^0.4.8; contract tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData); } contract EtherFuture { string public standard = 'EtherFuture 0.1'; string public name; string public symbol; uint8 public decimals; uint256 public totalSu...
This creates an array with all balances / This generates a public event on the blockchain that will notify clients / This notifies clients about the amount burnt / Initializes contract with initial supply tokens to the creator of the contract /
function EtherFuture() { }
85,128
./partial_match/1/0x6dbE10BFC331CB8b7b1c17ce252a6f178D74E912/sources/contracts/arbitrage/BancorArbitrage.sol
returns the min bnt burn amount/
function minBurn() external view returns (uint256) { return _minBurn; }
15,916,197
/* SPDX-License-Identifier: MIT @**********@ @*********** @*********** @*********** #***@ @***( *********** @**********# @*********** @*********** @*******@ .*********** @***@@@@***@ @***@@@@@@@@ @***@@@@@@@@ @***@@@@@@@@ #***@ @***( ****@@@@@@@ @@@@****@@@@ @***@@@@*...
Only allowed for tokens with id <= SINGLE_EDITIONS_SUPPLY Get the last price a token was minted or captured tokenId id of the token to check/
function lastPrice(uint256 tokenId) external view returns (uint256) { require( tokenId <= SINGLE_EDITIONS_SUPPLY, "Cannot get the last price of a token with id greater than SINGLE_EDITIONS_SUPPLY" ); if (!exists(tokenId)) { return 0; } ret...
5,708,720
./partial_match/1/0x865590f3bba350A1b0e55d6275E98B5924DDEE88/sources/PadEvolved.sol
If an inheriting token contract is deployed to a network without the registry deployed, the modifier will not revert, but the contract will need to be registered with the registry once it is deployed in order for the modifier to filter addresses.
function __initialize_OperatorFilterer(address subscriptionOrRegistrantToCopy, bool subscribe) internal { if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { if (subscribe) { OPERATOR_FILTER_REGISTRY.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy); ...
2,892,602
./partial_match/42/0x15ea71C14c8BFba3F1E3F87172b01674671586e0/sources/contracts/DeflectPool.sol
Returns the current reward tokens that the user can claim. Each user has it's own effective balance which is just the staked balance multiplied by boost level multiplier.
function earned(address account) public view returns (uint256) { uint256 effectiveBalance = _balances[account].add(_balancesAccounting[account]); return effectiveBalance.mul(rewardPerToken().sub(userRewardPerTokenPaid[account])).div(1e18).add(rewards[account]); }
3,422,197
// This code has not been professionally audited, therefore I cannot make any promises about // safety or correctness. Use at own risk. pragma solidity ^0.4.22; contract Randomness { bytes32 sealedSeed; bool seedSet = false; bool betsClosed = false; uint storedBlockNumber; address trustedParty = ...
Insert logic for usage of random number here;
function reveal(bytes32 _seed) public { require(seedSet); require(betsClosed); require(storedBlockNumber < block.number); require(keccak256(msg.sender, _seed) == sealedSeed); uint random = uint(keccak256(_seed, blockhash(storedBlockNumber))); seedSet = false; ...
5,352,940
./partial_match/1/0x35818D0Bc6328B0a7a259B3AfA2a73958608D3eC/sources/Token.sol
set buy fees marketing - set marketing fees ref - set reflection feesRequirements -- total buy fees must be less than equal to 5 percent.
function setBuyFee( uint16 marketing, uint16 ref) external onlyOwner { buyFee.marketingFee = marketing; buyFee.reflectionFee = ref; uint256 totalBuyFee = marketing + ref ; require(totalBuyFee <= 5, "max buy fees limit is 5%"); }
4,023,277
./partial_match/1/0xf2BFA8f74f6B5F8ea92C92d03021BfC1bA806267/sources/MoverCEOCapNFT.sol
See {IERC721Metadata-tokenURI}./
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 : ''; } address indexed token...
3,899,740
./full_match/5/0xC0a3857192072CFe5f2A64b741eF8c855fCCcAa0/sources/fruitCoinRewarder.sol
OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) This is the interface that {BeaconProxy} expects of its beacon./
interface IBeaconUpgradeable { function implementation() external view returns (address); } }
1,899,803
./partial_match/1/0x8002Aa3A2065cdc24c72FE518a0aEd5c9f8FA9D9/sources/ShareTokenSaleData.sol
Implementations 1. Add transfer history 2. Update transfer balance 3. Update share holder balance/Update shareholder balanceSave new shareholder if not existed
function updateShareholderTransferData(address from, address to, uint amount, uint round) external override onlyTokenSaleContract canTransfer returns(bool){ require(round == 0 || round == 1, "ShareTokenSaleData.addTransferHistoryAndBalance: Round is invalid"); _decreaseShareholderBalance(from, amou...
4,138,304
pragma solidity 0.4.24; pragma experimental "v0.5.0"; interface RTCoinInterface { /** Functions - ERC20 */ function transfer(address _recipient, uint256 _amount) external returns (bool); function transferFrom(address _owner, address _recipient, uint256 _amount) external returns (bool); ...
/ don't allow us to transfer RTC tokens stored in this contract
function transferForeignToken( address _tokenAddress, address _recipient, uint256 _amount) public onlyAdmin returns (bool) { require(_recipient != address(0), "recipient address can't be empty"); require(_tokenAddress != TOKENADDRESS, "token can't ...
12,769,956
/** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { uint constant public MAX_UINT256 = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) ...
self-destruct function for this contract
function killCoin() public onlyOwner { selfdestruct(owner); }
12,171,852
./full_match/137/0x16D66b01664bc834f5db13D01E51E1Fa7C44f03B/sources/browser/NFT721.sol
See {IERC721-isApprovedForAll}./
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; }
4,782,000
pragma solidity 0.4.25; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; /** * @dev This contract manages the puzzles generation and hashes comparing */ contract PuzzleManager is Ownable { // Represents a generated puzzle. struct Puzzle { // The unique identifier for this ...
Returns the original metrics associated to a given puzzle id puzzleId The ID of a specific puzzle return The original metrics of the specific puzzle/
function getPuzzleOriginalMetrics(uint256 puzzleId) external view returns (string) { return puzzles[puzzleId].originalMetrics; }
1,812,230
pragma solidity ^0.4.23; import "./PensionLib.sol"; contract PensionSettings { function getPensionFactor(PensionLib.PensionType _pensionType) public pure returns (uint256) { //scaled to 100% return 100; } //TODO: rename to "getPensionPointValue" function getPensionAmount(uint16 _year) public view ret...
18,6 % scaled to 100%
function getPensionSalaryPercentage(uint16 _year) public pure returns (uint256) { return 1860; }
12,912,688
./full_match/1/0xf3dE1fC01a02f4CDC3518A758fdDd55Ae069a8a0/sources/contracts/StabilizerV3.sol
Claim CRV and CVX. Claim FXS.
function claimRewards() external onlyOwner { apeUSDConvexStakingWrapperFrax.getReward(address(this)); apeUSDFraxStaking.getReward(address(this)); }
8,442,104
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol pragma solidity ^0.5.2; /** * @title ERC20 interface * @dev see https://eips.ethereum.org/EIPS/eip-20 */ interface IERC20 { function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value)...
return entire rlp item byte length
function _itemLength(uint memPtr) private pure returns (uint) { uint itemLen; uint byte0; assembly { byte0 := byte(0, mload(memPtr)) } if (byte0 < STRING_SHORT_START) itemLen = 1; else if (byte0 < STRING_LONG_START) itemLe...
610,692
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.6.12; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Pausable.sol"; /// @title A contract that submites poofs/documents to the blockchain /// @author Lucia Daly /// @notice You can use ...
Add proof to the blockchain
function submitProof( string memory _ipfs, string memory _title, string memory _summary, string memory _tags ) public { proofTimeStamp = block.timestamp; proofs[proofCounter] = Proof( msg.sender, proofCounter, proofTimeStamp, ...
15,855,254
./partial_match/1/0x45eDb535942a8C84D9f4b5D37e1b25F91Ea4804c/sources/RAOToken.sol
Set Finish Minting.
function finishMinting() public onlyOwner isActive { mintingFinished = true; MintFinished(); }
4,424,873
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; // Tipo Producto struct Producto { string nombre; uint precio; // Precio en Wei uint cantidad; // Cantidad de items en stock bool promocion; // Si el producto tiene promoción, se le restan 1000 Wei bool existe; // Variable de control para veri...
Función para destruir el contrato y enviar los fondos al creador, solo puede ser llamada por el creador debe ser llamada al menos 'maxIntentos' veces para que tenga efecto/
function destruirContrato() external soloCreador returns (string memory){ intentos++; if(intentos == maxIntentos){ return "Contrato destruido"; return "Si sigue intentando eventualmente el contrato se autodestruira"; } }
910,601
pragma solidity ^0.4.18; /* ==================================================================== */ /* Copyright (c) 2018 The Priate Conquest Project. All rights reserved. /* /* https://www.pirateconquest.com One of the world&#39;s slg games of blockchain /* /* authors rainy@livestar.com/Jonny.Fu@livestar.com /* ...
Get the approved address for a single kitty _tokenId The WAR to find the approved address for return The approved address for this WAR, or the zero address if there is none
function getApproved(uint256 _tokenId) external view isValidToken(_tokenId) returns (address) { return kittyTokenIdToApprovals[_tokenId]; }
2,460,691
./full_match/40/0x10b455000f60fbfA2041Ee2EB4e2D2594386D640/sources/contracts/ZappyAvaxTlos.sol
Converts to both sides of the LP token and builds the LP
function addLiquidity() internal { uint256 wrappedHalf = IERC20(wrapped).balanceOf(address(this)) / 2; IUniSwapRouter(router).swapExactTokensForTokens(wrappedHalf, 0, wrappedToLp1Path, address(this), block.timestamp); uint256 lp0Bal = IERC20(avax).balanceOf(address(this)); uint256 ...
9,549,085
./full_match/1/0x82E0E0E70972877Ee70F11454c4808AdB49Bb405/sources/contracts/PeachDropERC721.sol
Marks tokenIDs as redeemed _tokenIds Array of tokenIds to mark redeemed Requirements: - `owner` must be function caller - `tokenId` must exist - 'tokenId` must not already be redeemed - minting/redemption window must still be open/
function batchRedeem(uint256[] memory _tokenIds) public onlyOwner { require(deactivationTimestamp > block.timestamp, "Redemption has ended"); for (uint i = 0; i < _tokenIds.length; i++) { if (_exists(_tokenIds[i])) { redeems[_tokenIds[i]] = true; } } ...
16,528,315
pragma solidity ^0.4.21; /** * Math operations with safety checks */ 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 returns (uint) { // assert(b > 0); // Solidity...
update order revert anything update order revert anything
function sellNac(uint _value, address _buyer, uint _price) public returns (bool success) { require(_price == bid[_buyer].price && _buyer != msg.sender); NamiCrowdSale namiToken = NamiCrowdSale(NamiAddr); uint ethOfBuyer = bid[_buyer].eth; uint maxToken = ethOfBuyer.mul(bid[_buyer].pr...
7,913,963
./full_match/8453/0xaDC80234af7D4a92323Bf6AfbE45B001232A65d2/sources/src/base/enki/Enki.sol
Revoke permissions Remove policy from all policy data structures Remove policy from module dependents Set policy status to inactive
function _deactivatePolicy(Policy policy_) internal { if (!policy_.isActive()) revert Enki_PolicyNotApproved(address(policy_)); Permissions[] memory requests = policy_.requestPermissions(); _setPolicyPermissions(policy_, requests, false); uint256 idx = getPolicyIndex[policy_]; ...
11,546,008
// SPDX-License-Identifier: MIT // Contract based on https://docs.openzeppelin.com/contracts/3.x/erc721 pragma solidity ^0.8.4; import "@openzeppelin/contracts/interfaces/IERC20.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts...
============ PUBLIC FUNCTIONS FOR REFERRAL ============
function register(string memory name) public { require(refNameRegistered[name] == false, "This name already exists"); bytes memory tempName = bytes(name); bytes memory tempRefName = bytes(refName[msg.sender]); bool containSpace = isContainSpace(name); require( tem...
12,096,334
pragma solidity ^0.4.18; /** * @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 OwnershipTransferred(address indexed previousOw...
update wallet address
function updateWalletAddress(address _newWallet) onlyOwner { require(_newWallet != address(0)); wallet = _newWallet; WalletAddressUpdated(true); }
2,260,443
./partial_match/1/0x9eE0d74242F586ea7781F06619A3a8eE30d11709/sources/GoaldProxy.sol
This is overridden so we can update the reward balancees prior to the transfer completing. / Update the reward balances prior to the transfer for both sender and receiver. Preserve the original balances so we know if we need to change `_rewardHolders`. See if we need to change `_rewardHolders`. The sender has no balanc...
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _checkRewardBalance(sender); _checkRewardBalance(recipient); uint256 senderBefore = balanceOf(sender); uint256 recipientBefore = balanceOf(recipient); super.transferFro...
10,997,508
// SPDX-License-Identifier: GPL-3.0-or-later // 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 dis...
Rebalances funds between pool and asset manager to maintain target investment percentage./ Pool is under-invested so add more funds Pool is over-invested so remove some funds
function _rebalance( bytes32 /*pId*/ ) internal { uint256 aum = _getAUM(); (uint256 poolCash, uint256 poolManaged) = _getPoolBalances(aum); InvestmentConfig memory config = _config; uint256 targetInvestment = FixedPoint.mulDown(poolCash + poolManaged, config.targetPercen...
2,501,066
// File: openzeppelin-solidity/contracts/GSN/Context.sol pragma solidity ^0.5.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direc...
create WETH from ETH
function wrap(uint256 ETHAmount) private { if (ETHAmount != 0) { WETH.deposit.value(ETHAmount)(); } require(WETH.balanceOf(address(this)) >= ETHAmount, "eth_not_deposited"); }
369,669
./full_match/1/0x7bfCDb1649053919D65b17e0EDd5068E535a3a66/sources/contracts/abstract/Votes.sol
Moves delegated votes from one delegate to another./
function _moveDelegateVotes(address from, address to, uint256 amount) private { if (from != to && amount > 0) { if (from != address(0)) { (uint256 oldValue, uint256 newValue) = _delegateCheckpoints[from].push(_subtract, amount); emit DelegateVotesChanged(from, old...
16,604,171
pragma solidity 0.5.16; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./Valset.sol"; import "./Oracle.sol"; import "./BridgeBank/BridgeBank.sol"; import "./CosmosBridgeStorage.sol"; contract CosmosBridge is CosmosBridgeStorage, Oracle { using SafeMath for uint256; b...
: Performs low gas-comsuption string concatenation _prefix: start of the string _suffix: end of the string/
function concat(string memory _prefix, string memory _suffix) internal pure returns (string memory) { return string(abi.encodePacked(_prefix, _suffix)); }
2,523,770
./full_match/97/0xC55f31C2f2583D3edd82eA96b742F2c1782372a5/sources/project_/contracts/CrowdSale.sol
to update bonus percentage _bonusPercentage to set the value of bonus percentage/
function updateBonusPercentage( uint256 _bonusPercentage ) external onlyOwner { bonusPercentage = _bonusPercentage; }
3,286,823
// SPDX-License-Identifier: MIT // // _ _ _ _ _ // | |__ _ _ | |_ ___ _ __ ___ ___ | | __ ___ | |_ __| | ___ __ __ // | '_ \ | | | || __|/ _ \| '__|/ _ \ / __|| |/ // _ \| __| / _` | / _ \\ \ / / // | |_) || |_| || |_| __/| | | (_) || (_...
From https:ethereum.stackexchange.com/questions/70300/how-to-convert-an-ethereum-address-to-an-ascii-string-in-solidity
function addressToString(address _address) internal pure returns (string memory) { bytes32 _bytes = bytes32(uint256(_address)); bytes memory HEX = "0123456789abcdef"; bytes memory _string = new bytes(42); _string[0] = "0"; _string[1] = "x"; ...
12,721,391
./full_match/1/0xd989212c51BA850A1787ce4c666EB44A170CC415/sources/browser/ValueLiquid-newcore/ValueLiquidFormula.sol
General Description: Determine a value of precision. Calculate an integer approximation of (_baseN / _baseD) ^ (_expN / _expD) 2 ^ precision. Return the result along with the precision used. Detailed Description: Instead of calculating "base ^ exp", we calculate "e ^ (log(base) exp)". The value of...
function power( uint256 _baseN, uint256 _baseD, uint32 _expN, uint32 _expD ) internal view returns (uint256, uint8) { require(_baseN < MAX_NUM); uint256 baseLog; uint256 base = (_baseN * FIXED_1) / _baseD; if (base < OPT_LOG_MAX_VAL) { ...
3,047,555
pragma solidity ^ 0.4.25; // ----------------------------------------------------------------------------------------------------------------- // // Recon® Token Teleportation Service v1.10 // // of BlockReconChain® // for ReconBank® // /...
assignPreicoTokens transfers 3x tokens to pre-ICO participants (99,000,000)
function assignPreicoTokens() public onlyOwnerAndDirector { require(!assignedPreico); assignedPreico = true; } bool assignedTeam = false;
918,245
./full_match/8453/0x1f281C7305deA9afEA21C306fa40b89f416767E5/sources/contracts/payment/PaymentLite.sol
Extract `amount` of `erc20` tokens from this contract and send them to `account`. account destination of rescued tokens erc20 token to transfer out amount amount of tokens to rescue/
function rescueTokens( address account, IERC20Upgradeable erc20, uint256 amount ) external onlyRole(OWNER_ROLE) { erc20.safeTransfer(account, amount); }
11,550,849
// SPDX-License-Identifier: MIT /* * @title TemperaturesContract * @author Yuichi Takata <k19064kk@aitech.ac.jp> * * @dev このコントラクトは温度の登録、参照を目的としています。 * また、DeviceArea、Timeコントラクトを継承し、 * 外部のライブラリとしてsafemath,Ownableを * 使用しています。 * */ pragma solidity ^0.8.7; import "./devicearea.sol"; import "./saf...
アドレス(EOA)から情報を取得します。 対象のアドレスを引数とします。 return 検索結果として温度構造体を返します。/
function getTemperaturesByEOA(address _userId) public view returns (TemperaturesData[] memory resData) { require(UsersDataCount[_userId] >= 1); resData = new TemperaturesData[](UsersDataCount[_userId]); uint256 dataCount = 0; for (uint256 i = 0; i < Temper...
7,293,793
pragma solidity >=0.5.0 <0.6.0; import {D} from "./data.sol"; library Utils { /// Returns a label containing the longest common prefix of `check` and `label` /// and a label consisting of the remaining part of `label`. function splitCommonPrefix(D.Label memory label, D.Label memory check) internal pure re...
Returns a label containing the longest common prefix of `check` and `label` and a label consisting of the remaining part of `label`.
function splitCommonPrefix(D.Label memory label, D.Label memory check) internal pure returns (D.Label memory prefix, D.Label memory labelSuffix) { return splitAt(label, commonPrefix(check, label)); }
892,062
// Sources flattened with hardhat v2.8.3 https://hardhat.org // File hardhat/console.sol@v2.8.3 // SPDX-License-Identifier: MIT pragma solidity >= 0.4.22 <0.9.0; library console { address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67); function _sendLogPayload(bytes memory payload...
Set a new base URI for the NFT metadata _newBaseURI String of new baseURI
function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; }
14,388,375
./partial_match/1/0xd3B5AD4979788Cf23cBE0704C2Cd2F0629e521b6/sources/LiquidityMining.sol
function used to receive batch of erc1155 tokens. /
function onERC1155BatchReceived(address, address, uint256[] memory, uint256[] memory, bytes memory) public view override returns(bytes4) { require(_liquidityFarmTokenCollection == msg.sender, "Invalid sender"); return this.onERC1155BatchReceived.selector; }
4,218,431
// SPDX-License-Identifier: GPL-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; uint...
the weighted apr of all lenders. sum(nav apr)/totalNav
function estimatedAPR() public view returns (uint256) { uint256 bal = estimatedTotalAssets(); if (bal == 0) { return 0; } uint256 weightedAPR = 0; for (uint256 i = 0; i < lenders.length; i++) { weightedAPR = weightedAPR.add(lenders[i].weightedApr());...
1,462,824
pragma solidity ^0.4.24; import "../../../node_modules/ethereum-libraries-linked-list/contracts/LinkedListLib.sol"; import "../AddressUtils.sol"; import "../TagLib.sol"; import "../Uint256Utils.sol"; import "../LinkedList/LinkedListExtensionLib.sol"; import "../LinkedList/LinkedListIteratorLib.sol"; import "./ProvLink...
address[] memory addresses = new address[](self.keys.sizeOf()); uint256 counter = 0; LinkedListIteratorLib.Iterator memory iterator = self.getIterator(); (bool hasNext, uint256 next) = iterator.getNext(self.keys); while(hasNext) { addresses[counter] = next.toAddress(); counter++; (hasNext, next) = iterator....
function toReturnValue(ProvLinkListLib.LinkList storage self) public view returns(address[]) { return self.keys.getKeysAddressArray(); }
1,030,892
//SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "./StateUtils.sol"; import "./interfaces/IGetterUtils.sol"; /// @title Contract that implements getters abstract contract GetterUtils is StateUtils, IGetterUtils { string private constant CHECKPOINT_NOT_FOUND = "API3DAO.GetterUtils: Value cannot be fou...
Called to get the current delegate of the user userAddress User address return Current delegate of the user
function getUserDelegate(address userAddress) public view override returns(address) { return getUserDelegateAt(userAddress, block.number); }
13,041,901
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; pragma experimental ABIEncoderV2; import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol'; import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; import {IRe...
Deposit LP tokens to earn HALO Rewards. Withdraw LP tokens.==========================================================view functions=========================================================utility view functions
interface IRewards { function updateAmmRewardPool(address _lpAddress) external; function updateMinterRewardPool(address _collateralAddress) external; function deposit(address _lpAddress, uint256 _amount) external; function depositMinter( address _collateralAddress, address _account, uint256 _amou...
1,559,869