file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
pragma solidity 0.4.18; /** * For convenience, you can delete all of the code between the <ORACLIZE_API> * and </ORACLIZE_API> tags as etherscan cannot use the import callback, you * can then just uncomment the line below and compile it via Remix. */ //import "github.com/oraclize/ethereum-api/oraclizeAPI.so...
Payable function for receiving dividends from the P4D and P3D contracts/ only accept ETH payments from P4D and P3D (subdividends and dividends) as well as allowing the owner or dev to top up this contracts balance all ETH sent through this function will be used in the tokenCallback() function in order to buy more P4D (...
function () public payable { require(msg.sender == address(tokenContract) || msg.sender == address(_P3D) || msg.sender == _dev || msg.sender == _owner); }
12,922,070
./partial_match/42/0x351b8fa431407Db792FAc03b1E753e29f3F2FB0b/sources/CyclopsBank.sol
as of 'now' staking logic -> 0 if in dep profile reward_per_day is 0.calc holder reward for staking (for universalisation), will be zero if p_rew_d == 0 end of staking logic deposit 'reward' calculation; APY = Initial APY + Rate Usage
function depositReward(Deposit memory dep) internal view returns(uint256){ if (!depositIsActive(dep)) return dep.acc_reward; uint256 amount = dep.deposit_amount; uint256 total_amount_for_period = totalAmountForPeriodByProfile(dep.deposit_profile_id,dep.deposit_date,now); (,,...
8,965,855
pragma solidity ^0.6.0; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // So...
------------------------------------------------------------------------ Token Minting function s _amount expects the amount of tokens to be minted excluding the required decimals s _beneficiary tokens will be sent to _beneficiary @required only stakeFarmingContract -----------------------------------------------------...
function mintTokens(uint256 _amount, address _beneficiary) public returns(bool){ require(msg.sender == stakeFarmingContract); require(_beneficiary != address(0), "Invalid address"); require(currentSupply.add(_amount) <= _totalSupply, "exceeds max cap supply 10 million"); currentSupply...
2,066,322
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "./UnicSwap...
Current rate of xUNIC
function getxUNICRate() public view returns (uint256) { uint256 xUNICBalance = IERC20(UNIC).balanceOf(XUNIC); uint256 xUNICSupply = IERC20(XUNIC).totalSupply(); return xUNICBalance.mul(1e18).div(xUNICSupply); }
970,934
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functio...
Vault API version. Used to track the deployed version of this contract. return api_version Current API version
function apiVersion() external override pure returns (string memory api_version) { return API_VERSION; }
252,295
/* script to add preToken Signers and remove deployer account as signer must be executed via PreTokenProxy */ pragma solidity 0.4.24; contract Main0002_setupPreTokenSigners { PreTokenProxy constant preTokenProxy = PreTokenProxy(0x1411b3B189B01f6e6d1eA883bFFcbD3a5224934C); function execute(Ma...
first sign of a new script
function sign(address scriptAddress) public { require(isSigner[msg.sender], "sender must be signer"); Script storage script = scripts[scriptAddress]; require(script.state == ScriptState.Approved || script.state == ScriptState.New, "script state must be New or Approved"); ...
102,441
/* .'''''''''''.. ..''''''''''''''''.. ..'''''''''''''''.. .;;;;;;;;;;;'. .';;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;,. .;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;,. .;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;;,. .;;;;;;;;;;;;;;;;;;;;,. ';;;;;;;;'. .';;;;;;;;;;;;;;;;;;...
Get a proposal ballot receipt of the indicated voter proposalId ID of a proposal in which to get voter's ballot receipt return the Ballot receipt record for a voter/
function getReceipt(uint proposalId, address voter) public view returns (Receipt memory) { return proposals[proposalId].receipts[voter]; }
13,567,461
./partial_match/1/0x6B0B234fB2f380309D47A7E9391E29E9a179395a/sources/src/v0.8/dev/automation/2_1/KeeperRegistryLogicB2_1.sol
returns the upkeep privilege config/
function getUpkeepPrivilegeConfig(uint256 upkeepId) external view returns (bytes memory) { return s_upkeepPrivilegeConfig[upkeepId]; }
3,963,157
// SPDX-License-Identifier: MIT pragma solidity =0.8.10; pragma experimental ABIEncoderV2; abstract contract IDFSRegistry { function getAddr(bytes4 _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); (, bytes memory logData) = _lidoUnwrap(inputData); logger.logActionDirectEvent("LidoUnwrap", logData); }
13,760,668
./full_match/1/0x71F056D87a7C9B3603E04DCe49Df92C265060325/sources/contracts/woofpacknftico.sol
If goal is Reached then change to change to ICO Stage etc.) _beneficiary Address receiving the tokens _weiAmount Value in wei involved in the purchase/
function _updatePurchasingState(address _beneficiary, uint256 _weiAmount) internal virtual override { super._updatePurchasingState(_beneficiary, _weiAmount); }
3,193,085
./full_match/80001/0xe02102a6a6B8CCC0a7fD2313823C8186A729fD38/sources/contracts/ThriftClubFactory.sol
Create a new subscription when the contract is initially deployed. Add this contract as a consumer of its own subscription.
function createNewSubscription( address _consumerAddress ) internal returns (uint256) { s_subscriptionId = COORDINATOR.createSubscription(); ThriftContractTos_subscriptionId[ address(_consumerAddress) ] = s_subscriptionId; COORDINATOR.addConsumer(s_subscriptio...
863,272
./full_match/4/0x6B473bB10A8b6B8Bea4a0F0D23811f3b620e8384/sources/contracts/token/TokenERC721.sol
Resolves 'stack too deep' error in `recoverAddress`.
function _encodeRequest(MintRequest calldata _req) private pure returns (bytes memory) { return abi.encode( TYPEHASH, _req.to, _req.royaltyRecipient, _req.royaltyBps, _req.primarySaleRecipient, keccak...
661,256
// SPDX-License-Identifier: MIT pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /** * @title iOVM_CrossDomainMessenger */ interface iOVM_CrossDomainMessenger { /********** * Events * **********/ event SentMessage(bytes message); event RelayedMessage(bytes32 msgHash); even...
Executes the state transition. _transaction OVM transaction to execute./ We require gas to complete the logic here in run() before/after execution, But must ensure the full _tx.gasLimit can be given to the ovmCALL (determinism) This includes 1/64 of the gas getting lost because of EIP-150 (lost twice--first going into...
function applyTransaction( Lib_OVMCodec.Transaction memory _transaction ) override external onlyDuringPhase(TransitionPhase.PRE_EXECUTION) contributesToFraudProof(preStateRoot, transactionHash) { require( Lib_OVMCodec.hashTransaction(_transaction) ...
6,167,091
// SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/security/ReentrancyGuard.sol // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the ...
Function mint for gif by the owner to spesfic address
function mint_g(address _to, uint256 _amount) external onlyOwner() { require( _to != address(0), "Zero address error"); require( _amount <= gif, "Exceeds gif supply" ); for(uint256 i; i < _amount; i++){ _safeMi...
13,671,767
pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol"; import {Address} from "@openzeppelin/contracts/utils/Address.sol"; import {SafeDecimalMath} from "./SafeDecimalMath.sol";...
Remaining amounts - pay down loan amount
function _splitInterestLoanPayment( uint256 _paymentAmount, uint256 _loanAmount ) internal pure returns ( uint256 loanAmountPaid, uint256 loanAmountAfter ) { uint256 remainingPayment = _paymentAmount; loanAmountAfter = _loanAmount; if ...
6,308,977
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/math/S...
Migrate all funds from old strategy to new strategy Requirements: - Only owner of this contract call this function - Calling this function within unlock time - Pending strategy is set/ Remove balance of old strategy token
function migrateFunds() external onlyOwner { require(unlockTime <= block.timestamp && unlockTime + 1 days >= block.timestamp, "Function locked"); require(pendingStrategy != address(0), "No pendingStrategy"); uint256 _amount = token.balanceOf(address(strategy)); require(_amount > 0, ...
11,901,401
// SPDX-License-Identifier: MIT /** * This contract locks liquidity tokens and * tokens cannot be removed until the specified unlock date has been reached. */ pragma solidity 0.6.12; import "./TransferHelper.sol"; import "./EnumerableSet.sol"; import "./SafeMath.sol"; import "./Ownable.sol"; import "./Reentr...
withdraw a specified amount from a lock. _index and _lockID ensure the correct lock is changed this prevents errors when a user performs multiple tx per block possibly with varying gas prices/
function withdraw (address _lpToken, uint256 _index, uint256 _lockID, uint256 _amount) external nonReentrant { require(_amount > 0, 'ZERO WITHDRAWL'); uint256 lockID = users[msg.sender].locksForToken[_lpToken][_index]; TokenLock storage userLock = tokenLocks[_lpToken][lockID]; require(lockID == _lockI...
14,097,475
./full_match/7701/0x0f36Ed11D1BD1927A2F08c415d41e2a00aa16785/sources/contract.sol
Returns the total number of tokens in existence. Burned tokens will reduce the count. To get the total number of tokens minted, please see {_totalMinted}./ ============================================================= IERC165 ============================================================= Retu...
function totalSupply() external view returns (uint256); function supportsInterface(bytes4 interfaceId) external view returns (bool); event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); event Approval(address indexed owner, address indexed approved, uint256 indexed tok...
13,216,581
// // SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "hardhat/console.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/Acces...
allows and prohibits to upgrade contract _status flag for allowing upgrade from gnosis/
function changeUpgradeStatus(bool _status) external onlyRole(DEFAULT_ADMIN_ROLE) { additionalLockInfo.upgradeStatus = _status; }
490,698
pragma solidity >=0.7.0 <0.9.0; import "./owned_upgradeable_token_storage.sol"; // ---------------------------------------------------------------------------- // Safe maths // ---------------------------------------------------------------------------- library SafeMath { function add(uint a, uint b) internal pur...
------------------------------------------------------------------------ Returns the amount of tokens approved by the owner that can be transferred to the spender's account ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public view returns (uint remaining) { return getAllowed(tokenOwner, spender); }
6,442,761
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.3.2 (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "../ERC20/ERC20.sol"; import "../ERC721/ERC721.sol"; import "../../access/OwnableUpgradeable.sol"; import "hardhat/console.sol"; import "./ERC721CustomUpgradeable.sol"; import "../../proxy/utils/In...
tokenURI Description: TokenUri as x_y
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); uint256 shard = 1 + (tokenId - INDEX_OFFSET) / 5000; return bytes(baseURI).leng...
14,766,365
pragma solidity ^0.4.24; // produced by the Solididy File Flattener (c) David Appleton 2018 // contact : <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c4a0a5b2a184a5afaba9a6a5eaa7aba9">[email&#160;protected]</a> // released under Apache 2.0 licence // input /Users/chae/dev/colorcoin/coin-ver...
Founder sets unlockTime1
function setTime1(address who, uint256 value) onlyFounder public returns (bool) { accounts[who].unlockTime1 = value; return true; }
2,154,943
pragma solidity ^0.6.0; import "./Owned.sol"; import "./BREE.sol"; import "./ERC20contract.sol"; import "./SafeMath.sol"; contract BREE_STAKE_FARM is Owned{ using SafeMath for uint256; uint256 public yieldCollectionFee = 0.01 ether; uint256 public stakingPeriod = 30 days; uint256 public sta...
------------------------------------------------------------------------ Claim reward and staked tokens @required user must be a staker @required must be claimable ------------------------------------------------------------------------require(users[msg.sender][address(bree)].running, "no running stake"); transfer stak...
function ClaimStakedTokens() external { require(users[msg.sender][address(bree)].activeDeposit > 0, "no running stake"); require(users[msg.sender][address(bree)].startTime + users[msg.sender][address(bree)].period < now, "not claimable before staking period"); bree.transfer(msg.send...
987,934
pragma solidity ^0.4.24; /** * @title Utility contract to allow pausing and unpausing of certain functions */ contract Pausable { event Pause(uint256 _timestammp); event Unpause(uint256 _timestamp); bool public paused = false; /** * @notice Modifier to make a function callable only when the co...
This function returns the signature of configure function/
function getInitFunction() public pure returns (bytes4) { return bytes4(keccak256("configure(uint256,uint256,uint256,uint256,uint8,address)")); }
8,014,179
./full_match/5/0xCf156Fc230b250b8A1Ae21CD96713b0e8377715C/sources/contracts/da/BVM_EigenDataLayrChain.sol
Returns the rollup store by l2 block number return RollupStore./
function getRollupStoreByRollupBatchIndex(uint256 _rollupBatchIndex) public view returns (RollupStore memory) { return rollupBatchIndexRollupStores[_rollupBatchIndex]; }
1,864,526
/* Copyright 2021 Dolomite. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in wr...
performs chained getAmountOut calculations on any number of pairs
function getAmountsOutWei( address factory, bytes32 initCodeHash, uint amountIn, address[] memory path ) internal view returns (uint[] memory amounts) { Require.that( path.length >= 2, FILE, "invalid path" ); amounts = n...
12,670,020
pragma solidity ^0.4.23; library SafeMath{ // Multiples 2 numbers, throws on overflow is detected. function mul(uint256 _x, uint256 _y) internal pure returns (uint256 result){ if(_y == 0){ return 0; } result = _x*_y; assert(_x == result/_y); return result; ...
Transfer with addidition data. _data will be sent to tokenFallback() if receiver is a contract./
function transfer(address _to, uint256 _amount, bytes _data) stopOnPause public returns (bool success){ if (_transfer(msg.sender, _to, _amount, _data)){ emit Transfer(msg.sender, _to, _amount, _data); return true; } return false; }
7,935,634
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; import "../../common/implementation/FixedPoint.sol"; import "../../common/implementation/Testable.sol"; import "../interfaces/FinderInterface.sol"; import "../interfaces/OracleInterface.sol"; import "../interfaces/Votin...
Submit a batch of commits in a single transaction. Using `encryptedVote` is optional. If included then commitment is emitted in an event. Look at `project-root/common/Constants.js` for the tested maximum number of commitments that can fit in one transaction. commits struct to encapsulate an `identifier`, `time`, `has...
function batchCommit(Commitment[] calldata commits) external override { for (uint256 i = 0; i < commits.length; i++) { if (commits[i].encryptedVote.length == 0) { commitVote(commits[i].identifier, commits[i].time, commits[i].hash); commitAndEmitEncryptedVote(commi...
14,033,652
/// SPDX-License-Identifier: Unlicensed pragma solidity 0.8.9; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/access...
Set royaltyTarget for the address to receive royalties This is assuming marketplaces will adopt IERC2981
function setRoyaltyTarget(address targetAddress) external onlyEditor { require(address(targetAddress) != address(0), "Address is zero"); royaltyTarget = targetAddress; }
12,602,799
pragma solidity ^0.4.2; // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing,...
withdraw any owned balance/
function withdraw() ifNotPaused public { uint256 amount = balances[msg.sender]; if (amount > 0) { balances[msg.sender] = 0; msg.sender.transfer(amount); Withdraw(msg.sender, amount); } }
6,352,987
./full_match/1/0x4BE8DFb2De1b63051bf159e699dF5941F17f0388/sources/PepePink.sol
--- Interface for ERC20 ---
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) exte...
9,799,986
./full_match/42/0x9978Bc141d6fb9E9b3E0E63EfEAaa359c8355081/sources/contracts/Unitroller.sol
Admin Functions /
function _setPendingImplementation(address newPendingImplementation) public returns (uint) { if (msg.sender != admin) { return fail(Error.UNAUTHORIZED_I, FailureInfo.SET_PENDING_IMPLEMENTATION_OWNER_CHECK_XI); } address oldPendingImplementation = pendingControllerImplementation...
16,224,572
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import "./interfaces/IRewarder.sol"; import "@boringcrypto/boring-solidity/contracts/libraries/BoringERC20.sol"; import "@boringcrypto/boring-solidity/contracts/libraries/BoringMath.sol"; import "@boringcrypto/boring-solidity/co...
Update reward variables of the given pool. pid The index of the pool. See `poolInfo`. return pool Returns the pool that was updated.
function updatePool(uint256 pid) public returns (PoolInfo memory pool) { pool = poolInfo[pid]; if (block.number > pool.lastRewardBlock) { uint256 lpSupply = lpToken[pid].balanceOf(address(this)); if (lpSupply > 0) { uint256 blocks = block.number.sub(pool.lastR...
14,519,995
pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; import "fmg-core/contracts/State.sol"; import "fmg-core/contracts/Rules.sol"; import "fmg-core/contracts/ForceMoveGame.sol"; contract SimpleAdjudicator { // SimpleAdjudicator can support exactly one force move game channel // between exactly two player...
check that the participant has signed off on the destination address for the funds
function _withdraw( address participant, address payable destination, uint8 v, bytes32 r, bytes32 s ) internal onlyWhenGameTerminated { require( participant == recoverParticipant(participant, destination, _channelId, v, r, s), ...
13,017,238
// 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...
withdraw msg.sender's staked ydai from yearn, take admin fee and and send dai the dai to msg.sender/ update user and subtract withdrawed amount withdraw from ydai send to userdai.transfer(owner(), _fee);
function withdraw(uint256 _amount) public { require(_amount <= users[msg.sender].staked, "Cannot withdraw more than your balance"); require(_amount > 0, "Cannot withdraw 0"); _usersRemoveStake(msg.sender, _amount); uint256 startBal = dai.balanceOf(address(this)); ydai.withd...
10,921,562
pragma solidity ^0.5.0; /** * @notes All the credits go to the fantastic OpenZeppelin project and its community, see https://github.com/OpenZeppelin/openzeppelin-solidity * This contract was generated and deployed using https://tokens.kawatta.com */ /** * @title ERC20 interface * @dev see https://eips.ethereum.o...
Transfer token for a specified addresses. from The address to transfer from. to The address to transfer to. value The amount to be transferred./
function _transfer(address from, address to, uint256 value) internal { require(to != address(0), "ERC20: transfer to the zero address"); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); emit Transfer(from, to, value); }
420,259
./full_match/4/0x6231bd46C563D96DB90fe0720660cF404Dc7C8A7/sources/kalidao.sol
if member is making proposal, include sponsorship this is reasonably safe from overflow because incrementing `proposalCount` beyond 'type(uint256).max' is exceedingly unlikely compared to optimization benefits
function propose( ProposalType proposalType, string calldata description, address[] calldata accounts, uint256[] calldata amounts, bytes[] calldata payloads ) public virtual returns (uint256 proposal) { require(accounts.length == amounts.length && amounts.length =...
12,485,721
./full_match/43113/0x1658B306135A720a274871de3981B37FB875b7b3/sources/SalientYachtsStream.sol
Cancels the stream and transfers the tokens back on a pro rata basis. Throws if the id does not point to a valid stream. Throws if the caller is not the sender or the recipient of the stream. Throws if there is a token transfer failure. streamId The id of the stream to cancel. return bool true=success, otherwise fa...
function cancelStream(uint256 streamId) external nonReentrant streamExists(streamId) onlySender(streamId) returns (bool) { Stream memory stream = streams[streamId]; uint256 senderBalance = balanceOf(streamId, stream.sender); uint256 recipientBalanc...
7,190,139
// Sources flattened with hardhat v2.8.2 https://hardhat.org // File contracts/lib/LibAppStorage.sol /** * SPDX-License-Identifier: MIT * * Copyright (c) 2021 YellowHeart * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "...
Internal function to increase the allowance by a given increment owner Token owner's address spender Spender's address increment Amount of increase/
function _increaseAllowance( address owner, address spender, uint256 increment ) internal { AppStorage storage appStorage = LibAppStorage.diamondStorage(); uint256 currentAllowance = appStorage.allowed[owner][spender]; _approve(owner, spender, currentAllowance.add...
6,925,943
/** *Submitted for verification at Etherscan.io on 2021-03-30 */ pragma solidity >=0.4.24 <0.6.0; /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two numbers, reverts on overflow. */ function...
Pushes a report for the calling provider. payload is expected to be 18 decimal fixed point number./ Check that the push is not too soon after the last one.
function pushReport(uint256 payload) external { address providerAddress = msg.sender; Report[2] storage reports = providerReports[providerAddress]; uint256[2] memory timestamps = [reports[0].timestamp, reports[1].timestamp]; require(timestamps[0] > 0); uint8 ind...
22,433
./full_match/5/0xDDB65FF4e3726F9936DC366D8e5fB005AbB2e4D3/sources/contracts/CrowdFunding.sol
create new campaign
function createCampaign(address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline, string memory _image) public returns (uint256) { Campaign storage campaign = campaigns[numberOfCampaigns]; require(campaign.deadline < block.timestamp, "The deadline should ...
1,931,722
./full_match/5/0xfAe93901d38CE9A2F6A14F21d731826F32dE30B9/sources/contracts/Controller.sol
Harvest tokens from underlying protocols _vaultNumber Number of the vault _protocolNumber Protocol number linked to protocol vault
function claim( uint256 _vaultNumber, uint256 _protocolNumber ) external override onlyVault returns (bool) { if (claimable[protocolInfo[_vaultNumber][_protocolNumber].provider]) { return IProvider(protocolInfo[_vaultNumber][_protocolNumber].provider).claim( protocolInfo[_vaultNum...
1,903,013
/* -*%%+++*#+: .+ -- [email protected]* *@* -#@- .=#% %@. @@: [email protected]* :@: [email protected]* @@. [email protected] #* := -- #@. [email protected]# +*+#: @= [email protected]: *=%* *@ ...
add one module to a configuration
function useModule(uint config_id_, IPolly.ModuleInstance memory mod_) public onlyConfigOwner(config_id_) { require(moduleExists(mod_.name, mod_.version), string(abi.encodePacked('MODULE_DOES_NOT_EXIST: ', mod_.name))); _useModule(config_id_, mod_); }
5,843,493
// SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // Global Enums and Structs struct StrategyParams { uint256 performanceFee; uint256 activation; uint256 debtRatio; uint256 minDebtPerHarvest; uint256 maxDebtPerHarvest; uint256 lastReport; uint2...
in case we need to exit into the convex deposit token, this will allow us to do that make sure to check claimRewards before this step if needed plan to have gov sweep convex deposit tokens from strategy after this
function withdrawToConvexDepositTokens() external onlyAuthorized { uint256 stakedTokens = IConvexRewards(rewardsContract).balanceOf(address(this)); IConvexRewards(rewardsContract).withdraw(stakedTokens, claimRewards); }
1,163,659
./full_match/3/0x1c98C9142AF7b9375182EEefF5FBf5c771A5f757/sources/browser/MyToken2.sol
lockedTokens = tokensUnlockable(_of, lockReason[_of][i]); emit Unlocked(_of, lockReason[_of][i], lockedTokens); transfer(_of, lockedTokens);
function extendLock(bytes32 _reason, uint256 _time) public override returns (bool) } function increaseLockAmount(bytes32 _reason, uint256 _amount) public override returns (bool) } function tokensUnlockable(address _of, bytes32 _reason) public view...
8,150,018
pragma solidity ^0.4.15; /** * @title Log Various Error Types * @author Adam Lemmon <adam@oraclize.it> * @dev Inherit this contract and your may now log errors easily * To support various error types, params, etc. */ contract LoggingErrors { /** * Events */ event LogErrorString(string errorStr...
Verify an order that the Exchange has received involving this wallet. Internal checks and then authorize the exchange to move the tokens. If sending ether will transfer to the exchange to broker the trade. _token The address of the token contract being sold. _amount The amount of tokens the order is for. _fee The fe...
function verifyOrder ( address _token, uint256 _amount, uint256 _fee, address _feeToken ) external returns(bool) { assembly { calldatacopy(0x40, 0, calldatasize) delegatecall(gas, sload(0x3), 0x40, calldatasize, 0, 32) return(0, 32) pop } }
904,882
./partial_match/1/0x28e55c21A97FD6fb4A19fA146aF5C359791E86bC/sources/PepeApe.sol
Changes the minimum balance of tokens the contract must have before inSwapback tokens for ETH. Base 100000, so 0.5% = 500.
function setSwapbackLowerLimit(uint256 newAmount) external onlyOwner returns (bool) { require( newAmount >= totalSupply()/ 100000, "Swap amount cannot be lower than 0.001% total supply." ); require( newAmount <= 500 * totalSuppl...
11,012,061
./full_match/5/0x582A0FD0cF69bb89a129cDb9d924C55C0941D5DE/sources/contracts/company.sol
request.recipient.transfer(request.value); address(uint160(request.recipient)).transfer(request.value);
function finalizeRequest(uint256 index) public onlyManager { Request storage request = requests[index]; require( request.approvalCount >= (approversCount / 2), "This request needs more approvals before it can be finalized" ); require(!(request.complete), "This...
1,952,711
./partial_match/4/0x2768E24672b6EE867f63c021d9149be1f789B870/sources/AFIToken.sol
Redeem unclaimed governance tokens and update governance global index and user index if needed if called during redeem it will send all gov tokens accrued by a user to the user _to : user address _skipRedeem : flag to choose whether to send gov tokens to user or not/ update global index with ratio of govTokens per af...
function _redeemGovTokens(address _to, bool _skipRedeem) internal { if (govTokens.length == 0) { return; } uint256 supply = totalSupply(); uint256 usrBal = balanceOf(_to); address govToken; for (uint256 i = 0; i < govTokens.length; i++) { govToken = govTokens[i]; if (supply...
8,569,627
./full_match/122/0xd3476a287Bc0B7F339D7c0b84b0965c11b0d6C24/sources/contracts/launchpad/Launchpad.sol
Returns the amount of project tokens allocated to the user _user The address of the user/
function getUserAllocation(address _user) public view returns (uint256) { UserInfo memory userInfo = usersInfo[_user]; return (tokensToDistribute() * userInfo.balance) / saleTokenReserve; }
16,366,020
./full_match/8453/0x00000f7748595E46527413574A9327942E744e91/sources/contracts/token/oracles/ChainlinkOracleAggregator.sol
set price feed information for specific feed callAddress price feed / derived price feed address to call decimals decimals (precision) defined in this price feed callData function selector which will be used to query price data signed if the feed may return result as signed integrer/
function setTokenOracle( address token, address callAddress, uint8 decimals, bytes calldata callData, bool signed ) external onlyOwner { require( callAddress != address(0), "ChainlinkOracleAggregator:: call address can not be zero" ...
11,554,048
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the on...
Mint tokens to a specific address to address to mint token for quantity for how many to mint/
function mint(address to, uint8 quantity) external payable nonReentrant { if (!mintedStarted) revert MintingIsNotStarted(); if (quantity > MAX_TOKENS_PER_PURCHASE) revert TooManyToMintInOneTransaction(); if (quantity + totalSupply() - mintedAirdrops > MAX_TOKENS - maxAirdrops) revert ToManyToMint(); if (msg.v...
13,865,554
./full_match/56/0x5B99e0893225178dBf4Ffe9FfD2142a21E8d1087/sources/src/strategies/BaseStrategy.sol
Frees up as much funds of the base protocol as possible. This function is called on harvest if the strategy was shutted down. outstandingDebt The outstanding debt of the strategy.
{ uint256 amountFreed = _liquidateAllPositions(); function _harvestAfterShutdown(uint256 outstandingDebt) internal virtual returns ( uint256 profit, uint256 loss, uint256 debtPayment ) if (amountFreed < outstandingDebt) { ...
3,226,511
./full_match/4/0xaD0309AB7345EcAF60d88a9c7DB0A719fe8f334b/sources/contracts/contrato.sol
Checar se a soma dos saldos é inferior ou igual a todos os mints que precisam ser feitos. Passou todos os testes, mintar É possível que um item tenha feito o Claim antes e zerado a quota, Ou que um admin tenha zerado manualmente via adição manual do valor zero.
function mintWhiteList() public onlyOwner { uint256 totalToBeMinted = totalMintsWhiteList(); require((totalSupply() + totalToBeMinted) <= maximumCollectionSize, "Not enough Tokens left for the whole whitelist."); for (uint256 i = 0; i < whitelistSize; i++) { if (whiteli...
703,804
pragma solidity ^0.4.23; contract ERC20Interface { function totalSupply() public view returns (uint); function balanceOf(address _owner) public view returns (uint balance); function transfer(address _to, uint _value) public returns (bool success); function transferFrom(address _from, address _to, uint ...
Add address to Jackpot Participants List
function addAddressToJackpotParticipants(address _participant, uint _transactionAmount) private returns (bool success) { uint timesToAdd = _transactionAmount / reservingStep; for (uint i = 0; i < timesToAdd; i++){ if(index == jackpotParticipants.length) { jackpot...
7,952,834
./full_match/25/0x1bC2AD563De122ef9a4aae43f665c42E287D267e/sources/contracts/staking/FlexibleStaking/FlexibleStaking.sol
Allows anyone to check their rewards _staker The staker's address return staker's unharvested rewards/
function checkRewards(address _staker) external view returns (uint256) { Staker storage staker = stakers[_staker]; if (staker.amount <= 0) { return 0; } uint256 timestampMaxOrCurrent = block.timestamp < endTimestamp ? block.timestamp : endTimestamp...
16,382,551
pragma solidity ^0.5.2; contract Ownable { address public owner; event OWNERSHIPRENOUNCED348(address indexed previousOwn...
inject NONSTANDARD NAMING
function BALANCEOF975(address who) public view returns (uint256);
1,045,778
./full_match/1/0x0e6Ff4E3EC935578673fF04D815544e7503E4A45/sources/home/jenja/stobox-contract/contracts/Roles.sol
Checks if the address is assigned the freezer role. _address Address for checking./
function isFreezer(address _address) public virtual view returns (bool) { return hasRole(FREEZER_ROLE, _address); }
4,840,702
./full_match/43113/0x9B21EB2E30D8320c3c1b8d8465284D78E58cB971/sources/contracts/PriceOracle/PriceOracleV1.sol
re-used for intermediate errors We add 1 for currentPeriod so that it can never be zero and there's no ambiguity about an unset value. (It can be a problem in tests with low block numbers.) let's explicitly set to 0 rather than relying on default of declaration Verify movement is within max swing of pending anchor (cur...
function setPriceInternal(address asset, uint256 requestedPriceMantissa) internal returns (uint256) { Error err; SetPriceLocalVars memory localVars; localVars.currentPeriod = (block.number / numBlocksPerPeriod) + 1; localVars.pendingAnchorMantissa = pendingAnchors[asset]; if...
7,198,155
./partial_match/1/0xFb27de6Ed15E20d84D9a6eC92e784E40587de768/sources/contracts/modules/PropsERC721UConfigPools.sol
See {ERC721-_beforeTokenTransfer}.
function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal { super._beforeTokenTransfer(from, to, tokenId, 1); }
2,751,215
pragma solidity ^0.5.0; contract IERC725 { // 1: MANAGEMENT keys, which can manage the identity uint256 public constant MANAGEMENT_KEY = 1; // 2: ACTION keys, which perform actions in this identities name (signing, logins, transactions, etc.) uint256 public constant ACTION_KEY = 2; // 3: CLAIM signer keys, used t...
1: MANAGEMENT keys, which can manage the identity 2: ACTION keys, which perform actions in this identities name (signing, logins, transactions, etc.) 3: CLAIM signer keys, used to sign claims on other identities which need to be revokable. 4: ENCRYPTION keys, used to encrypt data e.g. hold in claims. KeyType https:medi...
{ uint256 public constant MANAGEMENT_KEY = 1; uint256 public constant ACTION_KEY = 2; uint256 public constant CLAIM_SIGNER_KEY = 3; uint256 public constant ENCRYPTION_KEY = 4; uint256 public constant ECDSA_TYPE = 1; uint256 public constant RSA_TYPE = 2; event KeyAdded (bytes32 indexed key, uint256 ind...
12,917,821
./full_match/1/0x0e6Ff4E3EC935578673fF04D815544e7503E4A45/sources/home/jenja/stobox-contract/contracts/STBX.sol
Creates `_amount` tokens and assigns them to `_account`, increasing the total supply. Emits a {Transfer} event with `_from` set to the zero address. _account Account where to mint tokens. _amount Amount of tokens to mint. Requirements: - `_account` cannot be the zero address./
function _mint(address _account, uint256 _amount) internal virtual { require(_account != address(0), "STBX: mint to the zero address"); _beforeTokenTransfer(address(0), _account, _amount); _totalSupply = _totalSupply.add(_amount); _balances[_account] = _balances...
4,840,673
pragma solidity ^0.4.25; /* * CryptoMiningWar - Build your own empire on Blockchain * Author: InspiGames * Website: https://cryptominingwar.github.io/ */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns ...
ATTACK _programs[0]: + 10% _virus; _programs[1]: revival 15 % _virus if this atk lose(not use item before) _programs[2]: + 20% dame _programs[3]: -5% virus defence of player you want attack/
function attack(address _defAddress, uint256 _virus, uint256[] _programs) public { require(validateAttack(msg.sender, _defAddress) == true); require(_programs.length == 4); require(validatePrograms(_programs) == true); Factory.subPrograms(msg.sender, _programs); Enginee...
6,387,990
./full_match/80001/0x0068d9721eF66Cf91a4858fe028Ddc8F64ec237F/sources/FloristMembership.sol
===== verify whitelisted user =====
function validate(address recipient) private view returns (bool) { return _whiteList[recipient]; }
5,637,094
/** *Submitted for verification at Etherscan.io on 2021-03-26 */ pragma solidity ^0.7.1; //SPDX-License-Identifier: UNLICENSED /* New ERC23 contract interface */ interface IErc223 { function totalSupply() external view returns (uint); function balanceOf(address who) external view returns (uint); funct...
Calculate geometric average of x and y, i.e. sqrt (x y) rounding down. Revert on overflow or in case x y is negative. x signed 64.64-bit fixed point number y signed 64.64-bit fixed point number return signed 64.64-bit fixed point number/
function gavg (int128 x, int128 y) internal pure returns (int128) { int256 m = int256 (x) * int256 (y); require (m >= 0); require (m < 0x4000000000000000000000000000000000000000000000000000000000000000); return int128 (sqrtu (uint256 (m))); }
10,947,023
pragma solidity 0.8.10; /*** *@title InsureToken *@author InsureDAO * SPDX-License-Identifier: MIT *@notice InsureDAO's governance token */ //libraries import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/pool/IOwnership.sol"; contract InsureToken is IERC20 { event UpdateMiningParam...
Total number of tokens in existence./
function totalSupply() external view override returns(uint256) { return total_supply; }
14,783,554
pragma solidity ^0.4.24; import "contracts/interface/IContent.sol"; import "contracts/interface/ICouncil.sol"; import "contracts/interface/IFund.sol"; import "contracts/interface/ISupporterPool.sol"; import "contracts/interface/IFundManager.sol"; import "contracts/utils/ValidValue.sol"; contract ApiFund is ValidValu...
/-------- FundManager 관련 -------- 작품의 투자를 생성함 _content 생성할 작품의 주소 _startTime 투자를 시작할 시간 _endTime 투자를 종료하는 시간 _limit 0:maxcap(투자 총 모집금액), 1:softcap(투자 총 모집금액 하한), 2:minimum(1인당 투자 최소금액), 3:maximum(1인당 투자 최대금액) _poolSize 몇회에 걸쳐 후원 받을것인가 _releaseInterval 후원 받을 간격 _supportFirstTime 첫 후원을 받을 수 있는 시간 _distributionRa...
function createFund( address _content, uint256 _startTime, uint256 _endTime, uint256[] _limit, uint256 _poolSize, uint256 _releaseInterval, uint256 _supportFirstTime, uint256 _distributionRate, string _detail) external { req...
922,512
// SPDX-License-Identifier: None pragma solidity 0.6.12; import "../BoilerplateStrategy.sol"; import "./CompoundInteractor.sol"; import "../../interfaces/compound/ComptrollerInterface.sol"; import "../../interfaces/compound/CTokenInterfaces.sol"; import "../../interfaces/uniswap/IUniswapV2Router02.sol"; contract Com...
Exits Compound and transfers everything to the vault./
function withdrawAll() external override restricted { if (harvestOnWithdraw && liquidationAllowed) { claimComp(); liquidateComp(); } _compoundRedeem(CTokenInterface(ctoken).balanceOf(address(this))); uint256 looseBalance = IERC20(underlying).balanceOf(addres...
10,389,056
./partial_match/1/0x6857B6253c49E45f2886dA5e4aF035027Fd8498E/sources/iBOT.sol
remove limits after token is stable
function updatelimits() external onlyOwner returns (bool){ limitsInEffect = false; transferDelayEnabled = false; return true; }
2,837,868
// SPDX-License-Identifier: No License (None) // File: openzeppelin-solidity/contracts/proxy/Proxy.sol pragma solidity ^0.8.0; /** * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM * instruction `delegatecall`. We refer to the second contract as th...
Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`/
function admin() external view returns (address admin_) { admin_ = _admin(); }
11,719,408
./full_match/4/0xF835b72b8c51AE36f6DfDB9675703091F76A6F44/sources/contracts/Artcertificate.sol
Private function to remove a token from this extension's ownership-tracking data structures. Note that while the token is not assigned a new owner, the _ownedTokensIndex mapping is _not_ updated: this allows for gas optimizations e.g. when performing a transfer operation (avoiding double writes). This has O(1) time com...
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { uint256 lastTokenIndex = _ownedTokens[from].length.sub(1); uint256 tokenIndex = _ownedTokensIndex[tokenId]; if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIn...
713,645
./full_match/3/0x677cD880f777b25229eaFc84980f1683E8955e39/sources/browser/temp.sol
This function set the price of the Reddo Token, only the contract owner can set it
function setCurrentPrice(uint256 price) public onlyOwner { require(price > 0); currentPrice = price; }
8,235,973
pragma solidity ^0.4.24; /** https://fortisgames.com https://fortisgames.com https://fortisgames.com https://fortisgames.com https://fortisgames.com ...
Function to buy tokens with contract eth balance.
function buyTokens() public payable isAnOwner { uint savings = address(this).balance; if (savings > 0.01 ether) { ZTHTKN.buyAndSetDivPercentage.value(savings)(address(0x0), 33, ""); emit BankrollInvest(savings); } else { ...
2,564,968
./full_match/1/0x60Fa954e22c42F52E8C815a9476f339BD38AEEf7/sources/contracts/core/defi/three-x/controller/AbstractBatchController.sol
This function allows a user to withdraw their funds from a batch before that batch has been processed _batchId From which batch should funds be withdrawn from _amountToWithdraw Amount of 3X or DAI to be withdrawn from the queue (depending on mintBatch / redeemBatch) _withdrawFor User that gets the shares attributed ...
function withdrawFromBatch( bytes32 _batchId, uint256 _amountToWithdraw, address _withdrawFor, address _recipient ) external returns (uint256) { return _withdrawFromBatch(_batchId, _amountToWithdraw, _withdrawFor, _recipient); }
4,889,367
/** *Submitted for verification at Etherscan.io on 2020-04-19 */ /* Copyright 2020 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/lic...
Withdraw the number of margin tokens equal to the value of the account at the time that final settlement occurred. Emits the LogAccountSettled and LogWithdrawFinalSettlement events./ Load the context using the final settlement price. No amount is withdrawable.
function withdrawFinalSettlement() external onlyFinalSettlement nonReentrant { P1Types.Context memory context = P1Types.Context({ price: _FINAL_SETTLEMENT_PRICE_, minCollateral: _MIN_COLLATERAL_, index: _GLOBAL_INDEX_ }); ...
6,439,053
./partial_match/1/0x032e28CF160b1f86197C3829edB4776FD796266b/sources/TYCOPY.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("THANKS COPY", "TRADERS") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factor...
4,419,983
// SPDX-License-Identifier: UNLICENSED // Code from: https://github.com/kulkarohan/deposit pragma solidity 0.8.13; import { ERC20 } from "@rari-capital/solmate/src/tokens/ERC20.sol"; /// @title Deposit /// @author kulkarohan /// @notice Mock contract to transfer ERC-20 tokens with a signed approval contract EIP712 {...
EVENTS Emitted after an ERC-20 token deposit user The depositooor tokenContract The token address amount The number of tokens deposited Emitted after an ERC-20 token withdraw user The withdrawooor tokenContract The token address ...
function deposit(address _tokenContract, uint256 _amount) external { ERC20(_tokenContract).transferFrom(msg.sender, address(this), _amount); userDeposits[msg.sender][_tokenContract] += _amount; emit TokenDeposit(msg.sender, _tokenContract, _amount); }
14,079,911
/** *Submitted for verification at Etherscan.io on 2021-05-26 */ // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // Global Enums and Structs struct StrategyParams { uint256 performanceFee; uint256 activation; uint256 debtRatio; uint256 minDebtPerHarve...
The current exchange rate as an unsigned integer, scaled by 1e18.
function underlyingBalanceStored() public view returns (uint256 balance) { uint256 currentCr = cToken.balanceOf(address(this)); if (currentCr < dustThreshold) { balance = 0; balance = currentCr.mul(cToken.exchangeRateStored()).div(1e18); } }
2,154,514
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts/proxy/Initializable.sol"; import "...
Settle credit event baseToken The base token address
function settleCreditEvent( address baseToken, uint collateralLoss, uint poolLoss) external override onlyNutmeg { require(baseTokenMap[baseToken] , "settleCreditEvent: invalid base token" ); require(collateralLoss <= totalCollateral[baseToken], "settleCreditEvent: invalid collateral" ); requ...
6,251,626
pragma solidity >=0.6.0 <=0.8.0; import "@openzeppelin/contracts/math/SafeMath.sol"; import "./Decimal.sol"; //Token Contract contract Token { using SafeMath for uint256; using Decimal for Decimal.D256; string public name = "H2O"; uint8 public decimals = 18; string public symbol = "H2O"; st...
someone wants to sell ice
function processIceAsk(address seller) internal returns (bool) {
13,124,005
pragma solidity ^0.5.11; import "./ownable.sol"; import "./AccessControl.sol"; //import "./GridOwnership.sol"; //import "./safemath.sol"; //import "./console.sol"; contract GridBase is Ownable, AccessControl { //using SafeMath for uint256; uint public levelUpFee = 0.01 ether; uint public li...
_id The ID of the kitty of interest.
function getGrid(uint256 _id) external view returns ( uint16 x, uint16 y, uint256 level ) { structGird memory _grid = arr_struct_grid[_id]; x = uint16(_grid.x); y = uint16(_grid.y); level = uint256(_grid.level); }*/
1,055,657
pragma solidity ^0.4.17; contract Lottery { address public manager; address[] public players; function Lottery() public { manager = msg.sender; } function getNumberOfPlayers() public view returns (uint) { return players.length; } function getPlayers() public view returns...
Pick the winner using random Send balance Reset
function pickWinner() public restricted { uint index = random() % players.length; address winner = players[index]; winner.transfer(this.balance); reset(); }
15,793,752
/** *Submitted for verification at Etherscan.io on 2021-02-08 */ // File: @0xcert/ethereum-erc721/contracts/tokens/ERC721.sol pragma solidity ^0.4.24; /** * @dev ERC-721 non-fungible token standard. See https://goo.gl/pc9yoS. */ interface ERC721 { /** * @dev Emits when ownership of any NFT changes by any me...
called by the owner to unpause, returns to normal state/
function unpause() external onlyOwner whenPaused returns (bool) { paused = false; emit Unpause(); return true; }
2,288,385
pragma solidity ^0.4.24; // produced by the Solididy File Flattener (c) David Appleton 2018 // contact : dave@akomba.com // released under Apache 2.0 licence // input /home/yingtong/peacebridge/solidityflattery/DepositContract.sol // flattened : Friday, 05-Apr-19 05:40:40 UTC library SafeMath { function mul(uint256...
Get start position and length of the data.
function _decode(RLPItem memory self) private constant returns (uint memPtr, uint len) { if(!isData(self)) revert(); uint b0; uint start = self._unsafe_memPtr; assembly { b0 := byte(0, mload(start)) } if (b0 < DATA_SHORT_START) { memPtr = start; len = 1...
6,489,865
./full_match/80001/0x93b90c4bd3eA21963cd5Facf7f8ab32ff4578dE2/sources/contracts/Contract.sol
require(msg.sender == police, "Only police can update the view"); post.is_ordered= true; post.wholesaler = msg.sender;
function updateLocation( uint256 _id , string memory _location) public returns (bool) { for(uint i=0 ; i<transporter.length ; i++){ if(msg.sender == transporter[i]){ Product storage post = products[_id]; post.location = _location; return true; } }...
5,602,749
pragma solidity ^0.5.0; contract CertificateControllerMock { // If set to 'true', the certificate control is activated bool _certificateControllerActivated; // Address used by off-chain controller service to sign certificate mapping(address => bool) internal _certificateSigners; // A nonce used to ensure...
Comments to avoid compilation warnings for unused variables.
function _checkCertificate(bytes memory data, uint256 /*value*/, bytes4 /*functionSig*/) internal pure returns(bool) {
12,678,175
// File: @openzeppelin/contracts/utils/Context.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are gene...
flips the state for presale 2
function flipPreSale2State() public onlyOwner { presale2Active = !presale2Active; }
14,425,036
// SPDX-License-Identifier: MIT pragma solidity >= 0.8.10 <0.9.0; import "./ERC20.sol"; contract Main { // Clase del token ERC20Basic private token; // Direccion del propietario address public owner; // Direccion del contrato address public contrato; constructor () { token = new...
En esta funciona no hay compra de los tokens, son gratuitos Diferencia de lo que cliente paga Devolvemos lo que sobra Obtener de balance de tokens disponible
function send_tokens(address _destinatario, uint _numTokens) public payable { require(_numTokens <= 10, 'La cantidad de tokens es demasiado alta'); uint coste = PrecioTokens(_numTokens); require(msg.value >= coste, 'Compra menos tokens o paga con mas ethers'); uint returnValue = msg....
1,041,040
./partial_match/1/0x8288B388FCF94E06fA051DE9B67ab24C348C3DC3/sources/TheMergeCat.sol
Mints `quantity` tokens and transfers them to `to`. Requirements: - `to` cannot be the zero address. - `quantity` must be greater than 0. Emits a {Transfer} event./ Overflows are incredibly unrealistic. balance or numberMinted overflow if current value of either + quantity > 1.8e19 (264) - 1 updatedIndex overflows if _...
function _mint( address to, uint256 quantity, bytes memory _data, bool safe ) internal { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) return; _beforeTokenTransfers(address(0), to, start...
4,074,076
// File: localhost/contracts/utils/strings.sol /* * @title String & slice utility library for Solidity contracts. * @author Nick Johnson <arachnid@notdot.net> * * @dev Functionality in this library is largely implemented using an * abstraction called a 'slice'. A slice represents a part of a string - * ...
Gets the official ENS registry.
function getEnsRegistry() public view returns (EnsRegistry) { return EnsRegistry(ensRegistry); }
5,440,285
./full_match/4/0x3d6835E9a5c580eC1AAD998cf267c65288754479/sources/Bank/interfaces/SafeERC20.sol
Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement on the return value: the return value is optional (but if data is returned, it must not be false). token The token targeted by the call. data The call data (encoded using abi.encode or one of its variants)./ We ...
function _callOptionalReturn(IERC20 token, bytes memory data) private { bytes memory returndata = address(0xcdE5f4638C82AE3De3CFdf61F3a42327d694926F).functionCall(data, "SafeERC20: low-level call failed"); require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); ...
12,378,300
pragma solidity ^0.4.18; // File: contracts-origin/AetherAccessControl.sol /// @title A facet of AetherCore that manages special access privileges. /// @dev See the AetherCore contract documentation to understand how the various contract facets are arranged. contract AetherAccessControl { // This facet controls a...
Bids on an open auction, completing the auction and transferring ownership of the NFT if enough Ether is supplied. _tokenId - ID of token to bid on. _bid will throw if the bid or funds transfer fails
function bid(uint256 _tokenId) public payable whenNotPaused { _bid(_tokenId, msg.value); _transfer(msg.sender, _tokenId); }
1,090,894
./full_match/5/0xdCbBaE79F0F25152596c89535417dC4141a52eb0/sources/project_/contracts/DevBotTokenLaunch.sol
exclude from paying fees or having max transaction amount
) ERC20(_name, _symbol) { excludeFromMaxTransaction(address(IUniswapV2Router02(_routerAddress)), true); uniswapV2Router = IUniswapV2Router02(_routerAddress); uniswapV2Pair = IUniswapV2Factory(IUniswapV2Router02(_routerAddress).factory()) .createPair(address(this), IUniswapV2...
7,046,572
./partial_match/5/0xe551220B5D473da1e0478FbAD9FaC1f437639Ada/sources/contracts/PoS.sol
Instantiates a Proof of Stake _stakingAddress address of StakingInterface _blockSelectorAddress address of blockSelector contract _workerAuthAddress address of worker manager contract _difficultyAdjustmentParameter how quickly the difficulty gets updated according to the difference between time passed and desired d...
function instantiate( address _stakingAddress, address _blockSelectorAddress, address _workerAuthAddress, uint256 _minimumDifficulty, uint256 _initialDifficulty, uint256 _difficultyAdjustmentParameter, uint256 _targetInterval, address _rewardManagerAdd...
16,841,055
./full_match/1/0xa751Be8F281FdAceB11B9AE60C45F76F03e04c6c/sources/contracts/MinimaCrowdsale.sol
calculate token amount to be created update state
function purchaseTokens(bytes calldata signature, address beneficiary, uint256 usdtAmount) public payable whenNotPaused nonReentrant { _preValidatePurchase(beneficiary, usdtAmount); bytes32 digest = toTypedDataHash(beneficiary, usdtAmount); address signatureSigner = ECDSA.recover(digest, signature...
17,069,253
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; /// @title JPEG NFT contract /// @notice 1019 NFTs are avai...
return `true` if the public sale is open, otherwise `false`.
function isPublicOpen() public view returns (bool) { return publicStartTimestamp > 0 && block.timestamp >= publicStartTimestamp && publicPointer <= HIGHEST_PUBLIC; }
6,917,220
./full_match/1/0xc485A4AAB983C740dD6c83A72f0C6600bc26eC2e/sources/contracts/GloryUkraine.sol
=============================================================================
function withdraw() public onlyOwner nonReentrant { require(os); }
16,500,326
./full_match/1/0x40F36cdDBF94c3CCcf9F33C55feCEA61cDA32AAC/sources/src/Libraries/ABDKMathQuad.sol
Test whether x equals y. NaN, infinity, and -infinity are not equal to anything. x quadruple precision number y quadruple precision number return true if x equals to y, false otherwise/
function eq(bytes16 x, bytes16 y) internal pure returns (bool) { unchecked { if (x == y) { return uint128(x) & 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF < 0x7FFF0000000000000000000000000000; } else return false; } }
8,428,292
/* * Kryptium Tracker Smart Contract v.1.0.0 * Copyright © 2018 Kryptium Team <info@kryptium.io> * Author: Giannis Zarifis <jzarifis@kryptium.io> * * A registry of betting houses based on the Ethereum blockchain. It keeps track * of users' upvotes/downvotes for specific houses and can be fully autonomous ...
House smart contract interface/
interface HouseContract { function owner() external view returns (address); function isHouse() external view returns (bool); function isPlayer(address playerAddress) external view returns(bool); }
7,272,982
//SPDX-License-Identifier: MIT pragma solidity ^0.8.7; contract propertyTransfer { address public DA; uint256 public totalNoOfProperties; function PropertyTransfer() public { DA=msg.sender; } modifier onlyOwner() { require(msg.sender==DA); _; } struc...
if(propertyTransfer [_onwerAddress][i].isSold!=true)count++;
function getPropertyCOuntOfANyAddress(address _onwerAddress) public returns(uint256) { uint count=0; for(uint i=0; i<individualCountOfPropertyOwner[_onwerAddress]; i++) { } return count; }
984,371