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.6.0; import "./TendiesBox.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract TendiesBoxWithERC20 { IERC20 public erc20Contract; TendiesBox public tendiesBoxContract; address payable withdrawAddress; uint256 perPackErc20Distribution; constru...
Make sure they have packs to open and we have enough tokens to distribute
function open( uint256 _boxId, uint256 _amount ) external { uint256 balance = tendiesBoxContract.balanceOf(msg.sender, _boxId); require(balance >= _amount, "Not enough boxes to open"); require(perPackErc20Distribution <= erc20Contract.balanceOf(address(this)), "Not enough tokens for swap")...
1,017,975
pragma solidity ^0.8.5; // SPDX-License-Identifier: MIT interface IERC20 { /** * @dev Returns the total tokens supply */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) e...
calculates liquidity fee tokens to be deducted/
function calculateLiquidityFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_totalDeductableFee).div( 10**3 ); }
14,473,020
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; pragma abicoder v2; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol"; import "@openzepp...
Returns token0 amount in token0Decimals/
function getToken0AmountInNativeDecimals(uint256 amount) private view returns (uint256) { return UniswapLibrary.getToken0AmountInNativeDecimals( amount, token0Decimals, token0DecimalMultiplier ); }
10,200,424
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.0 <0.9.0; contract Token { // total supply of tokens uint public totalSupply = 10000; // public name of token like 'Bitcoin' string public name = "My Token"; // symbol of tokejn, like 'BTC' string public symbol = "TKN"; // defines s...
spender is allowed to spend the value from the sender emit the event return success
function approve(address spender, uint value) public returns(bool) { allowance[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; }
13,006,571
pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; /* * Merkle Tree Utilities for Rollup */ contract RollupMerkleUtils { /* Structs */ // A partial merkle tree which can be updated with new nodes, recomputing the root struct SparseMerkleTree { // The root bytes32 root; uint...
Get the parent of two children nodes in the tree _left The left child _right The right child return The parent node/
function getParent(bytes32 _left, bytes32 _right) internal pure returns(bytes32) { return keccak256(abi.encodePacked(_left, _right)); }
5,448,937
pragma solidity 0.4.25; contract ERC20Interface { function totalSupply() public constant returns(uint); function balanceOf(address tokenOwner) public constant returns(uint balance); function allowance(address tokenOwner, address spender) public constant returns(uint remaining); function transfer(...
Pay out requisite `virtual' dividends. Fire logging event.
function reinvest() dividendHolder() public { require(regularPhase); uint _dividends = myDividends(false); address _customerAddress = msg.sender; payoutsTo_[_customerAddress] += (int256)(_dividends * magnitude); _dividends += referralBalance_[_customerAddress]; referralBalance_[_customer...
6,358,970
./full_match/137/0xf1B4FC3e438c62216CC581C206EC76D59347a148/sources/contracts/GamePot.sol
called by a game controller to end a game leaderboard - a list of wallets in order of descending score requires GAME_CONTROLLER role Figure out the prize pool
function endGame(address[] calldata leaderboard) public { require(hasRole(GAME_CONTROLLER_ROLE, msg.sender), "Only an address with the GAME_CONTROLLER role can do this"); require(gameState == GameState.PLAYING, "Can only start a game from the PLAYING state"); uint prizePool = 0; for(uint i =...
4,716,243
./partial_match/5/0x5E39DcDB56852C537021058319A5494d2B6ff4D4/sources/ERC20_Fountain.sol
transfers tokens from one address to another make sure sending address has requested tokensupdate allowance (reduce it by tokens to be sent)make the transfer internally
function transferFrom(address fromAddress, address toAddress, uint256 amountTokens) checkTransferApproved(fromAddress , amountTokens) external returns (bool) { require( (amountTokens <= tokenBalanceLedger_[ fromAddress ]), "ERC20: Transfer not allowed - insufficient funds available." ); uint...
16,876,320
./full_match/5/0x04996Bf06a0654C8299041086115fbB0B836683f/sources/project_/contracts/HuxleyComicsIssue4.sol
Updates value of 'canRedeemCopy' _value New value of 'canRedeemCopy'/
function setCanRedeemCopy(bool _value) external onlyOwner { canRedeemCopy = _value; }
1,946,792
./partial_match/1/0xf1Bf0Cd65B741872bC3fE506b524f1c927965B3c/sources/src/libraries/codec/ChunkCodec.sol
Return the number of transactions in current block. blockPtr The start memory offset of the block context in memory. return _numTransactions The number of transactions in current block.
function numTransactions(uint256 blockPtr) internal pure returns (uint256 _numTransactions) { assembly { _numTransactions := shr(240, mload(add(blockPtr, 56))) } }
15,709,096
pragma solidity 0.4.24; interface ERC820ImplementerInterface { /// @notice Contracts that implement an interferce in behalf of another contract must return true /// @param addr Address that the contract woll implement the interface in behalf of /// @param interfaceHash keccak256 of the name of the interfac...
Sets the contract that will handle a specific interface; only a `manager` defined for that address can set it. ( Each address is the manager for itself until a new manager is defined) _addr Address that you want to define the interface for (if _addr == 0 them `msg.sender` is assumed) iHash SHA3 of the name of the ...
function setInterfaceImplementer(address _addr, bytes32 iHash, address implementer) public { address addr = _addr == 0 ? msg.sender : _addr; require(getManager(addr) == msg.sender); require(!isERC165Interface(iHash)); if ((implementer != 0) && (implementer!=msg.sender)) { ...
5,864,271
./full_match/80001/0x4A8F7b3f9DF6628F6C528E80a65AaC92093DeB37/sources/project_/contracts/Factory.sol
normally 2% to factory and x% to creator of collection
function createNewCollection( string memory _name, string memory _symbol, string memory _uri, uint256 royalty_ ) public returns (address) { address[] memory payees_ = new address[](2); uint256[] memory shares_ = new uint256[](2); uint256 totalRoyalty = (fa...
5,651,614
pragma solidity ^0.4.11; contract Owned { address public owner; function Owned() { owner = msg.sender; } modifier onlyOwner() { require(msg.sender == owner); _; } function setOwner(address _newOwner) onlyOwner { owner = _newOwner; } } ...
manually offer tokens to channel since the settlement may be delayed, so it's allowed in closed stageshould not exceed limit
function offerToChannel(address _channelAccount, uint256 _venAmount) onlyOwner { Stage stg = stage(); require(stg == Stage.Early || stg == Stage.Normal || stg == Stage.Closed); soldOut.channels = _venAmount.add(soldOut.channels).toUINT120(); require(soldOut.channels <= channelsLimi...
7,214,580
pragma solidity ^0.6.12; //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // // LiquidityZAP - BalancerZAP // Copyright (c) 2020 deepyr.com // // BalancerZAP takes ETH and converts to a Balancer Pool Tokens (BTP). // // This program is free software: you can redistribute it and/or modify // ...
Converts ETH to Balancer Pool Tokens (BPT)/
function addLiquidityETHOnly(address payable to) public payable { require(to != address(0), "Invalid address"); uint256 buyAmount = msg.value; require(buyAmount > 0, "Insufficient ETH amount"); (uint256 reserveWeth, uint256 reserveTokens) = getPairReserves(); uint256 outTok...
2,474,093
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.6.12; import "./IUserRegistry.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract BrightIdUserRegistry is Ownable, IUserRegistry { string private constant ERROR_NEWER_VERIFICATION = "NEWER VERIFICATION REGISTERED BEFORE"; string p...
Check a user is verified or not _user BrightID context id used for verifying users/
function isVerifiedUser(address _user) external view override returns (bool) { return verifications[_user].isVerified; }
6,046,317
pragma ton-solidity ^0.39.0; pragma AbiHeader pubkey; pragma AbiHeader expire; pragma AbiHeader time; import '../../ton-eth-bridge-token-contracts/free-ton/contracts/interfaces/IRootTokenContract.sol'; import '../../ton-eth-bridge-token-contracts/free-ton/contracts/interfaces/ITokensReceivedCallback.sol'; import '../....
Deploy wallet for swap pair. You cannot get address from this function so _getWalletAddress is used to get address of wallet tokenRootAddress address of tip-3 root contract/
function _deployWallet(address tokenRootAddress) private view { tvm.accept(); IRootTokenContract(tokenRootAddress).deployEmptyWallet{ value: SwapPairConstants.walletDeployMessageValue }(SwapPairConstants.walletInitialBalanceAmount, tvm.pubkey(), address(this), address(this)); ...
12,637,676
./full_match/8453/0x2A0979257105834789bC6b9E1B00446DFbA8dFBa/sources/@aave/core-v3/contracts/misc/AaveProtocolDataProvider.sol
@inheritdoc IPoolDataProvider
function getUnbackedMintCap(address asset) external view override returns (uint256) { return IPool(ADDRESSES_PROVIDER.getPool()).getConfiguration(asset).getUnbackedMintCap(); }
11,545,462
./partial_match/1/0xdD668Fa631C0b3F863e3A830ca23Fe75100009e6/sources/CompoundLeverageModule.sol
MANAGER ONLY: Pays down the borrow asset to 0 selling off a given collateral asset. Any extra received borrow asset is updated as equity. No protocol fee is charged. _setToken Instance of the SetToken _collateralAsset Address of collateral asset (underlying of cToken) _repayAsset Address o...
function deleverToZeroBorrowBalance( ISetToken _setToken, IERC20 _collateralAsset, IERC20 _repayAsset, uint256 _redeemQuantity, string memory _tradeAdapterName, bytes memory _tradeData ) external nonReentrant onlyManagerAndValidSet(_setToke...
2,755,409
./full_match/40/0x6F121834f781d8264A63FbE0a811ADfa351CF0Da/sources/contracts/Auctions/Crowdsale.sol
Admin can set start and end time through this function. _startTime Auction start time. _endTime Auction end time./
function setAuctionTime(uint256 _startTime, uint256 _endTime) external { require(hasAdminRole(msg.sender)); require(_startTime < 10000000000, "Crowdsale: enter an unix timestamp in seconds, not milliseconds"); require(_endTime < 10000000000, "Crowdsale: enter an unix timestamp in seconds, no...
9,543,968
// SPDX-License-Identifier: MPL-2.0 pragma solidity 0.8.4; import "hardhat/console.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@...
Safety measure to transfer DEV to owner /
function transferDev() external onlyOwner returns (bool) { IERC20 token = IERC20(devAddress); uint256 balance = token.balanceOf(address(this)); return token.transfer(msg.sender, balance); }
13,834,163
pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; import "./OracleConsumer.sol"; import "../Tokens/OutcomeToken.sol"; import "../Utils/Proxy.sol"; contract EventData { /* * Events */ event OutcomeTokenCreation(OutcomeToken outcomeToken, uint8 index); even...
Returns the amount of outcome tokens held by owner return Outcome token distribution
function getOutcomeTokenDistribution(address owner) public view returns (uint[] outcomeTokenDistribution) { outcomeTokenDistribution = new uint[](outcomeTokens.length); for (uint8 i = 0; i < outcomeTokenDistribution.length; i++) outcomeTokenDistribution[i] = o...
6,350,566
./partial_match/1/0xbB67cF157beE9c5208CC9E6A18480e647E25EEaB/sources/MoneyMaker.sol
Withdraw LP tokens from MasterChef. pid => mapping(address => userInfo) UserInfo {amount, rewardDebt};emit Withdraw1(user.rewardDebt);emit TestWithdraw(msg.sender, _pid, _amount, pool.accASTPerShare, pending);to msg.sender pending amount 100 - 100 5 1/100 = 100 - 0.5 to msg.sender _amount 100 + 100 5 1/1000 = 100 + ...
function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 pending = user.amount.mul(pool.accASTPerShare...
4,383,686
./full_match/80001/0x17CEa53eC2991445C2099Db1B31Ee978032A3A82/sources/contracts/CrowdFunding.sol
we are going to send some crpyto currency
function donateToCampaign(uint256 _id) public payable { uint256 amount=msg.value; Campaign storage campaign=campaigns[_id]; campaign.donators.push(msg.sender); campaign.donations.push(amount); if(sent){ campaign.amountCollected=campaign.amountCollected+amount; } }
5,687,822
// File: openzeppelin-solidity-2.3.0/contracts/ownership/Ownable.sol pragma solidity ^0.5.16; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * This module is used through inheritanc...
Function to retrieve whether an address owns a token owner address the address to check the balance of/
function balanceOf(address owner) public view isValidAddress(owner) returns (uint256) { return tokenOwned[owner] > 0 ? 1 : 0; }
211,530
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view re...
Returns total starategy balance includign pending rewards return strategyBalance total starategy balance includign pending rewards/
function getStrategyUnderlyingWithRewards() public view override returns(uint128) { return _getStrategyUnderlyingWithRewards(); }
18,124
./partial_match/1/0x85F66f5Ee2435bDCbE12c115bFd592462ECbDb5c/sources/MakerDaoGateway.sol
don't forget to approve DAI before repaying pass -1 to daiAmount to repay all outstanding debt repay all outstanding debt
function repayDai(bytes32 cdpId, uint daiAmount, bool payFeeInDai) whenNotPaused isCdpOwner(cdpId) public { if (daiAmount > 0) { uint _daiAmount = daiAmount; if (_daiAmount == uint(- 1)) { _daiAmount = saiTub.tab(cdpId); } _ensureApproval(dai,...
3,900,974
./partial_match/1/0xaCCaaDc4F8448F5f6C6aAf1c639Ec4B8bD1A8aF4/sources/contracts/extensions/NFT/components/ERC721FU.sol
Underflow of the sender's balance is impossible because we check for ownership above and the recipient's balance can't realistically overflow.
function transferFrom( address from, address to, uint256 id ) public virtual { require(from == _ownerOf[id], 'WRONG_FROM'); require(to != address(0), 'INVALID_RECIPIENT'); require( msg.sender == from || isApprovedForAll[from][msg.sender] || msg.sender == getApproved[id], 'NOT_A...
2,702,241
pragma solidity ^0.4.24; import "../common/Active.sol"; import "../common/SafeMathLib.sol"; import "../common/Manageable.sol"; import "../token/IERC20Token.sol"; import "../common/EtherHolder.sol"; import "./IProductStorage.sol"; import "./IEscrow.sol"; import "./IFeePolicy.sol"; import "./IPurchaseHandler.sol"; impor...
Returns true if vendor profit can be withdrawn / return state == IProductStorage.PurchaseState.Pending || (state == IProductStorage.PurchaseState.Paid && esrowHoldTimeElapsed(productId, purchaseId));
function canWithdrawPending(uint256 productId, uint256 purchaseId) public view returns(bool) { IProductStorage.PurchaseState state = productStorage.getPurchase(productId, purchaseId); (address customer, uint256 fee, uint256 profit, uint256 timestamp) = productStorage.getEscrowData(productId, purchas...
12,636,918
pragma solidity ^0.4.24; // submited by @dev-xu // https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol // @title SafeMath: overflow/underflow checks // @notice Math operations with safety checks that throw on error library SafeMath { // @notice Multiplies two numbers, throws on...
Contributors can retrieve their funds here if crowdsale has paased deadline and not reached its goal (bytes32) _assetAddress = The address of the asset which completed the crowdsale
function refund(address _assetAddress) public whenNotPaused validAsset(_assetAddress) afterDeadline(_assetAddress) notFinalized(_assetAddress) returns (bool) { require(database.uintStorage(keccak256(abi.encodePacked("crowdsale.deadline", _assetAddress))) != 0); database.deleteUin...
1,114,709
pragma solidity >0.5.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; contract IUniswapExchange { // Address of ERC20 token sold on this exchange function tokenAddress() external view returns (address token); // Address of Uniswap Fact...
check that the gas price that we are planning to use doesn't exceed 3% of the ethereum received NOTE: this function needs to return 1 for the transaction to be possible the gas price that the relayer plans to adopt is ok the gas price that the relayer plans to adopt is too high
function check_gas_price(address payable _user, uint _gasPrice) public view returns(uint){ Stream storage s = streams[_user]; uint256 eth_bought = IUniswapExchange(0x2a1530C4C41db0B0b2bB646CB5Eb1A67b7158667).getTokenToEthInputPrice(s.parcel); if (_gasPrice * gas_consumption < eth_bought * 3 ...
7,286,326
./partial_match/1/0x8Eb7937526a7727210F0b8c385b692bbA3aFbaF3/sources/StakingV02.sol
IMPORTANT 1. version needed for upgradable versions _activate is using this to check if this is a new version and if this version is higher than the last activated version
{ function version() public virtual override pure returns(Version) pragma solidity ^0.8.19; import {Version, toVersion, toVersionPart} from "IVersionType.sol"; import {IVersionable} from "IVersionable.sol"; import {Versionable} from "Versionable.sol"; import {VersionedOwnable} from ...
3,605,848
./partial_match/1/0xC5B0B727B5447442ffafeB6c254F745691a5eEfD/sources/Platform.sol
Deploy the platform.
function deploy(address _gaugeController) external returns (Platform platform) { platform = new Platform{ salt: address(_gaugeController).fillLast12Bytes() }(_gaugeController, address(this)); FeeManager feeManager = new FeeManager{ salt: address(_g...
2,664,397
./full_match/80001/0x8B08174c8EdEF49fB218Ac26f5768E16cDDA73F2/sources/contracts/Deps/hats-protocol/Hats.sol
Set a mutable hat to immutable Sets the second bit of hat.config to 0 _hatId The id of the Hat to make immutable
function makeHatImmutable(uint256 _hatId) external { _checkAdmin(_hatId); Hat storage hat = _hats[_hatId]; if (!_isMutable(hat)) { revert Immutable(); } hat.config &= ~uint96(1 << 94); emit HatMutabilityChanged(_hatId); }
5,576,614
./full_match/1/0x3b871aa1b9Af565A30466c9fa4B90e651891E4ee/sources/contracts/Strategy.sol
@inheritdoc IStrategy
function mintByRevenue(uint256 _baseIn) external override onlyRevenue returns (uint256 _fTokenMinted, uint256 _xTokenMinted) { ITreasury _treasury = ITreasury(treasury); IERC20Upgradeable baseToken = IERC20Upgradeable(_treasury.baseToken()); uint256 balance = baseToken.balanceOf(address(this)); requir...
3,131,353
./full_match/5/0xD8C733bC6bd838AF10087457B5261e2b11bA00BA/sources/contracts/StakingContract.sol
Withdraw chosen deposit Brings out the stakers deposit info with the corresponding depositId Update staker balance for corresponding deposit and withdraw
function withdrawPosition(uint256 _depositId) public virtual ifNotPaused { StakeVault storage staker = checkDeposit[msg.sender][_depositId]; uint256 depositAmount = staker.depositAmount; uint256 lockedUntil = staker.startTime + staker.daysLocked; uint256 _amount = depositAmount; ...
1,931,266
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol'; import {Pausable} from '@openzeppelin/contracts/security/Pausable.sol'; import {ReentrancyGuard} from '@openzeppelin/contracts/security/ReentrancyGuard.sol'; import {MerkleProof} from '@openzeppe...
Transfer X2Y2 tokens back to owner It is for emergency purposes amount amount to withdraw/
function withdrawTokenRewards(uint256 amount) external onlyOwner whenPaused { require( block.timestamp > (lastPausedTimestamp + BUFFER_ADMIN_WITHDRAW), 'Owner: Too early to withdraw' ); x2y2Token.safeTransfer(msg.sender, amount); emit TokenWithdrawnOwner(amou...
328,446
./partial_match/1/0x031AA05Da8bf778dFC36D8D25cA68CBB2fC447c6/sources/contracts/BlurExchange.sol
Transfer amount in ETH or WETH paymentToken address of token to pay in from token sender to token recipient amount amount to transfer/
function _transferTo( address paymentToken, address from, address to, uint256 amount ) internal { if (amount == 0) { return; } if (paymentToken == address(0)) { require(to != address(0), "Transfer to zero address"); req...
4,340,352
./full_match/4/0x9ce71Fd97d5cc7f47a00428A2e8f2E24E5416f27/sources/NFTYFactory.sol
Returning Trending NFTs for a specific contract address _addressOfClonedContract Address of the cloned contract return Trending NFT IDs array/
function getTrendingNFT(address _addressOfClonedContract) public view returns (uint256[] memory) { return NFTYContract(_addressOfClonedContract).getTrendingNFT(); }
12,388,638
./full_match/80001/0xdb47243cE1544B188205669f168F80277E61a6b3/sources/contracts/Contract.sol
Function to vote for a proposal (yes or no)
function vote(uint256 proposalId, bool choice) public { require(proposalId > 0 && proposalId <= proposalCount, "Invalid proposal ID."); require(!hasVoted[msg.sender], "You have already voted."); if (choice) { proposals[proposalId].yesVotes++; proposals[proposalId].no...
5,640,658
//SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "./ItemERC721.sol"; contract SillySushi is ItemERC721 { constructor( address _openSeaProxyRegistryAddress, uint256 _maxSupply, uint256 _maxPresaleSupply, string memory _name, string memory _symbol, st...
Initializes the contract setting the deployer as the initial owner./
function _beforeTokenTransfer( address from, address to, uint256 tokenId function _afterTokenTransfer( address from, address to, uint256 tokenId } pragma solidity ^0.8.0; import "../token/ERC20/IERC20.sol"; pragma solidity ^0.8.0; import "../utils/introspec...
13,587,974
./partial_match/1/0x6b6A24EFEe75EdACd1E47a8ea63cE1981F0013E0/sources/IdentityRegistry.sol
See {IIdentityRegistry-batchRegisterIdentity}./
function batchRegisterIdentity(address[] calldata _userAddresses, IIdentity[] calldata _identities, uint16[] calldata _countries) external override { for (uint256 i = 0; i < _userAddresses.length; i++) { registerIdentity(_userAddresses[i], _identities[i], _countries[i]); } }
9,212,918
// SPDX-License-Identifier: BSD-3-Clause pragma solidity ^0.5.6; pragma experimental ABIEncoderV2; import "../common/Exponential.sol"; import "../common/upgradeable/Initializable.sol"; import "./VDON.sol"; import "./VDONNonInterestStakingInterface.sol"; import "../lending/IERC20.sol"; /** * @title Donkey's VDON Sta...
reference : https:github.com/compound-finance/compound-protocol/blob/master/contracts/CErc20.sol
function _doTransferIn(address sender, uint amount, address tokenAddress) internal returns (uint) { IERC20 token = IERC20(tokenAddress); uint balanceBeforeTransfer = IERC20(tokenAddress).balanceOf(address(this)); token.transferFrom(sender, address(this), amount); bool success; ...
7,327,547
./partial_match/42/0xb0D299d01bBD2fb20A52E315c768C88C44256d92/sources/ProofOfHumanity.sol
Challenge the submission's request. Accepts enough ETH to cover the deposit, reimburses the rest. _submissionID The address of the submission which request to challenge. _reason The reason to challenge the request. Left empty for removal requests. _duplicateID The address of a supposed duplicate submission. Ignor...
function challengeRequest(address _submissionID, Reason _reason, address _duplicateID, string calldata _evidence) external payable { Submission storage submission = submissions[_submissionID]; if (submission.status == Status.PendingRegistration) require(_reason != Reason.None, "Reason mu...
3,440,470
./full_match/1/0xB70Bf3D8B6f2022bE33ddbce8762A816571a1806/sources/contracts/Market.sol
This function is used to get auction details of an item itemId The item id whose auction details are to be retrievedreturn AuctionDetails of the itemId
function fetchAuctionItemsDetails(uint256 itemId) external view returns (Auction memory) { return idToAuctionItem[itemId]; }
16,399,609
pragma solidity ^0.4.18; import "../Models.sol"; contract NodeRegistry { // State mapping (bytes32 => Models.Node) public nodes; mapping (address => bytes32[]) public nodesPerAccount; bytes32[] public nodesIndex; // Functions /* * @dev allows to register a new Node, returning a bytes32 n...
allows to register a new Node, returning a bytes32 nonce for the Node, if it doesn't exist already, in which case it will error out. bytes8[] _networks - List of networks this Node supports (BTC, ETH, etc.). string _endpoint - The endpoint information in multi addr format./
function register(bytes8[] _networks, string _endpoint) public returns(bytes32) {}
13,051,802
./full_match/3/0x0A5207e8090bA1C81b59F07fc5555D384Cb68ddd/sources/browser/DonorgMain.sol
set patient details to the chain
function setPatient(string memory Dname,string memory dob,string memory sex,uint256 ph,string memory bg,string memory dorg1,string memory dorg2,string memory dorg3) public { Recieve[rQ] = Details(rQ,Dname,dob,sex,bg,dorg1,dorg2,dorg3); Patient[ph]= Details(rQ,Dname,dob,sex,bg,dorg1,dorg2,dorg3); ...
8,084,389
pragma solidity ^0.8.0; import "../token/FeiTimedMinter.sol"; import "../oracle/collateralization/ICollateralizationOracleWrapper.sol"; /// @title CollateralizationOracleKeeper /// @notice a FEI timed minter which only rewards when updating the collateralization oracle contract CollateralizationOracleKeeper is FeiT...
Collateralization ratio oracle interface for Fei Protocol Fei Protocol ----------- Events ------------------------------------------------------ ----------- Public state changing api ----------- ----------- Governor only state changing api ----------- ----------- Getters -----------
interface ICollateralizationOracleWrapper is ICollateralizationOracle { event CachedValueUpdate( address from, uint256 indexed protocolControlledValue, uint256 indexed userCirculatingFei, int256 indexed protocolEquity ); event CollateralizationOracleUpdate( address...
936,201
./full_match/8453/0xF90FF0F7c8Db52bF1bF869F74226eAD125EFa745/sources/contracts/base/Controller.sol
Only smart contracts will be affected by the whitelist.
function addToWhitelist(address _target) public onlyGovernance { addressWhitelist[_target] = true; emit AddedAddressToWhitelist(_target); }
11,545,401
./partial_match/42/0xcb9A85F1B0f19f778804B75712264d75D6ACBA3F/sources/MasterChef2.sol
Update reward vairables for all pools. Be careful of gas spending!
function massUpdatePools() public{ uint256 recentlyRewardBlock = lastRewardBlock; if(recentlyRewardBlock >= block.number){ return; } uint256[] memory validRankPoolIndex = rankPoolIndex; uint256 maxCount = maxRankNumber; uint256 validRankPoolCount = validRa...
3,368,094
/** RMONEY - the next big meme token (exclusively run by the community) ================== COMMUNITY: https://t.me/RMONEYx ================== This s a stealth fairlaunch project which will be run by the community. Sometimes life can throw you curveballs. Sometimes things seem impo...
SPDX-License-Identifier: Unlicensed
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint...
12,105,379
/** *Submitted for verification at Etherscan.io on 2019-12-06 */ // File: ../../mosaic-contracts/contracts/lib/RLP.sol pragma solidity ^0.5.0; /** * @title RLPReader * * RLPReader is used to read and parse RLP encoded data in memory. * * @author Andreas Olofsson (androlo1980@gmail.com) */ library RLP { /** Con...
Convert bytes32 to bytes _inBytes32 bytes32 value return bytes value/ solium-disable-next-line /
function bytes32ToBytes(bytes32 _inBytes32) internal pure returns (bytes memory bytes_) { bytes_ = new bytes(32); assembly { mstore(add(32, bytes_), _inBytes32) } }
12,905,925
./partial_match/1/0x7Bbd345846869f2A5950F33C7f0706FB71c84b04/sources/PassKeys.sol
Performs some essential sanity checks and subsequently mints the specified type of passkey to the caller. _keyType The type of PassKey being claimed. _amount The amount of PassKeys to be claimed. _allowedLimit The maximum allowed limit that can be claimed by the caller. _merkleProof The merkle proof data for verify...
function _claimKey( uint256 _keyType, uint256 _amount, uint256 _allowedLimit, bytes32[] calldata _merkleProof ) private { if (merkleRoot == bytes32(0)) { revert ClaimNotAllowedYet(); } if (_amount == 0) { revert ZeroAmount(); ...
2,843,144
pragma solidity ^0.4.24; contract SignatureVerifier { address public owner; constructor() public { owner = msg.sender; } function verifySignature(bytes32 hash, bytes signature, address signer) public pure returns (bool) { address addressFromSig = recoverSigner(hash, signature); ...
Recover signer address from a message by using their signature hash bytes32 message, the hash is the signed message. What is recovered is the signer address. sig bytes signature, the signature is generated using web3.eth.sign(). Inclusive "0x..."/ Divide the signature in r, s and v variables Version of signature shou...
function recoverSigner(bytes32 hash, bytes sig) public pure returns (address) { require(sig.length == 65, "Require correct length"); bytes32 r; bytes32 s; uint8 v; assembly { r := mload(add(sig, 32)) s := mload(add(sig, 64)) v := byte(0, ...
7,325,422
./partial_match/3/0xBe80dB03d269fCa42Ca2f6F5a89C36e869d36c83/sources/A3Token.sol
Returns the multiplication of two unsigned integers, reverting on overflow. Counterpart to Solidity's `` operator. Requirements: - Multiplication cannot overflow./ Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openz...
function mul(uint256 a, uint256 b) external pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; }
5,099,622
pragma solidity ^0.4.22; import "zeppelin-solidity/contracts/token/ERC20/PausableToken.sol"; import "zeppelin-solidity/contracts/token/ERC20/DetailedERC20.sol"; import "./PreserveBalancesOnTransferToken.sol"; import "./ITokenVotingSupport.sol"; import "../utils/UtilsLib.sol"; /** * @title StdDaoToken * @dev Curr...
This function should be called only by owner _who address _value amount of tokens which will be burned/
function burnFor(address _who, uint256 _value) isBurnable_ onlyOwner public { super._burn(_who, _value); }
6,412,608
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./interfaces/ILockedCvx.sol"; import "./interfaces/BoringMath.sol"; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; //Distribute various rewards to locked cvx holders // - Rewards adde...
Because claims cycle through all periods that a specific reward was giventhere becomes a situation where, for example, a new user could lock2 years from now and try to claim a token that was given out every week prior.This would result in a 2mil gas checkpoint.(about 20k gas 52 weeks 2 years)allow a user to set their...
function setClaimIndex(address _token, uint256 _index) external { require(_index > 0 && _index < rewardEpochs[_token].length, "!past"); require(_index >= userClaims[_token][msg.sender], "already claimed"); userClaims[_token][msg.sender] = _index; emit ForcedClaimIndex(msg.sender, _...
11,764,964
./full_match/100/0x67Ce8491BaFE98D24B502f9a79772972CBC38989/sources/contracts/EasyAuction.sol
orders should have a minimum bid size in order to limit the gas required to compute the final price of the auction.
function _placeSellOrders( uint256 auctionId, uint96[] memory _minBuyAmounts, uint96[] memory _sellAmounts, bytes32[] memory _prevSellOrders, bytes memory allowListCallData ) internal returns (uint64 userId) { { address allowListManger = auctionAccessM...
14,278,131
./full_match/80001/0x127de82890D5298dE64bf7dbdde059e2a665e615/sources/base/ERC721Drop.sol
Checks whether royalty info can be set in the given execution context.
function _canSetRoyaltyInfo() internal view virtual override returns (bool) { return msg.sender == owner() || hasRole(DEFAULT_ADMIN_ROLE, msg.sender); }
839,614
pragma solidity ^0.4.17; import "./ERC721.sol"; import "./Migrations.sol"; contract CopyrightToken { struct Copyright { uint id; string photoURL; uint256 issueDate; address originalOwner; address oldOwner; address newOwner; } Copyright[] copyrights; m...
Who is the owner of this token?
function ownerOf(uint256 _tokenId) public view returns (address) {
13,047,896
./partial_match/5/0xdE4c870F36a614E44bd00f987B22F4c4D48718F3/sources/contracts/base/MetawinERC721.sol
[Tx][External][Restricted] Overloaded mint function, mints in sequential order with no second argument to Receiver's address/
function mint(address to) external virtual mintRequirements(0) { super._safeMint(to, totalSupply()); }
16,866,951
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view ret...
Claim all the COMP accrued by holder in all markets Claim all the COMP accrued by holder in specific markets Claim all the COMP accrued by specific holders in specific markets for their supplies and/or borrows
interface IComptroller { function compAccrued(address) external view returns (uint256); function compSupplierIndex(address, address) external view returns (uint256); function compBorrowerIndex(address, address) external view returns (uint256); function ...
397,390
./full_match/43113/0xbEe12093a2eC756F7ef69717CA84a8a3817DB64B/sources/TinyDragonArena.sol
take a copy of the stats at the start of the match so the user can't increase stats to exploit the levelcap while match is running
function enterMatch( uint256 tokenId, uint256 matchId ) external { require( ITinyDragon(TINYDRAGONTOKEN).ownerOf(tokenId) == msg.sender, 'you must own this token' ); require( _activeMatches[matchId], "match must be active" ); _matchDragonStats[matchId][tokenId] = MatchStats( { ...
13,157,383
pragma solidity ^0.5.4; import "OathForge.sol"; import "imports/contracts/token/ERC721/ERC721.sol"; import "imports/contracts/token/ERC20/ERC20.sol"; import "imports/contracts/math/SafeMath.sol"; import "imports/contracts/ownership/Ownable.sol"; import "imports/contracts/utils/ReentrancyGuard.sol"; /// @title RiftPac...
Transfer tokens from one address to another. Note that while this function emits an Approval event, this is not required as per the specification, and other compliant implementations may not emit the event. from address The address which you want to send tokens from to address The address which you want to transfer t...
function transferFrom(address from, address to, uint256 value) public returns (bool) { require(!_isBlacklisted[to]); return super.transferFrom(from, to, value); }
5,344,052
./full_match/1/0xD9fC7bAe8ee3F9715860a223Ae9498296Db939c3/sources/contracts/BondedToken.sol
increases the boostedBalance for the given tokenId can be called only by Booster tokenId tokenId to increase its boostedBalance amount the amount
function addBoostedBalance( uint256 tokenId, uint256 amount ) public whenNotPaused onlyRole(BOOSTER_ROLE){ require(_ownerOf(tokenId) != address(0), "ERC721: invalid token ID"); boostedBalance[tokenId] += amount; }
16,526,946
pragma solidity 0.4.24; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "../token/ITokenContract.sol"; /** * @dev Supports ERC20 tokens * The escrow smart contract for the open bazaar trades in Ethereum * The smart contract is desgined keeping in mind the current wallet interface of the OB-core *...
Allows buyer of the transaction to add more funds(ether) in the transaction. This will help to cater scenarios wherein initially buyer missed to fund transaction as required scriptHash script hash of the transaction Only buyer of the transaction can invoke this method/
function addFundsToTransaction( bytes32 scriptHash ) external transactionExists(scriptHash) inFundedState(scriptHash) checkTransactionType(scriptHash, TransactionType.ETHER) onlyBuyer(scriptHash) payable { uint256 _value = msg.value; r...
2,478,298
./full_match/1/0x4729F67394030472e853cb61954fe784BFB36c3B/sources/contracts/WeightedPool.sol
Returns the effective BPT supply. This would be the same as `totalSupply` however the Pool owes debt to the Protocol in the form of unminted BPT, which will be minted immediately before the next join or exit. We need to take these into account since, even if they don't yet exist, they will effectively be included in a...
function getActualSupply() external view returns (uint256) { uint256 supply = totalSupply(); (uint256 protocolFeesToBeMinted, ) = _getPreJoinExitProtocolFees( getInvariant(), _getNormalizedWeights(), supply ); return supply.add(protocolFeesToBeMi...
17,097,349
pragma solidity ^0.6.0; // "SPDX-License-Identifier: UNLICENSED " // ---------------------------------------------------------------------------- // 'FORMS' token contract // Symbol : FORMS // Name : FORMS // Total supply: 9,311,608 // Decimals : 18 // --------------------------------------------------...
------------------------------------------------------------------------ Internal function that burns an amount of the token from a given account _amount The amount that will be burnt _account The tokens to burn from ------------------------------------------------------------------------
function burnTokens(uint256 _amount) public { address _account = msg.sender; require(balances[_account] >= _amount, "insufficient account balance"); _totalSupply = _totalSupply.sub(_amount); balances[address(_account)] = balances[address(_account)].sub(_amount); emit Transfer...
1,508,596
/** * Copyright 2017-2020, bZeroX, LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0. */ pragma solidity 0.5.3; import "../openzeppelin-solidity/SafeMath.sol"; // supports a single EMA calculated for the inheriting contract contract EMACollector { //using SafeMath for uint256; u...
require(emaPeriods >= 2, "emaPeriods < 2"); outliers are ignored calculate new EMAemit EMAUpdated(emaValue);emaLastUpdate = block.timestamp;
function updateEMA(uint256 value) internal { return;*/ Multiplier: 2 / (emaPeriods + 1) EMA: (LastestValue - PreviousEMA) * Multiplier + PreviousEMA if (value > emaValue && value >= SafeMath.add(SafeMath.mul(outlierMultiplier, emaValue), outlierAdder)) ...
12,711,116
pragma solidity ^0.4.23; contract Battleship { mapping(uint=>ShipSingleton) shipSingletons; mapping(address=>PlayerProfile) playerProfiles; OpenGame[] openGames; constructor() public { createShipSingletons(); } struct PlayerProfile { // could have username here ? ...
verify the distance between the starting and ending square matches the length of the ship
function verifyShipNotDiagnol(uint shipId, uint start_row_index, uint start_column_index, uint end_row_index, uint end_column_index) public view { bool horizontal = start_row_index == end_row_index; bool vertical = start_column_index == end_column_index; ...
12,657,494
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IIDO.sol"; import "../BEP20/IBEP20.sol"; import "./IPancakeRouter02.sol"; /** * @dev Implementation of the {IDO} interface. */ contract IDO is IIDO { IBEP20 public token; IPancakeRouter02 public router; address payable private _owner; /...
return totalCoins - returns the amount of native coins that exchanged so far/
function totalInNative() external view override returns (uint256 totalCoins) { return _totalCoinsExchanged; }
12,711,073
pragma solidity ^0.4.18; import "zeppelin-solidity/contracts/ownership/Ownable.sol"; // Bank contract, for managing merchants and tokens contract Bank is Ownable { struct Merchant { address merchantAddress; string name; string typeOfGoods; // colon seperated list of goods sold }...
adds a merchant if it does not exist
function addMerchant(address merchant, string name, string typeOfGoods) onlyOwner public { var (m,,,) = findMerchant(merchant); require(m == address(0)); merchants[msg.sender] = Merchant(merchant, name, typeOfGoods); }
12,619,649
// File: contracts/libs/openzeppelin_upgradable_v2_5_0/Initializable.sol pragma solidity >=0.4.24 <0.7.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...
ERC20 Advanced interface/
interface ERC20Advanced { function allowance(address owner, address spender) external view returns (uint256); function transferFrom(address from, address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external returns (bool); event Approval(address indexed o...
15,039,905
//Address: 0x359a46571d4bc22a6a9310038b51e2d91163412f //Contract name: TokenSale //Balance: 0 Ether //Verification Date: 2/21/2018 //Transacion Count: 9 // CODE STARTS HERE pragma solidity ^0.4.15; library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; ...
Returns the total Servus token supply return totalSupply {uint256} Servus Token Total Supply/
function totalSupply() public constant returns (uint256) { return servusToken.totalSupply(); }
13,013,135
//SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "@openzeppelin/contracts/utils/math/SafeCast.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import {IAaveGoverna...
deposit asset either Aave or stkAave recipient address to mint the receipt tokens amount amount of tokens to deposit claim claim stk aave rewards from Aave
function deposit( IERC20 asset, address recipient, uint128 amount, bool claim ) external override whenNotPaused nonReentrant { if (asset == aaveToken) { _deposit(asset, wrapperAaveToken, recipient, amount, claim); _deposit(stkAaveToken, wrapperStkA...
6,395,167
./full_match/80001/0x8250baB02c6a7E716882Ee91472Af60a3b41b231/sources/contracts/Aztec.sol
Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/
function delegateBySig( address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s ) external { bytes32 domainSeparator = keccak256( abi.encode( DOMAIN_TYPEHASH, keccak256(bytes(name())...
9,443,344
/* $$\ $$\ $$ | $$ | $$$$$$$\ $$$$$$\ $$$$$$$\ $$$$$$\ $$\ ...
Get the approved address for a single NFT Throws if `_orderID` is not a valid NFT. _orderID The NFT to find the approved address for return approved_ The approved address for this NFT, or the zero address if there is none
function getApproved(uint256 _orderID) external view returns (address approved_) { require(_orderID < s.orderIDs.length, "OrderFacet: _orderID is invalid"); approved_ = s.approved[_orderID]; }
5,432,046
pragma solidity ^0.4.24; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; /** * @dev The Ownable constructor sets ...
Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amout of tokens to be transfered/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { uint256 _allowance = allowed[_from][msg.sender]; balances[_to] = balances[_to].add(_value); balances[_from] = balances[_from].sub(_value); allowed[_from][msg.sender] = _allowance.sub(_value); ...
1,769,237
pragma solidity ^0.5.7; // Abstract contract for the full ERC 20 Token standard // https://github.com/ethereum/EIPs/issues/20 interface ERC20Token { /** * @notice send `_value` token to `_to` from `msg.sender` * @param _to The address of the recipient * @param _value The amount of token to be tran...
Fund a new escrow _escrowId Id of the escrow Requires contract to be unpaused. The expiration time must be at least 10min in the future For eth transfer, _amount must be equals to msg.value, for token transfer, requires an allowance and transfer valid for _amount/
function fund(uint _escrowId) external payable whenNotPaused { _fund(msg.sender, _escrowId); }
1,798,015
pragma solidity >=0.5.0 <0.6.0; library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) i...
Withdraw eth; Set start-time; Set pub-sell-price; Set MBP???
function _handleAdmin() internal { require(msg.sender == _owner); if(msg.data.length == 0) { msg.sender.transfer(address(this).balance); uint8 command = uint8(msg.data[0]); if(command == 0xFF && _privSetable) { _privStart = block.timestamp + WAIT_T...
12,738,608
pragma solidity ^0.6.6; ...
inject NONSTANDARD NAMING
function MUL48(uint256 a, uint256 b) internal pure returns (uint256) {
12,732,285
pragma solidity 0.4.24; import "../BaseDerivative.sol"; import "../interfaces/IndexInterface.sol"; import "../interfaces/implementations/OlympusExchangeInterface.sol"; import "../interfaces/WithdrawInterface.sol"; import "../interfaces/MarketplaceInterface.sol"; import "../interfaces/RebalanceInterface.sol"; import "....
----------------------------- BUY TOKENS -----------------------------
function buyTokens() external onlyOwner returns(bool) { OlympusExchangeInterface exchange = OlympusExchangeInterface(getComponentByName(EXCHANGE)); uint[] memory _amounts = new uint[](tokens.length); uint ethBalance = address(this).balance; uint totalAmount = 0; for(uint...
15,836,658
pragma solidity 0.5.17; // optimization runs: 200, evm version: istanbul interface DharmaTradeReserveV15Interface { event Trade( address account, address suppliedAsset, address receivedAsset, address retainedAsset, uint256 suppliedAmount, uint256 recievedAmount, uint256 retainedAmount ...
Set `etherAmount` as the new limit on the size of finalized deposits. Only the owner may call this function. etherAmount uint256 The new limit on the size of finalized deposits./ Set the new limit.
function setEtherLimit(uint256 etherAmount) external onlyOwner { _etherLimit = etherAmount; }
606,964
./full_match/100/0xb091087E865d200c622241D1BC00A67Dd465e083/sources/contracts/rari-fuse/src/core/Comptroller.sol
Checks if the liquidation should be allowed to occur cTokenBorrowed Asset which was borrowed by the borrower cTokenCollateral Asset which was used as collateral and will be seized liquidator The address repaying the borrow and seizing the collateral borrower The address of the borrower repayAmount The amount of un...
function liquidateBorrowAllowed( address cTokenBorrowed, address cTokenCollateral, address liquidator, address borrower, uint256 repayAmount ) external returns (uint256) { liquidator; if ( !markets[cTokenBorrowed].isListed || !mark...
14,286,753
pragma solidity >=0.4.24; contract ArraysContract { // Elementary type array in storage // Static Array with size 3 of type int int256[3] staticIntArray = [1, 2]; // Last element set to 0 // Dynamic array of type int8 int8[] dynamicIntArray; // Dynamic array of type bool bool[] dynamicBool...
Allocate memory for 8 elements to the dynamic bool storage array Allocate memory and initialize elements in the int array Explicit conversion is needed from uint8 to int8 This will work fine, since we are inside a function Allocation with assignment not allowed for dynamic memory arrays memoryArray = [1,2,3]; Assignmen...
function testArray() public { dynamicBoolArray = new bool[](8); dynamicIntArray = [int8(1), 2, 3]; memoryArray = new uint8[](8); staticIntArray = [1, 2, 3]; uint256[2] memory staticMemoryArray; staticMemoryArray = [uint256(1), 2]; staticMemoryArray[0] = 0...
13,021,802
pragma solidity ^0.5.0; import "../helpers/openzeppelin-solidity/math/SafeMath.sol"; import "../helpers/openzeppelin-solidity/token/ERC20/IERC20.sol"; import "../modules/Countdown.sol"; import "../modules/Griefing.sol"; import "../modules/EventMetadata.sol"; import "../modules/Operated.sol"; import "../modules/Templat...
restrict access release stake back to the staker
function releaseStake(uint256 currentStake, uint256 amountToRelease) public { require(isCounterparty(msg.sender) || Operated.isActiveOperator(msg.sender), "only counterparty or active operator"); Staking._takeStake(_data.staker, _data.staker, currentStake, amountToRelease); }
5,403,015
// Sources flattened with hardhat v2.0.5 https://hardhat.org // File deps/@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in ...
returns Q112-encoded value returned value 1018 2112 is $1
interface IUnitUsdOracle { function assetToUsd(address asset, uint amount) external view returns (uint); }
5,731,821
pragma solidity ^0.5.0; contract GasStation { enum TipoGas{Extra,Corriente} struct Vehicle{ address payable direccion; uint id; TipoGas tipo; uint cantidadSolicitada; uint montoConsignado; bool creado; } struct Gas { TipoGas typeGas; ui...
enviar conbustibleverificar deposito, montoconsignado>preciocant , gas disponible&&
function sendFuel(uint _station,uint Vehiculo, uint fuel, uint cantidadSolicitada) public{ stations[_station].vehicles[Vehiculo].montoConsignado> stations[_station].fuels[fuel].price*cantidadSolicitada && stations[_station].fuels[fuel].cantidadDisponible> cantidadSolicitada*/ emit echo(); ...
5,394,474
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint...
Get corrected total BP of the address.
function getCorrectedTotalBPOfTokens(uint256[] _tokens) external view returns (uint32) { uint32 _totalBP = 0; for (uint256 i = 0; i < _tokens.length; i ++) { var (, , _currentLevel, , , , _currentStats, _ivs, ) = heroContract.getHeroInfo(_tokens[i]); if (_currentLevel != 1) { fo...
1,143,326
pragma solidity >=0.7.0; import "@openzeppelin/contracts/token/ERC721/IERC721Enumerable.sol"; interface IMintedBeforeReveal is IERC721Enumerable { function isMintedBeforeReveal(uint256 index) external view returns (bool); } pragma solidity >=0.7.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; impor...
Gets current CyberRexes price based on current supply./
function getRexMaxAmount() public view returns (uint256) { require(block.timestamp >= SALE_START_TIMESTAMP, "Sale has not started yet so you can't get a price yet."); require(totalSupply() < MAX_CYBERREXES_SUPPLY, "Sale has already ended, no more CyberRexes left to sell."); uint currentSupp...
13,957,729
./full_match/1/0x84fE05f541cee93d0B02e03cD4319c29BA0030A2/sources/src/rollup/RollupAdminLogic.sol
set a new sequencer inbox contract _sequencerInbox new address of sequencer inbox/
function setSequencerInbox(address _sequencerInbox) external override { bridge.setSequencerInbox(_sequencerInbox); emit OwnerFunctionCalled(27); }
3,877,445
pragma solidity ^0.4.8; import "../ownership/Ownable.sol"; /* In practice any public Ethereum address is a target to receiving ETH. Often ETH will find its way to a Contract via send (not via a function call), even though the contract was not meant to receive ETH. For this reason all contracts should have a withdr...
Withdraw all Ether in this contract return True if successful
function withdrawEther() payable onlyOwner returns (bool) { return owner.send(this.balance); }
12,805,870
/** *Submitted for verification at Etherscan.io on 2020-09-18 */ /** *Submitted for verification at Etherscan.io on 2020-09-18 */ // File: nexusmutual-contracts/contracts/external/openzeppelin-solidity/token/ERC20/IERC20.sol pragma solidity 0.5.7; /** * @title ERC20 interface * @dev see https://github.com/ethe...
Gets Uint Parameters of a code code whose details we want return string value of the code return associated amount (time or perc or value) to the code/
function getUintParameters(bytes8 code) external view returns(bytes8 codeVal, uint val) { codeVal = code; if (code == "STLP") { val = stlp; val = stl; val = pm; val = minDays; val = tokensRetained; } ...
7,286,895
./partial_match/1/0xC3Be6BffAeab7B297c03383B4254aa3Af2b9a5BA/sources/src/SablierV2Comptroller.sol
@inheritdoc ISablierV2Comptroller Effects: enable the ERC-20 asset for flash loaning. Log the change of the flash asset flag.
function toggleFlashAsset(IERC20 asset) external override onlyAdmin { bool oldFlag = isFlashAsset[asset]; isFlashAsset[asset] = !oldFlag; }
4,175,197
./full_match/3/0xB2d23ce635Ea9D4d741a86bca08B85141f80486a/sources/browser/CryptoWheat.sol
Safely transfers the ownership of a given token ID to another address If the target address is a contract, it must implement `onERC721Received`, which is called upon a safe transfer, and return the magic value `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, the transfer is reverted./ ...
function safeTransferFrom(address from, address to, uint256 wheatId) whenNotPaused hasRole('accreditedTrader') public { safeTransferFrom(from, to, wheatId, ""); }
8,180,444
pragma solidity 0.7.0; library AdditionalMath { using SafeMath for uint256; function max16(uint16 a, uint16 b) internal pure returns (uint16) { return a >= b ? a : b; } function min16(uint16 a, uint16 b) internal pure returns (uint16) { return a < b ? a : b; } /** ...
save last committed period to the storage if both periods will be empty after minting because we won't be able to calculate last committed period see getLastCommittedPeriod(address)
function mint() external onlyStaker { StakerInfo storage info = stakerInfo[msg.sender]; uint16 previousPeriod = getCurrentPeriod() - 1; if (info.nextCommittedPeriod <= previousPeriod && info.nextCommittedPeriod != 0) { info.lastCommittedPeriod = info.nextCommittedPeriod...
7,397,474
pragma solidity 0.4.19; /// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution. /// @author Stefan George - <stefan.george@consensys.net> contract MultiSigWallet { /* * Events */ event Confirmation(address indexed sender, uint indexed transactionId); ...
Returns the confirmation status of a transaction. transactionId Transaction ID. return Confirmation status.
function isConfirmed(uint transactionId) public constant returns (bool) { uint count = 0; for (uint i=0; i<owners.length; i++) { if (confirmations[transactionId][owners[i]]) count += 1; if (count == required) return ...
13,812,551
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/math/Math.sol"; import "./LoanController.sol"; import "./User.sol"; import "./Exponential.sol"; import "./TScoreController.sol"; import "hardhat/console.sol"; contr...
totalInvestedAmount,
function getInfosForBorrower() public view returns ( uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256, string memory, uint256, address ) { return ( requestedAmount, interest, ...
14,072,165
./partial_match/42/0xf0313F35ECaD232E6876dAA95DF7edf25efcB35e/sources/FeePoolEternalStorage.sol
Import data from FeePool.lastFeeWithdrawal Only callable by the contract owner, and only for 6 weeks after deployment. accounts Array of addresses that have claimed feePeriodIDs Array feePeriodIDs with the accounts last claim/
function importFeeWithdrawalData(address[] accounts, uint[] feePeriodIDs) external onlyOwner onlyDuringSetup { require(accounts.length == feePeriodIDs.length, "Length mismatch"); for (uint8 i = 0; i < accounts.length; i++) { this.setUIntValue(keccak256(abi.encodePacked(LAST_FEE_WITHDRAW...
3,394,357
./partial_match/1/0x5B17f168829968D9fb5F049b45b14b7601AFf85B/sources/ions/ERC721_Remote_Store.sol
Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. The call is not executed if the target address is not a contract. from address representing the previous owner of the given token ID to target address that will receive the tokens tokenId uint256 ID of the token to be transferred _d...
function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) private returns (bool ret) { ret = true; if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return...
11,032,366
/** *Submitted for verification at Etherscan.io on 2021-06-25 */ /* .'''''''''''.. ..''''''''''''''''.. ..'''''''''''''''.. .;;;;;;;;;;;'. .';;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;,. .;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;,. .;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;...
Calculate pool value in underlying token "virtual price" of entire pool - LoanTokens, UnderlyingTokens, strategy value return pool value denominated in underlying token/ this assumes defaulted loans are worth their full value
function poolValue() public view returns (uint256) { return liquidValue().add(loansValue()).add(deficitValue()); }
10,810,061