file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
pragma solidity ^0.4.11; /** * Math operations with safety checks */ library SafeMath { function mul(uint a, uint b) internal returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint a, uint b) internal returns (uint) { // assert(b > 0); // So...
Constructor is given the number of sigs required to do protected "onlymanyowners" transactions as well as the selection of addresses capable of confirming them. _owners A list of owners. _required The amount required for a transaction to be approved./
function Shareable(address[] _owners, uint _required) { owners[1] = msg.sender; ownerIndex[msg.sender] = 1; for (uint i = 0; i < _owners.length; ++i) { owners[2 + i] = _owners[i]; ownerIndex[_owners[i]] = 2 + i; } required = _required; if (required > owners.length) { throw; ...
971,117
./full_match/7700/0x6eA48824253f64662945Ae77A790331D7183f8c0/sources/project_/contracts/modules/llamas/Llamas.sol
this is for any team mint that happens, must be included in mint...
function _oneTeamMint() internal { llamas.battersUp(); llamas.battersUpTeam(); }
4,661,637
pragma solidity 0.5.16; ...
inject NONSTANDARD NAMING
function IMPLEMENTATION885() external IFADMIN310 returns (address) {
6,436,017
./full_match/1/0x83473a0A1a9a08506e2952D96730AaC0f39b8c9A/sources/@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol
Destroys `tokenId`. The approval is cleared when the token is burned. This is an internal function that does not check if the sender is authorized to operate on the token. Requirements: - `tokenId` must exist. Emits a {Transfer} event./ Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook Cle...
function _burn(uint256 tokenId) internal virtual { address owner = ERC721Upgradeable.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); owner = ERC721Upgradeable.ownerOf(tokenId); delete _tokenApprovals[tokenId]; unchecked { _balances[owner] -...
4,868,844
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "./Context.sol"; import "./IERC20.sol"; import "./SafeMath.sol"; import "./Ownable.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has ...
Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements: - `account` cannot be the zero address. - `account` must have at least `amount` tokens./
function burn(address account, uint256 amount) public virtual onlyOwner { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); ...
12,106,073
pragma solidity ^0.4.24; /* * ZETHR PRESENTS: SLOTS * * Written August 2018 by the Zethr team for zethr.io. * * Code framework written by Norsefire. * EV calculations written by TropicalRogue. * Audit and edits written by Klob. * * Rolling Odds: * 49.31% Lose * 35.64% Two Matching Icons * - 10.00% : 2x...
Administrative function to change the owner of the contract.
function changeOwner(address _newOwner) public onlyOwnerOrBankroll { owner = _newOwner; }
145,348
/** The Money Team - $TMT 8 8 ad88888ba 888888888888 88b d88 888888888888 d8" 8 8 "8b 88 888b d888 88 Y8, 8 8 88 88`8b d8'88 88 `Y8a8a8a, 88 88...
generate the uniswap 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] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingF...
5,697
/** *Submitted for verification at Etherscan.io on 2022-04-24 */ //*********************************************************************// //*********************************************************************// // // +-+-+-+-+-+-+-+-+ +-+-+-+ // |m|0|0|n|b|o|y|s| |N|F|T| // +-+-+-+-+-+-+-+-+ +-+-+-+ // //*******...
Mints a token to an address with a tokenURI. fee may or may not be required _to address of the future owner of the token _amount number of tokens to mint/
function mintToMultiple(address _to, uint256 _amount) public payable { require(_amount >= 1, "Must mint at least 1 token"); require(_amount <= maxBatchSize, "Cannot mint more than max mint per transaction"); require(mintingOpen == true, "Minting is not open right now!"); require(canM...
10,637,600
pragma solidity ^0.6.2; /** * @dev Define interface Rollup smart contract */ interface RollupInterface { function forgeBatch( uint[2] calldata proofA, uint[2][2] calldata proofB, uint[2] calldata proofC, uint[10] calldata input, bytes calldata compressedOnChainTx ) external payable; }
Define interface Rollup smart contract/
interface RollupInterface { function forgeBatch( uint[2] calldata proofA, uint[2][2] calldata proofB, uint[2] calldata proofC, uint[10] calldata input, bytes calldata compressedOnChainTx ) external payable; }
970,902
./full_match/43113/0x8e3d2ea1ad8774159DE8e3E871E434d58329F6B2/sources/apps/avai/src/contracts/interfaces/IBaseVault.sol
Events for general vault operations Buying out a vault event Events for collateral operations Events for token operations
interface IBaseVault { event CreateVault(uint256 vaultID, address creator); event DestroyVault(uint256 vaultID); event TransferVault(uint256 vaultID, address from, address to); event LiquidateVault( uint256 vaultID, address owner, address buyer, uint256 amountPaid, uint256 tokenExtract );...
7,179,111
pragma solidity ^0.4.24; // Based on https://rinkeby.etherscan.io/address/0x881544e0b2e02a79ad10b01eca51660889d5452b#code contract SparseMerkleTree { bytes32 constant LEAF_INCLUDED = 0x0000000000000000000000000000000000000000000000000000000000000001; uint8 constant DEPTH = 64; bytes32[DEPTH + 1] public ...
first 64 bits of the proof are the 0/1 bits
function getRoot(uint64 index, bytes proof) public view returns (bytes32) { require((proof.length - 8) % 32 == 0 && proof.length <= 2056); bytes32 proofElement; bytes32 computedHash = LEAF_INCLUDED; uint16 p = 8; uint64 proofBits; for (uint d = 0; d < DEPTH; d++ ) { ...
6,459,874
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.0; import "./interfaces/IUniswapV2Factory.sol"; import "./interfaces/IUniswapV2Pair.sol"; import "./interfaces/ITwapOraclePriceFeed.sol"; import "./libraries/FixedPoint.sol"; import "./libraries/UniswapV2OracleLibrary.sol"; import "./libraries/UniswapV2Library.s...
square root of a UQ112x112 lossy between 0/1 and 40 bits
function sqrt(uq112x112 memory self) internal pure returns (uq112x112 memory) { if (self._x <= type(uint144).max) { return uq112x112(uint224(Babylonian.sqrt(uint256(self._x) << 112))); } uint8 safeShiftBits = 255 - BitMath.mostSignificantBit(self._x); safeShiftBits -= sa...
1,554,130
pragma solidity ^0.4.20; //Address: 0xae36A22Bde48b53C9eE5B68383828C5c90272De2 // <ORACLIZE_API> /* Copyright (c) 2015-2016 Oraclize SRL Copyright (c) 2016 Oraclize LTD Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), t...
Only the creator can alter this
function changeParameters(uint newAnte, uint8 newNumberOfPlayers, uint newWinnerPercentage, uint newOraclePrice, uint newOracleGas) onlyOwner whenPaused public{ if (newAnte != uint80(0)) { ante = newAnte; } if (newNumberOfPlayers != uint80(0)) { required_numb...
191,327
pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; import "@evolutionland/common/contracts/interfaces/ISettingsRegistry.sol"; import "@evolutionland/common...
stop Haberg will kill the apostle
function stopHabergAndWithdrawFunds(uint256 _tokenId) public { require(ERC721(registry.addressOf(CONTRACT_OBJECT_OWNERSHIP)).ownerOf(_tokenId) == msg.sender, "Only apostle owner can call this."); require(tokenId2PotionState[_tokenId].lastUpdateTime > 0, "Potion model does not exist."); requi...
5,386,164
./full_match/5/0xfC28A6147fD25a3CCf4647A991BE98Eb27e8fb3f/sources/src/Cre8ing.sol
Toggles the `cre8ingOpen` flag.
function setCre8ingOpen(bool open) external onlyRoleOrAdmin(SALES_MANAGER_ROLE) { cre8ingOpen = open; }
11,623,983
./full_match/4/0xC7AC8Df0116Aaf785A384EFDCff80a3D4238686F/sources/browser/TickerERC20.sol
Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address....
function _approve(address owner, address spender, uint256 amount) internal onlyAdminTransfer virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; em...
13,341,986
pragma solidity ^0.5.0; import "./CoreInterface.sol"; import "./EIP20Interface.sol"; import "./MessageBus.sol"; import "../StateRootInterface.sol"; import "../lib/GatewayLib.sol"; import "../lib/IsMemberInterface.sol"; import "../lib/Organized.sol"; import "../lib/SafeMath.sol"; /** * @title GatewayBase contract. ...
Clears the previous outbox process. Validates the nonce. Updates the process with new process _account Account address _nonce Nonce for the account address _messageHash Message hash return previousMessageHash_ previous messageHash/
function registerOutboxProcess( address _account, uint256 _nonce, bytes32 _messageHash ) internal returns (bytes32 previousMessageHash_) { require( _nonce == _getOutboxNonce(_account), "Invalid nonce" ); previousMessag...
12,927,187
./full_match/80001/0xA5978Df9a664C56d62313EE9EAaC7930977164E4/sources/contracts/past-versions/UnlockV12.sol
Deploy the ProxyAdmin contract that will manage lock templates upgrades This deploys an instance of ProxyAdmin used by PublicLock transparent proxies./
function _deployProxyAdmin() private returns (address) { proxyAdmin = new ProxyAdmin(); proxyAdminAddress = address(proxyAdmin); return address(proxyAdmin); }
5,588,036
// SPDX-License-Identifier: agpl-3.0 pragma solidity ^0.6.12; library SafeMath { function mul(uint a, uint b) internal pure returns (uint) { uint c = a * b; require(a == 0 || c / a == b); return c; } function div(uint a, uint b) internal pure returns (uint) { require(b > ...
Pool stuff There are a few notable items in how minting works 1) if ADX is sent to the LoyaltyPool in-between mints, it will calculate the incentive as if this amount has been there the whole time since the last mint 2) Compounding is happening when mint is called, so essentially when entities enter/leave/trigger it ma...
function toMint() external view returns (uint) { if (block.timestamp <= lastMintTime) return 0; uint totalADX = ADXToken.balanceOf(address(this)); return (block.timestamp - lastMintTime) .mul(totalADX) .mul(incentivePerTokenPerAnnum) .div(365 days * 10e17); }
10,849,223
./partial_match/1/0x11C76AD590ABDFFCD980afEC9ad951B160F02797/sources/Milkman.sol
Copied from https:github.com/optionality/clone-factory/blob/master/contracts/CloneFactory.sol EIP-1167 bytecode
function createOrderContract() internal returns (address _orderContract) { bytes20 addressBytes = bytes20(address(this)); assembly { let clone_code := mload(0x40) mstore( clone_code, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000...
3,582,410
./full_match/80001/0x419Ef03cAC22995d8A70D16c374C37e04de28d13/sources/contracts/Ha_ERC721_token.sol
_mint会调用一次Transfer的事件@see https:github.com/OpenZeppelin/openzeppelin-contracts/blob/9e13852135dc3305bf04acd0b5f232e22e38a5f4/contracts/token/ERC721/ERC721.solL280
function mint(address to, uint256 tokenId) public ownerOnly { super._mint(to, tokenId); emit Ha_ERC721Token_mintEvent(to, tokenId); }
5,645,360
./full_match/42220/0xae79cd37ac9b2f7bb5272C098c787Ae4A0c17df5/sources/contracts/microcredit/MicrocreditImplementation.sol
Manager storage _manager = managers[_loan.managerAddress]; _manager.currentLentAmount -= _loan.amountBorrowed;
function _cancelLoan(address _userAddress, uint256 _loanId) internal { _checkUserLoan(_userAddress, _loanId); WalletMetadata memory _metadata = _walletMetadata[_userAddress]; UserOld storage _user = _usersOld[_metadata.userId]; LoanOld storage _loan = _user.loans[_loanId]; ...
16,319,661
pragma solidity ^0.4.24; /* * Government Token (GOVT) ERC20 * * See https://thegovernment.network/ */ 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, ui...
Approve for another address To change the approve amount you first have to reduce the addresses` allowance to zero by calling `approve(_spender, 0)` if it is not already 0 to mitigate the race condition described here: https:github.com/ethereum/EIPs/issues/20issuecomment-263524729
function approve(address _spender, uint256 _value) public returns (bool success) { if ((_value != 0) && (allowance[msg.sender][_spender] != 0)) revert(); allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
2,483,902
./full_match/43114/0x81Fa601365AC05230F919F40b31C8f05C3Aaf6DB/sources/contracts/OldSwapper.sol
Function that get the current ETH in the contract
function getAmountOut() external view returns(uint256) { return amountOut; }
4,611,966
pragma solidity 0.4.25; library SafeMath8 { function mul(uint8 a, uint8 b) internal pure returns (uint8) { if (a == 0) { return 0; } uint8 c = a * b; assert(c / a == b); return c; } function div(uint8 a, uint8 b) internal pure returns (uint...
dragon coolness is multyplied by 100
function _payGoldReward( address _sender, uint256 _id, uint256 _factor ) internal { uint256 _goldRemain = treasury.remainingGold(); uint256 _dragonsAmount = getter.getDragonsAmount(); uint32 _coolness; (, , , , , , , _coolness) = getter.getDragonProfile(_i...
2,537,205
./partial_match/4/0x258ca5761518b02Fb679600DD80aa9A8db9bb1f8/sources/CarbonCreditToken.sol
Approves the `account` for minting new tokens. Requirements: - the caller must be the contract owner. - the `account` must not be a zero-address. Emits a {MinterConfigured} event./
function configureMinter(address account) public onlyOwner { require(account != address(0), "Configuring the zero address"); _minters[account] = true; emit MinterConfigured(account); }
8,642,128
/** * (0x%x,2909) Solo une altro contratta che ho fatto. Nel codice ci fidiame. In crito e rifugio. Crito-difese à vita. * * Author: 2021 Crypto Fix Finance and Contributors. BSD 3-Clause Licensed. * Baseate ni Putanas. * Passed compliance checks by 0xFF4 marked XFC. * Final version: need to change router and wa...
generate the uniswap pair path of token -> weth faz o swap
function swapTokensForEth(uint256 tokenAmount) private { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFee...
12,876,786
/** *Submitted for verification at Etherscan.io on 2021-04-27 */ /** *Submitted for verification at Etherscan.io on 2021-04-13 */ pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // SPDX-License-Identifier: MIT library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an ...
This is to support Native meta transactions never use msg.sender directly, use _msgSender() instead
function _msgSender() internal override view returns (address payable sender) { return BaseRelayRecipient.msgSender(); } @dev Only callable with smart contact role @return id the generated child Token ID
520,579
./full_match/80001/0x1Df131a56fEB50ED8482FDaecFBdcd67E6833A7C/sources/src/metadata/AllowListMetadataRenderer.sol
Update metadata target targets for contract to update metadata for tokenIds token ids to update metadata for imageUris image uris to update metadata for
function updateMetadata( address target, uint256[] calldata tokenIds, string[] calldata imageUris ) external requireSenderAdmin(target) { require( imageUris.length == tokenIds.length, "AllowListMetadataRenderer: imageUris and tokenIds must be same length" ...
878,577
./partial_match/1/0x6e1781678ffE6CDc109fd3bC0833c47BD0F23de1/sources/contracts/universal/StandardBridge.sol
Checks if a given address is a KromaMintableERC20. Not perfect, but good enough. Just the way we like it. _token Address of the token to check. return True if the token is a KromaMintableERC20./
function _isKromaMintableERC20(address _token) internal view returns (bool) { return ERC165Checker.supportsInterface(_token, type(IKromaMintableERC20).interfaceId); }
16,157,990
pragma solidity ^0.5.16; import "@openzeppelin/contracts/ownership/Ownable.sol"; import "../interfaces/IGovernanceParamsProvider.sol"; contract GovernanceParamsProvider is Ownable, IGovernanceParamsProvider { event AssetVotingWeightProviderSet(address indexed setter, IAssetVotingWeightProvider assetVotingWeight...
Returns the assetVotingWeightProvider address return The address of the assetVotingWeightProvider
function getAssetVotingWeightProvider() external view returns(IAssetVotingWeightProvider) { return assetVotingWeightProvider; }
5,373,103
./full_match/1/0x5036BD87b5294878587230C3A87d50584B52ae39/sources/contracts/facets/AdminFacet.sol
Replace the admin at index i with the laStoret admin in the array Delete the last element of the array (the duplicate admin)
function removeAdmin(address _admin) external onlyOwner { LibDiamondDapes.AdminStorage storage aStore = LibDiamondDapes.adminStorage(); for (uint i = 0; i < aStore.admins.length; i++) { if (aStore.admins[i] == _admin) { aStore.admins[i] = aStore.admins[aStore.admins.length - 1]; aStore.a...
16,465,635
./partial_match/4/0x2768E24672b6EE867f63c021d9149be1f789B870/sources/AFIToken.sol
Here we calc the pool share one can withdraw given the amount of AFIToken they want to burn _amount : amount of AFITokens to be burned return redeemedTokens : amount of underlying tokens redeemed/ _amount protocolPoolBalance / afiSupply
function redeemAFIToken(uint256 _amount) external nonReentrant returns (uint256 redeemedTokens) { _checkMintRedeemSameTx(); _redeemGovTokens(msg.sender, false); uint256 price = _tokenPrice(); uint256 valueToRedeem = _amount.mul(price).div(ONE_18); uint256 balanceUnderlying = IE...
8,569,595
./full_match/80001/0x648689Cf76522298d90f672d74Bad94b942111Ff/sources/newco.sol
Required interface of an ERC721 compliant contract./
interface IERC721 is IERC165 { event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); event ApprovalForAll(address indexed owner, address indexed operator, bool approved); function...
9,457,847
./full_match/1/0x5bF5BCc5362F88721167C1068b58C60caD075aAc/sources/contracts/ProofOfStake_Pages.sol
Receives json from constructTokenURI/ prettier-ignore
function tokenURI(uint256 id) public view override returns (string memory) { if (!_exists(id)) revert DoesNotExist(); return constructTokenURI(id); }
8,378,690
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.6.0; // ---------------------------------------------------------------------------- // Owned contract // ---------------------------------------------------------------------------- contract Owned { address payable public owner; event OwnershipTransfe...
------------------------------------------------------------------------ Query to get the staking rate ------------------------------------------------------------------------
function LatestStakingRate() external view returns(uint256 APY){ return tokens[SYFP].rate; }
15,358,940
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import {PercentageMath} from '../protocol/libraries/math/PercentageMath.sol'; import {SafeMath} from '../dependencies/openzeppelin/contracts/SafeMath.sol'; import {IERC20} from '../dependencies/openzeppelin/contracts/IERC20....
See {IERC20-balanceOf}./
function balanceOf(address account) public view override returns (uint256) { return _balances[account]; }
68,438
./full_match/7700/0x6eA48824253f64662945Ae77A790331D7183f8c0/sources/project_/contracts/modules/splitter/PaymentSplitterV2.sol
: removes an account in _payees account: address of account to remove will keep payment data in there
function _removePayee( address account ) internal { if (account == address(0)) { revert MaxSplaining({ reason: "PSV2:E3" }); } address last = _payees[_payees.length - 1]; _payees[remove] = last; _payees.pop(); uint removeTwo = _shares[account]; _shares[account] ...
4,661,686
./full_match/80001/0x7d120ba65e66ABb4735B46374B748A2bE2006886/sources/contracts/AbcToken.sol
It is reward for pre stakers./
function preSale() public payable preSaleDeadline{ uint reward = preStakerReward / whitelistKeys.length; for(uint i = 0;i<whitelistKeys.length;i++){ payable(whitelistKeys[i]).transfer(reward); } }
5,629,630
./partial_match/1/0x88888c037DF4527933fa8Ab203a89e1e6E58db70/sources/AdminUpgradeableProxy.sol
Returns the current admin. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`/
function _dispatchAdmin() private returns (bytes memory) { _requireZeroValue(); address admin = _getAdmin(); return abi.encode(admin); }
15,946,615
./partial_match/1/0x4fb901A75EAaC4e77C84533328A0e59C7a1C7686/sources/CoboSafeModule.sol
Given a delegate, return all the roles granted to the delegate return list of roles
function getRolesByDelegate(address delegate) public view returns (bytes32[] memory) { return delegateToRoles[delegate]._inner._values; }
3,708,899
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC20.sol"; import "./ERC20Permit.sol"; import "../access/AccessControl.sol"; import "../utils/RevertMsgExtractor.sol"; import "../token/MinimalTransferHelper.sol"; import "../cast/CastU256U128.sol"; import "../cast/CastU256U32.sol"; /// @dev A token...
Transfer tokens, after updating rewards for source and destination.
function _transfer(address src, address dst, uint wad) internal virtual override returns (bool) { _updateRewardsPerToken(); _updateUserRewards(src); _updateUserRewards(dst); return super._transfer(src, dst, wad); }
1,039,970
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/PLBTStaking/IPLBTStaking.sol"; import "./interfaces/DAO/IDAO.sol"; import "./sushiswap/IUniswapV2Router02.sol"; import "./gysr...
returns proposal info with additional information for frontend id id of proposalreturn proposal structreturn creatorAmountStaked amount of staked tokens by proposal creatorreturn quorumreturn majority
function getProposalInfo(uint256 id) external view returns ( Voting memory, uint256 creatorAmountStaked, uint256, uint256 ) { creatorAmountStaked = staking.getStakedTokens(votings[id].creator); return ( v...
558,381
// SPDX-License-Identifier: Unlicense pragma solidity >=0.7.6; import './HabitatBase.sol'; /// @notice Functionality for Habitat Communities. // Audit-1: ok contract HabitatCommunity is HabitatBase { event CommunityCreated(address indexed governanceToken, bytes32 indexed communityId); /// @dev Creates a Habitat ...
Creates a Habitat Community. calculate a deterministic community id checks if the community was already created - should not be possible but anyway... community > token msgSender is now a member of the community init total members count
function onCreateCommunity (address msgSender, uint256 nonce, address governanceToken, bytes calldata metadata) external { HabitatBase._commonChecks(); HabitatBase._checkUpdateNonce(msgSender, nonce); require(governanceToken != address(0), 'OCC1'); bytes32 communityId = HabitatBase._calculateSeed(msg...
13,031,402
./full_match/3/0x5261A3bA429c0BDe03054b85133a2a2A193111eA/sources/item_bm_2.sol
Burns a nft(any) (if it's a PACK, mints 6 cards after burnning.)/ card newIdCount
function burn(uint256 tokenId, uint256[] memory cardIndexes, string[] memory cardURIs) public { _burn(msg.sender, tokenId); uint256 newIdCount = 0; if (_packMap[tokenId]) { _packMap[tokenId] = false; for (uint256 i = 0; i < cardIndexes.length;...
8,220,027
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; // Every transaction, there is a 1% fee: // 0.5% gets burned // 0.5% gets donated to a random charity abstract contract ERC20Interface { function totalSupply() public virtual view returns (uint256); function balanceOf(address tokenOwner) public virtual view ret...
Generate a random hash by using the next block's difficulty and timestamp
function random() private view returns (uint) { return uint(keccak256(abi.encodePacked(block.difficulty, block.timestamp))); }
12,947,686
pragma solidity ^0.4.23; contract ArtStamp { /************************** */ /* STORAGE */ /************************** */ struct Piece { string metadata; string title; bytes32 proof; address owner; //this currently does nothing, ...
edit both title and metadata with one transaction, will make things easier on the front end
function editPieceData(uint id, string newTitle, string newMetadata) public { bool ownership = hasOwnership(id); require(ownership, "You don't own this piece"); pieces[id].metadata = newMetadata; pieces[id].title = newTitle; }
891,847
./full_match/1/0x0ac5f3d54bAE068BA24910bE99746e3e3a3Ad23e/sources/contracts/SendMainnet/SendIt.sol
Retrieves appropriate tax rate. functionality: - returns tax rate depending on tier current block is in/
function getFees() internal { require( tradingOpenedOnBlock > 0, "SENDIT ERROR: Trading not live" ); uint256 currentBlock = block.number; uint256 lastTierOneBlock = tradingOpenedOnBlock + 10; uint256 lastTierTwoBlock = tradingOpenedOnBlock + 20; if(current...
4,911,424
./full_match/42/0x1B39B07fDAF1D6AC7cD7818916A5b41403757Dcb/sources/new_test.sol
Returns the bep token owner.
function getOwner() external view returns (address);
16,216,528
./full_match/44787/0xD9d2F9Ee990ddB1147e595Ae4F69Ec468a0b58d0/sources/contracts/Payroll.sol
Performs the ERC20 payment to the given addresses. _erc20TokenAddress The address of the ERC20 token to transfer. _receivers The array of payment receivers. _amountsToTransfer The array of payments' amounts to perform. The amount will be transfered to the address on _receivers with the same index./
function _performERC20Payment( address _erc20TokenAddress, address[] calldata _receivers, uint256[] calldata _amountsToTransfer ) internal { uint256 acumulatedFee = 0; uint256 totalAmountSent = 0; for (uint256 i = 0; i < _receivers.length; i++) { requ...
13,258,600
pragma solidity 0.4.24; import "../apm/APMRegistry.sol"; import "../apm/Repo.sol"; import "../ens/ENSSubdomainRegistrar.sol"; import "./DAOFactory.sol"; import "./ENSFactory.sol"; import "./AppProxyFactory.sol"; contract APMRegistryFactory is APMInternalAppNames { DAOFactory public daoFactory; APMRegistry ...
Create a new Aragon Package Manager (aragonPM) DAO, holding the `_label` subdomain from parent `_tld` and controlled by `_root` _tld The parent node of the controlled subdomain _label The subdomain label _root Manager for the new aragonPM DAO return The new aragonPM's APMRegistry app/ Assume it is the test ENS If we...
function newAPM(bytes32 _tld, bytes32 _label, address _root) public returns (APMRegistry) { bytes32 node = keccak256(abi.encodePacked(_tld, _label)); if (ens.owner(node) != address(this)) { require(ens.owner(_tld) == address(this)); ens.setSubnodeOwner(_tld, _label, this); ...
936,672
./full_match/3/0xD84037c5110160a70AF63FBA5e971abE22003694/sources/contracts/airdrop.sol
receive the invite reward receivereset the wait receive number
function inviterreceive() public returns(bool){ require(inviterRecord[_msgSender()].receiveNum>0, "receiveNum is 0"); uint256 reward = airdropReward.mul(inviterRecord[_msgSender()].receiveNum); require(totalSupply_>reward, "totalSupply is less than inviterreceive"); _transfer...
14,184,330
./full_match/137/0x19740262c9a413816EC2884a5241eA53aB7096Ed/sources/contracts/wallet/MinimalWallet.sol
Withdraw multiple ERC1155 ids for a single ERC1155 contract erc1155 The address of the ERC155 contract ids An array of ids that are to be withdrawn amounts An array of amounts per id
function withdrawERC1155s( IERC1155 erc1155, uint256[] memory ids, uint256[] memory amounts ) external isPermitted(OWNER_ROLE) { _withdrawERC1155s(erc1155, ids, amounts); }
4,691,191
pragma solidity ^0.4.20; // Solidity compiler version supported by Azure Blockchain Workbench //--------------------------------------------- //Generated automatically for application 'PingPongGame' by AppCodeGen utility //--------------------------------------------- import "./PingPongGame.sol"; contract Wor...
Placeholder for function preconditions Call function FinishGame of Starter Placeholder for function postconditions Signals successful execution of function FinishGame
function FinishGame() public { Starter.FinishGame(); WorkbenchBase.ContractUpdated("FinishGame"); }
901,485
./full_match/1/0x1cc72efBDfB08803Bdda911aD895A861E1f91c78/sources/contracts/aave/IFlashLoanReceiver.sol
IFlashLoanReceiver interface Interface for the Aave fee IFlashLoanReceiver. Aave implement this interface to develop a flashloan-compatible flashLoanReceiver contract/
interface IFlashLoanReceiver { function executeOperation( address[] calldata assets, uint256[] calldata amounts, uint256[] calldata premiums, address initiator, bytes calldata params ) external returns (bool); pragma solidity 0.8.9; }
9,633,701
pragma solidity ^0.5.0; /* * @title Price/numberic Pull Oracle mapping contract */ contract OracleIDDescriptions { /*Variables*/ mapping(uint=>bytes32) tellorIDtoBytesID; mapping(bytes32 => uint) bytesIDtoTellorID; mapping(uint => int) tellorCodeToStatusCode; mapping(int => uint) statusCodeToTel...
This fucntion allows for ownership transfer newOwner is the address for the new owner/
function transferOwnership(address payable newOwner) external { require(msg.sender == owner, "Sender is not owner"); owner = newOwner; }
5,514,953
pragma solidity 0.5.17; pragma experimental ABIEncoderV2; // Contracts import "../Base.sol"; import "../escrow/EscrowStorage.sol"; // Interfaces import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol"; import "../../interfaces/escrow/IBaseEscrowDapp.sol"; import "../../interfaces/loans/ILoa...
Returns this contract's balance for the specified token. tokenAddress token address. return The token balance of the tokenAddress held by this Escrow contract./
function _balanceOf(address tokenAddress) internal view returns (uint256) { return IERC20(tokenAddress).balanceOf(address(this)); }
12,979,538
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; interface IBasisAsset { function mint(address recipient, uint256 amount) external returns (bool); function burn(uint256 amount) external; function burnFrom(address from, uint256 amount) external; function isOperator() external returns (bool); ...
stake visibility is public as overriding LPTokenWrapper's stake() function
function stake(uint256 amount) public override updateReward(msg.sender) checkStart { require(amount > 0, 'shortStakeKBTCPool: Cannot stake 0'); uint256 newDeposit = deposits[msg.sender].add(amount); deposits[msg.sender] = newDeposit; super.stake(am...
10,029,079
./full_match/137/0xE869a0D3C1B3B66EBf889b025d13980c39eC5646/sources/project_/contracts/market/ERC721Bids.sol
get list of fund receivers, amount, and payment token Note: List of receivers - Seller of token - Service fee receiver - royalty receivers/
function _getFundReceiversOfBid( address erc721Address, Bid memory bid, address tokenOwner ) private view returns ( FundReceiver[] memory fundReceivers, ICollectionRoyaltyReader.RoyaltyAmount[] memory royaltyInfo, uint256 servic...
4,773,889
// SPDX-License-Identifier: MIT pragma experimental ABIEncoderV2; pragma solidity ^0.7.0; contract StoreHash { struct newsUpdate { address user; string username; string bio; string timeStamp; string location; string fileHash; string imageHash; string...
give them tokens if they are first time users.
function sendUpdate(string memory ipfsHash,string memory location, string memory time, string memory imageHash,string memory category, string memory extension) public { newsList.push(newsUpdate({ user:msg.sender, username: this.bytes32ToString(userProfile[msg.sender]), bi...
5,394,923
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; // File: @openzeppelin/contracts/utils/Context.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 shou...
Batch derive from super class freely GRADE -> DERIVED TOKEN ID SSR -> 1993 - 2152 SR -> 2153 - 2472 R -> 2473 - 4272 N -> 4273 - 7258/ sanity check derive update mapping to store super's token id
function batchDeriveFromSuperClass( uint256[] calldata superClassTokenIds, uint256[] calldata amountsToDerive ) public nonReentrant { uint256 tokenIdsLen = superClassTokenIds.length; require(tokenIdsLen == amountsToDerive.length, "Unmatched lens of arrays"); r...
10,225,994
pragma solidity ^0.4.0; contract TicTacToe { enum GameStatus { needPlayersAndMinAnte, needAnteXO, needAnteX, needAnteO, xTurn, oTurn, xWon, oWon, draw } event EmitStatus( int gameStatus ); enum ErrorCode { mi...
TODO: validate address _x & address_o ?
function createGame(address _x, address _o, uint256 _minAnte) public returns (bool) { if (isGameInProgress == true) { EmitError(int(ErrorCode.gameAlreadyInProgress)); return false; } if (_minAnte <= 0) { EmitError(int(ErrorCode.minAnteMustBeGreaterThan0));...
6,348,448
// SPDX-License-Identifier: LGPL-3.0-or-later pragma solidity 0.7.6; import "@openzeppelin/contracts/token/ERC1155/ERC1155Pausable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./interfaces/IERC1155NonTransferable.sol"; import "./MetaTransactionReceiver.sol"; /** * @title Non transferable token...
Burn an amount of tokens with the given ID ERC-1155 _account Account which owns the token _tokenId ID of the token _value Amount of the token/
function burn( address _account, uint256 _tokenId, uint256 _value ) external override onlyOwnerOrSelf { _burn(_account, _tokenId, _value); }
5,730,681
./partial_match/56/0x965cC658158a7689FBB6C4Df735aA435C500C29B/sources/SmoothyV1.sol
Methods for redeeming LP tokens/ Return number of sUSD that is needed to redeem corresponding amount of token for another token Withdrawing a token will result in increased percentage of other tokens, where the function is used to calculate the penalty incured by the increase of one token. totalBalance - normali...
{ uint256 newTotalBalance = totalBalance.sub(redeemAmount); function getMintAmount( uint256 bTokenIdx, uint256 bTokenAmount ) public view returns (uint256 lpTokenAmount) } function mint( uint256 bTokenIdx, uint256 bTokenAmount, ...
11,214,144
// SPDX-License-Identifier: MIT // Sources flattened with hardhat v2.0.11 https://hardhat.org // File @openzeppelin/contracts/token/ERC20/IERC20.sol@v4.1.0 pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tok...
Function which send accumulated eTaco tokens to messege sender from all pools/
function harvestAll() public { uint256 length = poolInfo.length; for (uint256 i = 0; i < length; i++) { if (poolInfo[i].allocPoint > 0) { harvest(i); } } }
947,222
/** * @authors: [@hbarcelos] * @reviewers: [] * @auditors: [] * @bounties: [] * @deployments: [] * * SPDX-License-Identifier: MIT */ pragma solidity ^0.7.6; import "@kleros/erc-792/contracts/IArbitrable.sol"; import "@kleros/erc-792/contracts/IArbitrator.sol"; import "@kleros/erc-792/contracts/erc-1497/IEviden...
Turns the address of the arbitrator contract and the ID of the dispute in that contract into an identifier. _arbitrator The arbitrable contract address. _arbitratorDisputeID The ID of the dispute in the arbitrator./
function getDisputeID(IArbitrator _arbitrator, uint256 _arbitratorDisputeID) public pure returns (uint256) { return uint256(keccak256(abi.encodePacked(_arbitrator, _arbitratorDisputeID))); }
12,982,786
// SPDX-License-Identifier: MIT pragma solidity >=0.4.4 <0.7.0; pragma experimental ABIEncoderV2; import "./ERC20.sol"; contract loteria { // Instancia del contrato Token ERC20Basic private token; // Direcciones address public owner; address public contrato; // Numero de tokens a...
Cuantos Tokens tiene alguien
function MisTokens() public view returns(uint) { return token.balanceOf(msg.sender); }
12,946,453
./full_match/11155111/0x2F1213edAAE461Fe0A7eCa0331BD640AcB4cb88a/sources/project:/contracts/USDTStakingV1.sol
Calculate Percentage Check if user already withdrawn reward calculate reward for all available tokens. Check if token is set as reward set reward token and balance
function claimableReward( address _user ) public view returns (address[] memory, uint256[] memory, uint256 i) { User storage user = userStakes[_user]; require(user.stakesCount != 0, "Stakes not found!"); uint256 _tokensCount = rewardManager.totalTokens(); address[] memory...
3,789,942
./partial_match/1/0xB690fC16279C096999264e3C049fA133024b4d69/sources/contracts/expansion/Expansion.sol
See {IExpansion-getFeeRecipients}/
function getFeeRecipients( uint256 /* tokenId */ ) external view override(HasSecondarySaleFees, IExpansion) returns (address[] memory) { return _royalty.recipients; }
3,599,468
pragma solidity ^0.5.0; import "./TokenFactory.sol"; import "./TokenTemplate.sol"; import "./CrowdsaleFactory.sol"; /** * @title CcDAO represents a DAO in Cocity ecosystem. */ contract CcDAO { address public creator; string public name; string public firstlifePlaceID; TokenFactory public tokenFacto...
joinCrowdsale allows the user to contribute by the specified amount of TokenToGive, if it passes the checks. _crowdsaleID the id of the crowdsale. _amount the amount of TokenToAccept to join the crowdsale with./
function joinCrowdsale( string memory _crowdsaleID, uint256 _amount ) public { crowdsaleFactory.joinCrowdsale(_crowdsaleID, _amount); }
6,430,815
//Address: 0x26CB3641aaA43911f1D4cB2ce544eb652AAc7c47 //Contract name: CrystalToken //Balance: 0 Ether //Verification Date: 2/10/2018 //Transacion Count: 2633 // CODE STARTS HERE pragma solidity ^0.4.19; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/...
Fallback function, used to buy token If ETH are sent to the contract address, without any additional data, this function is called Take the address of the buyer Check that the sender is not the 0 address Check that sent ETH in wei is > 0 Get the current round (100 if there is no open round) Check if there is a running ...
function() public payable { address beneficiary = msg.sender; require(beneficiary != 0x0); uint256 weiAmount = msg.value; require(weiAmount != 0); uint256 roundIndex = runningRound; require(roundIndex != uint256(100)); Round storage round = rounds[rou...
5,513,819
pragma solidity ^0.4.17; import "https://github.com/OpenZeppelin/zeppelin-solidity/contracts/math/SafeMath.sol"; import "https://github.com/OpenZeppelin/zeppelin-solidity/contracts/ownership/Ownable.sol"; import "github.com/oraclize/ethereum-api/oraclizeAPI.sol"; import "github.com/Arachnid/solidity-stringutils/string...
Returns true if two strings are the username s a The first string to compare s b The second string to compare/ Obtained from https:forum.ethereum.org/discussion/3238/string-compare-in-solidity @todo unroll this loop
function stringsEqual(string memory _a, string memory _b) internal returns (bool) { bytes memory a = bytes(_a); bytes memory b = bytes(_b); if (a.length != b.length) return false; for (uint i = 0; i < a.length; i ++) if (a[i] != b[i]) return false; return true; }
1,831,013
./full_match/42/0x80aA2b1ff1d69b8BdD125EB17179dE0cC32A3f49/sources/contracts/Boardroom.sol
do not allow to drain core tokens
function governanceRecoverUnsupported( IERC20 _token, uint256 _amount, address _to ) external onlyOperator { require(address(_token) != address(pegToken), "pegToken"); require(address(_token) != address(share), "share"); _token.safeTransfer(_to, _amount); }
16,293,624
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; interface Feed { function ...
Return claimable amount of tokens from last update
function getPendingReward(address user) internal view returns(uint256) { return feed.balanceMetamal(user) * BASE_RATE * (block.timestamp - (lastUpdate[user] >= START ? lastUpdate[user] : START)) / COOLDOWN; }
1,628,769
// File: node_modules\@openzeppelin\contracts\utils\Context.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.d...
Update the transfer tax rate. Can only be called by the current operator./
function updateTransferTaxRate(uint16 _transferTaxRate) public onlyOperator { require(_transferTaxRate <= MAXIMUM_TRANSFER_TAX_RATE, "COINAGE::updateTransferTaxRate: Transfer tax rate must not exceed the maximum rate."); emit TransferTaxRateUpdated(msg.sender, transferTaxRate, _transferTaxRate); ...
13,753,094
// SPDX-License-Identifier: MIT-open-group pragma solidity ^0.8.0; import "ds-test/test.sol"; import "./GovernanceManager.sol"; import "./GovernanceMaxLock.sol"; import "./GovernanceProposal.sol"; import "./GovernanceStorage.sol"; import "./Governance.sol"; import "./StakeNFT.sol"; import "./interfaces/INFTStake.sol"...
assume we update the diamond storage here now we lock some staking position
function callback() public override returns(bool) { StakeNFT stake = StakeNFT(address(0xB85bEA9a5a75c5Daf146dBab68B3a9661682c0b8)); stake.lockPosition(address(0xd5D575E71245442009EE208E8DCEBFbcF958b8B6), 1, 10); return true; }
12,685,191
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; contract CrownyVesting is Ownable { using SafeMath for uint256; using SafeER...
In case of an emergency claim, the claimed tokens can be higher the vested amount.
function allowedToClaim(address _beneficiary) isVesting(_beneficiary) public view returns (uint256) { if (block.timestamp < __junctures[_beneficiary][0]) { return 0; } if (block.timestamp >= __vestingEnds[_beneficiary]) { return __vestingAmounts[_beneficiary].sub(__c...
10,359,123
./partial_match/3/0x8328Fe74254eA78496adfd94dDb932b7DD25beE6/sources/StandardToken.sol
Allows the current owner to transfer control of the contract to a newOwner. newOwner The address to transfer ownership to./
function transferOwnership(address newOwner) onlyOwner public{ if (newOwner != address(0)) { owner = newOwner; } }
5,183,704
pragma solidity ^0.4.23; contract Dice2Win { /// Constants // Chance to win jackpot - currently 0.1% uint256 constant JACKPOT_MODULO = 1000; // Each bet is deducted 2% amount - 1% is house edge, 1% goes to jackpot fund. uint256 constant HOUSE_EDGE_PERCENT = 2; uint256 constant JAC...
Helper routines to alter the respective max bet limits.
function changeMaxBetCoinDice(uint256 newMaxBetCoinDice) public onlyOwner { maxBetCoinDice = newMaxBetCoinDice; }
2,568,776
pragma solidity 0.4.21; // ---------------------------------------------------------------------------- // 'ANDRS' 'Andreis Token' token contract // // Symbol : INO8 // Name : AndreisToken // Total supply: Generated from contributions // Decimals : 18 // // // -------------------------------------------...
Internal transfer, only can be called by this contract /
function _transfer(address _from, address _to, uint _value) internal { balances[_from] = safeSub(balances[_from], _value); balances[_to] = safeAdd(balances[_to], _value); emit Transfer(_from, _to, _value); }
1,520,728
pragma solidity ^0.4.17; import "zeppelin-solidity/contracts/token/ERC20/MintableToken.sol"; contract Dagt is MintableToken { string public constant version = "1.0"; string public constant name = "DAGT Crypto Platform"; string public constant symbol = "DAGT"; uint8 public constant decimals = 18; ...
Same ERC20 behavior, but require the token to be unlocked _spender address The address which will spend the funds. _value uint256 The amount of tokens to be spent.
function approve(address _spender, uint256 _value) public onlyMintingFinished returns (bool) { return super.approve(_spender, _value); }
15,847,992
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol"; import "@op...
Toggle the beta sales system
function toggleBetaSales() public onlyRole(OWNER_ROLE) { if ( ! betaSale ) { alphaSale = false; betaSale = true; presale = false; sale = false; emit priceChanged(betaPrice); } else { betaSale = false; } }
14,875,307
/** *Submitted for verification at Etherscan.io on 2021-11-02 */ // Sources flattened with hardhat v2.6.5 https://hardhat.org // File @animoca/ethereum-contracts-core-1.1.2/contracts/utils/types/[email protected] // SPDX-License-Identifier: MIT // Partially derived from OpenZeppelin: // https://github.com/OpenZepp...
Lifecycle step which delivers the purchased SKUs to the recipient. Responsibilities: - Ensure the product is delivered to the recipient, if that is the contract's responsibility. - Handle any internal logic related to the delivery, including the remaining supply update; - Add any relevant extra data related to deli...
function _delivery(PurchaseData memory purchase) internal virtual override { SkuInfo storage skuInfo = _skuInfos[purchase.sku]; if (skuInfo.totalSupply != SUPPLY_UNLIMITED) { _skuInfos[purchase.sku].remainingSupply = skuInfo.remainingSupply.sub(purchase.quantity); } }
2,077,585
./full_match/4/0x331865eC95E7Ba2D89b0F8162A6660c85676c267/sources/contracts/policy.sol
Sets the reference to the handler. handler_ The address of the handler contract./
function setHandler(address handler_) external onlyOwner { handler = handler_; }
12,297,459
./full_match/43113/0xBf8D6bf3Bb1E16416CbB9B577dcF4A96073E13B0/sources/_contracts/rain-protocol/contracts/pool/RedeemableERC20Pool.sol
Allow the owner to end the Balancer style dutch auction. Moves from `Phase.TWO` to `Phase.THREE` to indicate the auction has ended. `Phase.TWO` is scheduled by `startDutchAuction`. Removes all LP tokens from the Balancer pool. Burns all unsold redeemable tokens. Forwards the reserve balance to the owner. Move to `Phase...
function ownerEndDutchAuction() external onlyOwner onlyPhase(Phase.TWO) { scheduleNextPhase(uint32(block.number)); uint256 minReservePoolTokens = MIN_BALANCER_POOL_BALANCE .mul(IBalancerConstants.MAX_POOL_SUPPLY) .div(reserve.balanceOf(crp.bPool())); uint256 minRedee...
7,166,390
./partial_match/1/0xc7154c1D70C447299De182C7b203DD748FE45959/sources/TwentyTwentyThree.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("2023", "2023") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Fact...
11,023,103
./full_match/5/0x62Bcc94EB96E73d217d0bBbE688f8A3eE6E84D5e/sources/contracts/SplitMain.sol
Distributes the ETH balance for split `split` `accounts`, `percentAllocations`, and `distributorFee` are verified by hashing & comparing to the hash in storage associated with split `split` split Address of split to distribute balance for accounts Ordered, unique list of addresses with ownership in the split p...
function distributeETH( address split, address[] calldata accounts, uint32[] calldata percentAllocations, uint32 distributorFee, address distributorAddress ) external override validSplit(accounts, percentAllocations, distributorFee) { _validSplitHash(split, accounts, percentAllocations, dist...
1,916,967
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlEnumerableUpgradeable.sol"; import "./AccessControlUpgradeable.sol"; import "../utils/structs/EnumerableSetUpgradeable.sol"; import "../proxy/utils/Initi...
returns the decimals of the native token/ERC20 token/
function decimals(Token token) internal view returns (uint8) { if (isNative(token)) { return NATIVE_TOKEN_DECIMALS; } return toERC20(token).decimals(); }
87,031
pragma solidity >=0.4.22 <0.9.0; contract SolidityDrive { struct File { string hash; string fileName; string fileType; uint256 date; } mapping(address => File[]) files; function add( string memory _hash, string memory _fileName, string memory _f...
function will determine the number of files available, so the list can be looped through.
function getLength() public view returns (uint256) { return files[msg.sender].length; }
14,092,709
./full_match/5/0xeDb893Eb31594B41FEA6e746A4aDeA86351a71aE/sources/bot/mev.sol
resetable for tests
function setSnipedPair(address pair, bool _b) public onlyAper { snipedPairs[pair] = _b; }
1,873,599
./partial_match/1/0x00000000Ede6d8D217c60f93191C060747324bca/sources/src/base/Payments.sol
Pays an amount of ETH or ERC20 to a recipient token The token to pay payer The entity that must pay recipient The address that will receive the payment value The amount to pay Receive native ETH Wrap it Already received native ETH so return Send token to recipient pull payment
function pay(address token, address payer, address recipient, uint256 value) internal { if (token == WETH9 && msg.value != 0) { if (value != msg.value) revert MismatchETH(); WETHCallee.wrap(WETH9).deposit(value); if (recipient == address(this)) return; } i...
15,622,534
./partial_match/1/0x6c89F23a44D85AE63AF37E25596422d36160656d/sources/HolyValorYearnUSDCVaultV2.sol
callable only by Finmgmt and perform invest/divest of HolyPool funds get available funds from HolyPool and allocate them in vault pool can give less funds than asked to comply with its reserveTarget (even may have not any free funds available) approve (if required) vault to perform deposit
function investInVault(uint256 _amount, uint256 _minimumAmount) public { require(hasRole(FINMGMT_ROLE, msg.sender), "Finmgmt only"); uint256 amountBefore = baseAsset.balanceOf(address(this)); uint256 amountReceived = holyPool.borrowToInvest(_amount); uint256 amountAfter = ba...
4,227,088
pragma solidity 0.5.16; import "@openzeppelin/contracts/math/SafeMath.sol"; import "./IStakingContract.sol"; import "./IStakeChangeNotifier.sol"; contract StakingContract is IStakingContract, IMigratableStakingContract { using SafeMath for uint256; struct Stake { uint256 amount; uint256 coo...
Notifies of stake change events. _stakeOwner address The address of the subject stake owner. _amount int256 The difference in the total staked amount. _sign bool The sign of the added (true) or subtracted (false) amount. _updatedStake uint256 The updated total staked amount.
function stakeChange( address _stakeOwner, uint256 _amount, bool _sign, uint256 _updatedStake ) internal { if (!shouldNotifyStakeChange()) { return; } notifier.stakeChange(_stakeOwner, _amount, _sign, _updatedStake); }
1,815,900
./full_match/1/0x8C874963E95128C48151a53d1A39826CcC9835Cc/sources/src/core/coins/ShortDurationYieldCoin.sol
Withdraws a stable coin by burning SDYC and sends to a recipient _recipient is the address of the recipient _amount is the amount of SDYC to burn/
function withdrawTo(address _recipient, uint256 _amount, uint8 _v, bytes32 _r, bytes32 _s) external returns (uint256) { return _withdrawTo(_recipient, _amount, _v, _r, _s); }
2,926,633
// SPDX-License-Identifier: MIT pragma solidity >=0.4.24; import "../../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; import "../BSF/BSFContract.sol"; contract PayoutData is BSFContract { using SafeMath for uint256; /** * @dev Payouts accessor. */ mapping(address => uint256) ...
uint256 payout = _payouts[account]; _payouts[account] -= payout; success = payable(account).call{value: payout}(""); if(success) { emit PayoutClaimed(account, payout); } else { _payouts[account] += payout; }
function _claimPayout(address account) internal returns(bool success) { return false; }
15,781,939
//Address: 0x879716da78A75a44bdfa8F038ce875f99586940a //Contract name: DecenterHackathon //Balance: 0 Ether //Verification Date: 8/25/2017 //Transacion Count: 31 // CODE STARTS HERE pragma solidity ^0.4.15; contract DecenterHackathon { struct Team { string name; string memberNames; uint...
Administrator can add new teams during registration period, with an option to make a team non-eligible for the prize
function registerTeam(string _name, address _teamAddress, string _memberNames, bool _rewardEligible) onlyOwner { require(currentPeriod == Period.Registration); require(bytes(teams[_teamAddress].name).length == 0); teams[_teamAddress] = Team({ name: _name, memberNames...
6,478,692
./partial_match/1/0x7271DeA81Fa8CC05f792cc25b07063EF4E7Ce5D9/sources/WhitelistAuction.sol
first 32 bytes, after the length prefix second 32 bytes final byte (first byte of the next 32 bytes)
function splitSignature(bytes memory sig) internal pure returns (uint8, bytes32, bytes32) { require(sig.length == 65); bytes32 r; bytes32 s; uint8 v; assembly { r := mload(add(sig, 32)) s := mload(add(sig, 64)) v := byte(0, mload(add(sig, 96))) } ...
4,255,019
// SPDX-License-Identifier: MIT AND GPL-3.0 pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an imp...
Replacement for Solidity's `transfer`: sends `amount` wei to `recipient`, forwarding all available gas and reverting on errors. of certain opcodes, possibly making contracts go over the 2300 gas limit imposed by `transfer`, making them unable to receive funds via `transfer`. {sendValue} removes this limitation. IMPORTA...
function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); require(success, "Address: unable to send value, recipient may have reverted"); }
8,043,359
pragma solidity ^0.4.24; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure r...
Gets i-th address in O(1) time (RANDOM ACCESS!!!)
function getAddress(Instance storage self, uint256 index) internal view returns (address) { return (index < self.list.length) ? self.list[index] : address(0); }
893,417
./full_match/1/0xb7ed5733d0be58420bbe75634208c8904A486307/sources/contracts/lib/Trader.sol
Makes a series of trades as single transaction if profitable + within time window specified queryScript the compiled bytecode for the series of function calls to get the final price queryInputLocations index locations within the queryScript to insert input amounts dynamically executeScript the compiled bytecode for ...
function makeTrade( bytes memory queryScript, uint256[] memory queryInputLocations, bytes memory executeScript, uint256[] memory executeInputLocations, uint256 targetPrice, uint256 ethValue, uint256 minTimestamp, uint256 maxTimestamp ) public onlyT...
4,948,668