file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
// SPDX-License-Identifier: bsl-1.1 /* Copyright 2021 Unit Protocol: Artem Zakharov ([email protected]). */ pragma solidity 0.7.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "./WSSLPUserProxy.sol"; import "../../helpers/ReentrancyGuard.so...
Get tokens from user, send them to TopDog, sent to user wrapped tokens only user or CDPManager could call this method/ get tokens from user, need approve of sslp tokens to pool deposit them to TopDog wrapped tokens to user
function deposit(address _user, uint256 _amount) public override nonReentrant { require(_amount > 0, "Unit Protocol Wrapped Assets: INVALID_AMOUNT"); require(msg.sender == _user || vaultParameters.canModifyVault(msg.sender), "Unit Protocol Wrapped Assets: AUTH_FAILED"); IERC20 sslpToken = g...
1,248,800
/* Copyright 2019 dYdX Trading 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 ...
return zero if input amount is zero
function getTradeCost( uint256 inputMarketId, uint256 outputMarketId, Account.Info memory makerAccount, Account.Info memory /* takerAccount */, Types.Par memory oldInputPar, Types.Par memory newInputPar, Types.Wei memory inputWei, bytes memory data ...
6,438,727
// SPDX-License-Identifier: WTFPL pragma solidity =0.6.12; pragma experimental ABIEncoderV2; // import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; // Inheritance import "@openzeppelin/contracts/access/Ownable.sol"; import "../helpers/ERC20Staking.sol"; // Int...
Calculates earned points Streams points to users every second by dividing pointsPerDay by 86400 account Address of user return Points calculated at current block timestamp./
function earned(address account) public view returns (uint256) { uint256 blockTime = block.timestamp; return points[account].add( blockTime .sub(lastUpdateTime[account]) .mul(pointsPerDay) .div(86400) ...
14,870,823
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.4; import "../interfaces/IPermittedAirdrops.sol"; import "../utils/Ownable.sol"; /** * @title PermittedAirdrops * @author NFTfi * @dev Registry for airdropa supported by NFTfi. Each Airdrop is associated with a boolean permit. */ contract PermittedAirdrop...
This function can be called by admins to change the permitted status of an airdrop. This includes both adding an airdrop to the permitted list and removing it. _airdropContract - The address of airdrop contract whose permit list status changed. _selector - The selector of the permitted function whose permit list stat...
function _setAirdroptPermit( address _airdropContract, bytes4 _selector, bool _permit ) internal { require(_airdropContract != address(0), "airdropContract is zero address"); require(_selector != bytes4(0), "selector is empty"); airdropPermits[abi.encode(_airdrop...
427,271
./full_match/80001/0x38D7c5D106c93831351fc4c6C9686b5FE8dd28C3/sources/src/lib/PureHelpers.sol
Returns number of unique recipients. sortedAccounts _must_ be sorted for this to work properly
function _countUniqueRecipients(address[] memory sortedAccounts) internal pure returns (uint32) { uint32 numRecipients = uint32(sortedAccounts.length); uint32 numUniqRecipients = 1; address lastRecipient = sortedAccounts[0]; for (uint256 i = 1; i < numRecipients;) { if (s...
5,632,471
/** *Submitted for verification at Etherscan.io on 2022-04-01 */ // SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/security/ReentrancyGuard.sol // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a ...
Gas spent here starts off proportional to the maximum mint batch size. It gradually moves to O(1) as tokens get transferred around in the collection over time./
function ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) { if (!_exists(tokenId)) revert OwnerQueryForNonexistentToken(); unchecked { for (uint256 curr = tokenId;; curr--) { TokenOwnership memory ownership = _ownerships[curr]; i...
7,694,666
./full_match/1/0x2ccE22c7A4A9f66ee589464D883e85D91F35DD6b/sources/Sorbettiere.sol
Withdraw staked tokens from Sorbettiere.
function withdraw(uint256 _pid, uint128 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "Sorbettiere: you cant eat that much popsicles"); updatePool(_pid); uint128 pending = ...
3,088,662
pragma solidity 0.5.7; contract ERC20 { function symbol() public returns(string memory); function transfer(address to, uint256 value) public returns (bool); function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) p...
call to send ETH or tokens to users only owner can call the function to: Ethereum address to receive funds origin: public address in Bizanc.io value: value in wei
function withdrawEth (string memory withdrawHash, address payable to, address origin, uint value) public canAccess { if(address(to).send(value)) emit logWithdrawal (withdrawHash, to, origin, value, "ETH", address(0x0)); }
1,055,600
/** * Dragonking is a blockchain game in which players may purchase dragons and knights of different levels and values. * Once every period of time the volcano erupts and wipes a few of them from the board. The value of the killed characters * gets distributed amongst all of the survivors. The dragon king receive...
Knight can attack a dragon. Archer can attack only a balloon. Dragon can attack wizards and archers. Wizard can attack anyone, except balloon. Balloon cannot attack. The value of the loser is transfered to the winner. characterID the ID of the knight to perfrom the attack characterIndex the index of the knight in the...
function fight(uint32 characterID, uint16 characterIndex) public onlyUser { if (characterID != ids[characterIndex]) characterIndex = getCharacterIndex(characterID); Character storage character = characters[characterID]; require(cooldown[characterID] + config.CooldownThreshold() <= now, "...
7,817,326
./partial_match/137/0x7d1762E59eC0954C7A82e6E8c7FF52853DE483Ee/sources/DARKv2test1.sol
To set a new timelock contract for gov
function setTimelock(address new_timelock) external onlyByOwnerOrGovernance { timelock_address = new_timelock; }
3,510,132
./full_match/80001/0x4d6bb91Ba70af5cd3FdbfF000Aa9d2741DA5bD68/sources/contracts/CryptoHomiesGenesis.sol
total eth to mint 0.101 Calculate the platform fee Calculate the total amount to be paid by the user Transfer the platform fee to the specified address Refund any excess amount sent by the user
function _mint() internal { uint16 _tokenId = tokenIdCount + 1; require(saleActive, "Sale not active"); require(_tokenId <= MAX_SUPPLY, "No more items left"); require(msg.value >= mintRate, "Not enough ether sent"); require( !mintedUsers[currentStage][msg.sender],...
5,554,766
./partial_match/80001/0x7a6381D1B30230f29E0469705cF39432099748CA/sources/contracts/Contract.sol
Array of names for Silver package Array of names for Gold package
function getStakerName(address user) public view returns (string memory) { require(stakers[user].package != 0, "User has not purchased a package"); if (stakers[user].package == 1) { string[2] memory silverNames = ["Rookie", "D League"]; uint256 index = uint256(keccak256(abi.encodePacked(user, b...
8,797,351
./full_match/137/0xE1e46C14F9E400e928b0ead380B98a9309a2307B/sources/contracts/interfaces/uniswap/callback/IUniswapV3SwapCallback.sol
Callback for IUniswapV3PoolActionsswap Any contract that calls IUniswapV3PoolActionsswap must implement this interface
interface IUniswapV3SwapCallback { function uniswapV3SwapCallback( int256 amount0Delta, int256 amount1Delta, bytes calldata data ) external; pragma solidity >=0.8.4; }
4,684,723
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "./interfaces/IDivinium.sol"; import "./DiviniumGenesisStaker.sol"; import "./DiviniumCreaturesStaker.sol"; contract DiviniumStaker is UUPSUpgradeable, DiviniumGenesisS...
Sets the Creatures contract address only admin can run this function creaturesAddress Address of the contract/
function __DiviniumCreaturesStaker_init_unchained() internal onlyInitializing function setCreaturesAddress(address creaturesAddress) external onlyRole(DEFAULT_ADMIN_ROLE) { deployedCreature = ICreatures(creaturesAddress); grantRole(CREATURES_ROLE, creaturesAd...
463,934
./full_match/1/0xcB0900D9307Da7FD4e000A9093f24Ce25D937D42/sources/contracts/ClaimManagement.sol
Force file a claim for a COVER-supported contract `_protocol` that bypasses validateClaim by paying the `forceClaimFee` fee `_incidentTimestamp` must be within the past 14 days. Only callable when isAuditorVoting is true _protocol address: contract address of the protocol that COVER supports _protocolName bytes32: p...
function forceFileClaim(address _protocol, bytes32 _protocolName, uint48 _incidentTimestamp) external override onlyWhenAuditorVoting { require(_protocol != address(0), "COVER_CM: protocol cannot be 0"); require( _protocol == getAddressFromFactory(_protocolN...
9,760,452
./full_match/84531/0x861450380ad7099591f2b311b192E72eAdF86E2f/sources/contracts/access-control-registry/AccessControlRegistry.sol
Initializes a role by setting its admin role and grants it to the sender If the sender should not have the initialized role, they should explicitly renounce it after initializing it. Once a role is initialized, subsequent initializations have no effect other than granting the role to the sender. The sender must be a m...
function initializeRoleAndGrantToSender( bytes32 adminRole, string calldata description ) external override returns (bytes32 role) { require(bytes(description).length > 0, "Role description empty"); role = deriveRole(adminRole, description); if (getRoleAdmin(role) == DEFA...
11,504,862
./full_match/44787/0x254b15349D5EB0fbA7Fd834BcF59D033f5b174a0/sources/contracts/VerstContract.sol
Function to get burned tokens for a specific project Initialize a dynamic array to hold the results Counter to keep track of actual results
function getTokensBurnedForProject(uint256 projectId) public view returns (TokenBurn[] memory) { TokenBurn[] memory projectBurnedTokens = new TokenBurn[](burnedTokens.length); uint256 counter = 0; for (uint256 i = 0; i < burnedTokens.length; i++) { if (burnedTokens[i].projectId...
13,259,941
pragma solidity ^0.4.8; contract Token{ // token总量,默认会为public变量生成一个getter函数接口,名称为totalSupply(). uint256 public totalSupply; /// 获取账户_owner拥有token的数量 function balanceOf(address _owner) constant returns (uint256 balance); //从消息发送者账户中往_to账户转数量为_value的token function transfer(address _to,...
require(balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]);
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { require(balances[_from] >= _value && allowed[_from][msg.sender] >= _value); return true; }
5,545,600
./full_match/1/0xa0334AD349c1D805BF6c9e42125845B7D4F63aDe/sources/contracts/BlockHistory.sol
Parses the proof inputs for block history snark proofs proof the snark proof return proofParent the parentHash of the proof blocks return proofLast the lastHash of the proof blocks return proofRoot the merkle root of the proof blocks/
function parseProofInputs(SignedRecursiveProof calldata proof) internal pure returns ( bytes32 proofParent, bytes32 proofLast, bytes32 proofRoot ) { uint256[] calldata inputs = proof.inner.inputs; require(inputs.length == 12); ...
17,179,310
./full_match/4/0xf75701CD57BC4EF0ed9C4BeBB6751C859c4E7Ccb/sources/contracts/synthetix/SafeDecimalMath.sol
return The result of safely dividing x and y. The return value is as a rounded decimal in the precision unit specified in the parameter. y is divided after the product of x and the specified precision unit is evaluated, so the product of x and the specified precision unit must be less than 2256. The result is rounded ...
function _divideDecimalRound( uint x, uint y, uint precisionUnit ) private pure returns (uint) { uint resultTimesTen = x.mul(precisionUnit * 10).div(y); if (resultTimesTen % 10 >= 5) { resultTimesTen += 10; } return resultTimesTen / 10; }
13,306,110
/** *Submitted for verification at Etherscan.io on 2021-04-01 */ pragma solidity ^0.5.17; pragma experimental ABIEncoderV2; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because p...
overridable for testing
function getReserves(address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) { (address token0,) = UniswapV2Library.sortTokens(tokenA, tokenB); (uint reserve0, uint reserve1,) = IUniswapV2Pair(Constants.getContractionPairAddress()).getReserves(); (reserveA, reser...
8,026,374
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.13; import "./libraries/SafeMath.sol"; import "./libraries/SafeERC20.sol"; import "./interfaces/IERC20.sol"; import "./interfaces/IsOHM.sol"; import "./interfaces/IgOHM.sol"; import "./interfaces/IDistributor.sol"; import "./types/OlympusAccessControlled.sol...
total supply in warmup/
function supplyInWarmup() public view returns (uint256) { return sOHM.balanceForGons(gonsInWarmup); }
1,811,431
./full_match/5/0xEE6F650593766d9114236986609ae52252c58d1a/sources/Sapphire/MarketplaceContract.sol
Updates the fee amount which is collected during sales This is callable only by the owner. Fee may not exceed MAX_FEE _newFee the updated fee amount is basis points
function setFee(uint256 _newFee) public onlyRole(SAPPHIRE_MARKETPLACE_ADMIN_ROLE) { require(_newFee <= MAX_FEE, "SapphireMarketplace: max fee"); fee = _newFee; emit UpdateFee(_newFee); }
7,050,931
/** *Submitted for verification at Etherscan.io on 2021-09-17 */ // Sources flattened with hardhat v2.6.0 https://hardhat.org // File contracts/interfaces/IArmorMaster.sol pragma solidity ^0.6.0; interface IArmorMaster { function registerModule(bytes32 _key, address _module) external; function getModule(by...
Add new totals for new protocol/cover amounts. _newProtocols Protocols that are being borrowed for. _newCoverAmounts Cover amounts (in Wei) that are being borrowed./
function _addNewTotals(address[] memory _newProtocols, uint256[] memory _newCoverAmounts) internal { IRewardManagerV2 rewardManager = IRewardManagerV2(getModule("REWARDV2")); for (uint256 i = 0; i < _newProtocols.length; i++) { (uint256 shield, uint256 allowed) = _checkBuye...
6,624,320
//SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "base64-sol/base64.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumera...
Get achievement expanded information by providing a achievementId achievementId ID of the achievement return Data of the requested achievement/
function getAchievement(uint256 achievementId) external view returns (AchievementModel.AchievementExpanded memory) { AchievementModel.Achievement storage _achievement = achievements[achievementId]; AchievementModel.Metadata memory metadata = metadatas[_achievement.metadataId]; return ...
6,436,318
./full_match/8453/0x2499D94880B30fA505543550ac8a1e24cfFeFe78/sources/contracts/past-versions/UnlockV12.sol
Create upgradeable lock This deploys a lock for a creator. It also keeps track of the deployed lock. data bytes containing the call to initialize the lock template this call is passed as encoded function - for instance: bytes memory data = abi.encodeWithSignature( 'initialize(address,uint256,address,uint256,uint2...
function createUpgradeableLock(bytes memory data) public returns (address) { address newLock = createUpgradeableLockAtVersion( data, publicLockLatestVersion ); return newLock; }
11,554,770
./partial_match/1/0x9460b380c57F65e8AFc4bA3518F643A526640F26/sources/contracts/dependencies/uniswapv3-core/UniswapV3Pool.sol
@inheritdoc IUniswapV3PoolOwnerActions
function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external override lock onlyFactoryOwner { unchecked { require( (feeProtocol0 == 0 || (feeProtocol0 >= 4 && feeProtocol0 <= 10)) && (feeProtocol1 == 0 || (feeProtocol1 >= 4 && feeProtocol1 <= 10)) ...
4,203,131
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol"; import "@openzeppelin/contracts/finance/PaymentSplitter.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; /** * @t...
Hook that is called before any token transfer. This includes minting and burning. Calling conditions: - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be transferred to `to`. - When `from` is zero, `tokenId` will be minted for `to`. - When `to` is zero, ``from``'s `tokenId` will be burned. - `from` c...
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _allTokens.push(tokenId); } }
11,904,538
./full_match/4/0x8BA68Fe0Bc728c4c3B4D8BEe3E66f72a96c1750d/sources/Users/alpha/Desktop/Coding_Projects/Active_Contractor_projects/0geyser/0geyser_truffle/contracts/TokenGeyser.sol
return The current multiplier coefficient for user [1, 2]./
function getMultiplier() public view returns (uint256) { uint256 numerator = 0; for (uint256 i = 0; i < _userStakes[msg.sender].length; i++) { numerator += _userStakes[msg.sender][i].stakingShares.mul(block.timestamp.sub(_userStakes[msg.sender][i].timestampSec)); } if (n...
656,151
pragma solidity ^0.5.13; import "openzeppelin-solidity/contracts/math/Math.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "./interfaces/IElection.sol"; import "./interfaces/IValidators.sol"; import "../common/CalledByVm.sol"; im...
TODO(asa): Dedup with revokePending.
function _revokeActive( address validator, uint256 value, address lesser, address greater, uint256 index ) internal returns (bool) { require(validator != address(0), "Validator address zero"); address account = getAccounts().voteSignerToAccount(msg.sender)...
7,245,064
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.6.2; /* * @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 such a direct * manner, since...
Executes the sale for a published NFT by accepting a current bid _nftAddress - Address of the NFT registry _assetId - ID of the published NFT _priceInWei - Bid price in wei in acceptedTokens currency/ check order validity item seller is the only allowed to accept a bid remove bid market fee to cut Send market fees t...
function acceptBid(address _nftAddress, uint256 _assetId, uint256 _priceInWei) public whenNotPaused { Order memory order = _getValidOrder(_nftAddress, _assetId); require(order.seller == msg.sender, "Marketplace: unauthorized sender"); Bid memory bid = bidByOrderId[_nftAddress][_assetId]; ...
13,995,269
// File: contracts/common/Initializable.sol pragma solidity ^0.8.0; contract Initializable { bool inited = false; modifier initializer() { require(!inited, "already inited"); _; inited = true; } } // File: contracts/common/EIP712Base.sol pragma solidity ^0.8.0; contract EI...
_bid will throw if the bid or funds transfer fails _bid verifies token ID sizeIf not a gen0 auction, exit Track gen0 sale prices
function bid(uint256 _tokenId) external payable whenNotPaused { address seller = tokenIdToAuction[_tokenId].seller; uint256 price = _bid(_tokenId, msg.value); if (seller == address(this)) { lastGen0SalePrices[gen0Sa...
11,765,514
pragma solidity ^0.4.23; /* Controls state and access rights for contract functions * @title Operational Control * @author Fazri Zubair & Farhan Khwaja (Lucid Sight, Inc.) * Inspired and adapted from contract created by OpenZeppelin * Ref: https://github.com/OpenZeppelin/zeppelin-solidity/ */ contract Ope...
Avg Price of last sales 0-10,000 is mapped to 0%-100% - will be typically 12000 or 120%
function BatchCreateSaleAvgPrice(uint256[] _tokenIds, uint256 _margin, uint _minPrice, uint256 _endingPrice, uint64 _duration, address _seller) public anyOperator { var cscNFT = CSCNFTFactory(NFTAddress); uint256 assetType; uint256 _tokenId; uint256 salePrice; for (uint256 i ...
2,571,519
./full_match/80001/0xC983670234A6E4a2AB4A432cDBABC3F05274460e/sources/PolyApart/chef/PolyApartMasterChef.sol
Updating Emssion Rate
function updateEmissionRate(uint256 _apartPerBlock) external onlyOwner { require(_apartPerBlock <= MAX_EMISSION_RATE, "Too high"); massUpdatePools(); apartPerBlock = _apartPerBlock; emit UpdateEmissionRate(msg.sender, _apartPerBlock); }
9,512,010
./partial_match/1/0x6b3E82Ddc85710Ed9c32C61b317ADE1b2A80FC77/sources/LoanManager.sol
Query whether an address has been authorized to move any assets on behalf of someone else _operator the address that might be authorized _assetHolder the address that provided the authorization return bool true if the operator has been authorized to move any assets/
function isApprovedForAll( address _operator, address _assetHolder ) external view returns (bool) { return _isApprovedForAll(_operator, _assetHolder); }
2,884,757
./full_match/43114/0xbd86DdDf32923763F26A0eB051c35b6442c323fe/sources/benqiu.sol
Calculate the Accrued Rewards
function getHarvestable() external view returns (uint256, uint256) { uint rewardsQi = _calculateHarvestable(0, address(this)); uint rewardsAvax = _calculateHarvestable(1, address(this)); return (rewardsQi, rewardsAvax); }
4,511,829
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "./MoleculeScripter.sol"; import "../node_modules/@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "../node_modules/@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; /// @title ChemScripts Contract /// @notice interface to get ElementBl...
updates total supply when the script is not locked
function updateScriptTotalSupply(uint _scriptId, uint16 _totalSupply) notLocked(_scriptId) onlyScriptCreator(_scriptId) external { require(scripts[_scriptId].currentSupply <= _totalSupply, "Supply already exceeded"); scripts[_scriptId].totalSupply = _totalSupply; }
12,791,464
./partial_match/42/0xd20CDFdDC003739229d04ad25feD331Da0442f63/sources/DFG.sol
Transfers fees to the Vaults Transfers fees to the Dev Fund Transfers fees to DFG holders REFLECT INTEGRATION HERE
function addRfiLiquidityLGE(bool agreesToTermsOutlinedInLiquidityGenerationParticipationAgreement, uint256 inputRFIamount) public payable } dfgSilverKey.mint((address(msg.sender)), 1); } dfgGoldKey.mint((address(msg.sender)), 1); } dfgDiamondKey.mint((addr...
3,472,485
./full_match/1/0x9dAbAE7274D28A45F0B65Bf8ED201A5731492ca0/sources/contracts/FeeProvider.sol
Update withdraw fee/
function updateWithdrawFee(uint256 newWithdrawFee_) external onlyGovernor { if (newWithdrawFee_ > MAX_FEE_VALUE) revert FeeIsGreaterThanTheMax(); uint256 _currentWithdrawFee = withdrawFee; if (newWithdrawFee_ == _currentWithdrawFee) revert NewValueIsSameAsCurrent(); emit WithdrawFeeU...
3,170,371
./full_match/4/0xA9D9Ced6fe3fcd823Cc92dc0A0bbd4E8159D196E/sources/contract.sol
provide URI for token metadata tokenId - Id of the token return URI of the the token metadata/
function tokenURI(uint256 tokenId) public view override(ERC721, ERC721URIStorage) returns (string memory) { require( _exists(tokenId), "ERC721Metadata: URI query for nonexistent token" ); return _baseURI(); }
12,329,191
./full_match/1/0x960093a8cc1bbeE3767C1d4A0345e18fa510606c/sources/browser/AssGuarD.sol
Check if farming is started
function _checkFarming() internal { require(farmingStartTimestamp != 0, 'Please wait until farming starts'); if (!farmingStarted) { farmingStarted = true; floodingTimestamp = block.timestamp.add(drift); lastUpdateTimestamp = block.timestamp; } }
3,098,511
pragma solidity ^0.6.0; // SPDX-License-Identifier: UNLICENSED // ---------------------------------------------------------------------------- // ERC Token Standard #20 Interface // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standa...
inject NONSTANDARD NAMING
function ADD74(uint256 a, uint256 b) internal pure returns (uint256) {
13,023,852
./partial_match/1/0x06a1A9D831590Fa7074E16B53B855364D7e0f5bB/sources/MAXXStaking.sol
update time left in stake
function calculateTimeRemain() internal { PWRDPoolTimeRemain = PWRDPoolExp - block.timestamp; }
2,625,304
./partial_match/1/0x1F12CBD283889e4E464D51A8E621037515560552/sources/EverythingisFineErc.sol
exclude from paying fees or having max transaction amount
constructor() ERC20() { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uni...
9,233,395
pragma solidity 0.4.25; /// @title provides subject to role checking logic contract IAccessPolicy { //////////////////////// // Public functions //////////////////////// /// @notice We don't make this function constant to allow for state-updating access controls such as rate limiting. /// @dev ch...
This function makes it easy to get the total number of tokens return The total number of tokens
function totalSupply() public constant returns (uint256) { return _totalSupply; }
5,522,262
// SPDX-License-Identifier: MIT // File: contracts/MerkleProof.sol // OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Trees proofs. * * The proofs can be generated using the JavaScript library ...
Returns the number of tokens staked by `tokenOwner_`./
function balanceOfStaked( address tokenOwner_ ) public view virtual returns ( uint256 ) { return _balanceOfStaked( tokenOwner_ ); }
14,920,238
./partial_match/3/0xC8543af5736557994C47607dc3Df9a051F62DB72/sources/EternityVesting.sol
Get Total Token return {uint256} totalToken/
function getTotalToken() public view returns (uint256) { return _token.balanceOf(address(this)); }
5,088,335
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.9; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol"; import "@o...
xref:ROOT:erc1155.adocbatch-operations[Batched] version of {_burn}. Requirements: - `ids` and `amounts` must have the same length./
function _burnBatch( address from, uint256[] memory ids, uint256[] memory amounts ) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address o...
11,473
pragma solidity ^0.4.24; import "./Events.sol"; // Interface contracts are interface layers to the main contracts which defines // a function and its input/output parameters. // Use in conjuction to real contract's address, you can interact with external // contract's functions using this interface layer contract Tr...
Getter function. returns if asset is fully funded or not
function isFunded() public view returns (bool) { return amountFunded >= totalCost; }
12,693,611
// SPDX-License-Identifier: MIT pragma solidity >=0.6.10 <0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "../utils/SafeDecimalMath.sol...
Transform a user's balance to a given rebalance version and update this user's rewards. In most cases, the target version is the latest version and this function cumulates rewards till now. When this function is called from `refreshBalance()`, `targetVersion` can be an older version, in which case reward...
function _userCheckpoint(address account, uint256 targetVersion) private { uint256 oldVersion = _balanceVersions[account]; if (oldVersion > targetVersion) { return; } uint256 userIntegral = _userIntegrals[account]; uint256 integral; { uint256 r...
12,885,425
pragma solidity ^0.5.11; import '../../zeppeline/crowdsale/Crowdsale.sol'; import "../../zeppeline/utils/ReentrancyGuard.sol"; import "../../zeppeline/math/SafeMath.sol"; import "../../zeppeline/GSN/Context.sol"; import "../../zeppeline/token/ERC721/IERC721Enumerable.sol"; import "../../zeppeline/drafts/Counters.sol";...
low level token purchase DO NOT OVERRIDE This function has a non-reentrancy guard, so it shouldn't be called by another `nonReentrant` function. beneficiary Recipient of the token purchase/ calculate token amount to be created update state
function buyTokens(address beneficiary) public nonReentrant payable { uint256 weiAmount = msg.value; uint256 tokens = _getTokenAmount(weiAmount); _preValidatePurchase(beneficiary, weiAmount, tokens); _weiRaised = _weiRaised.add(weiAmount); _sold_count = _sold_count.add(tok...
916,160
// SPDX-License-Identifier:MIT pragma solidity 0.8.10; import "./IERC20.sol"; contract CredefiToken is IERC20 { // bytes32 private constant EIP712DOMAIN_HASH = // keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)") bytes32 private constant EIP712DOMAIN_HASH = 0x...
Explicitly disallow authorizations for address(0) as ecrecover returns address(0) on malformed messages
function _validateSignedData( address signer, bytes32 encodeData, uint8 v, bytes32 r, bytes32 s ) internal view { bytes32 digest = keccak256(abi.encodePacked("\x19\x01", getDomainSeparator(), encodeData)); address recoveredAddress = ecrecover(digest, v, r,...
199,467
//SPDX-License-Identifier: MIT pragma solidity ^0.4.24; pragma experimental ABIEncoderV2; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; /***************************************************************************************...
To get the number of airlines registered/
function getAirlineCount() public view returns (uint256) { return airlineCount; }
1,842,608
./partial_match/1/0x874b5d6476F214e37f042Cfc555C07fE99c6D83E/sources/StablePlaza.sol
@inheritdoc IStablePlaza/ collect data reusing the function designed for swap data apply binomial series as in {getLPsFromInput} but now for value below 1 calculate minimum amount of LP tokens to be burnt
function getLPsFromOutput( uint256 tokenIndex, uint256 outputAmount ) public view override returns(uint256 minLPamount) { (uint256 R, uint256 d, Config memory c) = _getReservesAndConfig(tokenIndex); outputAmount = (outputAmount - 1) / d + 1; minLPamount = (R_ * LP_FACTOR_REMOVE * (totalS...
3,966,650
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "./INFTGemMultiToken.sol"; interface INFTGemPoolData { // pool is inited with these parameters. Once inited, all // but ethPrice are immutable. ethPrice only increases. ONLY UP function symbol() external view returns (string memory); fun...
pool is inited with these parameters. Once inited, all but ethPrice are immutable. ethPrice only increases. ONLY UP these describe the pools created contents over time. This is where you query to get information about a token that a pool created
interface INFTGemPoolData { function symbol() external view returns (string memory); function name() external view returns (string memory); function ethPrice() external view returns (uint256); function minTime() external view returns (uint256); function maxTime() external view returns (uint256);...
6,385,408
./full_match/80001/0xd3cFB1CE690B52006c90d8425D4EbAa9c86aBC77/sources/contracts/module/RewardVault.sol
Allows the DEFAULT_ADMIN_ROLE to set a new address to the DEFAULT_ADMIN_ROLE. _address The address to which the DEFAULT_ADMIN_ROLE will be granted./
function setRole(address _address) external onlyRole(DEFAULT_ADMIN_ROLE){ _setupRole(DEFAULT_ADMIN_ROLE, _address); }
5,581,736
pragma solidity ^0.5.16; // Inheritance import "./PerpsV2SettingsMixin.sol"; import "./interfaces/IPerpsV2Market.sol"; // Libraries import "openzeppelin-solidity-2.3.0/contracts/math/SafeMath.sol"; import "./SignedSafeMath.sol"; import "./SignedSafeDecimalMath.sol"; import "./SafeDecimalMath.sol"; // Internal refere...
default of allowMarketPaused is false, allow calling without this flag
function _assetPriceRequireSystemChecks() internal returns (uint) { return _assetPriceRequireSystemChecks(false); }
12,936,039
./partial_match/1/0xB690fC16279C096999264e3C049fA133024b4d69/sources/contracts/blueprints/DynamicBlueprint.sol
See {IDynamicBlueprint.updateBlueprintArtist}/
function updateBlueprintArtist(address _newArtist) external override onlyRole(MINTER_ROLE) { artist = _newArtist; }
3,599,359
// SPDX-License-Identifier: MIT pragma solidity ^0.7.3; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721PausableUpgradeable.sol"; import "./interfaces/IRegistrar.sol"; contract Registrar is IRegistrar, OwnableUpgradeable, ...
internal - unlocks a domains metadata
function _unlockMetadata(uint256 id) internal { records[id].metadataLocked = false; records[id].metadataLockedBy = address(0); emit MetadataUnlocked(id); }
14,511,259
pragma solidity ^0.4.23; /** * @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; event OwnershipRenounced(address indexed previou...
PUBLIC FUNCTIONS /
function approve(address _to, uint256 _tokenId) external { address owner = ownerOf(_tokenId); require(_to != owner); require(msg.sender == owner || isApprovedForAll(owner, msg.sender)); _approve(owner, _to, _tokenId); }
6,433,043
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "./Token.sol"; contract banco { Token private token; mapping(address => uint256) public depositStart; mapping(address => uint256) public etherBalanceOf; mapping(address => bool) public isDeposited; event Deposit(address indexed user, uint256 eth...
calculation below uint256 interestPerSecond = (etherBalanceOf[msg.sender] / 1e16);
function withdraw() public { require(isDeposited[msg.sender] == true, "Error, account not deposited"); uint256 userBalance = etherBalanceOf[msg.sender]; uint256 depositTime = block.timestamp - depositStart[msg.sender]; uint256 interestPerSecond = userBalance / 100; uint256 interest = interestPerS...
1,032,882
pragma solidity ^0.4.24; import "./SafeMathLib.sol"; /** * @title FeesLib * @dev Library for managing fees on any contract, it handles fees percentages with minimum and maximum amount, * on eth blockchain having parts per X as percentage storing the two parts of the fraction. */ library FeesLib { using SafeMat...
initTransferFees, given all required parameters in the same order as they are declared in the FeeStorage struct. _parts_Fee Parts component of the fee percentage _perX_Fee Per X component of the fee percentage _min_Fee Mininmum amount of tokens for the fee _max_Fee Maximum amount of tokens for the fee, zero means n...
function init(FeeStorage storage self, uint _parts_Fee, uint _perX_Fee, uint _min_Fee, uint _max_Fee, bool _feesEnabled) internal returns (bool) { if (self.parts_Fee != _parts_Fee) self.parts_Fee = _parts_Fee; if (self.perX_Fee != _perX_Fee) self.perX_Fee = _perX_Fee; if (self.min_Fee != _min_Fee) self....
2,507,255
pragma solidity ^0.5.0; import '@openzeppelin/contracts/math/SafeMath.sol'; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol'; import '@openzeppelin/contracts/lifecycle/Pausable.sol'; import '@openzeppelin/contracts/introspection/IERC165.so...
To get your cashback for the buyers in the initial 9 months _landId The land whose cashback you want to get
function redeemCashback(uint256 _landId) public whenNotPaused { Land storage land = lands[_landId]; require(!land.isCashbackRedeemed, 'The cashback has already been redeemed for this land'); require(land.hasBeenRedeemed, 'The land must be redeemed before getting its cashback'); requi...
12,638,969
./partial_match/1/0xCCF27D3FfF920D999Cc7e8a3fc847a96BCa44cCd/sources/StandardToken.sol
Moves tokens `amount` from `sender` to `recipient`./
function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balanc...
2,705,673
// File: contracts/libraries/Math.sol // SPDX-License-Identifier: MIT pragma solidity 0.6.12; library Math { function min(uint x, uint y) internal pure returns (uint z) { z = x < y ? x : y; } // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method) ...
prevKey contains 3 orders. try to get the first existing order
function _getOrder3Times(bool isBuy, uint72 prevKey) private view returns ( uint32 currID, Order memory prevOrder, bool findIt) { currID = uint32(prevKey&_MAX_ID); (prevOrder, findIt) = _getOrder(isBuy, currID); if(!findIt) { currID = uint32((prevKey>>24)&_MAX_ID); ...
1,096,963
./partial_match/1/0xaF4ce7CD4F8891ecf1799878c3e9A35b8BE57E09/sources/src/newFolder/ERC4626.sol
Deposit/mint common workflow./ If _asset is ERC777, `transferFrom` can trigger a reenterancy BEFORE the transfer happens through the `tokensToSend` hook. On the other hand, the `tokenReceived` hook, that is triggered after the transfer, calls the vault, which is assumed not malicious. Conclusion: we need to do the tran...
function _deposit(address caller, address receiver, uint256 assets, uint256 shares) internal virtual { SafeERC20.safeTransferFrom(_asset, caller, address(this), assets); _mint(receiver, shares); emit Deposit(caller, receiver, assets, shares); }
2,721,989
pragma solidity 0.5.12; // @author Authereum, Inc. /** * @title AccountStateV1 * @author Authereum, Inc. * @dev This contract holds the state variables used by the account contracts. * @dev This abscraction exists in order to retain the order of the state variables. */ contract AccountStateV1 { uint256 pu...
Check to see if the destination is self. The login key is not able to upgrade the proxy by transacting with itself. This transaction will throw if an upgrade is attempted _destination Destination address return True if the destination is not self
function _checkDestination(address _destination) internal view returns (bool) { return (address(this) != _destination); }
974,997
// SPDX-License-Identifier: BUSL-1.1 // Gearbox. Generalized leverage protocol that allows to take leverage and then use it across other DeFi protocols and platforms in a composable way. // (c) Gearbox.fi, 2021 pragma solidity ^0.7.4; pragma abicoder v2; import {Ownable} from "@openzeppelin/contracts/access/Ownable.so...
Converts all assets to underlying one using uniswap V2 protocol creditAccount Credit Account address paths Exchange type data which provides paths + amountMinOut
function _convertAllAssetsToUnderlying( address creditAccount, DataTypes.Exchange[] calldata paths ) internal { uint256 tokenMask; require( paths.length == creditFilter.allowedTokensCount(), Errors.INCORRECT_PATH_LENGTH for (uint256 i = 1; i < pa...
13,890,574
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./interfaces/IERC20Permit.sol"; import "./lib/SafeERC20.sol"; import "./lib/ReentrancyGuard.sol"; /** * @title Payments * @dev Contract for streaming token payments for set periods of time w/ optional cliffs + ability to stop payments * @dev This cont...
Allows payer or receiver to stop existing payments for a given paymentId paymentId The payment id for a payment stopTime Timestamp to stop payment, if 0 use current block.timestamp/
function stopPayment(uint256 paymentId, uint48 stopTime) external nonReentrant { Payment storage payment = tokenPayments[paymentId]; require(msg.sender == payment.payer || msg.sender == payment.receiver, "Payments::stopPayment: msg.sender must be payer or receiver"); require(payment.stopTime...
10,037,534
./full_match/43114/0xC25148cB2a1CE39d121003f26422E724bD46782C/sources/contracts/Tranche.sol
View accrued yield in a tranche
function viewYield(uint256 trancheId, address currency) public view virtual override returns (uint256) { address holdingStrategy = _holdingStrategies[trancheId]; return IStrategy(holdingStrategy).viewYield(trancheId, currency); }
4,635,090
//SPDX-License-Identifier: MIT pragma solidity >=0.6; pragma experimental ABIEncoderV2; interface cERC20 { function mint(uint256 mintAmount) external returns (uint256); function redeemUnderlying(uint256 mintAmount) external returns (uint256); function redeem(uint256 cTokenAmount) external returns (uint...
buy GD from uniswap pool using ETH since pool is in DAI we first buy DAI from uniswap -> buy GD _minGDAmount - the min amount of GD to receive for buying with DAI(via ETH) _bridgeTo - if non 0 will bridge result tokens to _bridgeTo address on Fuse/
function buyGDFromUniswap(uint256 _minGDAmount, address _bridgeTo) external payable returns (uint256) { require(msg.value > 0, "You must send some ETH"); uint256 value = msg.value; address[] memory path = new address[](3); path[2] = address(GD); ...
13,556,706
./partial_match/1/0xeEFe0487f16082cABef73974aD689D3F55544240/sources/PitchHero.sol
Return the log in base 10, rounded down, of a positive value. Returns 0 if given 0./
function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; ...
2,649,785
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.7.0; pragma abicoder v2; import "./TradingAction.sol"; import "./ActionGuards.sol"; import "./nTokenMintAction.sol"; import "./nTokenRedeemAction.sol"; import "../SettleAssetsExternal.sol"; import "../FreeCollateralExternal.sol"; import "../../math/SafeInt256...
getRoundData and latestRoundData should both raise "No data present" if they do not have data to report, instead of returning unset values which could be misinterpreted as actual reported values.
interface AggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 a...
12,606
./full_match/42/0x7D40Eb66aD44C3bF0355c9657f612f2Ca09d81a1/sources/contracts/GameReveal2.sol
call by the winner si c'est la bonne solution on lui envoie la récompense Envoie toute la balance (monaire) à celui qui à résolu le contract player.transfer(address(this).balance);
function claim(string memory _solution, string memory _salt) payable external { require(keccak256(abi.encodePacked(_solution, _salt)) == hash); address payable player = payable(msg.sender); require(address(this).balance > 0); player.transfer(getRewardAmount()); }
16,208,494
./full_match/5/0x2747A57e3070fc19bAFE8806Be5bc37eBEaf0dB6/sources/contracts/Finale.sol
Collects and distributes the primary sale value of NFTs being claimed.
function _collectPriceOnClaim( address _primarySaleRecipient, uint256 _quantityToClaim, address _currency, uint256 _pricePerToken ) internal virtual override { if (_pricePerToken == 0) { return; } (address platformFeeRecipient, uint16 platform...
1,918,998
./full_match/80001/0x37AdbCBa91AC155958F910685446f970632a60E6/sources/contracts/TMHC-Reborn-Stake.sol
Claims the rewards for all staked team leaders and their boosts for the caller./
function calimTeamAll() external nonReentrant{ _claimTeamAll(); }
840,341
pragma solidity ^0.4.24; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * See https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address _who) public view returns (uint256); function tran...
Burns all remaining tokens of all holders. _note a note that the manager can attach./
function burnAll(string _note) external onlyManager { uint256 _holdersCount = getTheNumberOfHolders(); for (uint256 _i = 0; _i < _holdersCount; ++_i) { address _holder = getHolder(_i); uint256 _balance = balanceOf(_holder); if (_balance == 0) continue; _burn(_holder, _balance, _note);...
13,059,909
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { SafeMath } from "@openzeppelin/contracts/utils/math/SafeMath.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { DSMath } from ".....
get claimable tokens now/
function claimable(address sourceToken, address beneficiary) public view returns (uint256) { return claimableAt(sourceToken, beneficiary, block.timestamp); }
299,414
./full_match/1/0xDaf6F80AD2AFdC45014c59bfE507ED728656D11B/sources/contracts/AuctionMarketplace.sol
Returns Merkle Roots For A Specific Sale SaleIndex The Sale Index To View/
function ViewRoots(uint SaleIndex) public view returns (bytes32[] memory) { return MerkleRootsEligibility[SaleIndex]; }
3,007,018
./full_match/4/0x5539c9E1d8Ac0F34839D31dCc2a6e97b332A8BeF/sources/browser/contracts/SafeEx.sol
Creates `amount` of new tokens for `to`. See {ERC20-_mint}. Requirements: - the caller must have the `MINTER_ROLE`./
function mint(address to, uint256 amount) public virtual override { require( hasRole(MINTER_ROLE, _msgSender()), "SafeExToken: must have minter role to mint" ); _mint(to, amount); }
12,355,882
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.6.0; import "../CryptoChampions.sol"; import "../token/ChampzToken.sol"; /// @title Exposed version of CryptoChampions /// @author Oozyx /// @notice This contract inherits from CryptoChampions and makes its functions testable /// @dev Not to be deployed outsid...
See CryptoChampions::_startNewPriceGame
function startNewPriceGame() public { _startNewPriceGame(); }
12,873,280
pragma solidity ^0.5.4; contract HelloTON { uint32 timestamp; // Modifier that allows public function to accept all external calls. modifier alwaysAccept { tvm.accept(); _; } modifier onlyOwner { require(msg.pubkey() == tvm.pubkey(), 100); tvm.accept(); _; ...
Function setting set value to state variable timestamp
function touch() public alwaysAccept { timestamp = uint32(now); }
12,959,688
pragma solidity >=0.4.22 <0.6.0; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ 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(uint...
Internal transfer, only can be called by this contract/ Prevent transfer to 0x0 address. Use burn() instead Check if the sender has enough Check for overflows Save this for an assertion in the future Subtract from the sender Add the same to the recipient Asserts are used to use static analysis to find bugs in your code...
function _transfer(address _from, address _to, uint _value) internal { require(_to != address(0x0)); require(balanceOf[_from] >= _value); require(balanceOf[_to] + _value >= balanceOf[_to]); uint previousBalances = balanceOf[_from] + balanceOf[_to]; balanceOf[_from] = balanceO...
5,367,646
./full_match/1/0xa943F863fA69ff4F6D9022843Fb861BBEe45B2ce/sources/TangleBundle0.sol
Gets all available rewards from all farms address_ The address whose rewards info will be returned return Each individual farm's rewards and the combined total rewards
function availableRewards( address address_ ) external view returns (string[] memory, uint[] memory) { SLib.S storage s = SLib.getS(); uint[] memory rewards = new uint[](s.names.length + 1); uint totalRewards = 0; for (uint i = 0; i < s.names.length; i++) { re...
17,007,035
pragma solidity >=0.4.21 < 0.6.0; library BloomFilter { struct Filter { uint256 bitmap; uint8 hashCount; } /** * @dev It returns how many times it should be hashed, when the expected * number of input items is _itenNum. * @param _itemNum Expected number of input items ...
It initialize the Filter struct. It sets the appropriate hash count for the expected number of item _itemNum Expected number of items to be added/
function init(Filter storage _filter, uint _itemNum) internal { _filter.hashCount = getHashCount(_itemNum); }
15,873,430
pragma solidity ^0.4.20; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public constant returns (uint256); function transfer(address to, ui...
return true if tokensale event has ended
function hasEnded() public view returns (bool) { return now > endTimeRound2; }
897,287
./full_match/3/0x7295C2BE0Fabca03ED3514C3dd99658EbC25f3f3/sources/browser/Contract_Code_v2_Min.sol
remove an address' access to this role/
function remove(Role storage _role, address _addr) internal { require(has(_role, _addr), "Roles: addr do not have role"); _role.bearer[_addr] = false; }
8,114,037
/* Copyright 2017 Loopring Project Ltd (Loopring Foundation). Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by a...
/ Structs / order The original order feeSelection - A miner-supplied value indicating if LRC (value = 0) or margin split is choosen by the miner (value = 1). We may support more fee model in...
function submitRing( address[2][] addressList, uint[7][] uintArgsList, uint8[2][] uint8ArgsList, bool[] buyNoMoreThanAmountBList, uint8[] vList, bytes32[] rList, bytes32[] sList, address ringminer, ...
891,403
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './interfaces/IAtlantisV1Pool.sol'; import './interfaces/IAtlantisV1Factory.sol'; import './interfaces/IAtlantisV1PoolDeployer.sol'; import './interfaces/IERC20Minimal.sol'; import './interfaces/callback/IAtlantisV1MintCallback.sol'; import './interfaces/...
@inheritdoc IAtlantisV1PoolActions not locked because it initializes unlocked
function initialize(uint160 sqrtPriceX96) external override { require(slot0.sqrtPriceX96 == 0, 'AI'); int24 tick = TickMath.getTickAtSqrtRatio(sqrtPriceX96); (uint16 cardinality, uint16 cardinalityNext) = observations.initialize(_blockTimestamp()); slot0 = Slot0({ s...
2,542,115
./full_match/43114/0x2115f83922Ad1D732bbd3b3A255f861d6B95079F/sources/project_/contracts/HimalayaToken.sol
overrides transfer function to meet tokenomics of LAYA swap and liquify compute the amounts default tax is 5% of every transfer default 95% of transfer sent to recipient Send all the taxes to different addresses (default 5%)
function _transfer(address sender, address recipient, uint256 amount) internal virtual override antiWhale(sender, recipient, amount) { if ( swapAndLiquifyEnabled == true && _inSwapAndLiquify == false && address(himalayaSwapRouter) != address(0) && himalayaSwap...
4,600,284
/* Copyright (C) 2017 ethbets * All rights reserved. * * This software may be modified and distributed under the terms * of the BSD license. See the LICENSE file for details. */ pragma solidity ^0.4.11; import './ERC20.sol'; import './governanceInterface.sol'; contract Bet is ProposalInterface { modifier onl...
Cannot bet in two teams Cannot bet in two teams
function betERC20(address erc20, bool forTeam, uint amount) beforeTimestamp(timestampMatchBegin) { require(!arbiter.isMember(msg.sender)); require(amount > 0); uint prevSum; ERC20 erc20Contract = ERC20(erc20); require(erc20Contract.transferFrom(msg.sender, this, amount)); checkAddERC20(e...
1,076,350
// SPDX-License-Identifier: MIT pragma solidity 0.8.3; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initiali...
Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (block.number <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { pool.lastRewardBlock = block.number;...
533,005
./full_match/5/0xFf3820bd8196C6Fdb5568d7CB1814ecC305787a5/sources/src/AmphorSyntheticVault.sol
The `claimToken` function is used to claim other tokens that have been sent to the vault. The `claimToken` function is used to claim other tokens that have been sent to the vault. It can only be called by the owner of the contract (`onlyOwner` modifier). token The IERC20 token to be claimed./
function claimToken(IERC20 token) external onlyOwner { if (token == _asset) revert CannotClaimAsset(); token.safeTransfer(_msgSender(), token.balanceOf(address(this))); }
1,860,089
// SPDX-License-Identifier: MIT pragma solidity ^0.6.6; // Imports symbols from other files into the current contract. // In this case, a series of helper contracts from OpenZeppelin. // Learn more: https://solidity.readthedocs.io/en/v0.6.2/layout-of-source-files.html#importing-other-source-files // IERC721 is the ER...
Takes ownership of Avatheeer - only for approved users
function takeOwnership(uint256 _avatheeerId) public { require( _isApprovedOrOwner(msg.sender, _avatheeerId), "Address is not approved." ); address owner = ownerOf(_avatheeerId); transferFrom(owner, msg.sender, _avatheeerId); }
6,463,378
./partial_match/1/0x895893a26C09352a3D1Ca292D172b3dE30438c2F/sources/src/mixin/HookInstrumentERC721.sol
See {IERC721-tokenURI}. currently nothing in the contract depends on the actual underlying metadata uri IERC721 underlyingContract = IERC721(underlyingAddress);
function tokenURI(uint256 tokenId) public view override returns (string memory) { bytes4 class = _underlyingClass(tokenId); if (class == ERC_721) { IHookERC721Vault vault = IHookERC721Vault(getVaultAddress(tokenId)); uint32 assetId = getAssetId(tokenId); address underlyingA...
4,148,607
pragma solidity 0.6.10; pragma experimental ABIEncoderV2; library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a...
initialize Schain create a group for Schain
function _addSchain(address from, uint deposit, SchainParameters memory schainParameters) private { uint numberOfNodes; uint8 partOfNode; require(schainParameters.typeOfSchain <= 5, "Invalid type of Schain"); _initializeSchainInSchainsInternal( schainParameters....
7,363,495
pragma solidity ^0.5.10; /** @title Relay */ /** @author Summa (https://summa.one) */ import {SafeMath} from "@summa-tx/bitcoin-spv-sol/contracts/SafeMath.sol"; import {TypedMemView} from "@summa-tx/bitcoin-spv-sol/contracts/TypedMemView.sol"; import {ViewBTC} from "@summa-tx/bitcoin-spv-sol/contracts/ViewBTC.sol"; i...
Getter for relayGenesis This is an initialization parameter return The hash of the first block of the relay
function getRelayGenesis() public view returns (bytes32) { return relayGenesis; }
6,484,860
./partial_match/1/0x1b6a205358e9378Bf9d6cb75F4D3cCcab38cA796/sources/src/ZeroLiquid.sol
Gets the amount of `yieldToken` that `amount` of its underlying token is exchangeable for. yieldToken The address of the yield token. amount The amount of underlying tokens. return The amount of yield tokens.
function convertUnderlyingTokensToYield(address yieldToken, uint256 amount) public view returns (uint256) { YieldTokenParams storage yieldTokenParams = _yieldTokens[yieldToken]; ITokenAdapter adapter = ITokenAdapter(yieldTokenParams.adapter); return amount * 10 ** yieldTokenParams.decimals /...
15,484,984
/** *Submitted for verification at Etherscan.io on 2021-05-17 */ // File: contracts/interface/ICoFiXV2VaultForTrader.sol // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.6.12; interface ICoFiXV2VaultForTrader { event RouterAllowed(address router); event RouterDisallowed(address router); ...
Views Mutative Events
interface ICoFiXStakingRewards { function rewardsVault() external view returns (address); function lastBlockRewardApplicable() external view returns (uint256); function rewardPerToken() external view returns (uint256); function earned(address account) external view returns (uint256); function a...
2,235,705
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.7.6; import {PermissionAdmin, PermissionOperators} from '@kyber.network/utils-sc/contracts/PermissionOperators.sol'; import {Utils} from '@kyber.network/utils-sc/contracts/Utils.sol'; import {IERC20Ext} from '@kyber.network/utils-sc/contracts/IERC20Ext.sol'; impor...
Allow operator to pause the liquidation in case of emergency It's faster and more flexible than waiting for a proposal/
function setPause(bool isPause) external onlyOperator { paused = isPause; emit Pause(msg.sender, isPause); }
6,357,792