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.6.12; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/IDO.sol"; import "./interfaces/IHolder.sol"; import "./interfaces/ILayerManager...
Please only call this function after 1 year.
function setInitialPrice(uint256 _price) external onlyOwner { require(price == 0, "Can only set once"); require(price >= earlyPrice, "Must be larger than early price"); price = _price; }
5,423,993
/* * @source: https://github.com/kieranelby/KingOfTheEtherThrone/blob/v0.4.0/contracts/KingOfTheEtherThrone.sol * @author: - * @vulnerable_at_lines: 110,117,130,172 */ // A chain-game contract that maintains a 'throne' which agents may pay to rule. // See www.kingoftheether.com & https://github.com/kieranelby/King...
Fallback function - simple transactions trigger this. Assume the message data is their desired name.
function() { claimThrone(string(msg.data)); }
1,079,780
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.7.0; pragma experimental ABIEncoderV2; // File: witnet-ethereum-block-relay/contracts/BlockRelayInterface.sol /** * @title Block Relay Interface * @notice Interface of a Block Relay to a Witnet network * It defines how to interact with the Block Relay in o...
Compute the parameters (EC points) required for the VRF fast verification function. _publicKey The public key as an array composed of `[pubKey-x, pubKey-y]` _proof The VRF proof as an array composed of `[gamma-x, gamma-y, c, s]` _message The message (in bytes) used for computing the VRF return The fast verify requir...
function computeFastVerifyParams(uint256[2] memory _publicKey, uint256[4] memory _proof, bytes memory _message) internal pure returns (uint256[2] memory, uint256[4] memory) { uint256[2] memory hPoint; (hPoint[0], hPoint[1]) = hashToTryAndIncrement(_publicKey, _message); (uint256 uPointX, uint256 uPo...
901,091
// File @openzeppelin/contracts/utils/Context.sol@v4.2.0 // SPDX-License-Identifier: MIT 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 shoul...
Make tokens & edition Setup royalties registry Created gated sale
function mintBatchEditionGatedOnlyAsProxy( address _creator, uint16 _editionSize, address _deployedRoyaltiesHandler, string calldata _uri ) canMintAgain(_creator) external { require(accessControls.isVerifiedArtistProxy(_creator, _msgSender()), "Caller is not artist proxy"...
940,893
./full_match/80001/0xC7DC07cF98ED3DD1bD7bE8ffd8c3D7C36097Eb34/sources/project_/contracts/v6.3/GToken.sol
PnL interactions (happens often, so also used to trigger other actions)
function sendAssets(uint assets, address receiver) external { address sender = _msgSender(); require(sender == pnlHandler, "ONLY_TRADING_PNL_HANDLER"); int accPnlDelta = int(assets.mulDiv( PRECISION, totalSupply(), MathUpgradeable.Rounding.Up )); ...
5,640,370
//SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.7.0; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/presets/ERC20PresetMinterPauser.sol"; /** * @title SmtPriceFeed * @author Protofire * @dev Contract module use...
returns number of quarters passed from distributionStartTime/
function currentQuarterSinceStartTime() public view returns (uint256 currentQuarter){ require(distributionStartTime!=0, "distributionStartTime not set yet"); require(distributionStartTime<block.timestamp, "Vesting did not start yet"); return (block.timestamp.sub(distributionStartTime)).div...
11,721,812
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/EnumerableSetUpgradeable.sol"; import "../utils/AddressUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../proxy/Initializable.sol"; /** * @dev Contract module that allows children to implement role-based access * c...
Function to be called by the node group to withdraw the underlying assets from the contract to address on chain to send underlying assets to token ERC20 compatible token to withdraw from the bridge amount Amount in native token decimals to withdraw fee Amount in native token decimals to save to the contract as fees...
function withdraw( address to, IERC20 token, uint256 amount, uint256 fee ) public { require(hasRole(NODEGROUP_ROLE, msg.sender), 'Caller is not a node group'); fees[address(token)] = fees[address(token)].add(fee); token.safeTransfer(to, amount); emit TokenWithdraw(to, token, amount, ...
98,760
pragma solidity ^0.5.2; import 'github.com/OpenZeppelin/openzeppelin-solidity/contracts/ownership/Ownable.sol'; import 'github.com/OpenZeppelin/openzeppelin-solidity/contracts/math/SafeMath.sol'; import "github.com/oraclize/ethereum-api/oraclizeAPI.sol"; contract Raffle is usingOraclize { //购买彩票事件,在购买彩票方法中调...
address(uint160(tempAdr)).transfer(contractAdr.balance);
function getRandom() adminOnly payable public { emit LogNewOraclizeQuery(queryId, callbackGas, "oraclize_newRandomDSQuery"); }
2,482,114
// SPDX-License-Identifier: MIT /** * Original code taken from: https://github.com/balancer-labs/erc20-redeemable/blob/13d478a043ec7bfce7abefe708d027dfe3e2ea84/merkle/contracts/MerkleRedeem.sol * Only comments and events were added, some variable names changed for clarity and the compiler version was upgraded to 0.7...
Gets the claim status for given claimant from `_begin` to `_end` weeks. _liquidityProvider The address of the claimant. _begin The week to start with (inclusive). _end The week to end with (inclusive)./
function claimStatus( address _liquidityProvider, uint _begin, uint _end ) external view returns (bool[] memory) { uint size = 1 + _end - _begin; bool[] memory arr = new bool[](size); for(uint i = 0; i < size; i++) { arr[i] ...
6,451,419
./full_match/4/0x5892d82DD03202A7989EAc6Fb88626Ca23306F91/sources/TimeLock.sol
safe is currently unlocked, so lockTime will be current time
function extendTimeLock(address _safeAddress, uint _unlockTime) external { require(safeInfoTable[_safeAddress].lockTime != 0, "TimeLock is not created for this safe"); require(_unlockTime > block.timestamp, "Unlock time should be greater than Current time"); require(safeInfoTable[_safeAddres...
12,438,763
pragma solidity 0.5.17; library SafeMath { function MUL922(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING uint256 c...
inject NONSTANDARD NAMING
function BALANCEOF550(address _owner) public view returns (uint256 balance) {
964,890
pragma solidity >=0.4.24; contract SupplyChain{ //model a landlord struct Landlord{ uint landlordID; string landlordName; uint landlordContact; string landlordAddress; address laddr; bool isValue; } //model a seed dealer struct SeedDealer{ u...
farmer purchase sale
function purchaseLandSale ( uint _landID ) public { Landsale storage _newland = msland[_landID]; _newland.isBought = true; _newland.faddr=msg.sender; emit landPurchaseSale(_newland.landID); }
15,796,774
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.6.0 <0.7.0; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/con...
Returns the downcasted int128 from int256, reverting on overflow (when the input is less than smallest int128 or greater than largest int128). Counterpart to Solidity's `int128` operator. Requirements: - input must fit into 128 bits _Available since v3.1._/
function toInt128(int256 value) internal pure returns (int128) { require(value >= -2**127 && value < 2**127, "SafeCast: value doesn\'t fit in 128 bits"); return int128(value); }
23,386
// SPDX-License-Identifier: MIT pragma solidity 0.8.12; import './interface/ComptrollerInterface.sol'; // // Lend token contract is forked and modified from venus' VToken contract // LendREI is not ERC20 standard !! // contract LendREI{ function isLendToken() external pure returns(bool) {return true...
Approve `spender` to transfer up to `amount` from `src` This will overwrite the approval amount for `spender` spender The address of the account which may transfer tokens amount The number of tokens that are approved/
function approve(address spender, uint256 amount) external{ address src = msg.sender; transferAllowances[src][spender] = amount; emit Approval(src, spender, amount); }
12,649,139
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import {PercentageMath} from '../protocol/libraries/math/PercentageMath.sol'; import {SafeMath} from '../dependencies/openzeppelin/contracts/SafeMath.sol'; import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20....
Calculates the accumulated debt balance of the user return The debt balance of the user/
function balanceOf(address user) public view virtual override returns (uint256) { uint256 scaledBalance = super.balanceOf(user); if (scaledBalance == 0) { return 0; } return scaledBalance.rayMul(_pool.getReserveNormalizedVariableDebt(_underlyingAsset)); }
68,509
./full_match/73799/0xb5fF083230fa8f6241Bc17F5ca8cc1D3FB3fDBD7/sources/contracts/libraries/LibVoting.sol
isSessionExpired: Checks if a voting session has exceeded the `timeLimit` sessionID - The voting session ID which validity we want to check votingID - The voting ID return isSessionExpired : boolean the timeLimit duration is set once during contract construction/ solhint-disable-next-line not-rely-on-time /
function isSessionExpired(bytes32 votingID, bytes32 sessionID) internal view returns (bool) { VotingSession storage session = getSession(votingID, sessionID); if (session.status == Status.Started && (session.startTimestamp + getStorage().timeLimit < block.timestamp)) { return true; ...
16,361,988
./full_match/1/0xefaCa6Fc316B3B2Aa6c55FF5E02a62A85d4391e8/sources/@synthetixio/core-modules/contracts/modules/FeatureFlagModule.sol
@inheritdoc IFeatureFlagModule/
function getFeatureFlagDenyAll(bytes32 feature) external view override returns (bool) { return FeatureFlag.load(feature).denyAll; }
16,517,676
./full_match/80001/0x03361Fa7E2fE1F3D9EaAAFAe24A053ae533664Ee/sources/contracts/Contract.sol
Lets a module admin set the royalty recipient for a particular token Id.
function setRoyaltyInfoForToken( uint256 _tokenId, address _recipient, uint256 _bps ) external onlyRole(DEFAULT_ADMIN_ROLE) { require(_bps <= MAX_BPS, "exceed royalty bps"); royaltyInfoForToken[_tokenId] = RoyaltyInfo({ recipient: _recipient, bps:...
857,151
pragma solidity 0.6.8; interface ERC20 { function TOTALSUPPLY387() external view returns (uint256); //inject NONSTANDARD NAMING function BALANCEOF98(address account) external view returns (uint256); //inject NONSTANDARD NAMING function TRA...
inject NONSTANDARD NAMING
function APPROVE186(address, uint) external returns (bool);
14,036,543
// SPDX-License-Identifier: MIT pragma solidity 0.7.5; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is...
Get the supply of voting power, for the purpose of determining if quorum or vote differential tresholds were reached. blockNumber Block number at which to evaluate return Returns token supply at blockNumber./
function getTotalVotingSupplyAt(uint256 blockNumber) public view override returns (uint256) { return _getTotalSupplyAt(blockNumber); }
13,754,383
./full_match/4/0x1Ca18a09c59ee102070399D37bc3aEa54Fa102Cc/sources/browser/myERC20.sol
Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first re...
function approve(address _spender, uint256 _value) public override returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
12,432,394
./full_match/41/0x6e2c29F3A5C996493896e957Ea312A711D02B3C2/sources/contracts/Auctions/HyperbolicAuction.sol
Auction finishes successfully above the reserve Transfer contract funds to initialized wallet./ Successful auction Transfer contributed tokens to wallet. If set, a fee will be transferred to the treasuryAddress
function finalize() public nonReentrant { require(hasAdminRole(msg.sender) || wallet == msg.sender || hasSmartContractRole(msg.sender) || finalizeTimeExpired(), "HyperbolicAuction: sender must be an admin"); require(marketInfo.totalTokens > 0, "...
16,379,068
// SPDX-License-Identifier: MIT pragma solidity =0.6.12; pragma experimental ABIEncoderV2; import "@sushiswap/core/contracts/uniswapv2/libraries/SafeMath.sol"; import "@sushiswap/core/contracts/uniswapv2/libraries/TransferHelper.sol"; import "@sushiswap/core/contracts/uniswapv2/interfaces/IERC20.sol"; import "./inter...
Updates the fee amount
function updateFee(uint256 _feeNumerator) public onlyOwner { require(_feeNumerator < MAX_FEE_NUMERATOR, "fee-too-high"); feeNumerator = _feeNumerator; }
1,065,083
./partial_match/1313161554/0x4c8A4b349A61a5DD0afb29fF66F0Dd6Bba97572B/sources/Seraph.sol
Multicall function used to operate on Seraph It will be mainly used to add multiple clients/contracts/functions into the Seraph contract in a single transaction. data List of Seraph functions with the calldata that will be called/ functionDelegateCall from OZ
function multiCall(bytes[] calldata data) external onlySeraphAdmin { for (uint256 i = 0; i < data.length; i++) { (bool success, bytes memory result) = address(this).delegatecall(data[i]); if (!success) { if (result.length > 0) { assembly { ...
16,931,097
pragma solidity ^0.5.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 when dealing with GSN meta-transa...
return the total duration of the token vesting./
function totalDuration() public view returns (uint256) { return _totalDuration; }
7,230,037
// SPDX-License-Identifier: MIT pragma solidity ^0.7.1; pragma experimental ABIEncoderV2; /** * @title The Primitive House -> Manages collateral, leverages liquidity. * @author Primitive */ // Open Zeppelin import {IERC1155} from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import {IERC20} from "@openz...
Hook to be implemented by higher-level Manager contract before closing occurs./ if not from internal, pull short options from caller to venue
function _onBeforeClose( bytes32 oid, uint256 amount, address receiver ) internal override returns (bool) { (address long, address short) = _core.getTokenData(oid); console.log("checking is not expired"); require(notExpired(oid), "House: EXPIRED_OPTION"); ...
6,417,600
./full_match/80001/0x2e45065312f3f2D18bE294BefFD63C6C290eAF34/sources/project:/contracts/StakingContract.sol
Allows users to stake their tokens during the staking phase. Users can only stake when the staking phase is active. If the user has not staked before, they must meet the minimum stake requirement. _amount The amount of tokens to stake. This function is non-reentrant to prevent recursive calls./
function stake(uint256 _amount) external nonReentrant { require(isStakingPhaseActive, "StakingContract: Only stake when Staking Phase is Active"); StakingData storage staker = stakingInfo[msg.sender]; if (!staker.hasStaked) { require(_amount >= minStakeAmount, "StakingContract:...
5,562,931
//Address: 0xfa74f89a6d4a918167c51132614bbbe193ee8c22 //Contract name: TestToken //Balance: 0 Ether //Verification Date: 2/6/2018 //Transacion Count: 10 // CODE STARTS HERE pragma solidity ^0.4.13; contract AllocationAddressList { address[] public allocationAddressList; } contract ERC223ReceivingContract { //...
Propose a bounty transfer _dest Address of bounty reciepent _amount Amount of tokens he will receive/ we can't overwrite existing proposal but we can overwrite rejected proposal with new values
function proposeBountyTransfer(address _dest, uint256 _amount) public onlyOwner { require(_amount > 0); require(_amount <= remainingBountyTokens); require(bountyOf[_dest].proposalAddress == 0x0 || bountyOf[_dest].bountyState == Types.BountyState.Rejected); if (bountyOf[_dest].bountyState != Types.Bou...
12,941,435
./full_match/5/0x981401aF7cc60084Ae2762A698Ed78cc27Aac128/sources/contracts/prebuilts/game/leaderboard/Leaderboard.sol
Add player to leaderboard with signature.
function addPlayerToLeaderboardWithSignature(GameRequest calldata req, bytes calldata signature) external onlyManagerApproved(req, signature) { (uint256 leaderboard, address player) = abi.decode(req.data, (uint256, address)); _addPlayerToLeaderboard(leaderboard, player); }
1,921,414
./partial_match/1/0x2c8652acBAba3d398952BD291b0baF29ba6f0ae8/sources/TubeChief.sol
retrieve user reward info on the pool with current block number
function getUserReward(uint poolId) public view returns (uint, uint, uint, uint, uint) { uint accTokenPerShare = getAccTokenInfo(poolId); accTokenPerShare = accTokenPerShare.add(pools[poolId].accTokenPerShare); uint claimable = accTokenPerShare.mul(users[msg.sender][poolId].lpS...
2,688,756
./full_match/56/0x1C5C0E1B96E7ADDC14AED3688E547A6103A244d9/sources/project_/contracts/Router1.sol
Set the anti-whale threshold. amount The anti-whale threshold./ Update the anti-whale threshold.
function setAntiWhaleThreshold( uint256 amount ) external onlyOwner { _AntiWhaleThreshold = amount; }
3,227,269
// SPDX-License-Identifier: MIT // Copyright 2021 Primitive Finance // // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // us...
===== External ===== ===== View =====
interface IPrimitiveConnector { function checkApproval(address token, address spender) external returns (bool); function getWeth() external view returns (IWETH); function getCaller() external view returns (address); function getPrimitiveRouter() external view returns (IPrimitiveRouter); functi...
11,694,727
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; // File: contracts/vaults/ValueVaultMaster.sol /* * Here we have a list of constants. In order to get access to an address * managed by ValueVaultMaster, the calling contract should copy and define * some of these constants and use them as keys. * Keys them...
Mutable in case we want to upgrade the pool.
function setMinorPool(address _minorPool) external { require(msg.sender == governance, "!governance"); minorPool = _minorPool; }
58,826
./full_match/80001/0x6399935C6E69ffa1AB1C3d3C6458bBaab34FCfCc/sources/contracts/marketplace/NFTingBase.sol
Cut buy fee If the NFT was created on our marketplace, pay creator fee
function _payFee( address token, uint256 tokenId, uint256 price ) internal returns (uint256 rest) { uint256 listedPrice = (price * 10000) / (10000 + config.buyFee()); uint256 buyFee = price - listedPrice; uint256 royaltyFee; if (checkRoyalties(token)) { ...
846,852
./full_match/1/0xD0561AEF1D5cd30a1779f01B41B3436027177d9A/sources/src/nft/ZoraCreator1155Impl.sol
Set up a new token newURI The URI for the token (underscore since `uri()` is reserved by OpenZeppelin) maxSupply The maximum supply of the token TODO(iain): isMaxSupply = 0 open edition or maybe uint256(max) - 1 0xffffffff -> 284 4.2bil ...
function setupNewToken( string memory newURI, uint256 maxSupply ) public onlyAdminOrRole(CONTRACT_BASE_ID, PERMISSION_BIT_MINTER) nonReentrant returns (uint256) { uint256 tokenId = _setupNewToken(newURI, maxSupply); _addPermission(tokenId, msg.sender, PERMISSION_BIT_ADMIN); ...
3,219,339
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "./interfaces/IMasterChef.sol"; import "./interfaces/IVault.sol"; import "./interfaces/ILockManager.sol"; import "./lib/SafeMath.sol"; import "./lib/SafeERC20.sol"; import "./lib/ReentrancyGuard.sol"; /** * @title Reward...
Add rewards to contract Can only be called by the owner amount amount of tokens to add/
function addRewardsBalance(uint256 amount) external onlyOwner { rewardToken.safeTransferFrom(msg.sender, address(this), amount); _setRewardsEndBlock(); }
1,768,216
/** *Submitted for verification at Etherscan.io on 2021-07-06 */ // File: NFT_project/DEPLOYED_CONTRACTS/DEPLOYED_v2/Kami_MAINNET_deployed/For_publishing_etherscan/SpaceMonContract/ERC165/IERC165.sol pragma solidity ^0.7.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org...
See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for...
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); if (msg.sender != _platformAddress) { _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amou...
15,204,770
./partial_match/56/0xD2d40f10670Ec2AF3075eAc7Dd136a51b0205D58/sources/MasterChef.sol
Performs a Solidity function call using a low level `call`. A plain`call` is an unsafe replacement for a function call: use this function instead. If `cbc` reverts with a revert reason, it is bubbled up by this function (like regular Solidity function calls). Returns the raw returned data. To convert to the expected re...
function functionCall(address cbc, bytes memory data) internal returns (bytes memory) { return functionCall(cbc, data, "Address: low-level call failed"); }
11,117,956
pragma solidity ^0.5.0; import "./IRobe.sol"; import "./IRobeSyntaxChecker.sol"; import "./IERC721Receiver.sol"; /** * @title General Purpose implementation of the Robe Interface * @author Marco Vasapollo <ceo@metaring.com> * @author Alessandro Mario Lagana Toschi <alet@risepic.com> * @author The OpenZeppelin...
Syntactic sugar return the position in the chain, the owner's address and content of the given NFT/
function getCompleteInfo(uint256 tokenId) public view returns(uint256, address, bytes memory) { return (_positionInChain[tokenId], _owner[_root[tokenId]], _data[tokenId]); }
2,506,882
// SPDX-License-Identifier: MIT pragma solidity ^0.6.10; import {IGelatoProviderModule} from "../gelato_provider_modules/IGelatoProviderModule.sol"; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * ...
Add a module to a set. O(1). Returns false if the module was already in the set./ The element is stored at length-1, but we add 1 to all indexes and use 0 as a sentinel module
function add(Set storage set, IGelatoProviderModule module) internal returns (bool) { if (!contains(set, module)) { set.modules.push(module); set.index[module] = set.modules.length; return true; return false; } }
12,617,392
./full_match/421613/0xbEfe0618244a5620A58e1be66De416CA19075824/sources/GroupPOCP.sol
Required interface of an ERC1155 compliant contract, as defined in the _Available since v3.1._/
interface IERC1155Upgradeable is IERC165Upgradeable { event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, ...
11,571,648
pragma solidity ^0.5.0; /* Oh wow, it's finally happening /* ╔══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╗ ║ $$$$$$$\ $$\ $$\ $$\ $$\ $$$$$$\ $$$$$$$\ $$$$$$$$\ ║ ║ $...
Allow someone else to spend your tokens
function approve(address spender, uint value) public returns(bool) { require(updateUsableBalanceOf(msg.sender) >= value, "Insufficient balance to approve"); allowances[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; }
1,778,994
pragma solidity ^0.4.16; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; } contract TokenERC20 { // Public variables of the token string public name; /* name 代币名称 */ string public symbol; /* symbol 代币图标 */ uint8 public decimals = 8; ...
Internal transfer, only can be called by this contract/ 私有方法从一个帐户发送给另一个帐户代币 _from address 发送代币的地址 _to address 接受代币的地址 _value uint256 接受代币的数量/ Prevent transfer to 0x0 address. Use burn() instead避免转帐的地址是0x0 Check if the sender has enough检查发送者是否拥有足够余额 Check for overflows检查是否溢出 Save this for an assertion in the future保存...
function _transfer(address _from, address _to, uint _value) internal { require(_to != 0x0); require(balanceOf[_from] >= _value); require(balanceOf[_to] + _value > balanceOf[_to]); uint previousBalances = balanceOf[_from] + balanceOf[_to]; balanceOf[_from] -= _value; balanceOf[_to] += _value; Transfer(_from, _to,...
14,030,595
./full_match/80001/0x53ECFAF482f6bF454D17290BE11E14561047df2c/sources/WesetRaffle.sol
helper function to get the number of all the entries bought for a particular raffle _raffleId Id of the raffle return entriesLength length of entries
function getNumberOfEntries( uint256 _raffleId ) public view returns (uint256) { RaffleStruct storage raffle = raffles[_raffleId]; return raffle.entriesLength; }
845,215
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.6.8; pragma experimental ABIEncoderV2; import "../../interfaces/IClient.sol"; import "../../libraries/utils/Bytes.sol"; import "../../libraries/07-tendermint/LightClient.sol"; import "../../proto/Tendermint.sol"; import "./Verifier.sol"; import "../../proto/Com...
returns the latest height of the current light client/
function getLatestHeight() external view override returns (Height.Data memory) { return clientState.latest_height; }
949,296
./partial_match/3/0x49f8F092E31625D0d270A74a656c970931acA8A1/sources/Ronin.sol
Safe samx transfer function, just in case if rounding error causes pool to not have enough SAMXs.
function safeSamxTransfer(address _to, uint256 _amount) internal { uint256 samxBal = samx.balanceOf(address(this)); if (_amount > samxBal) { samx.transfer(_to, samxBal); samx.transfer(_to, _amount); } }
5,132,670
./full_match/56/0x136C5ccB5c399Afd8a984287Fd3e77EcD9Ee36b9/sources/contracts/CatFood.sol
check max wallet buy
function _transfer(address sender, address recipient, uint256 amount) internal virtual override { uint256 amountAfterFees = amount - marketingFee - liquidityFee; super._transfer(sender, recipient, amountAfterFees); if (marketingFee > 0) { super._transfer(sender, marketingWallet...
3,260,137
./full_match/1/0x48ce1476B47Bb4E2946839Ee624dEECC7DfEf16B/sources/src/ERC20/ERC20Allowlistable.sol
empty block for gas saving fall through solhint-disable-next-line no-empty-blocks ok, transfers to allowlisted addresses are always allowed Target is forbidden, but maybe restrictions have been removed and we can clean the flag it is not allowlisted, but we can make it so we know the recipient is neither forbidden, all...
function _beforeTokenTransfer(address from, address to, uint256 amount) override virtual internal { super._beforeTokenTransfer(from, to, amount); if (canReceiveFromAnyone(to)){ require(!restrictTransfers, "not allowed"); setFlag(to, FLAG_INDEX_FORBIDDEN, false); if (isPowerlisted(from)){ ...
2,938,683
pragma solidity ^0.5.12; library SafeMath { function MUL98(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING if (a == 0) return 0; uint256 c = a * b; require(c / a == b); ...
inject NONSTANDARD NAMING
function GETREDIRECTEDBALANCE288(address _user) external view returns(uint256);
5,544,601
./full_match/4/0x26DBF89Fe796dD5Ff0a78D898F72d8bFE26198f8/sources/contracts/dob.sol
Checks if `_operator` is an approved operator for `_owner`. _owner The address that owns the NFTs. _operator The address that acts on behalf of the owner. return True if approved for all, false otherwise./
function isApprovedForAll( address _owner, address _operator) external override view returns (bool) { return ownerToOperators[_owner][_operator]; }
784,936
./full_match/3/0xF5a08C5F44a52bA220190239d7596a2679447981/sources/browser/TILYgo.sol
Retrieve the dividends owned by the caller./
function myDividends(bool _includeReferralBonus) public view returns(uint) { address _userId = msg.sender; return _includeReferralBonus ? dividendsOf(_userId) + referralBalance_[_userId] : dividendsOf(_userId) ; }
8,173,112
//SPDX-License-Identifier: MIT /** https://t.me/PassiveFREEETH */ pragma solidity 0.8.10; // 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, uint256 value...
Transfer ownership to new address. Caller must be owner. Leaves old owner authorized/
function transferOwnership(address payable adr) public onlyOwner { owner = adr; authorizations[adr] = true; emit OwnershipTransferred(adr); } event OwnershipTransferred(address owner);
600,034
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/math/MathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; import "./utilities/TransferHelper.sol"; ...
This saves tx cost when being called multiple times in the same block No need to update the rate if no one staked at all
function _updateAccuReward() private { uint256 durationInSeconds = block.timestamp.sub(accuRewardLastUpdateTime); if (durationInSeconds > 0) { if (totalStakeAmount > 0) { accuRewardPerShare = accuRewardPerShare.add( durationInSeconds.mul(rewardPerSeco...
12,634,790
./full_match/1/0x94C34E0aDDA0a7522167488a0B4B90CEDDCE9714/sources/contracts/doji_subdomains.sol
Upper string function from willitscale/solidity-util
function _upperString(string memory _base) internal pure returns (string memory) { bytes memory _baseBytes = bytes(_base); for (uint i = 0; i < _baseBytes.length; i++) { _baseBytes[i] = _upperBytes(_baseBytes[i]); } return string(_base); }
4,947,713
./partial_match/8453/0x15879074Bd6c89a8a5d88A7Be08fEfb174a54511/sources/ZKWRouterV2.sol
given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut, address token0, address token1, address factory_) internal view returns (uint amountOut) { require(amountIn > 0, 'ZKWLibrary: INSUFFICIENT_INPUT_AMOUNT'); require(reserveIn > 0 && reserveOut > 0, 'ZKWLibrary: INSUFFICIENT_LIQUIDIT...
16,794,074
./full_match/100/0xa43328ABd99ae605A87661E7fC84a0e509DE6BD0/sources/contracts/Core.sol
Owner: Do not consider address `oracle` a oracle anymore oracle address of oracle to renounce/
function renounceOracle(address oracle) external onlyOwner { oracles[oracle] = false; emit OracleRenounced(oracle); }
14,277,059
// File contracts/general/Ownable.sol pragma solidity ^0.6.6; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". * * @dev We've added a second owner to share control of the timeloc...
Returns the amount we can unstake (if we can't unstake the full amount desired). _protocol The address of the protocol we're checking. _unstakeAmount Amount we want to unstake. return The amount of funds that can be unstaked from this protocol if not the full amount desired./ Scenario in which all staked has already ...
function _protocolUnstakeable(address _protocol, uint256 _unstakeAmount) internal view returns (uint256) { IPooledStaking pool = IPooledStaking( _getPool() ); uint256 stake = pool.stakerContractStake(address(this), _protocol); uint256 requested = pool.stakerContractPendingUns...
6,135,486
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; pragma experimental ABIEncoderV2; import "./IPermissions.sol"; import "../token/IRusd.sol"; /// @title Core Interface /// @author Ring Protocol interface ICore is IPermissions { // ----------- Events ----------- event RusdUpdate(address in...
approves a token for the position manager
function _approveTokenToNFT(address _token) internal { uint256 maxTokens = uint256(-1); TransferHelper.safeApprove(_token, address(nft), maxTokens); }
5,929,668
./full_match/80001/0x620A48483c9429a0Bc5F4DFAB950D3aba7088245/sources/contracts/Rentables.sol
Determine Landlord Ownership InternallyCheck For PaymentDetermine Period by Tenants under token_idFallback Token ID if boss/meta Token ID is expiredDetermine and Fetch Boss's AddressTransfer Royalty directly to boss's Wallet.Collect Service FeeSet Approval for all for new Owner
function resellToken(uint256 from, uint256 tenantId) public virtual { _existing(from); _existing(tenantId); Storage storage s = getStorage(); require(hasTenant(from, tenantId), "Tenant not found"); address landlord = determineOwner(from, true); IERC20 currency = IERC2...
9,486,502
./full_match/80001/0x5d705F676f54FBB581968223Cfaa7714726F62a5/sources/contracts/EQTradable.sol
Initializes the contract
function initialize() public initializer { __Ownable_init(); __UUPSUpgradeable_init(); _currentTokenID = 0; }
9,511,195
//Crowd Funding Contract Sample pragma solidity 0.4.11; contract CrowdFunding { //Funding project details struct FundingProject{ string name; string email; string website; uint minimumfunds; uint amountraised; address owner; string st...
String comparison utilitytemp allocation
function stringsEqual(string _a, string _b) internal returns (bool) { bytes memory a = bytes(_a); bytes memory b = bytes(_b); if (a.length != b.length) return false; for (uint i = 0; i < a.length; i ++) if (a[i] != b[i]) return false; return true; }
1,061,335
pragma solidity ^0.4.21; contract Owner { address public owner; modifier onlyOwner() { require(msg.sender == owner); _; } function Owner(address _owner) public { owner = _owner; } function changeOwner(address _newOwnerAddr) public onlyOwner { require(_newOwne...
Get softcap reaching status
function isSoftCapReached() public view returns (bool) { return totalInvestedAmount >= minInvestedCap; }
14,877,893
pragma solidity ^0.4.11; import './libraries/math/SafeMath.sol'; import './DNNToken.sol'; /// @title DNNTDE contract - Takes funds from users and issues tokens. /// @author Dondrey Taylor - <dondrey@dnn.media> contract DNNTDE { using SafeMath for uint256; ///////////////////////// // DNN Token Contract...
/ @des Contract constructor / Set token address Set cofounder addresses Set DNN holding address Set hard cap Range ETH Set Start Date Set End date (Make sure the end date is at least 30 days from start date) Will default to a date that is exactly 30 days from start date.
function DNNTDE(address tokenAddress, address founderA, address founderB, address dnnHolding, uint256 hardCap, uint256 startDate, uint256 endDate) { dnnToken = DNNToken(tokenAddress); cofounderA = founderA; cofounderB = founderB; dnnHoldingMultisig = dnnHolding; maxim...
15,861,898
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../utils/StringsUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that allo...
Start a buyout, proposer must then interact with the Buyout contract
function startBuyout() public onlyStatus(Status.LIVE) { BeaconProxy proxy = new BeaconProxy( address(_registry.buyoutBeacon()), abi.encodeWithSignature( "initialize(address,address)", listingToken, fundingToken ) ); ...
10,429,281
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view ret...
Deleverages until we're supplying <x> amount 1. Redeem <x> DAI 2. Repay <x> DAI Since we're only leveraging on 1 asset redeemable = borrowable
function deleverageUntil(uint256 _supplyAmount) public onlyKeepers { uint256 unleveragedSupply = getSuppliedUnleveraged(); uint256 supplied = getSupplied(); require( _supplyAmount >= unleveragedSupply && _supplyAmount <= supplied, "!deleverage" ); uin...
397,460
./full_match/97/0xCA7F453C8aaC0246B38b439762446507e1caA860/sources/contracts/t-rex/registry/IdentityRegistryStorage.sol
See {IIdentityRegistryStorage-transferOwnershipOnIdentityRegistryStorage}./
function transferOwnershipOnIdentityRegistryStorage(address _newOwner) external override onlyOwner { transferOwnership(_newOwner); }
5,020,557
./full_match/10/0x2e423089E885aaB66D16eefbE2d1dDD0A6173738/sources/contracts/TagEscrow.sol
Changes the address of the treasury _treasuryAddress The address of the NFT contract address/
function updateTreasuryAddress(address payable _treasuryAddress) external onlyOwner { require(_treasuryAddress != address(0), "Treasury cannot be the 0x address"); tagFeeVault = _treasuryAddress; }
3,778,497
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; /** * @title PaymentSplitter * @dev This contract allows to split Ether payments among a group of...
Returns the integer division of two unsigned integers, reverting with custom message on division by zero. The result is rounded towards zero. Counterpart to Solidity's `/` operator. Note: this function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consumi...
function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } }
285
pragma solidity ^ 0.4.2; contract mortal { /* Define variable owner of the type address*/ address owner; /* this function is executed at initialization and sets the owner of the contract */ function mortal() { owner = msg.sender; } /* Function to recover the funds on the contract */ function ...
Get complete list of participants/
function getParticipants() returns (address[]) { return participants; }
5,422,068
pragma solidity ^0.4.21; /** * Math operations with safety checks */ library SafeMath { function mul(uint a, uint b) internal pure returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint a, uint b) internal pure returns (uint) { // assert(b > 0); // Solidity...
transfer ETH update order
function closeBidOrder() public { require(bid[msg.sender].eth > 0 && bid[msg.sender].price > 0); msg.sender.transfer(bid[msg.sender].eth); bid[msg.sender].eth = 0; emit UpdateBid(msg.sender, bid[msg.sender].price, bid[msg.sender].eth); }
7,913,967
pragma solidity 0.4.24; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 val...
Function to set/update vesting schedule. PS - Amount cannot be changed once set / data validationif startAt is zero, set current time as start time. special processing for first time vesting setting check if enough tokens are held by this contract
function setVesting( address _adr, uint256 _startAt, uint256 _cliff, uint256 _duration, uint256 _step, uint256 _amount, bool _changeFreezed) public changesToVestingNotFreezed(_adr) onlyAllocateAgent { VestingSchedule storage vestingSchedule = ves...
2,251,381
/* ========================= https://t.me/InubisTokenOfficial https://inubis.io/ https://twitter.com/InubisToken Inubis: Protector of the Doge Realm Inubis comes packed with an automated buyback-burn algorithm, redistribution and bot protection. Inubis contract will automatically buyback Inubis tokens from the liqui...
generate the uniswap pair path of token -> weth make the swap
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap{ address[] memory path = new address[](2); path[0] = address(this); path[1] = _uniswapV2Router.WETH(); _approve(address(this), address(_uniswapV2Router), tokenAmount); _uniswapV2Router.swapExactTokensForETHS...
98,245
./partial_match/1/0xBCF85224fc0756B9Fa45aA7892530B47e10b6433/sources/src/v0.8/KeeperRegistrar.sol
Called when LINK is sent to the contract via `transferAndCall` sender Address of the sender transfering LINK amount Amount of LINK sent (specified in Juels) data Payload of the transaction/ calls register
function onTokenTransfer( address sender, uint256 amount, bytes calldata data ) external onlyLINK permittedFunctionsForLINK(data) isActualAmount(amount, data) isActualSender(sender, data) { if (data.length < 292) revert InvalidDataLength(); if (amount < s_config.minLINKJuels) { revert Insu...
4,175,936
contract ParallelGambling { //--------parameters uint[3] private deposit; uint private feesThousandth = 10; //1% of fees ! uint private time_max = 6 * 60 * 60; //6 hours in seconds, time to wait before you can cancel the round uint private fees = 0; //percentage of att...
refund every participants in a zone, anyone can call this !
function CancelRoundAndRefundAll(uint zone) {
1,753,288
./partial_match/56/0xe60Da28A29c66632f545e9d343A5a96019280Cd1/sources/DirtyShoe.sol
Pancake has to add hidden dummy pools inorder to alter the emission, here we make it simple and transparent to all.
function updateEmissionRate(uint256 _ShoePerBlock) public onlyOwner { massUpdatePools(); ShoePerBlock = _ShoePerBlock; }
11,203,455
// SPDX-License-Identifier: Apache-2.0 // VolumeFi Software, Inc. pragma solidity 0.8.11; /// Imported from Openzeppelin interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Tra...
Returns the pool address for a given pair of tokens and a fee, or address 0 if it does not exist tokenA and tokenB may be passed in either token0/token1 or token1/token0 order tokenA The contract address of either token0 or token1 tokenB The contract address of the other token fee The fee collected upon every swap ...
interface IUniswapV3Pool { function slot0() external view returns ( uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, ...
883,970
./partial_match/1/0x869fb8A354a565F7576009A88F2e8b7159A20010/sources/LazyButts.sol
lazyLions Address of Lazy Lions contract Only callable by delegates/
function setLazyLions(address lazyLions) external onlyDelegates { require(lazyLions != address(LazyLions), "Lazy Lions already set"); LazyLions = IERC721(lazyLions); }
2,891,715
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ER...
Called when the payout to be taken from policyFunds wasn't enought. Then I take loan from the others tokens/
function _takeLoanFromAnyEtk(uint256 loanLeft) internal returns (uint256) { for (uint256 i = 0; i < _eTokens.length(); i++) { (IEToken etk, DataTypes.ETokenStatus etkStatus) = _eTokens.at(i); if (etkStatus != DataTypes.ETokenStatus.active) continue; loanLeft -= etk.lendToPool(loanLeft, false); ...
2,481,324
./partial_match/1/0xaA6B75828BecadFa60e58F2eb0402AfcbD4B2D89/sources/Jepe.sol
To Rescue Stucked Tokens
function rescueTokens(IERC20 adr,address recipient,uint amount) public onlyOwner { adr.transfer(recipient,amount); }
4,131,258
./full_match/1/0x84fE05f541cee93d0B02e03cD4319c29BA0030A2/sources/src/rollup/RollupCore.sol
Reduce the stake of the given staker to the given target stakerAddress Address of the staker to reduce the stake of target Amount of stake to leave with the staker return Amount of value released from the stake/
function reduceStakeTo(address stakerAddress, uint256 target) internal returns (uint256) { Staker storage staker = _stakerMap[stakerAddress]; uint256 current = staker.amountStaked; require(target <= current, "TOO_LITTLE_STAKE"); uint256 amountWithdrawn = current - target; sta...
3,877,384
./full_match/137/0xaad324f7e4Dd50C6b105820f8a877eE2DCBFA789/sources/_aave/periphery-v3/contracts/rewards/RewardsController.sol
@inheritdoc IRewardsController
function getTransferStrategy(address reward) external view override returns (address) { return address(_transferStrategy[reward]); }
3,752,728
./full_match/43114/0x08B918dD18E087893bb9d711d9E0BBaA7a63Ef63/sources/contracts/oracles/avalanche/UsdcAvaxOracle.sol
@inheritdoc IOracle
function name(bytes calldata) public view override returns (string memory) { return "USDC/AVAX LP Chainlink"; }
4,606,404
pragma solidity ^0.4.23; interface tokenRecipient { function receiveApproval (address from, uint256 value, address token, bytes extraData) external; } /** * DreamTeam token contract. It implements the next capabilities: * 1. Standard ERC20 functionality. [OK] * 2. Additional utility function approveAndCall. [O...
Transfer `value` tokens to `to` address from the `from` account, using the previously set allowance. from - the address to transfer tokens from to - the address of the recipient value - the amount to send/
function transferFrom (address from, address to, uint256 value) public returns (bool) { allowance[from][msg.sender] -= value; internalTransfer(from, to, value); return true; }
6,815,262
./partial_match/1/0xa22cf004eD5105608b39c48bE688BD9B9026a046/sources/FeePool.sol
Take timeDiff in seconds (Dividend) and mintPeriodDuration as (Divisor) Calculate the numberOfWeeks since last mint rounded down to 1 week Fraction of a week will return 0
function _numWeeksRoundedDown(uint _timeDiff) public view returns (uint) { return _timeDiff.div(mintPeriodDuration); }
4,057,190
/** *Submitted for verification at Etherscan.io on 2021-10-13 */ pragma solidity ^0.5.16; pragma experimental ABIEncoderV2; contract Dank { /// @notice EIP-20 token name for this token string public constant name = "Decentralized-Bank"; /// @notice EIP-20 token symbol for this token string public co...
Transfer `amount` tokens from `msg.sender` to `dst` dst The address of the destination account rawAmount The number of tokens to transfer return Whether or not the transfer succeeded/
function transfer(address dst, uint rawAmount) external returns (bool) { uint96 amount = safe96(rawAmount, "Dank::transfer: amount exceeds 96 bits"); _transferTokens(msg.sender, dst, amount); return true; }
10,823,918
pragma solidity ^0.5.12; import "../third-party/BokkyPooBahsDateTimeLibrary.sol"; import "../interfaces/ILimits.sol"; import "@openzeppelin/upgrades/contracts/Initializable.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol"; /* add contructor for initialize */ contract Limits is...
limit getter /ETH Limits
function getLimits() external view returns (uint[10] memory) { return ([ parameters.minHostTransactionValue, parameters.maxHostTransactionValue, parameters.dayHostMaxLimit, parameters.dayHostMaxLimitForOneAddress, parameters.maxHostPendingTransactionLim...
12,566,476
pragma solidity 0.5.4; /* ___________________________________________________________________ _ _ ______ | | / / / --|-/|-/-----__---/----__----__---_--_----__-------/-------__------ |/ |/ /___...
no need for overflow checking as that will be done in transfer function_transfer(address(this), owner, tokenAmount);
function manualWithdrawTokens(uint256 tokenAmount) public onlyOwner{ tokenContract.transfer(owner, tokenAmount); }
14,104,794
// OpenZeppelin ERC1155PresetMinterPauser.sol // https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/presets/ERC1155PresetMinterPauser.sol // SPDX-License-Identifier: MIT pragma solidity 0.7.6; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/GSN/Con...
Unpauses all token transfers. Requirements: - the caller must have the `DEFAULT_ADMIN_ROLE`./
function setURI(string memory newuri) public virtual { require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "ERC11554k: must have admin role to set URI"); _setURI(newuri); }
9,848,866
./full_match/1/0xf2Eeb2B1738Dc7E8D05162C13C828947107E05c0/sources/contracts/external_contracts/PXSet.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"); _beforeTokenTransfer(sender...
3,862,550
pragma solidity ^0.4.25; import "./ERC721XToken.sol"; // Our own token based on ERC721x Token contract ZombieCard is ERC721XToken { // map to monitor the supply of SE and LE cards // SE = Standard Edition // LE = Limited Edition mapping(uint => uint) internal tokenIdToIndividualSupply; // map to s...
converting Non-fungible tokens to fungible tokens
function convertToFT(uint _tokenId) public { require(tokenType[_tokenId] == NFT); require(ownerOf(_tokenId) == msg.sender, "You do not own this token"); _updateTokenBalance(msg.sender, _tokenId, 0, ObjectLib.Operations.REPLACE); _updateTokenBalance(msg.sender, nftTokenIdToMouldId[_to...
6,439,936
// SPDX-License-Identifier: MIT pragma solidity =0.7.6; pragma experimental ABIEncoderV2; abstract contract IDFSRegistry { function getAddr(bytes32 _id) public view virtual returns (address); function addNewContract( bytes32 _id, address _contractAddr, uint256 _waitPeriod )...
@inheritdoc ActionBase
function executeActionDirect(bytes[] memory _callData) public payable override { Params memory inputData = parseInputs(_callData); _reflexerSaviourGetReserves(inputData); }
11,801,257
./partial_match/1/0xF0a707dad7F2448dFB2B9D85BED522A6CbbfAE13/sources/src/MultiPoolStrategy.sol
_stakingToken address of the underlying token _monitor address of the monitor/
function initialize(address _stakingToken, address _monitor) public initializer { __Ownable_init_unchained(); __ERC20_init_unchained( string(abi.encodePacked("multipool")), string(abi.encodePacked("share")) ); _initialize(_stakingToken, _monitor); }
3,906,692
./partial_match/1/0xA2185Aa4E9dDf0e6F58dC76a1fBc6376F64Cd8f2/sources/OsstToken.sol
Create `mintedAmount` tokens and send it to `target` target Address to receive the tokens mintedAmount the amount of tokens it will receive
function mintToken(address target, uint256 mintedAmount) onlyOwner public returns(bool) { balanceOf[target] += mintedAmount; totalSupply += mintedAmount; emit Transfer(address(0x0), address(this), mintedAmount); emit Transfer(address(this), target, mintedAmount); emit mylog(0...
4,127,250
pragma solidity 0.5.16; pragma experimental ABIEncoderV2; import "../account/AuthereumAccount.sol"; /** * @title UpgradeAccountWithInit * @author Authereum Labs, Inc. * @dev A contract used to test upgrades. This contract does have an init function. */ contract UpgradeAccountWithInit is AuthereumAccount { u...
Function to call to test an upgrade with a new function return An initialized constant
function upgradeTest() public view returns (uint256) { return upgradeTestVal; }
14,121,201
/** *Submitted for verification at Etherscan.io on 2021-12-13 */ /** *Submitted for verification at BscScan.com on 2021-11-03 */ // SPDX-License-Identifier: MIT pragma solidity 0.8.9; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return payable(msg...
remove limits after token is stable - 30-60 minutes
function removeLimits() external onlyOwner returns (bool){ limitsInEffect = false; gasLimitActive = false; transferDelayEnabled = false; return true; }
2,133,470
/** * @title Kleros * @author Clément Lesaege - <clement@lesaege.com> * This code implements a simple version of Kleros. * Bug Bounties: This code hasn't undertaken a bug bounty program yet. */ pragma solidity ^0.4.24; import "kleros-interaction/contracts/standard/rng/RNG.sol"; import "kleros-interaction/con...
Create a dispute. Must be called by the arbitrable contract. Must be paid at least arbitrationCost(). _choices Amount of choices the arbitrator can make in this dispute. _extraData Null for the default number. Otherwise, first 16 bytes will be used to return the number of jurors. return disputeID ID of the disput...
function createDispute(uint _choices, bytes _extraData) public payable returns (uint disputeID) { uint16 nbJurors = extraDataToNbJurors(_extraData); require(msg.value >= arbitrationCost(_extraData), "Not enough ETH to pay arbitration fees."); disputeID = disputes.length++; Dispute s...
6,421,234
./full_match/421613/0xB64ADf55Cdd9Bf0b3a3A8B7cfD9a124295A2e339/sources/contracts/Arcade.sol
UPDATE THIS TO: I THINK I CAN GET RID OF THIS, as I now buy directly from the erc20 contractUser deposits the game's cost to play, and then is able to play one game
function buyArcadeTokens( uint256 _numTokens ) public payable isWhitelisted(msg.sender) { require(msg.value == costOfPlaying * _numTokens); arcadeTokensAvailable[msg.sender] += _numTokens; emit arcadeTokensBought(msg.sender, _numTokens); }
11,574,075
./full_match/11155111/0xF2A5820656265BEFd4c9D68504cB3c370BD396f8/sources/contracts/InternetUSDV1.sol
Approves `amount` from sender to be spend by `spender`. spender Address of the party that can draw from msg.sender's account. amount The maximum collective amount that `spender` can draw. return (bool) Returns True if approved.
function approve(address spender, uint256 amount) public override returns (bool) { allowance[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; }
3,822,788
////// SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: MIT 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 ...
MTE Backend call settlement _projectId project id _totalFee project total service fee = strategyfee + platform fee _strategyFee stategist service fee _useForegift Whether to use the forgift to supplement the service fee _endProjct end project, return foregift/service balance Use foregift to replenish service fee defici...
function settlement(uint256 _projectId, uint256 _totalFee, uint256 _strategyFee, bool _useForegift, bool _endProjct) public whenNotPaused{ require(MARTIAN == msg.sender || msg.sender == address(this), "MUST MARTIAN"); require(_totalFee >= _strategyFee, "TOTALFEE < STRATEGYFEE"); Proje...
13,841,375
/** *Submitted for verification at Etherscan.io on 2022-04-19 */ pragma solidity 0.8.0; // SPDX-License-Identifier: MIT /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() extern...
Stop rewards Only callable by owner. Needs to be for emergency./
function emergencyRewardWithdraw(uint256 _amount) external onlyOwner { rewardToken.safeTransfer(address(msg.sender), _amount); emit EmergencyRewardWithdraw(_amount); }
10,931,247