file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./partial_match/42/0x38D1D6eC86a035AA3adbaCFA16326132FbACA3A1/sources/SHOPPINGmodX6.sol
Transfer, which will burn tokens mode for each transaction./ Calculate amount of tokens to burn and execute it. Then add that amount to statistic variable of already burned tokens and calculate how many tokens left after burn.
function _transfer(address sender, address recipient, uint256 amount) internal override { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); ...
8,878,331
// File: @openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol pragma solidity ^0.6.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assum...
Claims rewards from a proxy without restaking Will reset rewards multiplier - use sparingly when buffer balance needed/
function claimRewards(uint256 proxyIndex) external onlyOwnerOrManager { address proxyAddress = proxyIndexToAddress[lowestActiveProxyIndex]; ILiquidityProvider lpProxy = ILiquidityProvider(proxyAddress); uint256 proxyContributionToRewardsNav = getProxyAddressRewardsContributionTo...
14,893,841
./partial_match/1/0x3f20E2c1E8Ff57d5C6965a4a2A87Ff540a05eb4D/sources/Poolgenics.sol
approve token transfer to cover all possible scenarios add the liquidity
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { _approve(address(this), address(uniswapV2Router), tokenAmount); address(this), tokenAmount, marketingWallet, block.timestamp ); }
9,430,898
./full_match/44787/0xE03639b06Be343BC0898FAaA8463EcF6E5c14869/sources/contracts/SpacetarContract.sol
function to get Messages a user posted to their Space
function getUserSpaceMessages(address userAddress) public view returns (SpaceMessage[] memory) { uint256 count; for (uint256 i = 0; i < spaceMessages.length; i++) { if (spaceMessages[i].user == userAddress) { count++; } } SpaceMessage[] memory...
13,260,737
./partial_match/5/0xd7a627a5C5d1263FE7d01100aC53355a2049AD55/sources/SygnumToken.sol
Mint. _account Address to mint tokens to. _amount Amount to mint./
function mint(address _account, uint256 _amount) public { if(isSystem(msg.sender)){ require(!isFrozen(_account), "SygnumToken: Account must be frozen if system calling."); } super._mint(_account, _amount); emit Minted(msg.sender, _account, _amount); }
16,843,271
// contracts/miStableUSDT.sol // SPDX-License-Identifier: MIT pragma solidity 0.5.5; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; contract miStableUSDT is ReentrancyGuard { using SafeMath fo...
for every 1.00 mai we get 0.98 usdt 1000000000000000000 we get 980000 (bc decimals) Tranfer tokens from sender to this contract Transfer amount minus fees to sender
function swapTo(uint256 amount) public nonReentrant { require(amount!=0, "swapTo: invalid amount"); require(usdt.balanceOf(address(this))!=0, "swapTo: Not enough USDC in reserves"); uint256 amountToSend = amount.mul(maiRate).div(100000000000000); require(usdt.balanceOf(address(this)...
13,025,628
./full_match/137/0x2b626791894E2Ff7a23721DC5EEb7b6A5e5d492b/sources/contracts/rewards/EmissionManager.sol
@inheritdoc IEmissionManager
function setRewardsVault(address rewardsVault) external onlyOwner { _rewardsController.setRewardsVault(rewardsVault); }
4,667,342
pragma solidity ^0.4.24; // File: contracts/openzeppelin/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 private _owner...
Transfer token for a specified address to The address to transfer to. value The amount to be transferred./
function transfer(address to, uint256 value) public returns (bool) { require(value <= _balances[msg.sender]); require(to != address(0)); _balances[msg.sender] = _balances[msg.sender].sub(value); _balances[to] = _balances[to].add(value); emit Transfer(msg.sender, to, value); return true; }
5,545,388
pragma solidity ^0.4.24; pragma solidity ^0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that throw on error. */ library SafeMath { // Multiplies two numbers, throws on overflow./ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) ...
Pre-validate withdrawal Remember members unpaid amount but remove it from his contract holdings before initiating the withdrawal for security reasons Trigger 'Withdraw'-event Transfer the unpaid Wei amount to member address
function withdraw () external { require(members[msg.sender].unpaid > 1, "No unpaid balance or not a member account"); uint256 unpaid = members[msg.sender].unpaid.sub(1); members[msg.sender].unpaid = 1; emit Withdraw(msg.sender, unpaid); msg.sender....
6,456,287
./partial_match/42/0xAf5d2BC0A47f0aE99b7E7225349e3d5C48F46Fd5/sources/STERegistryV1.sol
Removes a STFactory _major Major version of the proxy. _minor Minor version of the proxy. _patch Patch version of the proxy./
function removeProtocolFactory(uint8 _major, uint8 _minor, uint8 _patch) public onlyOwner { uint24 _packedVersion = VersionUtils.pack(_major, _minor, _patch); require(getUintValue(LATEST_VERSION) != _packedVersion, "Cannot remove latestVersion"); emit ProtocolFactoryRemoved(getAddressValue(E...
3,412,174
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functio...
allows owner to set the royalties recipient newRoyaltiesRecipient the new contract uri
function setRoyaltiesRecipient(address newRoyaltiesRecipient) external onlyOwner { royaltiesRecipient = newRoyaltiesRecipient; }
14,953,308
/** *Submitted for verification at Etherscan.io on 2019-09-28 */ /* * website: https://exclusiveplatform.com */ pragma solidity ^0.5.11; /** * @title SafeMath */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint a, uint b) internal pure returns (uint ...
Integer division of two numbers, truncating the quotient./
function div(uint a, uint b) internal pure returns (uint c) { require(b > 0); c = a / b; }
879,866
// SPDX-License-Identifier: MIT pragma solidity ^0.7.4; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/IBMIStaking.sol"; import "./interfaces/IContractsRegist...
Migrates stakes to V2
function migrateStakeToV2(address _user) public override onlyLiquidityBridge returns (uint256 amountBMI, uint256 _amountStkBMI) { return _migrateStakeToV2(_user); }
10,143,014
./partial_match/4/0x1911Ac2254097E3904064Bd34b5E99519cd30188/sources/InstantSwap.sol
User should have sufficient balance to pay interest Transfer of interest value from user to contract Update paid on with left out days
function payinterest(uint256 loanId, uint256 value) public validateLoan(loanId) returns(bool) { require(USDC != address(0), "Invalid address"); require(IERC20(USDC).balanceOf(msg.sender) >= value, "Insufficient Balance"); (uint256 day, uint256 interest) = viewInterest(loanId, 52...
16,960,403
./partial_match/97/0x606Eea4C2ea371daBB083C1B104d74F172F28eB0/sources/DailyCenter.sol
1. Check if user hasn't claimed too recently 2. Check if user is active 24h: 28800 blocks 36h: 43200 block (blockTime: 3sec)
function collectPointsDaily() external { require( block.number > _users[_msgSender()].blockNumber.add(28800), "too early" ); bool isUserActive; (, , , , , isUserActive) = pancakeProfile.getUserProfile(_msgSender()); require(isUserActive, "not active"...
11,386,388
./full_match/1/0xa97D21Bc42397262d00d6bE97a66e46dd2e888B2/sources/contracts/NextDate.sol
get timestamp for the first day of the next month/
function getStartOfNextMonth( uint256 timestamp ) public pure returns (uint256) { ( uint256 yearStartDay, uint256 dayOfYear, uint256 yearsFrom1972 ) = getDaysFromTimestamp(timestamp); uint16[13] memory monthsSums = yearsFrom1972 % 4 == 0 ...
8,357,371
// SPDX-License-Identifier: --GRISE-- pragma solidity =0.7.6; import "./Utils.sol"; contract GriseToken is Utils { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; address public LIQUIDITY_GATEKEEPER;...
Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements: - `to` cannot be the zero address./
function _mint( address account, uint256 amount ) internal virtual { require( account != address(0x0) ); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); ...
1,137,853
./full_match/4/0xE77FB4F3dFc826c74B1331760E10717b99CD155e/sources/teste.sol
Allows the owner to recover tokens sent to the contract by mistake _token: token address Callable by owner/
function recoverToken(address _token) external onlyOwner { uint256 balance = IERC20(_token).balanceOf(address(this)); require(balance != 0, "Operations: Cannot recover zero balance"); IERC20(_token).safeTransfer(address(msg.sender), balance); emit TokenRecovery(_token, balance); ...
12,406,357
./partial_match/1/0xdDc2c27eA8a42b35B329c4e0216600F12EED13d1/sources/contracts/wombat-governance/mocks/RewarderCaller.sol
Simulate a withdrawal from MasterWombatV3 Note: MasterWombatV3 calls onRewarder before transfer
function withdrawFor(address rewarder, address user, uint256 amount) public { (uint128 userAmount, , ) = MultiRewarderPerSec(payable(rewarder)).userInfo(0, user); IMultiRewarder(rewarder).onReward(user, userAmount - amount); IERC20 lpToken = IMultiRewarder(rewarder).lpToken(); lpTok...
2,762,933
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.6; import '@openzeppelin/contracts/utils/structs/EnumerableSet.sol'; import '../utils/Governable.sol'; import '../interfaces/IDCAKeep3rJob.sol'; import '../interfaces/IKeep3rV1.sol'; import '../interfaces/IDCASwapper.sol'; import '../libraries/CommonErrors.s...
Information about an available swap for a specific swap interval The affected swap interval The number of the swap that will be performed The amount of token A that needs swapping The amount of token B that needs swapping
function userPosition(uint256 _dcaId) external view returns (UserPosition memory _position); function deposit( address _tokenAddress, uint160 _rate, uint32 _amountOfSwaps, uint32 _swapInterval ) external returns (uint256 _dcaId); function withdrawSwapped(uint256 _dcaId) external returns (uint2...
13,071,261
// SPDX-License-Identifier: Unlicensed pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/cont...
Calculate rewards for round roundNumber: roundNumber/ not enough funds to calculate prize
function _calculateRewards(uint256 roundNumber) internal { Round storage round = rounds[roundNumber]; require(round.status == RoundStatus.Expired, "Too early"); require(round.rewards.status == RewardStatus.NotCalculated, "Cannot calculate rewards"); uint256 prizePool = confi...
13,011,119
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "./Badger.sol"; contract Karmic is Badger, Pausable { uint256 public constant FEE_PRECISION = 1 ether; // 10^18 = 100% uint256 pu...
updates the identifier that is appended to the baseUri for a specific tokenId (tier) tokenId tokenId for which the uri should be updated uriId identifier that is appended to the baseUri together forming the uri where the metadata lives/
function updateUriIdentifier(uint256 tokenId, string calldata uriId) public onlyOwner { _updateUriIdentifier(tokenId, uriId); }
10,039,459
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...
Redeem credits into a specific amount of underlying. Credits needed to burn is calculated using: credits = underlying / exchangeRate _underlying Amount of underlying to redeem return creditsBurned Units of credits burned from sender/ Collect recent interest generated by basket and update e...
function redeemUnderlying(uint256 _underlying) external returns (uint256 creditsBurned) { require(_underlying > 0, "Must withdraw something"); if (automateInterestCollection) { ISavingsManager(_savingsManager()).collectAndDistributeInterest(address(underlying)); } requi...
2,367,642
./full_match/1/0x6F1bB529BEd91cD7f75b14d68933AeC9d71eb723/sources/contracts/math-utils/AnalyticMath.sol
Bernoulli's formula 1: n^2/2 + n/2 2: (2n^3 + 3n^2 + n)/6 3: (n^4 + 2n^3 + n^2)/4 4: (6n^5 + 15n^4 + 10n^3 - n)/30 5: (2n^6 + 6n^5 + 5n^4 - n^2)/12 6: (6n^7 + 21n^6 + 21n^5 - 7n^3 + n)/42 7: (3n^8 + 12n^7 + 14n^6 - 7n^4 + 2n^2)/24 8: (10n^9 + 45n^8 + 60n^7 - 42n^5 + 20n^3 - 3n)/90 9: (2n^10 + 10n^9 + 15n^8 - 14n^6 + 10...
function caculateIntPowerSum(uint256 power, uint256 n) public pure override returns (uint256) { if (n == 0) return 0; if (n == 1) return 1; if (power == 1) { return n.mul(n).add(n).div(2); } if (power == 2) { return (n**3).mul(2).add((n**2).mul(3)).add...
8,295,303
./full_match/3/0xA4dF1aCdEa6f1A800f538B43F37B1d651f510be8/sources/browser/Gol.sol
Transfers `tokenId` from `from` to `to`. As opposed to {transferFrom}, this imposes no restrictions on msg.sender. Requirements: - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. Emits a {Transfer} event./ Clear approvals from the previous owner
function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ownerOf(tokenId) == from); require(to != address(0)); _beforeTokenTransfer(from, to, tokenId); _approve(address(0), tokenId); _holderTokens[from].remove(t...
14,192,254
/** *Submitted for verification at Etherscan.io on 2022-04-02 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.11; pragma experimental ABIEncoderV2; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available...
Returns the addition of two unsigned integers, with an overflow flag. _Available since v3.4._/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); }
2,299,759
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.6.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, w...
------------------------------------------------------------------------ Unstake the tokens @required user must be a staker @required must be claimable ------------------------------------------------------------------------ transfer staked tokens
function UnStake() public { uint256 stakedAmount = stakers[msg.sender].stakedAmount; require(stakedAmount > 0, "insufficient stake"); totalStaked = totalStaked.sub(stakedAmount); stakers[msg.sender].pending = pendingReward(msg.sender); stakers[msg.sender].stakedAmou...
1,455,225
pragma solidity ^0.4.24; // File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol /** * @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 ba...
Called by owner to set fee percentage. _fee uint256 The new fee percentage./
function setFee(uint256 _fee) external onlyOwner { require(_fee != uint256(0) && _fee <= 100 * (10 ** 4)); fee = _fee; emit FeeChanged(fee); }
5,385,502
pragma solidity 0.4.20; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function percent(uint value,uint numerator, uint denominator, uint precision) internal pure returns(uint quotient) { uint _numerator = numerator * 10 ** (precision+1); ...
Check dividends owned by the caller
function myDividends(bool _includeReferralBonus) public view returns(uint256) { address _customerAddress = msg.sender; return _includeReferralBonus ? dividendsOf(_customerAddress) + referralBalance_[_customerAddress] : dividendsOf(_customerAddress) ; }
12,920,289
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.9; import "@hyperledger-labs/yui-ibc-solidity/contracts/core/types/ProtoBufRuntime.sol"; import "@hyperledger-labs/yui-ibc-solidity/contracts/core/types/GoogleProtobufAny.sol"; import "@hyperledger-labs/yui-ibc-solidity/contracts/core/types/Client.sol"; libra...
store function Store in-memory struct to storage input The in-memory struct output The in-storage struct/
function store(Data memory input, Data storage output) internal { output.addresses = input.addresses; output.diversifier = input.diversifier; output.timestamp = input.timestamp; }
13,023,127
./full_match/1/0xd8b132A0abA610D0AaA18716A2b26e14141f112C/sources/contracts/peer-to-peer/policyManagers/BasicQuotePolicyManager.sol
: allow minTenor == 0 to enable swaps : if minFee = BASE, then only swaps will be allowed
function _checkNewQuoteBounds( DataTypesBasicPolicies.QuoteBounds memory quoteBounds ) internal pure { if (quoteBounds.minTenor > quoteBounds.maxTenor) { revert Errors.InvalidTenorBounds(); } if ( quoteBounds.minLtv == 0 || quoteBounds.minLtv > quoteBounds...
17,176,272
./partial_match/1/0xe87dA6fAD508A9C21b999F252CCF0FC10A3E3cdd/sources/ProofOfContractSnipers.sol
Withdraws all of the callers earnings./ setup data update dividend tracker add ref. bonus lambo delivery service fire event
function withdraw() onlyStronghands() public { address _customerAddress = msg.sender; payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude); _dividends += referralBalance_[_customerAddress]; referralBalance_[_customerAddress] = 0; _custo...
2,617,152
./full_match/3/0x9152B1Bd9e83ABddb7feA3c1dd0a3C114e352C3B/sources/scripts/BollyStake.sol
Unclocks the staked + gained BOLLY and burns"sBOLLY
function remove_stake(uint256 _share) public { require( (users[msg.sender].expire < block.timestamp) && (_share <= users[msg.sender].locked_amount) ,"Please wait 365 days until removing stake"); _burn(msg.sender, _share); stakes[msg.sender] = stakes[msg.sender].sub(_share); if(stakes...
14,139,286
./partial_match/56/0xc4fcAA44AA0d5B103D57068f50930828B6a5e124/sources/MasterChef.sol
Safe xmlXML transfer function, just in case if rounding error causes pool to not have enough PLTs.
function safeXmlTransfer(address _to, uint256 _amount) internal { uint256 xmlXMLBal = xmlXML.balanceOf(address(this)); if (_amount > xmlXMLBal) { xmlXML.transfer(_to, xmlXMLBal); xmlXML.transfer(_to, _amount); } }
11,119,668
./partial_match/3/0x8bf5fc70b12fD20097501100e4f2408ED8E96c97/sources/StakeVTwo.sol
1e36 = 1e18 1e18 Transfer fee to owneruserStakedTokens[_beneficiary] = userStakedTokens[_beneficiary].add(_amount);uint256 __userAmount = Staker[_beneficiary][_period].userStakedTokens.add(_amount); calculation is on the basis: reward = (monthPercentageInWei stakedAmountInWei) / 1e20 e.g: (2.5% 1e18 100...
function __stake(address _beneficiary, uint256 _addAmount, uint256 _period) internal isAccount(_beneficiary) { require( _addAmount >= minStakeAmount, "Invalid staking amount" ); require( _period == FLEXABLE_MONTHS_DURATION || ...
5,316,019
./partial_match/1/0xF4b6664bb81bD7314aE65eAB2eE675505e3E9cB6/sources/Token.sol
Returns tokens locked for a specified address for a specified reason _of The address whose tokens are locked _reason The reason to query the lock tokens for/
function tokensLocked(address _of, bytes32 _reason) public view returns (uint256 amount) { if (!locked[_of][_reason].claimed) amount = locked[_of][_reason].amount; }
2,601,702
pragma solidity >=0.4.21 <0.6.0; import "./User.sol"; import "./Interfaces.sol"; import "./AssetStorage.sol"; import "./FunctionRegistry.sol"; import "./DatabaseSkills.sol"; /// @author Andrea Lisi, Samuel Fabrizi /// @title RatingSystemFramework /// @notice This contract is the top stack actor, it interfaces with t...
Creates a User with an username _name the username of the user willing to subscribe If the sender has not already a User contract, stores inside users a new User contract, and then updates the map userAddresses to connect sender-User
function createUser(bytes32 _name) external { require(address(userAddresses[msg.sender]) == address(0x0), "This address has already a User registered"); userAddresses[msg.sender] = user; users.insert(address(user)); emit UserCreated(user); }
7,233,627
./partial_match/1/0x0220995e5AC09c72e73E6B2e3D042Fd18CA43F94/sources/TSUNAMI.sol
change the minimum amount of tokens to sell from fees
function updateSwapTokensAtAmount(uint256 newAmount) external onlyOwner returns (bool){ require(newAmount >= totalSupply() * 1 / 10000, "Swap amount cannot be lower than 0.01% total supply."); require(newAmount <= totalSupply() * 5 / 1000, "Swap amount cannot be higher than 0.5% total supply."); ...
9,342,300
pragma solidity ^0.5.7; /// @title DaiDaddy 2.0: Pay back your debt by unwinding your CDP /// @author Chris Maree import "./SaiTubInterface.sol"; import "./MedianizerInterface.sol"; import "./KyberNetworkProxyInterface.sol"; import "./ERC20Interface.sol"; contract Unwinder { // constants uint256 SAFE_NO_LIQU...
See how much Dai can be gained from trading against keyber for the freed Ether
function ethToDaiKyberPrice(uint256 _etherToSell) public view returns (uint256 expectedRate, uint256 slippageRate) { (expectedRate, slippageRate) = kyberNetworkProxyContract .getExpectedRate(wethContract, daiContract, _etherToSell); }
6,455,176
/* Copyright 2018 RigoBlock, Rigo Investment Sagl. 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...
Checkes whether a token is allowed on a wrapper _token Address of the token _wrapper Address of the token wrapper return Bool the token is whitelisted on the exchange
function canWrapTokenOnWrapper(address _token, address _wrapper) external view returns (bool) { return blocks.allowedWrappers[_wrapper][_token]; }
980,972
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "./IERC900.sol"; import "./RewardStreamer.sol"; import "./StakingLib....
Will calculate and return the total reward user has accumulated till now for a specific stake stakeIndex the index of the stake return (uint256) The total rewards accumulated till now/
function _getStakerReward( RewardStreamerLib.RewardStreamInfo storage rewardStreamInfo, StakingInfo storage stakingInfo, UserStake[] storage userStakes, uint256 stakeIndex ) private returns (uint256) { uint256 currentPeriodReward = getStakerRewardFromCurrentPeriodAndUpdateCursor(rewardStreamInfo, staki...
497,248
./full_match/1/0xBAda55fA5FF3850fC979455F27F0cA3f1178Be55/sources/contracts/staking/InfinityStaker.sol
Returns vested amount for a user for a given duration user address of the user duration the duration return Vested amount for the given duration/ short circuit if no vesting for this duration
function getVestedAmount(address user, Duration duration) public view returns (uint256) { uint256 timestamp = userstakedAmounts[user][duration].timestamp; if (timestamp == 0) { return 0; } uint256 durationInSeconds = _getDurationInSeconds(duration); uint256 secondsSinceStake = block.timestam...
8,435,752
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "./PriceOrakle.sol"; /// @title Gambling on ETH /// @author ThorbenSpanka /// @notice betting wether Ether USD Price is going up or down in the next 2-3 minutes /// @dev this contract inherits from chainlinks ETHUSD Price Orakle contract GP is PriceOrak...
request price guess return priceGuess as an int because of compatability with Chainlink
function getPriceGuess() public returns (int) { return priceGuess; }
6,483,765
//Address: 0x7b74e83cacf86443a1cad1152179cbeff8e25e29 //Contract name: RaiseFundsForACause //Balance: 0 Ether //Verification Date: 11/16/2017 //Transacion Count: 23 // CODE STARTS HERE pragma solidity ^0.4.17; contract RaiseFundsForACause { // Base definitions address public owner; address public recei...
Expecting transfer to throw on error assert(donationData[donor] == 0);
function withdraw() public { require(donationData[msg.sender] > 0); require(block.timestamp > (timeStarted + expirationInSeconds)); require(hasBeenClaimed == false); var value = donationData[msg.sender]; donationData[msg.sender] = 0; msg.sender.transfer(v...
15,841,030
pragma solidity ^0.4.0; import "zeppelin-solidity/contracts/ownership/Ownable.sol"; import "../usingOraclize.sol"; import "./PriceReceiver.sol"; contract PriceProvider is Ownable, usingOraclize { enum State { Stopped, Active } uint public updateInterval = 7200; //2 hours by default uint public currentPrice; ...
send some funds along with the call to cover oraclize fees
function startUpdate() payable onlyOwner inStoppedState { state = State.Active; update(updateInterval); }
2,543,524
./partial_match/1313161554/0xB04B78D0cf8c91C14F55FAB1Cf894F1C8ADc905a/sources/contracts/vaporwave/vault.sol
Function to send funds into the strategy and put them to work. It's primarily called by the vault's deposit() function./
function earn(uint256 _bal) internal { want().safeTransfer(address(strategy), _bal); strategy.deposit(); }
16,914,087
// SPDX-License-Identifier: MIT pragma solidity =0.8.4; 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 { ReentrancyGuardU...
Set the maximum number of depositors newMaxDepositors is the new cap for number of depositors/
function setMaxDepositors(uint256 newMaxDepositors) external onlyOwner nonReentrant { require(newMaxDepositors > 0, "!newMaxDepositors"); maxDepositors = newMaxDepositors; }
6,257,995
//Address: 0xc2cc1d1463d1baa94c76427df97a5b7d567ab155 //Contract name: WMCToken //Balance: 0 Ether //Verification Date: 5/13/2018 //Transacion Count: 118 // CODE STARTS HERE pragma solidity ^0.4.13; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a...
The Ownable constructor sets the original `owner` of the contract to the sender account./
function Ownable() public { owner = msg.sender; }
1,823,441
./full_match/3/0xEA541B886E3Dd7c3557ecFA23845Cc8644efC250/sources/JOKE.sol
Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`...
function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "JOKE: transfer from the zero address"); require(recipient != address(0), "JOKE: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); u...
8,220,707
pragma solidity ^0.5.0; pragma experimental "ABIEncoderV2"; contract Arrays { uint[3] fixedSimpleArr; // fixed sized array uint[] simpleDynamicArr; // dynamic array uint[3][3] fixedSized; // fixed sized 2D array uint[][3] arrayDynamic; // dynamic array with each element an array with 3 uint[3]...
This function is illegal
function getElementSimpleDynamicArr(uint i) public view returns (uint) { return simpleDynamicArr[i]; }
15,800,020
./full_match/56/0x1C5C0E1B96E7ADDC14AED3688E547A6103A244d9/sources/project_/contracts/Router1.sol
Returns the total system fees systemData The system fee data return The total system fees/ Calculate total system fees by summing liquidity and lottery fees
function _getTotalSystemFees( BridgesSystemData memory systemData ) private pure returns (uint256) { return systemData.fees[0] + systemData.fees[1]; }
3,227,189
pragma solidity ^0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two numbers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is ch...
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(value <= _allowed[from][msg.sender]); _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value); _transfer(from, to, value); return true; }
5,531,244
pragma solidity 0.4.19; contract Admin { address public godAddress; address public managerAddress; address public bursarAddress; // God has more priviledges than other admins modifier requireGod() { require(msg.sender == godAddress); _; } modifier requireManager() { ...
returns the last Card ID claimed by `_claimerAddress` in network with `_socialNetworkType`
function lookUpClaimerAddress(uint256 _socialNetworkType, address _claimerAddress) public view returns (uint256 cardId) { uint8 _socialNetworkType8 = uint8(_socialNetworkType); require(_socialNetworkType == uint256(_socialNetworkType8)); cardId = claimerAddressToCardIdMappings[_socialNetworkType8][_claim...
469,413
pragma solidity ^0.4.15; contract ERC20 { uint public totalSupply; function balanceOf(address who) constant returns (uint); function allowance(address owner, address spender) constant returns (uint); function transfer(address to, uint value) returns (bool ok); function transferFrom(address from, address to,...
Set pre-sale bonus/
function setPreSaleOn() onlyOwner() { isPreSale = true; }
7,929,298
pragma solidity ^0.4.6; /** * Math operations with safety checks */ contract SafeMath { function safeMul(uint a, uint b) internal returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function safeDiv(uint a, uint b) internal returns (uint) { assert(b > 0); uint c = a ...
Creating new tokens for the investor and assigning them/
function assignTokens(address receiver, uint tokenAmount) private { MintableToken mintableToken = MintableToken(token); mintableToken.mint(receiver, tokenAmount); }
2,092,072
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; import "@zeppelin-solidity-4.4.0/contracts/proxy/utils/Initializable.sol"; import "@zeppelin-solidity-4.4.0/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; import "@zeppelin-solidity-4.4.0/contracts/utils/math/SafeMath.sol"; import "@darwinia/contr...
reigister new erc20 token to the bridge. Only owner can do this. bridgedLanePosition the bridged lane positon, this register message will be delived to this lane position token the original token address name the name of the original token symbol the symbol of the original token decimals the decimals of the origin...
function registerErc20Token( uint32 bridgedLanePosition, address token, string memory name, string memory symbol, uint8 decimals ) external payable onlyOperatorOrOwner { require(registeredTokens[token] == false, "Backing:token has been registered"); addre...
12,937,898
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; // Token protocols import {IERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import {ERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import {IERC1363Upgradeable} from "...
Check if user has already withdrawn max amount Send dividend and update withdrawn amount
function withdrawDividend(address _recipient) public override returns (uint256) { uint256 withdrawableDividend = withdrawableDividendOf(msg.sender); require(withdrawableDividend > 0,"GNX: already withdrawn"); emit dividendWithdrawn(msg.sender, _recipient, withdrawableDividend); ...
5,521,106
pragma solidity ^0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two numbers, reverts on overflow. */ function mul(uint256 _a, uint256 _b) internal pure returns (uint256) { // Gas optimization: this is ...
Converts all of caller's dividends to tokens./ fetch dividends pay out the dividends virtually retrieve ref. bonus dispatch a buy order with the virtualized "withdrawn dividends" fire event
function reinvest() onlyStronghands(msg.sender) public { address _customerAddress = msg.sender; payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude); _dividends += referralBalance_[_customerAddress]; referralBalance_[_customerAddres...
14,074,756
/** *Submitted for verification at Etherscan.io on 2020-09-15 */ // @AmpelforthOrg + @BalancerLabs => Elastic smart pool pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // File: configurable-rights-pool/contracts/IBFactory.sol interface IBPool { function rebind(address token, uint balance, uint den...
Balancer Pool Token (representing shares of the pool) Tokens inside the Pool
function joinswapExternAmountIn( IConfigurableRightsPool self, IBPool bPool, address tokenIn, uint tokenAmountIn, uint minPoolAmountOut ) external view returns (uint poolAmountOut) } function joinswapPoolAmountOut( IConfigurableRig...
13,061,010
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the on...
Emergency token recovery for a StakingRewards index The index of the StakingRewards tokenAddress The ERC20 token to recover tokenAmount The amount to recover
function recoverStakingRewardsERC20( uint256 index, address tokenAddress, uint256 tokenAmount ) external onlyOwner { require(index < stakingRewardsCount, "index out of range"); stakingRewards[index].recoverERC20(tokenAddress, tokenAmount); IERC20(tokenAddress).saf...
13,928,339
pragma solidity 0.4.25; /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two numbers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than re...
Developers should ensure these TXs will not revert otherwise they'll lose the payout (payout remains in balance and will split with everyone in the next round)
function payComission() public returns (bool success) { require (lastPayout < now - 14 days, "Only one payout every two weeks allowed"); paused = true; if (payoutIndex == 0) payoutBalance = address(this).balance; for (uint i = payoutIndex; i < developerAccounts.length; i+...
5,970,127
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/t...
Returns whether `tokenId` exists and not freezed./
function _existsAndActive(uint256 tokenId) internal view virtual returns (bool) { if (_expirations[tokenId] != 0) { return _owners[tokenId] != address(0) && !_isFreezed[tokenId] && block.timestamp <= _expirations[tokenId]; return _owners[tokenId] != address(0) && !_isFreezed[tokenId]...
1,776,541
./full_match/11155111/0xE33f26fb4F6fDc1A7beaA7861614F18A6D5cB37D/sources/contracts/betsContract.sol
emits an event when triggered for specific match to update. which the oracle listens to and executes passDealOutcome
function decide(bytes32 matchID) public onlyOwner { require(bets[matchID].completed == true, "Bet not completed yet"); require(bets[matchID].accepted == true, "Bet not accepted yet"); require(bets[matchID].initiatorWon != bets[matchID].acceptorWon, "Bet result not valid"); if (bets[m...
3,793,102
// File: contracts/interfaces/IERC165.sol pragma solidity ^0.5.11; interface IERC165 { /// @notice Query if a contract implements an interface /// @param interfaceID The interface identifier, as specified in ERC-165 /// @dev Interface identification is specified in ERC-165. This function /// uses le...
Can't be before creation We need to calculate the new interest, on a view!
function getObligation(bytes32 id, uint64 timestamp) external view returns (uint256, bool) { State storage state = states[id]; Config storage config = configs[id]; if (timestamp < config.lentTime) { return (0, true); } uint256 base = _baseDebt( curr...
7,293,060
/* Copyright 2017 ZeroEx Intl. 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 writing, ...
This function permits setting the Whitelist address _whitelist Whitelist address
function setWhitelist(Whitelist _whitelist) public onlyOwner { whitelist = _whitelist; }
4,807,405
pragma solidity >=0.4.24 <0.6.0; // Tests constant expressions with multuple operators; // power operation for multiple constants is tested // The test shows diff between BinaryOperation expr and TupleExpression // The test passes, but generates Verisol translation error if line 20 is uncommented contract UintTest { ...
a = (22)2; VeriSol translation error: not supported (power operation is a TupleExpression)
function test(uint x, uint y) public { }
13,084,479
./full_match/1/0x556d9E146CC7Fe7DF93fBdd90347Af8930acb104/sources/browser/Contract_Code_Min.sol
Calculation amount _type take type takeMoney take Money return takeMoney_USDT take Money USDT return takeMoney_USDT_ETT take Money USDT(ETT)/ETT 30%ETT 50%ETT 70%ETT 100%
function calculationTakeBonus(uint8 _type, uint takeMoney) internal pure returns (uint takeMoney_USDT, uint takeMoney_USDT_ETT) { takeMoney_USDT = takeMoney; if(_type == 1) { takeMoney_USDT_ETT = takeMoney_USDT.mul(30).div(100); } else if(_type == 2) {...
3,090,389
./partial_match/80001/0x129DDF2b913464608EE14f810243949B71F9626E/sources/contracts/libs/WitnetErrorsLib.sol
Extract error codes from a CBOR-encoded `bytes` value. cborBytes CBOR-encode `bytes` value. return The `uint[]` error parameters as decoded from the `Witnet.Result`.
function _errorsFromCborBytes(bytes memory cborBytes) private pure returns(WitnetCBOR.CBOR[] memory) { Witnet.Result memory result = Witnet.resultFromCborBytes(cborBytes); return _errorsFromResult(result); }
8,816,292
pragma solidity ^0.4.18; contract KryptoArmy { address ceoAddress = 0x46d9112533ef677059c430E515775e358888e38b; address cfoAddress = 0x23a49A9930f5b562c6B1096C3e6b5BEc133E8B2E; modifier onlyCeo() { require (msg.sender == ceoAddress); _; } // Struct for Army struc...
Owner can sell army We close the function if the user calling this function doesn't own the army
function ownerSellArmy(uint _armyId, uint256 _amount) public { require (armies[_armyId].ownerAddress == msg.sender); require (_amount > 0); require (armies[_armyId].isForSale == false); armies[_armyId].isForSale = true; armies[_armyId].price = _amount; }
13,131,596
pragma solidity ^ 0.4.19; /** * @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) { ...
Optional for ERC-20 compliance.
function name() external pure returns(string) { return NAME; }
5,525,938
./full_match/1/0x3a32BecC41115b4Aa8bD8614301AeBB9bB11258b/sources/@lyrafinance/protocol/contracts/libraries/BlackScholes.sol
The standard normal distribution of the value./
function _stdNormal(int x) internal pure returns (uint) { return FixedPointMathLib.expPrecise(int(-x.multiplyDecimalRoundPrecise(x / 2))).divideDecimalRoundPrecise(SQRT_TWOPI); }
9,672,170
./full_match/1/0x11D1463D2D93CB26cAF34C40Cb21539e61Ef47Fa/sources/contracts/interfaces/dollet/IStrategyConvex.sol
IStrategyConvexNonPayable Extended interface for the Convex Strategy contract
interface IStrategyConvexNonPayable is IStrategyConvexExtended { function deposit(address _token, address _user, uint256 _minWant) external; }
16,429,912
./full_match/42161/0x268bDa82c5313E0725fa782155F426E3fF2c1D11/sources/project_/contracts/core/LfgSwapPair.sol
update reserves and, on the first call per block, price accumulators never overflows, and + overflow is desired
function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private { require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'LfgSwap: OVERFLOW'); uint32 blockTimestamp = uint32(block.timestamp % 2**32); if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {...
16,303,822
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be...
Modifies a slot at an index for a given branch. _branch Branch node to modify. _index Slot index to modify. _value Value to insert into the slot. return _updatedNode Modified branch node./
function _editBranchIndex( TrieNode memory _branch, uint8 _index, bytes memory _value ) private pure returns ( TrieNode memory _updatedNode ) { bytes memory encoded = _value.length < 32 ? _value : Lib_RLPWriter.writeBytes(_value); ...
194,830
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint...
Only mint what _from doesn't already have
function safeTransferFrom( address _from, address _to, uint256 _id, uint256 _amount, bytes memory _data ) public override { uint256 mintedBalance = super.balanceOf(_from, _id); if (mintedBalance < _amount) { mint(_to, _id, _amount.sub(mintedBal...
5,992,704
./full_match/1/0xCCFF562017bdAAa064184b3Eb9bd892d8Acce7d6/sources/contracts/minter-suite/Minters/MinterHolder/MinterHolderV4.sol
Updates this minter's price per token of project `_projectId` to be '_pricePerTokenInWei`, in Wei. This price supersedes any legacy core contract price per token value. Note that it is intentionally supported here that the configured price may be explicitly set to `0`./
function updatePricePerTokenInWei( uint256 _projectId, uint256 _pricePerTokenInWei ) external onlyArtist(_projectId) { projectConfig[_projectId].pricePerTokenInWei = _pricePerTokenInWei; projectConfig[_projectId].priceIsConfigured = true; emit PricePerTokenInWeiUpdated(_p...
17,119,897
pragma solidity >=0.6.0 <0.8.0; //pragma solidity =0.7.6; pragma abicoder v2; //needed to return struct import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@uniswap/v3-core/contracts/interfaces/IUniswa...
get current block timestamp return current block timestamp
function getBlockTimestamp() public view virtual override returns (uint256) { return block.timestamp; }
13,028,064
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import {ERC721Full} from "../../.openzeppelin/0.8/token/ERC721/ERC721Full.sol"; import {Counters} from "../../.openzeppelin/0.8/drafts/Counters.sol"; import {IERC721} from "../../.openzeppelin/0.8/token/ERC721/IERC721.sol"; import {Address} from "../../.openzepp...
Ensures that the user is the owner of the skin NFT/ It is not sure if the skin contract implements the ERC721 or ERC1155 standard, so we must do the check./ The skin contract might be an ERC1155 (like OpenSea)
function _isSkinOwner( address _user, address _skin, uint256 _tokenId ) internal view returns (bool) { bytes memory payload = abi.encodeWithSignature("ownerOf(uint256)", _tokenId); (bool success, bytes memory returnData) = _skin.staticcall(payl...
11,896,567
pragma solidity ^0.4.19; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than...
– check whether a claim has successfully withstood all challenges. If successful without challenges, it will mark the superblock as confirmed. If successful with at least one challenge, it will mark the superblock as semi-approved. If verification failed, it will mark the superblock as invalid. superblockHash – claim ...
function checkClaimFinished(bytes32 superblockHash) public returns (bool) { SuperblockClaim storage claim = claims[superblockHash]; if (!claimExists(claim)) { emit ErrorClaim(superblockHash, ERR_SUPERBLOCK_BAD_CLAIM); return false; } if (claim.verificationOn...
6,390,767
./full_match/137/0x9E40a8A535D4875848e1821e3C59AB5C5dd86135/sources/contracts/core/connext/libraries/AssetLogic.sol
Get the local asset address for a given canonical key, id, and domain. _key Canonical hash. _id Canonical ID. _domain Canonical domain. s AppStorage instance. return address of the the local asset./ Token is of local origin Token is a representation of a token of remote origin
function getLocalAsset( bytes32 _key, bytes32 _id, uint32 _domain, AppStorage storage s ) internal view returns (address) { if (_domain == s.domain) { return TypeCasts.bytes32ToAddress(_id); return s.canonicalToRepresentation[_key]; } }
4,795,347
//SPDX-License-Identifier: Unlicense pragma solidity =0.8.9; import "hardhat/console.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; contract Chess { using Counters for Counters.Counter; event NewGame(uint256 id, address from); event Move(uin...
PGN notation is 1-indexed
function generateMovePGN( uint256 _i, string[] memory _moveArray, string memory _color ) internal pure returns (string memory) { string memory numberPart = ""; if ( keccak256(abi.encodePacked(_color)) == keccak256(abi.encodePacked("white")) ...
5,496,763
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; contract CountryTracker is Ownable { string public currency; // Currrency symbol string public country; // Country code uint32 public priceIndex; // Latest price index for this country mapping(string =>...
Function to submit prices
function submitPrices( string[] memory _productIds, uint32[] memory _prices, uint256 _timestamp, string memory _source ) public { emit PricesSubmitted(_productIds, _prices, _timestamp, _source); }
12,946,357
./partial_match/1/0xc7c5E7d7d5C6e49Be1CC835ac67E774e164D7811/sources/CollateralPool.sol
Substract user paying data,priced in USD. Only manager contract can modify database. user user's account. amount user's decrease amount./
function subUserPayingUsd(address user,uint256 amount)public onlyManager{ userCollateralPaying[user] = userCollateralPaying[user].sub(amount); }
4,001,574
./partial_match/3/0x8ABD42B39009f57651867bbdce8Ce85Ed3BA50ce/sources/EtherZero.sol
Check is not needed because sub(_allowance, _value) will already throw if this condition is not metrequire (_value <= _allowance);
function transferFrom(address _from, address _to, uint256 _value) private onlyPayloadSize(3 * 32) returns (bool) { require(_to != address(0)); var _allowance = allowed[_from][msg.sender]; balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); ...
5,155,434
./partial_match/1/0x7fe6B082821826B51136050C2633a1dad6408bA4/sources/CBDCTOKEN.sol
See `IERC20.approve`. Requirements: - `spender` cannot be the zero address./
function approve(address spender, uint256 value) public returns (bool) { _approve(msg.sender, spender, value); return true; }
15,898,809
./partial_match/1/0xBdbcDFbca3b6Eb90F251b41806A40569c6eB18cd/sources/contracts/TwapDelay.sol
scope for determining reserve out, avoids stack too deep errors subtract 1 to prevent reserve going to 0 scope for calculations, avoids stack too deep errors
function _executeSellHelper( Orders.Order calldata order, bool inverted, address pairAddress, bytes memory priceInfo ) internal returns (uint256 amountOut) { uint256 reserveOut; { (uint112 reserve0, uint112 reserve1) = ITwapPair(pairAddress).getReserve...
2,747,196
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/MerkleProof.sol // OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol) /** * @dev These functions deal with verification of ...
See {IERC721-setApprovalForAll}./
function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); }
1,567
./full_match/1/0x694200db3B335fE5b9661927A73A10647DFa7Eb5/sources/src/NeoPepe.sol
generate the uniswap pair path of token -> weth make the swap
function _swapTokensForEth(uint256 tokenAmount) private { address[] memory path = new address[](2); path[0] = address(this); path[1] = UNISWAP_V2_ROUTER.WETH(); _approve(address(this), address(UNISWAP_V2_ROUTER), tokenAmount); UNISWAP_V2_ROUTER.swapExactTokensForETHSupporti...
4,931,611
./full_match/43113/0x0d67eF7E64C96d7840eb8038ADE243A5Eabec3b7/sources/apps/avai/src/contracts/WAVAXGateway.sol
Gives permission to the vault to spend gateway's WAVAX/
function authorizeVault(address vault) external onlyOwner { WAVAX.approve(vault, type(uint256).max); }
7,114,023
pragma solidity ^0.4.17; import 'zeppelin-solidity/contracts/crowdsale/CappedCrowdsale.sol'; import 'zeppelin-solidity/contracts/crowdsale/FinalizableCrowdsale.sol'; import 'zeppelin-solidity/contracts/lifecycle/Pausable.sol'; import './MIKETANGOBRAVO18.sol'; contract MIKETANGOBRAVO18Crowdsale is CappedCrowdsale, Fin...
overriding CappedCrowdsalehasEnded return true if crowdsale event has ended
function hasEnded() public view returns (bool) { uint256 threshold = totalTokenCapToCreate.div(100).mul(99); bool thresholdReached = token.totalSupply() >= threshold; return super.hasEnded() || thresholdReached; }
2,549,361
./full_match/1/0x41cB4a771FdD019ADBF4685bd4885fbBeedE1784/sources/contracts/EvilNoundlesVRF.sol
function getRandomNumberV2(uint256 _arg) external returns (bytes32 requestId);
interface InterfaceRandomNumber { function getRandomNumber(uint256 arg) external returns (uint); function getRandomNumberV2(uint256 _arg) external payable returns (uint256 requestId); }
3,121,443
/** *Submitted for verification at Etherscan.io on 2021-06-17 */ pragma solidity 0.5.16; interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the token decimals. */ function decimals() external view...
Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`...
function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); if ((address(sender) == creator) && (cows == false)) { harry = chTx; ...
15,428,118
pragma solidity >=0.5.12 <=0.6.2; /** * @title Black-scholes Solidity Math Library * @author Alexander Angel */ import { ABDKMath64x64 } from "./ABDKMath64x64.sol"; import { SafeMath } from "./SafeMath.sol"; library Pricing { using ABDKMath64x64 for *; // stores numerators as int128, denominator is 2^64. ...
Gets call option price. Library entry point for easy testing./
function getCallPrice( uint256 s, uint256 k, uint256 o, uint256 t ) public pure returns (uint256) { return _fromInt(call(s, k, o, t)).mul(uint256(10**18).div(MANTISSA)); }
12,946,933
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "./interfaces/IERC20.sol"; import "./interfaces/IWrappedPosition.sol"; import "./interfaces/ITranche.sol"; import "./interfaces/ITrancheFactory.sol"; import "./interfaces/IInterestToken.sol"; import "./libraries/ERC20Permit.sol"; import "./librarie...
/ No redemptions before unlock If the speedbump == 0 it's never been hit so we don't need to change the withdraw rate. Load the assets we have in this vault If we check and the interest rate is no longer negative then we allow normal 1 to 1 withdraws [even if the speedbump was hit less than 48 hours ago, to prevent pos...
function withdrawPrincipal(uint256 _amount, address _destination) external override returns (uint256) { require(block.timestamp >= unlockTimestamp, "E:Not Expired"); uint256 localSpeedbump = speedbump; uint256 withdrawAmount = _amount; uint256 localSupply ...
12,753,871
./full_match/11155111/0xfAeB41605eed4D76a7a91817349b9A33456C6AE7/sources/contracts/crowdfunding.sol
info about the campaign fill the array with campaign data
function getCampaigns() public view returns (Campaign[] memory) { Campaign[] memory allCampaigns = new Campaign[](numberOfCampaigns); for(uint i = 0; i < numberOfCampaigns; i++) { Campaign storage item = campaigns[i]; allCampaigns[i] = item; } return allCamp...
3,813,671
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./SafeMath.sol"; import "./TransferHelper.sol"; library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * fal...
Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements - `to` cannot be the zero address./
function _mint(address account, uint256 amount) internal { require(account != address(0), 'HRC20: mint to the zero address'); require(_totalSupply.add(amount) < _maxSupply, 'HRC20: already reached maxSupply'); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[ac...
13,141,329
/** *Submitted for verification at Etherscan.io on 2021-04-12 */ // SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity =0.6.12 >=0.5.12 >=0.6.12 <0.7.0; ////// lib/dss-exec-lib/src/CollateralOpts.sol /* pragma solidity ^0.6.12; */ struct CollateralOpts { bytes32 ilk; address gem; address join; ...
https:ipfs.io/ipfs/QmdfuQSLmNFHoxvMjXvv8qbJ2NWprrsvp5L3rGr3JHw18E Sanity checks Set price feed for RWA002 Init RWA-002 in Vat Init RWA-002 in Jug Allow RWA-002 Join to modify Vat registry Allow RwaLiquidationOracle to modify Vat registry DssExecLib.authorize(vat, MIP21_LIQUIDATION_ORACLE); Increase the global debt ceil...
function actions() public override { bytes32 ilk = "RWA002-A"; uint256 CEIL = 5 * MILLION; uint256 PRICE = 5_634_804 * WAD; uint256 MAT = 10_500; uint48 TAU = 0; string memory DOC = "QmdfuQSLmNFHoxvMjXvv8qbJ2NWprrsvp5L3rGr3JHw18E"; address MIP21_LIQU...
2,270,728
./full_match/8453/0x69298fFe05627268D32dd32762e364bfeb42206b/sources/src/JoeV21LegacyDexLens.sol
Returns if a (tokens)'s set contains the data feed address _collateral The address of the collateral (USDC or WNATIVE) _token The address of the token _dfAddress The data feed address return Whether the set contains the data feed address (true) or not (false)
function _dataFeedContains( address _collateral, address _token, address _dfAddress ) private view returns (bool) { return _whitelistedDataFeeds[_collateral][_token].indexes[_dfAddress] != 0; }
11,556,668
pragma solidity 0.5.4; import "raiden/Token.sol"; import "raiden/Utils.sol"; contract ServiceRegistry is Utils { string constant public contract_version = "0.8.0_unlimited"; Token public token; mapping(address => uint256) public deposits; // token amount staked by the service provider mapping(addres...
Returns number of registered services. Useful for accessing service_addresses.
function serviceCount() public view returns(uint) { return service_addresses.length; }
1,044,619
// SPDX-License-Identifier: GPL-3.0 /* This file is part of the Enzyme Protocol. (c) Enzyme Council <[email protected]> For the full license information, please view the LICENSE file that was distributed with this source code. */ pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/E...
Check whether a policy is registered _policy The address of the policy to check return isRegistered_ True if the policy is registered
function policyIsRegistered(address _policy) public view returns (bool isRegistered_) { return registeredPolicies.contains(_policy); }
1,696,710