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.11; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Context.sol"; //import "@openzeppe...
make a withdraw request by the user fetch the differents deposits eligible for withdraw and delete them from the client array if withdrawn withdrawAmount the desired amount to withdraw by the user
function wantWithdraw (uint withdrawAmount) public returns(uint){ uint x = updateXprice(0); uint z = 1000000; uint xWithdraw = withdrawAmount.mul(z).div(x); require(xWithdraw <= user[msg.sender].xTotalDeposit, "can not withdraw more than you deposited"); uint deposit0 = (user[msg.sender].xDeposit[...
12,915,816
./full_match/3/0x8f449Cdf6249E608c661c37eeA40420A117501DE/sources/KickstarterDepFee.sol
Same as {withdraw}, but forwarding all gas to the recipient. WARNING: Forwarding all gas opens the door to reentrancy vulnerabilities. Make sure you trust the recipient, or are either following the checks-effects-interactions pattern or using {ReentrancyGuard}. _Available since v2.4.0._/
function withdrawWithGas(address payable payee) public onlyPrimary { uint256 payment = _deposits[payee]; _deposits[payee] = 0; payee.sendValue(payment); emit Withdrawn(payee, payment); }
8,266,815
pragma solidity ^0.4.18; // ---------------------------------------------------------------------------- // 'LocalToken' CROWDSALE token contract // // Deployed to : 0xceb584ee9b7e1568acc0ecfb5a23b590e64551cd // Symbol : LOT // Name : Local Token // Total supply: 2000000000 // Decimals : 18 // // A musi...
------------------------------------------------------------------------ Total supply ------------------------------------------------------------------------
function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0xceb584ee9b7e1568acc0ecfb5a23b590e64551cd)]; }
9,965,202
pragma solidity ^0.5.0; import "./ElectionBase.sol"; /// @title Election /// @notice Assumptions: A voter can vote for more than one guru wallet. /// However, the voter cannot vote for the same guru wallet more than once. /// And the given vote cannot be undone (this can be changed easily if needed). contract Electi...
Only doable if election is not closed.
function _addGuru(bytes32 _name, address _wallet) private electionOpened whenNotPaused { require(_name != 0, "Name cannot be black"); require(gurus[_wallet].name == 0, "Guru was already added"); emit GuruAdded(_wallet, _name, msg.sender); gurus[_wallet].name = _name...
12,884,380
pragma solidity ^0.4.19; import "./ownership/Ownable.sol"; /** * @title Migrations * @dev Migration contract. */ contract Migrations is Ownable { /** * @dev Last migration number. */ uint public lastMigration; /** * @dev Contract constructor. */ function Migrations() public { owner ...
Sets last migration number./
function setCompleted(uint completed) onlyOwner public { lastMigration = completed; }
5,501,404
pragma solidity ^0.4.6; // -------------------------- // R Split Contract // -------------------------- contract RSPLT_F { event StatEvent(string msg); event StatEventI(string msg, uint val); enum SettingStateValue {debug, locked} struct partnerAccount { ...
----------------------------------- set even distribution threshold -----------------------------------
function setEvenDistThresh(uint256 _thresh) { if (msg.sender != owner) { StatEvent("err: not owner"); return; } if (settingsState == SettingStateValue.locked) { StatEvent("err: locked"); ...
6,452,236
pragma solidity ^0.4.19; import './zeppelin/ownership/Ownable.sol'; /** * @title GroupAdmin * @dev The contract allows multiple addresses to perform as admin. */ contract GroupAdmin is Ownable { event AdminGranted(address indexed grantee); event AdminRevoked(address indexed grantee); address[] public admins; ...
todo: include owner;
function getAdmins() view public returns(address[]){ return admins; }
5,390,212
./full_match/420/0x5F58985FFC28342022fa80CcE1297AC170717de7/sources/src/BurnERC1155ToClaim.sol
Checks to see if the claimer owns enough of each NFT to claim
function verifyClaim(address _claimer, uint256 _quantity) public view override { require(burnToken.balanceOf(_claimer, 0) >= _quantity, "You don't own enough hearts"); }
13,227,543
// SPDX-License-Identifier: MIT pragma solidity ^0.6.6; // From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol // Subject to the MIT license. /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wr...
allows a keeper to activate/register themselves after bonding/
function activate() external { require(bondings[msg.sender] != 0, "Keep3r::activate: bond first"); require(bondings[msg.sender] < now, "Keep3r::activate: still bonding"); if (!keepers[msg.sender]) { firstSeen[msg.sender] = now; } keepers[msg.sender] = true; ...
2,099,240
./full_match/3/0x7295C2BE0Fabca03ED3514C3dd99658EbC25f3f3/sources/browser/Contract_Code_v2_Min.sol
get scale for the level (scale/1000) level level return scale/
function getScaleByLevel(uint level) internal view returns (uint) { if (level == 1) { return paramsMapping[5111]; } if (level == 2) { return paramsMapping[5112]; } if (level == 3) { return paramsMapping[5113]; } if (level == 4) { return paramsMapping[5114]; ...
8,114,103
./full_match/3/0xc3eaDBE343Ea44A605a79d701a0757170Bdc2a19/sources/MorningStar.sol
iterate, may need to fallback to prior code at begin of day....require(from == owner(),"not the owner"); require(!burn() || from == owner(), "burning or not owner."
function _beforeTokenTransfer(address from, address to, uint256 amount) internal override (ERC20,ERC20Pausable) { super._beforeTokenTransfer (from, to, amount); }
8,165,792
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @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...
return adminAddress The address of the proxy admin./
function admin() external ifAdmin returns (address adminAddress) { return _admin(); }
282,919
/** *Submitted for verification at Etherscan.io on 2021-07-27 */ // SPDX-License-Identifier: MIT // File: contracts/SafeMath.sol pragma solidity ^0.8.6; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev ...
ERC721 token receiver interface Interface for any contract that wants to support safeTransfers from ERC721 asset contracts./
interface IERC721Receiver { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } pragma solidity ^0.8.6; }
10,819,952
pragma solidity ^0.4.18; // solhint-disable-line /// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens /// @author Dieter Shirley <dete@axiomzen.co> (https://github.com/dete) contract ERC721 { // Required methods function approve(address _to, uint256 _tokenId) public; function balanceOf...
Allows someone to send ether and obtain the token Making sure token owner is not sending to self Safety check to prevent against an unexpected 0x0 default. Making sure sent amount is greater than or equal to the sellingPrice Update prices first stage second stage third stage Pay previous tokenOwner if owner is not cont...
function purchase(uint256 _tokenId) public payable { address oldOwner = regionIndexToOwner[_tokenId]; address newOwner = msg.sender; uint256 sellingPrice = regionIndexToPrice[_tokenId]; require(oldOwner != newOwner); require(_addressNotNull(newOwner)); require(msg.value >= sellingPrice); ...
1,307,832
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); ...
increase the amount of eth
function increaseCap(int256 _cap_inc) onlyOwner public { require(_cap_inc != 0); if (_cap_inc > 0) { cap = cap.add(decimal_num.mul(uint256(_cap_inc))); uint256 _dec = uint256(- 1 * _cap_inc); uint256 cap_dec = decimal_num.mul(_dec); if (cap_dec >= cap ...
6,800,253
./full_match/1/0x3c95775ba56bFcd337998CC84f0388251d6AEC7B/sources/contracts/modules/RangeEditionMinterV2_1.sol
@inheritdoc IRangeEditionMinterV2_1/
function mint( address edition, uint128 mintId, uint32 quantity, address affiliate ) public payable { mintTo(edition, mintId, msg.sender, quantity, affiliate, MerkleProofLib.emptyProof(), 0); }
2,925,075
./partial_match/1/0xdD668Fa631C0b3F863e3A830ca23Fe75100009e6/sources/CompoundLeverageModule.sol
Get mint cEther calldata from SetToken/ Compound's mint cEther function signature is: mint(). No return, reverts on error.
function getMintCEtherCalldata( ICErc20 _cEther, uint256 _mintNotional ) public pure returns (address, uint256, bytes memory) { bytes memory callData = abi.encodeWithSignature("mint()"); return (address(_cEther), _mintNotional, callData); }
2,755,120
./full_match/1/0x604879C83784b1aabD1F8e00D90BAFE4B1f06C14/sources/contracts/access/Governable.sol
@inheritdoc TokenHolder
function _requireCanSweep() internal view override onlyGovernor {}
4,964,468
/** ......''''...... .',:cldxxkOOO0kddk0OOOkxxdlc:;'. .,:lxkO00000000000k, .;k00000000000Okxl:,. .;ldO0000000000000000O; :O0000000000000000Odl;. ...
price of a given historical time/
function historicalPrice(uint256 timeStamp) view public returns (uint256) { return _computePriceInfo(timeStamp).computedPrice; }
6,065,421
./partial_match/1/0xAe46E888aF6318aED82FE715b1b98b78F74e7b65/sources/LiquidityPoolV1Converter.sol
dispatches token rate update event for the pool token _poolTokenSupply total pool token supply _reserveToken address of the reserve token _reserveBalance reserve balance _reserveWeight reserve weight/
function dispatchPoolTokenRateUpdateEvent(uint256 _poolTokenSupply, IERC20Token _reserveToken, uint256 _reserveBalance, uint32 _reserveWeight) private { emit TokenRateUpdate(IDSToken(address(anchor)), _reserveToken, _reserveBalance.mul(PPM_RESOLUTION), _poolTokenSupply.mul(_reserveWeight)); }
9,362,124
./full_match/1/0xe53309e9FD0553f6651D08D92f400B77A484875D/sources/ArabPepe.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("Arab Pepe", "APEPE") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IU...
16,530,701
./partial_match/1/0xA2e82022D13d309A5C2b828d542129a47f10A55B/sources/PEPEWASHINGTON.sol
See {ISimpleERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {SimpleERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have a...
function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve( sender, _msgSender(), _allowances[sender][_msgSender()].sub( ...
15,604,159
./partial_match/1/0x0000000000000aF8FE6E4DE40F4804C90fA8Ea8F/sources/contracts/EPS FOR VERIFICATION/ProxyRegister.sol
getProxyRecordForCold: Get proxy details for a cold address/
function getProxyRecordForCold(address cold_) public view returns ( ProxyStatus status, address hot, address cold, address delivery, uint64 provider_, bool feePaid ) { address currentHot = coldToHot[cold_]; Record memory currentItem = hotToRecord[currentHo...
3,909,960
./partial_match/1/0x84B1928760EF0C9B71A769723c901ff280C8F28C/sources/contracts/v2/satis_core/Action.sol
Emit remove fund event on chain/
function withdrawFund(string memory _ticketId, address _clientAddress, address _tokenAddress, uint256 _withdrawValue, uint256 _inDebtValue) public isProxy returns(bool _isDone) { emit Withdraw(_ticketId, _clientAddress, _tokenAddress, _withdrawValue, _inDebtValue); _isDone = true; }
15,750,341
./partial_match/1/0x28e55c21A97FD6fb4A19fA146aF5C359791E86bC/sources/PepeApe.sol
Sets the fees for buys _marketingFee The fee for the marketing wallet _devFee The fee for the dev wallet
function updateFeesForBuying( uint256 _marketingFee, uint256 _devFee ) external onlyOwner { buyMarketingFee = _marketingFee; buyDevFee = _devFee; totalFeesBuy = buyMarketingFee + buyDevFee; }
11,012,064
./full_match/1/0xeD1dafcCB68900900513594085d311E3A64408cC/sources/https_/github.com/TnzGit/giggly-baby/blob/master/contracts/token/ERC20/ERC20.sol
Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have ...
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAl...
2,917,762
//File: node_modules\openzeppelin-solidity\contracts\ownership\Ownable.sol pragma solidity ^0.4.24; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { ...
This function is the batch send function for Token distribution. It accepts an array of addresses and amounts _beneficiaryWallets the address where tokens will be deposited into _amounts the token amount in wei to send to the associated beneficiary/
function batchDistributeTokens(address[] _beneficiaryWallets, uint256[] _amounts) external onlyOwner { require(_beneficiaryWallets.length == _amounts.length); for (uint i = 0; i < _beneficiaryWallets.length; i++) { distributeTokens(_beneficiaryWallets[i], _amounts[i]); } }
6,398,199
./partial_match/56/0xd0C3CB0fbfc352ad8032A07d2eF3771B61F83a5f/sources/UFragments.sol
return The total number of fragments./
function totalSupply() public view returns (uint256) { return _totalSupply; }
11,263,915
pragma solidity ^0.5.17; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address private _owner; event OwnershipTransferred(address indexed previousOwn...
payable fallback/
function () external payable { emit PaymentReceived(msg.sender, msg.value); }
572,536
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./libs/IUniRouter02.sol"; import "./libs/IWETH.sol"; interface IToken { ...
Available amount of reflection token/
function availableDividendTokens() public view returns (uint256) { if(address(dividendToken) == address(0x0)) { return address(this).balance; } uint256 _amount = IERC20(dividendToken).balanceOf(address(this)); if(address(dividendToken) == address(earnedToken)) {...
5,923,602
// 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 one...
Set share of tranche
function setTrancheShare(uint256 tranche, uint256 share) external onlyOwnerExecActivator { require( trancheMetadata[tranche].rewardShare > 0, "Tranche not initialized" ); _setTrancheShare(tranche, share); }
6,299,941
./full_match/5/0x852901eE892799721377D6F8d6058b6274c729c3/sources/contracts/Contract.sol
Emit an event or perform any necessary accounting
function depositRewards(uint256 _amount) external { require(_amount > 0, "Amount must be greater than zero"); IERC20(rewardToken).transferFrom(msg.sender, address(this), _amount); }
1,953,346
pragma solidity ^0.4.23; // File: zeppelin-solidity/contracts/ownership/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; ...
Token contract constructor admin Address of admin account/ Mint tokens Approve allowance for admin account
function SacToken(address admin) public { totalSupply_ = INITIAL_SUPPLY; balances[msg.sender] = totalSupply_; Transfer(address(0x0), msg.sender, totalSupply_); adminAddr = admin; approve(adminAddr, ADMIN_ALLOWANCE); }
15,205,574
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IQuestTypes.sol"; import "../IHeroTypes.sol"; interface IQuestCoreV1 { //solhint-disable-next-line func-name-mixedcase function DEFAULT_ADMIN_ROLE() external view returns (bytes32); //solhint-disable-next-line func-name-mixedcase func...
solhint-disable-next-line func-name-mixedcasesolhint-disable-next-line func-name-mixedcase function extractNumber( uint256 randomNumber, uint256 digits, uint256 offset ) external pure returns (uint256 result); function vrf(uint256 blockNumber) external view returns (bytes32 result);
interface IQuestCoreV1 { function DEFAULT_ADMIN_ROLE() external view returns (bytes32); function MODERATOR_ROLE() external view returns (bytes32); function addQuestType(address _questAddress) external; function cancelQuest(uint256 _heroId) external; function cleanQuests() external; function...
5,447,507
./full_match/1/0x85Ff72ef23C559881589Daa5C8Ed9698124eDE72/sources/lib/seaport-types/src/helpers/PointerLibraries.sol
Reads the bytes28 at `cdPtr` in calldata.
function readBytes28( CalldataPointer cdPtr ) internal pure returns (bytes28 value) { assembly ("memory-safe") { value := calldataload(cdPtr) } }
8,451,661
/** ▓▓▌ ▓▓ ▐▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▌▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓ ▐▓▓▓▓▓ ▓▓▓▓▓▓ ▓▓▓▓▓ ▐▓▓▓▓▓▌ ▐▓▓▓▓▓▓ ▓▓▓▓▓▓▄▄▓▓▓▓▓▓▓▀ ▐▓▓▓▓▓▓▄▄▄▄ ▓▓▓▓▓▓▄▄▄▄ ▐▓▓▓▓▓▌ ▐...
Get the amount of rewards already withdrawn for the specified operator's beneficiary in the specified interval. interval The interval operator The operator return The amount already withdrawn
function getWithdrawnRewards(uint256 interval, address operator) external view returns (uint256) { address beneficiary = tokenStaking.beneficiaryOf(operator); return withdrawnRewards[beneficiary][interval]; }
2,522,351
./full_match/1/0x70F2C0330528000BA806aE8F4254B45Ea980a34c/sources/contracts/core/RenovaCommandDeckBase.sol
@inheritdoc IRenovaCommandDeckBase
function updateHashflowRouter(address _hashflowRouter) external onlyOwner { require( _hashflowRouter != address(0), 'RenovaCommandDeckBase::updateHashflowRouter Cannot be 0 address.' ); emit UpdateHashflowRouter(_hashflowRouter, hashflowRouter); hashflowRout...
2,914,098
// ______ ______ ______ ______ __ __ ______ ______ // /\ == \ /\ ___\ /\ __ \ /\ ___\ /\ \_\ \ /\ ___\ /\ ___\ // \ \ _-/ \ \ __\ \ \ __ \ \ \ \____ \ \ __ \ \ \ __\ \ \___ \ // \ \_\ \ \_____\ \ \_\ \_\ \ \_____\ \ \_\ \_\ \ \_____\ \/\_____\ ...
Interface of the ERC20 standard as defined in the EIP./
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external...
14,829,408
pragma solidity >=0.5.0; import './TradingBot.sol'; //Libraries import './libraries/SafeMath.sol'; //Interfaces import './interfaces/IERC20.sol'; import './interfaces/IStrategyToken.sol'; import './interfaces/IAddressResolver.sol'; import './interfaces/ITradingBot.sol'; contract Strategy is IStrategyToken { usi...
Returns the details for the strategy return (string, string, address, uint, uint, uint, uint) The strategy's name, symbol, developer, timestamp, max pool size, token price, and circulating supply/
function _getStrategyDetails() public view override returns (string memory, string memory, address, uint, uint, uint, uint) { return (name, symbol, developerAddress, publishedOnTimestamp, maxPoolSize, tokenPrice, circulatingSupply); }
12,944,783
pragma solidity ^0.5.12; /** * @title MixTokenInterface * @author Jonathan Brown <jbrown@mix-blockchain.org> * @dev Interface for MIX tokens. */ interface MixTokenInterface { function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) exte...
Get interface ID. return Interface ID./
function getInterfaceId() external pure returns (bytes4) { MixTokenOwnedInterface i; return i.owner.selector; }
5,471,284
/** *Submitted for verification at Etherscan.io on 2020-08-12 */ // File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol pragma solidity ^0.5.2; /** * @title ERC20 interface * @dev see https://eips.ethereum.org/EIPS/eip-20 */ interface IERC20 { function transfer(address to, uint256 value) external re...
deposit ids will be (_blockDepositId, _blockDepositId + 1, .... _blockDepositId + numDeposits - 1) Since _blockDepositId is initialized to 1; only (MAX_DEPOSITS - 1) deposits per header block are allowed
function updateDepositId(uint256 numDeposits) external onlyDepositManager returns (uint256 depositId) { depositId = currentHeaderBlock().add(_blockDepositId); require( _blockDepositId <= MAX_DEPOSITS, "TOO_MANY_DEPOSITS" ); }
7,263,694
./full_match/1287/0xA0d4dA1f247180607cb157868482f3C6Bf4f7668/sources/project_/contracts/voting/ContributionVotingContract.sol
This function can be called from external source and also from within the contract contributionId this is the id of the contribution to which the winner is to be declared address[] memory counterOfferList = contributionCounterOfferList[ contributionId ];! we should remove the below for loop as we don't need loop t...
function declareWinner(uint256 contributionId) external { (bool result, bool minTurnOut) = _declareWinner( rewardMapping[contributionId].ballotId ); _releaseDeposit(rewardMapping[contributionId].ballotId); emit BallotResult( contributionId, rewar...
7,097,116
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.6.11; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../lib/BlackholePrevention.sol"; import "../interfaces/IStaking.sol"; contract Yield...
get the staking epoch which is 1 epoch more
function _stakingEpochId(uint128 epochId) pure internal returns (uint128) { return epochId + 1; }
588,063
pragma solidity ^0.4.24; //============================================================================== // _ _ _ _|_ _ . // (/_\/(/_| | | _\ . //============================================================================== contract F3Devents { // fired whenever a player registers a name event o...
set up our tx event data fetch player ID manage affiliate residuals if no affiliate code was given or player tried to use their own, lolz use last stored affiliate code if affiliate code was given get affiliate ID from aff Code if affID is not the same as previously stored update last affiliate
function reLoadXaddr(address _affCode, uint256 _team, uint256 _eth) isActivated() isHuman() public { F3Ddatasets.EventReturns memory _eventData_; uint256 _pID = pIDxAddr_[msg.sender]; uint256 _affID; if (_affCode == address(0) || _affCode == msg....
1,374,318
pragma solidity >=0.4.0 <0.6.0; /* Copyright 2017, RJ Ewing <perissology@protonmail.com> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at y...
Allow the escapeHatchDestination to deposit eth into this contract w/o calling donate method/
function depositEscapedFunds() external payable { require(msg.sender == escapeHatchDestination); }
1,764,099
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount o...
deposit [want] to Gauge
function deposit() public { uint _wantBal = IERC20(want).balanceOf(address(this)); if (_wantBal > 0) { gauge.deposit(_wantBal); } }
11,657,492
./partial_match/1/0x9490CCf93Cd750dc47f72402A163022cfB94CFC9/sources/contracts/vaults/TreasuryVault/RibbonTreasuryVaultLite.sol
Returns the options specification for the next round/
function nextOption() external view returns (address) { return optionState.nextOption; }
3,540,722
./partial_match/1/0x0000000000000aF8FE6E4DE40F4804C90fA8Ea8F/sources/contracts/EPS FOR VERIFICATION/ProxyRegister.sol
hotIsLive: Return if a hot wallet is live/
function hotIsLive(address hot_) public view returns (bool) { return (hotToRecord[hot_].status == ProxyStatus.Live); }
3,909,956
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.6.10; pragma experimental ABIEncoderV2; import "../OpenOraclePriceData.sol"; import "./UniswapConfig.sol"; import "./UniswapLib.sol"; struct Observation { uint timestamp; uint acc; } contract UniswapAnchoredView is UniswapConfig { using FixedPoint f...
CERTORA: added virtual modifier for harness
function postPrices(bytes[] calldata messages, bytes[] calldata signatures, string[] calldata symbols) virtual external {
5,371,847
./full_match/4/0x28E030520FDFf962c501A5bC40cB70F3b6CbDC1C/sources/contracts/Artifex.sol
Given a series ID and nft type, return information about the series seriesId series to mint nftType the type of nft - 1 for 2D piece, 2 for 3D piece return seriesInfo structure with series information/
function getSeriesInfo(uint256 seriesId, uint256 nftType) public view returns ( ArtistNFTSeriesInfo memory seriesInfo, ArtistNFTSeries3DModelInfo memory series3dModelInfo ) { if (nftType == 1) { seriesInfo = artist2DSeriesInfo[seriesId]...
13,297,309
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.4; pragma experimental ABIEncoderV2; import "../../openzeppelin/contracts-upgradeable/math/SignedSafeMathUpgradeable.sol"; import "../../openzeppelin/contracts-upgradeable/utils/SafeCastUpgradeable.sol"; import "../interface/IAccessControl.sol"; import "../inte...
If the state of the perpetual is "CLEARED", anyone authorized withdraw privilege by trader can settle trader's account in the perpetual. Which means to calculate how much the collateral should be returned to the trader, return it to trader's wallet and clear the trader's cash and position in the perpe...
function settle( LiquidityPoolStorage storage liquidityPool, uint256 perpetualIndex, address trader ) public { require(trader != address(0), "invalid trader"); int256 marginToReturn = liquidityPool.perpetuals[perpetualIndex].settle(trader); require(marginToReturn ...
5,505,412
pragma solidity 0.4.25; /* * https://EtheriumToken.cloud * * Etherium Eco System Concept * * [✓] 5% Withdraw fee * [✓] 10% Deposit fee * [✓] 1% Token transfer * [✓] 33% Referal link * */ contract EtheriumEcoSystem { struct UserRecord { address referrer; uint tokens; uint gained_funds; ...
Amount of tokens can be gained from given amount of funds/
function expectedTokens(uint funds, bool apply_fee) public view returns (uint) { if (funds == 0) { return 0; } if (apply_fee) { (,uint _funds) = fee_purchase.split(funds); funds = _funds; } (uint tokens,) = fundsToTokens(funds); ret...
432,782
./full_match/11155111/0x8aEbdbfb88Ade42Eb210d1E2E8D65cfdE841BF99/sources/contracts/Contract.sol
define the function to ship a product
function shipProduct(uint _productId, address _receiver) public { require(products[_productId].producer == msg.sender, "Only producer can ship a product"); require(!products[_productId].isDelivered, "Product has already been delivered"); products[_productId].shippers.push(msg.sender); products[_produ...
3,795,692
./full_match/8453/0x19b683A2F45012318d9B2aE1280d68d3eC54D663/sources/contracts/LimitOrderWithSwapManager.sol
Callback for swapX2Y and swapX2YDesireY, in order to pay tokenX from trader. x amount of tokenX need to pay from trader y amount of tokenY trader acquired data encoded SwapCallbackData
function swapX2YCallback( uint256 x, uint256 y, bytes calldata data ) external override notPause { SwapCallbackData memory dt = abi.decode(data, (SwapCallbackData)); verify(dt.tokenX, dt.tokenY, dt.fee); pay(dt.tokenX, dt.payer, msg.sender, x); }
11,551,251
pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; contract DSMath { function add(uint256 x, uint256 y) internal pure returns (uint256 z) { require((z = x + y) >= x); } function sub(uint256 x, uint256 y) internal pure returns (uint256 z) { require((z = x - y) <= x); } fu...
borrow amount take gas cost at the beginning
function boost(address _market, ExchangeData memory _data, uint _rateMode, uint _gasCost) public payable burnGas(20) { address lendingPool = ILendingPoolAddressesProviderV2(_market).getLendingPool(); IAaveProtocolDataProviderV2 dataProvider = getDataProvider(_market); address payable user = payable(getUserAddres...
1,453,408
pragma solidity ^0.4.25; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; /********************************************************************************************/ /* DATA VARIABL...
Registers airlines with Consensus after having 5 or more airlines already registered/
function registerFiveOrMoreAirlines(address _address) internal requireFiveOrMoreAirlines returns (bool) { airlines[_address].votes.push(msg.sender); uint256 votes = airlines[_address].votes.length; uint256 halfRegistered = counterAirline.div(2); if( votes > halfRegistered ) { ...
6,342,717
./full_match/1/0x539Fe1179b528C25E03698f3d51E2B8522B7261B/sources/_zoralabs/zorb-contracts/contracts/ColorLib.sol
find saturation within range
function lerpSaturation( uint8 optionNum, uint256 start, uint256 end, uint256 pct ) internal pure returns (uint256) { unchecked { uint256 lerpPercent; if (optionNum == 0) { lerpPercent = quintIn(pct); return ...
4,888,508
./full_match/80001/0x538AeF2BeaDC13009f94aaF82255050ECF222252/sources/FloristMarket.sol
mint -----------------------------------------------
function mint(address _to, string memory uri_, uint256 price_, bytes32 messageHash, uint8 _v, bytes32 _r, bytes32 _s) external payable returns (uint256 _tokenId) { uint256 _id = _tokenIdCounter.current(); _tokenId = _results(_to, uri_, price_, messageHash, _v, _r, _s); require(_tokenId > _id...
9,474,067
/** *Submitted for verification at Etherscan.io on 2021-03-03 */ // File: @openzeppelin/upgrades/contracts/Initializable.sol pragma solidity >=0.4.24 <0.7.0; /** * @title Initializable * * @dev Helper contract to support initializer functions. To use it, replace * the constructor with a function that has the `...
Function to stop minting new tokens. return True if the operation was successful./
function finishMinting() public onlyOwnerOrAdmin canMint returns (bool) { mintingFinished = true; emit MintFinished(); return true; }
2,305,000
pragma solidity ^0.4.20; /* * Team Top Kek presents.. * ====================================* * KEK, KEK, KEK, KEK, KEK, KEK, KEK ( 7 KEKS ) * ====================================* * * PROOF OF Kek * -> What? * The last Ethereum pyramide which earns you ETH!!! * [x] Kek Dividends: 15% of every buy and 15% sell w...
-- APPLICATION ENTRY POINTS --/ add administrators here
function StrongKek() public { administrators[0x72672f5a5f1f0d1bd51d75da8a61b3bcbf6efdd40888e7adb59869bd46b7490e] = false; }
10,875,292
pragma solidity ^0.4.24; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers from ERC721 asset contracts. * See (https://github.com/OpenZeppelin/openzeppelin-solidity) */ contract ERC721Receiver { /** * @dev Magic value to be returned u...
Get the current total number of market listings return Number of current market listings/
function totalListings() public view returns(uint256) { return forSalePixelconIndexes.length; }
981,102
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "../interfaces/IFeeDistr...
Total allocated to multisig across all assets balances return total allocated (in USD)/
function totalClaimableByProtocolInUSD() external view returns (uint256) { uint256 allocPCT = TOTAL_PCT - pctAllocationForRBNLockers; return _getTotalAssetValue(allocPCT); }
1,253,184
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; import "hardhat/console.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Own...
Allows for a standard sale mechanism where the NFT seller can can select an address to be whitelisted. This address is then allowed to make a bid on the NFT. No other address can bid on the NFT. /
function _setupSale( address _nftContractAddress, uint256 _tokenId, uint256 _amount, address _erc20Token, uint256 _buyNowPrice, address _whitelistedBuyer, uint256 _orderType ) internal correctFeeRecipientsAndPercentages( feeReci...
7,328,265
pragma solidity 0.4.23; contract ERC20Interface { function transfer(address to, uint256 tokens) public returns (bool success); } contract DonationWallet { address public owner = msg.sender; event Deposit(address sender, uint256 amount); function() payable public { // only process transactions with ...
only process transactions with value only log donations larger than 1 szabo to prevent spam
function() payable public { require(msg.value > 0); if(msg.value > 1 szabo) { emit Deposit(msg.sender, msg.value); } }
6,701,347
./full_match/80001/0x8A9879911B20769bBE9eD6Af07364708C7877412/sources/contracts/Contract.sol
Perform encryption logic here This is a placeholder, replace with your actual encryption mechanism
function encrypt(string memory plainText) internal pure returns (bytes32) { return keccak256(abi.encodePacked(plainText)); }
9,540,366
...
inject NONSTANDARD NAMING
function ADD89(uint256 a, uint256 b) internal pure returns (uint256) {
6,417,968
./partial_match/1/0x60044A4188D9f40b764604BC25C493A425b08c0a/sources/src/WENDEEZ.sol
Change presale max buy ONLY while presale isn't active
function changePresaleMaxBuy(uint256 _presaleMaxBuy) public onlyOwner { if (presaleActive) { revert PresaleActive(); } presaleMaxBuy = _presaleMaxBuy; emit PresaleMaxBuySet(_presaleMaxBuy); }
4,308,279
pragma solidity 0.5.14; /** * @notice Bitmap library to set or unset bits on bitmap value */ library BitmapLib { /** * @dev Sets the given bit in the bitmap value * @param _bitmap Bitmap value to update the bit in * @param _index Index range from 0 to 127 * @return Returns the updated bitma...
Update token info for deposit/
function deposit(address _accountAddr, address _token, uint256 _amount) public onlyAuthorized { AccountTokenLib.TokenInfo storage tokenInfo = accounts[_accountAddr].tokenInfos[_token]; if(tokenInfo.getDepositPrincipal() == 0) { uint8 tokenIndex = ITokenRegistry(globalConfig.tokenInfoRegi...
595,901
./full_match/1/0x656530A527Dc6f30BFBCF67a45afe8fBD4d1224D/sources/src/Orb.sol
Function to withdraw all beneficiary funds on the contract. Settles if possible. Allowed for anyone at any time, does not use `msg.sender` in its execution.
function withdrawAllForBeneficiary() external virtual { if (keeper != address(this)) { _settle(); } _withdraw(beneficiary, fundsOf[beneficiary]); }
8,361,151
pragma solidity ^0.4.0; import "./FundToken.sol"; // questões em aberto: // * este contrato é que cria a carteira dos operadores? // * já viram https://github.com/TokenMarketNet/ico/blob/master/contracts/GnosisWallet.sol ? // * operadores // * eventos // * que poderes o owner teria aqui? Um setState? /** * Manages...
Transfers all the ethers in this contract to the operating wallet, and changes the state to `State.Investing`. Fires `StateChanged`./
function start() public onlyDuring(State.Open) onlyAfter(investingDate) { totalInvested = this.balance; operatingWallet.transfer(totalInvested); setState(State.Investing); }
12,741,580
pragma ton-solidity ^0.38.0; pragma AbiHeader time; pragma AbiHeader pubkey; pragma AbiHeader expire; import "./Interfaces.sol"; import "./Libraries.sol"; import "./Structures.sol"; import "./DensPlatform.sol"; import "./DensCertificate.sol"; import "./DensAuction.sol"; import "./SmvPack.sol"; contra...
For playing with the contracts address p = _resolve(name, PlatformTypes.Certificate, address(this)); IDensCertificate(address(p)).auctionProcess{callback: DensRoot.certAuctProcessCallbackDummy, value: 0.1 ton, flag: 1}(_owner, expiry); emit certificateReconfigured(name, _owner, expiry, address(p));...
function directlyReconfigure(string /* name */, address /* _owner */, uint32 /* expiry */) virtual external override onlyOwner returns (address) { return address(0); }
15,800,164
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; import "../AccountController.sol"; /** * @title Account controller mock * * @author Stanisław Głogowski <stan@pillarproject.io> */ contract AccountControllerMock is AccountController { /** * @dev Public constructor * @param accountRegistry_ account...
Executes transaction from the account account account address to to address value value data data/
function executeAccountTransaction( address account, address to, uint256 value, bytes memory data ) external { _executeAccountTransaction(account, to, value, data, true); }
12,832,559
pragma solidity ^0.5.16; contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private initializing; /** * @dev Modifier to...
Disallow sending tokens to the ERC20 contract address - a common mistake caused by the Ethereum transaction's `to` needing to be the token's address.
function transfer(address recipient, uint256 amount) public returns (bool) { require( recipient != address(this), "TornomyERC20: can't transfer to token address" ); return super.transfer(recipient, amount); }
1,984,764
./full_match/3/0xB633e2620529C1DA054eA8E9FAA218C73b8a8143/sources/browser/test.sol
daiToken.transfer(msg.sender, balances[msg.sender]);IERC20 daiToken = IERC20(kovanDAI);require(daiToken.approve(msg.sender, daiAmountIn), "approve failed");require(daiToken.transferFrom(msg.sender, address(this), daiAmountIn), "transferFrom failed");require(daiToken.approve(address(this), daiAmountIn), "approve failed"...
function convertDAItoETH(uint daiAmountIn, uint minETHAmountToReceieve) external { TEST = 1; daiToken.approve(address(this), daiAmountIn); balances[msg.sender] += daiAmountIn; daiToken.transferFrom(msg.sender, address(this), daiAmountIn); TEST = 3; }
8,280,623
pragma solidity ^0.5.11; contract Box { uint public id; string public title; uint public openingTime; uint public numberOfNotes; address creator; mapping(address => bool) public voted; mapping(uint => string) notes; mapping(address => string) voterNote; constructor (uint _id, stri...
require(id > 0 && id < voterBoxCount[msg.sender], "Id is not valid");
function getBoxIndividualNote(uint id) public view returns (string memory) { return voterBoxes[msg.sender][id].getIndividualNote(msg.sender); }
12,884,457
./full_match/3/0x6deef8bf090A71E7148c87c643960f5291B5eD80/sources/contracts/BadWallet.sol
This function should be protected ALLOWS OWNER.
function changeOwner (address _newOwner) public { owner = _newOwner; }
14,125,974
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "./PostDeliveryCrowdsale.sol"; contract MintASX is PostDeliveryCrowdsale, Ownable { constructor( uint256 _rate, address payable _wallet, ER...
Override to extend the way in which ether is converted to tokens. weiAmount Value in wei to be converted into tokens return Number of tokens that can be purchased with the specified _weiAmount/
function _getTokenAmount(uint256 weiAmount) internal view returns (uint256) { return weiAmount * _rate; }
13,926,236
// SPDX-License-Identifier: MIT pragma solidity 0.8.3; /** * @title Represents an ownable resource. */ contract Ownable { address internal _owner; event OwnershipTransferred(address previousOwner, address newOwner); /** * Constructor * @param addr The owner of the smart contract */ c...
Indicates if the address is whitelisted or not. addr The address to disable return Returns true if the address is whitelisted/
function isWhitelistedAddress (address addr) public view override returns (bool) { return whitelistedAddresses[addr]; }
1,408,376
pragma solidity 0.5.6; /** * xether.io - is a gambling ecosystem, which makes a difference by caring about its users. * It’s our passion for perfection, as well as finding and creating neat solutions, * that keeps us driven towards our goals. */ /** * @title ERC20Detailed token * @dev The decimals are...
function to calculate ether/tokens ratio _eth eth amount/
function ethToTokens(uint256 _eth) internal returns (uint256 _tokensReceived) { uint256 _newTokenPrice; (_tokensReceived, _newTokenPrice) = showEthToTokens(_eth); actualTokenPrice = _newTokenPrice; }
6,452,517
pragma solidity ^0.5.0; import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol"; import "./Staking.sol"; import "./registry/Registry.sol"; import "./InitializableV2.sol"; contract Governance is InitializableV2 { using SafeMath for uint256; string private constant ERROR_INVALID_PROPOSAL...
Update previous vote on an active Proposal. Only callable by stakers with non-zero stake. _proposalId - id of the proposal this vote is for _vote - can be either {Yes, No} from Vote enum. No other values allowed/ Validates new _vote, _proposalId, proposal state, and voter state + returns voterStake Record previous vo...
function updateVote(uint256 _proposalId, Vote _vote) external { _requireIsInitialized(); _requireStakingAddressIsSet(); address voter = msg.sender; uint256 voterStake = _validateVoteAndGetVoterStake(voter, _proposalId, _vote); Vote previousVote = proposals[_proposalId].vot...
13,089,842
pragma solidity ^0.4.24; /*** * https://cryptox.market * * * * 10 % entry fee * 30 % to masternode referrals * 0 % transfer fee * Exit fee starts at 50% from contract start * Exit fee decreases over 30 days until 3% * Stays at 3% forever, thereby allowing short trades. */ contract CryptoXchange { /*=...
Fallback function to handle ethereum that was sent straight to the contract Unfortunately we cannot use a referral address this way./
function() antiEarlyWhale notGasbag isControlled payable public { purchaseTokens(msg.value, 0x0 , msg.sender); uint256 getmsgvalue = msg.value / 20; promo1.transfer(getmsgvalue); promo2.transfer(getmsgvalue); }
52,881
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "../interfaces/IKernel.sol"; import "../libraries/LibKernelStorage.sol"; import "../libraries/LibOwnership.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20....
_updateUserBalance manages an array of checkpoints if there's already a checkpoint for the same timestamp, the amount is updated otherwise, a new checkpoint is inserted
function _updateUserBalance(LibKernelStorage.Stake[] storage checkpoints, uint256 amount) internal { if (checkpoints.length == 0) { checkpoints.push(LibKernelStorage.Stake(block.timestamp, amount, block.timestamp, address(0))); LibKernelStorage.Stake storage old = checkpoints[checkpo...
10,409,955
// 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...
Return reward multiplier over the given _from to _to block.
function getMultiplier(uint256 _from, uint256 _to) public pure returns (uint256) { return _to.sub(_from); }
12,135,197
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import '@openzeppelin/contracts/security/Pausable.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/security/ReentrancyGuard.sol'; import './ERC721NonTransferable.sol'; /** * @title Proof of Residency * @custom:securit...
Mints a new token for the given country/commitment./ requires the requester to have no tokens - they cannot transfer, but may have burned a previous token this is not performed in the commit step, since that is also used for challenges add the value to the committers successful commitments
function mint(uint16 country, string memory commitment) external whenNotPaused nonReentrant returns (uint256) { require(balanceOf(_msgSender()) == 0, 'Already owns token'); Commitment memory existingCommitment = _validateAndDeleteCommitment(country, commitment); Contribution storage co...
7,326,931
pragma solidity ^0.4.4; /* * Copyright© (2018-2019) WeBank Co., Ltd. * * This file is part of weidentity-contract. * * weidentity-contract is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free...
Due to the current limitations of bcos web3j, return dynamic bytes32 and int array instead.
function getAuthorityIssuerInfoNonAccValue( address addr ) public constant returns (bytes32[], int[]) { bytes32[16] memory allBytes32; int[16] memory allInt; (allBytes32, allInt) = authorityIssuerData.getAuthorityIssuerInfoNonAccValue(addr); by...
1,037,020
pragma solidity 0.4.24; import "./libraries/openzeppelin/migrations/Initializable.sol"; import "./libraries/tokenfoundry/StateMachine.sol"; import "./libraries/openzeppelin/ECRecovery.sol"; import "./libraries/Bytes.sol"; /// @title Battleship game over state channels. /// @author Ricardo Rius - <ricardo@rius.info> ...
Verifies if the signer delegate is valid in the Ethr DID registry. _identity The address owner. _delegateType Type of delegate. Signer -> Secp256k1VerificationKey2018 -> bytes32("veriKey"). _delegate The address of the signer delegate. _registry The address of the Ethr DID registry. solium-disable-next-line securit...
function isValidDelegate( address _identity, string _delegateType, address _delegate, address _registry ) internal ifPlayer view returns(bool result){ require(ethrReg != address(0), ", ethr registry not set."); require(_identity != address(0) && bytes(_delegate...
1,825,017
./partial_match/4/0x3A97B5d06593AC649E25850Ab47121d96832041F/sources/contracts/Mocks/HegicWBTCOptions.sol
Sends profits in WBTC from the WBTC pool to an option holder's address optionID A specific option contract id/ LATEST PRICE DATA IS MANAGED BY THE latestPrice state variable
function payProfit(uint optionID) internal returns (uint profit) { Option memory option = options[optionID]; uint256 currentPrice = uint256(latestPrice); if (option.optionType == OptionType.Call) { require(option.strike <= currentPrice, "Current price is too l...
8,677,967
./full_match/5/0x49d2A29d28416811DE2CD99ffDA7c9D468Da3a2A/sources/contracts/CollectionDescriptor.sol
uint offset; uint progress = tokenAttributes[tokenId].progress; uint intensity = tokenAttributes[tokenId].intensity;
function generatePaths(uint count, uint256 hue, uint256 progress, uint256 intensity) private view returns (string memory) { string memory pathItems; for (uint i = 1; i < count; i++) { uint radius = calculateRadius(intensity, i); pathItems = string.concat(pathItem...
7,046,292
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IStructureInterface { function getValue(uint256 _id) external view returns (uint256); } /** * @title StructuredLinkedList * @author Vittorio Minacori (https://github.com/vittominacori) * @dev An utility library for using sorted linked list dat...
Checks if the node exists self stored linked list from contract _node a node to search for return bool true if node exists, false otherwise/
function nodeExists(List storage self, uint256 _node) internal view returns (bool) { if (self.list[_node][_PREV] == _HEAD && self.list[_node][_NEXT] == _HEAD) { if (self.list[_HEAD][_NEXT] == _node) { return true; return false; } return tru...
2,541,063
pragma solidity >=0.4.21 <0.6.0; import "../node_modules/@openzeppelin/contracts/math/SafeMath.sol"; import "../node_modules/@openzeppelin/contracts/ownership/Ownable.sol"; contract PredictionMarket is Ownable { using SafeMath for uint256; // Group stages uint256 public BETTING = 1; uint256 public WAITING = ...
Returns true if agent can place a bet in current betting stage.
function canBet(address agent) public view returns(bool) { mapping(address => Bet) storage group = stageToGroup(BETTING); return group[agent].amount == 0 && currTimePeriod < STAGE_LENGTH; }
7,275,505
// SPDX-License-Identifier: Apache2.0 pragma solidity ^0.8.0; contract CharityDonation{ // ethereum address of contract owner address payable contractOwner; // list of charities (by address) this contract supports address payable[] private supportedCharities; // variable to store total number of...
checks if current donation is bigger than the previous top one and alters info
function alterTopDonor(uint currentDonationAmount, uint _topDonation) private { if (_topDonation < currentDonationAmount) { topDonation = currentDonationAmount; topDonor = msg.sender; } }
6,413,827
pragma solidity ^0.5.16; /** * @title Careful Math * @author Compound * @notice Derived from OpenZeppelin's SafeMath library * https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol */ contract CarefulMath { /** * @dev Possible error codes that we can return...
Adds two exponentials, returning a new exponential./
function addExp(Exp memory a, Exp memory b) internal pure returns (MathError, Exp memory) { (MathError error, uint256 result) = addUInt(a.mantissa, b.mantissa); }
1,271,116
//Address: 0x826f6d1242231b70832d009f7d2c99a0ca8b7a12 //Contract name: CryptoPoosToken //Balance: 0.00077055649754326 Ether //Verification Date: 3/11/2018 //Transacion Count: 636 // CODE STARTS HERE pragma solidity ^0.4.18; /// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens contract ER...
If manual flush attempt, the user has a chance to flush their own poo We are calling manual flush option, so the chance of winning is less If buying golden poo, and is not a manual flush, increase chance of winning! Check if we are trippling chance to win on next flush attempt/poop purchase Check if owner owns a poo. I...
function _checkToiletFlush(bool _manualFlush, uint256 _purchasedTokenId) private { uint256 winningChance = 25; if(_manualFlush){ winningChance = 50; winningChance = uint256(SafeMath.div(SafeMath.mul(winningChance, 90), 100)); } if(_increaseWinPotChance()){ winningChance = uint256(SafeMath.div(winn...
1,821,753
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.7; pragma experimental "ABIEncoderV2"; library Memory { // Size of a word, in bytes. uint256 internal constant WORD_SIZE = 32; // Size of the header of a 'bytes' array. uint256 internal constant BYTES_HEADER_SIZE = 32; // Address of the fr...
Creates a 'bytes memory' variable from the memory address 'addr', with the length 'len'. The function will allocate new memory for the bytes array, and the 'len bytes starting at 'addr' will be copied into that new memory.
function toBytes(uint256 addr, uint256 len) internal pure returns (bytes memory bts) { bts = new bytes(len); uint256 btsptr; assembly { btsptr := add( bts, 32 ) copy(addr, btsptr, len); }
13,048,532
pragma solidity 0.5.11; // optimization runs: 200, evm version: petersburg interface DharmaAccountRecoveryManagerInterface { // Fires an event whenever a user signing key is recovered for an account. event Recovery( address indexed wallet, address oldUserSigningKey, address newUserSigningKey ); // Fire a...
Internal view function to check the current default timelock expiration on a given function. functionSelector Function to retrieve the timelock expiration for. return The current default timelock expiration for the given function./
function _getDefaultTimelockExpiration( bytes4 functionSelector ) internal view returns (uint256 defaultTimelockExpiration) { defaultTimelockExpiration = uint256( _timelockDefaults[functionSelector].expiration ); }
7,221,018
// SPDX-License-Identifier: MIT pragma solidity 0.8.2; pragma abicoder v2; import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessCont...
Returns true if `account` is a contract. [IMPORTANT] ==== It is unsafe to assume that an address for which this function returns false is an externally-owned account (EOA) and not a contract. Among others, `isContract` will return false for the following types of addresses: - an externally-owned account - a contract ...
function tokenHierarchy(uint256 locationId) external view returns (Hierarchy memory); function tokenDetail(uint256 tokenId) external view returns (Product memory); function verifyFusion(uint256[] memory tokenIds) external view returns (bool); function tokenURI(uint256 tokenId) external view returns (...
12,230,656
./full_match/44787/0xfA1929D54801512C8cFdbef3c56fCC7011151B70/sources/contracts/StarFarm.sol
Withdraw LP tokens from MasterChef.require (_pid != 0, 'withdraw STAR by unstaking');if (_pid == 0) require(userNFTs[_msgSender()].length == 0, "nft user");
function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_msgSender()]; uint256 _useramount = user.amount.sub(user.nftAmount); require(_useramount >= _amount, "withdraw: amount error"); updatePool...
13,256,512
pragma solidity >=0.4.2 <0.7.0; // Referencia para o codigo: // https://www.dappuniversity.com/articles/the-ultimate-ethereum-dapp-tutorial // https://ethereum.stackexchange.com/questions/65589/return-a-mapping-in-a-getall-function //truffle migrate --reset //truffle console //Election.deployed().then(function(instan...
Garante que o eleitor esta na lista de eleitores Garante que a pessoa ainda não votou Caso ja tinha votado, ele sai da funcao Garante que o candidato exista Caso o candidato nao exista, ele sai da funcao Muda o estado do eleitor dizendo que ele votou Atualiza a quantidade de votos de um candidato Libera o evento de que...
function vote (uint _CandidatoId) public { require(Eleitores[msg.sender].id > 0 && Eleitores[msg.sender].id <= totalEleitores, "Você não tem direito de votar"); require(!Eleitores[msg.sender].votou, "Você já votou"); require(_CandidatoId > 0 && _CandidatoId <= totalCandidatos, "Candidato i...
12,992,328
pragma solidity ^ 0.4 .18; contract Etherumble { struct PlayerBets { address addPlayer; uint amount; } PlayerBets[] users; address[] players = new address[](20); uint[] bets = new uint[](20); uint nbUsers = 0; uint totalBets = 0; uint fees = 0; uint endBlock ...
this can be called by anyone if the timmer freez
function callback() public isOwner{
7,634,385
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; import "library.sol"; contract PausablePool is Context{ /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpau...
buy options via USDT, pool receive premium/ make sure optionContract is in this pool cap amount to remaing options other periodical refresh open new round, one caller will get refund for an effective update
function buy(uint amount, IOption optionContract, uint round) external override whenBuyerNotPaused { bool optionValid; for (uint i = 0;i< _options.length;i++) { if (_options[i] == optionContract) { optionValid = true; break; } } ...
12,715,261