file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./full_match/1/0x3EAf985beFc08B90c7574d1d3D65B3cE3Ab901d4/sources/browser/AyMaTrading.sol
Track the balance of the token RECEIVED from the trade Swap on AMM: give _fromToken, receive _toToken Read _toToken balance after swap Calculate how much of the token we received Swap on AMM: give _toToken, receive _fromToken
function _tradeAMMtoAMM(address[] calldata _pool, address _fromToken, address _toToken, uint256 _fromAmount, bytes calldata _1InchDataOne, bytes calldata _1InchDataTwo, uint256[] calldata _flag) internal { uint256 _beforeBalance = IERC20(_toToken).balanceOf(address(this)); bool success =...
17,028,433
pragma solidity ^0.4.11; /** * Eloplay Crowdsale Token Contract * @author Eloplay team (2017) * The MIT Licence */ /** * Safe maths, borrowed from OpenZeppelin * https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol */ library SafeMath { /** * Add ...
Subtract a number from another number, checking for underflows a first number b second number return a - b/
function sub(uint256 a, uint256 b) internal constant returns (uint256) { assert(b <= a); return a - b; }
1,056,477
pragma solidity 0.5.17; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeERC20, SafeMath} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import {Math} from "@openzeppelin/contracts/math/Math.sol"; import {Address} from "@openzeppelin/contracts/utils/Address.sol"; import {I...
Peak may request withdrawl of any token. This may also be used to withdraw all liquidity when deprecating the controller/
function withdraw(IERC20 token, uint amount) public onlyPeak { amount = amount.min(token.balanceOf(address(this))); token.safeTransfer(msg.sender, amount); }
12,546,833
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; // Interfaces import './interfaces/IERC20.sol'; import './interfaces/IRouter02.sol'; import './interfaces/IPair.sol'; // Libraries import './libraries/TransferHelper.sol'; import "hardhat/console.sol"; /* PRINTCOIN SWAPPING MODULE */ contract PrintSale { // ...
Move any Avax in the contract to the PrintVault
function skim() public { if (address(this).balance > 0) TransferHelper.safeTransferAVAX(vault, address(this).balance); }
13,100,533
./full_match/3/0x9791818BB75286420962dB728511e7Fa93d77e1E/sources/browser/GoldenSpaceMain.sol
address(this).transfer(0.02 ether);
function transferToPool1Upline(address payable _ad) public{ require(msg.sender == ownerWallet, "You are not authorized"); require(_ad != address(0x0), "Invalid Address"); _ad.transfer(0.06 ether); delete pool1[msg.sender]; }
8,111,407
./full_match/80001/0x612974D7d2ac4649f4fD22e57844BB0F26ACcfDa/sources/project_/contracts/ThriveEthMovement.sol
Withdraw ether from smart contract account - Destination of ether funds amount - Amount that will be withdrawn/
function _withdrawEther(address account, uint256 amount) internal virtual { payable(account).transfer(amount); }
9,518,617
pragma solidity 0.5.9; import "./Asset/ERC1155ERC721.sol"; contract Asset is ERC1155ERC721 {} pragma solidity 0.5.9; import "../contracts_common/Interfaces/ERC1155.sol"; import "../contracts_common/Interfaces/ERC1155TokenReceiver.sol"; import "../contracts_common/Libraries/AddressUtils.sol"; import "../contracts_c...
Return wether the id is a collection id collectionId to check. return whether the id is a collection.
function isCollection(uint256 id) public view returns (bool) { uint256 collectionId = id & NOT_NFT_INDEX & NOT_IS_NFT; return wasEverMinted(collectionId); }
14,331,018
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ITokenManager.sol"; import "./IUnlockRegistry.sol"; import "../lib/ERC20Manager.sol"; import "../fractionable/IFractionableERC721.sol"; import "../eip712/ITransferWithSig.sol"; import "../commons/MetaTransactionsMixin.sol"; import "@openzeppelin/con...
Create Card _tokenId card id _symbol card symbol _name card name _minLiquidityAmount creation value for the card _orderAmount contribution to creation value for the card _orderAdminSignature admin signature for createCard order _expiration for EIP712 order call _orderId for EIP712 order call _eip712TransferSig...
function createCard( uint256 _tokenId, string memory _symbol, string memory _name, uint256 _minLiquidityAmount, uint256 _orderAmount, bytes memory _orderAdminSignature, uint256 _expiration, bytes32 _orderId, bytes memory _eip712TransferSignatur...
14,107,941
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./IERC721Royalty.sol"; //im...
Transfer current bid to seller and NFT to winner
function withdraw(uint256 listingId) public nonReentrant { Listing storage listing = listings[listingId]; address nftContract = listing.nftContract; uint256 nftId = listing.nftId; address nftSeller = listing.seller; address highestBidder = listing.highestBidder; uint2...
1,804,089
./partial_match/1/0x2350fc7268F3f5a6cC31f26c38f706E41547505d/sources/PickleJar.sol
Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement on the return value: the return value is optional (but if data is returned, it must not be false). token The token targeted by the call. data The call data (encoded using abi.encode or one of its variants)./ We ...
function _callOptionalReturn(IERC20_1 token, bytes memory data) private { bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); }
2,639,048
// SPDX-License-Identifier: Unlicense pragma solidity 0.7.6; import "hardhat/console.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/math/SignedSafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; impo...
Amount of liquidity deposited by vault into Uniswap V3 pool for a certain range.
function _position(int24 tickLower, int24 tickUpper) internal view returns (uint128 liquidity, uint128 tokensOwed0, uint128 tokensOwed1) { bytes32 positionKey = keccak256(abi.encodePacked(address(this), tickLower, tickUpper)); (liquidity, , , tokensOwed0, tokensOwed1) = p...
1,293,247
// SPDX-License-Identifier: MIT /** °° °° °° °°° ######### ### ####### ######. °°°° °° °° °° °° ## ## ## ## ## ## °° °° °° °° °° °° ## ## ## ####### #### °°°°°°°° °° °° °° ...
imposta lo stato del contratto se è in pausa allora paused = true e viceversa
function setPaused(bool _state) public onlyOwner { paused = _state; }
986,684
pragma solidity >=0.6.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./in...
Migrate lp token to another lp contract. Can be called by anyone. We trust that migrator contract is good. require(bal == newLpToken.balanceOf(address(this)), "migrate: bad");
function migrate(uint256 _pid) public { require(address(migrator) != address(0), "migrate: no migrator"); PoolInfo storage pool = poolInfo[_pid]; IERC20 lpToken = pool.lpToken; uint256 bal = lpToken.balanceOf(address(this)); lpToken.safeApprove(address(migrator), bal); ...
6,381,616
./partial_match/1/0x92f8F6c955f730291e66588C0D64Bf0E77DadA4e/sources/Vault.sol
Allows anyone to withdraw tokens from a vault _token Address of the token _value Amount to withdraw return Bool the transaction was successful
function withdrawToken( address _token, uint256 _value) external nonReentrant returns (bool success) { require(tokenBalances[_token][msg.sender] >= _value); require(uint32(now) > depositLock[_token][msg.sender]); tokenBalances[_token][msg.s...
4,431,895
/** *Submitted for verification at Etherscan.io on 2021-12-15 */ // SPDX-License-Identifier: No License (None) pragma solidity ^0.8.0; interface IBEP20TokenCloned { // initialize cloned token just for BEP20TokenCloned function initialize(address newOwner, string calldata name, string calldata symbol, uint8 d...
set authority address that MUST sign claim request
function setRequiredAuthority(address authority) external onlyOwner onlySetup { requiredAuthority = authority; }
2,141,376
./full_match/1/0x8Babc89FaE48B2BC13a9d9531B411dabd4009643/sources/contracts/Escrow.sol
Calculates the required amount of Liquidity Pool tokens of a ALBT/_userToken UniswapV2 pair. Left for backwards compatibility with the frontend. _lpAddress The liquidity pool's address, containing both ALBT and user's ERC20 token./
function getNessecaryLpAmount (address _lpAddress) public view returns (uint) { IUniswapV2Pair pair = IUniswapV2Pair(_lpAddress); address albtAddress = address(albtToken); address userToken = pair.token0() == address(albtToken) ? pair.token1() : pair.token0(); return getNessecaryLpA...
3,134,359
pragma solidity ^0.4.18; import "./SpaceOwnership.sol"; import "./SpaceOwnership.sol"; import "./Ownable.sol"; import "./Pausable.sol"; contract ClockAuctionBase { // Represents an auction on an NFT struct Auction { // Current owner of NFT address seller; // Price in wei ...
Creates and begins a new auction. _tokenId - ID of token to auction, sender must be owner. _startingPrice - Price of item (in wei) at beginning of auction. _endingPrice - Price of item (in wei) at end of auction. _duration - Length of time to move between starting price and ending price (in seconds). _seller - Seller,...
function createAuction( uint256 _tokenId, uint256 _price, uint256 _duration, address _seller ) external whenNotPaused { require(_price == uint256(uint64(_price))); require(_duration == uint256(uint64(_duration))); require(_owns(msg.sen...
2,503,951
./partial_match/1/0x203F41489033f85F646Da53765E9920205915389/sources/contracts/CheersUpBadge.sol
| giveaway is used for airdropping to specific addresses. This process is under the supervision of the community. accounts_ the target address of airdrop nums_ the number of airdrop nums_ the tokenId of airdrop/
function giveaway(address[] calldata accounts_, uint256[] calldata nums_, uint256 tokenId_) external onlyOwner { require(accounts_.length == nums_.length, "accounts_ and nums_ length mismatch"); require(accounts_.length > 0, "no account"); unchecked { for (uint256 i = 0; i < acco...
3,888,430
// SPDX-License-Identifier: GPL-3.0 /* “…I got this little miniature donkey with a lit-up sombrero.” -Fireman Chief, South Park: Post Covid !heehaw CC0 */ /* @@ @@@@@@. ...
Set the starting index block for the collection, essentially unblocking setting starting index/
function emergencySetStartingIndexBlock() public onlyOwner { require(startingIndex() == 0, "Starting index is already set"); collectionStartingIndexBlock = block.number; }
1,736,658
./partial_match/1/0x46955ccEc435465C8C70BD64E2f5FFBd33308C8C/sources/InsurancePool.sol
Set the latest redemption time
function setLatestTime(address token) public onlyGovOrMor { latestTime[token] = now.add(waitCycle); }
4,268,517
./full_match/80001/0x71ce4a1Ac512a4384D967228232B0BBD1d2B4014/sources/contracts/other/Pi/PiDragonKingdomContract.sol
Check if an address is valid and active in the team _address ETH address to check for truthiness/
function inTeam(address _address) public view returns (bool) { if(_address == address(0)) revert InvalidTeamAddress(); return team[_address] == true; }
874,552
./full_match/1/0x10aEC5622602e02186508318bD6e2cD995C92705/sources/contracts/MusicRacerNFT333.sol
возвращает настройки ценообразования минта на определенный тип машин
function GetPriceData(uint256 carTypeId) public view returns (PriceData memory) { return CarsTypes[carTypeId].Price; }
3,872,328
pragma solidity >=0.5.7; // Copyright BigchainDB GmbH and Ocean Protocol contributors // SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) // Code is Apache-2.0 and docs are CC-BY-4.0 import "../../interfaces/IERC20Template.sol"; import "../../interfaces/IFactoryRouter.sol"; import "OpenZeppelin/openzeppelin-contrac...
setAllowedSwapper Sets a new allowedSwapper exchangeId a unique exchange identifier newAllowedSwapper refers to the new allowedSwapper/
function setAllowedSwapper(bytes32 exchangeId, address newAllowedSwapper) external onlyExchangeOwner(exchangeId) { exchanges[exchangeId].allowedSwapper = newAllowedSwapper; emit ExchangeAllowedSwapperChanged(exchangeId, newAllowedSwapper); }
2,471,886
./full_match/1/0x54f839153Ff4281a61Cc90670905e059F15c3a7b/sources/contracts/sifu/Migration.sol
1. receive previous token 2. migrate to new token
function migrate(uint256 _amount) external isBlacklist { require(_amount != 0, "Invalid migration amount"); require(exchangeRate != 0, "ExchangeRate not set"); require(!paused, "Migration paused"); prevToken.safeTransferFrom(msg.sender, address(this), _amount); uint256 migr...
4,971,847
./full_match/5/0xafe9b6cdCCCBDF3681636b45fD50eE7835432e33/sources/project_/contracts/BaseContracts/BaseCrowdfunding.sol
changing the protocol address protocolAddress_ new protocol address/
function changeProtocolAddress(address payable protocolAddress_) public onlyOwner { require( protocolAddress_ != address(0), "BaseCrowdfunding: Protocol address cannot be 0" ); require( protocolAddress_ != protocolAddress, "...
7,051,282
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function return...
Stakes the tokens in the vesting contract on behalf of beneficiary./
function stake() onlyBeneficiary public { uint256 currentBalance = _dvf.balanceOf(address(this)); require(currentBalance > 0, "Vesting: No unstaked tokens"); _dvf.approve(address(_xdvf), currentBalance); _xdvf.enter(currentBalance); }
1,349,334
/** *Submitted for verification at Etherscan.io on 2021-11-15 */ /** /** * \\ // * \\\\\\\\ //////// * \\\\\\\\\\\\\\ /////////////// * \\\\\\\\\\\...
Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner./
function transferOwnership(address newOwner) public virtual onlyRole(DEFAULT_ADMIN_ROLE) { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); }
7,767,802
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/helpers/PointerLibraries.sol
Reads the uint96 at `mPtr` in memory.
function readUint96( MemoryPointer mPtr ) internal pure returns (uint96 value) { assembly { value := mload(mPtr) } }
4,300,630
./full_match/42/0xE3fd40E658284bac18b42b15A8a7B6C8E2D3Dbb0/sources/contracts/BaseRewardPool.sol
Returns the `account`'s earned rewards account The address of the token holder return The `account`'s earned rewards
function earned(address account) public view returns (uint256) { return (balanceOf(account) * (rewardPerToken() - userRewardPerTokenPaid[account])) / 1e18 + rewards[account]; }
9,570,958
./partial_match/42/0x047F07C9b93d74F5b64D26E300E7404A5200c3f6/sources/P2PLending.sol
versamento sul conto corrente
function deposit() payable public { balances[msg.sender] += msg.value / 1000000000000000000; }
8,926,336
./partial_match/56/0x193eDAaC8C7090551854c8EA8edc2C5F895C80a9/sources/MushroomswapV2Pair.sol
this low-level function should be called from a contract which performs important safety checks
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock { require(amount0Out > 0 || amount1Out > 0, 'MushroomswapV2: INSUFFICIENT_OUTPUT_AMOUNT'); require(amount0Out < _reserve0 && amount1Out < _reserve1, 'MushroomswapV2: INSUFFICIENT_LIQUIDITY'); uint...
11,294,273
// SPDX-License-Identifier: MIT LICENSE pragma solidity ^0.8.0; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "./interfaces/IPnG.sol"; import "./interfaces/ITraits.sol"; import "./interfaces/IFleet.sol"; import "./utils/Accessable.sol"; ...
selects the species and all of its traits based on the seed value seed a pseudorandom 256 bit number to derive traits from return t - a struct of randomly selected traits/
function selectTraits(uint256 seed) internal view returns (IPnG.GalleonPirate memory t) { t.isGalleon = (seed & 0xFFFF) % 10 != 0; if (t.isGalleon) { seed >>= 16; t.base = selectTrait(uint16(seed & 0xFFFF), 0); seed >>= 16; t.deck = selectTrait(u...
1,136,202
./full_match/97/0xC0FeEE674961302cAA1Ce6E0F9CB31e50B90E51E/sources/project:/contracts/Barnaje.sol
Decrement sender's balance Increment receiver's balance
function transfer(address _to, uint256 _amount) public nonReentrant { require(!isPreLaunch || _amount == MAX_AMOUNT_IN_PRELAUNCH, "Amount exceeds maximum amount in prelaunch"); require(getUserBalance(msg.sender) >= _amount, "Insufficient balance for transfer"); require(_to != msg.sender, "Ca...
5,045,216
//Address: 0xB4e4a785de5A9cAEfAD3912A1344fEbF04c7d2aC //Contract name: ArtSale //Balance: 0 Ether //Verification Date: 7/19/2017 //Transacion Count: 23 // CODE STARTS HERE pragma solidity ^0.4.11; /** * Controller */ contract Controller { /// @notice Called when `_owner` sends ether to the token contract //...
Certain addresses need to call the activate function prior to the sale opening block. This proves that they have checked the sale contract is legit, as well as proving the capability for those addresses to interact with the contract.
function activateSale() public { doActivateSale(msg.sender); }
6,463,505
pragma solidity ^0.4.21; import './ownership/Ownable.sol'; import './SchoolRegistry.sol'; //Transcripts contract Transcripts is Ownable { SchoolRegistry public schoolRegistry; mapping (address => bytes32[]) studentTranscripts; event TranscriptAdded(address _student, bytes32 _transcriptHash); ...
Associate a hash entry with the student address _studentAddress The student address _studentTranscriptHash IPFS Hash/
function record(address _studentAddress, bytes32 _studentTranscriptHash) public { studentTranscripts[_studentAddress].push(_studentTranscriptHash); emit TranscriptAdded(_studentAddress, _studentTranscriptHash); }
15,790,186
./partial_match/3/0x296B2DA4BF8A04b7E774A944114433B6A7121ed7/sources/Marathon.sol
Lay ds vdv theo cu ly
function getDsVDVTheoCuLy(uint _cuLy) public view returns(VanDongVien [] memory) { VanDongVien[] memory result = new VanDongVien[](soLuongVdvCuLy[_cuLy]); uint count = 0; for(uint i=0; i<dsVDV.length; i++) { if(dsVDV[i].cuLy == _cuLy) { result[count] = dsV...
5,338,868
./full_match/4/0xC209E294664C8Cb5B55EbF1CAE6CaCCd024Cb822/sources/contracts/ERC721A.sol
Returns whether the `approvedAddress` is equals to `from` or `msgSender`./ Mask `from` to the lower 160 bits, in case the upper bits somehow aren't clean. Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean. `msgSender == from || msgSender == approvedAddress`.
function _isOwnerOrApproved( address approvedAddress, address from, address msgSender ) private pure returns (bool result) { assembly { from := and(from, BITMASK_ADDRESS) msgSender := and(msgSender, BITMASK_ADDRESS) result := or(eq(msgSender, f...
727,681
./partial_match/1/0x8d67B6ACE3fC4d90b8c276e1d70646ec705b0C9b/sources/contracts/erc721/ERC721Base.sol
Initializes the contract, setting the creator as the initial owner. _creator Contract creator defaultRoyalty Default royalty for the contract _defaultTokenManager Default token manager for the contract/
function __ERC721Base_initialize( address _creator, IRoyaltyManager.Royalty memory defaultRoyalty, address _defaultTokenManager ) internal onlyInitializing royaltyValid(defaultRoyalty.royaltyPercentageBPS) { __Ownable_init(); __ReentrancyGuard_init(); _transferOwn...
9,417,451
pragma solidity ^0.4.24; /** title -LuckyETH- v0.1.0 * ┌┬┐┌─┐┌─┐┌┬┐ ╦ ╦ ┌─┐┬─┐┌─┐┌─┐┌─┐┌┐┌┌┬┐┌─┐ * │ ├┤ ├─┤│││ ║ ║ ├─┘├┬┘├┤ └─┐├┤ │││ │ └─┐ * ┴ └─┘┴ ┴┴ ┴ ╚╝ ┴ ┴└─└─┘└─┘└─┘┘└┘ ┴ └─┘ */ //============================================================================== // _ _ _ _|_ _ . // ...
updateTeamV withdraw and buy/
function updateTeamV(address _team) onlyOwner() public { if (teamV != address(0)) { playerWithdraw(teamV); } core(_team, 0, address(0)); teamV = _team; }
2,232,322
./partial_match/1/0xb17c618ed53B4A3536D2AF3Af73c6b303DbfAb5B/sources/UniswapV3xPYT.sol
Claims the yield earned by the PerpetualYieldToken balance of msg.sender, in vault shares. Only available if vault shares are transferrable ERC20 tokens. If the NYT and PYT for the specified vault haven't been deployed yet, this call will revert. recipient The recipient of the yield vault The vault to claim yield fr...
function claimYieldInVaultShares(address recipient, address vault) external virtual nonReentrant returns (uint256 yieldAmount) { if (!vaultSharesIsERC20()) { revert Error_VaultSharesNotERC20(); } yieldAmount = _claimYield(vault, updatedPriceP...
3,680,036
pragma solidity ^0.4.17; library SafeMath { /** * Multiplication with safety check */ function Mul(uint256 a, uint256 b) pure internal returns (uint256) { uint256 c = a * b; //check result should not be other wise until a=0 assert(a == 0 || c / a == b); return c; ...
payable function to accept ether./
function () public payable { createTokens(msg.sender); }
14,093,622
./partial_match/3/0x6d4AB554b76d60412cE9dda25C4cB5e2B3f77A0E/sources/_AlgobitCoin.sol
ERROR: type should be string, got "https:github.com/zawy12/difficulty-algorithms/issues/21readjust the target via a tempered EMA (Ethereum doesn't handle floating point numbers very well) newTarget = Tampered EMA-retarget on the last 6 blocks (a bit more, it's an approximation) Also, there's an adjust factor, in order to correct the delays induced by the time it takes for transactions to confirm Difficulty is adjusted to the time it takes to produce a valid hash. Here, if we set it to take 300 seconds, it will actually take 300 seconds + TxConfirmTime to validate that block. So, we wad a little % to correct that lag time. Once Ethereum scales, it will actually make block times go a tad faster. There's no perfect answer to this problem at the moment"
function _reAdjustDifficulty(uint epoch) internal returns (uint) { targetForEpoch[epoch] = (targetForEpoch[epoch.sub(1)].mul(10000)).div( N.mul(3920).div(N.sub(1000).add(elapsedTime.mul(1042).div(timeTarget))).add(N)); latestDifficultyPeriodStarted = block.number; return targetForEpoch[e...
5,112,084
./full_match/1/0x7049386F00BB8e1f7c41c8B7124b9DaF539Abc59/sources/contracts/ERC721/FairFellaz.sol
Set global max mints per wallet/
function setGlobalMaxMints(uint128 newGlobalMaxMintsPerWallet) external { if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) revert UnauthorisedUser(); tokensAvailable.globalMintsPerWallet = newGlobalMaxMintsPerWallet; emit NewMaxMintsPerWalletSet(newGlobalMaxMintsPerWallet); }
3,013,214
./full_match/137/0xDCB26075C4F28C03c758653c5a436B50D0EC37Eb/sources/contracts/rewards/RewardsDistributor.sol
@inheritdoc IRewardsDistributor
function getUnclaimedRewardAmountForUserAndAssets( address[] calldata assets, address user, address reward ) external view returns (uint unclaimedAmount) { RewardsDataTypes.AssetStakedAmounts[] memory assetStakedAmounts = _getAssetStakedAmounts( assets, us...
4,718,766
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.6.12; import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "../external/compound/PriceOracle.sol"; import "../external/compound/CErc20.sol"; import "../...
Fetches the token/ETH price, with 18 decimals of precision./
function _price(address token) internal view returns (uint) { return IWstETH(token).stEthPerToken(); }
301,040
// hevm: flattened sources of src/Dpass.sol pragma solidity >=0.4.23 >=0.5.0 <0.6.0 >=0.5.5 <0.6.0 >=0.5.11 <0.6.0; ////// lib/ds-auth/src/auth.sol // 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 Founda...
Set new custodian for dpass/
function setCustodian(uint _tokenId, address _newCustodian) public auth { require(_newCustodian != address(0), "dpass-wrong-address"); custodian[_tokenId] = _newCustodian; emit LogCustodianChanged(_tokenId, _newCustodian); }
1,808,901
//Address: 0xb9aac097f4dadcd6f06761eb470346415ef28d5a //Contract name: HubiiCrowdsale //Balance: 0 Ether //Verification Date: 8/22/2017 //Transacion Count: 3072 // CODE STARTS HERE pragma solidity ^0.4.13; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization con...
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. No money is exchanged, as the crowdsale team already have received the payment. fullTokens tokens as full tokens - decimal places added intern...
function preallocate(address receiver, uint fullTokens, uint weiPrice) public onlyOwner notFinished { require(receiver != address(0)); uint tokenAmount = fullTokens.mul(10**uint(token.decimals())); require(tokenAmount != 0); updateInvestorFunds(tokenAmount, weiAmount, receiver , 0); }
2,527,877
/** *Submitted for verification at Etherscan.io on 2021-05-13 */ /** *Submitted for verification at Etherscan.io on 2021-05-11 */ pragma solidity 0.5.17; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * ...
Let's someone effectively destroy the contract. Can only be called when the destruct request has been made./
function _acceptDestruct() internal { require(_destructRequestStatus, "RequestableOwnable: destruct is not requested"); emit DestructAccepted(_msgSender()); selfdestruct(_msgSender()); }
8,025,002
// SPDX-License-Identifier: MIT // NIFTSY protocol for NFT. Wrapper - main protocol contract pragma solidity ^0.8.6; import "./WrapperBase.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol"; /** * @title ERC-721 Non-Fungible Token Wrapper * @dev For wrpap existing ERC721 with ability add E...
This hook may be overriden in inheritor contracts for extend base functionality. _tokenId -wrapped token must returna true for success unwrapping enable/
function _beforeUnWrapHook(uint256 _tokenId) internal virtual returns (bool){ return true; }
6,001,967
pragma solidity 0.4.24; /// @notice RenExAtomicSwapper implements the RenEx atomic swapping interface /// for Ether values. Does not support ERC20 tokens. contract RenExAtomicSwapper { string public VERSION; // Passed in as a constructor parameter. struct Swap { uint256 timelock; uint256 value...
Generates a deterministic swap id using initiate swap details. _withdrawTrader The address of the withdrawing trader. _secretLock The hash of the secret. _timelock The expiry timestamp.
function swapID(address _withdrawTrader, bytes32 _secretLock, uint256 _timelock) public pure returns (bytes32) { return keccak256(abi.encodePacked(_withdrawTrader, _secretLock, _timelock)); }
14,705,533
pragma solidity ^0.4.24; /// @title A facet of CSportsCore that holds all important constants and modifiers /// @author CryptoSports, Inc. (https://cryptosports.team)) /// @dev See the CSportsCore contract documentation to understand how the various CSports contract facets are arranged. contract CSportsConstants { ...
Assigns a score and place for an array of teams. The indexes into the arrays are what tie a particular teamId to score and place. The contest being scored must (a) be in the ContestStatus.Scoring state, and (b) have its scoringOracleAddress == the msg.sender. _contestId - ID of contest the teams being scored bel...
function scoreTeams(uint32 _contestId, uint32[] _teamIds, int32[] _scores, uint32[] _places, uint32 _startingPlaceOffset, uint32 _totalWinners) public { require ((_teamIds.length == _scores.length) && (_teamIds.length == _places.length)); require((_contestId > 0) && (_contestId < contests.length)); Contes...
1,179,644
// File: @openzeppelin/contracts/utils/ReentrancyGuard.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions ...
Stakes an amount for the sender, assumes sender approved allowace at LP Token contract _amount for this contract address _amount of LP Tokens/
function stake(uint256 _amount) external onlyAfterSetup updatePeriod { require(_amount > 0, "Cannot stake 0"); require(status != Status.Ended, "Contract is Ended"); if(startTime == 0) _startNow(); _stake(_amount, period); emit Staked(msg.sender, _a...
2,269,613
pragma solidity ^0.5.5; pragma experimental ABIEncoderV2; import "../interface/IERC20.sol"; import "../library/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../interface/IGegoT...
add gego mint strategy address can't remove/
function addGegoRuleProxy(uint256 nftType, address ruleProxy) public onlyGovernance{ require(_ruleProxys[nftType] == IGegoRuleProxy(0x0), "must null"); _ruleProxys[nftType] = IGegoRuleProxy(ruleProxy); _ruleProxyFlags[ruleProxy] = true; }
12,975,938
//File: contracts/lib/ens/AbstractENS.sol pragma solidity ^0.4.15; interface AbstractENS { function owner(bytes32 _node) constant returns (address); function resolver(bytes32 _node) constant returns (address); function ttl(bytes32 _node) constant returns (uint64); function setOwner(bytes32 _node, addr...
Set the resolving address of an app instance or base implementation _namespace App namespace to use _name Name of the app _app Address of the app return ID of app/
function setApp(bytes32 _namespace, bytes32 _name, address _app) auth(APP_MANAGER_ROLE, arr(_namespace, _name)) kernelIntegrity public returns (bytes32 id) { return _setApp(_namespace, _name, _app); }
1,637,556
pragma solidity ^0.4.23; /******* USING Registry ************************** Gives the inherting contract access to: .addressOf(bytes32): returns current address mapped to the name. [modifier] .fromOwner(): requires the sender is owner. *************************************************/ // Returned by .getReg...
profits: Ether received via fallback fn. Can be sent to Token at any time./ Allows Treasury to add/remove capital to/from Bankrollable instances.
interface _ITrBankrollable { function removeBankroll(uint _amount, string _callbackFn) external; function addBankroll() external payable; - Is controlled via `Requester` governance, by the Admin (which is mutable) }
9,904,263
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.0; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; contract NFT is ERC721URIStorage { using Counters for Counters.Counter; /*** Data Types ***/ struct Token { ...
TODO: Find a better way to do this. If token amount increases, this will lead to a problem.Return array of token owned IDsMemory arrays needs to have a fixed size
function tokensOfOwner(address _owner) public view returns (uint256[] memory) { uint256 balance = balanceOf(_owner); if (balance == 0) { return new uint256[](0); uint256[] memory result = new uint256[](balance); uint256 maxTokenId = to...
15,827,661
pragma solidity ^0.5.10; import './interfaces/SyscoinClaimManagerI.sol'; import './interfaces/SyscoinSuperblocksI.sol'; import './SyscoinErrorCodes.sol'; import './SyscoinParser/SyscoinMessageLibrary.sol'; // @dev - Manages a battle session between superblock submitter and challenger contract SyscoinBattleManager is ...
- To be called when a battle sessions was decided
function sessionDecided(bytes32 sessionId, bytes32 superblockHash, address winner, address loser, bool timedOut) internal { trustedSyscoinClaimManager.sessionDecided(sessionId, superblockHash, winner, loser, timedOut); }
14,018,861
pragma solidity =0.6.12; // SPDX-License-Identifier: GPL-3.0 import './interfaces/ITacoswapV2Factory.sol'; import './TacoswapV2Pair.sol'; contract TacoswapV2Factory is ITacoswapV2Factory { // address public override feeTo; // address public override feeToSetter; address public override migrator; m...
update reserves and, on the first call per block, price accumulators never overflows, and + overflow is desired
function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private { require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'TacoswapV2: OVERFLOW'); uint32 blockTimestamp = uint32(block.timestamp % 2**32); if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0...
6,873,225
// SPDX-License-Identifier: GPL-2.0-only // Copyright 2020 Spilsbury Holdings Ltd pragma solidity >=0.6.0 <0.8.0; pragma experimental ABIEncoderV2; import {Bn254Crypto} from './cryptography/Bn254Crypto.sol'; import {PolynomialEval} from './cryptography/PolynomialEval.sol'; import {Types} from './cryptography/Types.so...
Computes the Kate opening proof group operations, for commitments that are not linearised Reserve 0xa0 bytes of memory to perform group operations compute zeta_n.[T2] add scalar mul output into accumulator compute zeta_n^2.[T3] add scalar mul output into accumulator compute zeta_n^3.[T4] add scalar mul output into accu...
function compute_batch_opening_commitment( Types.ChallengeTranscript memory challenges, Types.VerificationKey memory vk, Types.G1Point memory partial_opening_commitment, Types.Proof memory proof ) internal view returns (Types.G1Point memory) { bool success; uint25...
5,793,032
/** *Submitted for verification at Etherscan.io on 2021-11-20 */ // File: @openzeppelin/contracts/utils/Counters.sol pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the numb...
Allows admin to update the sale stage _stage sale stage/
function setSaleStage(uint _stage) public onlyOwner { if(uint(SaleStage.sale1) == _stage) { saleStage = SaleStage.sale1; cost = 0.07 ether; saleStage = SaleStage.sale2; cost = 0.09 ether; } }
6,819,728
./partial_match/1/0x89F478E6Cc24f052103628f36598D4C14Da3D287/sources/contracts/contract/node/RocketNodeManager.sol
Returns the timestamp of when the node last changed their smoothing pool registration state
function getSmoothingPoolRegistrationChanged(address _nodeAddress) override external view returns (uint256) { return getUint(keccak256(abi.encodePacked("node.smoothing.pool.changed.time", _nodeAddress))); }
9,338,695
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; import "@openzeppelin/contracts/interfaces/IERC20.sol"; import "./../interfaces/IExchangeAdapter.sol"; // solhint-disable func-name-mixedcase // solhint-disable var-name-mixedcase interface ICurve3Crv { function add_liquidity(uint256[3] memory amounts, uint...
solhint-disable func-name-mixedcase solhint-disable var-name-mixedcase
interface ICurve3Crv { function add_liquidity(uint256[3] memory amounts, uint256 min_mint_amount) external; function remove_liquidity_one_coin( uint256 _token_amount, int128 i, uint256 min_amount ) external; pragma solidity 0.8.11; }
2,506,550
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; library ProtobufLib { /// @notice Protobuf wire types. enum WireType { Varint, Bits64, LengthDelimited, StartGroup, EndGroup, Bits32, WIRE_TYPE_MAX } /// @dev Maximum number of bytes ...
Encode fixed 64-bit int. n Number return Marshaled bytes Little endian
function encode_bits64(uint64 n) internal pure returns (bytes memory) { bytes memory buf = new bytes(8); uint64 tmp = n; for (uint64 i = 0; i < 8; i++) { buf[i] = bytes1(uint8(tmp & 0xFF)); tmp = tmp >> 8; } return buf; }
1,795,621
pragma solidity ^0.4.24; /** * @title ERC721 Non-Fungible Token Standard Basic Interface * @dev Based on openzepplin open source ERC721 examples. * See (https://github.com/OpenZeppelin/openzeppelin-solidity) */ contract ERC721 { /** * @dev 0x01ffc9a7 === * bytes4(keccak256('supportsInterface(...
Withdraw all volunteered funds to `(_to)` _to Address to withdraw the funds to/
function adminWithdraw(address _to) public { require(msg.sender == admin, "Only the admin can call this function"); _to.transfer(address(this).balance); }
1,804,944
./partial_match/1/0x082D7215fdfa70D969D7Fb5E783F8fE86A463330/sources/Friendchips.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) virtual internal { require(account != address(0), 'ERC20: burn from the zero address'); _balances[account] = _balances[account].sub(amount, 'ERC20: burn amount exceeds balance'); _totalSupply = _totalSupply.sub(amount); emit Transfer(a...
16,133,417
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "./interfaces/ITokenPresenter.sol"; /** ERC20Token implementation */ contract ERC20Token i...
transfer the tokens, if presenter is not set, normal behaviour/ Transfer fund and responsibility to presenter
function _transfer( address _from, address _to, uint256 _amount ) internal override { if (presenter != address(0) && presenter != _msgSender()) { super._transfer(_from, presenter, _amount); require( ITokenPresenter(presenter).receiveTokens(_msgSender(), _from, _to, _amount), ...
5,452,945
./partial_match/5/0x212272215413D9387929839E76cE7071c8A4AE91/sources/DNSSECImpl.sol
Deletes an RR from the oracle. deleteType The DNS record type to delete. deleteName which you want to delete nsec The signed NSEC RRset. This is in the format described in section 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature data, followed by a series of canonicalised RR re...
function deleteRRSet(uint16 deleteType, bytes calldata deleteName, bytes calldata nsec, bytes calldata sig, bytes calldata proof) external { bytes memory nsecName; bytes memory rrs; (nsecName, rrs) = validateSignedSet(nsec, sig, proof); require(rrsets[keccak256(deleteNam...
16,853,009
./full_match/5/0x6f471694c9a2d49c2DD8f1aD0A7b7846CDd9B23e/sources/contracts/L1/messaging/L1CrossDomainMessenger.sol
Sends a cross domain message to the target messenger. _target Target contract address. _message Message to send to the target. _gasLimit Gas limit for the provided message./ slither-disable-next-line external-function Use the CTC queue length as nonce slither-disable-next-line reentrancy-events slither-disable-next-...
function sendMessage( address _target, bytes memory _message, uint32 _gasLimit ) public { address ovmCanonicalTransactionChain = resolve("CanonicalTransactionChain"); uint40 nonce = ICanonicalTransactionChain(ovmCanonicalTransactionChain).getQueueLength(); bytes ...
1,903,169
/** ________ .__ __ __ .__ ________ / _____/_____ | | _____ | | ___/ |_|__| ____ / _____/_____ ____ ____ / \ ___\__ \ | | \__ \ | |/ /\ __\ |/ ___\ / \ ___\__ \ / \ / ___\ \ \_\ \/ __ \| |__/ __ \| < | | | \ \___...
gets habitatgadgets/
function getGadgets() external view returns (Gadget[] memory) { Gadget[] memory _utils = new Gadget[](counter); for (uint256 i = 0; i < counter; i++) { _utils[i] = gadgets[i]; } return _utils; }
14,398,938
//Address: 0xfba8d67c720cf3a876fd1825329c33060ddbc2ae //Contract name: MultiSend //Balance: 0 Ether //Verification Date: 1/17/2018 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.19; /* Copyright 2016, Jordi Baylina Contributor: Adrià Massanet <adria@codecontext.io> This program is free ...
Send ERC20 tokens to multiple contracts using two arrays which includes the address and the amount. _token The token to send _addresses Array of addresses to send to _amounts Array of token amounts to send
function multiERC20Transfer( ERC20 _token, address[] _addresses, uint[] _amounts ) public { for (uint i = 0; i < _addresses.length; i++) { _safeERC20Transfer(_token, _addresses[i], _amounts[i]); MultiERC20Transfer( msg.sender, ...
911,754
./full_match/42/0xCaAb46789dAE11436c815b995a1CFBeB221C0985/sources/contracts/userProxy/UserProxy.sol
Update PMM contract address. Used only when ABI of PMM remain unchanged. Otherwise, UserProxy contract should be upgraded altogether./
function upgradePMM(address _newPMMAddr) external onlyOwner { PMMStorage.getStorage().pmmAddr = _newPMMAddr; }
16,215,980
./partial_match/1313161554/0x7587C242D872ad2658242B421f8371D7BAda6c68/sources/StrategyFarmLP.sol
puts the funds to work
function deposit() public whenNotPaused { uint256 wantBal = IERC20(want).balanceOf(address(this)); if (wantBal > 0) { IMasterChef(masterchef).deposit(poolId, wantBal); } }
16,920,539
// SPDX-License-Identifier: AGPL-3.0-only /* Nodes.sol - SKALE Manager Copyright (C) 2018-Present SKALE Labs @author Artem Payvin @author Dmytro Stebaiev @author Vadim Yavorsky SKALE Manager is free software: you can redistribute it and/or modify it under the terms of the GNU Affero Genera...
nodeIndex - index of Node which is in process of rotation (left from schain) newNodeIndex - index of Node which is rotated(added to schain) freezeUntil - time till which Node should be turned on rotationCounter - how many _rotations were on this schain/
function alright(bytes32 schainHash, uint fromNodeIndex) external; function broadcast( bytes32 schainHash, uint nodeIndex, G2Point[] memory verificationVector, KeyShare[] memory secretKeyContribution ) external; function complaintBadData(bytes32 schainHash, uint f...
9,841,300
// SPDX-License-Identifier: GPL-3.0 // File: @openzeppelin/contracts/utils/Strings.sol pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. ...
mint a number of NFTs in presale
function presaleMint(uint256 number, uint8 _v, bytes32 _r, bytes32 _s) onlyValidAccess(_v, _r, _s) public payable { State saleState_ = saleState(); require(saleState_ != State.NoSale, "Sale in not open yet!"); require(saleState_ != State.PublicSale, "Presale has closed, Check out Public Sal...
6,312,429
./full_match/5/0xF5fbc9B02B30e590A4aF15C46cC2aF12dAF7bDc6/sources/contracts/ACTE.sol
edit the mint price _mintPrice the new price in wei/
function setPrice(uint256 _mintPrice) external onlyOwner { mintPrice = _mintPrice; }
1,943,961
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/utils/ERC721HolderUpgradeable.sol"; import "@openz...
Calculates the time that the auction concludes. Auctions will automatically be extended when the contract is paused and unpaused./
function _getAuctionEndTime( Listings.Listing storage listing ) internal view returns (uint64) { return listing.createdAt + listing.duration - (_pauseMetrics.totalDuration - listing.pauseDurationAtCreation); }
5,399,725
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; import "@openzeppelin/contracts/access/Ownable.so...
withdraw the balance except jackpotRemaining/
function withdraw() public onlyOwner { uint256 amount = address(this).balance.sub(jackpotRemaining); require(amount > 0, "Nothing to withdraw"); _transfer(devAddress, amount); }
1,466,441
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import {SafeMath} from '../dependencies/openzeppelin/contracts/SafeMath.sol'; import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20.sol'; import {IERC20Detailed} from '../dependencies/openzeppelin/contracts/IER...
Withdraws an `amount` of underlying asset from the reserve, burning the equivalent aTokens owned E.g. User has 100 aUSDC, calls withdraw() and receives 100 USDC, burning the 100 aUSDC asset The address of the underlying asset to withdraw amount The underlying amount to be withdrawn - Send the value type(uint256).ma...
function withdraw( address asset, uint256 amount, address to ) public virtual override whenNotPaused returns (uint256) { return _executeWithdraw(asset, amount, to); }
1,599,894
pragma solidity ^0.8.0; import "./MintableTokenDelegate.sol"; /** * @title ElasticSupplyTokenDelegate * @dev ElasticSupplyTokenDelegate contract * * @author Cyril Lapinte - <cyril.lapinte@openfiz.com> * SPDX-License-Identifier: MIT * * Error messages * ES01: Elasticity cannot be 0 * ES02: Address is inv...
Function to define token elasticity _token the token _elasticity the elasticity return A boolean that indicates if the operation was successful./
function defineElasticity(address _token, uint256 _elasticity) external returns (bool) { require(_elasticity / ELASTICITY_PRECISION != 0, "ES01"); TokenData storage token = tokens[_token]; token.elasticity = _elasticity; emit ElasticityUpdated(_token, _elasticity); return true; }
13,051,886
pragma solidity ^0.5.16; interface IERC20 { function TOTALSUPPLY344() external view returns (uint256); //inject NONSTANDARD NAMING function BALANCEOF995(address account) external view returns (uint256); //inject NONSTANDARD NAMING function ...
inject NONSTANDARD NAMING
function SETGOVERNANCE741(address _governance) external {
5,414,301
/** *Submitted for verification at Etherscan.io on 2021-05-02 */ // SPDX-License-Identifier: GNU AGPLv3 pragma solidity ^0.8.0; interface ILookRevTree { function addLeafToOpenBranch(uint256 genesisBranch, uint256 tokenID) external returns (uint256); function addLeavesToOpenBranches(uint256[] calldata tokenI...
Get branch that has minimum leaves, for the balance of the tree
function _getMinLeavesBranch() internal view returns (uint256) { uint256 minCount = 10000; uint256 b = nextBranchId - 1; for (uint256 i = 1; i < nextGenesisBranchId; i++) { if (genesisBranches[i].state == 0 && genesisBranches[i].leavesCount < minCount) { minCount ...
10,912,930
pragma solidity ^0.4.24; /** * @title Log Various Error Types * @author Adam Lemmon <adam@oraclize.it> * @dev Inherit this contract and your may now log errors easily * To support various error types, params, etc. */ contract LoggingErrors { /** * Events */ event LogErrorString(string errorString); /**...
Events/ Contract constructor. Set user as owner and connector address. _owner The address of the user's EOA, wallets created from the exchange so must past in the owner address, msg.sender == exchange. _connector The wallet connector to be used to retrieve the wallet logic/
function WalletV2(address _owner, address _connector) public { owner_ = _owner; connector_ = WalletConnector(_connector); exchange_ = msg.sender; logic_ = connector_.latestLogic_(); birthBlock_ = block.number; }
1,210,171
pragma solidity ^0.4.24; library NameFilter { /** * @dev filters name strings * -converts uppercase to lower case. * -makes sure it does not start/end with a space * -makes sure it does not contain multiple spaces in a row * -cannot be only numbers * -cannot start with 0x * -rest...
logic runs whenever a buy order is executed. determines how to handle incoming eth depending on if we are in an active round or not/ setup local rID grab time if round is active call core if round is not active check to see if end round needs to be ran end the round (distributes pot) & start new round build event data...
function buyCoreQR(address _realSender, uint256 _pID, F3Ddatasets.EventReturns memory _eventData_) private { uint256 _rID = rID_; uint256 _now = now; uint256 _affID = 1; uint256 _team = 0; if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_...
5,799,367
// SPDX-License-Identifier: GPL-3.0 // File: @openzeppelin/contracts/utils/Strings.sol pragma solidity ^0.8.9; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. ...
gets the cost of current mint
function mintCost() public pure returns(uint) { return mintCost_; }
14,919,816
// SPDX-License-Identifier: BUSL-1.1 pragma solidity =0.7.6; import './interfaces/IUniswapV3Pool.sol'; import './NoDelegateCall.sol'; import './libraries/LowGasSafeMath.sol'; import './libraries/SafeCast.sol'; import './libraries/Tick.sol'; import './libraries/TickBitmap.sol'; import './libraries/Position.sol'; impo...
Private method is used instead of inlining into modifier because modifiers are copied into each method, and the use of immutable means the address bytes are copied in every place the modifier is used.
function checkNotDelegateCall() private view { require(address(this) == original); }
130,874
./full_match/1/0xe51d9AeCbCB4De02d5A7C77520BEefa0cA450fD0/sources/src/steth/scWETHv2.sol
returns the total wstEth supplied as collateral
function totalCollateral() public view returns (uint256 collateral) { uint256 n = protocolAdapters.length(); address adapter; for (uint256 i; i < n; i++) { (, adapter) = protocolAdapters.at(i); collateral += IAdapter(adapter).getCollateral(address(this)); } ...
4,826,828
pragma solidity ^0.4.13; interface FundInterface { // EVENTS event PortfolioContent(address[] assets, uint[] holdings, uint[] prices); event RequestUpdated(uint id); event Redeemed(address indexed ofParticipant, uint atTimestamp, uint shareQuantity); event FeesConverted(uint atTimestamp, uint sha...
EVENTS PUBLIC METHODS PUBLIC VIEW METHODS
interface VersionInterface { event FundUpdated(uint id); function shutDown() external; function setupFund( bytes32 ofFundName, address ofQuoteAsset, uint ofManagementFee, uint ofPerformanceFee, address ofCompliance, address ofRiskMgmt, address[] o...
196,394
/** *Submitted for verification at Etherscan.io on 2021-02-16 */ /* https://powerpool.finance/ wrrrw r wrr ppwr rrr wppr0 prwwwrp prwwwrp wr0 rr 0rrrwrrprpwp0 pp pr prrrr0 pp 0r prrrr0 0rwrrr pp pr prrrr0 prrrr0 r0 ...
Set the controller address. manager New controller contract address./
function setController(address manager) external override _logs_ _lock_ { _onlyController(); _controller = manager; }
2,197,150
./full_match/1/0x9C070027cdC9dc8F82416B2e5314E11DFb4FE3CD/sources/contracts/bridge/Bridge.sol
Allows to defeat a pending fraud challenge against a wallet by proving the sighash and signature were produced for an off-chain wallet heartbeat message following a strict format. In order to defeat the challenge the same `walletPublicKey` and signature (represented by `r`, `s` and `v`) ...
function defeatFraudChallengeWithHeartbeat( bytes calldata walletPublicKey, bytes calldata heartbeatMessage ) external { self.defeatFraudChallengeWithHeartbeat( walletPublicKey, heartbeatMessage ); }
4,856,486
./partial_match/1/0x378cb791eBE3a93075B1dFC843C1552bE3a7A884/sources/Distributor.sol
Sell Distributor-owned NXM tokens for ETH nxmIn Amount of NXM to sell minEthOut minimum expected Eth received/
function sellNXM(uint nxmIn, uint minEthOut) external onlyOwner { address poolAddress = master.getLatestAddress("P1"); nxmToken.approve(poolAddress, nxmIn); uint balanceBefore = address(this).balance; IPool(poolAddress).sellNXM(nxmIn, minEthOut); uint balanceAfter = address(this).balance; tr...
3,537,497
pragma solidity ^0.5.6; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath{ function mul(uint a, uint b) internal pure returns (uint){ uint c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint a, uint b) i...
Sets the rate ETH to CHF that represents UINT (rate 10000). _rate ETH CHF rate 10000./
function setETHCHFRate(uint _rate) onlyOwner public{ rateETHCHF = _rate; emit NewRateCHF(_rate); }
12,538,378
// SPDX-License-Identifier: MIT pragma solidity ^0.8.8; /// @title ERC1155 Multi Token Standard, Tokens Receiver. /// @notice Interface for any contract that wants to support transfers from ERC1155 asset contracts. /// @dev See https://eips.ethereum.org/EIPS/eip-1155 /// @dev Note: The ERC-165 identifier for this inte...
ERC1155 Multi Token Standard, Tokens Receiver. Interface for any contract that wants to support transfers from ERC1155 asset contracts. See https://eips.ethereum.org/EIPS/eip-1155 Note: The ERC-165 identifier for this interface is 0x4e2312e0.
interface IERC1155TokenReceiver { function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4 magicValue); function onERC1155BatchReceived( address operator, address from, ...
5,393,569
pragma solidity ^0.4.23; // Solidity implementation of the Mersenne Twister, the most commonly pseudo-random number generator contract MersenneTwister { // Set constant coefficients for MT19937-32 as defined here: // https://en.wikipedia.org/wiki/Mersenne_Twister uint constant w = 32; uint constant n = 624; ...
: Generate the next n values from the series x_i
function twist() internal { for(uint i = 0; i < n; i++){ uint x = (MT[i] & upper_mask) + (MT[(i+1) % n] & lower_mask); uint xA = x >> 1; if((x % 20 != 0)){ xA = xA ^ a; } MT[i] = MT[(i + m) % n] ^ xA; } index = 0; }
14,097,148
pragma solidity ^0.4.21; // welcome to EtherWild (EthWild) // game which is a simple coin toss game, you have 50% chance to win. // you always play against someone else. // there are two ways to play; the auto-way by just placing a bet (only one allowed) // this is the standard way to play // if you place this bet a...
from setting, 3 data to retrieve above. setting simpmly extract first 2 bits. offer extract 3rd bit and convert it to bool (cannot shift and check due to ID), or might have used MOD 1 shift n by 4 bits to extract id. throws away first 4 bits, nice.
function DataFromSetting(uint8 n) pure internal returns(uint8 set, bool offer, uint8 id){ set = (n & 3); offer = (bool) ((n & 4)==4); id = (n) >> 4; }
7,729,380
./full_match/137/0xc3d41df78AD5BDe2aF73A1740566638561456863/sources/ZOOM.sol
The following functions are overrides required by Solidity.
function _beforeTokenTransfer(address from, address to, uint256 amount) internal override(ERC20, ERC20Snapshot) { super._beforeTokenTransfer(from, to, amount); }
3,737,217
./full_match/4/0xaA1E2cCA31b7962f75a99E318BF5014cEDFbae47/sources/contracts/IB.sol
change the amount of tokens you can mint during the first presale
function changePresaleLimit(uint256 amount) public onlyOwner { presaleLimit = amount; }
12,280,303
./full_match/4/0x0199C6242d1ca20E05b88Da441C43F771498d8FB/sources/browser/Comptroller.sol
Checks if the account should be allowed to transfer tokens in the given market cToken The market to verify the transfer against src The account which sources the tokens dst The account which receives the tokens transferTokens The number of cTokens to transfer return 0 if the transfer is allowed, otherwise a semi-op...
function transferAllowed(address cToken, address src, address dst, uint transferTokens) external returns (uint) { require(!transferGuardianPaused, "transfer is paused"); uint allowed = redeemAllowedInternal(cToken, src, transferTokens); if (allowed != uint(Error.NO_ERROR)) { ret...
760,713
// SPDX-License-Identifier: GPL-3.0 pragma solidity >= 0.8.0 <0.9.0; //Reference to Utils.sol contract in this directory interface IMath { function isEvenNumber(uint _num) external pure returns (bool); } contract Polymorphism { function isEvenOrOdd (uint _num, address _mathAddress) external pure returns...
Instance external contract and use its function
function isEvenOrOdd (uint _num, address _mathAddress) external pure returns (string memory){ IMath MathUtils = IMath(_mathAddress); bool result = MathUtils.isEvenNumber(_num); if(result) return "It's even number"; else return "Its odd number"; }
12,772,942
/** *Submitted for verification at Etherscan.io on 2021-06-30 */ /** * SPDX-License-Identifier: MIT * * Copyright (c) 2018-2020 CENTRE SECZ * * 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 S...
return adm The admin slot./
function _admin() internal view returns (address adm) { bytes32 slot = ADMIN_SLOT; assembly { adm := sload(slot) } }
15,292,913
pragma solidity 0.5.17; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; import "openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol"; import "./Escrow.sol"; interface IBeneficiaryContract { function __escrowSentTokens(uint256 ...
Transfers the role of drawee to another address. Can be called only by the contract owner.
function setDrawee(address newDrawee) public onlyOwner { require(newDrawee != address(0), "New drawee can not be zero address"); emit DraweeRoleTransferred(drawee, newDrawee); drawee = newDrawee; }
12,968,938