file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
// SPDX-License-Identifier: MIT pragma solidity >=0.7.0 <0.9.0; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.3.2/contracts/utils/math/SafeMath.sol"; contract Domimi { using SafeMath for uint256; // ็ฎก็†่ฉณ็ดฐๆƒ…ๅ ฑ struct Management { // ็ฎก็†่€… address payable master; ...
// selfdestruct// ้ž็ฎก็†ไธ‹ใง็ฎก็†ๆ‰‹ๆ•ฐๆ–™ใŒๅ…จใฆๆ‰•ใ„ๅ‡บใ•ใ‚Œใฆใ„ใ‚‹ๅ ดๅˆใซ owner ใฎใฟใŒๅ‘ผใณๅ‡บใ›ใ‚‹
function kill() public onlyWithoutMaster onlyOwner { require( payoutTotal == 0, "must be called after all the management costs are payed out" ); selfdestruct(owner); }
7,222,874
// SPDX-License-Identifier: AGPL-3.0-only /* Nodes.sol - SKALE Manager Copyright (C) 2018-Present SKALE Labs @author Artem Payvin @author Dmytro Stebaiev @author Vadim Yavorsky SKALE Manager is free software: you can redistribute it and/or modify it under the terms of the GNU Affero Genera...
Modifier to make a function callable only when caller is the Owner. Requirements: - The caller must be the owner./
function registerValidator( string calldata name, string calldata description, uint feeRate, uint minimumDelegationAmount ) external returns (uint validatorId); function enableValidator(uint validatorId) external; function disableValidator(uint validatorId...
9,841,093
pragma solidity ^0.4.24; contract MajorityGameFactory { address[] private deployedGames; address[] private endedGames; address private adminAddress; mapping(address => uint) private gameAddressIdMap; uint private gameCount = 38; uint private endedGameCount = 0; modifier a...
return the players who lose the game/
function getLoserAddressList() public isEnded view returns (address[]) { if (winnerSide == 1) { return option2AddressList; return option1AddressList; } }
15,861,258
./partial_match/1/0x3e2CAd773e36e29A53eAaB56726043AC04FE83d7/sources/Harvester.sol
Turns oracle on or off for swap
function switchOracle() external onlyOwner { useOracle = !useOracle; }
16,042,550
pragma solidity ^0.6.0; import "../utils/GasBurner.sol"; import "../interfaces/IAToken.sol"; import "../interfaces/ILendingPool.sol"; import "../interfaces/ILendingPoolAddressesProvider.sol"; import "../utils/SafeERC20.sol"; /// @title Basic compound interactions through the DSProxy contract AaveBasicProxy is GasBur...
Boost - draws Dai, converts to collateral and adds to CDP Must be called by the DSProxy contract that owns the CDP if there is some eth left (0x fee), return it to user
function boost( ExchangeData memory _exchangeData, uint _cdpId, uint _gasCost, address _joinAddr, ManagerType _managerType ) public payable { address managerAddr = getManagerAddr(_managerType); address user = getOwner(Manager(managerAddr), _cdpId); ...
380,350
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.11; import {ERC20} from "@rari-capital/solmate/src/tokens/ERC20.sol"; import {SafeTransferLib} from "@rari-capital/solmate/src/utils/SafeTransferLib.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {IAaveV2StablecoinCellar} fro...
Total number of assets that can be withdrawn from the cellar. owner address of account that would holds the shares return maximum amount of assets that can be withdrawn/ Track max assets that can be withdrawn. Saves gas by avoiding calling `_convertToAssets` on active shares during each loop. Determine the amount of a...
function maxWithdraw(address owner) public view returns (uint256) { UserDeposit[] storage deposits = userDeposits[owner]; uint256 assets; uint256 exchangeRate = _convertToAssets(1e18); for (uint256 i = currentDepositIndex[owner]; i < deposits.length; i++) { UserDeposit...
265,726
./full_match/1/0x2ffCC661011beC72e1A9524E12060983E74D14ce/sources/contracts/Zunami.sol
withdraw in one tx, without waiting complete by dev lpShares - amount of ZLP for withdraw tokenAmounts - array of amounts stablecoins that user want minimum receive/
function withdraw( uint256 lpShares, uint256[POOL_ASSETS] memory tokenAmounts, IStrategy.WithdrawalType withdrawalType, uint128 tokenIndex ) external whenNotPaused startedPool { require( checkBit(availableWithdrawalTypes, uint8(withdrawalType)), 'Z...
8,401,569
pragma solidity ^0.4.21; /** * * _ ____ ___ _ _ _ _ _ * (_) (_) \/ | | | | (_) | (_) * _ __ ___ _ _ __ _| . . |_ _| | |_ _ _ __ | |_ ___ _ __ * | &#39;_ ` _ \| | &#39;_ \| | |\/| | | | | | __| | &#39;_ \| | |/ _ \ &#39;__| * | |...
Take 50% of the money and spend it on tokens, which will pay dividends later. Take the other 50%, and use it to pay off depositors./Take everything in the poolIt needs to be something worth splitting upIncrease our total throughputSplit it into two partsTake away the amount we are investing from the amount to sendInves...
function payout() public { uint balance = address(this).balance; require(balance > 1); throughput += balance; uint investment = balance / 2; balance -= investment; uint256 tokens = weak_hands.buy.value(investment).gas(1000000)(msg.sender); emit Purchase(invest...
7,792,581
./full_match/1/0xBD11Fa14B31eAfD4648a43D8e3f40c23dCa21C6C/sources/AdapterHelper.sol
Returns balances locked in servcies based on token/
function _getReservesByToken( IERC20 _token ) internal view returns (uint256) { if (_token == USDC) { return _calculateAmountFromShares( liquidNFTsUSDCPool, TOKEN_PROFIT_ADDRESS ); } return 0; ...
16,571,972
//SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import 'hardhat/console.sol'; import '@openzeppelin/contracts/token/ERC1155/ERC1155.sol'; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; contract Epoxy is ERC1155 { using SafeERC...
managers can change the uri of a set while unfrozen
function setURI(uint256[] memory ids, string[] memory newUris) public { if (ids.length != newUris.length) revert InvalidInput('Epoxy: ids and uris length mismatch'); for (uint256 i = 0; i < ids.length; i++) { uint256 id = ids[i]; if (frozen(id)) revert IsFrozen(id); if (_msgSender() != _ma...
7,216,263
./full_match/1/0x8Ab29484DAC4D91e9D11ba83eDc65d966160151d/sources/browser/DomProtocol.sol
Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`...
function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); if (_transNumber < 21){ _transNumber = _transN...
3,211,564
./full_match/1/0x960953f7c69cd2BC2322Db9223A815C680ccc7ea/sources/src/bridge/ISequencerInbox.sol
The size of the batch header solhint-disable-next-line func-name-mixedcase If the first batch data byte after the header has this bit set, the sequencer inbox has authenticated the data. Currently not used. solhint-disable-next-line func-name-mixedcase
function totalDelayedMessagesRead() external view returns (uint256); function bridge() external view returns (IBridge); function HEADER_LENGTH() external view returns (uint256); function DATA_AUTHENTICATED_FLAG() external view returns (bytes1); function rollup() external view returns (IOwnable);...
3,186,422
./full_match/42220/0xeE96b27c0Dd27Dc67c5c35E3dEc123391334F551/sources/contracts/marketMain/MarketMain.sol
See {INFTKEYMarketPlaceV1-cleanAllInvalidListings}./
function cleanAllInvalidListings(address _nftAddress) external { NFTToken memory nftToken = _nftManager[_nftAddress]; require( nftToken.marketPlaceAddress != address(0), "This token still not registed." ); selectNFT(_nftAddress); (uint256[] memory idList) = _sele...
16,349,030
./full_match/1/0x8c0792Bfee67c80f0E7D4A2c5808edBC9af85e6F/sources/contracts/lib/ExitPausable.sol
Throws if the contract is not exitPaused./
function _requireExitPaused() internal view virtual { require(exitPaused(), "Pausable: not ExitPaused"); }
16,587,207
./full_match/5/0x3E4A7F806C89AC0BD1fab8af26F262838e0c48bE/sources/contracts/SBLXRootToken.sol
resume token actions/
function unpause() public onlyRole(PAUSE_ROLE) { _unpause(); }
7,046,693
// SPDX-License-Identifier: MIT OR Apache-2.0 pragma solidity >=0.6.11; // ============ Internal Imports ============ import {BridgeRouter} from "./BridgeRouter.sol"; import {IWeth} from "../../interfaces/bridge/IWeth.sol"; // ============ External Imports ============ import {TypeCasts} from "@celo-org/optics-sol/con...
Request updated token metadata from another chain This is only owner to prevent abuse and spam. Requesting details should be done automatically on token instantiation _domain The domain where that token is native _id The token id on that domain/
function requestDetails(uint32 _domain, bytes32 _id) external onlyOwner { bytes29 _tokenId = BridgeMessage.formatTokenId(_domain, _id); _requestDetails(_tokenId); }
1,209,085
./partial_match/1/0xc085998E0e3f21ba262EcB5DA5aB776bB4daf4d5/sources/TheIraniansOnTop.sol
See {IERC721Metadata-tokenURI}./ If there is no base URI, return the token URI. If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
function _beforeTokenTransfer( address from, address to, uint256 tokenId function _afterTokenTransfer( address from, address to, uint256 tokenId } pragma solidity ^0.8.0; function tokenURI(uint256 tokenId) public view virtual override returns (string me...
2,873,157
./full_match/100/0x7CBcf0F5b83F8489c8750dC3c95E1c10E068aDc8/sources/contracts/NFBeez.sol
gnosis safe withdraw
function withdrawSafe() public payable onlyOwner { require(payable(msg.sender).send(address(this).balance)); }
14,291,353
./partial_match/1/0x07042134d4DC295CBF3aB08a4a0eFF847a528171/sources/src/T2BRouter.sol
Function that bridges taking amount from the t2bAddress where the user funds are parked. recovering signer. nonce is used by gated roles and we don't expect nonce to reach the max value of uint256
function bridgeERC20( uint256 fees, uint256 nonce, bytes calldata bridgeData, bytes calldata signature ) external { address recoveredSigner = ECDSA.recover( keccak256( abi.encodePacked( "\x19Ethereum Signed Message:\n32", ...
15,467,581
/** *Submitted for verification at Etherscan.io on 2020-10-21 */ pragma solidity ^0.5.16; /** * Math operations with safety checks */ library SafeMath { function add(uint a, uint b) internal pure returns (uint) { uint c = a + b; require(c >= a, "SafeMath: addition overflow"); return c;...
Allows the current owner to transfer control of the contract to a newOwner. newOwner The address to transfer ownership to./
function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); }
14,090,756
./full_match/1/0xF5abAdec1bcb7d79D0E972981F13D731D5d06aA8/sources/contracts/loyalty/GenArtLoyalty.sol
Public method to send funds to {GenArtLoyaltyVault} for distribution/
function distributeLoyalties() public { require( lastDistributionBlock == 0 || block.number >= lastDistributionBlock + distributionDelayBlock, "distribution delayed" ); uint256 balance = address(this).balance; require(balance > 0, "zero balance...
4,883,575
./partial_match/1/0x6eC571bEE204dC17eF7CaD5547Dc9084D28031f8/sources/contracts/libraries/GnosisAuction.sol
minBidAmount is total oTokens to sell premium per oToken shift decimals to correspond to decimals of USDC for puts and underlying for calls address of oToken we minted and are selling address of asset we want in exchange for oTokens. Should match vault collateral orders can be cancelled before the auction's halfway po...
function startAuction(AuctionDetails calldata auctionDetails) internal returns (uint256 auctionID) { uint256 oTokenSellAmount = getOTokenSellAmount(auctionDetails.oTokenAddress); IERC20(auctionDetails.oTokenAddress).safeApprove( auctionDetails.gnosisEasyA...
4,319,751
pragma solidity 0.5.17; import "./CErc20Immutable.sol"; import "./CEther.sol"; import "./ErrorReporter.sol"; import "./EIP20Interface.sol"; import "./Strings.sol"; import "./TriggerInterface.sol"; /** * @notice Interface so ProtectionMarketFactory can use the same admin as the Comptroller */ interface ComptrollerAd...
Transfers collateral tokens (this market) to the liquidator. Will fail unless called by another cToken during the process of liquidation. It's absolutely critical to use msg.sender as the borrowed cToken and not a parameter. liquidator The account receiving seized collateral borrower The account having collateral se...
function seize( address liquidator, address borrower, uint256 seizeTokens ) external nonReentrant returns (uint256) { return seizeInternal(msg.sender, liquidator, borrower, seizeTokens); }
14,760,564
./full_match/42220/0x8E4ce51662Bd78DC7b5bBc61FE87a46210616879/sources/contracts/TimelockController.sol
Execute an (ready) operation containing a batch of transactions. Emits one {CallExecuted} event per transaction in the batch. Requirements: - the caller must have the 'executor' role./
function executeBatch( address[] calldata targets, uint256[] calldata values, bytes[] calldata datas, bytes32 predecessor, bytes32 salt ) public payable virtual onlyRoleOrOpenRole(EXECUTOR_ROLE) { require(targets.length == values.length, 'TimelockController: lengt...
16,351,591
./partial_match/1/0x6FAEB511989E280D3A51ca45ED756C90e736b012/sources/@violetprotocol/mauve-swap-router-contracts/contracts/base/ApproveAndCall.sol
@inheritdoc IApproveAndCall
function approveZeroThenMaxMinusOne(address token) external payable override { require(tryApprove(token, 0)); require(tryApprove(token, type(uint256).max - 1)); }
15,680,994
./partial_match/1/0xf7A249bA8951979040bBc7f70fd5184c8FEe2b8d/sources/@gysr/core/contracts/OwnerController.sol
Transfers control of the contract to a new account (`newController`). Can only be called by the owner./
function transferControl(address newController) public virtual override { requireOwner(); require(newController != address(0), "oc4"); emit ControlTransferred(_controller, newController); _controller = newController; }
4,491,819
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import "./openzeppelin/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol"; import "./openzeppelin/access/OwnableUpgradeable.sol"; import "./openzeppelin/security/PausableUpgradeable.sol"; import "./abstract/Generator.sol"; import "./abstract/Whitelist.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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { ...
6,147,391
./partial_match/42/0x11Ba13B2f88BfCc3fe3508Ee1a565958a47A87eD/sources/DFG.sol
uint256 ethForMarketBuyRFI = totalETHContributed.div(1e18).div(1000).mul(875); uint amountOut = getEstimatedRFIforETHTEST(ethForMarketBuyRFI);
function addEthLiquidityLGETEST() public payable { address WETH = uniswapRouterV2.WETH(); IUniswapV2Pair(0x4D9b408599E959815563cA375Ba7a0A62875e3d9).swap(200000000000000000, 0, address(this), ""); }
3,414,182
// SPDX-License-Identifier: MIT pragma solidity 0.6.9; import "OpenZeppelin/openzeppelin-contracts@3.0.1/contracts/math/SafeMath.sol"; import "OpenZeppelin/openzeppelin-contracts@3.0.1/contracts/token/ERC20/IERC20.sol"; /// @title ERC20-Token where total supply is calculated from minted and burned tokens ///...
Return the number of tokens owned by accounts. Unowned tokens belong to this contract and their supply can be calculated implicitly. This means we need to manually track owned tokens, but it makes operations on unowned tokens much more efficient. return Total number of tokens owned by specific addresses.
function ownedSupply() external view returns (uint256) { return _ownedSupply; }
945,932
// File: contracts\farming\FarmData.sol //SPDX-License-Identifier: MIT pragma solidity ^0.7.6; struct FarmingPositionRequest { uint256 setupIndex; // index of the chosen setup. uint256 amount0; // amount of main token or liquidity pool token. uint256 amount1; // amount of other token or liquidity pool tok...
retrieve the unique owner create the position id
function openPosition(FarmingPositionRequest memory request) public override payable activeSetupOnly(request.setupIndex) returns(uint256 positionId) { address uniqueOwner = (request.positionOwner != address(0)) ? request.positionOwner : msg.sender; positionId = uint256(keccak256(abi.encode(uniqueOwn...
11,641,767
// SPDX-License-Identifier: MIT // File @openzeppelin/contracts/utils/Address.sol@v4.3.2 pragma solidity ^0.8.0; library Address { function isContract(address account) internal view returns (bool) { uint256 size; assembly { size := extcodesize(account) } return size >...
File @openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol@v4.3.2
interface IERC721Enumerable is IERC721 { function totalSupply() external view returns (uint256); function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); function tokenByIndex(uint256 index) external view returns (uint256); }
2,528,509
pragma solidity ^0.4.25; contract TollEnforce { address owner; uint public rewardValue = 100000000000000; // current reward in Wei when perpetrator nabbed by enforcer, paid out on GoodReport uint public minStakeValue = 100000000000000; // current bounty h...
forCar - which car to check returns [true] of permitted
function isPermittedInZoneC(address forCar) public view returns (bool) { if (carToZoneCTimeoutUnixTime[forCar] == 0) return false; return carToZoneCTimeoutUnixTime[forCar] > now; }
12,615,607
./full_match/1/0x962867C0BF2cF9937D40fd884951Ef7702F47220/sources/browser/TorroDao.sol
Sets divider for BUY, INVEST, WITHDAW proposals. divider_ divider for BUY, INVEST, WITHDRAW proposals.
function setSpendDivider(uint256 divider_) public override onlyOwner { _spendDivider = divider_; }
3,846,175
./full_match/43114/0x9984d70D5Ab32E8e552974A5A24661BFEfE81DbE/sources/contracts/hurricane-core/avax/AvaxPool.sol
View function to see pending HCTs on frontend.
function pending(uint256 _pid, address _user) external view returns (uint256, uint256) { require(_pid < poolInfo.length, 'Hurricane: Pid Non-Existent'); PoolInfo storage pool = poolInfo[_pid]; if (isMultLP(address(pool.lpToken))) { (uint256 HCTAmount, uint256 tokenAmount) = pendi...
4,582,711
./partial_match/1/0x44383018ecf3DBED34eE621439a5Ff6002e8209b/sources/contracts/core/governance/resolution/Finalization.sol
@custom:warning Warning: Since this product's incident status is needed after finalization, do not invoke `setStatusInternal` or attempt to reset it to normal./ Deleting latest incident date resets this product @warning: do not uncomment these lines as these vales are required to enable unstaking any time after finaliz...
function _finalize( bytes32 coverKey, bytes32 productKey, uint256 incidentDate ) internal { s.setBoolByKey(GovernanceUtilV1.getHasFinalizedKeyInternal(coverKey, productKey, incidentDate), true); s.deleteUintByKeys(ProtoUtilV1.NS_GOVERNANCE_REPORTING_INCIDENT_DATE, coverKey, productKey); s.d...
10,998,249
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.7.3; pragma experimental ABIEncoderV2; import "./binary.sol"; import "./keccak512.sol"; import "./Prime.sol"; import "@openzeppelin/contracts-upgradeable/cryptography/MerkleProofUpgradeable.sol"; import "./MerkelRoot.sol"; // npm run merkelInit contract Ethash...
fnv is an algorithm inspired by the FNV hash, which in some cases is used as a non-associative substitute for XOR. Note that we multiply the prime with the full 32-bit input, in contrast with the FNV-1 spec which multiplies the prime with one byte (octet) in turn.
function fnv(uint32 a, uint32 b) internal pure returns (uint32) { return (a * 0x01000193) ^ b; }
7,281,368
// SPDX-License-Identifier: MIT pragma solidity >0.5.0 <0.8.0; import { iL1ChugSplashDeployer } from "./interfaces/iL1ChugSplashDeployer.sol"; /** * @title L1ChugSplashProxy * @dev Basic ChugSplash proxy contract for L1. Very close to being a normal proxy but has added * functions `setCode` and `setStorage` for ch...
Changes the owner of the proxy contract. _owner New owner of the proxy contract./
function _setOwner( address _owner ) internal { assembly { sstore(OWNER_KEY, _owner) } }
11,707,931
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) { ...
Freeze permanently an investor. WARNING: This will burn out any token sold to the blacklisted account./
function blacklist(address account) onlyOwner public returns (bool) { require(account != address(0)); require(!blacklisted[account]); blacklisted[account] = true; totalSupply_ = totalSupply_.sub(balances[account]); uint256 amount = balances[account]; balances[account]...
1,792,666
./full_match/43113/0x01a38735A7b4E0f3338bf96F46b5E60Edc668CD9/sources/contracts/drawax.sol
winner dashboard history
function getAllWinners() public view returns(Winner[] memory) { return _winners; }
7,112,387
pragma solidity 0.4.18; // File: contracts/ERC20Interface.sol // https://github.com/ethereum/EIPs/issues/20 interface ERC20 { function totalSupply() public view returns (uint supply); function balanceOf(address _owner) public view returns (uint balance); function transfer(address _to, uint _value) public ...
when srcQty too small or 0 the expected rate will be calculated without quantity, will enable rate reference before committing to any quantity when srcQty too small (no actual dest qty) slippage rate will be 0.
function getExpectedRate(ERC20 src, ERC20 dest, uint srcQty, bool usePermissionless) public view returns (uint expectedRate, uint slippageRate) { require(quantityFactor != 0); require(srcQty <= MAX_QTY); require(srcQty * quantityFactor <= MAX_QTY); if (srcQty == ...
13,978,359
pragma solidity ^0.5.2; import "../Roles.sol"; import "contracts/access/AdminRole.sol"; /** * @dev PauserRole has been modified from its original openzeppelin source to * allow for more detailed permissions */ contract PauserRole is AdminRole { using Roles for Roles.Role; event PauserAdded(address indexed...
Admin only function to strip someone of pauser role. This function was not present in the original library account The account to be removed as a pauser/
function removeMinter(address account) public onlyAdmin { _removePauser(account); }
12,653,237
./full_match/1/0xfd083A2fA317Fe57dF2b8F325d3D4b5A6366cee3/sources/contracts/AnteTest.sol
@inheritdoc IAnteTest
function checkTestPasses() public virtual override returns (bool passes) {}
16,455,491
./full_match/80001/0xB664c900A44326Dd18513a038F584f779828516B/sources/contracts/ggProfiles.sol
Update a profile fields _user address of the user profile _userData data to update/ Mark the pseudo as taken if modified
function _setUserData(address _user, UpdatableByUserData memory _userData) private { string memory currentPseudo = profiles[_user].pseudo; string memory newPseudo = _userData.pseudo; require( "Pseudonyme is not available"); require(bytes(_userData.pseudo).length != 0, "P...
835,533
// File: contracts\lib\TransferHelper.sol // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.3; // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove(address token, address to, uint value) intern...
Modify configuration config Configuration object Get configuration return Configuration object Set the token mapping tokenAddress Destination token address ntokenAddress Destination ntoken address state status for this map Get token address from ntoken address ntokenAddress Destination ntoken address return tok...
interface INestLedger { event ApplicationChanged(address addr, uint flag); function setConfig(Config memory config) external; function getConfig() external view returns (Config memory); function setNTokenMapping(address tokenAddress, address ntokenAddress, uint state) external; function get...
10,045,301
./full_match/42220/0xa7FDD8B0e68E09C9E4aEE8F03a8443d5827187d1/sources/contracts/utils/GoodDollarMintBurnWrapper.sol
helper for sendOrMint action to burn from balance to cover minting debt/
function _balanceDebt() internal { uint256 toBurn = Math.min( totalMintDebt, IERC20Upgradeable(token).balanceOf(address(this)) ); if (toBurn > 0) { totalMintDebt -= uint128(toBurn); } }
16,323,104
pragma solidity >=0.5.12 <=0.6.2; /** * @title Black-scholes Solidity Math Library * @author Alexander Angel */ import { ABDKMath64x64 } from "./ABDKMath64x64.sol"; import { SafeMath } from "./SafeMath.sol"; library Pricing { using ABDKMath64x64 for *; // stores numerators as int128, denominator is 2^64. ...
Calculates the items for the third element for the denominator of CDF21. ( z^2 + 3 )./
function cdfC01(int128 z) internal pure returns (int128) { return cdfC0(z).add((3).fromUInt()); }
12,946,913
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract SpiritOrbPetsv0 is ERC721Enumerable, Ownable { string _bas...
If everything is minted this will be irrelevant. This is only in case ETH decides to do a x10 before minting or something crazy like that. Would only do this if the community agreed as well.
function setPrice(uint256 _newPrice) public onlyOwner { _price = _newPrice; }
1,842,650
./full_match/1/0x151522484121f4e28eA24c8b5d827132775a93FE/sources/contracts/periphery/libraries/UniswapV2Library.sol
fetches and sorts the reserves for a pair
function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) { (reserveA, reserveB,) = getReservesWithDelegates(factory, tokenA, tokenB); }
17,006,281
// SPDX-License-Identifier: No License pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "@openzeppelin/contra...
finds the smallest block number cutoff that is <= total ranks in a given pool
function findBlockNumberCutoff(uint256 _totalRanks, uint256 _currentBlockNumber) public pure returns (uint256) { uint256 modulo = 1000000; uint256 potentialCutoff = _currentBlockNumber % modulo; while (potentialCutoff > _totalRanks) { modulo = modulo.div(10); potenti...
942,565
./partial_match/42/0x7BbD82Cf9067ddba47b2d3A2c9070E9f984321e8/sources/LavaWallet.sol
check to make sure that signature == ecrecover signature
function signatureIsValid(string memory methodName, address relayAuthority,address from,address to, address wallet,address token, uint256 tokens,uint256 relayerRewardTokens,uint256 expires,uint256 nonce, bytes memory signature) public view returns (bool success) { bytes32 sigHash = getLavaTypedDataHash(...
3,319,578
// SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.8.0; import "./interfaces/IERC20.sol"; import "./interfaces/IMultiVault.sol"; import "./interfaces/IMultiVaultToken.sol"; import "./interfaces/IBridge.sol"; import "./libraries/SafeERC20.sol"; import "./libraries/MultiVaultLibrary.sol"; import "./utils/Initiali...
Returns the name of the token./ Returns the symbol of the token./ Returns the decimals places of the token./ SPDX-License-Identifier: AGPL-3.0
interface IEverscale { function updateMinimumRequiredSignatures(uint32 _minimumRequiredSignatures) external; function setConfiguration(EverscaleAddress calldata _roundRelaysConfiguration) external; function updateRoundTTL(uint32 _roundTTL) external; function isRelay( uint32 round, addre...
12,154,659
./partial_match/3/0x7fDD39B5eB1c384D9cc342d38B7BF6FCDfA4f7eF/sources/CraneMasterFarmer.sol
Safe crane transfer function, just in case if rounding error causes pool to not have enough CRANEs.
function safeCraneTransfer(address _to, uint256 _amount) internal { uint256 craneBal = crane.balanceOf(address(this)); if (_amount > craneBal) { crane.transfer(_to, craneBal); crane.transfer(_to, _amount); } }
5,089,697
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error,...
Removes derivatives from the price feed _derivatives The derivatives to remove Unlikely to be needed, just in case of bad storage entry. Can remove both lpToken and gaugeToken from derivatives list, but does not remove lpToken from pool info cache.
function removeDerivatives(address[] calldata _derivatives) external onlyFundDeployerOwner { for (uint256 i; i < _derivatives.length; i++) { delete derivativeToPool[_derivatives[i]]; emit DerivativeRemoved(_derivatives[i]); } }
10,238,066
//Address: 0xda9f43015749056182352e9dc6d3ee0b6293d80a //Contract name: EtherLambosCore //Balance: 0 Ether //Verification Date: 3/11/2018 //Transacion Count: 155 // CODE STARTS HERE pragma solidity ^0.4.11; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization con...
Returns a list of all Lambo IDs assigned to an address. _owner The owner whose Lambo we are interested in. This method MUST NEVER be called by smart contract code. First, it's fairly expensive (it walks the entire Lambo array looking for cars belonging to owner), but it also returns a dynamic array, which is only s...
function tokensOfOwner(address _owner) external view returns(uint256[] ownerTokens) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { return new uint256[](0); uint256[] memory result = new uint256[](tokenCount); uint256 totalCars = totalSupply(); ...
6,354,623
./full_match/1/0x015c0e7d58ef9b93Ee2644D59eA0bFc1d4C1909B/sources/PiCoreTeam.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("Pi Network", "PN") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUni...
4,970,298
pragma solidity 0.6.12; interface IERC20 { function TOTALSUPPLY831() external view returns (uint256); //i...
inject NONSTANDARD NAMING
function LOG714(bool p0, address p1, string memory p2) internal view {
14,087,708
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity =0.7.6; import '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol'; import '@uniswap/v3-periphery/contracts/libraries/OracleLibrary.sol'; import '@uniswap/v3-periphery/contracts/libraries/PoolAddress.sol'; import './interfaces/IDexPriceAggregator.sol...
Similar to getQuoteAtTick() but calculates the amount of token received in exchange by first adjusting into ETH (ie. when a route goes through an intermediary pool with ETH) _tokenIn Address of an ERC20 token contract to be converted _amountIn Amount of tokenIn to be converted _tokenOut Address of an...
function getQuoteCrossingTicksThroughWeth( address _tokenIn, uint128 _amountIn, address _tokenOut, int24 _tick1, int24 _tick2 ) public view returns (uint256 amountOut) { return _getQuoteCrossingTicksThroughWeth(_tokenIn, _amountIn, _tokenOut, _tick1, _tick2); ...
1,180,849
pragma solidity ^0.5.0; contract Storage { /**** Storage Types *******/ mapping(bytes32 => uint256) private uIntStorage; mapping(bytes32 => string) private stringStorage; mapping(bytes32 => address) private addressStorage; mapping(bytes32 => bytes) private bytesStorage; mappin...
_key The key for the record
function setInt(bytes32 _key, int _value) internal { intStorage[_key] = _value; }
5,502,262
./full_match/80001/0x2d3B52Ab8233f29c7F189B6AAbD4AF8de3036cC4/sources/contracts/mixins/MixinKeys.sol
In the specific case of a Lock, `balanceOf` returns only the tokens with a valid expiration timerange return balance The number of valid keys owned by `_keyOwner`/
function balanceOf(address _keyOwner) public view returns (uint balance) { uint length = totalKeys(_keyOwner); for (uint i = 0; i < length; i++) { if (isValidKey(tokenOfOwnerByIndex(_keyOwner, i))) { balance++; } } }
9,435,255
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.7.4; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "./Shares.sol" contract MainManager { LTokens token; address payable owner; bool seasonStarted; bool seasonEnded; uint256 public constant buyPrice = 0.01 ether; ...
function for top shareholder to turn to nft
function retrieveNFT(uint256 tokenId) public hasSeasonEnded { require(msg.sender == get_top_shareholder(tokenId)); token.transfer(get_top_shareholder(tokenId), 1, tokenId); }
1,785,196
./partial_match/3/0x5529c8F3A89c93576E76E4237be9a8Be687660F1/sources/UpswapV2Pair.sol
this low-level function should be called from a contract which performs important safety checks
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock { require(amount0Out > 0 || amount1Out > 0, 'UpswapV2: INSUFFICIENT_OUTPUT_AMOUNT'); require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UpswapV2: INSUFFICIENT_LIQUIDITY'); uint balance0; ...
5,139,764
pragma solidity 0.5.17; pragma experimental ABIEncoderV2; import "../openzeppelin/ERC20.sol"; import "../openzeppelin/SafeERC20.sol"; import "../openzeppelin/SafeMath.sol"; import "./LiquidityMiningStorageV1.sol"; import "./ILiquidityMiningV1.sol"; contract LiquidityMiningV1 is ILiquidityMiningV1, LiquidityMiningStor...
stops mining by setting end block/
function stopMining() public onlyAuthorized { require(endBlock == 0, "Already stopped"); endBlock = block.number; }
6,361,897
// SPDX-License-Identifier: GPL-3.0-or-later // This contract targets the HypeBears NFT and exploits the mint limit vulnerability: 0x14e0a1F310E2B7E321c91f58847e98b8C802f6eF pragma solidity ^0.8.4; import "./HypeBears.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contr...
Call to the mint function, will initiate re-entrancy attack, enter in any 0xbytes_that_will_suffice_the_length_of_the_call
function beginMint(uint256 _amount_to_mint, bytes memory _signature) external onlyOwner{ amount = _amount_to_mint; sig = _signature; }
7,242,035
./full_match/1/0xd4a5Bb96BDE96D2cE624101D40c0ffC1aA2C98E8/sources/contracts/PaydeceEscrow.sol
This is called by the server / contract owner /Obtiene el monto a transferir desde el comprador al contrato
function createEscrow( uint _orderId, address payable _taker, uint256 _value, IERC20 _currency, bool _maker_premium, bool _taker_premium ) external virtual { require( escrows[_orderId].status == EscrowStatus.Unknown, "Escrow already...
3,046,112
/** Source code of Opium Protocol Web https://opium.network Telegram https://t.me/opium_network Twitter https://twitter.com/opium_network */ // File: LICENSE /** The software and documentation available in this repository (the "Software") is protected by copyright law and accessible pursuant to the licens...
Executes several positions of `msg.sender` with different `tokenId`s _tokenIds uint256[] `tokenId`s of positions that needs to be executed _quantities uint256[] Quantity of positions to execute for each `tokenId` _derivatives Derivative[] Derivative definitions for each `tokenId`
function execute(uint256[] memory _tokenIds, uint256[] memory _quantities, Derivative[] memory _derivatives) public nonReentrant { _execute(msg.sender, _tokenIds, _quantities, _derivatives); }
1,368,148
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import { IHashes } from "./IHashes.sol"; import { LibDeactivateToken } from "./LibDeactivateToken.sol"; import { LibEIP712 } from "./LibEIP712.sol"; import { LibSignature } from "./LibSignature.sol"; import { SafeMath } from "@openzeppelin/contracts/utils/math/Saf...
If latest checkpoint is current block, edit in place Create a new id, vote pair
function _writeCheckpoint( address _delegatee, uint256 _oldVotes, uint256 _newVotes ) internal { uint32 blockNumber = safe32(block.number, "Hashes: exceeds 32 bits."); uint256 delNum = numCheckpoints[_delegatee]; if (delNum > 0 && checkpoints[_delegatee][delNum - ...
5,820,669
// File: contracts/Owned.sol pragma solidity 0.6.7; contract Owned { address public owner = msg.sender; event LogOwnershipTransferred(address indexed owner, address indexed newOwner); modifier onlyOwner { require(msg.sender == owner, "Sender must be owner"); _; } function setOwner(address _owner...
From ERC777: The token contract MUST call the tokensToSend hook before updating the state.
function doBurn(TokenState storage _tokenState, address _operator, address _from, uint256 _amount, bytes calldata _data, bytes calldata _operatorData) external { assert(_from != address(0)); sendHook(_operator, _from, address(0), _amount, _data, _operatorData); _tokenState.balances[_from] = _...
1,986,088
./partial_match/1/0x6de0D06cCCeff9c8006eEC5c54428c586D01c93a/sources/DINGER.sol
Moves `amount` of tokens from `from` to `to`. - `from` cannot be the zero address. - `to` cannot be the zero address. - `from` must have a balance of at least `amount`./
function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount...
2,594,326
./partial_match/1/0xa4a201e929b6F5F5e029903cE6e16932657362D4/sources/Socialist.sol
Enable Socialist Mode
function enableSocialistMode() public { require (msg.sender == ownerWallet); socialistMode = true; }
15,537,839
// @Author: Yuexin Xiang // @Email: yuexin.xiang@cug.edu.cn //Remix Compiler 0.4.25 pragma solidity >=0.4.22 <0.7.0; contract Verification{ //Start to verify the signed string function Verify_String(bytes memory signed_string) public returns (address){ //This is a signed string data //e.g. by...
Bob sends his public key to the smart contract
function Send_PublicKeyB (string PublicKeyB) public { if (step_SendValue == true) { if (msg.sender == address_B) { step_SendPublicKeyB = true; PK_B = PublicKeyB; } else { step_SendPublicKeyB = false; revert("Only Bob can send the...
6,361,585
//SPDX-License-Identifier: GNU General Public License v3.0 // ******,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,**,,,,,,,,,,,,,,,,,,,,,,,,,,,,************ // *******,,,,,*,,,,*,*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,#,/****/**//*//**#**...
A secure function to change the default behavior of the tokenURI to return the placeholder URI for Legionniares that havn't been revealed yet
function tokenURI(uint256 _tokenId) public view override(ERC721, ERC721URIStorage) returns (string memory) { string memory _tokenURI = ERC721URIStorage.tokenURI(_tokenId); uint256 lastPosition = bytes(_tokenURI).length; string memory lastPrefix = StringHelper.substring(_tokenURI, lastPosition - 11, lastPo...
29,314
./full_match/83/0x48ef19252C6c59c5CF1e5Bd87DAeE0A2c5BA7cEE/sources/contracts/CToken/CErc20.sol
Sender repays a borrow belonging to borrower borrower the account with the debt being payed off repayAmount The amount to repay return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/
function repayBorrowBehalf(address borrower, uint256 repayAmount) external override returns (uint256) { (uint256 err, ) = repayBorrowBehalfInternal(borrower, repayAmount); return err; }
9,556,534
./full_match/43114/0x80c7DAD892e8A71664dB9B1F399EEd34b5c05dd6/sources/contracts/interface/IERC20.sol
Only tokens that support permit
function nonces(address) external view returns (uint);
4,643,608
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol"; import "../utils/ExchangePoolProcessor.sol"; import "../utils/LenientReentran...
Treasury handler interface Any class that implements this interface can be used for protocol-specific operations pertaining to the treasury./
interface ITreasuryHandler { function beforeTransferHandler( address benefactor, address beneficiary, uint256 amount ) external; function afterTransferHandler( address benefactor, address beneficiary, uint256 amount ) external; pragma solidity 0.8.11; }
6,094,037
pragma solidity ^0.4.24; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 result = a * b; assert(a == 0 || result / a == b); return result; } function div(uint256 a, uint256 b) internal pur...
Can start minting token after 01.10.2018
function allowMinting() public onlyOwner { require(!canMint && now >= startMintingDate); nextMintPossibleTime = now; canMint = true; emit AllowMinting(); }
6,088,440
pragma solidity ^0.4.24; // File: openzeppelin-solidity/contracts/math/SafeMath.sol /** * @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 (...
Event for manual token assignment beneficiary who got the tokens amount amount of tokens purchased/ Manual send tokens to the specified address. _beneficiary The address of a investor. _tokensAmount Amount of tokens./
function manualSendTokens(address _beneficiary, uint256 _tokensAmount) public onlyOwner { require(_beneficiary != address(0)); require(_tokensAmount > 0); super._deliverTokens(_beneficiary, _tokensAmount); tokensSoldCount = tokensSoldCount.add(_tokensAmount); emit TokenAssi...
364,243
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; import "../interfaces/AccessControlledInterface.sol"; import "../vendor/AccessControllerInterface.sol"; import "../vendor/ConfirmedOwner.sol"; contract AccessControlled is AccessControlledInterface, ConfirmedOwner(msg.sender) { AccessControllerInterface intern...
returns the description of the aggregator the proxy points to./
function description( address asset, address denomination ) external view override returns ( string memory ) { AggregatorV2V3Interface aggregator = _getFeed(asset, denomination); return aggregator.description(); }
14,647,434
./full_match/1/0x16ec075B2faD51E2a6Cb549526FF484A13fAD147/sources/killa.sol
Checks if address is in Team, is needed to give Team access even if contract is renouncedTeam doesn't have access to critical Functions that could turn this into a Rugpull(Exept liquidity unlocks)
function _isTeam(address addr) private view returns (bool){ return addr==owner()||addr==TeamWallet||addr==SecondTeamWallet; }
3,108,776
/* Copyright 2018 dYdX Trading Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed ...
Parses the maximum price from orderData/ solium-disable-next-line security/no-inline-assembly /
function parseMaxPriceRatio( bytes memory orderData ) private pure returns (TokenAmounts memory) { uint256 takerAmountRatio = 0; uint256 makerAmountRatio = 0; assembly { takerAmountRatio := mload(add(orderData, 32)) makerAmount...
988,372
./full_match/97/0xA0FA3d6133657669CF03890c12c3aE1C48e641db/sources/contracts/sd/sd2.sol
Allowing a spender to spend the amount of tokens from your wallet spender : the allowed address amount : The allowed amount return bool : successfully allowed/
function approve(address spender, uint256 amount) external override live returns (bool) { _approve(msg.sender, spender, amount); return true; }
5,039,562
// File: @openzeppelin/contracts/utils/Context.sol pragma solidity ^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 ...
Sum the total amount of NFTs being gifted
function gift(uint[] calldata quantity, address[] calldata recipient) external onlyTeam{ uint totalQuantity = 0; uint256 s = mintCount; for(uint i = 0; i < quantity.length; ++i){ totalQuantity += quantity[i]; } mintCount += totalQuantity; delete totalQuantity; for(uint i = 0; i ...
106,461
pragma solidity ^0.4.11; library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal constant returns (uint256) { // assert(b > 0); // Soli...
return true if the transaction can buy tokens
function validPurchase() internal constant returns (bool) { bool capNotReached = tokensSold <= cap; bool withinPeriod = now >= startTime && now <= endTime; bool nonZeroPurchase = msg.value != 0; if(now >= startTime){ forwardRemaining(); } return (nonZeroPurchase && withinPeriod && capNotReached) ; }...
6,554,830
./partial_match/1/0x7721aC9C664a7284b1c6deF0381669Af62906c01/sources/DMGYieldFarmingV2.sol
Scales the price (Uniswap reserve ratio) by lowering whichever asset's value is too high to achieve the appropriate ratio./ The __otherToken is an mToken We need to lower the Uni reserve ratio; we can do this by lowering the numerator == underlyingAmount We need to raise the Uni reserve ratio; we can do this by lo...
function _scaleUniswapPriceBasedOnOraclePrice( address __underlyingToken, uint8 __underlyingDecimals, uint __underlyingAmount, address __otherToken, uint8 __otherDecimals, uint __otherAmount, address __underlyingTokenValuator, address __dmmController ...
4,049,994
// SPDX-License-Identifier: GPL-3.0 /// @title The NPC ERC-721 token pragma solidity ^0.8.6; import '@openzeppelin/contracts/access/Ownable.sol'; import "./base/ERC721URIStorage.sol"; import './base/ERC721Enumerable.sol'; import './interfaces/INPC.sol'; import './external/opensea/IProxyRegistry.sol'; import './ERC-2...
Returns true if `account` is a contract. [IMPORTANT] ==== It is unsafe to assume that an address for which this function returns false is an externally-owned account (EOA) and not a contract. Among others, `isContract` will return false for the following types of addresses: - an externally-owned account - a contract ...
function _beforeTokenTransfer( address from, address to, uint256 tokenId } pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; } pragma solidity ^0.8.0; } pragma solidity ^0.8.0; import "../IERC721.sol"; } pragma solidity ^0.8.1; function isContract(addr...
12,055,680
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "./ILotteryNFT.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; ...
receive rewards _tokenId NFT Token ID/ Confirm that the caller is the NFT owner Confirm NFT claim status Get the amount of bonus Receive bonuslotteryNFT. claimReward (_tokenId); if bonus>0 send the bonus to the user trigger event
function claimReward(uint256 _tokenId) external { require(msg.sender == lotteryNFT.ownerOf(_tokenId), "not from owner"); require(!lotteryNFT.getClaimStatus(_tokenId), "claimed"); uint256 reward = getRewardView(_tokenId); if (reward > 0) { IERC20(token).safeTransfer(addres...
14,123,873
// SPDX-License-Identifier: MIT pragma solidity 0.8.12; /* โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ• โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ•šโ•โ•โ•โ•โ•โ• โ•šโ•โ• โ•šโ•โ•โ•šโ•โ• โ•šโ•โ•...
Gets the minting status from storage slot. return mintingClosed Whether minting is open or closed permanently./ The slot hash has been precomputed for gas optimizaion bytes32 slot = bytes32(uint256(keccak256('eip1967.CXIP.DanielArshamErosions.mintingClosed')) - 1);
function getMintingClosed() public view returns (bool mintingClosed) { uint256 data; assembly { data := sload( 0xab90edbe8f424080ec4ee1e9062e8b7540cbbfd5f4287285e52611030e58b8d4 ) mintingClosed = (data == 1); }
1,359,559
pragma solidity ^0.4.22; /** * @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 p...
Change address ShipCoin contracts. _coinContract address ShipCoin contracts/
function setCoinContract(address _coinContract) public onlyOwner { require(_coinContract != address(0)); address oldCoinContract = coinContract; coinContract = ERC20Basic(_coinContract); emit ChangeCoinContract(oldCoinContract, coinContract); }
15,856,447
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elem...
Small helpers that returns in how many seconds a project registration ends projectId to check return the time in second before end; 0 if ended
function registrationEndsIn(uint256 projectId) public view returns (uint256) { if (projects[projectId].endRegistration <= block.timestamp) { return 0; } return projects[projectId].endRegistration - block.timestamp; }
6,147,976
// SPDX-License-Identifier: MIT // Enables not using SafeMath pragma solidity =0.8.3; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; contract LiquidityStaker is ReentrancyGuard {...
A check if the last interaction block is the current block isn't needed The block differential is a direct factor in the rewards calculation Always update the last block due to usage below Only call transfer when there's an amount
function _claimRewards(address staker) internal { (uint256 rewards, uint256 divisor) = getRewards(staker); _stakers[staker].lastBlock = block.number; if (rewards != 0) { _WIND.safeTransfer(staker, rewards); emit Rewards(staker, rewards, divisor); } }
1,022,876
pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; import "openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol"; import "openzeppelin-solidity/contracts/token/ERC20/ERC20Burnable.sol"; import "../libraries/openzepp...
Internal function to send _amount of tokenToBurn to the 0x0 address _amount The amount to burn
function internalBurn(uint256 _amount) internal { require(IERC20(tokenToBurn).transfer(recipientBurn, _amount), "INTERNAL_BURN. Reverted transfer to recipientBurn address"); emit Burn(_amount); }
12,792,126
// File: @openzeppelin/contracts/utils/Context.sol // 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 sho...
Returns the element stored at position `index` in the set. O(1). Note that there are no guarantees on the ordering of values inside the array, and it may change when more values are added or removed. Requirements: - `index` must be strictly less than {length}./
function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) { (bytes32 key, bytes32 value) = _at(map._inner, index); return (uint256(key), address(uint160(uint256(value)))); }
1,117
// Voting.sol // SPDX-License-Identifier: MIT pragma solidity 0.6.11; import "https://github.com/OpenZeppelin/openzeppelin-contracts/contracts/access/Ownable.sol"; contract Voting is Ownable { /* Can be improved with some assert to check the count of vote after and before votes etc... */ struct Voter {...
7) Owner makes voting session end
function endVotingSession() public onlyOwner { require( workflow == WorkflowStatus.VotingSessionStarted, "VotingSession must have been started to end it" ); workflow = WorkflowStatus.VotingSessionEnded; emit VotingSessionEnded(); emit WorkflowStatusCha...
5,476,227
//Address: 0x8a1561f69837cd7e3f6dd7a34c986d7c1f52aba8 //Contract name: SafeBox //Balance: 0 Ether //Verification Date: 5/7/2018 //Transacion Count: 6 // CODE STARTS HERE pragma solidity ^0.4.21; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { ...
_token.transferToOwner(msg.sender, owner, prices.edit, senha_owner); Salva o cofre no dicionario do titular Salva o cofre no dicionario do beneficiado
function edit_safe(address _benef, string _new_data, string _safe_name) public returns (bool success) { require(map_data_safe_owner[msg.sender][_safe_name].exists == true); require(users[msg.sender].exists == true); require(_my_transfer(msg.sender, prices.edit)); ...
5,498,071
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2019-2021, 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 ...
If we've reached here, we've already confirmed that sum(sendLengths) == sendsData.length
function processOutgoingMessages(bytes calldata sendsData, uint256[] calldata sendLengths) external override { require(msg.sender == rollup, "ONLY_ROLLUP"); uint256 messageCount = sendLengths.length; uint256 offset = 0; for (uint256 i = 0; i < messageCount; i++) {...
602,700
//SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "../interfaces/ITimelock.sol"; /** * @title Timelock contract * @author Taken from Compound Finance (COMP) and tweaked/detailed by Nobody (me) * @notice A timelock contract queues and executes proposals made through the Eternal Fund contract */ contra...
Queues a given proposal's action. target The address of the contract whose function is being called value The amount of AVAX being transferred in this transaction signature The function signature of this proposal's action data The function parameters of this proposal's action eta The estimated minimum UNIX time (i...
function queueTransaction(address target, uint256 value, string memory signature, bytes memory data, uint256 eta) public override returns (bytes32) { require(msg.sender == fund, "Call must come from the fund"); require(eta >= block.timestamp + delay, "Delay is not over yet"); bytes32 txHash...
12,539,709
./full_match/4/0x0D0eC8c4a8Af6D666C916A422D17e909b97aAa09/sources/oracle.sol
if responsew time window is over or all delegates have voted, anyone can finalize the request to trigger the eventcheck to see if chosen option already is accounted for, if so, add weight to it.add new unique optionwrite results in stone
function finalizeRequest(uint ticketID) public{ RequestTicket storage ticket = requestTickets[ticketID]; if(!ticket.finalized){ address watcher; int[] memory intOptions = new int[](hotSeats); bytes[] memory bytesOptions = new bytes[](hotSeats); address[] memory addressOptions = new address[](ho...
679,332
pragma solidity ^0.4.21; // Dev fee payout contract + dividend options // EtherGuy DApp fee will be stored here // Buying any token gives right to claim part of development dividends. // It is suggested you do withdraw once in a while. If someone still finds an attack after this fixed contrat // they are unable the...
>MINT IT EG HE PGMyTokens[address(0x0)] = 400000; Since not a lot of addresses bought, we can instantly restore this If this happens in the future, we will need users to do a single transaction to retrieve their tokens from previous contract and withdraw all amount immediately Below tokens are paid for - 0.5 szabo per ...
function Dividends() public { dev = msg.sender; MyTokens[address(0x83c0Efc6d8B16D87BFe1335AB6BcAb3Ed3960285)] = 200000; MyTokens[address(0x26581d1983ced8955C170eB4d3222DCd3845a092)] = 200000; MyTokens[address(0x3130259deEdb3052E24FAD9d5E1f490CB8CCcaa0)] = 100000; ...
5,959,083
./partial_match/1313161554/0x5A5301F9429818f01101744BE2fc9AD5510846AE/sources/PureFiFarming2.sol
Deposit LP tokens to PureFiFarming for Token allocation. validate received verificationData
function depositTo( uint16 _pid, uint256 _amount, address _beneficiary, bytes calldata _purefidata ) public payable override whenNotPaused withCustomAddressVerification(DEPOSIT_RULE, msg.sender, _purefidata) { _checkUserRegistration(_pid, _beneficiary); ...
16,950,661
pragma solidity ^0.5.7; pragma experimental ABIEncoderV2; // ------------------------------------------------------------------------ // Math library // ------------------------------------------------------------------------ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256){...
------------------------------------------------------------------------ Get all content ids for article ------------------------------------------------------------------------
function getAllContentForArticle(uint256 articleId) public view returns(Content[] memory content) { content = new Content[](countContentForArticle(articleId)); uint counter = 0; for(uint i=0;i<allContents.length;i++) { Content memory c = allContents[i]; if(c.articleId...
7,316,426
pragma solidity ^0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two numbers, reverts on overflow. */ function mul(uint256 _a, uint256 _b) internal pure returns (uint256) { // Gas optimization: this ...
Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred/
function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_value <= balances_[_from]); require(_value <= allowed_[_from][msg.sender]); require(_to != address(0)); balances_[_from] = balances_[_from].sub(_value); balances_[_to] = balances_[_to].add(_va...
12,946,264