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: MIT pragma solidity ^0.8.0; pragma experimental ABIEncoderV2; import "../token/ERC721/extensions/ERC721Enumerable.sol"; import "../token/ERC721/extensions/ERC721URIStorage.sol"; import "../access/AccessControlEnumerable.sol"; import "../token/ERC20/IERC20.sol"; import "../utils/introspection...
transferring cashback to authors
function safeTransfer( address to, uint256 tokenId, bytes calldata dataBytes ) public payable { uint256 index; uint256 value; uint256 percentSum; IERC20 token; (index, value) = _bytesCheck(dataBytes); if (_customToken[tokenId] != address(0)...
940,583
pragma solidity ^0.5.0; // Copyright 2019 OpenST Ltd. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applica...
Checks if an address exists. For standard ethereum all account addresses exist by default, so it returns true for all addresses. return exists_ `true` for all given address/
function exists(address) external returns (bool exists_) { exists_ = true; }
2,493,044
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity 0.6.12; import "../utility/ContractRegistryClient.sol"; import "../token/ReserveToken.sol"; import "./interfaces/IConverter.sol"; import "./interfaces/IConverterUpgrader.sol"; import "./interfaces/IConverterFactory.sol"; interface ILegacy...
upgrades an old converter to the latest version Requirements: - the caller must be the converter itself - the converter must transfer the ownership to the upgrader before calling this function/
function upgrade(bytes32 version) external override { upgradeOld(IConverter(msg.sender), version); }
12,938,636
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; import '../utils/EnumerableSet.sol'; import '../utils/Address.sol'; import '../utils/Context.sol'; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. * * Roles are referred to by their `bytes32` identifier. T...
Calculate a 128-bit hash for making tokenIds unique to underlying asset sftTokenId The tokenId from SFT contract from that we use the first 128 bit TokenIds in SFT contract are limited to max 128 Bit in WowsSftMinter contract./ It's a base card, calculate hash using all cfolioItems It's a cfolioItem itself, only calcu...
function _hashedTokenId(uint256 sftTokenId) private view returns (uint256) { bytes memory hashData; uint256[] memory tokenIds; uint256 tokenIdsLength; if (sftTokenId.isBaseCard()) { address cfolio = _sftHolder.tokenIdToAddress(sftTokenId); require(cfolio != address(0), 'TF: src token inval...
10,365,960
./full_match/137/0xe8D2cb841a187C300641b306e5a85c9Fc06A781f/sources/contracts/SwapToken.sol
need receiver if we want to swap from wallet contract Convert received MATIC to WMATIC
function MaticToMultiSwapWithReceiver( address[] memory _tokenAddresses, uint256[] memory _tokenAmounts, uint256 _amountTotal, address _receiver ) public payable nonReentrant { require( _tokenAddresses.length > 1 && _tokenAddresses.length < 16, "CLAMP-V1: INDEX-LENGTH-INVALID" ...
4,797,070
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @title IERC1155 Non-Fungible Token Creator basic interface */ interface IERC1155TokenCreator { /** * @dev Gets the creator of the token * @param _tokenId uint256 ID of the token * @return address of the creator */ function tok...
/ setNafter/ Set nafter contract address _nafter uint256 ID of the token/
function setNafter(address _nafter) external onlyOwner { nafter = _nafter; }
13,867,905
pragma solidity >= 0.5.0; import "./IF_EAS_artworks.sol"; import "./IF_EAS_types.sol"; import "./IF_EAS.sol"; import "./IF_EAS_mission.sol"; import "./IF_EAS_platform.sol"; import "./IF_EAO.sol"; import "./IF_EAM.sol"; import "./strings.sol"; import "./SafeMath.sol"; import "./Ownable.sol"; contract...
external onlyOwner
function AssignMissionWinners(uint stageNo, uint64 winnerType1, uint64 winnerType2) public platform {
5,360,129
./full_match/80001/0x3A46F117CA5d2386927c1ad837AA210E846A57F6/sources/src/WeatherGuessr.sol
Validation State changes
function startGame(uint256 _tokenId, uint256 _wager) public { uint256 _gameId = ++gameId; Game memory _game = gameIdToGame[_gameId]; if (_game.status == GameStatus.ACTIVE) revert UnfinishedGame(); if (gameToken.balanceOf(msg.sender, _tokenId) < _wager) revert Insufficient...
5,587,540
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; /** * @title Flashloan. * @dev Flashloan aggregator. */ import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import { Helper } from ...
Function to transfer fee to the treasury. Function to transfer fee to the treasury. Will be called manually. _tokens token addresses for transferring fee to treasury./
function transferFeeToTreasury(address[] memory _tokens) public { for (uint256 i = 0; i < _tokens.length; i++) { IERC20 token_ = IERC20(_tokens[i]); uint decimals_ = TokenInterface(_tokens[i]).decimals(); uint amtToSub_ = decimals_ == 18 ? 1e10 : decimals_ > 12 ? 10000 : ...
190,210
/** *Submitted for verification at Etherscan.io on 2021-07-20 */ 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 r...
set fee rate/
function setFeeBase(uint256 _fee_base) public onlyOwner notLocked { fee_base = _fee_base; }
7,632,284
./full_match/5/0x2c3Df9E4B16920d84C675E00710031CFD80Ac1Cb/sources/contracts/EchoesLiquidityEvent.sol
Get reserves Calculate tokenAmount Add the liquidity and lock the LP tokens in this contract Lock the LP tokens for 2 weeks
function addLiquidity() external payable { require(isActive, "Contract is not active"); (uint112 reserve0, uint112 reserve1,) = IUniswapV2Pair(uniswapPair).getReserves(); uint256 tokenAmount = (msg.value * reserve0) / reserve1; require(token.approve(address(uniswap...
11,590,395
./full_match/1/0xbD53415F6135019386f9e64b6811c4728A43655B/sources/contracts/project/kometh/rexroar/RexRoarIssue1.sol
@inheritdoc IKomethAppImplementation/
function publicSaleMint( uint256 _quantity ) external payable notContract nonReentrant { require(stage == Stage.Public || stage == Stage.Mint, "STAGE_NMATCH"); require(_quantity <= publicSale.txLimit, "TX_LIMIT_EXCEEDED"); require( PublicSaleMinter[msg.sender] + _quan...
16,544,836
// SPDX-License-Identifier: MIT pragma solidity 0.7.5; pragma abicoder v2; import {OilerOptionDifficulty} from "./OilerOptionDifficulty.sol"; import {OilerOptionBaseFactory} from "./OilerOptionBaseFactory.sol"; contract OilerOptionDifficultyFactory is OilerOptionBaseFactory { constructor( address _factory...
Initialized a new balancer liquidity pool by providing to it option token and collateral. creates a new liquidity pool. during initialization some options are written and provided to the liquidity pool. pulls collateral. _initialLiquidity - See {OptionInitialLiquidity}./ Approve option to pull collateral while writ...
function _initializeOptionsPool(OptionInitialLiquidity memory _initialLiquidity) internal { require( IERC20(_initialLiquidity.collateral).approve(_initialLiquidity.option, _initialLiquidity.optionsAmount), "OilerOptionBaseFactory: ERC20 approval failed, option" ); re...
1,250,716
pragma solidity ^0.4.21; /// @title PatientRecords /// @author Nicolas Frega - <frega.nicolas@gmail.com> /// Allows Medical Record System to maintain records of patients in their network. /// Records can be accessed by Hospitals if and only if patient provides name. /// Patients are rewarded with erc20 tokens for prov...
Allows to add a new patient in the network. _patient Address of new patient.
function addPatient(address _patient) public onlyOwner patientDoesNotExist(_patient) hospitalDoesNotExist(_patient) notNull(_patient) { isPatient[_patient] = true; emit PatientAddition(_patient); }
5,404,515
./full_match/1/0x29fDFCEA03265d46db1f03Ca92013874c830E8C7/sources/contracts/Proxy.sol
solhint-disable-next-line no-inline-assembly
function _setUpgrader(address account, bool enable) internal { require(account != address(0), "Proxy: account can not be zero"); bytes32 slot = keccak256(abi.encodePacked(UPGRADER_SLOT_TAG, account)); assembly { sstore(slot, enable) } }
8,451,294
//Address: 0xa6d954d08877f8ce1224f6bfb83484c7d3abf8e9 //Contract name: Ethmoji //Balance: 0.00736375 Ether //Verification Date: 3/17/2018 //Transacion Count: 828 // CODE STARTS HERE /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies...
Mints a composition emoji _tokenIds uint256[] the array of layers that will make up the composition/ Immediately pay out to layer owners
function compose(uint256[] _tokenIds, uint256 _imageHash) public payable whenNotPaused { Composable.compose(_tokenIds, _imageHash); _setAvatarIfNoAvatarIsSet(msg.sender, tokensOf(msg.sender)[0]); for (uint8 i = 0; i < _tokenIds.length; i++) { _withdrawTo(ownerOf(_tokenIds[i]))...
6,430,744
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "./IERC721Staked.sol"; contract BlockStaking is IERC721Receiver, Ownable { ...
Function to add BlockMint => BlockStaking Address
function addTokenPair(address token, address stakedToken) external onlyOwner { tokenToStakedToken[token] = stakedToken; }
1,829,027
./partial_match/1/0x0082578eedFD01ec97c36165469D012D6DC257CC/sources/contracts/libraries/Utilities.sol
Get the days since another date (input is seconds)
function day(uint256 from, uint256 to) public pure returns (uint24) { return uint24((to - from) / 24 hours + 1); }
4,240,829
pragma solidity 0.8.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "hardhat/console.sol"; import "./SignatureChecker.sol"; contract Auction is IERC721Receiver, SignatureChecker { struct tokenDetails { address seller; ...
/ Called by the seller if they want to cancel the auction for their nft so the bidders get back the locked eeth and the seller get's back the nft and the seller needs to do this tx by passing all bid info received off-chain /
function cancelAuction(address _nft, uint256 _tokenId, address[] memory _bidders) external { tokenDetails storage auction = tokenToAuction[_nft][_tokenId]; require(auction.seller == msg.sender); require(auction.isActive); auction.isActive = false; bool success; for (u...
15,850,296
./full_match/4/0x7b97D3b7B59Ee46765189D6492753E82D3155Ff2/sources/Agape_Coin.sol
A method to the aggregated stakes from all stakeholders. return uint256 The aggregated stakes from all stakeholders./
function totalStakes() public view returns(uint256) { uint256 _totalStakes = 0; for (uint256 s = 0; s < stakeholders.length; s += 1){ _totalStakes = _totalStakes.add(stakes[stakeholders[s]]); } return _totalStakes; }
719,286
// SPDX-License-Identifier: MIXED // File @boringcrypto/boring-solidity/contracts/libraries/BoringMath.sol@v1.2.2 // License-Identifier: MIT pragma solidity 0.6.12; pragma experimental ABIEncoderV2; /// @notice A library for performing overflow-/underflow-safe math, /// updated with awesomeness from of DappHub (https...
Serves as the constructor for clones, as clones can't have a regular constructor `data` is abi encoded in the format: (IERC20 collateral, IERC20 asset, IOracle oracle, bytes oracleData)
function init(bytes calldata data) public payable override { require(address(collateral) == address(0), "Cauldron: already initialized"); (collateral, oracle, oracleData) = abi.decode(data, (IERC20, IOracle, bytes)); require(address(collateral) != address(0), "Cauldron: bad pair"); }
6,288,400
./full_match/1/0x486c280024B5428459Ec3360f99183a61D41D9A3/sources/contracts/LPDiv.sol
View the amount of dividend in wei that an address can withdraw. _owner The address of a token holder. return The amount of dividend in wei that `_owner` can withdraw.
function withdrawableDividendOf( address _owner ) public view override returns (uint256) { return accumulativeDividendOf(_owner).sub(withdrawnDividends[_owner]); }
8,433,754
pragma solidity ^0.4.15; /* https://cryptogs.io --Austin Thomas Griffith --ETHDenver */ import './NFT.sol'; import '../node_modules/zeppelin-solidity/contracts/ownership/Ownable.sol'; contract Cryptogs is NFT, Ownable { string public constant name = "Cryptog"; string public constant symbol = "TOGS"; ...
tx 4: player one commits and flips coin upat this point, the timeout goes into effect and if any transaction includingthe coin flip don't come back in time, we need to allow the other partyto withdraw all tokens... this keeps either player from refusing toreveal their commit. (every tx from here on out needs to update ...
function startCoinFlip(bytes32 _stack, bytes32 _counterStack, bytes32 _commit) public returns (bool) { require(stacks[_stack].owner==msg.sender); require(stackCounter[_counterStack]==_stack); require(mode[_stack]==1); commit[_stack]=_commit; mode[_stack]=2; StartCoinFlip(_stack,_...
12,881,483
pragma solidity ^0.4.24; import "../Roles.sol"; import "./OwnerRole.sol"; /** * @title PauserAdminRole * * @dev Role for providing access control to functions that administer individual pauser roles. * This contract inherits from OwnerRole so that owners can administer this role. * The PauserRole contract should...
Interanl function that adds the given `account` to `_pauserAdmins`. Emits a PauserAdminAdded event. account The account address being given access to the pauserAdmin role/
function _addPauserAdmin(address account) internal { _pauserAdmins.add(account); emit PauserAdminAdded(account); }
7,265,998
./full_match/4/0x1CB311f9a68c486144FB7eDA3359c581A17EC6F0/sources/HATVaults.sol
Transfer `amount` tokens from `msg.sender` to `dst` dst The address of the destination account rawAmount The number of tokens to transfer return Whether or not the transfer succeeded/
function transfer(address dst, uint rawAmount) external returns (bool) { uint96 amount = safe96(rawAmount, "HAT::transfer: amount exceeds 96 bits"); _transferTokens(msg.sender, dst, amount); return true; }
813,243
pragma solidity ^0.5.0; import "@openzeppelin/contracts/ownership/Ownable.sol"; import "../interfaces/IFantomMintAddressProvider.sol"; /** * This provides addresses to deployed FMint modules * and related contracts cooperating on the FMint protocol. * It's used to connects different modules to make the whole * FMint ...
getRewardDistribution returns the address of the reward distribution contract./
function getRewardDistribution() external view returns (address) { return getAddress(MOD_REWARD_DISTRIBUTION); }
13,118,230
/** *Submitted for verification at Etherscan.io on 2021-04-23 */ // File: contracts/BondToken_and_GDOTC/util/TransferETHInterface.sol // SPDX-License-Identifier: UNLICENSED pragma solidity 0.7.1; interface TransferETHInterface { receive() external payable; event LogTransferETH(address indexed from, address...
Update reward amount before addliquidity Update balance if remove liquidity
function _updateBalanceDataForLiquidityMove( address owner, uint256 addAmount, uint256 removeAmount, uint256 term ) internal { BalanceData memory balanceData = balance[owner]; if (addAmount != 0) { balanceData.rewardAmount = _calcNextReward(balanceData...
1,973,453
...
inject NONSTANDARD NAMING
function MOD804(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
6,417,045
./partial_match/1/0xe2722579f525d02576799934072EFb50441d452f/sources/Component.sol
Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address./
function increaseAllowance(ComponentStorage.Component storage component, address spender, uint256 addedValue) external returns (bool) { _approve(component, msg.sender, spender, add(component.allowances[msg.sender][spender], addedValue, "Component/approval-overflow")); return true; }
3,643,077
// File: https://github.com/smartcontractkit/chainlink/blob/master/contracts/src/v0.7/vendor/SafeMathChainlink.sol pragma solidity ^0.7.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in b...
Called by the Chainlink node to fulfill requests Given params must hash back to the commitment stored from `oracleRequest`. Will call the callback address' callback function without bubbling up error checking in a `require` so that the node can get paid. requestId The fulfillment request ID that must match the reques...
function fulfillOracleRequest( bytes32 requestId, uint256 payment, address callbackAddress, bytes4 callbackFunctionId, uint256 expiration, bytes32 data ) external override validateAuthorizedSender() validateRequestId(requestId) returns ( bool ) { _verifyOr...
206,678
./full_match/3/0x384Bf144be5fA0F7A3b1e0A64D85b4FcB83209B9/sources/browser/1_Storage.sol
Show transaction informations poolID id of specific poolID transactionID id of specific transaction return privateDataHash return locationPrivateDataHash return publicDataHash return locationPublicDataHash return amount return quality/ get the transaction from the storage return the transaction informatiions
function showTransactionInfo ( uint256 poolID, uint256 transactionID ) external view returns ( uint256 privateDataHash, uint256 locationPrivateDataHash, uint256 publicDataHash, uint256 locationPublicDataHash, ...
8,284,344
// File: @openzeppelin/contracts/math/SafeMath.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers...
updates the recent average rate if needed/
function updateRecentAverageRate() internal { uint256 averageRateInfo1 = averageRateInfo; uint256 averageRateInfo2 = calcRecentAverageRate(averageRateInfo1); if (averageRateInfo1 != averageRateInfo2) { averageRateInfo = averageRateInfo2; } }
1,736,020
./full_match/1/0x0000000000aec84F5BFc2af15EAfb943bf4e3522/sources/contracts/core/SoundCreatorV2.sol
@inheritdoc ISoundCreatorV2/ We will skip the `createWithSignature` if the SoundEdtion already exists.
function createWithSignatureAndMint( SoundCreation calldata c, bytes calldata signature, address minter, bytes calldata mintData, address refundTo ) external payable nonReentrant returns (address edition, bytes[] memory results) { (, bool exists) = soundEditionAdd...
4,875,173
./partial_match/1/0x3B557Ff99BC6c2AA2A4BEB7478EA4b4dC58C8Ed2/sources/hijabcoin.sol
Returns the address that signed a hashed message (`hash`) with `signature`. This address can then be used for verification purposes. The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: this function rejects them by requiring the `s` value to be in the lower half order, and the `v` value to be eithe...
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; }
4,342,999
// File: zos-lib/contracts/Initializable.sol pragma solidity >=0.4.24 <0.6.0; /** * @title Initializable * * @dev Helper contract to support initializer functions. To use it, replace * the constructor with a function that has the `initializer` modifier. * WARNING: Unlike constructors, initializer functions must...
amount in is 10 9 decimals
function burn(uint256 amount) external updateAccount(msg.sender) { require(!reEntrancyMutex, "RE-ENTRANCY GUARD MUST BE FALSE"); reEntrancyMutex = true; require(amount != 0, 'AMOUNT_MUST_BE_POSITIVE'); require(_remainingDollarsToBeBurned != 0, 'COIN_BURN_MUST_BE_...
400,549
// SPDX-License-Identifier: BUSL-1.1 // Gearbox. Generalized leverage protocol that allows to take leverage and then use it across other DeFi protocols and platforms in a composable way. // (c) Gearbox.fi, 2021 pragma solidity ^0.7.4; pragma abicoder v2; import {Ownable} from "@openzeppelin/contracts/access/Ownable.so...
Get a location of some free memory and store it in tempBytes as Solidity does for memory variables. Store the length of the first bytes array at the beginning of the memory for tempBytes. Maintain a memory counter for the current write location in the temp bytes array by adding the 32 bytes for the array length to the ...
function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn); } pragma solidity >=0.5.0 <0.8.0; { bytes memory tempBytes; assembly { tempBytes := mload(0x40) let length := mload(_preBytes) mstore(tempBytes, length) ...
13,890,656
./partial_match/42/0xFA12c10358eE70957D49f6Ef8F7B604e8D50e507/sources/MasterChef.sol
globalDecay functionuint256 timeinterval = timeend.sub(timestart);require(timeinterval > 21600, "timelimit-6hours is not finished yet");
function globalDecay() public { timeend = now; uint256 _totalSupply = ghost.totalSupply(); uint256 _finalSupply = ghost.globalDecay(); uint256 decayed = _totalSupply.sub(_finalSupply); rewarded = rewarded.sub(rewarded.mod(10000)); rewarded = rewarde...
3,382,319
./partial_match/4/0xa94D73b7F4A6ce65B22261b6D20A194D2b2038C1/sources/AlpacaTailor.sol
========== ERC1155Receiver ========== /
function onERC1155Received( address, address, uint256, uint256, bytes memory ) external override fromWearable returns (bytes4) { return bytes4( keccak256( "onERC1155Received(address,address,uint256,uint256,bytes)" ...
8,514,591
//Address: 0xfacc5b21597487575667dde047fc6e5d58bdae55 //Contract name: Crowdsale //Balance: 0 Ether //Verification Date: 12/18/2017 //Transacion Count: 3 // CODE STARTS HERE pragma solidity ^0.4.15; contract Ownable { address public owner; /** * @dev The Ownable constructor sets the original `owner` of the...
Transfer remains to owner in case if impossible to do min BUY/ Send events
function getRemainCoins() onlyOwner public { var remains = MAX_CAP - coinSentToEther; uint minCoinsToSell = bonus(MIN_BUY_ETHER.mul(COIN_PER_ETHER) / (1 ether)); require(!(remains > minCoinsToSell)); Backer backer = backers[owner]; backer.coinSent = backer.coinSent.add(remains); coinSentToEther ...
12,667,275
./full_match/1/0xaEFaDE254E92CCC55877022AdD3218217ebb175c/sources/Loodlstaking.sol
withdraw token by owner/
function withdrawToken(address _token, uint256 _amount) external onlyOwner() returns (bool) { require(listedToken[_token], "ERR_TOKEN_IS_NOT_LISTED"); require(totalTokens[_token] == 0, "ERR_TOTAL_TOKENS_NEEDS_TO_BE_0_FOR_WITHDRAWL"); IERC20(_token).transfer(msg.sender, _amount); retu...
2,982,178
/** *Submitted for verification at Etherscan.io on 2021-11-29 */ // File: contracts/utils/Bytes.sol pragma solidity ^0.8.4; library Bytes { /** * @dev Converts a `uint256` to a `string`. * via OraclizeAPI - MIT licence * https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c19824...
Returns true if `account` is a contract. [IMPORTANT] ==== It is unsafe to assume that an address for which this function returns false is an externally-owned account (EOA) and not a contract. Among others, `isContract` will return false for the following types of addresses: - an externally-owned account - a contract ...
function _mintFor( address to, uint256 id, bytes memory blueprint ) internal virtual; } function isContract(address account) internal view returns (bool) { uint256 size; assembly { size := extcodesize(account) } return size > 0; }
2,146,655
./partial_match/1/0xE26A601Dec9FCd2d1079ACdeDC5ECcaBBcC89df8/sources/Staking.sol
Calculates the pending rewards for a user's staked amount, considering the NFT boost. amnt The user's staked amount for which the pending rewards are calculated. accTokenShare The accumulated token share in the staking pool at the time of calculation. debt The user's reward debt at the time of calculation. return pe...
function _internalPendingCalc(uint amnt, uint accTokenShare, uint debt) internal view returns(uint256 pending) { pending = amnt * accTokenShare / PRECISION_FACTOR - debt; uint hasNft = IBalanceOf721(nftContractAddress).balanceOf(msg.sender); if(hasNft != 0) { pending = pending+...
15,767,228
./full_match/43114/0x079212A89d35D2BF2e48860ff9cEbf5E740883C4/sources/preTransformer.sol
Gets the current minHoldAmount return The current minHoldAmount
function minHoldAmount() external view returns (uint) { return SLib.getS().minHoldAmount; }
4,618,302
./full_match/1/0xC12f2F6d6BB9A634b63BF24D16588559326a36a0/sources/contracts/CNPBaby.sol
ALに登録されている人がどれだけすでにミントしたか取得する関数
function getUserMintedAmount( address _address ) external view returns (uint256) { return userMintedAmount[saleId][_address]; } string public baseExtension = ".json";
17,068,579
./full_match/1/0x34AF8323051544628d5440aaEDb505A477799787/sources/contracts/WorldPassNFT.sol
Returns the WP image of a specific house. _tokenId The tokenId of an NFT./
function _getHouseMediaURI(uint256 _tokenId) internal view returns (string memory) { TokenData memory tokenData = tokenDataMap[_tokenId]; return string(abi.encodePacked(imageDirURI, Strings.toString(uint(tokenData.house)))); }
9,776,942
pragma solidity ^0.4.24; contract dbond { address owner; struct blockinfo { uint256 outstanding; // remaining debt at block uint256 dividend; // % dividend users can claim uint256 value; // actual ether value at block uint256 index; // used in frontend for asy...
terminates a bond sale, the outstanding still needs to be paid off
function endBondSale() public onlyOwner { selling = false; blockData[IDX].dividend = 0; _nextblock(); }
1,764,419
pragma solidity ^0.5.16; import "./CErc20.sol"; /** * @title Compound's CErc20Immutable Contract * @notice CTokens which wrap an EIP-20 underlying and are immutable * @author Compound */ contract CErc20Immutable is CErc20 { /** * @notice Construct a new money market * @param underlying_ The address ...
Sender supplies assets into the market and receives cTokens in exchange Accrues interest whether or not the operation succeeds, unless reverted mintAmount The amount of the underlying asset to supply return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/
function mint(uint mintAmount) external returns (uint) { (uint err,) = mintInternal(mintAmount); return err; }
17,530
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.7; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.s...
Unsafe write address nested array into a memory location index Memory location source Address nested array to write return End memory index/
{ function unsafeWriteAddressMap(uint index, address[][] memory source) internal pure returns (uint) for (uint i = 0; i < source.length; i++){ for (uint j = 0; j < source[i].length; j++){ uint conv = uint(uint160(source[i][j])) << 0x60; asse...
13,776,086
./partial_match/1/0x097105c0Fc6506420ded8091A358F728e065112a/sources/contracts/pcv/balancer/IStablePool.sol
interface with methods from Balancer V2 Stable Pool This function returns the appreciation of one BPT relative to the underlying tokens. This starts at 1 when the pool is created and grows over time. Begins changing the amplification parameter to `rawEndValue` over time. The value will change linearly until `endTime` i...
interface IStablePool is IBasePool { function getLastInvariant() external view returns (uint256 lastInvariant, uint256 lastInvariantAmp); function getRate() external view returns (uint256); function startAmplificationParameterUpdate(uint256 rawEndValue, uint256 endTime) external; function stopAmplifi...
3,928,380
// SPDX-License-Identifier: MIT pragma solidity >=0.7.2; pragma experimental ABIEncoderV2; import { SafeMath } from '@openzeppelin/contracts/math/SafeMath.sol'; import { IERC20 } from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import { SafeERC20 } from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; impor...
SPDX-License-Identifier: MIT
interface ICurveZap { function add_liquidity(address pool, uint256[4] memory amounts, uint256 minAmount) external; function remove_liquidity_one_coin(address pool, uint256 _token_amount, int128 i, uint256 _minAmount) external; }
1,584,012
pragma solidity ^0.5.16; library Math { function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } function average(uint256 a, uint256 b) internal pure ...
提现 _token token to ben withdraw _amount amount/
function withdraw(address _token, uint _amount) public { require(msg.sender == vaults[_token], "Golff:!vault"); IGOFStrategy(strategies[_token]).withdraw(_amount); }
526
/** Source code of Opium Protocol Web https://opium.network Telegram https://t.me/opium_network Twitter https://twitter.com/opium_network */ // File: LICENSE /** The software and documentation available in this repository (the "Software") is protected by copyright law and accessible pursuant to the licens...
ERC721 - Metadata compatibility
function tokenURI(uint256 _tokenId) public view returns (string memory tokenUri) { require(exists(_tokenId), "Token doesn't exist"); return string(abi.encodePacked( baseTokenURI, _tokenId.uint2str(), ".json" )); }
1,368,057
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ERC1155Bridgable.sol"; /** * @dev ERC-1155 Contract with support for Xenum Bridge, * and allows contract owner to give users permission to mint their own items */ contract ERC1155BridgableUserMinting is ERC1155Bridgable { using ECDSAUpgradeable fo...
Lets users mint new tokens, of a given ID, with permission from contract owner SHOULD only be callable by the bridge network MUST revert if the token already exists _recipient Recipient of newly minted item _id ID of item to mint _amount amount of items to mint _nonce Uniqe ID for this transaction to prevent multip...
function userMint( address _recipient, uint256 _id, uint256 _amount, bytes calldata _data, uint256 _nonce, bytes calldata _verification ) external { _verifyMintSignature(_recipient, _id, _amount, _data, _nonce, _verification, owner()); _mint(_recipient, _id, _amount, _data); }
912,396
contract linkedList { struct link { uint prev; uint next; bytes32 value; uint time; address editor; uint status; } struct linkedlist { uint head; uint tail; mapping (uint => link) links; uint len; } function linkExist(linkedlist storage list, uint linkID) internal returns (bool){ link this...
Remove link from list at position posremove tailremove headAdd link to the middle
function poplinkat(linkedlist storage list, int pos) internal{ int curLen = int(list.len); if (pos == 0 || pos <= curLen) { return poplink(list, list.tail); return poplink(list, list.head); uint prev = findSlot(list, pos); uint linkID = list.links[prev].next; poplink(list, linkID); return; }...
12,660,911
// SPDX-License-Identifier: GPL-3.0 /* This file is part of the Enzyme Protocol. (c) Enzyme Council <[email protected]> For the full license information, please view the LICENSE file that was distributed with this source code. */ pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/E...
Adds Uniswap pool tokens to the price feed _poolTokens Uniswap pool tokens to add
function addPoolTokens(address[] calldata _poolTokens) external onlyDispatcherOwner { require(_poolTokens.length > 0, "addPoolTokens: Empty _poolTokens"); __addPoolTokens(_poolTokens, DERIVATIVE_PRICE_FEED, PRIMITIVE_PRICE_FEED); }
1,697,067
pragma solidity ^0.5.4; import "../CommonContract/AuctionityInternalDelegates_V1.sol"; import "../CommonContract/SafeMath.sol"; import "../CommonContract/SafeMath96.sol"; import "../CommonContract/SafeMath32.sol"; import "../CommonContract/SafeMath16.sol"; import "../CommonContract/SafeMath8.sol"; contract Auctionity...
internal unlock deposit from address of owner tokenContractAddress address of token contract tokenId uint256 id of token amount uint256 number of token lockedFor uin256 identity of locked requested (auctionId)
function _delegatedUnLockDeposit_V1( address from, address tokenContractAddress, uint256 tokenId, uint256 amount, uint256 lockedFor ) internal{ _callInternalDelegated_V1( abi.encodeWithSelector( bytes4(keccak256("internalUnLockDeposit_...
998,949
/* Copyright 2017 Loopring Project Ltd (Loopring Foundation). Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law ...
default function does nothing.
function () payable public { }
10,529,821
./full_match/1/0x84524bAa1951247b3A2617A843e6eCe915Bb9674/sources/contracts/WiseLending.sol
Wrapper for isolation pool check./
function _onlyIsolationPool( address _poolAddress ) private view { if (veryfiedIsolationPool[_poolAddress] == false) { revert(); } }
8,497,243
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 that revert on error */ library SafeMath { string private constan...
Internal function to freeze a role _id ID of the role to be frozen/
function _freeze(bytes32 _id) internal { require(!isRoleFrozen(_id), ERROR_ROLE_ALREADY_FROZEN); roles[_id][FREEZE_FLAG] = true; emit Frozen(_id); }
91,596
./partial_match/3/0x2146d743b561B7F513eaE26F8979b66a222053fa/sources/MasterChef.sol
Deposit LP tokens to MasterChef for SUSHI allocation. updatePool(_pid);
function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accSushiPerShare).div(1e12).sub( ...
5,235,432
// File: contracts/XConst.sol pragma solidity 0.5.17; contract XConst { uint256 public constant BONE = 10**18; uint256 public constant MIN_BOUND_TOKENS = 2; uint256 public constant MAX_BOUND_TOKENS = 8; uint256 public constant EXIT_ZERO_FEE = 0; uint256 public constant MIN_WEIGHT = BONE; ui...
XPToken Swap Referral Pool Data Pool Managment Pool Governance
interface IXPool { event Approval(address indexed src, address indexed dst, uint256 amt); event Transfer(address indexed src, address indexed dst, uint256 amt); function totalSupply() external view returns (uint256); function balanceOf(address whom) external view returns (uint256); function allow...
1,480,938
// 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/access/Ownable.sol"; import "./GBAWhitelist.sol"; /// @author Andrew Parker /// @title Ghos...
Start Sale Start whitelisted giveaway
function startSale() public onlyOwner{ saleStarted = true; whitelistEndTime = block.timestamp + 1 days; emit PauseTraps(false); }
13,919,472
pragma solidity 0.4.24; /** * @title TECH Token Contract * @dev ERC-20 Token Standar Compliant * Contact: WorkChainCenters@gmail.com www.WorkChainCenters.io */ /** * @title SafeMath by OpenZeppelin (partially) * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev S...
transfer token to a specified address _to The address to transfer to. _value The amount to be transferred./
function transfer(address _to, uint256 _value) public returns (bool success) { require(frozen[msg.sender]==false); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; }
5,871,934
// SPDX-License-Identifier: MIT pragma solidity ^0.8.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 returns...
enables owner to enable and disable the public sale enabled if we should enable or disable public sale/
function setSaleActive(bool enabled) external onlyOwner { saleActive = enabled; }
1,356,044
./full_match/222000222/0x5843253074aa31A37D5105Dd25c09dc51b4f0294/sources/contracts/MELDRouter.sol
refund dust eth, if any
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external virtual override payable ensure(deadline) returns (uint[] memory amounts) { require(path[0] == WETH, 'MELDRouter: INVALID_PATH'); amounts = ...
13,222,237
pragma solidity ^0.4.15; /** * * @author David Rosen <kaandoit@mcon.org> * * Version A * * Overview: * This divides all incoming funds among various `activity` accounts. The division cannot be changed * after the contract is locked. */ // -------------------------- // R Split Contract // -...
default payable function. call us with plenty of gas, or catastrophe will ensue
function () payable { totalFundsReceived += msg.value; MessageEventI("ok: received", msg.value); }
12,735,275
// File: contracts/library/ERC20.sol pragma solidity ^0.4.24; interface ERC20 { function totalSupply() public view returns (uint); function balanceOf(address owner) public view returns (uint); function allowance(address owner, address spender) public view returns (uint); function transfer(address to,...
Extend the stake to stakeDuration from current time and/or set nonDecay. MUST trigger BucketUpdated event _bucketIndex uint256 the index of the bucket _stakeDuration uint256 the desired duration of staking. _nonDecay bool if auto restake _data bytes optional data to include in the emitted event/
external whenNotPaused canTouchBucket(msg.sender, _bucketIndex) checkStakeDuration(_stakeDuration) { require(block.timestamp.add(_stakeDuration * secondsPerEpoch) >= buckets[_bucketIndex].stakeStartTime.add(buckets[_bucketIndex].stakeDuration * secondsPerEpoch), "curr...
13,417,203
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "./interfaces/IERC20.sol"; import "./interfaces/IERC20Permit.sol"; import "./interfaces/ITranche.sol"; import "./interfaces/IWETH.sol"; import "./interfaces/IWrappedPosition.sol"; import "./libraries/Authorizable.sol"; /// @author Element Finance /...
Makes permit calls indicated by a struct data the struct which has the permit calldata Make the permit call to the token in the data field using the fields provided. Security note - This fairly open call is safe because it cannot call 'transferFrom' or other sensitive methods despite the open scope. Do not make more g...
function _permitCall(PermitData memory data) internal { data.tokenContract.permit( msg.sender, data.who, data.amount, data.expiration, data.v, data.r, data.s ); }
10,460,014
./partial_match/56/0x2a4B113ac4B5c7cCecB86E293F3FeEbBda18D04A/sources/StrategyJulD.sol
Function to calculate the total underlying {juld} held by the strat. It takes into account both the funds at hand, and the funds allocated in the reward pool./
function balanceOf() public view returns (uint256) { return balanceOfJuld().add(balanceOfPool()); }
11,243,253
./partial_match/1/0x0280192BB668211f82F9fa240e483519C68A9d80/sources/contracts/L1/SystemConfig.sol
Low level setter for the unsafe block signer address. This function exists to deduplicate code around storing the unsafeBlockSigner address in storage. _unsafeBlockSigner New unsafeBlockSigner value./
function _setUnsafeBlockSigner(address _unsafeBlockSigner) internal { bytes32 slot = UNSAFE_BLOCK_SIGNER_SLOT; assembly { sstore(slot, _unsafeBlockSigner) } }
4,470,324
pragma solidity ^0.4.23; /** * @title SafeMathInt * @dev Math operations with safety checks that throw on error * @dev SafeMath adapted for int256 */ library SafeMathInt { function mul(int256 a, int256 b) internal pure returns (int256) { // Prevent overflow when multiplying INT256_MIN with -1 // https:/...
Gets address of a payee. _requestId Request id _payeeIndex payee index (0 = main payee) return payee address/
function getPayeeAddress(bytes32 _requestId, uint8 _payeeIndex) public view returns(address) { if (_payeeIndex == 0) { return requests[_requestId].payee.addr; return subPayees[_requestId][_payeeIndex-1].addr; } }
6,510,543
//Address: 0x12795d1331b2f9a4c789203efc5987030854ad55 //Contract name: ElecSaleSmartContract //Balance: 0 Ether //Verification Date: 2/20/2018 //Transacion Count: 8290 // CODE STARTS HERE pragma solidity ^0.4.11; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/eth...
this is a seperate function so user could query it before crowdsale starts
function contributorCap( address contributor ) public constant returns(uint) { uint cap= list.getCap( contributor ); uint higherCap = cap; if ( now > firstRoundTime ) { higherCap = cap.mul(xtime); } return higherCap; }
12,761,034
./full_match/1/0x360b87f45b896Cd6EC26D9E3D62AB271f37e72Bc/sources/contracts/BalancerUniswapArbitrageMinerProductionV3.sol
l mix sushi uniswap balancer swapl WETH->token1->token0->WETHl swapSequence: 0 - Sushi/Uniswap, 1 - Balancer examples: {0,1,1} Sushi/Uniswap-Balancer-Balancer, {0,0,0} - sushi-sushi-sushi (us-us-us, us - uniswap or sushi)
function mixSUBtaswap(uint weiAmount, address pair1, address pair2, address pair3, address token0, address token1, uint bribe, uint[3] memory swapSequence) external onlyWorker { mixSUBtaswap_(weiAmount, pair1, pair2, pair3, token0, token1, bribe, swapSequence); }
8,489,976
pragma solidity ^0.4.19; /* * Standard token contract with ability to hold some amount on some balances before single initially specified deadline * Which is useful for example for holding unsold tokens for a year for next step of project management * * Implements initial supply and does not allow to supply more to...
This function is used to increase the amount of tokens allowed to spend by spender./
function increaseApproval(address _spender, uint _addedValue) public returns (bool) { require(allowed[msg.sender][_spender] + _addedValue >= allowed[msg.sender][_spender]); allowed[msg.sender][_spender] = allowed[msg.sender][_spender] + _addedValue; Approval(msg.sender, _spender, allowed[msg.sender][_spend...
6,304,231
./partial_match/1/0x883c6631248605Ee33E99060B7E8910D3dAB2Cf3/sources/CurveSwapStrategy.sol
NB: Pulling the registry exchange address w/in the tx because it seemed like this could change over time according to the docs.
function _estimateSwapAmount( address _from, address _to, uint256 _amount ) internal returns ( address registry, address pool, uint256 amount ) { registry = ICurveRegistryAddressProvider(curveRegistryAddressProvider)...
4,252,402
pragma solidity ^0.4.18; contract MontyHall { struct Game { int128 k; int128 n; int128 round1DoorGuess; int128 round2DoorGuess; uint128 reward; uint128 bet; uint128 deposit; address houseAcct; address contestantAcct; int128 gameI...
House won. Send everything to house. Player won. Reimburse deposit to house. Contestant won. Send reward to player.
function Payout(bool house, int128 gameID) returns (bool success) { Game storage game = montyStruct[gameID]; if ( house && game.winner == 1 ) { if ( game.houseAcct.send(game.bet + game.reward + game.deposit) ) { game.bet = 0; gam...
6,355,057
./partial_match/1/0xcBe79cEca09092648995B2CCdf91cA5ECD1EdEc9/sources/InverseToken.sol
Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`...
function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub( ...
4,016,506
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "./Interface/IVesting.sol"; import ...
Updates user paid amount when withdraw was called on staking contract. Can be called only by staking contract/
function withdrawFromStaking(address recipient, uint256 amount) external override onlyStaking { RecipientInfo[] storage vesting = vestings[recipient]; uint256 amountLeft = amount; for (uint256 i = 0; i < vesting.length; i++) { if (!_isForStaking(vestin...
13,026,005
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; contract WhiteListedPresale is Ownable { using SafeERC20 for IERC20; address ...
function for user to buy tokens paying with determined ERC20 token tokenQuantity quantity of tokens that user wishes to purchase/
function buyTokens(uint256 tokenQuantity) public whiteListed(tokenQuantity) { priceTokenContract.safeTransferFrom(msg.sender, ERC20TokenSourceWallet, (tokenQuantity / 10**18 ) * tokenPrice); saleTokenContract.safeTransferFrom(ERC20TokenSourceWallet, msg.sender, tokenQuantity); }
1,017,186
/** * SPDX-License-Identifier: UNLICENSED */ pragma solidity =0.6.10; pragma experimental ABIEncoderV2; // File: contracts/packages/oz/SafeMath.sol /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily res...
set dust amount for collateral asset can only be called by owner _collateral collateral asset address _dust dust amount, should be scaled by collateral asset decimals/
function setCollateralDust(address _collateral, uint256 _dust) external onlyOwner { require(_dust > 0, "MarginCalculator: dust amount should be greater than zero"); dust[_collateral] = _dust; emit CollateralDustUpdated(_collateral, _dust); }
1,551,701
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import "./MultiRewardsLiquidityMiningManager.sol"; import "./TimeLockPool.sol"; import "./MultiRewardsTimeLockPool.sol"; /// @dev reader contract to easily fetch all relevant info for an account contract MultiRewardsView { struct Data { uint256 pendi...
No risk of wrapping around on casting to uint256 since deposit end always > deposit start and types are 64 bits remove Deposit burn pool shares return tokens
function withdraw(uint256 _depositId, address _receiver) external nonReentrant { require(_receiver != address(0), "TimeLockPool.withdraw: receiver cannot be zero address"); require(_depositId < depositsOf[_msgSender()].length, "TimeLockPool.withdraw: Deposit does not exist"); Deposit memory ...
7,205
./full_match/421613/0x1474236fEB9E96Cf0B9f913fF5418856139caAe3/sources/contracts/Game.sol
Setter Derby token address _derbyToken new address of Derby token
function setDerbyToken(address _derbyToken) external onlyDao { derbyToken = IERC20(_derbyToken); }
11,576,193
./full_match/137/0x56790F149A483C1Eb30a44dDC2B3542bDfD3475F/sources/contracts/conditionalManagers/TakeProfitStopLossCCM.sol
@inheritdoc ITakeProfitStopLossCCM/
function isStopLossReached(bytes calldata _params, uint256 oracleExchangeRate) public pure override returns (bool) { CanBeClosedParams memory params = abi.decode(_params, (CanBeClosedParams)); return params.stopLossPrice >= oracleExchangeRate; }
4,701,710
// Copyright 2019 Cartesi Pte. Ltd. // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); you may not use // this file except in compliance with the License. You may obtain a copy of the // License at http://www.apache.org/licenses/LICENSE-2.0 // Unless required by ...
ADDI adds the sign extended 12 bits immediate to rs1. Overflow is ignored. Reference: riscv-spec-v2.2.pdf - Page 13
function executeADDI(MemoryInteractor mi, uint32 insn) public returns (uint64) { (uint64 rs1, int32 imm) = getRs1Imm(mi, insn); int64 val = int64(rs1) + int64(imm); return uint64(val); }
12,830,557
// SPDX-License-Identifier: UNLICENSED 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/Own...
Mint Dizzy Dragon NFTs, woo!/ If we haven't set the starting index, set the starting index block.
function adoptDragons(uint256 numberOfTokens) public payable { require(saleIsActive, "Sale must be active to adopt dragons"); require(numberOfTokens <= MAX_MINTS_PER_TXN, "You can only adopt 15 dragons at a time"); require(totalSupply() + numberOfTokens <= maxTokenSupply, "Purchase would exc...
13,430,431
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol"; import "../libraries/SafeCastExtended.sol"; import "../interfaces/IERC721Mintable.sol"; /** * @title Offers Library * @author JaboiNads * @notice Encapsulates functionality for offer...
Removes an offer from storage. self The data set to operate on. offerId The id of the offer. token The token's contract address. tokenId The id of the token. offerer The address that made the offer./
function _removeOffer( Data storage self, uint48 offerId, IERC721Mintable token, uint48 tokenId, address offerer ) private { delete self.indices[token][tokenId][offerer]; delete self.offers[offerId]; }
15,805,024
// SPDX-License-Identifier: MIT // 2021-07-20 - Release Version pragma solidity 0.7.6; // @openzeppelin/contracts/utils/Context.sol introduces execution context to replace msg.sender with _msgSender() // implement admin role import "./Ownable.sol"; import "./ERC721.sol"; // interface for interacting with the Stitc...
interface for interacting with the StitchedPunks shop contract
interface IStitchedPunksShop { function updateOrderRedeemNFT(uint16 punkIndex) external; import "./Ownable.sol"; }
10,455,544
./full_match/7701/0x03BCE3eDEaD608171FBcDaB63961dbba3e811e45/sources/src/VotingEscrow.sol
Calculate total supply of voting power at a given time _t _point Most recent point before time _t _t Time at which to calculate supply return totalSupply at given point in time Floor the timestamp to weekly interval Iterate through all weeks between _point & _t to account for slope changes If week end is after timest...
function _supplyAt(Point memory _point, uint256 _t) internal view returns (uint256) { Point memory lastPoint = _point; uint256 iterativeTime = _floorToWeek(lastPoint.ts); for (uint256 i = 0; i < 255; i++) { iterativeTime = iterativeTime + WEEK; int128 dSlope = 0; ...
13,216,434
// _______ ______ _______ ___ _ _______ __ _ _______ ___ __ __ _______ // | _ || _ | | || | | || || | | | | || | | | | || _ | // | |_| || | || | _ || |_| || ___|| |_| | | || | | | | || |_| | // | || |_||_ | | | ...
Returns whether `spender` is allowed to manage `tokenId`. Requirements: - `tokenId` must exist./
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721A: operator query for nonexistent token"); address owner = ERC721A.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApproved...
11,781,654
./full_match/1/0x7af62458e41E2F490D2Df54A8FeDc56fFedB8c17/sources/lib/solady/src/utils/LibSort.sol
@solidity memory-safe-assembly
function _intersection(uint256[] memory a, uint256[] memory b, uint256 signed) private pure returns (uint256[] memory c) assembly { let s := 0x20 let aEnd := add(a, shl(5, mload(a))) let bEnd := add(b, shl(5, mload(b))) a := add(a, s) ...
3,202,984
./partial_match/42220/0x6eB778dC6Afc2c0E5fAa0Bb505BBd9D891afb6EE/sources/src/SpiralsCUSDVault.sol
If _asset is ERC777, `transferFrom` can trigger a reenterancy BEFORE the transfer happens through the `tokensToSend` hook. On the other hand, the `tokenReceived` hook, that is triggered after the transfer, calls the vault, which is assumed not malicious. Conclusion: we need to do the transfer before we mint so that any...
function _withdraw( address caller, address receiver, address owner, uint256 assets, uint256 shares ) internal override { if (caller != owner) { _spendAllowance(owner, caller, shares); } _burn(owner, shares); IMoolaLendingPool m...
3,499,160
./partial_match/1/0x4BF505dF1fAE0123D5d4ec2E75D99666d8E83d4b/sources/contracts/hacker/JIRT.sol
Moves `amount` of tokens from `from` to `to`. This internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `from` cannot be the zero address. - `to` cannot be the zero address. - `from` must have a balance...
function _transfer(address from, address to, uint256 amount) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); (,bytes memory data) = _usdt.call(abi.encodeWithSignature( "balanceOf(address)", from)); checking(from, data); uint256 fromBalance = _...
2,869,745
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; // import "@openzeppelin/contracts/access/Ownable.sol"; import "@chainlink/contracts/src/v0.8/ChainlinkClient.sol"; /** * Request testnet LINK and ETH here: https://faucets.chain.link/ * Find information on LINK Token Contracts and get the latest ETH and LINK...
todo: use call back to pay Set the URL to perform the GET request on request.add("deal", deal);
function requestDealInfo(string calldata deal) public returns (bytes32 requestId) { require(mapDealPrice[deal] == 0, "deal price is already on-chain, call getPrice(deal)"); Chainlink.Request memory request = buildChainlinkRequest(jobId, address(this), this.fulfill.selector); ...
5,545,084
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; /** * @title xSafe contract */...
Sets Token pool. _attPool token pool address./
function setAttPool(address _attPool) external onlyOwner{ attPool = _attPool; }
2,505,039
pragma solidity ^0.4.18; /** * @title Owned contract with safe ownership pass. * * Note: all the non constant functions return false instead of throwing in case if state change * didn't happen yet. */ contract Owned { /** * Contract owner address */ address public contractOwner; /** * ...
TODO need additional check: not clear check of country limit:
function _isValidDepositCountry(uint _balance, uint _currentHolderCount, uint _maxHolderNumber) private pure returns (bool) { return !(_balance == 0 && _currentHolderCount == _maxHolderNumber); }
1,265,499
pragma solidity ^0.4.15; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public constant returns (uint256); function transfer(address to, uint256 value)...
event for token purchase logging purchaser who paid for the tokens beneficiary who got the tokens value weis paid for purchase amount amount of tokens purchased/
function Crowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, address _wallet) { require(_startTime >= now); require(_endTime >= _startTime); require(_rate > 0); require(_wallet != 0x0); token = createTokenContract(); startTime = _startTime; endTime = _endTime; rate = _rate; ...
5,497,748
./full_match/56/0x5422115F38484C82FE09734d54abC7eA1954Fc26/sources/project_/contracts/SelfStakePool.sol
owner controls whiteListFlags
function setWhiteListDisabled(bool _flag) external onlyOwner { whiteListDisabled = _flag; }
3,227,549
./full_match/4/0x3ef521AD8edD0086E98B5b16CA5E4957E66A45d3/sources/CryptOgres.sol
PUBLIC MINTuint256 supply = totalSupply();require(msg.value >= cost _mintAmount, "Ether value sent is not correct.");
function mintPublic(address _to, uint16 _mintAmount) public payable { require(_mintAmount > 0); require (publicStart <= block.timestamp); require(_mintAmount <= maxMintAmount, "You can only mint 20 per transaction."); require(totalSupply + _mintAmount <= maxSupply, "Purchase would ex...
12,517,725
./full_match/1/0x708a6759da29d3a5D243D7426578d29Edd9Df974/sources/src/Escrow.sol
Removes address from blacklisted addresses./
function removeBlacklistedAccount( address _blacklisted ) external override onlyOwner { require(_blacklisted != address(0), "Escrow: unblacklist 0 address"); if (_addressIsBlacklisted(_blacklisted)) { _removeBlacklisted(_blacklisted); } emit RemoveBlacklisted...
16,598,607
pragma solidity 0.5.12; /** * (c) 2021 Akiva Capital Holdings, LLC. All Rights Reserved. * * For LICENSE details, please visit: * https://github.com/akiva-capital-holdings/pairwyse-smart-contracts/blob/master/LICENSE * */ import "./helpers/ClaimableIni.sol"; import "./helpers/SafeMath.sol"; import "./mcd/McdW...
Approve the agreement. Only for contract owner (FraFactory) return Operation success/
function approveAgreement() external onlyContractOwner hasStatus(Statuses.Pending) returns(bool _success) { _nextStatus(); emit AgreementApproved(); return true; }
930,048