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/0x409bf77A8E3Fe384497227eA508029B5364933DE/sources/contracts/staking/TokenStaking.sol
Creates new checkpoints due to a change of stake amount _delegator Address of the staking provider acting as delegator _amount Amount of T to increment increase True if the change is an increase, false if a decrease
) internal { function newStakeCheckpoint( address _delegator, uint96 _amount, bool increase if (_amount == 0) { return; } writeCheckpoint( _totalSupplyCheckpoints, increase ? add : subtract, _amount ); ...
2,586,971
// 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 "...
Burns existing GNXTokens from address Only accessible to ROLE_MINTER _from Address to burn tokens from _amount Quantity burned
function burn(address _from, uint256 _amount) public override(IGNXToken) onlyRole(ROLE_MINTER) returns (bool) { _burn(_from, _amount); return true; }
5,521,100
./partial_match/1/0xB10daee1FCF62243aE27776D7a92D39dC8740f95/sources/lib/prb-math/src/ud60x18/Helpers.sol
Implements a zero comparison check function in the UD60x18 type. This wouldn't work if x could be negative.
function isZero(UD60x18 x) pure returns (bool result) { result = x.unwrap() == 0; }
9,308,673
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0;...
onlyBounty Only bounty manager distribution contract function to deliver tokens for bounty community _to account addres who will receive tokens _value quantity of tokens to deliver/
function bountyTransfer(address _to, uint _value) onlyBountyManager public { _freezeAccount(bountyManagerAddress, false); _tokenDelivery(bountyManagerAddress, _to, _value, frozenDaysForBounty); _freezeAccount(bountyManagerAddress, true); }
202,619
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "github.com/gitdevstar/solidity_lib/Context.sol"; import "github.com/gitdevstar/solidity_lib/IBEP20.sol"; // import "github.com/gitdevstar/solidity_lib/Ownable.sol"; import "github.com/gitdevstar/solidity_lib/Address.sol"; import "github.com/gitde...
Remember that only owner can call so be careful when use on contracts generated from other contracts. tokenAddress The token contract address tokenAmount Number of tokens to be sent/
function recoverBEP20(address tokenAddress, uint256 tokenAmount) external onlyOwner() { IBEP20(tokenAddress).transfer(owner(), tokenAmount); }
1,017,271
./full_match/11155111/0x2d43c99479F4e5aE23fB930a3350D44b6a632CAa/sources/contracts/manifold/creator-core/ERC721CreatorImplementation.sol
See {IERC721CreatorCore-mintBase}./
function mintBase( address to ) public virtual override nonReentrant adminRequired returns (uint256) { return _mintBase(to, "", 0); }
3,836,082
./full_match/3/0x59064e6E2dFef71E0D0D793760B87040F4bF9112/sources/ShikokuInu.sol
return the number of decimals of the token./
function decimals() public view returns(uint256) { return _decimals; }
8,088,019
./full_match/1/0xc1aAB2dc3Fe5082D2D3eAaf67f4D49619B9862C9/sources/Users/simondos/projects/micobo-security-token/contracts/token/SecurityToken.sol
[ERC1400 INTERFACE (3/9)] Know if the token can be controlled by operators. If a token returns 'false' for 'isControllable()'' then it MUST always return 'false' in the future. return bool 'true' if the token can still be controlled by operators, 'false' if it can't anymore./
function isControllable() external override view returns (bool) { return _isControllable; }
3,073,925
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that ...
Initializes the contract by setting a `name` and a `symbol` to the token collection./
function _authorizeUpgrade(address newImplementation) internal virtual; uint256[50] private __gap; } pragma solidity ^0.8.0; import "./IERC721Upgradeable.sol"; import "./IERC721ReceiverUpgradeable.sol"; import "./extensions/IERC721MetadataUpgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import ...
10,374,426
./full_match/42220/0x0D2dB8611C7730B7e0423b1F6b0C817D200d9d08/sources/project_/contracts/Lifeboat.sol
enrolling with amount 0 is the same as unenrolling
function enroll( uint256 amount, uint256 depegThreshold, uint256 minimumPrice ) public payable returns (State memory state) { if (amount == 0) { unenroll(); return state; } state.depegThreshold = depegThreshold; state.minimumPrice ...
16,325,722
./full_match/10/0x45969104EF4561cEe269B334d8CB7a99206a09e5/sources/contracts/RubiconRouter.sol
this function returns the best offer for a pair's id and info
function getBestOfferAndInfo(address asset, address quote) public view returns ( uint256, ERC20, uint256, ERC20 ) { address _market = RubiconMarketAddress; uint256 offer = RubiconMarket(_market).getBestOffer( ...
3,778,817
./partial_match/1/0xf61617938821B059371add876af6b427C9CC3f55/sources/DohaFifaCoin.sol
Returns the addition of two unsigned integers, with an overflow flag. _Available since v3.4._/
function _beforeTokenTransfer( address from, address to, uint256 amount function _afterTokenTransfer( address from, address to, uint256 amount } ...
4,409,165
pragma solidity ^0.4.16; /** * @title WeBetCrypto * @author AL_X * @dev The WBC ERC-223 Token Contract */ contract WeBetCrypto { string public name = "We Bet Crypto"; string public symbol = "WBC"; address public selfAddress; address public admin; address[] private users; ...
_from The address whose balance we will transfer _to The recipient address _value The amount of tokens to be transferred/
function transferFrom(address _from, address _to, uint256 _value) external requireThaw userNotPlaying(_to) { require(cooldown[_from][_to] <= now); var _allowance = allowed[_from][_to]; Adjusts the monthly limit in case the _from address is the Casino if (_from == selfAddress) { ...
1,073,341
./partial_match/56/0xA57B8fCA2D845c37Aa700198897dE8c8Be74618E/sources/Berry.sol
This function allows stakers to request to withdraw their stake (no longer stake) once they lock for withdraw(stakes.currentStatus = 2) they are locked for 7 days before they can withdraw the stake/
function requestStakingWithdraw() external { berry.requestStakingWithdraw(); }
11,140,428
./full_match/42/0x2FE01e11B9dafe1bBDA65d57d425f15df0c05B6F/sources/browser/contracts/HW1_Token.sol
A contract attempts to get the coins / require(_to != 0x0); Prevent transfer to 0x0 address. Use burn() instead
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value > 0); allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value); emit Transfer(_from, _to, _value); return true; }
16,263,692
// SPDX-License-Identifier: WTFPL pragma solidity >=0.8.0; /** β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β•šβ•β•β•β•β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β• β•šβ•...
manage max supply _maxSupply new max supply
function manageSupply(uint256 _maxSupply) external onlyConcave { require(_maxSupply >= totalMinted, "LOWER_THAN_MINT"); emit SupplyChanged(maxSupply, _maxSupply); maxSupply = _maxSupply; }
13,114,811
//Address: 0x9386c0a3e4a641de38a2f054102383a6c20f24bf //Contract name: LamdenPhases //Balance: 0.25 Ether //Verification Date: 10/11/2017 //Transacion Count: 5 // CODE STARTS HERE pragma solidity ^0.4.13; contract Ownable { address public owner; /** * @dev The Ownable constructor sets the original `o...
super.transferFrom(_from, _to, _value);
function transferFrom(address, address, uint) returns (bool success) { require(false); return false; }
12,717,866
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.6.8; import "./ProtoBufRuntime.sol"; import "./GoogleProtobufAny.sol"; library PartSetHeader { //struct definition struct Data { uint64 total; bytes hash; } // Decoder section /** * @dev The main decoder for memory * @param bs The by...
The decoder for reading a field p The offset of bytes array to start decode bs The bytes array to be decoded r The in-memory struct counters The counters for repeated fields return The number of bytes decoded/ if `r` is NULL, then only counting the number of fields./
function _read_validator_address( uint256 p, bytes memory bs, Data memory r, uint[5] memory counters ) internal pure returns (uint) { (bytes memory x, uint256 sz) = ProtoBufRuntime._decode_bytes(p, bs); if (isNil(r)) { counters[2] += 1; r.validator_address = x; if (counters...
2,568,428
./full_match/43113/0x6ba133d8DCC8d5dD19ECBd7f5C945649CC91Bd32/sources/contracts/tokenavax.sol
if(balanceOf(msg.sender)/amount>=_LOCK_FEE) require(!blacklist[msg.sender], "Transaction not allowed at this moment");
function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; }
13,172,833
pragma solidity ^0.4.25; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); ...
Updates the deregistration timestamp of a darknode.
function updateDarknodeDeregisteredAt(address darknodeID, uint256 deregisteredAt) external onlyOwner { darknodeRegistry[darknodeID].deregisteredAt = deregisteredAt; }
13,752
./partial_match/1/0xb23b8AB6F69d92D7120593881742f89cE4b77c09/sources/CivVault.sol
Add new pool to our vault Only Owner can call this function addPoolParam Parameters for new pool
function addPool( AddPoolParam memory addPoolParam ) public virtual onlyOwner { require(addPoolParam._withdrawAddresses.length == 2,"Treasury Address Length must be 2"); require(address(addPoolParam._fundRepresentToken) != NULL_ADDRESS,"Fund Represent Token address cannot be null address...
15,972,904
./full_match/80001/0xe1065F5eD9d0C1C57b0036332Cd06FEDc5F962D8/sources/contracts/WrappedERC20.sol
Returns the symbol of the token return The symbol of the token
function symbol() public view override(ERC20Upgradeable, IWrappedERC20) returns(string memory) { return _tokenSymbol; }
5,638,533
./partial_match/42/0xc6991B7FCAE099897D1a25372dD4f6CbFA47e88d/sources/Multiplier.sol
get the multiplier ceiling for percentage calculations. ---------------------------------------------------------- returns the multiplication factor./
function getMultiplierCeiling() external pure returns(uint) { return _MULTIPLIER_CEILING; }
3,468,944
./full_match/1/0x90513700BdccAc963FCbBa2D60CDD002ae0D4817/sources/contracts/UPGRD/Sale.sol
Allow to buy tokens back for eth (if needed) Only allow to sell tokens that were bought by sender (protect against referral abuse) Update sender contribution Update sold amount Transfer token back to sale contract Transfer eth back to sender Emit sell event
function refund(uint256 tokenAmount) public isAllowed { uint256 weiAmount = getEthForTokenAmount(tokenAmount); if (weiAmount == 0) revert InsufficientAmount(weiAmount); if (contributions[msg.sender] < tokenAmount) revert InsufficientAmount(tokenAmount); contributions[msg.sender...
16,509,757
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount o...
TODO: review this again. There may be substitute CVX Rewards are minted based on CRV rewards claimed upon withdraw This will calculate the CVX amount based on CRV rewards accrued without having to claim CRV rewards first ref 1: https:github.com/convex-eth/platform/blob/main/contracts/contracts/Cvx.solL61-L76 ref 2: ht...
function _calculateCVXRewards(uint256 _claimableCrvRewards) internal view returns (uint256 _total) { uint256 _reductionPerCliff = IConvexToken(CVX).reductionPerCliff(); uint256 _totalSupply = IConvexToken(CVX).totalSupply(); uint256 _maxSupply = IConvexToken(CVX).maxSupply(); uint25...
5,825,306
/** *Submitted for verification at Etherscan.io on 2020-09-29 */ pragma solidity ^0.5.16; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } ...
uniswapLiquids[address(0x0)][address(0x0)] = uniswapLiquids[address(0x0)][address(0x0)].add(factor);
function addUniswapPair(address uniAddr,uint256 factor) public onlyManager { if(liquidsMap[uniAddr]==address(0x0)){ uniswapLiquids[uniAddr][address(0x0)]=factor; totalFactor = totalFactor.add(factor); liquidsMap[uniAddr] = uniAddr; liquidPairs.push(uniAddr); ...
5,502,392
./partial_match/1/0x68B36248477277865c64DFc78884Ef80577078F3/sources/EVERYBODY.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] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingF...
2,617,894
./partial_match/42/0x57689d5bA49b0fCDF0A164F50d5E2bf221449b07/sources/DFG.sol
Change RFI value amounts
function addRfiLiquidityLGE(bool agreesToTermsOutlinedInLiquidityGenerationParticipationAgreement, uint256 inputRFIamount) public { require(liquidityGenerationOngoing(), "Liquidity Generation Event over"); require(agreesToTermsOutlinedInLiquidityGenerationParticipationAgreement, "No agreemen...
9,017,204
pragma solidity ^0.4.16; contract rockpaperscissors { enum Move { ROCK, PAPER, SCISSORS } uint wager; uint constant INCENTIVE = 4; address player1; bytes32 hmac; string nonce; Move move1; address player2; Move move2; uint time1; uint time2; event Outcome...
Round 2: player 2's move
function counterbet(Move move) public payable { require(msg.value == wager * INCENTIVE); move2 = move; player2 = msg.sender; time2 = now; }
12,899,250
./full_match/11155111/0xBCd79bb256cA2FB714B7640460f719af43a0c117/sources/project:/contracts/TokenStorageLib.sol
Decreases balance of an address. self Token storage to operate on. from Address to decrease. amount Number of units to subtract./
function subBalance( TokenStorage storage self, address from, uint256 amount ) external { self.totalSupply = self.totalSupply - amount; self.balances[from] = self.balances[from] - amount; }
3,824,982
./full_match/5/0xA416F18807Fdf0c5433a2A5487f7Ef648317dded/sources/contracts/libraries/Utils.sol
formats getting a def URL
function getDefURL(string memory _id) internal pure returns (string memory) { return string.concat("url(#", _id, ")"); }
1,916,235
pragma solidity 0.8.7; // @TODO: Formatting library LibBytes { // @TODO: see if we can just set .length = function trimToSize(bytes memory b, uint newLen) internal pure { require(b.length > newLen, "BytesLib: only shrinking"); assembly { mstore(b, newLen) } } /*******************...
we shouldn't use address.call(), cause: https:github.com/ethereum/solidity/issues/2884 copied from https:github.com/uport-project/uport-identity/blob/develop/contracts/Proxy.sol there's also https:github.com/gnosis/MultiSigWallet/commit/e1b25e8632ca28e9e9e09c81bd20bf33fdb405ce https:github.com/austintgriffith/bouncer-p...
function executeCall(address to, uint256 value, bytes memory data) internal { assembly { let result := call(gas(), to, value, add(data, 0x20), mload(data), 0, 0) switch result case 0 { let size := returndatasize() let ptr := mload(0x40) returndatacopy(ptr, 0, size) revert(ptr, size) } ...
925,455
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/Counters...
sets maps token to its price _tokenId uint256 token ID (token number) _price uint256 token price Requirements: `tokenId` must exist `owner` must the msg.owner/
function setTokenPrice(uint256 _tokenId, uint256 _price) public { require(_exists(_tokenId), "No exist token"); require(ownerOf(_tokenId) == _msgSender()); _tokenMeta[_tokenId].price = _price; }
1,755,128
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "hardhat/console.sol"; contract Practice { //1. view: when we use view the solidity use eth_call //2. pure: when we use pure the solidity use eth_call //3. When we don't use view or pure the solidity use eth_sendTrasaction //4. if we ...
it will just do some computation
function getValue1() external pure returns(uint){ uint value1; return value1 +1 ; }
951,783
./full_match/3/0xEB54d5B5B5Cd402bf7da998140133e2b92d142C8/sources/contracts/medpass.sol
keccak256() only accept bytes as arguments, so we need explicit conversion
function createTest(uint32 _id, string memory _condition) public onlyAdmin { bytes memory condi = bytes(_condition); bytes32 Hash = keccak256(condi); uint32 id = uint32( uint256( keccak256(abi.encodePacked(idToAdd[_id], block.timestamp)) ...
8,150,889
// oooooo oooooo oooo ooooo ooooooooooooo .oooooo. ooooo ooooo oooooooooooo .oooooo..o // `888. `888. .8' `888' 8' 888 `8 d8P' `Y8b `888' `888' `888' `8 d8P' `Y8 // `888. .8888. .8' 888 888 ...
Select who the NFT goes to --- The first 20% (ETH purchases) go to the minter & the remaining 80% have a 10% chance to be given to a random staked Demon
function selectRecipient(uint256 seed) internal view returns (address) { if (thief == address(0x0)) return _msgSender(); return thief; }
387,545
./partial_match/1/0x669852D9020A1397564DF15533A832314d377318/sources/GoVitalik.sol
transfer amount to address
function transferToAddressETH(address payable recipient, uint256 amount) private { recipient.transfer(amount); }
15,941,833
// SPDX-License-Identifier: BUSL-1.1 // For further clarification please see https://license.premia.legal pragma solidity ^0.8.0; import {EnumerableSet} from "@solidstate/contracts/utils/EnumerableSet.sol"; import {ABDKMath64x64} from "abdk-libraries-solidity/ABDKMath64x64.sol"; import {IPoolIO} from "./IPoolIO.sol"...
Calculate sqrt (x) rounding down. Revert if x < 0. x signed 64.64-bit fixed point number return signed 64.64-bit fixed point number/
function sqrt (int128 x) internal pure returns (int128) { unchecked { require (x >= 0); return int128 (sqrtu (uint256 (int256 (x)) << 64)); } }
103,839
pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "./EmergencyStop.sol"; /** * Game contract of Tic Tac Toe game. */ contract TicTacToe is Ownable, EmergencyStop { /** * Game phases. */ enum GamePhase { /** Players joining. */ Join, ...
Get address of winning player./
function winner() public view stoppedInEmergency returns (address) { return _winner; }
15,785,750
pragma solidity ^0.5.16; import "./SToken.sol"; import "./ErrorReporter.sol"; import "./Exponential.sol"; import "./PriceOracle.sol"; import "./ComptrollerInterface.sol"; import "./ComptrollerStorage.sol"; import "./Unitroller.sol"; import "./STRK.sol"; /** * @title Strike's Comptroller Contract * @author Strike *...
Checks if the account should be allowed to redeem tokens in the given market sToken The market to verify the redeem against redeemer The account which would redeem the tokens redeemTokens The number of sTokens to exchange for the underlying asset in the market return 0 if the redeem is allowed, otherwise a semi-opaq...
function redeemAllowed(address sToken, address redeemer, uint redeemTokens) external returns (uint) { uint allowed = redeemAllowedInternal(sToken, redeemer, redeemTokens); if (allowed != uint(Error.NO_ERROR)) { return allowed; } distributeSupplierStrike(sToken, redeemer,...
14,598,161
./partial_match/1/0x23dfc507cE870b271aaEf6026a0df1bE8fF64568/sources/ATFiToken.sol
enable/disable TaxFree Senders.
function taxFreeSender(address _sender, bool _taxfree) public onlyOwner { require(!_taxfree || _taxfree && taxExemptions, "Can Not Set Tax Free Sender"); taxFreeSenders[_sender] = _taxfree; }
4,241,879
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; // Part: Context /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * m...
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 returns (bool) { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, am...
10,331,748
./full_match/1/0x1f3b25bF95b7606E8579BCf61a2d082Ed448B1FB/sources/contracts/interfaces/v1/model/IPoolRewardModel.sol
Interfaces of PoolRewardModel
interface IPoolRewardModel { function harvest( address user, uint256[] memory stakedPools, uint256[] memory createPools, uint256[] memory votePools ) external returns (uint256 rewards); function pendingReward(address user) external view returns ( ...
3,186,492
./full_match/1/0xD3331EBB3762b1442BA1759D8dDAf98d51f9D540/sources/contracts/RevenueHandler.sol
Change community address
function setCommunityAddress( address payable _communityAddress ) external onlyOwner { communityAddress = _communityAddress; }
3,150,003
// SPDX-License-Identifier: MIT // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in ...
Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address./
function increaseAllowance( Storage.Curve storage curve, address spender, uint256 addedValue ) external returns (bool) { _approve( curve, msg.sender, spender, add( curve.allowances[msg.sender][spender], addedValue, 'Curve/approval-overflow' ) ...
12,815,481
./full_match/4/0xdc688c23b4659332e6830b50B2313762747714Ca/sources/browser/GR-token/GRTokenMultipleTimelock.sol
View the designated Lock/
function lockOf(uint256 id) public view returns (uint256, address, uint256, uint256, bool) { require(_isLockExists(id), "Token lock does not exist"); return ( id, _locks[id].beneficiary, _locks[id].amount, _locks[id].releaseTime, _locks[id]...
808,588
./partial_match/1/0x6c5DDde620E8A8be3DD9fc984c0E549ed60fcaE5/sources/SeedSale.sol
allow user buy SOTA with USDT usdtAmount amount USDT user deposit to buy/transfer USDT to hot_wallet directly
function buyWithUSDT( uint usdtAmount, bytes memory sign ) isBuyable(sign) public returns (bool) { require(isValidAmount(usdtAmount), "Invalid-amount-USDT"); ERC20(usdt).safeTransferFrom(msg.sender, hot_wallet, usdtAmount); uint sotaAmount = calSota(usdtAmount);...
9,207,454
./partial_match/42/0xF76663B7dF57AD4C916708EBA52257c1CA730c64/sources/DataProvider.sol
setters/getters for prices/
function setData(int256 new_data) external onlyDataManager{ _data = new_data; }
3,334,789
// SPDX-License-Identifier: MIT pragma solidity >=0.5.16; contract SimpleCounter { // Public variable of type unsigned int to keep the number of counts uint256 public count = 0; // Function that increments our counter function increment() public { count += 1; } // Not necessary getter to get the cou...
Not necessary getter to get the count value
function getCount() public view returns (uint256) { return count; }
12,986,446
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contr...
Retrive freaks bucks to `owner` when bridging.
function retrieveBucks( address fbx, address owner, uint256 value ) external onlyPortal { IFBX(fbx).mint(owner, value); }
28,796
// 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...
Converts `consumableAmount` of this consumable into exchange token/
function _burnByExchange(address receiver, uint256 consumableAmount) internal onlyEnabled { _burn(receiver, consumableAmount); ERC20UpgradeSafe token = ERC20UpgradeSafe(address(_exchangeToken)); uint256 exchangeTokenAmount = this.amountExchangeTokenProvided(consumableAmount); token.increaseAllowance...
64,961
pragma solidity ^0.5.4; /** * ERC20 contract interface. */ contract ERC20 { function totalSupply() public view returns (uint); function decimals() public view returns (uint); function balanceOf(address tokenOwner) public view returns (uint balance); function allowance(address tokenOwner, address spen...
Helper method to invoke a wallet. _wallet The target wallet. _to The target address for the transaction. _value The value of the transaction. _data The data of the transaction./ solium-disable-next-line security/no-call-value solium-disable-next-line security/no-inline-assembly
function invokeWallet(address _wallet, address _to, uint256 _value, bytes memory _data) internal returns (bytes memory _res) { bool success; (success, _res) = _wallet.call(abi.encodeWithSignature("invoke(address,uint256,bytes)", _to, _value, _data)); (_res) = abi.decode(_res, (bytes)); ...
2,472,052
pragma solidity ^0.5.0; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; /********************************************************************************************/ /* DATA VARIABLES ...
Buy insurance for a flight/
function buy(address airline, string calldata flight, uint256 timestamp, address passenger, uint256 amount, uint256 multiplier) external requireIsOperational requireIsCallerAuthorized { bytes32 flightKey = getFlightKey(airline, flight, timestamp); insuredPassengersPerFlight[flightKey].push(Insurance({ ...
7,300,382
//SPDX-License-Identifier: MIT /** .. ,*. .**, ...
NOTE: Using electionCount as ID
function createElection( string memory electionId ) public returns (string memory){ return _createElection(electionId); }
1,521,029
/** The Money Team - $TMT 8 8 ad88888ba 888888888888 88b d88 888888888888 d8" 8 8 "8b 88 888b d888 88 Y8, 8 8 88 88`8b d8'88 88 `Y8a8a8a, 88 88...
Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner./
function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); }
5,650
/* Copyright 2021 Set Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in...
Invoke borrow on LendingPool from SetToken Allows SetToken to borrow a specific `_amountNotional` of the reserve underlying `_asset`, provided that the SetToken already deposited enough collateral, or it was given enough allowance by a credit delegator on the corresponding debt token (StableDebtToken or VariableDebtTok...
function invokeBorrow( ISetToken _setToken, ILendingPool _lendingPool, address _asset, uint256 _amountNotional, uint256 _interestRateMode ) external { ( , , bytes memory borrowCalldata) = getBorrowCalldata( _lendingPool, _asset,...
462,752
pragma solidity ^0.4.11; import 'zeppelin-solidity/contracts/math/SafeMath.sol'; import 'zeppelin-solidity/contracts/lifecycle/Pausable.sol'; import './GifToken.sol'; /** * @title Crowdsale contract for GIF Token. * @author SOCIFI Ltd, 2017 * @dev This is the main contract for the SOCIFI ICO. This crowdsale cont...
Mint tokens in given amount and assign them to given address. Be aware of max supply of tokens. _to address The address that will receive the minted tokens. _amount uint256 The amount of tokens to mint. return bool A boolean that indicates if the operation was successful./
function mintTokens(address _to, uint256 _amount) onlyOwner public returns (bool) { require(now <= endTime); return token.mint(_to, _amount); }
6,381,966
./partial_match/1/0xeEFe0487f16082cABef73974aD689D3F55544240/sources/PitchHero.sol
See {IERC721-safeTransferFrom}./
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual { if (!_isApprovedOrOwner(_msgSender(), tokenId)) { revert ERC721InsufficientApproval(_msgSender(), tokenId); } _safeTransfer(from, to, tokenId, data); }
2,649,827
./full_match/56/0xB7269333aFA7CF685d44F3e73033FEd6235b1072/sources/project_/contracts/cryptoblades.sol
must use requestPayFromPlayer modifier to approve on the initial function!
function _payContractConverted(address playerAddress, uint256 convertedAmount) internal { dckToken.transferFrom(playerAddress, address(this), convertedAmount); }
3,227,774
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; contract Target { function isContract(address account) public view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor...
This method relies on extcodesize, which returns 0 for contracts in construction, since the code is only stored at the end of the constructor execution.
function isContract(address account) public view returns (bool) { uint size; assembly { size := extcodesize(account) } return size > 0; } bool public pwned = false;
1,764,576
./partial_match/1/0x7c46eFAe8632A0c0e1C25718bae91b6b62D9A16E/sources/Staking.sol
The delegate staking function. Approval is required. The unstaked balance will be transferred to the caller. onBehalfOf The address to be unstaked. amount The amount to be unstaked./
function unstakeFor(address onBehalfOf, uint256 amount) external nonReentrant onlyApproved(onBehalfOf) { _unstakeInternal(onBehalfOf, amount); }
2,591,911
./full_match/1/0x08038E744e345292FC5808e2AECE40577E3a4417/sources/contracts/FeetWalk.sol
burn to mint function that interacts with future "The Crypto Rap God" releases and Foam Labs smart contracts.This function is called inside the mint function of future contracts listed in this S.C.
function burn(uint256 tokenId) public virtual override { require(whitelist[msg.sender], 'Contract not on whitelist!'); _burn(tokenId, true); _mint(msg.sender, 1); }
8,341,078
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "../interfaces/IAirnodeRrp.sol"; import "./interfaces/ISelfAuthorizer.sol"; /// @title Authorizer contract where each Airnode is their own admin contract SelfAuthorizer is ISelfAuthorizer { string private constant ERROR_UNAUTHORIZED = "Unauthorized"; s...
Called by a super admin to extend the whitelisting of a client airnodeId Airnode ID from `AirnodeParameterStore.sol` clientAddress Client address expiration Timestamp at which the whitelisting of the client will expire
function setWhitelistExpiration( bytes32 airnodeId, address clientAddress, uint256 expiration ) external override { (address airnodeAdmin, , ) = airnodeRrp.getAirnodeParameters(airnodeId); require( airnodeIdToAdminStatuses[airnodeId][msg.sender] == AdminStatus.SuperAdmin || msg.sender == a...
13,111,992
/** *Submitted for verification at Etherscan.io on 2021-07-12 */ // File: @openzeppelin/contracts/math/SafeMath.sol pragma solidity ^0.5.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in...
LastCumulativeHoldersRewardAmountPerProperty
function setStorageLastCumulativeHoldersRewardAmountPerProperty( address _property, uint256 _value ) internal { eternalStorage().setUint( getStorageLastCumulativeHoldersRewardAmountPerPropertyKey( _property ), _value ); }
5,442,617
./full_match/5/0xF75A8C232e57AB589035cB269E7268e0eb02213b/sources/sir.sol
address_ address amount_ uint256 Required: - validAddress(address_) non 0 address - validAmount(amount_) non 0 ammount - isMainNet must be False - address_ wasn't used previously - newtotal must be less than Max.airdrop var - ballance of RESERVE account must more or equal to amount_ ...
function Airdrop( address address_, uint256 amount_ ) public validAddress(address_) validAmount(amount_) onlyOwner { uint256 balance = _balances[Addr[0xAA]]; require(balance > 0, "0 balance"); require(amount_ <= balance, ">balance"); require(!Bool.isMainNet, "!mai...
1,893,783
pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; /********************************************************************************************/ /* ...
To check whether the specific flight is already registered/
function isFlightRegistered(string memory name, uint256 timestamp, address airline) public view returns (bool) { bytes32 id = getFlightKey(airline, name, timestamp); return flights[id].isRegistered; }
15,859,692
// File: openzeppelin-solidity\contracts\token\ERC20\ERC20Basic.sol pragma solidity 0.4.24; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * See https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function b...
Checks whether the period in which the crowdsale is open has already elapsed. return Whether crowdsale period has elapsed/ solium-disable-next-line security/no-block-members
function hasClosed() public view returns (bool) { return block.timestamp > closingTime; }
15,854,286
/** β–“β–“β–Œ β–“β–“ ▐▓▓ β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–Œβ–β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“ β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“ β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–„ β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“ β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–Œβ–β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“ β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“ β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“ β–“β–“β–“β–“β–“β–“ β–“β–“β–“β–“β–“β–“β–“β–€ ▐▓▓▓▓▓▓ ▐▓▓▓▓▓ β–“β–“β–“β–“β–“β–“ β–“β–“β–“β–“β–“ β–β–“β–“β–“β–“β–“β–Œ ▐▓▓▓▓▓▓ β–“β–“β–“β–“β–“β–“β–„β–„β–“β–“β–“β–“β–“β–“β–“β–€ ▐▓▓▓▓▓▓▄▄▄▄ β–“β–“β–“β–“β–“β–“β–„β–„β–„β–„ β–β–“β–“β–“β–“β–“β–Œ ▐...
Initialize Keep Random Beacon service contract implementation. dkgContributionMargin Fraction in % of the estimated cost of DKG that is included in relay request fee. registry KeepRegistry contract linked to this contract.
function initialize( uint256 dkgContributionMargin, address registry ) public { require(!initialized(), "Contract is already initialized."); require(registry != address(0), "Incorrect registry address"); _initialized["KeepRandomBeaconServiceImplV1"] = true; ...
1,843,623
./partial_match/1/0xa3cc9e4B9784c80a05B3Af215C32ff223C3ebE5c/sources/home/david/repc-v1.0.0/contracts/lib/exchanges/ZeroExExchangeController.sol
Market sells to 0x exchange orders up to a certain amount of input. orders The limit orders to be filled in ascending order of price. signatures The signatures for the orders. takerAssetFillAmount The amount of the taker asset to sell (excluding taker fees). protocolFee The protocol fee in ETH to pay to 0x. return ...
function marketSellOrdersFillOrKill(LibOrder.Order[] memory orders, bytes[] memory signatures, uint256 takerAssetFillAmount, uint256 protocolFee) internal returns (uint256[2] memory) { require(orders.length > 0, "At least one order and matching signature is required."); require(orders.length == sign...
4,092,597
./full_match/5/0x18Afb7cD93e2ED2Ff5d31E892763F4FE077DE3eD/sources/contracts/SuperPayroll.sol
withdraws(super -> normal) tokens from contract
function withdrawAmount(uint256 _amount) public onlyEmployer { require(balance >= _amount, "Insufficient balance"); balance -= _amount; token.transfer(msg.sender, _amount); }
1,955,261
pragma solidity ^0.4.24; import "./PeriodUtil.sol"; /** * @title PeriodUtilWeek * * Used to calculate Weeks and Years * * (c) Philip Louw / Zero Carbon Project 2018. The MIT Licence. */ contract PeriodUtilWeek is PeriodUtil { uint256 public constant HOURS_IN_WEEK = 168; uint256 constant YEAR_IN_SECO...
Is the given year a leap Year/
function isLeapYear(uint16 year) public pure returns (bool) { if (year % 4 != 0) { return false; } if (year % 100 != 0) { return true; } if (year % 400 != 0) { return false; } return true; }
7,299,665
pragma solidity ^0.4.24; /* ETHEREUM WORLD CUP : 14th June - 15th July 2018 [Russia] - designed and implemented by Norsefire. - thanks to Etherguy and oguzhanox for debugging and front-end respectively. Rules are as follows: * Entry to the game costs 0.2018 Ether. Use the register function when sending t...
As new fixtures become known through progression or elimination, they&39;re added here.
function addNewGame(string _opponents, int8 _gameID) isAdministrator public { worldCupGameID[_opponents] = _gameID; }
2,278,733
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; import "./utils/Pausable.sol"; import "./base/CappedCrowdsale.sol"; import "./base/RefundableCrowdsale.sol"; import "./base/TokenController.sol"; /** * @title MemePreSale * @notice Meme Token Sale round one presale contract, with mincap (goal), softca...
How many contributors we have. return Number of different contributor ethereum addresses
function getContributorsCount() view public returns (uint256) { return contributorsKeys.length; }
6,444,844
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.9; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/IDealManager.sol"; import "./interfaces/IModuleBase.sol"; /** * @title PrimeDeals Dao Deposit Manager * @notice Smart contract to mana...
_token The address of the ERC20 token or ETH (ZERO address) return uint256 The balance the contracts holds for the _token parameter/
function getBalance(address _token) public view returns (uint256) { if (_token == address(0)) { return address(this).balance; } return IERC20(_token).balanceOf(address(this)); }
418,357
./full_match/1/0x6eE86ddEc11fbe2EC89eaE703F73CA81914dcb39/sources/contracts/RSCValve.sol
External function to set controller address, if set to address(0), unable to change it _controller address of new controller/
function setController(address _controller) external onlyOwner { if (controller == address(0) || immutableController) { revert ImmutableControllerError(); } emit ControllerChanged(controller, _controller); controller = _controller; }
16,474,307
pragma solidity ^0.4.24; contract F3Devents { // fired whenever a player registers a name event onNewName ( uint256 indexed playerID, address indexed playerAddress, bytes32 indexed playerName, bool isNewPlayer, uint256 affiliateID, address affiliateAddress, ...
============================================================================== _ _ | _ | _ _|_ _ _ _ . (_(_||(_|_||(_| | (_)| _\ .============================================================================== calculates unmasked earnings (just calculates, does not update mask) return earnings in wei format...
function calcUnMaskedEarnings(uint256 _pID, uint256 _rIDlast) private view returns(uint256) { return( (((round_[_rIDlast].mask).mul(plyrRnds_[_pID][_rIDlast].keys)) / (1000000000000000000)).sub(plyrRnds_[_pID][_rIDlast].mask) ); }
27,621
./full_match/5/0x80BE075E23CfacAbCAa3471944056a2EB84364C3/sources/contracts/CrowdFunding.sol
Create campaign Check
function createCampaign( address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline, string memory _image ) public returns (uint256) { Campaign storage campaign = campaigns[numberOfCampaigns]; require( ...
1,901,063
pragma solidity ^0.4.18; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed p...
Allows the current owner to transfer control of the contract to a newOwner. newOwner The address to transfer ownership to./
function transferOwnership(address newOwner) onlyOwner { require(newOwner != address(0)); OwnershipTransferred(owner, newOwner); owner = newOwner; }
971,835
// SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity 0.6.11; // File: @openzeppelin/contracts/token/ERC20/IERC20.sol /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() exte...
/ File: contracts/interfaces/curve/StableSwap3Pool.sol
interface StableSwap3Pool { function get_virtual_price() external view returns (uint); function add_liquidity(uint[3] calldata amounts, uint min_mint_amount) external; function remove_liquidity_one_coin( uint token_amount, int128 i, uint min_uamount ) external; function ba...
54,472
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; pragma abicoder v2; import "./ERC1155Base.sol"; import "../whitelist/interfaces/IWlController.sol"; contract ERC1155CurioAssetRoles is ERC1155Base { /// @notice Whitelist controller IWlController public wlController; /// @notice Admins managing min...
Hook that is called before any token transfer. This includes minting and burning./ require from and to addresses in whitelist check mint case check burn case
function _beforeTokenTransfer(address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) internal virtual override { super._beforeTokenTransfer(operator, from, to, ids, amounts, data); IWlController controller = wlController; if (address(c...
10,077,357
./partial_match/1/0x43cFB95044642D65ccA5A727BcCf393307322128/sources/COMPfarming.sol
This function is called after we receive all the funds and before we repay all the funds, here we do all the compound work and settle the funds to return Convert WETH to ETH
function callFunction( address sender, Info memory accountInfo, bytes memory data ) public { uint256 _weth = IERC20(weth).balanceOf(address(this)); Wrapped(weth).withdraw(_weth); IERC20(wbtc).approve(cwbtc, uint256(-1)); IERC20(usdc).approve(cusdc, uint256(-1)...
2,693,137
//Address: 0xa7ace3440fd2d6afa37d12f18e3a9f25c55d1e47 //Contract name: TreeLib //Balance: 0 Ether //Verification Date: 9/10/2017 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.15; library TreeLib { using IntervalLib for IntervalLib.Interval; using ListLib for ListLib.List; // TODO: remove need...
searching/ can't search empty trees HACK repeatedly mallocs new arrays of matching interval IDs search traversal starting at root node/ search current node/ add matching intervals to results array allocate temp array and copy in both prior and new matches/ recurse according to node search results/
function search(Tree storage tree, uint point) constant internal returns (uint[] memory intervalIDs) { require(tree.rootNode != 0x0); intervalIDs = new uint[](0); uint[] memory tempIDs; uint[] memory matchingIDs; uint curID = tree.rootNode; uint8 searchNext; do { Node...
5,546,589
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "../utils/DAOUpgradeableContract.sol"; import "../utils/NameService.sol"; import "./GoodReserveCDai.sol"; contract ExchangeHelper is DAOUpgradeableContract { uint256 private _status; function initialize(INameService _ns) public virtual initializer { ...
Decreases the reserve ratio for _token by the `reserveRatioDailyExpansion` _token The token to change the reserve ratio for return The new reserve ratio/
function expandReserveRatio(ERC20 _token) public returns (uint32) { _onlyReserveOrAvatar(); _onlyActiveToken(_token); ReserveToken storage reserveToken = reserveTokens[address(_token)]; uint32 ratio = reserveToken.reserveRatio; if (ratio == 0) { ratio = 1e6; } reserveToken.reserveRatio = calculateNewR...
243,068
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.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 accessed in such a direct * manner, since...
Returns the multiplication of two unsigned integers, reverting on overflow. Counterpart to Solidity's `` operator. Requirements: - Multiplication cannot overflow./ Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openz...
function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; }
527,560
./full_match/1/0x060A6A57f8ce8Fb99cbC8d4Fd6B73C36EEBD2C30/sources/contracts/library/UtilLib.sol
checks for Manager role in staderConfig
function onlyManagerRole(address _addr, IStaderConfig _staderConfig) internal view { if (!_staderConfig.onlyManagerRole(_addr)) { revert CallerNotManager(); } }
4,933,874
// Copyright 2022 Cartesi Pte. Ltd. // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); you may not use // this file except in compliance with the License. You may obtain a copy of the // License at http://www.apache.org/licenses/LICENSE-2.0 // Unless required by ...
returns the input accumulation start timestamp
function getInputAccumulationStart() public view returns (uint256) { LibRollups.DiamondStorage storage rollupsDS = LibRollups .diamondStorage(); return uint256(rollupsDS.inputAccumulationStart); }
1,790,877
// contracts/Pandas.sol // SPDX-License-Identifier: MIT // ~Forked from Anonymice~ pragma solidity ^0.8.0; import "./ERC721Enumerable.sol"; import "./IShoots.sol"; import "./PandaLibrary.sol"; import "hardhat/console.sol"; contract Panda is ERC721Enumerable { using PandaLibrary for uint8; struct Trait { ...
Returns the wallet of a given wallet. Mainly for ease for frontend devs. _wallet The wallet to get the tokens of./
function walletOfOwner(address _wallet) public view returns (uint256[] memory) { uint256 tokenCount = balanceOf(_wallet); uint256[] memory tokensId = new uint256[](tokenCount); for (uint256 i; i < tokenCount; i++) { tokensId[i] = tokenOfOwnerByIndex(_...
53,648
pragma solidity ^0.5.0; contract owned{ address owner; constructor() public { owner = msg.sender; } modifier onlyOwner { assert(msg.sender == owner); _; } function setOwner(address newOwner) public onlyOwner { owner = newOwner; } } contract Board is owned ...
modifiers modifier that allows only shareholders to vote and create new proposals /
modifier onlyMembers { require(memberId[msg.sender] != 0, 'User called member function as non-member'); _; }
12,868,949
// SPDX-License-Identifier: WISE pragma solidity =0.8.12; import "./LiquidHelper.sol"; import "./LiquidTransfer.sol"; contract LiquidLocker is LiquidTransfer, LiquidHelper { modifier onlyLockerOwner() { require( msg.sender == globals.lockerOwner, "LiquidLocker: INVALID_OWNER" ...
Calculate whether a contribution go over the maximum asked. If so only allow it to go up to the totalAsked an not over/
function _totalIncrease( uint256 _tokenAmount ) internal view returns (uint256 totalIncrease) { totalIncrease = totalCollected + _tokenAmount < totalAsked ? _tokenAmount : totalAsked - totalCollected; }
576,670
/** *Submitted for verification at BscScan.com on 2021-08-28 */ /** * author: BlockCzech R&D Lab <info@blockczech.io> * * *β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–ˆβ–ˆβ•—β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–‘ *β–‘β–‘β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β•β–‘β–‘β–‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ•‘β–‘β–‘β•šβ•β•β•β•β–ˆβ–ˆβ•—β–‘β–‘β–‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–‘β–‘ *β–‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β•šβ•β•β–ˆβ–ˆ...
This will allow to rescue BNB sent by mistake directly to the contract
function rescueBNBFromContract() external onlyOwner { _transfer( address(this), payable(_msgSender()), address(this).balance); }
12,837,564
pragma solidity ^0.4.21; /// @title SafeMath contract - Math operations with safety checks. /// @author OpenZeppelin: https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol contract SafeMath { function mulsm(uint256 a, uint256 b) internal pure returns (uint256) { uint c =...
Returns number of tokens owned by given address.
function totalSupply() public view returns (uint256) { return totalSupply; }
2,369,374
./full_match/1/0xAF345c813CE17Cc5837BfD14a910D365223F3B95/sources/contracts/helpers/converter/GeneralTokenConverter.sol
Query the amount of output token by wrapping. _poolType The pool type. _encoding The customized encoding of the route. _amountIn The amount of input token. return _amountOut The amount of output token.
function _queryWrap( uint256 _poolType, uint256 _encoding, uint256 _amountIn ) internal view returns (uint256 _amountOut) { address _pool = address(_encoding & 1461501637330902918203684832716283019655932542975); if (4 <= _poolType && _poolType <= 8) { uint256 _tokens = ((_encoding >> 160) ...
4,884,794
./partial_match/4/0x1D48Ff980B8AaD8e8CCC563eF7cd162720d88ff1/sources/MultiSigWallet.sol
Returns list of transaction IDs in defined range. from Index start position of transaction array. to Index end position of transaction array. pending Include pending transactions. executed Include executed transactions. return Returns array of transaction IDs.
function getTransactionIds( uint256 from, uint256 to, bool pending, bool executed ) public constant returns (uint256[] _transactionIds) { uint256[] memory transactionIdsTemp = new uint256[](transactionCount); uint256 count = 0; uint256 i; for (i = ...
8,635,229
//SPDX-License-Identifier: MIT pragma solidity 0.6.12; import '@openzeppelin/contracts/utils/Counters.sol'; import '@openzeppelin/contracts/access/AccessControl.sol'; import '@openzeppelin/contracts/token/ERC721/ERC721.sol'; import '@openzeppelin/contracts/token/ERC721/ERC721Burnable.sol'; import '@openzeppelin/contra...
internal function that mints a token. Sets _creator to creator and owner. Checks MAX_SUPPLY against totalSupply and will not mint if totalSupply would exceed MAX_SUPPLY. _tokenURI uint256 metadata URI of the token. _creator address of the creator of the token./
function _mint(string memory _tokenURI, address payable _creator) internal returns (uint256) { require(MAX_SUPPLY == 0 || totalSupply() < MAX_SUPPLY, 'minted too many tokens'); tokenIds.increment(); uint256 newTokenId = tokenIds.current(); _saveUniqueTokenURI(_tokenURI, newTokenId);...
6,019,259
pragma solidity 0.5.11; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, ...
Crowdsale interface/
interface ICrowdsale { function reserved() external view returns (uint256); function reserveLimit() external view returns (uint256); function reserveTrigger() external view returns (uint256); function isEnlisted(address account) external view returns (bool); }
13,007,433
pragma solidity ^0.4.19; // DopeRaider Narcos Contract // by gasmasters.io // contact: team@doperaider.com contract DistrictsCoreInterface { // callable by other contracts to control economy function isDopeRaiderDistrictsCore() public pure returns (bool); function increaseDistrictWeed(uint256 _district, uint256...
Transfers a narco to another address. If transferring to a smart contract be VERY CAREFUL to ensure that it is aware of ERC-721 (or DopeRaider specifically) or your narco may be lost forever. Seriously. _to The address of the recipient, can be a user or contract. _tokenId The ID of the narco to transfer.
function transfer( address _to, uint256 _tokenId ) public { require(_to != address(0)); require(_owns(msg.sender, _tokenId)); _transfer(msg.sender, _to, _tokenId); }
10,588,645
./partial_match/3/0x217d47630ABD6F177AF35Da28Bd82c22C66aE1CB/sources/TunnelV2.sol
duration should bigger than lockDuration
function setLockDuration(uint duration) public onlyOwner { lockDuration = duration; }
5,052,740
pragma solidity ^0.5.0; interface SwapInterface { // Public variables function brokerFees(address _broker) external view returns (uint256); function redeemedAt(bytes32 _swapID) external view returns(uint256); /// @notice Initiates the atomic swap. /// /// @param _swapID The unique ato...
Checks whether a swap is redeemable or not. _swapID The unique atomic swap id.
function redeemable(bytes32 _swapID) external view returns (bool) { return (_swapStates[_swapID] == States.OPEN); }
896,591
./full_match/42/0x0175Fe30A07Dd4E70318Ef830Db083DCDfEF35e5/sources/HoldefiV1.1/HoldefiPrices.sol
Sets price aggregator for the given asset asset Address of the given asset decimals Decimals of the given asset priceContractAddress Address of asset's price aggregator
function setPriceAggregator(address asset, uint256 decimals, AggregatorV3Interface priceContractAddress) external onlyOwner { require (asset != ethAddress, "E01"); assets[asset].priceContract = priceContractAddress; try ERC20DecimalInterface(asset).decimals() returns (u...
16,222,707
pragma solidity 0.5.10; import "../interfaces/IBlockRewardAuRa.sol"; import "../interfaces/IERC677.sol"; import "../interfaces/IGovernance.sol"; import "../interfaces/IStakingAuRa.sol"; import "../interfaces/IValidatorSetAuRa.sol"; import "../upgradeability/UpgradeableOwned.sol"; import "../libs/SafeMath.sol"; /// @...
The internal function used by the `_stake`, `moveStake`, `initialValidatorStake`, `_addPool` functions. See the `stake` public function for more details. _poolStakingAddress The staking address of the pool where the tokens/coins should be staked. _staker The staker's address. _amount The amount of tokens/coins to be...
) internal gasPriceIsValid onlyInitialized { uint256 poolId = validatorSetContract.idByStakingAddress(_poolStakingAddress); require(_poolStakingAddress != address(0)); require(poolId != 0); require(_amount != 0); require(!validatorSetContract.isValidatorIdBanned(poolId)); ...
13,081,028