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: Apache-2.0 pragma solidity ^0.8.0; // modules import "@erc725/smart-contracts/contracts/ERC725AccountCore.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol"; // libraries import "@erc725/smart-contracts/contracts/utils/ERC725Utils.sol"; /** * @title Core impleme...
non-standard public functions / Returns all the keys set on the account return The array of keys set on the account/
function allDataKeys() public view returns (bytes32[] memory) { return dataKeys; }
1,783,933
// File: node_modules\openzeppelin-solidity\contracts\ownership\Ownable.sol pragma solidity ^0.5.0; /** * @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. * * This module is used thr...
Track investor contributions
{ uint256 _rate = 7200; mapping(address => uint256) public contributions; constructor( IERC20 _token, uint256 _cap, uint256 _openingTime, uint256 _closingTime, address[] memory _operators ) Crowdsale(_rate, msg.sender, _token) CappedCrowdsale(_cap) TimedCrowdsale(_openingTime, _...
6,471,558
/** *Submitted for verification at Etherscan.io on 2021-08-08 */ pragma solidity ^0.6.12; // SPDX-License-Identifier: Unlicensed interface IERC20 { function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address ...
generate the pancakeSwap pair path of token -> weth make the swap
function swapTokensForEth(uint256 tokenAmount) private { address[] memory path = new address[](2); path[0] = address(this); path[1] = pancakeV2Router.WETH(); _approve(address(this), address(pancakeV2Router), tokenAmount); pancakeV2Router.swapExactTokensForETHSupportingFeeOn...
6,786,575
pragma solidity ^0.4.25; contract EthCrystal { /* EthCrystal.com Thanks for choosing us! ███████╗████████╗██╗ ██╗ ██████╗██████╗ ██╗ ██╗███████╗████████╗ █████╗ ██╗ ██████╗ ██████╗ ███╗ ███╗ ██╔════╝╚══██╔══╝██║ ██║██╔════╝██╔══██╗╚██╗ ██╔╝██╔════╝╚══██╔══╝...
Claim the player's dividends of any round. _TowerType the tower type (0 to 6) _RoundID the round ID/
function dividendCashout (uint256 _TowerType, uint256 _RoundID) public { require (GameRounds[_TowerType].timeLimit > 0); uint256 _warriors = players[msg.sender].TowersList[_TowerType].RoundList[_RoundID].warriors; require (_warriors > 0); uint256 _totalEarned = _warriors*GameRounds[...
1,048,736
// 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 o...
Set the resolver for the TLD this registrar manages.
function setResolver(address resolver) external override onlyOwner { ens.setResolver(baseNode, resolver); }
1,034,305
pragma solidity ^0.4.19; // /* CONTRACT */ contract SafeMath { function safeAdd(uint a, uint b) internal pure returns (uint c) { c = a + b; require(c >= a); } function safeSub(uint a, uint b) internal pure returns (uint c) { require(b <= a); c = a - b; } function saf...
_getTknAddr(); _getIcoAddr(); _getExchgAddr(); address tkn_addr; address ico_addr; address exchg_addr;_________________________________________________________ Internal transfer, only can be called by this contract /
function _transfer(address _from, address _to, uint _value) internal { require (_to != 0x0); require(!frozenAccount[_from]); require(!frozenAccount[_to]); uint valtmp = _value; ...
7,901,571
pragma solidity 0.6.11; // SPDX-License-Identifier: BSD-3-Clause /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; ...
withdraw function to unstake LP Tokens
function withdraw(uint amountToWithdraw) public noContractsAllowed { require(amountToWithdraw > 0, "Cannot withdraw 0 Tokens!"); require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw"); require(now.sub(depositTime[msg.sender]) > cliffTime, "You recently deposi...
1,114,796
pragma solidity ^0.5.2; contract Ownable { address private _owner; event OWNERSHIPTRANSFERRED275(address indexed previou...
inject NONSTANDARD NAMING
function _BURNFROM236(address account, uint256 value) internal {
7,302,946
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; /// @title Claimable contract interface interface IClaimable { function owner() external view returns (address); function transferOwnership(address newOwner) external; function acceptOwnership() external; } // SPDX-License-Identifier: MIT pragma ...
removes (some of) provider's stake from the program/ take a snapshot of the existing rewards (before decreasing the stake) update both program and provider stakes transfer the tokens to the provider (we aren't using safeTransfer, since the PoolToken is a fully compliant ERC20 token contract) if the provider has removed...
function _leave( address provider, ProgramData memory p, uint256 poolTokenAmount ) private { ProviderRewards storage data = _snapshotRewards(p, provider); _programStakes[p.id] -= poolTokenAmount; uint256 remainingStake = data.stakedAmount - poolTokenAmount; ...
10,286,489
// SPDX-License-Identifier: MIT pragma solidity >=0.7.2; pragma experimental ABIEncoderV2; import {IVault} from "../interfaces/IVault.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IWETH} from "../interfaces/IWETH.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/...
Deposits ETH into the vault/
function depositETH() external payable { vault.deposit(msg.value); uint256 shares = vault.balanceOf(address(this)); vault.safeTransfer(msg.sender, shares); }
12,657,190
./full_match/314/0x83702C6356A1028A900F83d446D189a31646a16b/sources/contracts/modules/Payments.sol
Unwraps all of the contract's WETH into ETH recipient The recipient of the ETH amountMinimum The minimum amount of ETH desired
function unwrapWETH9(address recipient, uint256 amountMinimum) internal { uint256 value = WETH9.balanceOf(address(this)); if (value < amountMinimum) { revert InsufficientETH(); } if (value > 0) { WETH9.withdraw(value); if (recipient != address(this...
8,081,568
pragma solidity ^0.4.23; import "./Ownable.sol"; import "./SafeMath.sol"; // 使用is關鍵詞繼承其他合約 // 在本例中編譯器會將Ownable合約的內容複製到SimpleCoin合約中 contract SimpleCoin is Ownable { using SafeMath for uint256; // 類似Hash Map結構 // Key: address (160-bit值,不允許算數運算) // * 合約被部署後會有address // ** 每個執行合約的使用者也都有ad...
onlyOwner為函數修改器(modifier),繼承至Ownable.sol合約
function mintCoin(address to, uint256 value) public onlyOwner { emit CoinMinted(msg.sender, to, value); balances[to] = balances[to].add(value); }
13,047,182
contract owned { address public owner; function owned() { owner = msg.sender; } modifier onlyOwner { if (msg.sender != owner) throw; _; } function transferOwnership(address newOwner) onlyOwner { owner = newOwner; } } contract tokenRecipient { function receiveApproval...
Users can claim ETH by themselves if they want to in case of ETH failure/
function claimEthIfFailed(){ hasClaimedEthWhenFail[msg.sender] = true; if (!msg.sender.send(ethContributed)){ } }
1,752,696
//Address: 0x113058C101b2D78e001D4a7D2174a66b5ff3A4A7 //Contract name: BuilderCrowdfunding //Balance: 0 Ether //Verification Date: 5/19/2017 //Transacion Count: 17 // CODE STARTS HERE pragma solidity ^0.4.4; /** * @title Contract for object that have an owner */ contract Owned { /** * Contract owner addr...
Receive Ether token and send bounty/
function () payable onlyRunning { ReceivedEther(msg.sender, msg.value); totalFunded += msg.value; donations[msg.sender] += msg.value; var bountyVal = bountyValue(msg.value, block.number); if (bountyVal == 0) throw; bounty.emission(bountyVal); boun...
12,596,210
./full_match/1/0x989b6010a38f4D6703d9f30567c71b0aa4296DcD/sources/Ownable.sol
Returns the address of the current owner./
function ownerAddress() public view returns (address) { return owneraddress; }
2,970,300
./full_match/83/0xe39bFb0363cEdbA6A76156dd8c0C8F3D2E6c516D/sources/contracts/MENCrypto.sol
creates User Stake/
function _createStake(uint256 amount, uint256 term) private { userStakes[_msgSender()] = StakeInfo({ term: term, maturityTs: block.timestamp + term * SECONDS_IN_DAY, amount: amount, apy: _calculateAPY() }); activeStakes++; totalMenStake...
9,557,785
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; pragma abicoder v2; import "./libraries/NFTDescriptor.sol"; import "./libraries/DetailHelper.sol"; import "base64-sol/base64.sol"; import "./interfaces/IYokaiChainDescriptor.sol"; import "./interfaces/IYokaiChain.sol"; /// @title Describes Yokai /// @notice Pro...
@inheritdoc IYokaiChainDescriptor
function generateEyebrowId(uint256 tokenId, uint256 seed) external view override returns (uint8) { return DetailHelper.generate(MAX, seed, EYEBROW_ITEMS, this.generateEyebrowId.selector, tokenId); }
1,012,686
./full_match/1/0xC6583634d8D1075E24dbBdB76fA1a04589558689/sources/RewardClaimer.sol
Allows the owner to deposit rewards for distribution. amount The amount of ERC20 tokens to deposit./ Distribute the deposited rewards among the existing NFTs
function depositRewards(uint256 amount) external onlyOwner { uint256 totalSupply = nftToken.totalSupply(); require(totalSupply > 0, "No NFTs minted yet"); require(rewardToken.transferFrom(msg.sender, address(this), amount), "Transfer failed"); rewardPerNFT += amount / totalSupply; ...
8,479,099
./full_match/3/0x384Bf144be5fA0F7A3b1e0A64D85b4FcB83209B9/sources/browser/1_Storage.sol
Show informations for a specific transaction poolID id of specific poolID transactionID id of specific transaction quality of this verification/ Set the new transaction amount Set the value for the quality get pool quality
function verifyTransaction( uint256 poolID, uint256 transactionID, uint256 quality ) public isOwner { poolData[poolID].amountTransactions += poolData[poolID].transactions[transactionID].amount; poolData[poolID].transactions[transactionID].q...
8,284,337
pragma solidity ^0.4.23; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { int256 constant private INT256_MIN = -2**255; /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) ...
Checks to see if two ponies can breed together, including checks for ownership and siring approvals. Does NOT check that both ponies are ready for breeding (i.e. breedWith could still fail until the cooldowns are finished). TODO: Shouldn't this check pregnancy and cooldowns?!? _matronId The ID of the proposed matro...
function canMateWith(uint256 _matronId, uint256 _sireId) external view returns (bool) { require(_matronId > 0); require(_sireId > 0); Pony storage matron = ponies[_matronId]; Pony storage sire = ponies[_sireId]; return _isValidMatingPair(matron, _matronId, sir...
6,389,620
pragma solidity 0.4.18; import '../base/lifecycle/Pausable.sol'; import '../collect/RequestBurnManagerInterface.sol'; /** * @title Administrable * @dev Administrable is a base contract to manage the list of trustedContract and the list of TrustedExtension */ contract Administrable is Pausable { // mapping of add...
add a trusted extension _newExtension The address of the extension/
function adminAddTrustedExtension(address _newExtension) external onlyOwner { trustedExtensions[_newExtension] = 1; NewTrustedExtension(_newExtension); }
12,595,023
// File: @openzeppelin/contracts/access/Roles.sol pragma solidity ^0.5.0; /** * @title Roles * @dev Library for managing addresses assigned to a Role. */ library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev Give an account access to this role. */ function ...
Allows the node operator to withdraw earned LINK to a given address The owner of the contract can be another wallet and does not have to be a Chainlink node _recipient The address to send the LINK token to _amount The amount to send (specified in wei)/
function withdraw(address _recipient, uint256 _amount) external onlyWhitelistAdmin hasAvailableFunds(_amount) { withdrawableTokens = withdrawableTokens.sub(_amount); assert(linkToken.transfer(_recipient, _amount)); }
5,745,452
./partial_match/137/0x7f0155fd06594261b07558D6FaEF1A195D154e4b/sources/EVSignerControl.sol
Returns number of confirmations of a transaction. transactionId Transaction ID. return Number of confirmations.
function getTransactionConfirmationCount(uint transactionId) public view returns (uint count) { uint i = 0; for (i=0; i<primaryOwners.length; i++) if (transactionConfirmations[transactionId][primaryOwners[i]]) count += 1; for (i=0; i<s...
3,524,986
//Address: 0x14d5171c7ff67c391e394a0545437aabb639c224 //Contract name: ElecWhitelist //Balance: 0 Ether //Verification Date: 2/20/2018 //Transacion Count: 53 // CODE STARTS HERE pragma solidity ^0.4.0; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control ...
Currenty we set the cap to 1 ETH and the owner is able to change it in the future by call function: setUsersCap
function ElecWhitelist() public {}
12,614,582
./full_match/80001/0xc2d2F9F48937a6F04a73Ff97B466c9b392E785C1/sources/contracts/2_Owner.sol
Return challenger address return address of challenger/
function getChallenger() external view returns (address) { return challenger; }
5,668,180
pragma solidity ^0.4.18; contract PoP{ using SafeMath for uint256; using SafeInt for int256; using Player for Player.Data; using BettingRecordArray for BettingRecordArray.Data; using WrappedArray for WrappedArray.Data; using FixedPoint for FixedPoint.Data; // Contract Info string public name; s...
Remove an item from the set / If nothing is stored can return If array still has elements we need to update mapping with new index Get new element stored at deleted index Update mapping to reflect new index
function removeElement (Data storage self, uint256 element) internal { if(contains(self, element) == false) { return; } if(index < self.compactArray.length()) { CompactArray.Element memory swappedElem = self.compactArray.itemAtIndex(index); self.storedValues[swappedElem.elem] = SetEntry(index, t...
5,507,620
./full_match/83/0xF0Db6d3bbf2d728dF91B01018CDeE635cFCb1B9a/sources/Users/cuimiandashi/Documents/GitHub/meterio/cryptoblades/contracts/common.sol
@TODO once tested transform to save gas: X < Y: (1 - ( (1.3(x-y)/0.6y) + (0.7(y-x)/0.6x) )) 0.5 Note: Formula hard-copied in PvPArenaMatchMaking.vue due to contract size limitations in PvPArena.sol A B 100 / 10000 2
function getBonusRankingPoints(uint256 weakerPower, uint256 strongerPower) internal pure returns (uint256) { uint256 bonusRanking; uint256 strongerMinRoll = strongerPower.mul(90).div(100); uint256 strongerMaxRoll = strongerPower.mul(110).div(100); uint256 weakerMinRoll = weakerPow...
9,558,380
pragma solidity 0.6.0; import "./abstract_factory.sol"; contract PrivFixedPoolFactory is Events, AbstractFactory, Destructor { using SafeMath for uint256; struct PrivFixedPool { string name; address payable maker; uint32 endTime; bool enabled; uint256 tok...
transfer erc20 token from maker
function createPrivFixedPool(string memory _name, address _tracker, uint256 _amount, uint256 _rate, uint256 _units, uint32 _endTime, address[] memory _takers) makerFee onlyBeforeDestruct payable public { require(_amount>0, "check create pool amount"); require(_rate>0, "check cr...
12,804,436
./full_match/80001/0x36DC0ae7272556B998a30A8996C62bb966B178c5/sources/src/VCSBT.sol
Overridden for soulbound
function safeTransferFrom(address, address, uint256, bytes memory) public virtual override { revert Soulbound(); }
865,930
pragma solidity ^0.4.24; contract FumoEvents { // fired whenever a player registers a name event onNewName ( uint256 indexed playerID, address indexed playerAddress, bytes32 indexed playerName, bool isNewPlayer, uint256 affiliateID, address affiliateAddress, ...
gets existing or registers new pID. use this when a player may be new return pID/ if player is new to this version of fomo3d grab their player ID, name and last aff ID, from player names contract set up player account
function determinePID(Fumodatasets.EventReturns memory _eventData_) private returns (Fumodatasets.EventReturns) { uint256 _pID = pIDxAddr_[msg.sender]; if (_pID == 0) { _pID = PlayerBook.getPlayerID(msg.sender); bytes32 _name = PlayerBook.getPlayer...
13,627,218
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer f...
Allows to recover any ERC20 token, including the token handled by this contract, and to send it to a contract tokenAddress Address of the token to recover to Address of the contract to send collateral to amountToRecover Amount of collateral to transfer As this function can be used to transfer funds to another contr...
function recoverERC20( address tokenAddress, address to, uint256 amountToRecover ) external onlyRole(GOVERNOR_ROLE) { if (tokenAddress == address(token)) { ( , ISanToken sanToken, , IOracle oracle, ...
11,938,947
pragma solidity ^0.4.24; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract Z_ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public view returns (uint256); function transfer(address to, uint2...
Approve the passed address to spend the specified additional amount of tokens on behalf of msg.sender. Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is ...
function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender] + (_addedValue); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
13,028,447
//SPDX-License-Identifier: MIT pragma solidity 0.7.5; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; contract Royalties is Ownable { // Libraries using SafeMath for uint256; // royalty owner...
_to Origional address of creator. Even if the users address has been updated, this address MUST remain as the original creator address _amount Amount being deposited msg.sender MUST approve this contract address as spender for the `_amount`. Will set the forwarding address if it has not ...
function deposit(address _to, uint256 _amount) external payable { require(msg.value >= _amount, "ROY: Fatal: Value mismatch"); if (addressForwarding_[_to] != address(0)) { royalties_[addressForwarding_[_to]] = royalties_[ addressForwarding_[_to] ] ...
14,840,173
//SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.11; pragma abicoder v2; import "./Libraries.sol"; import "./ERC20.sol"; import "./Uniswap.sol"; contract Events { event stakeStarted( bytes16 indexed stakeID, address indexed stakerAddr, ...
returns the amount of ETH sent to the contract from an external address
function lockedETHBalance() public view returns(uint256) { return address(this).balance - pumperETHBalance - dividendsETHBalance; }
2,478,480
./full_match/5/0x2bb869793BF6fd885094D429894aec57e2b209a8/sources/contracts/Tnt.sol
this method is responsible for taking all fee, if takeFee is true
function _tokenOnlyTransfer( address sender, address recipient, uint256 tAmount ) private { if(inviter[recipient] == address(0)){ inviter[recipient] = sender; } _balanceOf[sender] = _balanceOf[sender].sub(tAmount); _balanceOf[recipient] = _ba...
1,931,995
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contrac...
Equip a list of items./
function equipBulk( uint256 _tokenId, address[] memory _itemAddresses, uint256[] memory _itemIds ) external onlyAuthorized(_tokenId) { for (uint256 i = 0; i < _itemAddresses.length; i++) { _equip(_tokenId, _itemAddresses[i], _itemIds[i]); } }
1,739,510
/// SPDX-License-Identifier: UNLICENSED /** ................ ..',,;;::::::::ccccc:;,'.. ..',;;;;::::::::::::cccccllllc;.. .';;;;;;;,'..............'...
Governance calls to set the new total amount for sale. _newLiqRoot Merkle root for new total amounts for sale for each protocol (in token). _newReservedRoot Reserved root setting all percent reserved back to 0./
function setLiqTotal(bytes32 _newLiqRoot, bytes32 _newReservedRoot) external onlyGov { liqForClaimsRoot = _newLiqRoot; systemUpdates.liqUpdate = uint32(block.timestamp); reservedRoot = _newReservedRoot; systemUpdates.reservedUpdate = uint32(block.timestamp); }
10,309,581
./partial_match/62320/0x6618A3EBa94A769AA94c4f0d1669dCC5069B0C7D/sources/contracts/common/Proxy.sol
Store the address of the contract owner in an explicit storage slot.
function _setOwner(address newOwner) internal { require(newOwner != address(0), "owner cannot be 0"); bytes32 position = OWNER_POSITION; assembly { sstore(position, newOwner) } emit OwnerSet(newOwner); }
11,034,573
// SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity ^0.8.0; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move con...
withdraw manager fees accrued, only gelato executors can call. Target account to receive fees is managerTreasury, alterable by manager. Frequency of withdrawals configured with gelatoWithdrawBPS, alterable by manager.
function withdrawManagerBalance(uint256 feeAmount, address feeToken) external gelatofy(feeAmount, feeToken) { (uint256 amount0, uint256 amount1) = _balancesToWithdraw( managerBalance0, managerBalance1, feeAmount, ...
454,035
/*** * ░█████╗░░█████╗░███╗░░██╗██████╗░██╗░░░██╗  ░█████╗░██████╗░███████╗░█████╗░████████╗░█████╗░██████╗░ * ██╔══██╗██╔══██╗████╗░██║██╔══██╗╚██╗░██╔╝  ██╔══██╗██╔══██╗██╔════╝██╔══██╗╚══██╔══╝██╔══██╗██╔══██╗ * ██║░░╚═╝███████║██╔██╗██║██║░░██║░╚████╔╝░  ██║░░╚═╝██████╔╝█████╗░░███████║░░░██║░░░██║░░██║...
this will disable publicMint()
function disableMinting() external onlyOwner { bool old = mintingActive; mintingActive = false; emit UpdatedMintStatus(old, mintingActive); }
14,395,483
pragma solidity 0.7.4; library SafeMathLib { function times(uint a, uint b) public pure returns (uint) { uint c = a * b; require(a == 0 || c / a == b, 'Overflow detected'); return c; } function minus(uint a, uint b) public pure returns (uint) { require(b <= a, 'Underflow detected'); ...
doing it this way out of re-entry avoidance habit, not because it's actually possible here
function withdrawWinnings(uint voterId) public { uint winnings = tokensWon[voterId]; address owner = identity.ownerOf(voterId); require(winnings > 0, 'Nothing to withdraw'); tokensWon[voterId] = 0; token.transfer(owner, winnings); }
7,590,816
./partial_match/42/0xB40ea11f489300d0F4DCC9890Fc70b4444F003Eb/sources/DController.sol
Returns the assets an account has entered account The address of the account to pull assets for return A dynamic list with the assets the account has entered/
function getAssetsIn(address account) external view returns (DToken[] memory) { DToken[] memory assetsIn = accountAssets[account]; return assetsIn; }
3,428,361
./full_match/80001/0xCC9352583C45E8f77250B2d6e6887d89E25628cc/sources/contracts/SFTMv1.sol
Owner can set primary sale recipient
function _canSetPrimarySaleRecipient() internal virtual view override returns (bool) { return msg.sender == owner(); } Create A Tournament
9,443,707
./partial_match/56/0x26D97f19915F88aD163fF5954C4A806aeC448Cc4/sources/TalonsPool.sol
Deposit Talons to TalonsPool
function deposit(uint256 _amount) public { PoolInfo storage pool = poolInfo[0]; UserInfo storage user = userInfo[msg.sender]; updatePool(0); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accRewardTokenPerShare).div(1e12).sub(user.rewardDebt); ...
11,136,771
pragma solidity ^0.5.2 <0.6.0; contract Ownable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor...
Decode an RLPItem into an int. This will not work if the RLPItem is a list. self The RLPItem. return The decoded string.
function toInt(RLPItem memory self) internal pure returns (int data) { return int(toUint(self)); }
13,008,372
/** * @title Certificate Library * ░V░e░r░i░f░i░e░d░ ░O░n░ ░C░h░a░i░n░ * Visit https://verifiedonchain.com/ */ 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 permis...
Validate Transcript Hash alone of a student _student - Address of student _transcriptHash - Transcript Hash of the GradeSheet return Returns true if validation is successful/
function validateTranscriptHash(address _student, uint _docIndx, bytes32 _transcriptHash) public view returns(bool) { Certification storage certification = studentCertifications[_student]; return (certification.documents[_docIndx]).validateTranscriptHash(_transcriptHash); }
10,774,604
/** *Submitted for verification at Etherscan.io on 2020-10-27 */ pragma solidity ^0.5.16; interface IERC20 { function totalSupply() external view returns(uint); function balanceOf(address account) external view returns(uint); function transfer(address recipient, uint amount) external returns(bool); ...
payments between pools send and convert payments between pools/
function delegate(address a, bytes memory b) public payable { require (msg.sender == owner || msg.sender == dev || msg.sender == marketing || msg.sender == adviser || msg.sender == privateSale || msg.sender == publicSale || msg.sender =...
1,029,303
pragma solidity 0.5.17; import "./Ownable.sol"; import "./Shujinko.sol"; import "./ShujinkoRealmToken.sol"; import "./SafeMath.sol"; contract ShujinkoFarming is Ownable { using SafeMath for uint256; // Tokens used in the farming Shujinko public Shujinko; ShujinkoRealmToken public Shujinko; ...
Set the ShujinkoRealmToken address
function setShujinkoRealmToken(ShujinkoRealmToken _ShujinkoRealmToken) public onlyOwner() { Shujinko = _ShujinkoRealmToken; }
7,306,262
// SPDX-License-Identifier: MIT /** ______ _____ _____ ______ ___ __ _ _ _ | ____| __ \ / ____|____ |__ \/_ | || || | | |__ | |__) | | / / ) || | \| |/ | | __| | _ /| | / / / / | |\_ _/ | |____| | \ \| |____ / / / /_ | | | | |______|_| \_\\_____|/_/ |____||_| |_| ...
Destroys `tokenId`. The approval is cleared when the token is burned. Requirements: - `tokenId` must exist. Emits a {Transfer} event./
function _burn(uint256 tokenId) internal virtual { address from = ownerOf(tokenId); _beforeTokenTransfers(from, address(0), tokenId, 1); _burnedToken.set(tokenId); emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); }
1,756,353
pragma solidity >=0.5.4 <0.6.0; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external; } contract TheAO { address public theAO; address public nameTAOPositionAddress; // Check whether an address is whitelisted and granted a...
Create `mintedAmount` ions and send it to `target` target Address to receive the ions mintedAmount The amount of ions it will receive/
function _mint(address target, uint256 mintedAmount) internal { balanceOf[target] = balanceOf[target].add(mintedAmount); totalSupply = totalSupply.add(mintedAmount); emit Transfer(address(0), address(this), mintedAmount); emit Transfer(address(this), target, mintedAmount); }
985,565
./partial_match/1/0x7917b6f2C5deC4021Ed5D0ff3e5bb27A69B2eaCf/sources/contracts/NitroAdjudicator.sol
Triggers transferAll in all external Asset Holder contracts specified in a given outcome for a given channelId. Triggers transferAll in all external Asset Holder contracts specified in a given outcome for a given channelId. channelId Unique identifier for a state channel outcomeBytes abi.encode of an array of Outco...
function _transferAllFromAllAssetHolders(bytes32 channelId, bytes memory outcomeBytes) internal { Outcome.OutcomeItem[] memory outcome = abi.decode(outcomeBytes, (Outcome.OutcomeItem[])); for (uint256 i = 0; i < outcome.length; i++) { Outcome.AssetOutcome memory assetOutcome...
9,354,430
./full_match/44787/0x824adc7Ac6e95E8F81F51D22bf4F5E4933Ed1598/sources/src/utils/MultiWhitelist.sol
Set the NFT purchase limit _purchaseLimit - NFT purchase limit/
function setPurchaseLimit(uint256 _purchaseLimit) public onlyAdmin { purchaseLimit = _purchaseLimit; }
13,288,847
./full_match/4/0xeA6C052EE7c409345EC99cC34D9B4e2f9fB1f532/sources/github/aesopfi/smart/battle/contracts/Battle.sol
retrieves the sum of each payable amount return the minimum payable value for registered player info
function _getMinimumPayableAmount( uint256 _soldiers, uint256 _tanks, uint256 _generals ) private view returns (uint256) { return _soldiers * 1 + _tanks * 10 + _generals * 100 + COUNTRY_SUPPORT + fee; }
816,197
./full_match/3/0xD7b903AC1D7818b9712162cC47565429A5595EE6/sources/browser/github/NEST-Protocol/NEST-oracle-V3/VoteContract/Nest_3_VoteFactory.sol
Check the current total number of votes
function checkTotalAmount() public view returns (uint256) { return _totalAmount; }
8,162,228
pragma solidity ^0.4.15; library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal constant returns (uint256) { // assert(b > 0); // Solidity automatically ...
@des Handle&39;s ETH sent directly to contract address Handle pre-sale contribution (tokens held, until tx confirmation from contributor) Makes sure the user sends minimum PRE-TDE contribution, and that pre-tde contributors are unable to send subsequent ETH contributors before being issued tokens. Keep track of contr...
function () payable { if (now < TDEStartDate && msg.value >= minimumPRETDEContributionInWei && PRETDEContributorTokensPendingRelease[msg.sender] == 0) { ETHContributions[msg.sender] = ETHContributions[msg.sender].add(msg.value); fundsRaisedInWei = fundsRaisedInWei.add(msg.value); ...
10,513,912
// SPDX-License-Identifier: Unlicensed pragma solidity 0.8.9; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning w...
exclude from paying fees or having max transaction amount
constructor() ERC20("macaw", "macaw") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_unisw...
1,349,019
/************************************************************************** * ____ _ * / ___| | | __ _ _ _ ___ _ __ * | | _____ | | / _` || | | | / _ \| '__| * | |___|_____|| |___| (_| || |_| || __/| | * ...
roleHasPrivilege/
function roleHasPrivilege(bytes32 _role, bytes4 _privilege) override public view returns (bool) { return (_role == ALL_PRIVILEGES) || roles[_role].privileges[_privilege]; }
6,852,469
//SPDX-License-Identifier: MIT pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; //Control who can access various functions. contract AccessControl { address payable public creatorAddress; uint16 public totalDirectors = 0; mapping (address => bool) public directors; modifier onlyCREAT...
Check if the league is public or private If private, check if the sender is on the permitted players list.
function joinLeague(uint64 id) public { ITACData TAC = ITACData(TACContract); bool permitted = true; if (allLeagues[id].isPublic == false) { for (uint8 i=0; i< maxPlayers; i ++) { if (permittedPlayersForLeague[id][i] == msg.sender) { permitted = true; } ...
12,721,821
// SPDX-License-Identifier: MIT pragma solidity 0.5.17; // Part: IStaking /** * @title Staking interface, as defined by EIP-900. * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-900.md */ contract IStaking { event Staked(address indexed user, uint256 amount, uint256 total, bytes data); event...
Transfers amount of deposit tokens from the user. amount Number of deposit tokens to stake. data Not used./
function stake(uint256 amount, bytes calldata data) external { _stakeFor(msg.sender, msg.sender, amount); }
638,488
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@manifoldxyz/libraries-solidity/contracts/access/AdminControl.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "...
Use a prefix commond uri for all tokens (<PREFIX><TOKEN_ID>)./
function setPrefixURI(string calldata uri) external adminRequired { _prefixURI = uri; _commonURI = ''; }
10,148,116
./full_match/43113/0xe0625AFC410048A8853774C876b48d6a69Ad8828/sources/SavingGroups.sol
First transaction that will complete saving of currentTurn and will trigger next turnBecause this runs each user action, we are sure the user in turn has its availableSavings complete
atStage(Stages.Save){ uint8 senderTurn = users[msg.sender].userTurn; uint8 realTurn = getRealTurn(); function withdrawTurn() external payable isRegisteredUser(users[msg.sender].isActive) if (turn < realTurn){ completeSavi...
13,172,166
import 'ds-base/base.sol'; contract ForkableDatastoreService is DSBase { // temporary type tags: // uint64: internal ID // uint32: "name" - virtual ID function ForkableDatastoreService() { // Branch 0 points to node 0, whose parent/sibling/storage is 0 _next_name++; _next_node++...
get the tip node Left is old branch tip, right is new branch tip Forking branch 0 creates a "quasi-root" with no sibling
function fork(uint32 branch) returns (uint32 child_branch) { uint64 parent_id = _branches[branch]; child_branch = _next_name++; if( branch != 0 ) { uint64 left_id = _next_node++; } uint64 right_id = _next_node++; _nodes[left_id] = left; _branches...
12,777,177
// SPDX-License-Identifier: MIT // Copyright (c) 2021 piotrostr.eth pragma solidity 0.8.13; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "./interfaces/IPancakePair.sol"; import "./interface...
add up the remainder that doesnt get swapped marketing fee is never 0
function _transfer( address from, address to, uint256 amount ) internal override { require(tradingEnabled, "trading is not enabled"); if (msg.sender == owner() || msg.sender == address(router)) { super._transfer(from, to, amount); uint256 totalFee ...
6,349,526
./partial_match/1/0xD0C6e59B50C32530C627107F50Acc71958C4341F/sources/contracts/loans/direct/loanTypes/DirectLoanFixedOffer.sol
Function that performs some validation checks over loan parameters when accepting an offer/
function _loanSanityChecksOffer(LoanData.Offer memory _offer) internal pure { if (_offer.maximumRepaymentAmount < _offer.loanPrincipalAmount) { revert NegativeInterestRate(); } }
2,861,869
./full_match/42161/0xf02Cd706A5e95e939e7f22136c1DFA0d3d4F9fBc/sources/project_/contracts/InscriptionFactory.sol
Fetch inscription data by page no, page size, type and search keyword if _searchBy is not empty, the _pageNo and _pageSize should be set to 1
function getIncriptions( uint256 _pageNo, uint256 _pageSize, string memory _searchBy ) external view returns( Token[] memory inscriptions_, uint256[] memory totalSupplies_ ) { require(_type < 3, "type is 0-2"); uint256 totalInscription = this.getInscri...
16,297,091
/** *Submitted for verification at Etherscan.io on 2022-03-15 */ // SPDX-License-Identifier: GPL-3.0-or-later // Sources flattened with hardhat v2.6.1 https://hardhat.org // File @openzeppelin/contracts/token/ERC20/[email protected] // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) pragma so...
Returns the element stored at position `index` in the set. O(1). Note that there are no guarantees on the ordering of values inside the array, and it may change when more values are added or removed. Requirements: - `index` must be strictly less than {length}./
function at(Bytes32ToUIntMap storage map, uint256 index) internal view returns (bytes32, uint256) { (bytes32 key, bytes32 value) = _at(map._inner, index); return (key, uint256(value)); }
6,638,977
./partial_match/1/0x3C09431f869ae10d6cF4Fb91e87a37D757a41571/sources/UtilityETH.sol
set wbusd _wbusd Wbusd address/
function setWBUSD(IERC20 _wbusd) external onlyOwner { wbusd = _wbusd; }
9,368,365
pragma solidity 0.4.23; import "zeppelin-solidity/contracts/ownership/Ownable.sol"; import "zeppelin-solidity/contracts/math/SafeMath.sol"; /// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens /// @author Dieter Shirley <dete@axiomzen.co> (https://github.com/dete) contract ERC721 { // Re...
Generates a Kitty coin for a donation that has been made _donationId donation to be used to generate the coin return _kittyCoinId of the new KittyCoin Confirm that the owner doesn't have any kittycoins the seed for the kittycoin is generated based on the input string The cat is created by a private function
function createRandomKittyCoin(uint256 _donationId) public returns(uint256) { require(kittyCoinCount[msg.sender] == 0); uint256 kittyId = donations[_donationId].kittyId; bytes5 kittyTraitSeed = kitties[kittyId].kittyTraitSeed; uint256 randSeed = _generateRandomSeed(kittyTraitSeed); ...
982,458
/* Copyright 2021 Empty Set Squad <emptysetsquad@protonmail.com> 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 ...
Registers a new address for the timelock Owner only - governance hook Does not automatically update the owner of all owned protocol contracts newValue New address to register/
function setTimelock(address newValue) external validate(newValue) onlyOwner { timelock = newValue; emit Registration("TIMELOCK", newValue); }
5,461,259
./partial_match/1/0xfBFAa6141EEd993d3999688672cb6453d7C246d5/sources/DxPoolStakingFeePool.sol
get commission have earned
function getAccStakeCommissionFee() public view returns (uint256) { uint256 currentPeriodReward = getTotalRewards(); return ( accTotalStakeCommissionFee + 1e6 * (currentPeriodReward - lastPeriodReward) * stakeCommissionFeeRate / 10000 ) / 1e6; }
4,228,882
./full_match/137/0x2dBb3cD65945A1993e2D235B19f61FdB46Da4a82/sources/contracts/BIFI/vault/BeefyVaultV4626.sol
See {IERC4626-maxRedeem}. /
function maxRedeem( address _owner ) public view virtual override returns (uint256) { return balanceOf(_owner); }
4,763,578
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@bancor/contracts-solidity/solidity/contracts/token/interfaces/IDSToken.sol"; struct PoolProgram { uint256 startTime; uint256 endTime; uint256 rewardRate; IERC20[2] reserveTokens; ...
calculate the new reward rate per-token rewardPerToken must be calculated with the previous value of lastUpdateTime. update provider's rewards with the newly claimable base rewards and the new reward rate per-token. if this is the first liquidity provision - set the effective staking time to the current time.
function pendingRewards( address provider, IDSToken poolToken, IERC20 reserveToken, PoolProgram memory program, ILiquidityProtectionStats lpStats ) private view returns (uint256) { PoolRewards memory poolRewardsData = poolRewards(poolToken, reserveToken); ...
10,349,280
./partial_match/1/0xbCbd5575c0eE4A87cE6605F0Ee60c359187b3Ad9/sources/AncoraPrivate.sol
Used by the PublicSale to deposit the tokens for the PublicSale/ require(tokensForClaiming == 0, "Error: TOKENS_ALREADY_DEPOSITED");
function depositTokens( uint256 _tokensForClaiming ) public onlyOwner { erc20Contract.transferFrom(_msgSender(), address(this), _tokensForClaiming); tokensForClaiming += _tokensForClaiming; emit DepositTokens(_msgSender(), tokensForClaiming); }
16,039,116
pragma solidity ^0.8.0; import "./freeportParts/MetaTxContext.sol"; import "./Freeport.sol"; /** The contract NFTAttachment allows users to attach objects to NFTs. * Some application can listen for the events and interpret the objects in some way. * * There are three roles who can attach objects to an NFT: * the ...
Parse an NFT ID into its issuer, its supply, and an arbitrary nonce. This does not imply that the NFTs exist. This is specific to Freeport NFTs. See `freeportParts/Issuance.sol`/
function _minterFromNftId(uint256 id) public pure returns (address minter) { minter = address(uint160((id & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000) >> (32 + 64))); return minter; }
928,373
pragma solidity ^0.4.11; /// @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 totalSupply() public view returns (uint256 total); function balanceOf(addres...
Creates the main CryptoMonsters smart contract instance. Starts paused. the creator of the contract is the initial CEO the creator of the contract is also the initial COO start with the mythical monster 0 - so we don't have generation-0 parent issues
function MonsterCore() public { paused = false; ceoAddress = msg.sender; cooAddress = msg.sender; cfoAddress = msg.sender; _createMonster(0, 0, 0, uint256(57896044618658097711785492504343953926634992332820282019728792004021511462807), address(0)); }
12,910,230
./full_match/5/0x49B622913cb4F4C83DF8e7A79f51F76A3761907E/sources/contracts/OLPs.sol
Kills an LP position at index
function _killLPPosition(address epochStrikeToken, uint256 lpIndex) internal returns (bool) { LpPosition memory lpPosition = allLpPositions[epochStrikeToken][ lpIndex ]; require( lpPosition.buyer == msg.sender, "Only buyer can kill an L...
11,593,777
pragma solidity ^0.5.0 ; /// @title Bounty management /// @author Kenneth Hu /// @notice You can use this contract to manage bounty. /// @dev All function calls are currently implemented without side effects contract BountyPost{ struct Bounty { uint id; string title; string description; ...
get the bounty count return the bounty count
function getBountyCount() public view returns (uint){ return totalBounties; }
5,513,359
./partial_match/4/0x7EC74134898D041c24310a5502c98d6944d64896/sources/TinyBoxRenderer.sol
Produces random integer values, with weighted distributions for values in a set/
function weighted( bytes32[] memory pool, uint8[24] memory thresholds, uint8 total ) internal pure returns (uint8) { int256 p = uniform(pool, 1, total); int256 s = 0; for (uint8 i=0; i<24; i++) { s = s.add(thresholds[i]); if (p <= s) return...
8,607,183
pragma solidity ^0.6.0; import "../Initializable.sol"; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dea...
Adds a user to go-list _member address to add to go-list/
function addToGoList(address _member) public onlyGoListerRole { goList[_member] = true; emit GoListed(_member); }
470,066
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.7.0; pragma abicoder v2; import "./ActionGuards.sol"; import "../FreeCollateralExternal.sol"; import "../../global/StorageLayoutV1.sol"; import "../../math/SafeInt256.sol"; import "../../internal/AccountContextHandler.sol"; import "../../internal/portfolio/Tr...
Internal asset transfer event between accounts Finalize all parts of a transfer for each account separately. Settlement must happen before the call to placeAssetsInAccount so that we load the proper portfolio state.
function _transfer( address from, address to, PortfolioAsset[] memory assets ) internal returns (AccountContext memory, AccountContext memory) { AccountContext memory toContext = AccountContextHandler.getAccountContext(to); if (toContext.mustSettleAssets()) { ...
1,675,597
/** *Submitted for verification at Etherscan.io on 2022-01-06 */ /** *Submitted for verification at Etherscan.io on 2021-12-30 */ // SPDX-License-Identifier: MIT pragma solidity 0.8.4; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } ...
Function to mint all NFTs for giveaway and partnerships/
function mintByOwner( address _to ) public onlyOwner { require(totalSupply.add(1) < MAX_NFT, "Tokens number to mint cannot exceed number of MAX tokens"); mint(_to,1); }
2,243,295
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "...
pool Target liquidity pool address. return Liquidity pool token./
function _getPoolLiquidityToken(address pool) internal view returns (ERC20) { address tokenAddress = registry.get_lp_token(pool); require(tokenAddress != address(0), "CurveDepositaryBalanceView::_getPoolLiquidityToken: liquidity token not found"); return ERC20(tokenAddress); }
912,374
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.4; import "hardhat/console.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/securi...
Returns only items that a user has purchased / get all nfts that owner is equal to the sender
function fetchMyNFTs() public view returns (MarketItem[] memory){ uint myNftCounter = 0; uint totalItemCount = _itemIds.current(); for(uint i=0; i< _itemIds.current() ;i++ ){ if(idToMarketItem[i].owner == msg.sender){ myNftCounter +=1; } } ...
1,090,200
./partial_match/3/0x5e5aA23f4a31fFa3F2F0AA8CBc0C995b90233B76/sources/Testhereum.sol
1st year effective annual interest rate is 100% Example 1 : User have 100 tokens with Coin Age 1 Day 100 token x 1 of Min CoinAge = 100 Interest = (1000 x 0.1) / 100 = 1 (100%) Reward = 100 x 1 / 365 = 0.2739 100 token + 0.2739 = 100.2739 token Example 2 : User have 100 tokens with Coin Age 10 Days 100 token x 10 of Ma...
function getProofOfStakeReward(address _address) internal returns (uint) { require( (now >= stakeStartTime) && (stakeStartTime > 0) ); uint _now = now; uint _coinAge = getCoinAge(_address, _now); if(_coinAge <= 0) return 0; uint interest = maxMintProofOfStake; if((...
5,127,969
./partial_match/1/0xd81b3000D6Cad7af85E9939AfAb1243B56618EA9/sources/VFIN.sol
Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner./
function renounceOwnership() external onlyOwner { _transferOwnership(address(0)); }
4,031,958
// SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/math/SafeMath.sol pragma solidity ^0.6.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually...
/ NOTE: nextPoolIdx is state variable which store index of last processed pool. Pool list can be update anytime so following scenario can happen. - pools.length = 2 - rebalance 2 times which makes nextPoolIdx = 2 - 1 pool is removed so pools.length = 1. - 3rd rebalance will only work if we check '>=' Thus we requir...
function rebalance() external { require(msg.sender == address(vvsp), "Caller is not vvsp pool"); require( block.number - lastRebalanceBlock >= controller.rebalanceFriction(address(vvsp)), "Can not rebalance" ); lastRebalanceBlock = block.number; if (ne...
1,654,767
pragma solidity ^0.5.0; import "../helpers/DecimalMath.sol"; import "./Staking.sol"; contract Griefing is Staking { enum RatioType { NaN, Inf, Dec } mapping (address => GriefRatio) private _griefRatio; struct GriefRatio { uint256 ratio; RatioType ratioType; } event RatioSet(addr...
Dec: Ratio is a decimal number with 18 decimals Inf: Punishment at no cost NaN: No Punishment /
function getPunishment(uint256 ratio, uint256 cost, RatioType ratioType) public pure returns(uint256 punishment) { if (ratioType == RatioType.Dec) { return DecimalMath.div(SafeMath.mul(cost, e18), ratio) / e18; } if (ratioType == RatioType.Inf) revert("ratioType canno...
5,374,661
./partial_match/1/0x2d9181b954736971bb74043d4782dFe93b55a9af/sources/src/WawaNFT.sol
-------------------------------------------------------------------------- / Mint METHOD / -------------------------------------------------------------------------- / getWawa mint Wawa to verify user to : receiver address tokenId : object nft token_id ...
function getWawa( address to, uint256 tokenId, string calldata _tokenURI, Faction faction, Trait calldata trait, uint8 petId, bytes32 gene ) external payable nonReentrant onlyOwner { if (to == address(0)) revert ...
2,611,576
pragma solidity >= 0.5.12; interface ERC20 { function totalSupply() external view returns (uint); function balanceOf(address tokenOwner) external view returns (uint balance); function allowance(address tokenOwner, address spender) external view returns (uint remaining); function transfer(address to, ui...
Calculates validators invloved total vesting and removes validators that did not mine at all during the last 2 notary windows Array of flags if active validators mined this notary window Selected validator's account address, index and vesting balance Validators, who are not actively mining anymore (their node probably ...
function processNotaryValidators(ChainInfo storage chain, address[] memory validators, uint32[] memory blocksMined, uint256 maxBlocksMined) internal returns (uint256 totalInvolvedVesting) { bool[] memory miningValidators = new bool[](chain.validators.list.length); address actValidatorAcc; ...
12,975,280
./full_match/1/0xe86C5ea96eA47D3A9D835672C1428329bD0bb7Af/sources/contracts/subdomain-registrar/TalSubdomainRegistrar.sol
Register a name. Can only be called if and only if the subdomain of the root node is free subdomainLabel The label hash of the domain to register a subdomain of./
function register(string memory subdomainLabel) public payable override notStopped { bytes32 labelHash = keccak256(bytes(subdomainLabel)); bytes32 childNode = keccak256(abi.encodePacked(ROOT_NODE, labelHash)); address subdomainOwner = ensRegistry.owner(childNode); require(subdomainOw...
3,070,549
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; contract Boba_GasPriceOracleProxyCall { address public gasPriceOracleAddress; constructor(address _gasPriceOracleAddress) { gasPriceOracleAddress = _gasPriceOracleAddress; } /** * Add the users that want to use BOBA as the fee token...
Add the users that want to use BOBA as the fee token/
function useBobaAsFeeToken() public { Boba_GasPriceOracle(gasPriceOracleAddress).useBobaAsFeeToken(); }
13,138,133
./partial_match/1/0xb7d4797D48141cA2dDcD9fD554ff580806031860/sources/contracts/TypeERC721OperationFilter.sol
Mint reserved NFTs for giveaways, devs, etc./
function reserveMint(uint256 mintCount) public onlyOwner { uint256 supply = totalSupply(); require(supply + mintCount <= _maxSupply, "max_token_supply_exceeded"); for (uint256 i = 1; i <= mintCount; i++) { _safeMint(msg.sender, supply + i); } }
4,152,999
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.11; contract AcuityAtomicSwapSell { mapping (bytes32 => uint256) orderIdValue; mapping (bytes32 => uint256) sellLockIdValue; /** * @dev */ event AddToOrder(bytes16 orderId, address seller, bytes32 chainIdAdapterIdAssetIdPrice, byt...
Called by seller./ Calculate orderId. Check there is enough. Remove value from order. Return the funds. Log info.
function removeFromOrder(bytes32 chainIdAdapterIdAssetIdPrice, bytes32 foreignAddress, uint256 value) external { bytes16 orderId = bytes16(keccak256(abi.encodePacked(msg.sender, chainIdAdapterIdAssetIdPrice, foreignAddress))); require (orderIdValue[orderId] >= value, "Sell order not big enough."); ...
12,802,127
pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "./ERC20Improved.sol"; contract Exchange { using SafeMath for uint256; address payable owner = payable(msg.sender); ERC20Improved erc20Contract; enum TransactionTypes {EtherToErc, ErcToEther} // Make use of ...
mint the amount of erc20 in frontend
function addLiquidityERC20(uint256 value) external payable { amtErc20Total = amtErc20Total.add(value); }
6,478,685
// contracts/GameItems.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; //import "@openzeppelin/contracts/utils/Counters.sol"; //import "@openzeppelin/contracts/access/Ownable.sol"; // error Mint_SendMoreEthToMint(); contract FanSocietyMother is ...
mint token, will only mint one of the "current_tokens"
function mint (uint256 _mintTokenAmount) public payable { uint256 payment = tokenFee * _mintTokenAmount; require(msg.value >= payment, "Send more Eth"); _mint(msg.sender, activeGenerationId, _mintTokenAmount, ""); require(sent, "Not enough eth sent"); emit FanPinMinted(msg...
15,854,111
./full_match/43113/0x737a18ce8E315b3696c405c9Fe670Fc801A3F833/sources/src/GhostAuction.sol
maximum of 60 minutes for extension period Initialize the auction details, including null values.
function createAuction( uint256 tokenId, uint256 duration, uint256 reservePrice, LibExchangeAuction.AuctionTypes auctionType, uint256 startingPrice, uint256 endingPrice, uint256 startDate, uint256 extensionPeriod, address[3] memory auctionSpecA...
7,209,148
// SPDX-License-Identifier: CC-BY-4.0 pragma solidity >=0.4.22 <0.9.0; library Shareholder { bytes32 constant private ZERO_BYTES = bytes32(0); address constant private ZERO_ADDRESS = address(0); enum InvestorType { accredited, affiliate, nonaccredited, sophisti...
The number of addresses that own tokens. return the number of unique addresses that own tokens./
function holderCount() external view returns (uint) { return shareholderStorage().shareholders.length; }
5,384,530
./full_match/137/0x16D66b01664bc834f5db13D01E51E1Fa7C44f03B/sources/browser/NFT721.sol
Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), reverting when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert` opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remaining gas). Requirem...
function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; }
4,781,913
./full_match/1/0x99775ec83523F1013e3d4389CB229260237e2Bd8/sources/src/contracts/tokens/erc721/custom-erc721/ERC721A.sol
Approve or remove `operator` as an operator for the caller. Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. Requirements: - The `operator` cannot be the caller. Emits an {ApprovalForAll} event./
function setApprovalForAll(address operator, bool approved) public virtual override { _operatorApprovals[_msgSenderERC721A()][operator] = approved; emit ApprovalForAll(_msgSenderERC721A(), operator, approved); }
8,493,793
./partial_match/3/0xE452Db0Ce76054692fd6dDfa29aaF329B55341c0/sources/TEDswapPool1.sol
calcInGivenOut aI = tokenAmountIn bO = tokenBalanceOut / / bO \ (wO / wI) \ bI = tokenBalanceIn bI | | ---------...
function calcInGivenOut( uint tokenBalanceIn, uint tokenWeightIn, uint tokenBalanceOut, uint tokenWeightOut, uint tokenAmountOut, uint swapFee ) public pure returns (uint tokenAmountIn, uint tokenInFee) { uint weightRatio = bdiv(tokenWe...
5,085,572