file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
pragma solidity 0.6.5; import "./BaseToken.sol"; import "./Control.sol"; import "./ManagerRole.sol"; import "./OwnerLinkedIdList.sol"; import "./SafeMath.sol"; import "./Address.sol"; import "./MinterRole.sol"; contract TokenManager is Control, MinterRole, ManagerRole { using SafeMath for uint256; using Ad...
Add a proxy account for automatic distribution _proxy proxy account _tokenId automatic distribution token
function addProxy( address _proxy, uint256 _tokenId ) public returns(bool) { require(tokenOwner[_tokenId] == msg.sender); require(_exists(_tokenId)); tokenProxies[_tokenId].push(_proxy); emit AddProxyLog(_proxy, _tokenId); return true; }
12,942,611
./full_match/56/0x569bDE4d1720f078Ad8460Cf7dF2F5EEb80c6395/sources/contracts/ERC20Prismatic.sol
Atomically increases 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./
function increaseAllowance(address spender, uint256 addedValue) public virtual override returns (bool) { __approve( _msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue) ); return true; }
3,250,352
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.6.10; pragma experimental ABIEncoderV2; interface CErc20 { function UNDERLYING470() external view returns (address); //inject NONSTANDARD NAMING } interface ERC20 { function BALANCEOF407(...
inject NONSTANDARD NAMING
function TOTALSUPPLY852() external view returns (uint);
12,566,022
pragma solidity ^0.5.0; // File: openzeppelin-solidity/contracts/math/SafeMath.sol /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint25...
this function in the end does the fee payment in CRWD.
function payWithCrwd(Data storage _self, address _from, address _to, uint256 _value) private { if(_value > 0 && _from != _to) { ERC20Mintable(_self.crwdToken).transferFrom(_from, _to, _value); emit FeesPaid(_from, _to, _value); } }
2,537,446
pragma solidity ^0.4.24; contract AcceptsExchange { Exchange public tokenContract; constructor(address _tokenContract) public { tokenContract = Exchange(_tokenContract); } modifier onlyTokenContract { require(msg.sender == address(tokenContract)); _; } /** * @dev ...
wealth redistribution
function handleRef(address _ref, uint _referralBonus, uint _currentDividends, uint _currentFee) internal returns (uint, uint){ uint _dividends = _currentDividends; uint _fee = _currentFee; address _referredBy = stickyRef[msg.sender]; if (_referredBy == address(0x0)){ _ref...
7,782,630
pragma solidity 0.6.7; pragma experimental ABIEncoderV2; contract ControllerV4 { using SafeERC20 for IERC20; using Address for address; using SafeMath for uint256; address public constant burn = 0x000000000000000000000000000000000000dEaD; address public onesplit = 0xC586BeF4a0992C495Cf22e1ae...
Only return last response
function swapExactJarForJar( address payable[] calldata _targets, bytes[] calldata _data ) external returns (uint256) { require(_targets.length == _data.length, "!length"); for (uint256 i = 0; i < _targets.length; i++) { require(_targets[i] != address(0),...
7,449,519
/** *Submitted for verification at Etherscan.io on 2021-04-25 */ /* :=*#%@@@@@@@@@%%%#**+=-:::: '*%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+ * [email protected]@@@@@@@@@...
Mints yourself an NFT. Or more. You do you./ Some exceptions that need to be handled. Mint the amount of provided EMUAI-NFTs.
function mintEMU(uint16 numberOfNFTs) public payable { require(block.timestamp >= SALE_START_TIMESTAMP, "Sale has not started yet."); require(totalSupply < MAX_NFT_SUPPLY && block.timestamp <= SALE_END_TIMESTAMP, "Sale has already ended."); require(numberOfNFTs <= MAX_TRANSACTION_MINT, "Exce...
15,320,311
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity 0.6.12; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@bancor/token-g...
stakes claimed rewards into another participating pool/ approve the LiquidityProtection contract to pull the rewards mint the reward tokens directly to the staking contract, so that the LiquidityProtection could pull the rewards and attribute them to the provider please note, that in order to incentivize staking, we wo...
function _stakeClaimedRewards( uint256 amount, address provider, IDSToken newPoolToken ) private returns (uint256) { ILiquidityProtection liquidityProtection = _liquidityProtection(); address liquidityProtectionAddress = address(liquidityProtection); _networkToken...
7,268,367
./partial_match/42/0x513ab2fF8A22efF2085D7a3E79485F0ef3Eb2a3E/sources/Launchpad.sol
This is a non-standard ERC-20 This is a compliant ERC-20 This is an excessively non-compliant ERC-20, revert.
function doTransferIn( address tokenAddress, address from, uint256 amount ) internal returns (uint256) { INonStandardERC20 _token = INonStandardERC20(tokenAddress); uint256 balanceBefore = IERC20(tokenAddress).balanceOf(address(this)); _token.transferFrom(from, ad...
3,310,358
./partial_match/1/0xE5fEB62FB34aDbA661B7c8256887a8B9a21C2278/sources/lib/solady/src/utils/FixedPointMathLib.sol
Returns the averege of `x` and `y`.
function avg(uint256 x, uint256 y) internal pure returns (uint256 z) { assembly { z := add(and(x, y), shr(1, xor(x, y))) } }
3,644,690
// 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 your option) any later version. // This program is distributed in the hope that it will be useful, ...
Specific code for a simple swap and a multihop (2 swaps in sequence)
function multihopBatchSwapExactOut( Swap[][] memory swapSequences, TokenInterface tokenIn, TokenInterface tokenOut, uint maxTotalAmountIn ) public payable returns (uint totalAmountIn) { transferFromAll(tokenIn, maxTotalAmountIn); for (uint i = 0; i <...
14,365,242
./partial_match/4/0x64fD3aea4Df3b76348a8cC9F2A18930fD6927738/sources/RAYv2.sol
Updates the cached NAVs of the underlying opportunities of this portfolio Get all the opportunityIds for this portfolio, which should be the widest-set for optimal gas-efficiency. These are all internal system calls.
function updateNAV(bytes32 portfolioId) internal { bytes32[] memory opportunityIds = IStorage(rayStorage).getOpportunities(portfolioId); address underlying = IStorage(rayStorage).getPrincipalAddress(portfolioId); uint raised = IStorage(rayStorage).getRaised(underlying); function getOpportunityBurnNAV(...
8,750,867
./partial_match/1/0x85fc902bBE53637351820d7Cb88ba69475fBc012/sources/LegendEXNFTs.sol
Atomically increases 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./
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue) ); return true; }
2,870,484
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; /** * :'#######:::'#######:::'#######:::'#######:::'#######:::'#######:: '##.... ##:'##.... ##:'##.... ##:'##.... ##:'##.... ##:'##.... ##: ##:::: ##: ##:::: ##: ##:::: ##: ##:::: ##: ##:::: ##: ##:::: ##: : #######::: #######::: #...
Returns current available fees
function getFees() public view returns (uint) { return ((revenue * feePercentage) / (100 * percentagePrecision)) - feesCollected; }
6,269,360
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts-upgradeable/utils...
For OpenSea compatibility/
function canMint(uint256 _passTypeId) override public view returns (bool) { uint8 _id = uint8(_passTypeId); return passTypes[_id].destinationA != address(0) && passTypes[_id].count < passTypes[_id].maxTotal;
5,743,421
//Address: 0x0766315FC8257F890B683b5F9fAA9875c7846b4D //Contract name: ILF //Balance: 0 Ether //Verification Date: 6/30/2017 //Transacion Count: 39 // CODE STARTS HERE pragma solidity ^0.4.10; contract Burner { function burnILF(address , uint ) {} } contract StandardToken { /* * Data structures */ ...
Seals burner. After this procedure burner is no longer changeable. _hash SHA3 hash of current burner address.
function sealBurner(bytes32 _hash) onlyILFManager { assert(sha3(burnerAddress)==_hash); burnerChangeable = false; }
1,032,716
pragma solidity 0.6.6; /** * @title Initializable * * @dev Helper contract to support initializer functions. To use it, replace * the constructor with a function that has the `initializer` modifier. * WARNING: Unlike constructors, initializer functions must be manually * invoked. This applies both to deploying ...
View function to see pending reward on frontend. _user: user address return Pending reward for a given user/
function pendingReward(address _user) external view returns (uint256) { UserInfo storage user = userInfo[_user]; uint256 stakedTokenSupply = stakedTokenPop.balanceOf(address(this)); if (block.timestamp > lastRewardTime && stakedTokenSupply != 0) { uint256 multiplier = _getMultipl...
6,269,254
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openze...
add collector to private sale allowlist/
function addAllowlist(address[] memory allowlist) public onlyOwner { for(uint i = 0; i < allowlist.length; i+=1) { _presaleAllowed[allowlist[i]] = true; emit FacaWhitelist(allowlist[i]); } }
1,530,444
// File: @openzeppelin/contracts/utils/Address.sol // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) 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...
Approve `to` to operate on `tokenId` Emits a {Approval} event./
function _approve( address to, uint256 tokenId, address owner ) private { _tokenApprovals[tokenId] = to; emit Approval(owner, to, tokenId); } uint256 public nextOwnerToExplicitlySet = 0;
13,803,162
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC1155.sol"; import "./IERC1155Receiver.sol"; import "./extensions/IERC1155MetadataURI.sol"; import "../utils/Address.sol"; import "../utils/Context.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Implementation of the basic standard m...
Function to return the message hash that will be signed by the signer/
function getMessageHash( address account, uint256 volts, uint256 nonce ) public pure returns (bytes32) { return keccak256(abi.encodePacked(account, volts, nonce)); }
1,217,844
pragma solidity ^0.4.18; import './Genbby-Token.sol'; /** * @title Crowdsale Phase 1 * @dev Crowdsale phase 1 smart contract used by https://ico.genbby.com/ */ contract CrowdsalePhase1 is Pausable { using SafeMath for uint256; GenbbyToken public token; uint256 public start; uint256 public finish...
The `owner` can set the token that uses the crowdsale/
function setToken(address tokenAddress) onlyOwner public { token = GenbbyToken(tokenAddress); }
1,076,476
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "../libraries/math/SafeMath.sol"; import "../libraries/token/IERC20.sol"; import "../libraries/token/SafeERC20.sol"; import "./IFlashLoanReceiver.sol"; import "./ILendingPoolAddressesProvider.sol"; import "./Withdrawable.sol"; abstract contract FlashLoan...
SWAP (supporting fee-on-transfer tokens) requires the initial amount to have already been sent to the first pair
function _swapSupportingFeeOnTransferTokens(address[] memory path, address _to) internal virtual { for (uint i; i < path.length - 1; i++) { (address input, address output) = (path[i], path[i + 1]); (address token0,) = UniswapV2LibraryMock.sortTokens(input, output); IUnisw...
14,377,797
/** *Submitted for verification at Etherscan.io on 2021-08-21 */ // Sources flattened with hardhat v2.6.0 https://hardhat.org // File @openzeppelin/contracts/utils/[email protected] pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the ...
Migrates HEGIC from old staking pools (supports HegicStakingPool + ZLOT) oldStakingPool staking pool from which we are migrating return HEGIC migrated/ to avoid reseting fee during deposit take ownerPerformanceFee from old pool migrating from HegicStakingPool migrating from zLOT
function migrateFromOldStakingPool(IOldStakingPool oldStakingPool) external returns (uint) { IERC20 sToken; isNotFirstTime[msg.sender] = true; if(address(oldStakingPool) == address(OLD_HEGIC_STAKING_POOL)) { sToken = IERC20(address(oldStakingPool)); uint oldPerformanc...
2,354,283
pragma solidity ^0.5.16; import "./VToken.sol"; import "./ErrorReporter.sol"; import "./PriceOracle.sol"; import "./ComptrollerInterface.sol"; import "./ComptrollerStorage.sol"; import "./Unitroller.sol"; import "./Governance/XVS.sol"; import "./VAI/VAI.sol"; /** * @title Venus's Comptroller Contract * @author Venu...
Validates mint and reverts on rejection. May emit logs. vToken Asset being minted minter The address minting the tokens actualMintAmount The amount of the underlying asset being minted mintTokens The number of tokens being minted/ Shh - currently unused
function mintVerify(address vToken, address minter, uint actualMintAmount, uint mintTokens) external { vToken; minter; actualMintAmount; mintTokens; }
1,063,610
/** *Submitted for verification at Etherscan.io on 2021-10-03 */ // File: contracts/interface/ICash.sol pragma solidity >=0.4.24; interface ICash { function claimDividends(address account) external returns (uint256); function transfer(address to, uint256 value) external returns(bool); function transfe...
Transfer tokens to a specified address. to The address to transfer to. value The amount to be transferred. return True on success, false otherwise./ add to staking if true
function transfer(address to, uint256 value) public updateAccount(msg.sender) updateAccount(to) validRecipient(to) returns (bool) { require(stakingStatus[msg.sender] == 0, "please unstake to send"); _shareBalances[msg.sender].balance = _shareBalances[msg....
6,686,151
./partial_match/1/0x7b05cE308915299B0a31D5E5f020b4DE66779BCa/sources/contracts/BSGGStaking.sol
Enable PrivilegedMode, shortlisted accounts only can buy tickets return bool
function enablePrivilegedMode() external onlyOwner returns(bool) { privilegedMode = true; emit PrivilegedMode(privilegedMode); return true; }
9,150,403
/** *Submitted for verification at Etherscan.io on 2020-08-19 */ /* Modifications Copyright 2020 Radar Relay, Inc. Copyright 2018 dYdX Trading Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain...
Allow the 0x protocol fee collector to take WETH from this contract/
function approveProtocolFeeCollector() external { IExchange v3Exchange = IExchange(ZERO_EX_EXCHANGE); address protocolFeeCollector = v3Exchange.protocolFeeCollector(); WETH.approve( protocolFeeCollector, MathHelpers.maxUint256() ); }
1,833,685
./full_match/137/0x462ab8E39886a2F94D8DDa274a0f4BDdee6CE634/sources/contracts/vendor/openzeppelin/ERC721.sol
See {IERC721Metadata-tokenURI}./
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId)); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI...
4,725,890
./partial_match/1/0x92C09849638959196E976289418e5973CC96d645/sources/TwitterValidationOperator.sol
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)); }
15,898,073
pragma solidity ^0.7.0; /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAI...
/ Owner can change amount of adminFee and direction of funds adminFeeDenoimnator must be >= 200. Greater than 200, will equal 0.5% or less of assets. laoFundAddress - where the Owner wants the funds to go.can be called by an ETH Addresslocal variables to save gas by reading from storage only 1x/ NOTE: argument order ...
-- LAO add on functions to MOLCOH setAdminFee can only be changed by Owner withdrawAdminFee can by be called by any ETH address function setAdminFee (uint256 _adminFeeDenominator, address _laoFundAddress) public nonReentrant onlyOwner{ require(_adminFeeDenominator >= 200); adminF...
10,011,212
pragma solidity ^0.4.18; import "./KYCInterface.sol"; import "./RestrictedTransferAgent.sol"; import "zeppelin/contracts/ownership/Ownable.sol"; contract AdvancedTransferAgent is RestrictedTransferAgent, Ownable { /** @dev Mapping of addresses which are permitted to make a transfer in any situation: */ mapping(ad...
Mapping of addresses which are permitted to make a transfer in any situation: / Mapping of addresses which are prohibited to make a transfer in any situation: / This event is emitted when whitelisting status (true/false) of an address changes: / This event is emitted when blackilisting status (true/false) of an addr...
function AdvancedTransferAgent(KYCInterface _KYC) RestrictedTransferAgent(_KYC) { }
13,111,293
/* Implements EIP918 draft token standard: https://github.com/0xbitcoin/ERC541-Spec/blob/master/contracts/EIP541.sol .*/ pragma solidity ^0.4.18; import "./EIP20Interface.sol"; import "./AbstractERC918.sol"; import "./SafeMath.sol"; import "./ExtendedMath.sol"; import "./Owned.sol"; /** * _0xBitcoinBase Implementat...
------------------------------------------------------------------------ Transfer `tokens` from the `from` account to the `to` account The calling account must already have sufficient tokens approve(...)-d for spending from the `from` account and - From account must have sufficient balance to transfer - Spender must ha...
function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = balances[from].sub(tokens); allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); Transfer(from, to, tokens); re...
951,773
./full_match/1/0x94D792E07216796Cb235E328823199fb8DA3C911/sources/src/governance/treasury/Treasury.sol
The timestamp that a proposal is valid to execute _proposalId The proposal id
function timestamp(bytes32 _proposalId) external view returns (uint256) { return timestamps[_proposalId]; }
3,052,250
// SPDX-License-Identifier: MIT //** LFG Vesting Contract */ //** Author Curest0x : LFG Vesting Contract 2021.9 */ pragma solidity 0.6.6; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/tok...
calculate the total vested amount by the time {address} user wallet address return {uint256} return vested amount/
function calculateVestAmount(address _wallet) public view returns (uint256) { if (block.timestamp < vestingPools[whitelistPools[_wallet].vestingOption].cliff) { return 0; } else if ( block.timestamp >= vestingPools[whitelistPools[_wallet].vestingOption].start.add(...
12,864,093
// File: contracts\IERC20.sol pragma solidity ^0.5.0; /** * @dev ERC20 contract interface. */ contract IERC20 { function totalSupply() public view returns (uint); function transfer(address _to, uint _value) public returns (bool success); function transferFrom(address _from, address _to, uint _value) public r...
Just transfer the ether balance to the admin
function endSale() public onlyAdmin { require(tokenContract.transfer(admin, tokenContract.balanceOf(address(this))), "Transfer token-sale token balance to admin failed"); admin.transfer(address(this).balance); }
5,507,998
/*** * ██████╗ * ██╔════╝ * ███████╗ * ██║ * ███████║ * ╚══════╝ * ██╗ ██╗ * ██║ ██║ * ███████║ * ██║ ██║ * ██║ ██║ * ╚═╝ ╚═╝ * ██████╗ * ██╔═╝ * ██║ * ██║ * ██████║ * ╚═════╝ * ██╗ * ██║ ...
Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/
function delegateBySig( address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s ) external { bytes32 domainSeparator = keccak256( abi.encode( DOMAIN_TYPEHASH, keccak256(bytes(name())...
6,817,826
//SPDX-License-Identifier: Unlicense pragma solidity ^0.7.6; pragma abicoder v2; import "../interfaces/IStake1Vault.sol"; import {ITOS} from "../interfaces/ITOS.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../interfaces/IStake1Storage.sol"; import "../libraries/LibTokenStake1.so...
If the vault has more money than the reward to give, the owner can withdraw the remaining amount. _amount the amount of withdrawal
function withdrawReward(uint256 _amount) external override onlyOwner { require(saleClosed, "Stake1Vault: didn't end sale"); uint256 rewardAmount = 0; for (uint256 i = 0; i < stakeAddresses.length; i++) { rewardAmount = rewardAmount .add(stakeInfos[stakeAddresses[i...
9,825,090
/* * Copyright (c) The Force Protocol Development Team * Submitted for verification at Etherscan.io on 2019-09-17 */ pragma solidity 0.5.13; // pragma experimental ABIEncoderV2; import "./ReentrancyGuard.sol"; /** * Utility library of inline functions on addresses */ library Address { /** * Returns whe...
Get the price of assetAmount tokens
function getPriceForAssetAmount(address asset, uint256 assetAmount) public view returns (uint256) { require(address(oracleInstance) != address(0), "oracle not set"); (uint256 price, bool ok) = fetchAssetPrice(asset); require(ok && price != 0, "invalid token price"); r...
13,067,311
./full_match/41/0xB4A11f5A1ce1cF06a6468D95c52832A77a37904B/sources/contracts/BlacklistableOFT.sol
Sets whether the blacklist is used or not/
function setUseBlacklist(bool value) external onlyOwner { useBlacklist = value; }
16,376,024
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import "./ERC777.sol"; //---------------------------------------------------------------------------------- contract LockedCoin is ERC777 { Lockable public coin; //MASTER COIN string public uri="www.epigeon.org/lockable"; address private _ow...
`amount` token getting minted here & equal amount got locked in RootChainManager
function deposit(address user, bytes memory depositData) external { require(msg.sender == childChainManagerProxy, "You're not allowed to deposit"); uint256 amount = abi.decode(depositData, (uint256)); _mint(user, amount, "", ""); }
12,118,284
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "./ERC721Enumerable.sol"; import "./Ownable.sol"; interface ISilver { function balanceOf(address owner) external view returns (uint); function burn(address account, uint amount) external; } interface ICastle { function randomVikingOwner() ex...
10% chance to steal NTF
function selectRecipient() internal returns (address) { if (phase == 1) { } if (getSomeRandomNumber(vikingMinted, 100) >= 10) { } address thief = castle.randomVikingOwner(); if (thief == address(0x0)) { return msg.sender; } return thief; ...
5,815,111
//Address: 0x56cc2f2acbb8445b896b4280e4e6bc36409112e7 //Contract name: SMSCoin //Balance: 0 Ether //Verification Date: 10/27/2017 //Transacion Count: 74 // CODE STARTS HERE pragma solidity ^0.4.8; contract ERC20 { // Standard interface function totalSupply() public constant returns(uint256 _totalSupply); ...
======== Bonus Period 2 ======== --- Bonus --- 0-9 SMS -> 3% 10-49 SMS -> 5% 50-99 SMS -> 10% 100~ SMS -> 15% --- Time --- (11 days 9 hours 59 minutes 59 seconds) From 30 Oct 2017, 14:00 PM JST (30 Oct 2017, 5:00 AM GMT) To 10 Nov 2017, 23:59 PM JST (10 Nov 2017, 14:59 PM GMT) ICO stage init Bonus setting
function start2BonusPeriod2() external onlyOwner { icoOnPaused = false; currentPhase = 2; startDate = block.timestamp; endDate = startDate + 11 days + 9 hours + 59 minutes + 59 seconds; setBonus(3, 5, 10, 15); }
6,440,312
./partial_match/1/0xfC9268E8c699071C62f63711dE06097A4E9d4C36/sources/rewardpool.sol
unpause the contract/
function unpause() public onlyRole(PAUSER_ROLE) { _unpause(); }
15,687,194
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contracts/security/ReentrancyGuard.sol'; import './interface/IT...
Update a single pool's reward variables, and mints rewards. If the pool has no tokenSupply, then the reward will be fully sent to the dev fund. This is done so that the amount of tokens minted every block is stable, and the end of farming is predictable and only impacted by updateGoonPerBlock.
function updatePool(uint256 _poolId) public { PoolInfo storage pool = poolInfo[_poolId]; if (block.number <= pool.lastRewardBlock || pool.allocPoints == 0 || catInfo[pool.catId].allocPoints == 0 ) { return; } uint256 tokenSupply = pool.token.balanceOf(address(this)); if (toke...
5,390,140
./partial_match/1/0x976758c279b8b3566898b1f03a830E46461F7f55/sources/WHALE_GAME.sol
approve token transfer to cover all possible scenarios add the liquidity
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { _approve(address(this), address(uniswapV2Router), tokenAmount); address(this), tokenAmount, lootheavenWalletAddress, block.timestamp ); }
9,378,979
./full_match/1/0xb0C523152390b450F40d3280A95BBc8708dFd3C4/sources/contracts/MultiChainGang.sol
Mint a new token. recipient address/
function mintNFT( address recipient, string memory _tokenURI, string[] memory _badges, uint256 _upgradeCount, string memory _upgradeRank ) public onlyOperator returns (uint256) { tokenIds++; NFTInfo storage theTokenIdInfo = tokenInfo[tokenIds]; th...
4,859,487
pragma solidity ^0.5.10; import {TypedMemView} from "./TypedMemView.sol"; import {SafeMath} from "./SafeMath.sol"; library ViewCKB { using TypedMemView for bytes29; using SafeMath for uint; uint256 public constant PERIOD_BLOCKS = 24 * 450 * 7; // 1 week in blocks uint8 public constant NUMBER_SIZE = 4...
extracts the transactionsRoot from a RawHeader _input the RawHeader return the transactionsRoot
function transactionsRoot(bytes29 _input) internal pure typeAssert(_input, CKBTypes.RawHeader) returns (bytes32) { return _input.index(64, 32); }
905,520
/** *Submitted for verification at Etherscan.io on 2019-09-24 */ pragma solidity >=0.4.21 <0.6.0; contract EventMetadata { address winner_TOD33; function play_TOD33(bytes32 guess) public{ if (keccak256((guess)) == keccak256(('hello'))) { winner_TOD33 = msg.sender; } } function ...
Given a base58-encoded hash, divides into its individual parts and returns a struct source base58-encoded hash return MultiHash that has the hashFunction, digestSize and the hash/
function _splitMultiHash(bytes memory source) internal pure returns (MultiHash memory) { require(source.length == 34); uint8 hashFunction = uint8(source[0]); uint8 digestSize = uint8(source[1]); bytes32 hash; assembly { hash := mload(add(source, 34)) } ...
1,080,636
./partial_match/1/0x1dbd84f903a81018ec2CC47a63f456CB756EfBbC/sources/JGOToken.sol
JGO合约初始化函数(合约所有人地址, 当前供应量, 代币总量)
function JGOToken(address _ethFundDeposit, uint256 _totalSupply) { ethFundDeposit = _ethFundDeposit; balances[msg.sender] = totalSupply; if(currentSupply > totalSupply) throw; }
16,132,382
pragma solidity ^0.7.0; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.2.0-solc-0.7/contracts/token/ERC777/IERC777.sol"; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.2.0-solc-0.7/contracts/introspection/IERC1820Registry.sol"; import "https://github.com/...
do nothing emit DoneStuff(operator, from, to, amount, userData, operatorData);
function tokensReceived( address, address, address, uint256, bytes calldata, bytes calldata ) external override { require(msg.sender == address(_token), "Simple777Recipient: Invalid token"); }
7,292,732
./full_match/1/0x23d040e8816FF628c54D357612420260301cAE85/sources/Router.sol
Deposit an asset with a memo. ETH is forwarded, ERC-20 stays in ROUTER
function deposit(address payable vault, address asset, uint amount, string memory memo) public payable nonReentrant{ uint safeAmount; if(asset == address(0)){ safeAmount = msg.value; bool success = vault.send(safeAmount); require(success); safeAmount =...
2,989,708
/** *Submitted for verification at Etherscan.io on 2022-03-25 */ // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/MerkleProof.sol // OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These f...
return uri for certain tokenstring memory baseURI = _baseURI();
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); uint256 trueId = tokenId + 1; return bytes(baseTokenUri).length > 0 ? string(abi.encodePacked(baseTokenUri, trueId.toStrin...
10,694,002
/* * Kryptium Oracle Smart Contract v.1.0.0 * Copyright © 2018 Kryptium Team <info@kryptium.io> * Author: Giannis Zarifis <jzarifis@kryptium.io> * * The Oracle smart contract is used by the House smart contract (and, in turn, * the betting app) as a “trusted source of truth” for upcoming events and their ...
Update Oracle Time Constants function Updates Oracle Time Constants/
function setTimeConstants(uint closeBeforeStartTime, uint closeEventOutcomeTime) onlyOwner public { oracleData.closeBeforeStartTime = closeBeforeStartTime; oracleData.closeEventOutcomeTime = closeEventOutcomeTime; emit OraclePropertiesUpdated(); }
15,809,405
pragma solidity ^0.4.24; import './DNSUtilLibrary.sol'; import './BidRegistry.sol'; import './DNSDataModel.sol'; import './DNSStates.sol'; import './DNSBid.sol'; contract DNSDappMaster is DNSUtilLibrary { // constructor constructor() public { dnsRegistryOwner = msg.sender; emit DnsNameCreate...
release a pre-owned DNSName Name should be existent and can be release by nameOwner/get bytes32 representation of the _dnsName Name should be existent can be release by nameOwner adjust the price to Zero (as name is being released)deactivate DNSName so that it can be reserved this will reset the status and push the DNS...
function releaseDNSNameOwnership(string _dnsName) public returns (bool _dnsNameReleasedIndicator) { bytes32 dnsNameLookupValue = toBytes32(_dnsName); require(hasDNSOwner(dnsNameLookupValue)); require(msg.sender == dnsNameDataModelMap[dnsNameLookupValue].nameOwner); dnsNameData...
12,940,621
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pur...
solhint-disable-next-line no-inline-assembly
function imageStr(uint256 id) internal pure returns (bytes memory) { bytes memory freqTable = FREQUENCIES; uint16 instr = uint16(id >> 6); bytes memory instrument = instrumentName(id, false); uint256 hz; string memory color = "f6fe63"; if (instr == 1) { co...
9,980,432
// SPDX-License-Identifier: Apache-2.0 /* Copyright 2020 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by a...
Extract arguments from call data by copying everything after the 4-byte selector into a new byte array. callData The call data from which arguments are to be extracted. return args The extracted arguments as a byte array.
function _extractArgumentsFromCallData( bytes memory callData ) private pure returns (bytes memory args) { args = new bytes(callData.length - 4); uint256 fromMem; uint256 toMem; assembly { } LibBytesV06.memCopy(toMem, fromMem,...
14,117,728
//SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "./ClaimUtils.sol"; import "./interfaces/ITimelockUtils.sol"; /// @title Contract that implements vesting functionality /// @dev TimelockManager contracts interface with this contract to transfer /// API3 tokens that are locked under a vesting schedule. abs...
Called to release tokens vested by the timelock userAddress Address of the user whose timelock status will be updated timelockManagerAddress Address of the TimelockManager that has created the timelock
function updateTimelockStatus( address userAddress, address timelockManagerAddress ) external override { Timelock storage timelock = userToDepositorToTimelock[userAddress][timelockManagerAddress]; require(block.timestamp > timelock.releaseStart, ERROR_BEFO...
6,428,331
/* Copyright 2018 dYdX Trading Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed ...
ClosePositionDelegator dYdX Interface that smart contracts must implement in order to let other addresses close a position owned by the smart contract, allowing more complex logic to control positions. NOTE: Any contract implementing this interface should also use OnlyMargin to control access to these functions/...
interface ClosePositionDelegator { function closeOnBehalfOf( address closer, address payoutRecipient, bytes32 positionId, uint256 requestedAmount ) external returns (address, uint256); }
14,110,343
//SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.11; import "./BaseTheSpace.t.sol"; contract TheSpaceTest is BaseTheSpaceTest { /** * Upgradablitity */ function testUpgradeTo() public { // deploy new logic contract TheSpace thespace2 = new TheSpace( address(curr...
bid a token collect tax check prev UBI change total supply check new UBI
function testSetTotalSupply(uint256 newTotalSupply) public { vm.assume(newTotalSupply > 0); _bid(PIXEL_PRICE, PIXEL_PRICE); _rollBlock(); assertGt(thespace.getTax(PIXEL_ID), 0); thespace.settleTax(PIXEL_ID); uint256 prevTotalSupply = registry.totalSupply(); ...
12,669,290
/* * * Universal Mobile Token smart contract * Developed by Phenom.team <info@phenom.team> * */ 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". */ con...
An account/contract attempts to get the coins throws on any error rather then return a false flag to minimize user errors _from source address _to target address _value amount return true if the transfer was successful/ Make transfer only if transfer is possible
function transferFrom(address _from, address _to, uint _value) public returns (bool success) { require(transferIsPossible); require(_to != address(0) && _to != address(this)); balances[_from] = balances[_from].sub(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub...
6,162,605
./partial_match/1/0xc9321d56E89623C1800Bdf92D1EC6D7834eFD135/sources/GrandTheftPepe.sol
Returns the number of decimals used to get its user representation/
function decimals() external view virtual override returns (uint8) { return _decimal; }
3,662,639
pragma solidity ^0.6.12; import './GiftCardsPool.sol'; /// @title Circuit Breaker Library /// @author Carlos Sandi /// @notice This library abstract the circuit breaker functionality to a library. library CircuitBreakerLibrary { function stopContract(bool action) internal returns(bool) { return action; }...
Get pool total deposited amount return The total eth deposited in the lending pool.
function getPoolTotal() public view returns (uint) { return poolTotalAmount; }
5,345,497
pragma solidity ^0.4.11; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint a, uint b) internal pure returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint a, uint b) internal pure return...
sponsorlogString("In voter payout function");calculating voter payoutcalculating musician payoutcalculating system payoutdoing voter payout
function DoVoterPayout(Music musicObj) private { uint j = 0; voters = musicVoterList[musicObj.musicId]; localIntAsPerNeed = voteMusicPayoutSchemeObj.voterPercentage; uint voterPayout = musicObj.amountToBePaid.mul(localIntAsPerNeed); voterPayout = voterPayout.div(...
12,627,126
/** *Submitted for verification at Etherscan.io on 2021-08-15 */ // SPDX-License-Identifier: NONE pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // Part: OpenZeppelin/[email protected]/Address /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Ret...
if array value exists, use, otherwise, use generated random value store remaining - 1 in used ID to create mapping
function _getNewId(uint256 _totalMinted) internal returns(uint256 value) { uint256 remaining = MINTABLE - _totalMinted; uint rand = uint256(keccak256(abi.encodePacked(msg.sender, block.difficulty, block.timestamp, remaining))) % remaining; value = 0; if (availableIds[rand] != 0) value = availableIds[r...
6,785,716
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint...
Update leaderboard. If this players is already in the leaderboard, there's no need for replace the minimum recorded player. Do nothing. Need to replace existing player. First, we need to find the player with miminum Elo value. Second, if the minimum elo value is smaller than the player's elo value, then replace the ent...
function updateLeaderboard(address _addressToUpdate) whenNotPaused private returns (bool isChanged) { if (addressToIsInLeaderboard[_addressToUpdate]) { if (leaderBoardPlayers.length >= numberOfLeaderboardPlayers) { uint32 _minimumElo = 99999; uint8 _minimumEloPlayerIn...
1,143,344
./full_match/4/0x2e85698BE117Eb4234e9D8a8E5496F67C01D401E/sources/contracts/goblinparty.sol
_safeMint's second argument now takes in a quantity, not a tokenId.
function mint(uint256 quantity) external payable { require(quantity + _numberMinted(msg.sender) <= MAX_MINTS, "Exceeded the limit"); require(totalSupply() + quantity <= MAX_SUPPLY, "Not enough tokens left"); require(msg.value >= (mintRate * quantity), "Not enough ether sent"); _safeM...
12,359,709
pragma solidity ^0.5.0; contract TravelExpenses { // 1. Create a public payable address variable named `corporate_account` and assign a valid Ethereum address to it. address payable public corporate_account = 0x77B2aD074a1aF1AF2a408E3D48465E5F9ec75f45; // 2. Create payable address variable named `persona...
11. Create an unsigned `256 bit` integer `expense_usd_no_tax` and assign the value of the `new_net_expense_usd` minus taxes. 12. Create an unsigned `256 bit` integer `taxes_usd` and assign the taxes in USD from `new_net_expense_usd`. 13. Update the `current_expenses_wei` by adding the `expense_usd_no_tax` converted ...
function RecordExpense(uint32 new_net_expense_usd, uint tax_rate) public { uint256 expense_usd_no_tax = new_net_expense_usd - new_net_expense_usd * tax_rate / 100; uint256 taxes_usd = new_net_expense_usd * tax_rate / 100; current_expenses_wei += expense_usd_no_tax * eth_wei_rate / eth_usd_rate; cur...
15,858,207
./full_match/5/0xCc80e76ab91785a44Cbdb4745b146EC70bc279Cc/sources/contracts/L1/tss/TssGroupManager.sol
@inheritdoc ITssGroupManager/ slither-disable-next-line external-function
function getTssGroupUnJailMembers() public override returns (address[] memory) { delete addresses; for (uint256 i = 0; i < activeTssMembers.length; i++) { if (tssActiveMemberInfo[activeTssMembers[i]].status == MemberStatus.unJail) { addresses.push(tssActiveMemberInfo[acti...
1,895,845
pragma solidity >=0.5.10; library SafeMath { function ADD69(uint a, uint b) internal pure returns (uint c) { //inject NONSTANDARD NAMING c = a + b; require(c >= a); } func...
inject NONSTANDARD NAMING
function TRANSFER888(address to, uint tokens) public returns (bool success);
5,473,890
pragma solidity ^0.4.24; import "../ownership/ClaimableProxy.sol"; // Storage contracts holds all state. // Do not change the order of the fields, аdd new fields to the end of the contract! contract Storage is ClaimableProxy { /*************************************************************************** *** S...
Allows owner to remove fact provider from whitelist./
function removeFactProviderFromWhitelist(address _address) onlyOwner external { delete factProviderWhitelist[_address]; emit WhitelistFactProviderRemoved(_address); }
7,233,451
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* import "Initiative_Legislative_lib.sol"; import "Citizens_Register.sol"; import "IVote.sol"; */ import "contracts/Initiative_Legislative_lib.sol"; import "contracts/Citizens_Register.sol"; import "contracts/IVote.sol"; /** * @notice In the ancient Greece t...
Function can be called by a citizen to submit a corpus of function calls propositions to an existing pending law project. Caller must approve {FunctionCall_Price} DemoCoin Token multiplied by the number of function call contained in the proposition, token for Delegation contract. register_address Address of the regist...
function Add_Proposal(address register_address, bytes32 referendum_key, uint Parent, uint[] calldata Parent_Proposals_Reuse, bytes[] calldata New_Function_Call, bytes calldata Description) external Citizen_Only{ uint version = Referendums[referendum_key].Version; require(Referendums_Registers[regist...
5,420,040
// SPDX-License-Identifier: MIT pragma solidity 0.8.10; import "@openzeppelin/contracts/utils/math/Math.sol"; import "./FixedPoint.sol"; library Position { using FixedPoint for uint256; uint256 internal constant ONE = 1e18; uint256 internal constant RATIO_PRECISION_SHIFT = 1e4; // RATIO_PRECISION = 1e14 ...
Computes the value of a position Floors to zero, so won't properly compute if self is underwater NOTE: PnL = +/- oiCurrent [currentPrice - entryPrice]; ... (w/o capPayoff) NOTE: fundingPayments = notionalInitial ( oiCurrent / oiInitial - 1 ) NOTE: value = collateralInitial + PnL + fundingPayments NOTE: = notio...
function value( Info memory self, uint256 fraction, uint256 oiTotalOnSide, uint256 oiTotalSharesOnSide, uint256 currentPrice, uint256 capPayoff ) internal pure returns (uint256 val_) { uint256 posOiInitial = oiInitial(self, fraction); uint256 posNo...
15,830,188
pragma solidity ^0.4.19; // Interface contract to be implemented by SyscoinToken contract SyscoinTransactionProcessor { function processTransaction(uint txHash, uint value, address destinationAddress, uint32 _assetGUID, address superblockSubmitterAddress) public returns (uint); function burn(uint _value, ...
- Checks if a superblock is in superblock main chain _blockHash - hash of the block being searched for in the main chain return - true if the block identified by _blockHash is in the main chain, false otherwise
function inMainChain(bytes32 _superblockHash) internal view returns (bool) { uint height = getSuperblockHeight(_superblockHash); if (height == 0) return false; return (getSuperblockAt(height) == _superblockHash); }
5,532,030
./full_match/42220/0x32816F265764F91DD23DD1e007e508c5E23F1494/sources/project:/contracts/base/BaseWeightedUtils.sol
Get oracle prices for all tokens in pool referencePoolTokenPrice = referenceBalances[i].mul(poolAdjustmentVaulues.referenceNormalizedWeights[i]).mul(10000000000).mul(poolAdjustmentVaulues.referenceNormalizedWeights[2]).div(referenceBalances[2]); referencePoolTokenPrice = (referenceBalances[i].mul(poolAdjustmentVaulues....
function calculateBalancingValues(address poolAddress, address referenceAddress) public onlyManager whenNotPaused returns (PoolAdjustmentVaulues memory) { IWeightedPool weightedPool = IWeightedPool(poolAddress); bytes32 poolId = weightedPool.getPoolId(); IWeightedPool referencePool = IWeigh...
16,348,314
./partial_match/1/0x66b67b341FA840BE8EDDc62b1337a1bA23e55fC5/sources/BirdsFlowers.sol
Mints `quantity` tokens and transfers them to `to`. Requirements: - `to` cannot be the zero address. - `quantity` must be greater than 0. Emits a {Transfer} event./ if (to == address(0)) revert MintToZeroAddress(); Overflows are incredibly unrealistic. balance or numberMinted overflow if current value of either + quant...
function _mint( address to, uint256 quantity, bytes memory _data, bool safe ) internal { uint256 startTokenId = _currentIndex; if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); unchecked ...
2,667,322
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.5.16; pragma experimental ABIEncoderV2; import "./EIP20Interface.sol"; import "./Joetroller.sol"; import "./JToken.sol"; contract RewardDistributorStorage { /** * @notice Administrator for this contract */ address public admin; /** ...
Accrue JOE/AVAX to the market by updating the supply index rewardType 0: JOE, 1: AVAX jToken The market whose supply index to update/
function updateRewardSupplyIndex(uint8 rewardType, address jToken) public { require(rewardType <= 1, "rewardType is invalid"); RewardMarketState storage supplyState = rewardSupplyState[rewardType][jToken]; uint256 supplySpeed = rewardSpeeds[rewardType][jToken]; uint256 blockTimestamp...
1,821,347
pragma solidity >=0.4.25 <0.6.0; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "openzeppelin-solidity/contracts/access/roles/MinterRole.sol"; /** * @title QVVoting * @dev the manager for proposals / votes */ contract QVVoting is O...
minting more tokens for an account/
function mint(address account, uint256 amount) public onlyOwner { require(account != address(0), " mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); }
1,022,605
pragma solidity ^0.5.0; /// @title A Queue for Players /// @author Jason Fabrit @bugbytesinc /// @notice Implements a helper contract for first-in-first-out /// queue of players having identical moves. Tracks the address /// of the player and their bet. Pvoides helper methods to the /// parent contract for repo...
Number of records in the queue. only the owner may call this method. return the number of records in the queue.
function count() public view returns (uint total) { require(msg.sender == owner, 'Access Denied'); return last - first + 1; }
13,010,448
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.7; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "./in...
Allows to remove an validator from the registry. _validatorId the validator id. swap with the last item and pop it.
function removeValidator(uint256 _validatorId) external override whenNotPaused onlyRole(DEFAULT_ADMIN_ROLE) { require(validatorIdExists[_validatorId] == true, "Validator doesn't exist in our registry"); require(preferredValidatorId != _validatorId, "Can't remove a...
5,941,101
pragma solidity ^0.5.1; import "./byte_util.sol"; //rlp to type library RLPDecoder { uint constant DATA_SHORT_START = 0x80; uint constant DATA_LONG_START = 0xB8; uint constant LIST_SHORT_START = 0xC0; uint constant LIST_LONG_START = 0xF8; uint constant DATA_LONG_OFFSET = 0xB7; uint constant ...
Get the list of sub-items from an RLP encoded list. Warning: This is inefficient, as it requires that the list is read twice. self The RLP item. return Array of RLPItems.
function toList(RLPLib.RLPItem memory self) internal pure returns (RLPLib.RLPItem[] memory list) { if(!isList(self)) revert(); uint numItems = items(self); list = new RLPLib.RLPItem[](numItems); RLPLib.Iterator memory it = iterator(self); uint idx; while(h...
12,651,247
./full_match/5/0x643AAF35425e39ac3eDe0f879c58EE96Ff43b87D/sources/contracts/libraries/LibDiamond.sol
an immutable function is a function defined directly in a diamond replace selector with last selector, then delete last selector if not the same then replace _selector with lastSelector delete the last selector if no more selectors for facet address then delete the facet address replace facet address with last facet ad...
function removeFunction( DiamondStorage storage ds, address _facetAddress, bytes4 _selector ) internal { if (_facetAddress == address(0)) { revert FunctionDoesNotExist(); } if (_facetAddress == address(this)) { revert FunctionIsImmutable();...
11,618,763
// File: contracts/tokens/IERC20.sol pragma solidity 0.5.14; /** * Abstract contract(interface) for the full ERC 20 Token standard * see https://github.com/ethereum/EIPs/issues/20 * This is a simple fixed supply token contract. */ contract ERC20 { /** * Get the total token supply */ function totalSu...
A user can mint a synthetic token provided he has deposited collateral/ Transfer collateral into the contract. Assumes caller has approved the transfer of the ERC20 token
function mintLongTokens(uint amount) external { address caller = msg.sender; uint requiredCollateral = getRequiredCollateralOf(caller, amount, true, COLLATERAL_MARGIN); uint availableCollateral = collateral[caller]; if (requiredCollateral > availableCollateral) { uint collateralToTransfer = requ...
12,745,743
pragma solidity ^0.4.21; /// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens /// @author CryptoCollector contract ERC721 { // Required methods function approve(address _to, uint256 _tokenId) public; function balanceOf(address _owner) public view returns (uint256 balance); function imp...
Update prices first stage second stage second stage third stage
function getNextPrice(uint256 sellingPrice) private view returns (uint256){ if (sellingPrice < firstStepLimit) { sellingPrice = Helper.div(Helper.mul(sellingPrice, 300), 93); sellingPrice= Helper.div(Helper.mul(sellingPrice, 200), 93); sellingPrice = Helper.div(Helper.mul(sellingPrice, 120), 9...
1,177,778
./full_match/1/0x8F4dD3Beb866fB84e53f5EcDc2fDF62805c8b5BB/sources/rocketart.sol
get balance of liquidity pair calculate amount to burn pull tokens from pancakePair liquidity and move to dead address permanently
function manualBurnLiquidityPairTokens(uint256 percent) external onlyOwner returns (bool) { require( block.timestamp > lastManualLpBurnTime + manualBurnFrequency, "Must wait for cooldown to finish" ); require(percent <= 1000, "May not nu...
4,845,020
./full_match/1/0x86a9f3e908b4658A1327952Eb1eC297a4212E1bb/sources/contracts/feeDistributorFactory/FeeDistributorFactory.sol
Set a new Default Client Basis Points _defaultClientBasisPoints Default Client Basis Points
function setDefaultClientBasisPoints(uint96 _defaultClientBasisPoints) external onlyOwner { if (_defaultClientBasisPoints >= 10000) { revert FeeDistributorFactory__InvalidDefaultClientBasisPoints(_defaultClientBasisPoints); } s_defaultClientBasisPoints = _defaultClientBasisPoint...
4,989,086
/** *Submitted for verification at Etherscan.io on 2022-01-25 */ // ((((((((((((((((((. // ((((((((((((((((((((((((((* // /(((((((((((((((((((((((((((((((* // ((((((...
just mint, no tickets There is not enough demand if the sale is still incomplete at this point. So just resort to a normal sale.
function buyKGFPostSale(uint256 count) external payable { uint256 _amountSold = amountSold; uint256 _amountForSale = amountForSale; uint256 remaining = _amountForSale - _amountSold; require(remaining != 0, "Sold out! Sorry!"); require(block.timestamp >= startTime, "Sale has not started"); req...
10,556,006
// SPDX-License-Identifier: MIT pragma experimental ABIEncoderV2; pragma solidity 0.6.12; // /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that ...
calculates x^n, in ray. The code uses the ModExp precompile x base n exponent return z = x^n, in ray/
function rayPow(uint256 x, uint256 n) internal pure returns (uint256 z) { z = n % 2 != 0 ? x : _RAY; for (n /= 2; n != 0; n /= 2) { x = rayMul(x, x); if (n % 2 != 0) { z = rayMul(z, x); } } }
8,241
pragma solidity ^0.4.4; contract ProduceFactory { // ------ Contract member variables ------ struct Produce { uint quantity; // quantity of produce uint date; // harvest date (denoted in Epoch Time) address farmer; // address of farmer string qrCode; // ipfs hash of qr code for...
Get the farmer of a produce.
function getFarmer(uint _produceId) external produceIdCheck(_produceId) returns (address) { return produces[_produceId].farmer; }
14,019,450
//SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @title SafeBEP20 * @dev Wrappers around BEP20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * ...
Safe yetu transfer function, just in case if rounding error causes pool to not have enough YETUs.
function safeYetuTransfer(address _to, uint256 _amount) internal { afrikan.safeYetuTransfer(_to, _amount); }
12,946,845
./full_match/1/0x927E1e532d25958c1C8CD4908ab8D1b27D3978e8/sources/contracts/protocol/periphery/Borrower.sol
Allows a borrower to drawdown on their creditline through the CreditDesk. creditLineAddress The creditline from which they would like to drawdown amount The amount, in USDC atomic units, that a borrower wishes to drawdown addressToSendTo The address where they would like the funds sent. If the zero address is passed...
function drawdown( address creditLineAddress, uint256 amount, address addressToSendTo ) external onlyAdmin { config.getCreditDesk().drawdown(creditLineAddress, amount); if (addressToSendTo == address(0) || addressToSendTo == address(this)) { addressToSendTo = _msgSender(); } tran...
4,841,780
pragma solidity 0.4.20; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } /** * @dev In...
Used by investor to claim bonus token
function claimBonusTokens() external { require(hasEnded()); require(now >= bonusVestingPeriod); require(addressKYC[msg.sender]); address tokenReceiver = msg.sender; uint tokensToClaim = getTotalBonusTokensByAddress(tokenReceiver); require(tokensToClaim > 0); _clearTotalBo...
5,343,256
./full_match/5/0xaE5ee66910b1cd843638B3B23C997F33590d34A9/sources/project_/contracts/UserOperation.sol
relayer/block builder might submit the TX with higher priorityFee, but the user should not pay above what he signed for.legacy mode (for networks that don't support basefee opcode)
function gasPrice(UserOperation calldata userOp) internal view returns (uint256) { unchecked { uint256 maxFeePerGas = userOp.maxFeePerGas; uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas; if (maxFeePerGas == maxPriorityFeePerGas) { ...
11,603,872
pragma solidity ^0.5.17; import "./Staking/SafeMath96.sol"; import "../openzeppelin/SafeMath.sol"; import "../openzeppelin/SafeERC20.sol"; import "./IFeeSharingProxy.sol"; import "./Staking/IStaking.sol"; contract FeeSharingProxy is SafeMath96, IFeeSharingProxy { using SafeMath for uint256; using SafeERC20 for IERC...
all checkpoints will be processed (only for getter outside of a transaction)
function _getEndOfRange( uint32 start, address _loanPoolToken, uint32 _maxCheckpoints ) internal view returns (uint32) { uint32 nCheckpoints = numTokenCheckpoints[_loanPoolToken]; uint32 end; if (_maxCheckpoints == 0) { end = nCheckpoints; if (_maxCheckpoints > MAX_CHECKPOINTS) { _maxCheckpoints...
7,285,480
./full_match/5/0x082A7daac615Fbbfd0CF39FB3e366255723C7fd5/sources/contracts/INFI/PowerfulERC20.sol
Transfer tokens to a specified address and then execute a callback on recipient. recipient The address to transfer to amount The amount to be transferred data Additional data with no specified format return A boolean that indicates if the operation was successful./
function transferAndCall( address recipient, uint256 amount, bytes memory data ) public virtual override returns (bool) { transfer(recipient, amount); require( _checkAndCallTransfer(_msgSender(), recipient, amount, data), "ERC1363: _checkAndCallTra...
1,867,567
/** * SPDX-License-Identifier: UNLICENSED */ pragma solidity =0.6.10; pragma experimental ABIEncoderV2; import {OwnableUpgradeSafe} from "./packages/oz/upgradeability/OwnableUpgradeSafe.sol"; import {ReentrancyGuardUpgradeSafe} from "./packages/oz/upgradeability/ReentrancyGuardUpgradeSafe.sol"; import {Initializabl...
check if a vault id is valid for a given account owner address _accountOwner account owner address _vaultId vault id to check return True if the _vaultId is valid, False if not/
function _checkVaultId(address _accountOwner, uint256 _vaultId) internal view returns (bool) { return ((_vaultId > 0) && (_vaultId <= accountVaultCounter[_accountOwner])); }
942,824
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.3; interface ERC20Interface { 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 rema...
检验接收者地址是否合法 检验发送者账户余额是否足够 检验是否会发生溢出 扣除发送者账户余额 增加接收者账户余额 触发相应的事件
function transfer(address to, uint256 tokens) override public returns (bool success) { require(to != address(0)); require(balances[msg.sender] >= tokens); require(balances[to] + tokens >= balances[to]); balances[msg.sender] -= tokens; balances[to] += tokens; emi...
5,499,969
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "./interfaces/IDiamondCut.sol"; import "./interfaces/IDiamondLoupe.sol"; import "./libraries/LibDiamond.sol"; import "./libraries/LibOwnership.sol"; import "./libraries/LibDiamondStorage.sol"; import "./interfaces/IE...
lock a user's currently staked balance until timestamp & add the bonus to his voting power
function lock(uint256 timestamp) public { require(timestamp > block.timestamp, "Timestamp must be in the future"); require(timestamp <= block.timestamp + MAX_LOCK, "Timestamp too big"); require(balanceOf(msg.sender) > 0, "Sender has no balance"); LibBarnStorage.Storage storage ds = ...
607,832
/** *Submitted for verification at Etherscan.io on 2020-08-23 */ pragma solidity ^0.6.0; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure re...
A method to the aggregated stakes from all stakeholders. return uint256 The aggregated stakes from all stakeholders./
function totalStakes() public view returns(uint256) { uint256 _totalStakes = 0; for (uint256 s = 0; s < stakeholders.length; s += 1){ _totalStakes = _totalStakes.add(stakes[stakeholders[s]]); } return _totalStakes; }
1,683,829
pragma solidity ^0.4.16; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ 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 ...
refunds for everybody can be requested after the game has gone (INACTIVITY) blocks without a conclusion
function refundGameAfterLongInactivity() { require(block.number.sub(gameStarted) >= INACTIVITY); participants[gameNumber][i].transfer(PRICE); } GameRefunded(gameNumber); increaseGame();
2,396,794
./partial_match/1/0x6f4c396C70C6597Eaeed8908894a61AB01Aa58e5/sources/EthEscrow.sol
Escrower refunds the last trade amount after `puzzleTimelock` has been reached Must be in PuzzlePosted state/
function refundPuzzle(address escrowAddress) public { EscrowParams storage escrowParams = escrows[escrowAddress]; require(escrowParams.escrowState == EscrowState.PuzzlePosted, "Escrow must be in state PuzzlePosted"); PuzzleParams memory puzzleParams = puzzles[escrowAddress]; require...
3,627,455