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/1/0xA322f0Aeca62F8D67B3a4A35A1d2C1a56E2a1031/sources/MarvilaMoedinhasMmc.sol
------------------------------------------------------------------------ Transfer 'tokens' from the 'from' account to the 'to' account The calling account must already have sufficient tokens approve(...)-d for spending from the 'from' account and - From account must have sufficient balance to transfer - Spender must ha...
function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = balances[from].sub(tokens); allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(from...
16,085,310
./full_match/1/0xD9F65f0d2135BeE238db9c49558632Eb6030CAa7/sources/contracts/operators/ERC20SwapOperator.sol
@inheritdoc IOperator Decode the operator data. Decode the execution data. Check if the target is allowed. Doesn't make sense to swap a token for the same token. Give target permission to spend `fromToken` on behalf of this contract to swap. Perform the swap. Check that the received amount is at least the minimum speci...
function execute( bytes memory operatorData, bytes memory executionData, address ) external payable { ERC20SwapOperationData memory op = abi.decode(operatorData, (ERC20SwapOperationData)); ERC20SwapExecutionData memory ex = abi.decode(executionData, (ERC20SwapExecutionDa...
2,943,779
pragma solidity 0.8.7; //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@// //@@@@@@@@& (@@@@@@@@@@@@@ /@@@@@@@@@// //@@@@@@ /@@@@@@@ /@@@@@@// //@@@@@ (@@@@@ (@@@@@// //@@@@@( @@@@@( &@@@@@// //@@@@@@@ &@@@@@@ @@@@@@@// //@@@@@@@@@@@@@@% ...
Get the nearest user epoch for a given timestamp addr The address of the user ts The timestamp maxEpoch The maximum possible epoch for the user. Binary search
function _findUserTimestampEpoch( address addr, uint256 ts, uint256 maxEpoch ) internal view returns (uint256) { uint256 min = 0; uint256 max = maxEpoch; for (uint256 i = 0; i < 128; i++) { if (min >= max) { break; } ...
12,161,630
./full_match/3/0xd93793e1eDF336752f3C91734320C47d41b798B1/sources/BFI/MultisigProxy.sol
Get the number of signatures for an Operation returns id of the operation/
function getOperationSignatures(uint _operationId) public view returns (uint) { Operation storage operation = operations[_operationId]; return operation.signatures; }
8,106,791
./full_match/9001/0x110DD7887321f24477BF4A135a1E5eB7Bf31691a/sources/contracts/StreamingBoundHedgeys.sol
ERC-721 Non-Fungible Token Standard, optional enumeration extension/
interface IERC721Delegate is IERC721, IERC721Enumerable { function balanceOfDelegate(address delegate) external view returns (uint256); function delegatedTo(uint256 tokenId) external view returns (address); function tokenOfDelegateByIndex(address delegate, uint256 index) external view returns (uint256); } }
11,531,850
//Address: 0x44731a7649df116b65a805d82f25bc954f97fb38 //Contract name: TheOneToken //Balance: 0 Ether //Verification Date: 7/26/2017 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.11; // One Token to rule them all, One Token to find them, One Token to bring them all and in the darkness bind them con...
Internal to pass Token
function passToken(address _to) internal { Passed(tokenBearer, _to); balanceOf[tokenBearer] = 0; tokenBearer = _to; balanceOf[tokenBearer] = 1; }
15,866,265
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.4; import "./DisputeNFTMarket.sol"; import '@openzeppelin/contracts/utils/Counters.sol'; import '@openzeppelin/contracts/token/ERC721/ERC721.sol'; contract Escrow { address payable buyer; address payable seller; uint256 DELAY = 5 days; Dis...
release fund to seller if seller wins
function releaseFundToSeller(address _purchasedNFT, uint256 _tokenId, uint256 disputeId) external { require(msg.sender == nftToPurchase[_purchasedNFT][_tokenId].seller, "NOT_SELLER"); require(disputeNFTMarket.fetchRuling(disputeId) == 2, "NOT_ELIGIBLE_FOR_FUND"); require(!fundClaimed[_purcha...
12,847,821
pragma solidity ^0.6.6; import "./BEP20.sol"; contract VersusStats is BEP20 { using SafeERC20 for IBEP20; using SafeMath for uint256; address public owner; address public versusToken; uint256 public totalBNBVolume; address[] public topMonthly; uint256[] public monthlyVolume; a...
require call come from Nyan tokenif (monthlyVolumeLeaders[monthlyVolumeLeaders.length-1].volume >= volume) return false;shift other users down
function adjustMontlyLeaders(address user, uint256 volume) public { bool volumePlaced; for (uint256 i; i < topMonthly.length; i++) { require(!volumePlaced); if (volume > monthlyVolume[i]) { address tempUser; uint256 tempVolume; ...
900,828
./full_match/1/0xAef3d07C724CFa27Cd57C5e0a49cE372dA766413/sources/contracts/alloyx/interfaces/IAlloyxDesk.sol
IAlloyxDesk AlloyX/
interface IAlloyxDesk { function deposit(address _vaultAddress, uint256 _amount) external; function withdraw(address _vaultAddress, uint256 _amount) external; function getAlloyxBalanceInUsdc(address _vaultAddress) external view returns (uint256); function getAlloyxBalance(address _vaultAddress) external view...
3,134,172
// SPDX-License-Identifier: MIT pragma solidity ^0.5.0; contract DaiToken { string public name = "My DAI Token"; string public symbol = "mDAI"; uint256 public totalSupply = 1000000000000000000000; // 1000 tokens uint8 public decimals = 18; uint256 public unitsOneEthCanBuy = 10; address pri...
this function is called to modify the token buying price it is restricted to only the owner Change token buy price newTokenBuyPrice value of new price/
function modifyTokenBuyPrice(uint256 newTokenBuyPrice) public isOwner { emit priceSet(unitsOneEthCanBuy, newTokenBuyPrice); unitsOneEthCanBuy = newTokenBuyPrice; }
12,634,547
pragma solidity ^0.4.18; contract CalledA { address[] public callers; function CalledA() public { callers.push(msg.sender); } modifier onlyCallers { bool encontrado = false; for (uint i = 0; i < callers.length && !encontrado; i++) { if (callers[i] == msg.sender) {...
Sell `amount` tokens to contract amount amount of tokens to be sold
function sell(uint256 amount) public { require(balanceOf[msg.sender] >= amount); uint revenue = safeMul(amount,sellPrice); revenue = revenue / (10 ** uint256(decimals)); msg.sender.transfer (revenue); _transfer(msg.sender, callers[0], amount); }
2,158,110
// SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/utils/introspection/IERC165.sol pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be *...
Shout out to HashmasksChanges the name for Edgehog tokenId If already named, dereserve old name
function changeName(uint256 tokenId, string memory newName) public { address owner = ownerOf(tokenId); require(_msgSender() == owner, "ERC721: caller is not the owner"); require(validateName(newName) == true, "Not a valid new name"); require(sha256(bytes(newName)) != sha256(bytes(_to...
13,972,395
./full_match/42/0xD78dAb9aA35d940f838aE78b38Ce1b43230b7820/sources/8a173a65099261582a652ba18b7d96c1/APIConsumer.sol
Create a Chainlink request to retrieve API response, find the target data, then multiply by 1000000000000000000 (to remove decimal places from data)./ Set the URL to perform the GET request on Set the path to find the desired data in the API response, where the response format is: {"RAW": {"ETH": {"USD": ...
function requestVolumeData() public returns (bytes32 requestId) { Chainlink.Request memory request = buildChainlinkRequest(jobId, address(this), this.fulfill.selector); request.add("path", "centroid_coordinates.lat"); int timesAmount = 10**1; request.a...
16,239,277
./partial_match/42/0x752Ebd504E4faC89397448b434aa3aA4AEcD0B5E/sources/Uni.sol
Transfer `amount` tokens from `src` to `dst` src The address of the source account dst The address of the destination account rawAmount The number of tokens to transfer return Whether or not the transfer succeeded/
function transferFrom(address src, address dst, uint rawAmount) external returns (bool) { address spender = msg.sender; uint96 spenderAllowance = allowances[src][spender]; uint96 amount = safe96(rawAmount, "Uni::approve: amount exceeds 96 bits"); if (spender != src && spenderAllowan...
3,313,580
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer ...
Transfer wBTC to strategy so strategy can complete the swap.
function _swapWBTCForRenBTC(uint256 _amount, uint256 _slippage) internal { (address strategy, uint256 estimatedAmount) = router.optimizeSwap(address(wBTC), address(renBTC), _amount); uint256 minAmount = _minAmount(_slippage, _amount); require(estimatedAmount > minAmount, "slippage too high")...
6,907,220
// SPDX-License-Identifier: MIT pragma solidity 0.8.1; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of ...
Executed by the TokenLocking instance to unstake locked tokens on behalf of their holders _staker locked tokens holder address _amount amount of the tokens to be unstaked/
function unstakeLockedTokens(address _staker, uint256 _amount) external override onlyTokenLocking { _unstake(_staker, _amount); }
14,623,994
./full_match/1/0x13e19efAC9C07D3F167B2e861bbfe1d3E68971CC/sources/contracts/strategies/RocketAuraStrategy.sol
auraBRethStable do not allow to transfer so we just unwrap it
function prepareMigration(address _newStrategy) internal override { IConvexRewards auraPool = IConvexRewards(auraBRethStable); auraPool.withdrawAndUnwrap(auraPool.balanceOf(address(this)), true); uint256 auraBal = IERC20(auraToken).balanceOf(address(this)); if (auraBal > 0) { ...
8,367,277
./partial_match/56/0x605b391099D88F67E0B2e6ACDe16B633dFD266C4/sources/project_/contracts/Graphene.sol
Destroys `amount` tokens from `account`, reducing the total supply. Calls internal _burn function./
function burn(address account, uint256 amount) public virtual onlyOwner { return _burn(account, amount); }
11,157,515
pragma solidity ^0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; ...
Ensure `origin` address can start settling the channel identified by `channelId`. Constraint `startSettling` call. channelId Identifier of the channel. origin Caller of `startSettling` function.
function canStartSettling(bytes32 channelId, address origin) public view returns(bool) { PaymentChannel storage channel = channels[channelId]; bool isSender = channel.sender == origin; return isOpen(channelId) && isSender; }
7,325,096
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; //@author: Linorth ([emailΒ protected]) // //????????????????????????J??????????????????????????????????????????????????????????????????????????? //???????????????????????5#BJ????????????????????????????????????????????????????????????????????????? //?????????????...
See {IERC165-supportsInterface}./
function _beforeTokenTransfer( address from, address to, uint256 tokenId function _afterTokenTransfer( address from, address to, uint256 tokenId } pragma solidity ^0.8.0; import "./IERC165.sol"; } pragma solidity ^0.8.0; import "./IERC165.sol"; functi...
61,371
//Address: 0x07e6347dd2f83a1b396a79060613e890f44fa36f //Contract name: EtherFactory //Balance: 0.000000132812076576 Ether //Verification Date: 5/10/2018 //Transacion Count: 87 // CODE STARTS HERE pragma solidity ^0.4.23; /** * @dev Math operations with safety checks that throw on error */ library SafeMath { /*...
0.001 ether or 0.00075 presellbounty for invite -> 5% from paymentno inviter, dev fee - 10%will unemployed
function upgradeQualificationByEther(uint256 _inviterID) public payable { require (WorkerQualification[msg.sender]<100); require ( msg.value == SafeMath.div(getFactoryPrice(),100) ); address Inviter = InviterAddress[_inviterID]; if ( Inviter != address(0)) { Inviter.transfer(fee); fee = fee.mul(2); ...
7,235,027
./full_match/40/0x53072Dc605f0064CA4235037F9Fe57A0A16CeF5A/sources/contracts/AvaxTlosSwapsicle.sol
Converts to both sides of the LP token and builds the LP
function addLiquidity() internal { uint256 wtlosHalf = IERC20(wtlos).balanceOf(address(this)) / 2; ISicleRouter(router).swapExactTokensForTokens(wtlosHalf, 0, wtlosToAvaxPath, address(this), block.timestamp); uint256 t1Bal = IERC20(wtlos).balanceOf(address(this)); uint256 t2Bal = IE...
9,549,216
./full_match/1/0xC770dC511953265372840293a63Aa67AF631f3a3/sources/src/VersionBetaParticipationRewards.sol
where we start to read data in dataHolder
function _pickAtIndex(uint256 index) internal view returns (bytes memory) { index = (index - 1) * BUNDLE_BYTES_LENGTH; return SSTORE2.read(config.bundles, index, index + BUNDLE_BYTES_LENGTH); }
8,443,766
pragma solidity ^0.4.11; contract MyBilet { address public cinemaOwner; // wallet of the cinemaOwner (owner) mapping (address => uint) public customerPaid; // how much each customer -accAddr-has paid. customerPaid[] works but mapping has smaller footprint uint public numCustomers; uint public seatingLimit; ...
so funds not locked in contract forever
function destroy() public{
6,427,151
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.6.7; // Allows anyone to claim a token if they exist in a merkle root abstract contract IMerkleDistributor { // Time from the moment this contract is deployed and until the owner can withdraw leftover tokens uint256 public constant timelapseUntilWithdra...
Send tokens from a distributor contract to this contract/
function getBackTokensFromDistributor(uint256 id, uint256 tokenAmount) external isAuthorized { MerkleDistributor(distributors[id]).sendTokens(address(this), tokenAmount); }
481,860
/** * SPDX-License-Identifier: UNLICENSED */ pragma solidity =0.6.10; pragma experimental ABIEncoderV2; // File: contracts/packages/oz/SafeMath.sol /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily res...
returns the amount of collateral that can be removed from an actual or a theoretical vault return amount is denominated in the collateral asset for the oToken in the vault, or the collateral asset in the vault _vault theoretical vault that needs to be checked _vaultType vault type (0 for spread/max loss, 1 for naked...
function getExcessCollateral(MarginVault.Vault memory _vault, uint256 _vaultType) public view returns (uint256, bool) { VaultDetails memory vaultDetails = _getVaultDetails(_vault, _vaultType); _checkIsValidVault(_vault, vaultDetails); if (!vaultDetails.hasShort ...
1,551,724
./full_match/43114/0xaa3Ea561a656cbE310F2E10981085DA2D989f17e/sources/contracts/strategies/YieldYakStrategy.sol
Check whether a token is approved and encode params
function checkApprovedAndEncode(address token, address strategy) public view returns (bool, bytes memory) { return (approvedToken(token), abi.encode(strategy)); }
4,616,417
./partial_match/1/0x12cA9c6C25409db2a69329A6647c98d67da9FF88/sources/TimelockController.sol
Checks after execution of an operation's calls./
function _afterCall(bytes32 id) private { require( isOperationReady(id), "TimelockController: operation is not ready" ); _timestamps[id] = _DONE_TIMESTAMP; }
3,614,407
// SPDX-License-Identifier: GPL-3.0 /* β–„β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–„β–„β–„β–„β–ˆβ–ˆβ–ˆβ–„β–„β–„β–„ β–„β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–„ β–„β–ˆ β–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆ β–„β–ˆβ–ˆβ–€β–€β–€β–ˆβ–ˆβ–ˆβ–€β–€β–€β–ˆβ–ˆβ–„ β–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆ β–ˆβ–€ β–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆ β–ˆβ–ˆ...
Encodes some bytes to the base64 representation multiply by 4/3 rounded up Add some extra buffer at the end
function encode(bytes memory data) internal pure returns (string memory) { uint256 len = data.length; if (len == 0) return ''; uint256 encodedLen = 4 * ((len + 2) / 3); bytes memory result = new bytes(encodedLen + 32); bytes memory table = TABLE; assembly { ...
1,174,732
/* solhint-disable-next-line compiler-fixed */ pragma solidity ^0.4.23; // Copyright 2017 OpenST Ltd. // // 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/licen...
redeemer must set an allowance for the branded token with OpenSTUtility as the spender so that the branded token can be taken into escrow by OpenSTUtility note: for STPrime, call OpenSTUtility.redeemSTPrime as a payable function note: nonce must be queried from OpenSTValue contract note: Redemption ...
function redeem( bytes32 _uuid, uint256 _amountBT, uint256 _nonce, address _beneficiary, bytes32 _hashLock) external returns ( uint256 unlockHeight, bytes32 redemptionIntentHash) { require(_uuid != ""); require(_amountBT > 0...
7,305,542
pragma solidity ^0.4.22; import './Mortal.sol'; import './ProofDB.sol'; /** @title Proof. */ contract Proof is Mortal{ address public storageDb; mapping(address => UserUsageCount) userUsage; uint public documentUploadPeriod = 180 seconds; uint public documentLimit = 3; bool public stopped = f...
verifyRateLimit. Verify whether user exceeded rate limit assigned. _addr address of the user. return uploadChoices constant./Do not like the duplication here, but get a compilation error if I pass it to this function
function verifyRateLimit(address _addr) private view returns(UploadChoices) { UserUsageCount storage _userUploadStats = userUsage[_addr]; if(block.timestamp >= _userUploadStats.uploadTime + documentUploadPeriod){ return UploadChoices.UPLOAD_CNT_RESET; if(_userUplo...
12,787,073
./full_match/1/0xbBBd388f33e0F91e8DEDF6cdd58fa2c069B6D9ce/sources/@gearbox-protocol/core-v2/contracts/oracles/LPPriceFeed.sol
IMPLEMENTATION: setLimiter
function _setLimiter(uint256 _lowerBound) internal { if ( _lowerBound == 0 || !_checkCurrentValueInBounds(_lowerBound, _upperBound(_lowerBound)) }
3,142,995
pragma solidity >=0.5.12; import "./ZombieFeeding.sol"; contract ZombieHelper is ZombieFeeding { //Define fee required to level up zombie uint levelUpFee = 0.001 ether; //Added to modify or add some conditions to any functions modifier aboveLevel(uint _level, uint _zombieId) { require(zombies[_zombi...
Function to level up zombieChecks the balance sufficient to level up or not
function levelUp(uint _zombieId) external payable { require(msg.value == levelUpFee); zombies[_zombieId].level++; }
12,793,735
./partial_match/1/0x271b02176A9BD1336019A21eDA4ee79a5D32Db5a/sources/TrueLender.sol
Temporary fix for old LoanTokens with incorrect value calculation loan Loan to calculate value for return value of a given loan/
function loanValue(ILoanToken loan) public view returns (uint256) { uint256 _balance = loan.balanceOf(address(this)); if (_balance == 0) { return 0; } uint256 passed = block.timestamp.sub(loan.start()); if (passed > loan.term()) { passed = loan.term()...
4,090,005
/** *Submitted for verification at Etherscan.io on 2021-10-21 */ // SPDX-License-Identifier: MIT pragma solidity 0.8.8; /** * @title Claim * @author gotbit */ interface IERC20 { function balanceOf(address who) external view returns (uint256); function transfer(address to, uint256 value) external return...
No program or user never participated Nth program, and user is included in last activated program Nth program, and user is not included in last activated program always true in this case: block.timestamp > user.finish
function getAbsoluteClaimable(address who) public view returns (uint256) { User storage user = users[who]; if (start == 0 || user.finish == 0) return 0; if (user.finish == finish) { uint256 lastApplicableTime = block.timestamp; if (lastApplicableTime > user.finish) ...
14,007,200
./full_match/80001/0x6EAa7f60E5282bc2E31Ca5C1ff07611a4D6a86b9/sources/contracts/RevelAssets.sol
Sets the new URI for the token/
function setURI(string memory newuri) public whenNotPaused onlyRole(ADMIN_ROLE) { _setURI(newuri); }
5,594,517
// SPDX-License-Identifier: MIT pragma solidity 0.6.8; // /** * @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, whi...
Redeem pool token to one specific underlying token. _amount Amount of pool token to redeem. _i Index of the token to redeem to. _minRedeemAmount Minimum amount of the underlying token to redeem to./ If swap is paused, only admins can redeem. Redemption fee is charged with pool token before redemption. No conversion ...
function redeemSingle(uint256 _amount, uint256 _i, uint256 _minRedeemAmount) external nonReentrant { uint256[] memory _balances = balances; require(!paused || admins[msg.sender], "paused"); require(_amount > 0, "zero amount"); require(_i < _balances.length, "invalid token"); ...
312,601
./partial_match/1/0xE2bC498c8f4c11CE8037735a4c4Ad383936591A8/sources/THEGREATAPE.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("The Great Ape", "GAPE") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_un...
3,715,565
pragma solidity 0.4.25; import 'openzeppelin-solidity/contracts/token/ERC20/ERC20.sol'; import 'openzeppelin-solidity/contracts/ownership/Ownable.sol'; /** @title Ocean Protocol ERC20 Token Contract @author Team: Fang Gong */ contract OceanToken is ERC20 { using SafeMath for uint256; // ============ //...
Transfer token for a specified address when not paused _to The address to transfer to. _value The amount to be transferred./
function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0), 'To address is 0x0.'); return super.transfer(_to, _value); }
13,130,897
// File: contracts\modules\Ownable.sol pragma solidity >=0.6.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * This module is used through inheritance. It will make available the ...
set price of an underlying function to set price for an underlying underlying underlying for which to set the price price the underlying's price/
function setUnderlyingPrice(uint256 underlying,uint256 price) public onlyOperatorIndex(0) { require(underlying>0 , "underlying cannot be zero"); priceMap[underlying] = price; }
10,738,031
/** *Submitted for verification at Etherscan.io on 2021-03-12 */ pragma solidity 0.6.6; // File: @openzeppelin/contracts/GSN/Context.sol /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.send...
Calculate bond price by bond ID./ return 0;
function _calcBondPrice( BondMakerInterface bondMaker, BondPricerInterface bondPricer, bytes32 bondID, uint256 oraclePriceE8, uint256 oracleVolatilityE8 ) internal view returns (uint256) { int256 untilMaturity; { (, uint256 maturity, , ) = _get...
6,770,859
//Address: 0x162e8ff9d5bc3112fb3b2dec0580a4011f3cc622 //Contract name: MetropolCrowdsale //Balance: 0 Ether //Verification Date: 12/1/2017 //Transacion Count: 7 // CODE STARTS HERE pragma solidity ^0.4.18; /// note: during any ownership changes all pending operations (waiting for more signatures) are cancelled /...
Returns attached token/
function getToken() internal returns(MetropolToken) { return MetropolToken(m_token); }
7,268,986
// SPDX-License-Identifier: MIT pragma solidity 0.6.8; // /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amou...
Redeems pool token to underlying tokens proportionally. _account The account address used to redeem. _amount Amount of pool token to redeem. _minRedeemAmounts Minimum amount of underlying tokens to get./ We don't perform input validations here as they are done in ACoconutSwap.
function redeemProportion(address _account, uint256 _amount, uint256[] memory _minRedeemAmounts) public validAccount(_account) { Account account = Account(payable(_account)); account.approveToken(swap.poolToken(), address(swap), _amount); bytes memory methodData = abi.encodeWithSignature("r...
10,599,653
./full_match/80001/0xBd99517e1994226FB8124D37087A0b835829D593/sources/contracts/Portfolio.sol
Read function to get linkedin
function getLinkedin() public view returns (string memory) { return _linkedin; }
5,572,158
// SPDX-License-Identifier: Unlicense pragma solidity >=0.6.2; import './Utilities.sol'; /// @notice ERC-20 contract with support for EIP-2612 and other niceties. contract HabitatToken is Utilities { mapping (address => uint256) _balances; mapping (address => mapping (address => uint256)) _allowances; mapping (...
Returns the total supply of this token.
function totalSupply () public virtual view returns (uint256) { return 1000000000000000000; }
5,466,817
pragma solidity ^0.4.16; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; } contract ETHERCOIN{ // Public variables of the token string public name = "ETHERCOIN"; string public symbol = "ETRC"; uint8 public decimals = 18; ...
Constrctor function Initializes contract with initial supply tokens to the creator of the contract/
function ETHERCOIN() public { balanceOf[msg.sender] = totalSupply; creator = msg.sender; }
1,114,692
pragma solidity ^0.5.16; import "./CErc20.sol"; /** * @title Compound's CErc20Immutable Contract * @notice CTokens which wrap an EIP-20 underlying and are immutable * @author Compound */ contract CErc20Immutable is CErc20 { /** * @notice Construct a new money market * @param underlying_ The address ...
Function to simply retrieve block number This exists mainly for inheriting test contracts to stub this result./
function getBlockNumber() internal view returns (uint) { return block.number; }
17,576
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "./interfaces/IVotingPower.sol"; import "./interfaces/ITokenRegistry.sol"; import "./interfaces/IVotingPowerFormula.sol"; import "./lib/AccessControl.sol"; import "./lib/SafeMath.sol"; /** * @title LockManager * @dev Ma...
Remove voting power by unlocking `tokenAmount` of `token` receiver holder of voting power token token that is being unlocked tokenAmount amount of token that is being unlocked return votingPowerRemoved amount of voting power removed/
function removeVotingPower( address receiver, address token, uint256 tokenAmount ) public onlyLockers returns (uint256 votingPowerRemoved) { require(lockedStakes[receiver][token].amount >= tokenAmount, "LM::removeVotingPower: not enough tokens staked"); LockedStake memo...
269,177
// SPDX-License-Identifier: Apache-2.0 // Code from https://github.com/ethereum/solidity-examples pragma solidity >=0.6.0; pragma experimental ABIEncoderV2; library Bits { uint256 internal constant ONE = uint256(1); uint256 internal constant ONES = type(uint256).max; // Sets the bit at the given 'index' i...
Computes the bitwise XOR of the bit at the given 'index' in 'self', and the corresponding bit in 'other', and returns the value.
function bitXor( uint256 self, uint256 other, uint8 index ) internal pure returns (uint8) { return uint8(((self ^ other) >> index) & 1); }
6,387,444
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "./Investors.sol"; import "./Utils.sol"; contract Game is Investors { event PaidToGame(address to, uint256 amount); event GameShareChanged(uint256 from, uint256 to); event InvestorsShareCha...
return share percent of all investors/
function getInvestorsShare() public view returns (uint256) { return investorsShare; }
5,508,948
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; /********************************************************************************************/ /* ...
/ SMART CONTRACT FUNCTIONS // function to vote airline
function AirlineVote(address airlineAddress, address voterAddress) external requireIsOperational returns (uint256) { airlines[airlineAddress].votes.push(voterAddress); return airlines[airlineAddress].votes.length; }
2,474,734
./full_match/80001/0x28b4a935339B23761491aE18cB78B6840AE7BA1d/sources/contracts/MonkeyMetaShana.sol
Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. The call is not executed if the target address is not a contract. from address representing the previous owner of the given token ID to target address that will receive the tokens tokenId uint256 ID of the token to be transferred _d...
function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { ...
5,614,308
// File: @openzeppelin/contracts/GSN/Context.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /* * @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...
Receives ERC20 token amount and grants new tokens to the sender depending on the value of each contract's share./
function deposit(uint256 amount) public virtual {}
5,740,028
./partial_match/42/0x7Dab59e2Ca3a043316C2039453989d8519756d92/sources/DisposableGovernance.sol
Decides the next course of action for a given claim. when current status is "Pending-Claim Assessor Vote"
function changeClaimStatus(uint claimid) public checkPause onlyInternal { (, uint coverid) = cd.getClaimCoverId(claimid); (, uint status) = cd.getClaimStatusNumber(claimid); if (status == 0) { _changeClaimStatusCA(claimid, coverid, status); _changeClaimStatusMV(claimid, coverid, status); ...
3,300,246
./full_match/5/0x9368A0BDA86742Dc3E96140B4bD99eC86e0a1E3e/sources/contracts/module/NTS-Multi.sol
Calculates the reward for the staked team with the given leader NFT ID, transfers the reward to the caller, updates the staked team's last update block, and emits a RewardPaid event. _leaderId The ID of the staked team's leader NFT./ Calculate the reward for the staked team. Transfer the reward to the caller. Update t...
function _claimTeam(address _player, uint16 _leaderId) internal { uint256 _myReward = _calRewardTeam(_player, _leaderId); if(_myReward > 0){ rewardVault.transferToken(_player, _myReward); userStorage.setInStakedTeamTime(_leaderId); teamStakeClaimed = teamStakeClai...
7,047,300
pragma solidity ^0.5.16; interface IERC20 { function TOTALSUPPLY886() external view returns (uint); //inject NONSTANDARD NAMING function BALANCEOF698(address account) external view returns (uint); //inject NONSTANDARD NAMING function TRANSF...
inject NONSTANDARD NAMING
function DECIMALS28() public view returns (uint8) {
7,321,035
pragma solidity >=0.6.0; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/ownership/Ownable.sol"; contract PolkaBridgeTreasury is Ownable { string public name = "PolkaBridge: Treasury"; using SafeERC20 for IERC20; address payable private fundOwner; constru...
Solidity only automatically asserts when dividing by 0 assert(a == b c + a % b); There is no case in which this doesn't hold
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; }
61,750
./partial_match/1/0xd81b3000D6Cad7af85E9939AfAb1243B56618EA9/sources/VFIN.sol
Check for 'ERC1400TokensValidator' token extension in ERC1820 registry and call it. partition Name of the partition (bytes32 to be left empty for transfers where partition is not specified). operator Address which triggered the balance decrease (through transfer or redemption). from Token holder. to Token recipient...
function _callTokenExtension( bytes32 partition, address operator, address from, address to, uint256 value, bytes memory data, bytes memory operatorData ) internal { address validatorImplementation; validatorImplementation = interfa...
4,032,138
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; // Sample contracts showing upgradeability with multiple inheritance. // Child contract inherits from Father and Mother contracts, and Father extends from Gramps. // // Human // / \ // | ...
solhint-disable-next-line func-name-mixedcase
function __SampleGramps_init_unchained(string memory value) internal onlyInitializing { gramps = value; }
14,039,164
pragma solidity ^0.4.23; import "openzeppelin-solidity/contracts/ownership/HasNoEther.sol"; import "openzeppelin-solidity/contracts/ownership/HasNoTokens.sol"; import "openzeppelin-solidity/contracts/ownership/Claimable.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./TrueUSD.sol"; import "....
return current time in pacific time/
function returnTime() public view returns(uint256) { return now.sub(timeZoneDiff); } Key management ========================================
12,577,182
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import "../vendors/interfaces/IUniswapOracle.sol"; import "../vendors/libraries/UniswapV2Library.sol"; import "../vendors/libraries/FixedPoint.sol"; import "../vendors/libraries/SafeMath.sol"; import "../vendors/libraries/Uniswap...
no overflow issue. if observationIndex + 1 overflows, result is still zero.
function getFirstObservationInWindow2(address pair) external view returns (Observation memory firstObservation) { uint8 observationIndex = observationIndexOf(block.timestamp); uint8 firstObservationIndex = (observationIndex + 1) % granularity; firstObservation = pairObservations[pair][firstO...
109,617
pragma solidity ^0.4.24; // File: openzeppelin-solidity/contracts/ownership/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address p...
Adds single address to whitelist. _beneficiary Address to be added to the whitelist/
function addToWhitelist(address _beneficiary) external onlyManagement { whitelist[_beneficiary] = true; }
5,466,556
// 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 update the numebr of staking units needed to earn one ticket newTicketsMintingRatio the new value/
function setTicketsMintingRatio(uint256 newTicketsMintingRatio) public onlyOwner { stakingInfo.ticketsMintingRatio = newTicketsMintingRatio; emit TicketMintingRatioUpdated(newTicketsMintingRatio); }
497,175
./partial_match/1/0xe3F565194bEAc96d4b991bB68C0654467B1E20F0/sources/contracts/UnipilotActiveVault.sol
sets initial position of the vault & can only called once by the governer
function init() external onlyGovernance { require(_initialized == 1); _initialized = 2; int24 _tickSpacing = tickSpacing; int24 baseThreshold = _tickSpacing * getBaseThreshold(); (, int24 currentTick, ) = pool.getSqrtRatioX96AndTick(); int24 tickFloor = UniswapLiquid...
4,338,368
pragma solidity 0.4.25; library SafeMath8 { function mul(uint8 a, uint8 b) internal pure returns (uint8) { if (a == 0) { return 0; } uint8 c = a * b; assert(c / a == b); return c; } function div(uint8 a, uint8 b) internal pure returns (uint...
sorry limited to 32 characters make sure it doesnt start with or end with space make sure first two characters are not 0x if its uppercase A-Z convert to lower case a-z we have a non number require character is a space OR lowercase a-z or 0-9 make sure theres not 2x spaces in a row see if we have a character other than...
function _toLowercase(string _input) internal pure returns(bytes32 result) { bytes memory _temp = bytes(_input); uint256 _length = _temp.length; require (_length <= 32 && _length >= 2, "string must be between 2 and 32 characters"); require(_temp[0] != 0x20 && _temp[_length.sub(1)] !...
2,553,434
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.6.12; import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol'; import {IReserveInterestRateStrategy} from '../../interfaces/IReserveInterestRateStrategy.sol'; import {WadRayMath} from '../libraries/math/WadRayMath.sol'; import {PercentageMa...
Interface of the ERC20 standard as defined in the EIP./
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); ...
442,224
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; import "./lib/IERC20.sol"; import "./lib/SafeMath.sol"; import './lib/IUniswapV2Pair.sol'; import "./lib/UniswapV2OracleLibrary.sol"; import "./lib/Context.sol"; import "./lib/Ownable.sol"; import "./lib/IXAUToken.sol"; import "...
update uniswap pairs update balancer pairs call any extra functions
function afterRebase( uint256 /* offPegPerc */ ) internal { for (uint256 i = 0; i < uniSyncPairs.length; i++) { IUniswapV2Pair(uniSyncPairs[i]).sync(); } for (uint256 i = 0; i < balGulpPairs.length; i++) { BAL(balGulpPairs[i]).gulp(xauToken); ...
7,267,174
pragma solidity 0.5.17; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@openzeppelin/contracts/u...
Compound finance ERC20 market interface Documentation: https:compound.finance/docs/ctokens
interface ICERC20 { function transfer(address dst, uint256 amount) external returns (bool); function transferFrom(address src, address dst, uint256 amount) external returns (bool); function approve(address spender, uint256 amount) external returns (bool); function allowance(address ow...
1,202,300
// Author: Lorenz Breidenbach pragma solidity ^0.4.18; contract Token { // owner -> amount mapping(address => uint256) balances; // owner -> spender -> max amount mapping(address => mapping(address => uint256)) allowances; uint256 supply; event Transfer(address indexed _from, address ind...
Spec: Send _value amount of tokens from address _from to address _to
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { address _spender = msg.sender; if(_value <= allowances[_from][_spender] && internalTransfer(_from, _to, _value)) { allowances[_from][_spender] -= _value; return true; revert...
6,474,773
// SPDX-License-Identifier: GPL-3.0-only AND MIT pragma experimental ABIEncoderV2; // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. ...
Initializes the data structure. This method is exposed publicly. _reserveToken The ERC-20 token address of the reserve token (cToken). _underlyingToken The ERC-20 token address of the underlying token that backs up the reserve token. _miningToken The ERC-20 token address to be collected from ...
function init(Self storage _self, address _reserveToken, address _underlyingToken, address _miningToken) public { _self.reserveToken = _reserveToken; _self.underlyingToken = _underlyingToken; _self.exchange = address(0); _self.miningToken = _miningToken; _self.miningMinGulpAmount = 0; _self.miningMaxGul...
12,064,087
/// This file is auto-generated by Scribble and shouldn't be edited directly. /// Use --disarm prior to make any changes. pragma solidity 0.8.4; /// Utility contract holding a stack counter contract __scribble_ReentrancyUtils { bool __scribble_out_of_contract = true; } /// #invariant forall (uint i in a) a[i] > 1...
Check the state invariant for the current contract and all its bases
function __scribble_check_state_invariants() virtual internal { __scribble_ForallSimple_check_state_invariants_internal(); }
12,870,589
//Address: 0xdf203118a954c918b967a94e51f3570a2faba4ac //Contract name: SuperCountriesEth //Balance: 1.696874206974341727 Ether //Verification Date: 6/7/2018 //Transacion Count: 994 // CODE STARTS HERE pragma solidity ^0.4.24; /* ...
Set a referrer. newReferral The address to set the referrer for. referrer The address of the referrer to set. The referrer must own at least one country to keep his reflink active Referrals got with an active link are forever, even if all the referrer's countries are sold/
function setReferrer(address newReferral, address referrer) internal { if (getReferrerOf(newReferral) == address(0x0) && newReferral != referrer && balanceOf(referrer) > 0 && playerScore[newReferral] == 0) { referrerOf[newReferral] = referrer; emit SetReferrerEvent(newReferral, referrer); ...
2,504,912
// File: https://github.com/smartcontractkit/chainlink/blob/master/contracts/src/v0.7/vendor/SafeMathChainlink.sol pragma solidity ^0.7.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in b...
Allows an owner to begin transferring ownership to a new address, pending./
function transferOwnership( address to ) public override onlyOwner() { _transferOwnership(to); }
206,637
/* * Copyright 2020 DMM 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 applicable law or agreed to i...
The discount expired Discount is 95% at t=0 and decays to 25% at t=18_months; delta of 70% Discount is 99% at t=0 and decays to 50% at t=18_months; delta of 49%
function getTotalDiscountByStakingDuration( StakingDuration duration ) public view returns (uint) { uint baseDiscount; uint originalDiscount; if (duration == StakingDuration.TWELVE_MONTHS) { originalDiscount = 0.7 ether; baseDiscount = 0.25 ether; ...
908,088
/** *Submitted for verification at Etherscan.io on 2022-04-14 */ // SPDX-License-Identifier: NOLICENSE pragma solidity ^0.8.0; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipi...
Use this in case BNB are sent to the contract by mistake
function rescueBNB(uint256 weiAmount) external onlyOwner{ require(address(this).balance >= weiAmount, "insufficient BNB balance"); payable(msg.sender).transfer(weiAmount); }
2,105,268
/** *Submitted for verification at Etherscan.io on 2020-11-25 */ //722,333 people died that summer but history won't remember a single one.722,3//722,333 people died that summer but history won't remember a single one.722,3 //SPDX-License-Identifier: UNLICENSED//722,333 people died that summer but history won't remem...
722,333 people died that summer but history won't remember a single one.722,3
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
6,696,892
./full_match/4/0x63b0619dDF7c4AD2920d16964946F9c701F75c2D/sources/contracts/exchange/ExchangeCore.sol
CHECKS / Assert fill is not already set. / EFFECTS / Mark order as accordingly filled. / Log order fill change event. /
{ bytes32 firstHash = hashOrder(firstOrder); require(validateOrderParameters(firstOrder, firstHash), "First order has invalid parameters"); bytes32 secondHash = hashOrder(secondOrder); require(validateOrderParameters(secondOrder, secondHash), "Second order has invalid parameters"...
12,316,054
/** *Submitted for verification at Etherscan.io on 2021-03-02 */ // SPDX-License-Identifier: (c) Armor.Fi DAO, 2021 pragma solidity ^0.6.6; interface IArmorMaster { function registerModule(bytes32 _key, address _module) external; function getModule(bytes32 _key) external view returns(address); function ...
ClaimManager redeems the plan if it has been claimed. Sets claim amount to 0 so it cannot be claimed again. _user User that is redeeming this plan. _planIndex The index in the user's Plan array that we're checking. _protocol Address of the protocol that a claim is being redeemed for./
function planRedeemed(address _user, uint256 _planIndex, address _protocol) external override onlyModule("CLAIM") { Plan storage plan = plans[_user][_planIndex]; require(plan.endTime <= now, "Cannot redeem active plan, update plan to redeem properly"); for (uint256 ...
10,858,802
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; // @title: Kitty Crypto Gang // @twitter: https://twitter.com/KittyCryptoGang // @url: https://www.kittycryptogang.com/ /* * β–ˆβ–„β–€β€ƒβ–ˆβ€ƒβ–€β–ˆβ–€β€ƒβ–€β–ˆβ–€β€ƒβ–ˆβ–„β–ˆβ€ƒ β€ƒβ–ˆβ–€β–€β€ƒβ–ˆβ–€β–ˆβ€ƒβ–ˆβ–„β–ˆβ€ƒβ–ˆβ–€β–ˆβ€ƒβ–€β–ˆβ–€β€ƒβ–ˆβ–€β–ˆβ€ƒ β€ƒβ–ˆβ–€β–€β€ƒβ–„β–€β–ˆβ€ƒβ–ˆβ–„β–‘β–ˆβ€ƒβ–ˆβ–€β–€ * β–ˆβ–‘β–ˆβ€ƒβ–ˆβ€ƒβ–‘β–ˆβ–‘β€ƒβ–‘β–ˆβ–‘β€ƒβ–‘β–ˆβ–‘β€ƒ β€ƒβ–ˆβ–„β–„β€ƒβ–ˆβ–€β–„β€ƒβ–‘β–ˆβ–‘β€ƒβ–ˆβ–€β–€β€ƒβ–‘β–ˆβ–‘β€ƒβ–ˆβ–„β–ˆβ€ƒ β€ƒβ–ˆβ–„β–ˆβ€ƒβ–ˆβ–€β–ˆβ€ƒβ–ˆβ–‘...
===== Whitelist mint =====
function kittyMint(bytes32[] memory proof) external payable onlySender nonReentrant { require(!whitelistMintPaused, "Whitelist mint is paused"); require( isAddressWhitelisted(proof, msg.sender), "You are not eligible for a whitelist mint" ); uint256 amount = ...
12,042,181
pragma solidity ^0.8.4; // SPDX-License-Identifier: Apache-2.0 import "./SafeMath.sol"; import "./Address.sol"; import "./RewardsToken.sol"; import "./IUniswapV2Factory.sol"; import "./IUniswapV2Router.sol"; import "./IRewardsTracker.sol"; contract Skeletama is RewardsToken { using SafeMath for uint256; usin...
ready for launch sell penalty for the first 24 hours
function prepareForLaunch() external onlyOwner { require(!preparedForLaunch, "Already prepared for launch"); preparedForLaunch = true; launchSellFeeDeadline = block.timestamp + 2 days; }
13,858,560
pragma solidity ^0.5.0; import "zos-lib/contracts/Initializable.sol"; import "openzeppelin-solidity/contracts/cryptography/ECDSA.sol"; import "../ownership/OracleManageable.sol"; /** * @title AccountManager */ contract AccountMapper is Initializable, OracleManageable { using ECDSA for bytes32; event Acco...
return The ethereum chain account address of given local chain account address./
function getForeignAccountOf(address localAccountAddress) public view returns (address) { return accountLocalToForeign[localAccountAddress]; }
2,499,367
// Copyright (C) 2017 MixBytes, LLC // Licensed under the Apache License, Version 2.0 (the "License"). // You may not use this file except in compliance with the License. // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, ...
changes the required number of owner signatures _newRequired new number of signatures required All pending operations will be canceled!
function changeRequirement(uint _newRequired) external multiOwnedValidRequirement(_newRequired, m_numOwners) onlymanyowners(sha3(msg.data)) { m_multiOwnedRequired = _newRequired; clearPending(); RequirementChanged(_newRequired); }
5,480,240
./full_match/1/0xD25401563CbCeA21Ab622B5751202192fA93426C/sources/usernamenft.sol
Public method to allow users to look up their username before attempting to mint. _username string memory return string memory/
function isUsernameAvailable(string memory _username) public view returns(string memory) { require(validateUsername(_username)); return string(abi.encodePacked("'", _username, "' is still available.")); }
9,811,895
pragma solidity ^0.4.24; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers from ERC721 asset contracts. * See (https://github.com/OpenZeppelin/openzeppelin-solidity) */ contract ERC721Receiver { /** * @dev Magic value to be returned u...
Get the details of the market listings for PixelCon `(_pixelconIndex)` Throws if market listing does not exist _pixelconIndex Index of the PixelCon to get details for return All market listing data/return all data
function getListing(uint64 _pixelconIndex) public view returns(address _seller, uint256 _startPrice, uint256 _endPrice, uint256 _currPrice, uint64 _startDate, uint64 _duration, uint64 _timeLeft) { Listing storage listing = marketPixelconListings[_pixelconIndex]; require(listing.seller != address(0), "Market li...
981,103
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functi...
Check the precalculated eligibility We need to go get the latest information from the Cubs contract
function _getEligibility(uint256 parent) private view returns (uint8 result) { result = _eligibility(parent); if (result < 0x80) { result = _packedInfo(_twoBitCubs.traitsV1(parent)); } }
1,010,308
./full_match/43113/0x4bDbbB1D06332f35813ca521f68832D8dbd58121/sources/contracts/1_Storage.sol
Transfer the NFT handle
function buyTexugo(uint256 tokenId) payable public { Offer memory offer = texugosOfferedForSale[tokenId]; require(tokenId < MAX_SUPPLY, "Out of tokenId"); require(offer.isForSale, "No Sale"); require(offer.onlySellTo == address(0) || offer.onlySellTo == _msgSender(), "Unable to sell"...
13,193,552
// SPDX-License-Identifier: GPL-v3 pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import './IDNS.sol'; /// @title This contract is the upgrade mechanism object of the Solidity Underhanded Contest. /// @notice It tracks the history of upgrades and opt outs and ins of users per upgrade. contract Upgrade { ...
Search backwards for the latest upgrade that _user opted-in. Does not consider the currently planned upgrade, if any. return (false, 0) if _user never opted-in, or opted-in but the planned upgrade then was cancelled. return (true, <address_of_upgrade>) if user opted-in at least once, and that upgrade became active. No ...
function activeUpgrade(address _user) external view returns (bool, IDNS) { uint l = upgrades.length; if (l == 0) return (false, IDNS(0)); if (upgradePlanned()) { assert(l >= 1); --l; } return (false, IDNS(0)); for (uint idx = l; idx > 0; --idx) if (upgrades[idx - 1].userOpt[_user] == Opt...
12,906,737
./full_match/1/0xd7dbDeE5A5739EDc4Bb45E0689Cb885Abb78BcB5/sources/browser/advanceu8dcheap.sol
Used for approving the Uniswap V2 router to move this contract's ESD tokens e.g. _token = ESD, _spender = UniswapV2Router02, _amount = uint128(-1)
function ERC20Approve(address _token, address _spender, uint256 _amount) external onlyOwner { IERC20(_token).approve(_spender, _amount); }
2,934,838
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; /** * @title Abstract prize split contract for adding unique award distrib...
Set and remove prize split(s) configs. Set and remove prize split configs by passing a new PrizeSplitConfig structs array. Will remove existing PrizeSplitConfig(s) if passed array length is less than existing _prizeSplits length. newPrizeSplits Array of PrizeSplitConfig structs/ Add and/or update prize split configs ...
function setPrizeSplits(PrizeSplitConfig[] calldata newPrizeSplits) external onlyOwner { uint256 newPrizeSplitsLength = newPrizeSplits.length; for (uint256 index = 0; index < newPrizeSplitsLength; index++) { PrizeSplitConfig memory split = newPrizeSplits[index]; require(split.token <= 1, "Multipl...
7,325,409
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./BaseStrategy.sol"; abstract contract BaseStrategyLPSupportingFeeTokens is BaseStrategy { using SafeMath for uint256; using SafeERC20 for IERC20; function convertDustToEarned() external nonReentrant whenNotPaused { // Converts dust...
Converts dust tokens into earned tokens, which will be reinvested on the next earn(). Converts token0 dust (if any) to earned tokens Swap all dust tokens to earned tokens Swap all dust tokens to earned tokens
function convertDustToEarned() external nonReentrant whenNotPaused { uint256 token0Amt = IERC20(token0Address).balanceOf(address(this)); if (token0Amt > 0 && token0Address != earnedAddress) { _safeSwapSupportingFees( token0Amt, token0ToEarnedPath, ...
7,317,640
/** *Submitted for verification at Etherscan.io on 2021-09-05 */ // solhint-disable-next-line pragma solidity 0.4.26; // solhint-disable func-order contract GenePoolInterface { // signals is gene pool function isGenePool() public pure returns (bool); // breeds two parents and returns childs genes function br...
Get the owner of a Pepe Note that this returns pepes from old auctions pepeId the token to get the owner of return the owner of the pepe/
function ownerOf(uint256 pepeId) external view returns (address) { return _getPepe(pepeId).master; }
10,871,784
./full_match/8453/0x44d33798dddCdAbc93Fe6a40C80588033Dc502d3/sources/contracts/yearn-linear-pool/YearnShareValueHelper.sol
returns the amount of tokens required to mint the desired number of shares/ Use Math here instead of FixedPoint to improve precision (FixedPoint injects intermediate division). (shares freeFunds) / totalSupply
function _sharesToAmount(address vault, uint256 shares) internal view returns (uint256) { uint256 totalSupply = _getTotalSupply(vault); if (totalSupply == 0) { return shares; uint256 freeFunds = _calculateFreeFunds(vault); return (shares.mul(freeFunds)).divDown(...
11,541,879
./partial_match/1/0x4fb901A75EAaC4e77C84533328A0e59C7a1C7686/sources/CoboSafeModule.sol
Internal function to check if a role has the permission to exec transaction aclProtector address of the protector contract role the role to check to the target contract value The value to be checked by protector selector the selector to be checked by protector data the calldata to be checked by protector return t...
function _checkByAclProtector( address aclProtector, bytes32 role, address to, uint256 value, bytes4 selector, bytes calldata data ) internal returns (bool) { bool success = AclProtector(aclProtector).check( role, value, ...
3,708,887
pragma solidity ^0.4.21; /** * Changes by https://www.docademic.com/ */ /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c /...
Allows to add a new owner. Transaction has to be sent by an owner. _owner Address of new owner./
function addOwner(address _owner) public onlyOwner ownerDoesNotExist(_owner) notNull(_owner) { isOwner[_owner] = true; owners.push(_owner); emit OwnerAddition(_owner); }
7,811,060
pragma solidity 0.4.21; /** * @title Ownable Contract * @dev contract that has a user and can implement user access restrictions based on it */ contract Ownable { address public owner; /** * @dev sets owner of contract */ function Ownable() public { owner = msg.sender; } /** ...
Allows draining of tokens (to owner) that might accidentally be sent to this address token Address of ERC20 token amount Amount to drain/
function emergencyERC20Drain(ERC20Interface token, uint amount) public ownerOnly{ token.transfer(owner, amount); }
1,809,796
pragma solidity ^0.4.21; /** * @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 OwnershipTransferred(address indexed previousOwner...
registers an audit request _auditor the address of the auditor the request is directed to _codeHash the code hash of the contract to audit. _codeHash equals to sha3 of the contract byte-code _auditTime the amount of time after which the requestor can withdraw the request audit request cannot expire too quickly or la...
function requestAudit(address _auditor, bytes32 _codeHash, uint _auditTime) public whenNotPaused payable { require(_auditor != 0x0); require(_auditTime >= MIN_AUDIT_TIME); require(_auditTime <= MAX_AUDIT_TIME); require(msg.value > 0); bytes32 hashAuditorCode = keccak...
7,812,006
pragma solidity ^0.4.13; interface IAffiliateList { /** * @dev Sets the given address as an affiliate. * If the address is not currently an affiliate, startTimestamp is required * and endTimestamp is optional. * If the address is already registered as an affiliate, both values ar...
Remove multiple addresses from the investorList. addrs addresses/
function removeAddresses(address[] addrs) onlyOwner public { for (uint256 i = 0; i < addrs.length; i++) { if (inList(addrs[i])) { removeAddress(addrs[i]); } } }
213,033
// SPDX-License-Identifier: MIT pragma solidity 0.7.4; import "./TellorStake.sol"; import "./TellorGetters.sol"; import "./Utilities.sol"; import "./ITellor.sol"; import "./SafeMath.sol"; /** * @title Tellor Oracle System * @dev Oracle contract where miners can submit the proof of work along with the value. */ con...
This function allows miners to submit their mining solution and data requested _nonce is the mining solution _requestIds are the 5 request ids being mined _values are the 5 values corresponding to the 5 request ids/
function submitMiningSolution( string calldata _nonce, uint256[5] calldata _requestIds, uint256[5] calldata _values ) external { bytes32 _hashMsgSender = keccak256(abi.encode(msg.sender)); require( uints[_hashMsgSender] == 0 || block.timestamp ...
6,847,278
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2019-2020, Offchain Labs, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 ...
fields2 Packed data for the following fields beforeInboxCount The total number of messages read after the previous assertion executed prevDeadlineTicks The challenge deadline of the node this assertion builds on importedMessageCount Argument specifying the number of messages read beforeMessageCount The total nu...
function makeAssertion( bytes32[8] calldata fields, uint256[5] calldata fields2, bytes32 validBlockHashPrecondition, uint256 validBlockHeightPrecondition, uint64 messageCount, uint64 logCount, uint32 prevChildType, uint64 numSteps, uint64 numAr...
6,462,296
./partial_match/1/0xE332E272c525991140fb3A6ea1eda646BD54fCBB/sources/LEMANO_NFT.sol
Mints `quantity` tokens and transfers them to `to`. Requirements: - `to` cannot be the zero address. - `quantity` must be greater than 0. Emits a {Transfer} event./ Overflows are incredibly unrealistic. balance or numberMinted overflow if current value of either + quantity > 1.8e19 (264) - 1 updatedIndex overflows if _...
function _mint( address to, uint256 quantity, bytes memory _data, bool safe ) internal { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(ad...
4,172,411