file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
/** *Submitted for verification at Etherscan.io on 2021-07-12 */ //SPDX-License-Identifier: MIT /* FairShare I was testing some ideas on a fair lottery token on ropsten then i saw the EverShare contract. We have some similar ideas so i tweaked my token a bit. This token save fees in the contract & send to a rand...
seller can only win once
function _sendLotteryPrize() private { if (_lotteryPlayers.length > 0 && lotteryBalance > 0) { uint256 prize = lotteryBalance; uint256 index = _semiRandom() % _lotteryPlayers.length; address winner = _lotteryPlayers[index]; address payable target = payable(win...
2,446,471
./full_match/1/0x5cC70898c47f73265BdE5b8BB9D37346d0726c09/sources/contracts/strategies/MorphoCompoundStrategy.sol
Deposit asset into Morpho _asset Address of asset to deposit _amount Amount of asset to deposit/
function _deposit(address _asset, uint256 _amount) internal { require(_amount > 0, "Must deposit something"); IMorpho(MORPHO).supply( address(_getCTokenFor(_asset)), _amount ); emit Deposit(_asset, address(_getCTokenFor(_asset)), _amount); }
17,154,735
pragma solidity 0.4.24; import "truffle/Assert.sol"; import "../contracts/ExampleToken.sol"; import "./mocks/ERC223ReceivingContractMock.sol"; contract TestERC223ReceivingContract { ExampleToken token; ERC223ReceivingContractMock receiver; function beforeEach() public { token = new ExampleToken()...
Assert.equal(receiver.data(), data, 'Data should be correct');
function testTransferToERC223TokenContract() public { bytes memory data = "Hola Mundo"; token.transfer(receiver, 10, data); Assert.equal(receiver.sender(), address(this), 'Sender should be correct'); Assert.equal(receiver.value(), 10, 'Value should be correct'); }
15,844,566
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../common/Upgradeable.sol"; contract Bridge is Upgradeable { using SignatureUtils for TransferData; constructor(address _proxy) Upgradeable(_proxy) {} /** * @dev To approve or revoke a token from acceptance list * @param _tokenAdd...
_addr (0) fromToken, (1) toToken, (2) fromAddress, (3) toAddress _data (0) amount _internalTxId the transaction id/
function burnToken( address[] memory _addr, uint256[] memory _data, string memory _internalTxId ) public notBlacklisted nonReentrant { TransferData memory transferData = TransferData( _addr[0], _addr[1], _addr[2], _addr[3], ...
6,181,780
//SPDX-License-Identifier: MIT pragma solidity 0.8.2; import "./StateUtils.sol"; import "./interfaces/IGetterUtils.sol"; /// @title Contract that implements getters contract GetterUtils is StateUtils, IGetterUtils { /// @param api3TokenAddress API3 token contract address constructor(address api3TokenAddress) ...
Called to get the total voting power one block ago This method is used to implement the MiniMe interface for the Api3Voting app return Total voting power one block ago
function totalSupplyOneBlockAgo() public view override returns(uint256) { return totalSharesOneBlockAgo(); }
12,851,173
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external; } contract TokenERC20 { // Public variables of the token address public owner; string public name; string...
Approved storeOwners with balances can withdraw from the individual account
function withdrawBalanceStoreOwner(address payable _addr, uint _amount, uint256 _userId) external payable approvedStoreOwner(_userId) returns(bool success) { require(balanceOf[msg.sender] >= _amount, "Insufficeient balance"); balanceOf[msg.sender] -= _amount; balanceOf[_addr] += _amount; ...
14,014,956
./partial_match/1/0xe846aA628C4dED978f05ffD9806d08F787f845bF/sources/contracts/collectionTemplates/NFTTimedEditionCollection.sol
@inheritdoc ERC721Upgradeable/
function _burn( uint256 tokenId ) internal virtual override(ERC721Upgradeable, LazyMintedCollection, SequentialMintCollection) { super._burn(tokenId); }
4,112,432
./full_match/41/0xED231ad1C1C88Db553Ac8d0C57028C01B792fEF7/sources/contracts/FarmBooster.sol
limit max boost _cA max boost
function setCA(uint256 _cA) external onlyOwner { require(_cA >= MIN_CA && _cA <= MAX_CA, "setCA: Invalid cA"); uint256 temp = cA; cA = _cA; emit UpdateCA(temp, cA); }
16,371,282
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Utilities for manipulating memory arrays * * Unlike storage arrays, memory arrays can't be resized to we use these * utility functions to generate copies. */ library ArrayLibUtils { /** * @dev Append value to copy of the array, increasing...
Concatenate byte arrays arrayOfArrays of bytes return concatenated This function is especially useful when looking to concatenate a dynamic array of strings./
function concat(bytes[] memory arrayOfArrays) internal pure returns (bytes memory) { uint256 arrayCount = arrayOfArrays.length; uint256 totalLength = 0; for (uint256 i = 0; i < arrayCount; i++) { totalLength += arrayOfArrays[i].length; } bytes memory newArray = n...
12,605,007
./full_match/43114/0x43C263a40De709EfE72cfc2aD7E6a1e775968138/sources/OLYMP.sol
Deposit LP tokens to MasterChef for OLYMP allocation. If the current user doesn't have a referrer yet, add the address Transfer-tax check retrieve the balance of MC here for LP transfer lp to masterchef check how much masterchef received
function deposit(uint256 _pid, uint256 _amount, address _referrer) public nonReentrant { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); payOrLockupPendingOlymp(_pid); if (_refer...
4,520,923
// Copyright 2021 Cartesi Pte. Ltd. // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); you may not use // this file except in compliance with the License. You may obtain a copy of the // License at http://www.apache.org/licenses/LICENSE-2.0 // Unless required by ...
Submits a new turn for a given game _index index identifying the game _turnIndex a sequential number for the turn, which must be equal to the last submitted turn's index + 1 _nextPlayer address of a player responsible for next turn (can be empty, in which case no player will be held accountable for a timeout) _play...
function submitTurn( uint256 _index, uint256 _turnIndex, address _nextPlayer, uint256 _playerStake, bytes calldata _data ) public onlyActive(_index) { GameContext storage context = instances[_index]; if (context.claimTimeout(_index)) { deactiva...
12,706,966
pragma solidity ^0.5.17; interface IERC20 { function TOTALSUPPLY313() external view returns (uint); //inject NONSTANDARD NAMING function BALANCEOF488(address account) external v...
inject NONSTANDARD NAMING
function CALCULATECONTINUOUSMINTRETURN393(uint _amount) public view returns (uint mintAmount) {
13,006,518
./partial_match/1/0x6819d60b89c175F991bd6D89E4fC91550A14F9b2/sources/WARPCOIN.sol
exclude from paying fees or having max transaction amount
function _beforeTokenTransfer( address from, address to, uint256 amount function _afterTokenTransfer( address from, address to, uint256 amount } pragma solidity >=0.8.10 < 0.9; } } } constructor() ERC20("Warp Coin", "WARPCOIN") { IUniswap...
4,231,506
pragma solidity ^0.5.16; import "./Exponential.sol"; import "./SafeMath.sol"; /** * @title tropykus InterestRateModel Interface * @author tropykus */ contract InterestRateModel is Exponential { using SafeMath for uint256; /// @notice Indicator that this is an InterestRateModel contract (for inspection) ...
Calculates the current borrow interest rate per block cash The total amount of cash the market has borrows The total amount of borrows the market has outstanding reserves The total amnount of reserves the market has return The borrow rate per block (as a percentage, and scaled by 1e18)/ Calculates the current suppl...
function getBorrowRate( uint256 cash, uint256 borrows, uint256 reserves ) external view returns (uint256); function getSupplyRate( uint256 cash, uint256 borrows, uint256 reserves, uint256 reserveFactorMantissa ) external view returns (uint256); ...
12,703,228
pragma solidity ^0.4.24; interface PlayerBookInterface { function getPlayerID(address _addr) external returns (uint256); function getPlayerName(uint256 _pID) external view returns (bytes32); function getPlayerLAff(uint256 _pID) external view returns (uint256); function getPlayerAddr(uint256 _pID)...
priceCntThreshould_ = _keyNum.add(_rstAmount);
function keys(uint256 _eth) internal view returns(uint256) while(_eth >= _price){ _eth = _eth - _price; _price = _price + 5 *10**11; if(_price >= 2 *10**17){ _price = 2 *10**17; } _rstAmount++;...
5,419,062
// SPDX-License-Identifier: UNLICENSED /* ___________________________________________________________________ _ _ ______ | | / / / --|-/|-/-----__---/----__----__---_--_----__-------/-------__------ |/ ...
this flow is to prevent transferring ownership to wrong wallet by mistake
function acceptOwnership() external { require(msg.sender == newOwner); emit OwnershipTransferred(owner, newOwner); owner = newOwner; newOwner = address(0); }
1,048,428
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; } uint2...
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 amount of tokens to be transferred/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(frozenAccounts[_from] == false); require(frozenAccounts[_to] == false); Che...
10,938,268
./full_match/42/0xE32aceAacEfd84753c2A93dD51c790bD246E1679/sources/uniswap-solidity-example/flatten/Flattened.sol
require(daiToken.transfer(address(this), amountIn), 'transferFrom failed.');
function test2(uint256 _amount) external onlyAdmin { address multiDaiKovan = 0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa; address UNISWAP_ROUTER_ADDRESS = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; daiToken = IERC20(0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa); uint amountIn = 50 * 1 ...
16,269,083
./full_match/5/0x393f13d4A7A82c71d0926751CF897E1a1c588C35/sources/contracts/data/DataStore.sol
set the string value for the given key key the key of the value value the value to set return the string value for the key
function setString(bytes32 key, string memory value) external onlyController returns (string memory) { stringValues[key] = value; return value; }
11,589,368
./full_match/44787/0x9BA580397f62034D891e841ee65576b164cd1A0B/sources/contracts/marketPlace/CyberBoxMarket.sol
See {INFTKEYMarketPlaceV1-enterBidForToken}. People can only enter bid if bid is allowed The timestamp set needs to be in the allowed range bid price > 0 must not be token owner must allow this contract to spend enough payment token/ require( _paymentToken.allowance(msg.sender, address(this)) >= bidPrice, "Need...
function enterBidForToken( address sender, uint256 tokenId, uint256 bidPrice, uint256 expireTimestamp ) external onlyMarketplaceOpen onlyAllowedExpireTimestamp(expireTimestamp) { require(bidPrice > 0, "Please bid for more than 0"); require(!_isTokenOwner(tokenId, ...
13,248,903
./full_match/421613/0x65A6cFF0264c210cCf25C6ef6c9bA48BA2D82725/sources/project_/contracts/SpacestationProgression.sol
Returns the $DGM deposited in the current level/
function getDogiumDeposited(address _owner) public view returns (uint256) { uint256 level = _getLevel(_owner); uint256 totalDogium = dogiumDeposited[_owner]; if(level == DGM_LEVELS.length){ return 0; } return totalDogium - DGM_LEVELS[level-1]; }
11,579,642
./full_match/1/0x5A01592A2a4acfE2949f766EF67F4f7d04bE4ac0/sources/contracts/core/prize-pool/PrizePool.sol
Calculates new reward per share. return Updated reward per share.
function _getUpdatedRewardPerShare() internal view returns (uint256) { uint256 _rewardPerShare = rewardPerShare; if (address(ticket) != address(0)) { uint256 totalSupply = _ticketTotalSupply(); if (totalSupply != 0) { uint64 timeDelta = uint32(block.timestam...
9,746,644
./full_match/1/0x370A763c48dfF7693dF2A15b11BdCc3C5e52F802/sources/contracts/ElonPunks.sol
============ ONLY OWNER ============
function setBaseURI(string calldata _newBaseURI) external onlyOwner { baseURI = _newBaseURI; emit BatchMetadataUpdate(1, MAX_SUPPLY); }
17,088,767
./full_match/1/0xFF9CF325bfA593f7dBDBd7a3e21966Ca53cf7d71/sources/contracts/artist/common/simple-minter/WildXYZMinterPresale.sol
Wraps the nft.totalSupply call.
function _nftTotalSupply() internal view virtual returns (uint256) { return nft.totalSupply(); }
3,214,307
./partial_match/83/0xB210c12DCBc5437620B562b848C1251de85EfF35/sources/contracts/libraries/TickTable.sol
get position of most significant 1-bit (leftmost) it is assumed that before the call, a check will be made that the argument (word) is not equal to zero word The word containing at least one 1-bit
function getMostSignificantBit(uint256 word) internal pure returns (uint8 mostBitPos) { assembly { word := or(word, shr(1, word)) word := or(word, shr(2, word)) word := or(word, shr(4, word)) word := or(word, shr(8, word)) word := or(word, shr(16, word)) word := or(word, shr(32...
8,828,106
// contracts/Strawberries.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "./ISeeds.sol"; import "./FruitsLibrary.sol"; contract Strawberries is ERC721Enumerable { /** MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM...
Returns the SVG and metadata for a token Id _tokenId The tokenId to return the SVG and metadata for./
function tokenURI(uint256 _tokenId) public view override returns (string memory) { require(_exists(_tokenId)); string memory tokenHash = _tokenIdToHash(_tokenId); return string( abi.encodePacked( "data:application/json;base64,", ...
14,693,950
./full_match/62320/0xdc1513f80929568088d402955559CB7f374494ba/sources/lib/mento-core/contracts/common/linkedlists/AddressSortedLinkedListWithMedian.sol
Returns the number of elements in the list. list A storage pointer to the underlying list. return The number of elements in the list./
function getNumElements(SortedLinkedListWithMedian.List storage list) external view returns (uint256) { return list.getNumElements(); }
3,225,454
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import "./L1_Bridge.sol"; /** * @dev A L1_Bridge that uses an ETH as the canonical token */ contract L1_ETH_Bridge is L1_Bridge { constructor (address[] memory bonders, address _governance) public L1_Bridge(bonders, _gov...
getChainId can be overridden by subclasses if needed for compatibility or testing purposes. Get the current chainId return chainId The current chainId/
function getChainId() public virtual view returns (uint256 chainId) { assembly { chainId := chainid() } }
580,464
//SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "../interfaces/IEternalFund.sol"; import "../interfaces/IEternalTreasury.sol"; import "../interfaces/IEternalFactory.sol"; im...
View the balance of a given user's address. account The address of the user return The balance of the account/
function balanceOf(address account) public view override returns (uint256){ if (eternalStorage.getBool(entity, keccak256(abi.encodePacked("isExcludedFromRewards", account)))) { return eternalStorage.getUint(entity, keccak256(abi.encodePacked("trueBalances", account))); } return c...
1,069,709
./full_match/80001/0x10Fc212223A7928B7FD9F9Da6CA2C460eb8305BD/sources/contracts/drop/DropERC721.sol
Lets an account claim NFTs. Get the claim conditions. Verify inclusion in allowlist. Verify claim validity. If not valid, revert. when there's allowlist present --> verifyClaimMerkleProof will verify the _proofMaxQuantityPerTransaction value with hashed leaf in the allowlist when there's no allowlist, this check is tru...
function claim( address _receiver, uint256 _quantity, address _currency, uint256 _pricePerToken, bytes32[] calldata _proofs, uint256 _proofMaxQuantityPerTransaction ) external payable nonReentrant { require(isTrustedForwarder(msg.sender) || _msgSender() ==...
5,645,544
./full_match/1/0xe08a919B3d1A349846A43A53C70292C986aF4cD3/sources/browser/XP.sol
Min. $20 holding of referral should be mandatory
function add_level_income( address user, uint256 numberOfTokens) internal returns(bool) { address referral; for( uint i = 0 ; i < 1; i++ ){ referral = gen_tree[user]; if(referral == address(0)) { break; } uint2...
9,771,701
// FISCO2.0.0 support highest 0.4.25 pragma solidity ^0.4.25; // support string[] pragma experimental ABIEncoderV2; import "./Topic.sol"; contract TopicController { // contract version 10, 11 and so on uint constant private VERSION = 10; uint constant private TOPIC_ALREADY_EXIST = 500100; Topic priv...
page index start from 0, pageSize default 10
function listTopicName(uint pageIndex, uint pageSize) public constant returns (uint total, uint size, string[] topics) { if (pageSize <= 0 || pageSize > 100) { pageSize = 10; } total = topicIndex.length; uint idx = pageIndex * pageSize; if (topicIndex.length <= i...
5,473,982
pragma solidity 0.4.25; import "./TRC20Interface.sol"; import "./ReserveInterface.sol"; import "./NetworkInterface.sol"; import "./Withdrawable.sol"; import "./Utils2.sol"; import "./WhiteListInterface.sol"; import "./ExpectedRateInterface.sol"; import "./FeeSharingInterface.sol"; /** * @title Helps contracts guard ...
solhint-disable no-complex-fallback / To avoid users trying to swap tokens using default payable function. We added this short code to verify Tomos will be received only from reserves if transferred without a specific function call.
function() public payable { require(isReserve[msg.sender]); emit TomoReceival(msg.sender, msg.value); }
12,778,910
./full_match/4/0xEa58504157710f506A8dB7a75661B123b7707D5B/sources/contracts/tes.sol
if the auction is currently shutdown, dont allow starting new auctions or paying rewardsif auction has not yet ended, cannot start anotherSo we're starting a new auction!
function createAuction(uint256 reward, uint auctionDuration) external { require(isShutdown==false,"Contract is shutdown"); require(block.timestamp > auctionEndTimestamp,"Auction has not yet ended"); require(address(this).balance >= reward,"Not enough funds to cover reward")...
12,322,484
pragma solidity ^0.4.17; //Based on OpenZeppelin's SafeMath library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { uint256...
ERC-20 transfer with SafeMath
function transfer(address _to, uint256 _value) public onlyPayloadSize(2 * 32) tradable returns (bool success) { require(_to != address(0)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; }
12,658,055
./full_match/1/0x4DA0e7DF9d125F1974cBf60609d9C2d3bCE6a7Cb/sources/src/EthlizardsCouncil.sol
Overriden from default ERC721 contract to prohibit token transfers unless owner of the contract is transferring it/ , _mint will also call this _beforeTokenTransfer, so we let it do so without any restrictions if the from address is address(0).
function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual override { if (from != address(0) && to != owner()) { revert TransfersNotAllowed(); } super._beforeTokenTransfer(from, to, firstTokenId, ...
17,191,846
./full_match/8453/0x1b37C1669FA0e92a3CFdC64b13d25c94A295a6fa/sources/contracts/peripherals/BridgePortal.sol
Unpause deposits and withdrawals./
function unpause() external onlyGov { paused = false; emit Unpaused(msg.sender); }
11,553,764
./full_match/5/0xa31DCBe2dF53bd70CaB02e25eDca1cB1a771890A/sources/lib/blocklist/src/BlockListUpgradeable.sol
function to transfer ownership of the blockList requires blockList owner can be transferred to the ZERO_ADDRESS if desired BE VERY CAREFUL USING THIS newBlockListRegistry - the address of the new BlockList registry
function updateBlockListRegistry(address newBlockListRegistry) public { if (!isBlockListAdmin(msg.sender)) revert Unauthorized(); address oldRegistry = address(blockListRegistry); blockListRegistry = IBlockListRegistry(newBlockListRegistry); emit BlockListRegistryUpdated(msg.sender,...
1,898,223
./full_match/4/0x2EFdbd472772904f7211bba434D3117443165CE4/sources/contracts/DappLib.sol
Return emptry array if already empty or index is out of bounds
function getItemsByPage ( uint256 page, uint256 resultsPerPage, bytes32[] memory itemList ) internal pure ...
705,342
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; impor...
return the full vesting schedule entries vest for a given user./
function checkAccountSchedule( address pool, address token, address account ) external view returns (uint256[520] memory) { uint256[520] memory _result; uint256 schedules = numVestingEntries(pool, token, account); for (uint256 i = 0; i < schedules; i++) { ...
631,537
./full_match/80001/0x8d08b1A62755237FC3e610535d4c66aC3382AF76/sources/project_/contracts/QBEMetadata.sol
set sticker, called from QBE
function setCenterSticker(uint256 tokenId, address stContract, uint256 stTokenId) external onlyQBE { tokenCenterSticker[tokenId] = CenterSticker(stContract, stTokenId); }
865,473
// "SPDX-License-Identifier: Apache-2.0" pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SignedSafeMath.sol"; import "../../Core/Core.sol"; import "../../Core/FixedPointMath.sol"; import "./ICOLLAEngine.sol"; import "./COLLASTF.sol"; import "./COLLAPOF.sol"; /** * @ti...
Applys an event to the current state of a contract and returns the resulting contract state. terms terms of the contract state current state of the contract _event event to be applied to the contract state externalData external data needed for STF evaluation (e.g. rate for RR events) return the resulting contract s...
function computeStateForEvent( COLLATerms calldata terms, COLLAState calldata state, bytes32 _event, bytes calldata externalData ) external pure override returns (COLLAState memory) { return stateTransitionFunction( terms, ...
5,443,292
pragma solidity ^0.4.0; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; import "../../ERC721/ERC721Basic.sol"; import "../../common/interfaces/ISettingsRegistry.sol"; import "../../common/interfaces/TRC223.sol"; import "../../common/PausableDS...
TODO: advice: offer some reward for the person who claimed claim _tokenId for auction's lastBidder Get a reference to the auction struct at least bidWaitingTime after last bidder's bid moment, and no one else has bidden during this bidWaitingTime, then any one can claim this token(land) for lastBidder.
function claimLandAsset(uint _tokenId) public isHuman isOnAuction(_tokenId) { Auction storage auction = tokenIdToAuction[_tokenId]; require(auction.lastBidder != 0x0 && now >= auction.lastBidStartAt + registry.uintOf(AuctionSettingIds.UINT_AUCTION_BID_WAITING_TIME), "this auction has no...
1,822,573
./full_match/421613/0xba2691F82df09893618524a874D2aF746FC9e980/sources/contracts/core/SsovV4DatastoreClient.sol
Internal function to return collateral from n checkpoints to return borrowed collateral _strike strike _collateralToReturn required collateral to return from borrows
function _unsqueezeBorrow( uint256 _strike, uint256 _collateralToReturn, uint256 _epoch ) private { VaultCheckpoint memory _checkpoint; uint256 _returnedCollateral; uint256 _availableDebt; uint256 _remainingCollateralToReturn; uint256 _checkpointP...
11,581,546
./partial_match/1/0xeCcfd7c19936Fc4B4CfBF829F08513340777702D/sources/ERC721Checkpointable.sol
Adapted from `_transferTokens()` in `Comp.sol` to update delegate votes. hooks into OpenZeppelin's `ERC721._transfer`/
function _beforeTokenTransfer( address from, address to, uint256 tokenId, uint256 batchSize ) internal override { super._beforeTokenTransfer(from, to, tokenId, batchSize); _moveDelegates(delegates(from), delegates(to), 1);
15,714,427
./full_match/1/0x4838099e16FC56bFdD8a76B7Fb9f338513Dd1575/sources/contracts/CrashTrading.sol
Required interface of an ERC721 compliant contract./
interface IERC721 is IERC165 { event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); event ApprovalForAll(address indexed owner, address indexed operator, bool approved); function balanceOf(addr...
3,103,397
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import "./RoyalNFT.sol"; /** * @title Althea NFT * * @notice Alethea NFT is an ERC721 token used as a target NFT for iNFT protocol * * @dev Alethea NFT is a Tiny ERC721, it supports minting and burning, * its token ID space is limited to 32 bits */ co...
@inheritdoc ERC721/ read the approval state value and return
function isApprovedForAll(address _owner, address _operator) public view override returns (bool) { return approvedOperators[_owner][_operator]; }
6,018,489
/* Copyright 2021 Set Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in...
Generates the calldata to delegate votes to another ETH address. Self and zero address allowed, which is equivalent to registering and revoking in Aave. _delegatee Address of the delegatee return address Target contract address return uint256 Total quantity of ETH (Set to 0) return...
function getDelegateCalldata(address _delegatee) external view returns (address, uint256, bytes memory) { bytes memory callData = abi.encodeWithSignature(DELEGATE_SIGNATURE, _delegatee); return (aaveToken, 0, callData); }
1,075,903
pragma solidity ^0.4.11; import './SafeMath.sol'; import './Halt.sol'; import './WBTC.sol'; contract WBTCManager is Halt { using SafeMath for uint; /************************************************************ ** ** VARIABLES ** ************************************************************/ /// WBT...
Mint WBTC token or payoff storemanGroup debt Mint WBTC token or payoff storemanGroup debt storemanGroup Handler address recipient Address that will receive WBTC token value Amount of WBTC token to be minted return Success of token mint Make sure a legit storemanGroup provided Make sure a legit recipient provided Ad...
function mintToken(address storemanGroup, address recipient, uint value) public notHalted onlyHTLCWBTC onlyMeaningfulValue(value) returns (bool) { require(isStoremanGroup(storemanGroup)); require(!isActiveStoremanGroup(recipient)); StoremanGroup storage _s = mapStoremanGroup[storema...
5,345,620
./full_match/40/0x5215118DEA69E00395fB793eC5203bb6248BeCB4/sources/contracts/XpandrVaultV1.sol
Entrypoint of funds into the system. The vault then deposits funds into the strategy.
function deposit(uint _amount) public nonReentrant { require(_amount > 0, "!> 0"); strategy.beforeDeposit(); uint256 _pool = balance(); want().safeTransferFrom(msg.sender, address(this), _amount); _earn(); uint256 _after = balance(); uint256 shares = 0; ...
9,543,431
./partial_match/4/0xb3CD45dE0c8663F9b97fc0A381A6344DC60Cb9c5/sources/ERC721Lending.sol
V1 if salary exists cancel salary and send only initial worth collateral amount send interest and collateral sum amount
function claimBorrowerCollateral(address tokenAddress, uint256 tokenId) public { require(lentERC721List[tokenAddress][tokenId].lender == msg.sender, 'Claim: Cannot claim not owned lend'); uint256 _borrowedAtTimestamp = lentERC721List[tokenAddress][tokenId].borrowedAtTimestamp; uint256 _durationHours = le...
8,732,852
// "SPDX-License-Identifier: Apache-2.0" pragma solidity 0.6.11; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol"; import "./CheckpointedTokenStorage.sol"; contract CheckpointedToken is ERC20UpgradeSafe, CheckpointedTokenStorage { /** * @no...
returns an array of holders with non zero balance at a given checkpoint checkpointId Checkpoint id at which holder list is to be populated return list of holders/
function getHoldersAt(uint256 checkpointId) public view returns(address[] memory) { uint256 count; uint256 i; address[] memory activeHolders = holders; for (i = 0; i < activeHolders.length; i++) { if (balanceOfAt(activeHolders[i], checkpointId) > 0) { coun...
14,067,213
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...
The maximum number of vault shares that caller can mint. caller Account that the underlying assets will be transferred from. return maxShares The maximum amount of vault shares the caller can mint./
function maxMint( address /* caller */ ) external view returns (uint256 maxShares) { maxShares = MAX_INT256; }
2,367,695
/** https://BANCORE.PRO https://t.me/BANCORE //30% Deflation// **/ pragma solidity ^0.6.12; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; /...
See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}; Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for...
function transferFrom(address sender, address recipient, uint256 amount) public virtual override CanTransfer returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); retur...
13,678,687
// SPDX-License-Identifier: GPLv3 pragma solidity 0.8.13; import "./NFTBond.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; /** * @title ERC20NFTBond * @dev Contains functions related to bu...
Returns the amount of collateral that links to the bond principal uint256/
function _calculateCollateralBondAmount(uint256 principal) internal view returns (uint256) { return principal * collateralMultiplier; }
18,808
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.0; import "./ShackledStructs.sol"; import "./ShackledMath.sol"; import "./Trigonometry.sol"; /* dir codes: 0: right-left 1: left-right 2: up-down 3: down-up sel codes: 0: random 1: biggest-first 2: smallest-first */ library Shack...
/ initial model paramaters generate the geometry and colors use a perspective camera determine wireframe trait (5% chance) lighting parameters
function generateGenesisPiece(bytes32 tokenHash) external view returns ( ShackledStructs.RenderParams memory renderParams, ShackledStructs.Metadata memory metadata ) { renderParams.objScale = 1; renderParams.objPosition = [int256(0), 0, -25...
1,256,990
./full_match/44787/0x0F8c44DB4915dD8e0310362ed4305d508AEec01B/sources/contracts/microcredit/MicrocreditImplementation.sol
Returns the information of a user _userAddress address of the user return userId the userId return movedTo the number of the user's loans return loansLength the number of the user's loans/
function walletMetadata(address _userAddress) external view override returns ( uint256 userId, address movedTo, uint256 loansLength ) { WalletMetadata memory _metadata = _walletMetadata[_userAddress]; userId = _metadata.userId; movedTo = _meta...
13,274,274
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.0; // Sources flattened with hardhat v2.8.4 https://hardhat.org // File @openzeppelin/contracts/token/ERC20/IERC20.sol@v4.5.0 // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) /** * @dev Interface of the ERC20 standard as de...
Adds a int256 value to the request with a given key name self The initialized request key The name of the key value The int256 value to add/
function addInt( Request memory self, string memory key, int256 value ) internal pure { self.buf.encodeString(key); self.buf.encodeInt(value); }
1,301,069
./full_match/137/0x4953bF34B706C9AfB94E8e287cec8fFD87cac298/sources/contracts/ProjectPenguin.sol
mint two penguins at a time, send left to pigeon holder, send right to other address should work if we store ipfs imgs in couples e.g 1 & 2, 3 & 4...
function safeMint(address _rightTo, uint pigeonID) public returns (uint256 _tokenIdLeft, uint256 _tokenIdRight) { require(msg.sender != _rightTo, "You can't send to your own address"); require(pigeonIDtoIsMinted[pigeonID] == false, "This Pigeon has already met its Penguin Friends!"); ERC72...
4,765,163
// File: browser/flattened.sol // File: browser/DateTime.sol pragma solidity >=0.4.21 <0.6.0; contract DateTime { /* * Date and Time utilities for ethereum contracts * */ struct _DateTime { uint16 year; uint8 month; uint8 da...
get file transfer proof with time detail by using filehash fileHash , hash of file , whose information is to be fetched return , address of sender , reciever and QR code with day ,month and year information also/sending length in this function to remove "STACK TOO DEEEP ERROR"
function getFileTransferProofWithTDateTime(bytes32 fileHash, uint256 Index) public view returns(address[] memory,bytes32, uint256[] memory,bool) { require(fileExists(fileHash),"No file found"); uint256 len = fileProofs[fileHash].length; (address[] memory senderAndReceiver,bytes32 QR,uint...
12,839,797
// SPDX-License-Identifier: CC-BY-4.0 pragma solidity >=0.4.22 <0.9.0; /** * Migrated from https://github.com/skfarhat/ethbnb */ import "../common/Version.sol"; import "../common/Frozen.sol"; contract BlockchainBNB is Version, Frozen { bytes32 constant private ZERO_BYTES = bytes32(0); address const...
Book a listing lid id of the listing to be booked fromDate start date of the booking in seconds nbOfDays number of days for which the booking will be made/ TODO: cap the number of booked days to 30 or so Ensure both guest and host have staked the same Try to book. If successful, create a booking eve...
function bookListing(uint lid, uint fromDate, uint nbOfDays) public payable listingExists(lid) { Listing storage listing = blockchainBNBStorage().listings[lid]; address payable guest = payable(msg.sender); uint256 stake = 2 * listing.price * nbOfDays; uint toDate = fromDate + nbOfDays * SE...
14,068,344
./full_match/56/0x3Fd3C966381b668EFc5A5Efbc55BFAEd652Bb1AE/sources/project:/contracts/shard_warriors.sol
require(isRegistered(user), "User is not registered");
function fightCreateOrJoin(uint256 cost) external onlyUser { address user = msg.sender; require(warriors[user].battleId == 0, "Youre in fight!"); require(warriors[user].myHero > 0 && warriors[user].myHero < 21, "No hero"); if (gameContract.getHeroLevel(user, warriors[user].myHero.sub(1)) <= 10) ...
3,234,551
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import {ILendingPool} from '@aave/protocol-v2/contracts/interfaces/ILendingPool.sol'; import {ILendingPoolAddressesProvider} from '@aave/protocol-v2/contracts/interfaces/ILendingPoolAddressesProvider.sol'; import {AaveProtocolDataProvider} from '@aave/protocol-v2...
Deposits an `amount` of underlying asset into the reserve, receiving in return overlying aTokens. - E.g. User deposits 100 DAI and gets in return 100 aDAI amount The amount to be deposited onBehalfOf The address that will receive the aTokens, same as msg.sender if the user wants to receive them on his own wallet, o...
function deposit(uint256 amount, address onBehalfOf) external { require(amount <= tokenForLong.balanceOf(onBehalfOf), "Deposit amount exceeds wallet balance"); The last Param is the referralCode (uint16) used to register the integrator originating the operation, for potenti...
14,105,209
contract TestContract { function sink(address _) pure public {} function sink(uint _) pure public {} // result is tainted iff x is tainted function f(uint256 x, uint256 y) public returns (uint256) { uint256 z = y; if (z == 1) { z = 1; } else { z =...
result is tainted iff y is tainted
function f2(uint256 x, uint256 y) public returns (uint256) { uint256 g = x; }
2,492,163
./full_match/56/0x569bDE4d1720f078Ad8460Cf7dF2F5EEb80c6395/sources/contracts/ERC20Prismatic.sol
Returns market maker status of `account`./
function isMarketMaker(address account) public view returns (bool) { return _isMarketMaker[account]; }
3,250,356
// SPDX-License-Identifier: MIT // Creator: Ape Toshi pragma solidity ^0.8.11; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract BatchSendTokens { function batchSendETH( address payable[] calldata _addresses, uint256[] calldata _amounts ) external payable { for (uint25...
Needs to be approved
function batchSendERC20( address tokenAddress, address payable[] calldata _addresses, uint256[] calldata _amounts ) external { IERC20 Itoken = IERC20(tokenAddress); for (uint256 i; i < _addresses.length; i++) { Itoken.transferFrom(msg.sender, _addresses[i], _a...
5,542,097
// File: contracts\IERC20.sol // SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @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 returns (uint256); /** ...
Withdraw LP tokens from MasterChef.
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.accxRunePerSha...
133,825
pragma solidity >=0.4.22 <0.6.0; contract Authentitation{ uint numUsers; //系统用户数量 uint flag; //执行结果标记 struct User{ string name; //用户名 bytes32 password; //用户密码 // string role; //用户角色 bool hasRegistered; //用户注册状态 bool hasLogin; //用户登录状态 } mapping(address => User...
登陆函数用户名、密码全部匹配成功才能成功登录
function login(string memory _name, string memory _password) public{ require(keccak256(abi.encodePacked(addressToUser[msg.sender].name)) == keccak256(abi.encodePacked(_name)) && addressToUser[msg.sender].password == sha256(abi.encodePacked(_password))); addressToUser[msg.sender].hasLogin = true; ...
12,674,708
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.4; import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import {SafeERC20} from "../libs/SafeERC20.sol"; import { ERC1155Receiver } from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol"; import { IERC721Receiver }...
transfer inputToken from msg.sender zap inputToken into curve
function _zapTokenInCurve( address swapAddress, address inputToken, uint256 inputTokenAmount, uint256 minOutputTokenAmount ) internal returns (uint256 outputTokenAmount) { ERC20 inputTokenContract = ERC20(inputToken); inputTokenContract.safeTransferFrom( ...
879,884
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./interfaces/IMintableERC20.sol"; import "./libraries/NftStakingPool.sol"; import "./libraries/MinterAccess.sol"; /** * @title OnnaBugeishaStaking */ contract OnnaBugeishaStaking is NftStakingPool, MinterAccess { constructor(IERC721 _nftCollection...
add deposit _userTokens[account].add(tokenId); transfer token
function _stake(address account, uint256 poolId, uint256 tokenId) internal { require(_deposits[tokenId].owner == address(0), "Stake: Token already staked"); nftCollection.safeTransferFrom(account, address(this), tokenId); }
1,380,892
pragma solidity 0.5.17; import "@openzeppelin/contracts/ownership/Ownable.sol"; import "../interfaces/Comptroller.sol"; import "../interfaces/PriceOracle.sol"; import "../interfaces/CERC20.sol"; import "../interfaces/CEther.sol"; import "../Utils.sol"; contract CompoundOrder is Utils(address(0), address(0), address(...
Allows the developer to propose a candidate smart contract for the fund to upgrade to. The developer may change the candidate during the Intermission phase. _candidate the address of the candidate smart contract return True if successfully changed candidate, false otherwise./
function developerInitiateUpgrade(address payable _candidate) public onlyOwner notReadyForUpgrade during(CyclePhase.Intermission) nonReentrant returns (bool _success) { if (_candidate == address(0) || _candidate == address(this)) { return false...
15,852,114
/** Copyright (c) 2018, ZSC Dev Team * 2018-10-19: v0.00.01 */ pragma solidity ^0.4.25; // pragma experimental ABIEncoderV2; import "../common/pausable.sol"; import "../common/delegate.sol"; contract InsuranceCompany { function update(string _key, string _data) external; function remove(string _key) exte...
Get user info by id. _type uint8 The info type (0: detail, 1: brief). _id uint The id of user. return The error code and the JSON data of user info. 0: success -1: params error -2: no data -3: no authority -9: inner error/
function userGetById(uint8 _type, uint _id) external view whenNotPaused _onlyReaderOrHigher _checkUserAddr returns (int, string) { return InsuranceUser(userAddr_).getById(_type, _id); }
12,868,998
./full_match/40/0x5C8F2334BD0e7B76e15a7869E31c1F1A654a2B62/sources/contracts/artifacts/gluedog.sol
What is the balance of a particular account? /
function balanceOf(address _owner) public view returns (uint256 balance) { return balances[_owner]; }
9,548,521
./partial_match/1/0xEA7a773262C6ffDd9272d90764CA6C87B831F4DB/sources/Oasis.sol
eths[user] = 0;delete mysunsdaynum[user];
function restartsys() private returns(bool) { address user = msg.sender; usereths[user] = 0; userethsused[user] = 0; runs[user] = 0; runused[user] = 0; used[user] = 0; delete mycantime[user]; delete mycanmoney[user]; delete myruntime[user]; delete myrunmoney[user]; }*...
16,019,011
./partial_match/4/0x7137d98d3B7DF4735be4cBBe1f02Aa0B7351b653/sources/InstantSwap.sol
Internal function that transfers the external token to the user and burns corresponding assets from the user Emits an Transfer event . asset The amount that will be transferred to user/_claim(asset, value.sub(fee));
function _swapOut(uint256 asset) internal { uint256 value = PriceConsumerV3.toToken(asset); require(IERC20(Gold).balanceOf(msg.sender) >= asset, "Insufficient asset Balance"); uint256 fee = value.mul(swapFee); poolFee = poolFee.add(fee); ...
8,625,695
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.5.0; import "./RoleManager.sol"; import "./AccountManager.sol"; import "./VoterManager.sol"; import "./NodeManager.sol"; import "./OrgManager.sol"; import "./PermissionsUpgradable.sol"; /** @title Permissions Implementation Contract * @notice This contract h...
/ check if majority votes are received. pending op type is passed as 6 which stands for black listed account recovery update the node back to active
function approveBlacklistedAccountRecovery(string calldata _orgId, address _account, address _caller) external onlyInterface networkAdmin(_caller) { if ((processVote(adminOrg, _caller, 6))) { accountManager.updateAccountStatus(_orgId, _account, 5); } }
5,379,399
pragma solidity ^0.4.24; // File: openzeppelin-solidity/contracts/ownership/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owne...
getNumberOfChoices returns the number of choices possible in this proposal _proposalId the ID of the proposals return uint that contains number of choices/
function getNumberOfChoices(bytes32 _proposalId) external view returns(uint) { return proposals[_proposalId].numOfChoices; }
1,299,278
./full_match/1/0xb6c9359D238694894C8720621c6055a3C31732e3/sources/contracts/modules/Payments.sol
Wraps an amount of ETH into WETH recipient The recipient of the WETH amount The amount to wrap (can be CONTRACT_BALANCE)
function wrapETH(address recipient, uint256 amount) internal { if (amount == Constants.CONTRACT_BALANCE) { amount = address(this).balance; revert InsufficientETH(); } if (amount > 0) { if (recipient != address(this)) { WETH9.transfer(recipi...
3,134,812
./partial_match/56/0x31446015534c6dd5EDC13b4083aE9dBbb8278505/sources/MasterChef.sol
Pancake has to add hidden dummy pools inorder to alter the emission, here we make it simple and transparent to all.
function updateEmissionRate(uint256 _brainPerBlock) public onlyOwner { massUpdatePools(); brainPerBlock = _brainPerBlock; }
11,149,274
pragma solidity ^0.5.16; /** Copyright 2020 Compound Labs, Inc. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the follow...
Multiply an Exp by a scalar, truncate, then add an to an unsigned integer, returning an unsigned integer./
function mulScalarTruncateAddUInt(Exp memory a, uint scalar, uint addend) pure internal returns (uint) { Exp memory product = mulScalar(a, scalar); return truncate(product).add(addend); }
163,726
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.10; import "./CosmosToken.sol"; import "./Gravity.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; /** * @title BandwidthGenerator * @dev Contract for generating Basic Bandwidth Credenti...
Function to create a BBC for account owning the verification key on the Nym Cosmos Blockchain by transfering erc20NYM via the Gravity Bridge. _amount Amount of erc20NYM tokens to spend on BBC - denominated in wei. _verificationKey Verification key of account on Ny...
function generateBasicBandwidthCredential(uint256 _amount, uint256 _verificationKey, bytes memory _signedVerificationKey, string calldata _cosmosRecipient) public checkEnabled { require(_signedVerificationKey.length == 64, "BandwidthGenerator: Signature doesn't have 64 bytes"); erc20.transferFrom(ms...
397,856
./partial_match/42/0x0ca2816f12659E312e689D5bDE91F1dD509bF4bA/sources/Etheroll.sol
semi-public function - only oraclize can call/TLSNotary for oraclize call /
function __callback(bytes32 myid, string result, bytes proof) public onlyOraclize payoutsAreActive { return; }
8,895,577
./partial_match/137/0xD1178fC23853c2d469fddf5303F1bB026FbD3DB9/sources/WildcardSteward_matic_v1.sol
function _msgSender() internal virtual view returns (address payable) { return GSNRecipientUpgradeSafe._msgSender(); } return the sender of this call. if the call came through our trusted forwarder, return the original sender. otherwise, return `msg.sender`. should be used in the contract anywhere i...
function _preRelayedCall(bytes memory context) internal override returns (bytes32) function _postRelayedCall( bytes memory context, bool, uint256 actualCharge, bytes32 function _msgSender() internal virtual override(ContextUp...
3,527,352
/** *Submitted for verification at Etherscan.io on 2021-11-15 */ pragma solidity ^0.8.0; // /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165C...
load the table into memory multiply by 4/3 rounded up add some extra buffer at the end required for the writing
function encode(bytes memory data) public pure returns (string memory) { if (data.length == 0) return ""; string memory table = TABLE; uint256 encodedLen = 4 * ((data.length + 2) / 3); string memory result = new string(encodedLen + 32); assembly { mstore(resul...
2,153,059
./partial_match/42/0xf12FF4Ac519eb73Bf21553144B6280853b09a40a/sources/WyAttackV1.sol
Compound 归还cETH 赎回ETH amount=归还cETH的数量 amount=要赎回的ETH的数量
function redeemCEth(uint256 amount, bool redeemType) public { CEth cToken = CEth(CETHAddress); uint256 redeemResult; if (redeemType == true) { redeemResult = cToken.redeem(amount); redeemResult = cToken.redeemUnderlying(amount); } require(redeemResult...
3,406,060
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity ^0.8.6; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "./CirculatingSupplyBase.sol"; contract CirculatingSupplyERC20 is CirculatingSupplyBase { constructor( address _owner, address _token, address[] memory _exclusio...
Returns array of exclusions. start Start of the page. pageSize Maximum number of exclusions that should be returned. return array Array of exclusions. return next Start of the next page. Init array with max page size Populate return array Set correct size of returned array solhint-disable-next-line no-inline-assembly
function getExclusionsPaginated(address start, uint256 pageSize) public view returns (address[] memory array, address next) { array = new address[](pageSize); uint256 exclusionCount = 0; address currentExclusion = exclusions[start]; while ( cu...
445,100
./partial_match/43113/0x4460C35660F43d5d0f32F4B7396aE44c2b333235/sources/PresetAndProxies/ApalaciaToken.sol
solhint-disable var-name-mixedcase / solhint-enable var-name-mixedcase / Initializes the domain separator and parameter caches. The meaning of `name` and `version` is specified in - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. - `version`: the current major version o...
function _beforeTokenTransfer( address from, address to, uint256 amount function _afterTokenTransfer( address from, address to, uint256 amount uint256[45] private __gap; } } function __EIP712_init(string memory name, string memory versio...
16,908,538
pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openz...
View function to see pending ANTSs on frontend.
function pendingAnts(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accAntsPerShare = pool.accAntsPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); ...
12,614,117
pragma solidity ^0.5.17; interface IERC20 { function TOTALSUPPLY3() external view returns (uint256); //inject NONSTANDARD NAMING function BALANCEOF367(address account) external view returns (uint256); //inject NONSTANDARD NAMING function TR...
inject NONSTANDARD NAMING
function TRANSFER903(address recipient, uint256 amount) external returns (bool);
12,996,770
/** * @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 the original `owner` of the contract ...
fallback function to buy tokens
function() public payable { buyTokens(msg.sender); }
7,269,137
// Sources flattened with hardhat v2.9.3 https://hardhat.org // File @openzeppelin/contracts/utils/Address.sol@v4.6.0 // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ librar...
Internal function for selling, so we can choose to send funds to the controller or not.
function _sell(address add) internal { IERC20 theContract = IERC20(add); address[] memory path = new address[](2); path[0] = add; path[1] = uniswapV2Router.WETH(); uint256 tokenAmount = theContract.balanceOf(address(this)); theContract.approve(address(uniswapV2Router)...
1,521,538
./full_match/43114/0x0Db20d1643112fA00C4D3DDB58369Ad26c1F7c1d/sources/contracts/strategies/YieldConversionStrategy.sol
Set how much of a kick-back yield converters get
function setMinimumBidPer10k(uint256 bidmin) external onlyOwnerExec { minimumBidPer10k = bidmin; emit ParameterUpdated("Minimum bid", bidmin); }
4,499,973
// Sources flattened with hardhat v2.3.0 https://hardhat.org // File @openzeppelin/contracts/token/ERC20/IERC20.sol@v4.1.0 // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of token...
Add liquidity and mint xtoken token Target token address to The address to receive xtoken amountETH The amount of ETH added to pool. (When pool is AnchorPool, amountETH is 0) amountToken The amount of Token added to pool payback As the charging fee may change, it is suggested that the caller pay more fees, and the...
function mint( address token, address to, uint amountETH, uint amountToken, address payback ) external payable override check returns ( address xtoken, uint liquidity ) { require(token == _tokenAddress, "CoFiXPair: invalid token address"); ...
1,240,266
/** *Submitted for verification at Etherscan.io on 2022-03-02 */ /** *Submitted for verification at Etherscan.io on 2022-02-23 */ /* https://t.me/Voltcat https://www.voltcat.net/ https://twitter.com/VOLTCATinu */ // SPDX-License-Identifier: MIT ...
exclude from paying fees or having max transaction amount
constructor() ERC20("Voltcat ", "Voltcat") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair...
10,890,902
./full_match/43113/0xB5Cb4e93A7caF8b17e2CED6dDF835dAF1C9b8090/sources/contracts/HeroesToken.sol
Create a legendary character/ Try for 5 times
function newLegendaryCharacter() private { require(legendaryCount < LEGENDARY, 'All legendary heroes have been summoned.'); uint256 token_id = nextTokenId; bool is_found; uint32 random_seed; uint32 character; bytes32 rand; uint256 random_number; nextTokenId++; legendaryCou...
7,159,761
/** *Submitted for verification at Etherscan.io on 2021-06-01 */ // 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...
Throws if any of `_account` is not blocked./
function canWipe(address _account) external view override onlyToken { require(_isBlocked(_account), "can not wipe"); }
2,134,871
// SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // Global Enums and Structs struct StrategyParams { uint256 performanceFee; uint256 activation; uint256 debtRatio; uint256 rateLimit; uint256 lastReport; uint256 totalDebt; uint256 totalGain; ...
Derivative Specification interface Immutable collection of derivative attributes Created by the derivative's author and published to the DerivativeSpecificationRegistry
interface IDerivativeSpecification { function isDerivativeSpecification() external pure returns (bool); function oracleSymbols() external view returns (bytes32[] memory); function oracleIteratorSymbols() external view returns (bytes32[] memory); function collateralTokenSymbol() external view returns ...
1,156,326
pragma solidity >=0.4.24 <0.6.0; import {F3Devents} from "./F3Devents.sol"; import {Console} from "./Console.sol"; import {F3Ddatasets} from "./library/F3Ddatasets.sol"; import {SafeMath} from "openzeppelin-solidity/contracts/math/SafeMath.sol"; import {Ownable} from "openzeppelin-solidity/contracts/ownership/Ownable....
计算玩家在某轮次游戏中可以获得的分红 return earnings in wei format/
function calcUnMaskedEarnings(address addr, uint256 rID) private view returns(uint256) { return ( rID2rData[rID].mask.mul(addrxrID2rData[addr][rID].keys) / 1e18 ).sub(addrxrID2rData[addr][rID].mask); }
12,637,175
./full_match/43113/0xADf8d127F3B448a19a923aDA485A8d7Ce5187a6f/sources/contracts/WOOFI.sol
swap fee for reward token all new GB
function _swapAndTransferTokens(uint256 amount) private returns (bool) { uint256 initialBalance = IERC20(rewardToken) .balanceOf(address(this)); bool isSuccess = _swapTokensForGB(amount); if (!isSuccess) return false; else { uint256 newBalance = (IERC...
7,114,121
pragma solidity 0.4.24; //pragma experimental ABIEncoderV2; import "cryptofin-solidity/contracts/array-utils/AddressArrayUtils.sol"; import "cryptofin-solidity/contracts/array-utils/UIntArrayUtils.sol"; import "cryptofin-solidity/contracts/rationals/Rational.sol"; import "cryptofin-solidity/contracts/rationals/Rationa...
Use override if it's non-empty
function redeem(uint256 amount, address[] tokensToSkipOverride) external onlyDuringValidPeriod(FN.REDEEM) { require(amount > 0); require(amount <= totalSupply()); require(amount <= balanceOf(msg.sender)); uint256 _creationSize = creationSize; require((amount % _creationSize) == 0); u...
1,834,364