file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
/** *Submitted for verification at Etherscan.io on 2021-09-07 */ pragma solidity ^0.5.16; // ---------------------------------------------------------------------------- // ERC Token Standard #20 Interface // // ---------------------------------------------------------------------------- contract ERC20Interface { ...
See {BEP20-approve}. Requirements: - `spender` cannot be the zero address./
function approve(address spender, uint256 amount) public returns (bool) { require(spender != address(0), "BEP20: spender cannot be the zero address"); _approve(_msgSender(), spender, amount); return true; }
6,709,265
./full_match/1/0xD031d03E447f5873cbD44BdB75b34189829BBb93/sources/contracts/RebelMaxNFT.sol
Free for whitelisted
function reserveInPrivateSale(uint256 _amount) public nonReentrant { require(privateSale, "Private sale must be active"); require(_privateReserved[msg.sender] == 0, "Already reserved"); require(totalReserved+_amount <= (TOTAL_TOKEN_LIMIT.sub(2)), "Reserve would exceeed allocated limit."); require(_pr...
9,636,039
pragma solidity ^0.4.23; import "./ERC721.sol"; import "./ERC721BasicToken.sol"; /** * @title Full ERC721 Token * This implementation includes all the required and some optional functionality of the ERC721 standard * Moreover, it includes approve all functionality using operator terminology * @dev see https://git...
require(msg.value <= latestSelfAssesedValue,"You tried to send more than the value of the asset. Transaction reverted.");internal payTax function that applies sent value minus acquisition price to taxestest:
function acquireToken (uint256 _tokenId) public payable returns (bool) { uint256 tokenIndex = allTokensIndex[_tokenId]; uint256 latestSelfAssesedValue = harlics[tokenIndex].harlicValue; uint256 taxPayment = SafeMath.sub(msg.value, acquisitionPrice); address oldOwner = ownerOf(_tok...
12,887,891
// SPDX-License-Identifier: MIT // Project Sharing by Alpha Serpentis Developments - https://github.com/Alpha-Serpentis-Developments // Written by Amethyst C. pragma solidity ^0.7.4; import "../ERC677/ERC677Receiver.sol"; import "../ERC677/ERC677.sol"; import "../Module/Module.sol"; import "../../openzeppelin/math/S...
Approve or deny the transaction
{ require( multiSig, "approveTransfer(): Can only be used if multi-sig mode is enabled!" ); TransferRequest storage transferReq = pendingOutbound[_index]; function approveTransfer( bytes32 _index, bool _approve ) public ...
5,448,564
pragma solidity ^0.4.18; /** * Math operations with safety checks */ 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 returns (uint) { // assert(b > 0); // Solidity...
after month admin deposit ETH to ETH Pool
function depositEthPool(uint _roundIndex) payable public onlyEscrow { require(msg.value > 0 && round[_roundIndex].isCloseEthPool == false && round[_roundIndex].isOpen == false); if (msg.value > 0) { round[_roundIndex].ethBalance = round[_roundIndex].ethBalance.add(msg...
7,873,936
pragma solidity ^0.4.18; contract Ticket { string _brand; address _owner; // constructor() public { _brand = "火车"; // msg.sender 是当前合约的创建者 _owner = msg.sender; } function setBrand(string brand) public { _brand = brand; } // 如果返回值当中有状态的变量值需要使用 constant ...
如果只是纯粹的放回一个值,例如:固定的值,
function sayHello() pure public returns (string) { return "Hello World"; }
15,786,636
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; pragma experimental ABIEncoderV2; import "./interfaces/IDappState.sol"; import "./DappLib.sol"; import "./interfaces/IERC1155.sol"; import "./interfaces/IERC1155Receiver.sol"; import "./interfaces/IERC1155MetadataURI.sol"; import "./imports/custom_nft/Address.sol...
a function that writes state from an external contract. It and "incrementCounter" and "getCounter" functions can (should?) be deleted. This is an EXAMPLE function that illustrates how functions in this contract can be called securely from another contract to WRITE state data. Using the Contract Access block ...
function incrementCounter ( uint256 increment ) external override { require(increment > 0 && increment < 10, "Invalid increment value"); }
7,214,184
./full_match/44787/0xFBf4Fa7119Ebd69c8786E628acD76FE21C3F0903/sources/contracts/ERC721/MarketV2.sol
Purchase tokens baed on the {numTokens} specified for lazy minted tokens. groupTokenId The ID of the token that's being purchased numTokens Amount of tokens to be purchased
function purchaseTokenLazy(uint256 groupTokenId, uint256 numTokens) public payable nonReentrant { address minter = _groupTokenInfoList[groupTokenId].minter; uint256 tokenPrice = _groupTokenInfoList[groupTokenId].price; uint256 maxAmount = _groupTokenInfoList[group...
13,258,726
pragma solidity 0.4.15; /// @dev The interface a contract MUST implement if it is the delegate of some (other) interface for any address other than itself. interface AIRDelegateInterface { /// @notice Indicates whether the contract implements the interface `interfaceHash` for the address `target` or not. /// @...
Sets the contract which implements a specific interface for an address. Only the manager defined for that address can set it. (Each address is the manager for itself until it sets a new manager.) target Address to define the interface for. interfaceHash sha3 hash of the name of the interface as a string.
function setInterfaceDelegate(address target, bytes32 interfaceHash, address delegate) public canManage(target) { if (delegate != address(0) && delegate != msg.sender) require(AIRDelegateInterface(delegate).isDelegateFor(target, interfaceHash) == AIR_ACCEPT_MAGIC); interfaces[target][int...
1,754,349
// SPDX-License-Identifier: MIT pragma solidity >=0.7.2; pragma experimental ABIEncoderV2; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/token/ERC20/ERC20.sol'; import '@openzeppelin/contracts/utils/ReentrancyGuard.sol'; import { SafeMath } from '@openzeppelin/contracts/math/Safe...
return how many shares you can get if you deposit {_amount} sdToken _amount amount of token depositing/
function getSharesByDepositAmount(uint256 _amount) external view returns (uint256) { return _getSharesByDepositAmount(_amount, totalStakedaoAsset()); }
1,843,989
./full_match/100/0x0995e02276c2c5D1712a891731998Dbb43a590fC/sources/contracts/Core.sol
Maintainer: Set `newTimestamp` as new condition `conditionId` deadline. conditionId the match or game ID newTimestamp new condition start time/
function shift(uint256 conditionId, uint64 newTimestamp) external onlyMaintainer { if (conditions[conditionId].timestamp == 0) revert ConditionNotExists(); conditions[conditionId].timestamp = newTimestamp; emit ConditionShifted(conditionId, newTimestamp); }
14,288,020
// SPDX-License-Identifier: MIT OR Apache-2.0 pragma solidity >=0.6.11; // ============ Internal Imports ============ import {BridgeRouter} from "./BridgeRouter.sol"; import {IWeth} from "../../interfaces/bridge/IWeth.sol"; // ============ External Imports ============ import {TypeCasts} from "@celo-org/optics-sol/con...
Remove the replica from the two-way mappings _replica replica to un-enroll/
function _unenrollReplica(address _replica) internal { uint32 _currentDomain = replicaToDomain[_replica]; domainToReplica[_currentDomain] = address(0); replicaToDomain[_replica] = 0; emit ReplicaUnenrolled(_currentDomain, _replica); }
1,209,135
./partial_match/4/0x2F674500a367583D6Aaef312478a7cC1941a1977/sources/FECORE.sol
Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role./
function getRoleMemberCount(bytes32 role) public view returns (uint256) { return _roles[role].members.length(); }
8,664,338
./full_match/1/0x8940fd30496bD58De8f574919f3A0382c378D842/sources/contracts/APWineAirdrop.sol
Get the next epoch start
function getNextEpochStart() external view returns (uint256) { uint256 epoch = getCurrentEpoch(); uint256 gracePeriodEnd = getGracePeriodEnd(); return epoch == 0 ? gracePeriodEnd : gracePeriodEnd.add(epochDuration.mul(epoch)); }
9,801,217
./partial_match/42/0x1e01587409a3054CE02B7A7512616BA7dCe71a51/sources/InsuranceFund.sol
withdraw token to caller _amount the amount of quoteToken caller want to withdraw/
function withdraw(Decimal.decimal calldata _amount) external override nonReentrant returns (Decimal.decimal memory badDebt) { require(beneficiary == _msgSender(), "caller is not beneficiary"); IERC20Upgradeable quoteToken = exchange.quoteAsset(); Decimal....
3,472,775
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "../IController.sol"; import "../IConverter.sol"; import "../IHarvester.sol"; import "....
Returns the best (optimistic) strategy for funds to be withdrawn from Since Solidity doesn't support dynamic arrays in memory, the returned arrays from this function will always be the same length as the amount of strategies for a token. Check that _strategies[i] != address(0) when consuming to know when to break out ...
function getBestStrategyWithdraw( address _token, uint256 _amount ) public view returns ( address[] memory _strategies, uint256[] memory _amounts ) { uint256 k = tokenStrategies[_token].strategies.length; _strategies = new address[](k); _amounts = new ...
5,471,945
./partial_match/1/0xD3faD4C5e4D24646F90A0c8876314b17243E9460/sources/contracts/KounPass.sol
Set the state machine mint phase Use restricted to contract owner _mintPhase New mint phase, 0 = INACTIVE / 1 = ALLOWLIST_MINT / 2 = PUBLIC_MINT / 3 = SOLD_OUT/
function setMintPhase(MintPhase _mintPhase) external onlyOwner { mintPhase = _mintPhase; }
2,677,009
./partial_match/1/0x5F0B23Ba4Dcb8e0Bb5d81ceE1dB2de2B13E264a1/sources/InDefiEcoPreMining.sol
dfTokenizedStrategy.burnTokens(amount, 0, 0, flashloanFromAddress);
function withdrawToken(IToken token, uint256 amount, address receiver) internal { if (receiver != address(this)) { if (token.universalBalanceOf(address(this)) >= amount) { token.universalTransfer(receiver, amount); return; } } if (addr...
3,596,391
// File: REMIX_FILE_SYNC/openzeppelin-solidity/contracts/math/SafeMath.sol pragma solidity ^0.4.21; /** * @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) intern...
Checks to ensure that the token owner has approved the escrow contract/
function _approvedForEscrow(address _seller, uint256 _tokenId, address _tokenContractAddress) internal view returns (bool) { ERC721Safe tokenContract = _getTokenContract(_tokenContractAddress); return (tokenContract.isApprovedForAll(_seller, this) || tokenContract.getApproved(_token...
890,416
pragma solidity >=0.4.22 <0.6.0; pragma experimental ABIEncoderV2; import "./RoleManager.sol"; import "./TokenManager.sol"; //This contracts handles the trip logic and acts as a platform contract owning the TokenManager contract and the RoleManager contract contract PlatformContract { offer[] tripArray; //each tr...
use DateTime contract before to convert desired Date to uint epoch
function offerTrip(uint256 startTime, uint256 endTime, uint64 latpickupLocation, uint64 longpickupLocation, uint256 price, uint64[10] memory latPolygons, uint64[10] memory longPolygons, uint256 maxReservedAmount, uint8 objectType, string memory model ) public onlyVerifiedLessor(objectType) isNotBlockedLessor ...
5,489,698
pragma solidity 0.6.12; // SPDX-License-Identifier: BSD-3-Clause /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; ...
=============================ADMINISTRATIVE FUNCTIONS ==================================/
function setTokenAddresses(address _tokenAddr) public onlyOwner returns(bool){ require(_tokenAddr != address(0), "Invalid addresses format are not supported"); tokenAddress = _tokenAddr; }
13,808,880
pragma solidity ^0.4.23; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a,...
Allows the current owner to set an authorization. addressAuthorized The address to change authorization./
function setAuthorized(address addressAuthorized, bool authorization) onlyOwner public { emit AuthorizationSet(addressAuthorized, authorization); authorized[addressAuthorized] = authorization; }
12,976,921
./full_match/122/0xCbc6Ce8C3bc4E5D7EB0fe7440B7b0f58C2884D3B/sources/contracts/LiquidStakingPool.sol
Returns the current number of validators on list/
function getValidatorsLength() public view returns (uint256) { address[] memory validatorList = getValidators(); return validatorList.length; }
16,366,552
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view re...
Deposit to Idle (mint idle tokens) amount Amount to deposit slippages Slippages array return Minted idle amount/ deposit underlying NOTE: Middle Flag is unused so can be anything
function _deposit(uint128 amount, uint256[] memory slippages) internal override returns(uint128) { (bool isDeposit, uint256 slippage) = _getSlippageAction(slippages[0]); require(isDeposit, "IdleStrategy::_deposit: Withdraw slippage provided"); underlying.safeApprove(address(idleToken), amou...
1,489,471
//Address: 0xd223e8aed64bf8f2031e1c7b97bf391f1bf75451 //Contract name: PetitionFactory //Balance: 0.002 Ether //Verification Date: 5/31/2018 //Transacion Count: 5 // CODE STARTS HERE pragma solidity 0.4.21; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a,...
we do if instead of require so we can call it throughout the smart contract. This way if someone signs, creates a petition, etc. It can ding to the next dividend pool.
function endDividendPool() public { if (now > dividendPoolEnds) { availableForWithdraw = availableForWithdraw + (claimableDividendPool - claimedThisPool); claimableDividendPool = currentDividendPool; claimedThisPool = 0; currentDividendPool = 0; ...
14,040,052
//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...
Give the ordered end blocks of stakeContracts in this vault return the ordered end blocks
function orderedEndBlocksAll() external view override returns (uint256[] memory) { return orderedEndBlocks; }
9,825,108
./full_match/137/0x971f4c09cb893071dC04C0418B91Dd590262Eca0/sources/project_/contracts/sale/MembershipTokenSale.sol
배열 번호에 해당하는 판매 정보 리턴
function getSaleInfo (uint256 _saleIndex) public view returns (SaleItem memory) { SaleItem memory sale = SaleTokenList[_saleIndex]; return sale; }
4,726,079
// SPDX-License-Identifier: MIT pragma solidity 0.7.3; import "../YakStrategyV2.sol"; import "../interfaces/IPair.sol"; import "../lib/DexLibrary.sol"; /** * @notice Adapter strategy for MasterChef. */ abstract contract MasterChefStrategy is YakStrategyV2 { using SafeMath for uint256; IWAVAX private consta...
Initialization helper for Pair deposit tokens Checks that selected Pairs are valid for trading reward tokens Assigns values to IPair(swapPairToken0) and IPair(swapPairToken1)/
function assignSwapPairSafely( address _ecosystemToken, address _poolRewardToken, address _swapPairPoolReward ) private { if (_poolRewardToken != _ecosystemToken) { if (_poolRewardToken == IPair(_swapPairPoolReward).token0()) { require( ...
1,039,622
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; /** * @title SushiSwap Double Incentive. * @dev Decentralized Exchange. */ import { TokenInterface } from "../../common/interfaces.sol"; import { Helpers } from "./helpers.sol"; import { Events } from "./events.sol"; abstrac...
harvest from masterChef harvest from masterChef token1 token1 deposited of LP token token2 token2 deposited LP token setId ID stores Pool ID data the metadata struct/
function harvest( address token1, address token2, uint256 setId, Metadata memory data ) external payable returns (string memory _eventName, bytes memory _eventParam) { token1 = changeEthAddrToWethAddr(token1); token2 = changeEthAddrToWethAddr(token2); if (data.poolId == uint256(-1) || data.versio...
944,591
pragma solidity ^0.4.17; // Decentralized autonomous lottery contract DAL { // ... } struct Bet { // Bet amount uint256 value; // Guessed numbers uint32 betHash; // Future block to validate the bet uint32 validateBlock; } // Mapping to store bet against an user. mapping(address => Bet) be...
Fallback function which acts as a shortcut to the token buying process/
function () payable external { play(uint(keccak256(msg.sender, block.number))); }
6,367,627
./full_match/1/0xe0651907B99e349198a4F7fc96430a809b9AeD83/sources/contracts/Raffle/ERC1155PrizeWrapper.sol
operator The address which initiated the transfer (i.e. msg.sender) from The address which previously owned the token id The ID of the token being transferred value The amount of tokens being transferred data Additional data with no specified format return `bytes4(keccak256("onERC1155Received(address,address,uint25...
(i.e. 0xf23a6e61, or its own function selector). function onERC1155Received(address operator, address from, uint256 id, uint256 value, bytes calldata data) public virtual override returns (bytes4) { return this.onERC1155Received.selector; } been updated. To accept the transfer(s), this must return `bytes4(ke...
9,695,643
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; /// @title ERC20 compliant implementation of custom token. /// @author Robi Markac /// @notice This contract can be used as POC governance token /// @dev Functions are implemented in the spirit of POC thus i...
Retrieve balance of specific address at specific block height This function can be computing intensive so consider caching value _address Users address for which balance is requested _blockHeight Block height at which users balance is requested return uint Users balance at provided block height iterate from back to...
function getBalanceAtBlockHeight(address _address, uint _blockHeight) external view returns (uint) { BalanceCheckpoint[] storage checkpoints = _balanceCheckpoints[_address]; for (uint i = checkpoints.length; i > 0; i--) { if (checkpoints[i-1].blockHeight < _blockHeight) { return checkpoints[i-1...
12,742,944
./partial_match/4/0xBB4D9ab065E8d3d46e28F762057960F58E2c5F1F/sources/StoboxToken.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) public onlyOwner { require(newOwner != address(0), "New owner cannot be current owner"); emit OwnershipTransferred(owner, newOwner); owner = newOwner; }
8,579,196
// SPDX-License-Identifier: BSD-3-Clause pragma solidity ^0.8.3; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgr...
DEPLOYMENT ACCOUNT FUNCTION TO DISABLE ONLY ADDORDER FUNCTION FOR A TRADEPAIR
function pauseAddOrder(bytes32 _tradePairId, bool _addOrderPaused) public { require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "E-OACC-12"); tradePairs.pauseAddOrder(_tradePairId, _addOrderPaused); }
1,840,876
pragma solidity 0.4.24; import "@aragon/os/contracts/apps/UnsafeAragonApp.sol"; import "@aragon/os/contracts/common/EtherTokenConstant.sol"; import "@aragon/os/contracts/common/IsContract.sol"; import "@aragon/os/contracts/common/SafeERC20.sol"; import "@aragon/os/contracts/lib/math/SafeMath.sol"; import "@aragon/os/c...
Open a buy order worth `@tokenAmount(_collateral, _value)` _buyer The address of the buyer _collateral The address of the collateral token to be spent _value The amount of collateral token to be spent/
function openBuyOrder( address _buyer, address _collateral, uint256 _value ) external payable auth(OPEN_BUY_ORDER_ROLE) { require(isOpen, ERROR_NOT_OPEN); require(_collateralIsWhitelisted(_collateral), ERROR_COLLATERAL_NOT_WHITELISTED); require(!_batchIsCancelled(...
5,455,286
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; pragma abicoder v2; import { ISuperfluid, ISuperToken, ISuperApp, ISuperAgreement, SuperAppDefinitions, BatchOperation } from "./ISuperfluid.sol"; // When you're ready to leave Remix, change imports to follow this pattern: // "@superfluid-f...
returns the price of a provider
function _getProviderPrice(address provider, ISuperToken soldToken) private view returns (int96 providerPrice) { int96 soldStream = _getTokenStreamToProvider(provider, soldToken); int96 boughtStream = _getTokenStreamToProvider(provider, _getAnotherToken(soldToken)); providerPrice = boughtStr...
1,067,571
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/Counters.sol"; import "./NameableCharacter.sol"; import "./AllowedColorsStorage.sol"; import "hardhat/console.sol"; /** * @title NiftyDegen NFT (The OG NFTs of the Nifty League on Ethereum) * @dev Extends NameableCharact...
Fallback to set NFT price to static ether value if necessary newPrice New price to set for remaining character sale Minimum value of 0.08 ETH for this to be considered in getNFTPrice/
function overrideMintPrice(uint256 newPrice) external onlyOwner { _manualMintPrice = newPrice; }
11,659,109
pragma solidity ^0.4.19; contract Ownable { /** * @dev set `owner` of the contract to the sender */ address public owner = msg.sender; /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } ...
Transfer ownership of data contract to _addr _addr address/
function transferDataOwnership(address _addr) onlyOwner public { data.transferOwnership(_addr); }
626,894
// SPDX-License-Identifier: MIT pragma solidity 0.8.3; import "../controller/ControllerInterface.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract Bridge is Ownable { enum RequestStatus {PENDING, CANCELED, APPROVED, REJECTED} struct Request { address requester; // sender of the req...
set txid as empty since it is not known yet.
function burn(uint amount) external onlyBroker returns (bool) { string memory depositAddress = brokerDepositAddress[msg.sender]; require(!isEmptyString(depositAddress), "broker asset deposit address was not set"); uint nonce = burnRequests.length; uint timestamp = getTimestamp(); ...
917,089
./partial_match/1/0xE2fe5E7E206e7B46CAd6A5146320e5b4b9A18E97/sources/metahashtoken.sol
Send tokens from the recipient to the recipient / check of allowed value / not enough tokens /
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success){ var _allowance = allowed[_from][msg.sender]; if (_allowance < _value){ revert(); } if (balance[_from] < _value){ revert(); } bala...
9,226,545
// SPDX-License-Identifier: ISC pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol"; import "@openzeppelin/contra...
Swap ETH for ALPHA uses either Sushiswap or Uniswap V3 depending on version ethAmount: amount of ETH to swap minReturn: Min return to pass to Uniswap trade return amount of ALPHA returned in the swap These swaps always use 'exact input' - they send exactly the amount specified in arguments to the swap, and the outpu...
function _swapETHforALPHAInternal(uint256 ethAmount, uint256 minReturn) private returns (uint256) { uint256 deadline = MAX_UINT; if (swapMode == SwapMode.SUSHISWAP) { IUniswapV2Router02 routerV2 = IUniswapV2Router02(sushiswapRouter); address[] memory path = new address[](2)...
10,295,806
./full_match/80001/0xB9ba12893A838CAaABc2a5E9F6F4fb76DEAc7DAa/sources/src/fancyERC20.sol
Internal function to remove staker from stakers array
function removeStaker(address _staker) internal { for (uint256 i = 0; i < stakers.length; i++) { if (stakers[i] == _staker) { stakers[i] = stakers[stakers.length - 1]; stakers.pop(); break; } } }
5,558,476
pragma solidity >=0.4.24; import '../core/Ownable.sol'; import 'openzeppelin-solidity/contracts/math/SafeMath.sol'; contract Ride is Ownable { using SafeMath for uint256; /********************** Public Varables ***********************/ // Contract owner address payable owner; // Placeholder for dr...
allows driver address to get current rideID
function fetchDriverBuffer() public view returns (address rideID) { address rideid = driverRides[msg.sender]; return (rideid); }
15,797,114
/** Copyright (c) 2018, ZSC Dev Team * 2018-10-19: v0.00.01 */ pragma solidity ^0.4.25; // pragma experimental ABIEncoderV2; import "../common/pausable.sol"; import "../common/delegate.sol"; contract InsuranceCompany { function update(string _key, string _data) external; function remove(string _key) exte...
Get size of company. return The size of company./
function companySize() external view whenNotPaused _onlyReaderOrHigher _checkCompanyAddr returns (uint) { return InsuranceCompany(companyAddr_).size(); }
12,868,990
./partial_match/1/0xD53E8E656fB6014E08ef221643D7AB087F6e9289/sources/Token2.sol
See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for...
function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve( sender, _msgSender(), _allowances[sender][_msgSender()].sub( ...
3,627,602
./full_match/56/0x3c8db23fe78Ff17010ba7decf40A619c3eb2d253/sources/project_/contracts/NFTRewardPool.sol
require(_token != address(stakedToken), "!staked");require(_token != address(rewardToken), "!reward");
function inCaseTokensGetStuck(address _token) external onlyOwner { uint256 amount = IERC20(_token).balanceOf(address(this)); IERC20(_token).safeTransfer(msg.sender, amount); }
3,226,180
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "@openzeppelin/contracts/presets/ERC721PresetMinterPauserAutoId.sol"; contract CaptureClubNFT is ERC721PresetMinterPauserAutoId { constructor(string memory name, string memory symbol, string memory baseURI) public ERC721PresetMinterPauserAutoI...
Creates a new token for `to`. Its token ID will be automatically assigned (and available on the emitted {IERC721-Transfer} event), and the token URI user asssigned based on the base URI passed at construction. See {ERC721-_mint}. Requirements: - the caller must have the `MINTER_ROLE`./ We cannot just use balanceOf to c...
function decentralizedMint(address to, string memory tokenURI) public virtual { require(hasRole(MINTER_ROLE, _msgSender()), "ERC721PresetMinterPauserAutoId: must have minter role to mint"); _mint(to, _tokenIdTracker.current()); _setTokenURI(_tokenIdTracker.current(), tokenURI); _tok...
553,280
/* -------------------------------------------------------------------------------- The Bethereum [BETHER] Token Smart Contract Credit: Bethereum Limited ERC20: https://github.com/ethereum/EIPs/issues/20 ERC223: https://github.com/ethereum/EIPs/issues/223 MIT Licence -------------------------------------------------...
ERC223 Functions / Get the contract constant _name /
function name() constant returns (string name) { return _name; }
20,884
pragma solidity ^0.5.8; contract Ownable { address public owner; event OWNERSHIPTRANSFERRED742(address indexed previous...
inject NONSTANDARD NAMING
function _BURNARRAYTOKENIDSALE680(uint index) internal {
7,237,375
./full_match/80001/0xC461989eAF209F43062cCD594994a75D920b5DBA/sources/contracts/dao/ERC1155Dao.sol
mints the token. emits the Mint event. Requirements: ‼ token with `tokenId` must not be already minted. ‼ contract should not be paused. Signature for mint(string,uint256,uint104,uint32,uint48) : `0x3e9047b9` tokenId id of the token. metadataId metadata id of the token. amount ...
function mint( uint256 tokenId, string memory metadataId, uint256 amount, uint104 price, uint32 expectedUsageLife, uint48 expiry ) external whenNotPaused { if (_tokenDetails[tokenId].isMinted) revert NotAvailableForOperationLib.NotAvailableForO...
844,462
pragma solidity ^0.5.10; /** @title BitcoinSPV */ /** @author Summa (https://summa.one) */ import {BytesLib} from "./BytesLib.sol"; import {SafeMath} from "./SafeMath.sol"; library BTCUtils { using BytesLib for bytes; using SafeMath for uint256; // The target at minimum Difficulty. Also the target of th...
Extracts the timestamp from a block header Time is not 100% reliable _header The header return The timestamp (little-endian bytes)
function extractTimestampLE(bytes memory _header) internal pure returns (bytes memory) { return _header.slice(68, 4); }
5,491,251
// SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity >=0.4.24 <0.8.0; import "../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contra...
Claim COMP rewards from Comptroller for this address comptroller The Compound Comptroller, Reward Contract
function claim(address comptroller) internal { IComptroller(comptroller).claimComp(address(this)); }
13,655,234
./full_match/43114/0xD97B4D013b31df04b6917Dc318D3197169c36bFD/sources/contracts/LongShort.sol
Sets a market as active once it has already been setup by createNewSyntheticMarket. Seperated from createNewSyntheticMarket due to gas considerations. marketIndex An int32 which uniquely identifies the market. kInitialMultiplier Linearly decreasing multiplier for Float token issuance for the market when staking synt...
function initializeMarket( uint32 marketIndex, uint256 kInitialMultiplier, uint256 kPeriod, uint256 unstakeFee_e18, uint256 initialMarketSeedForEachMarketSide, uint256 balanceIncentiveCurve_exponent, int256 balanceIncentiveCurve_equilibriumOffset, uint256 _marketTreasurySplitGradient_e...
4,519,949
pragma solidity ^0.4.11; /** * @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...
100% tokens owner is the only key holder no auction takes place,
function startAuction() onlyAfter(freePeriodEndTime) onlyInState(State.IcoFinished) { require(canStartAuction()); if (balances[msg.sender] == TOTAL_SUPPLY) { highestBidder = msg.sender; currentState = State.AuctionFinished; AuctionFinished(highestBidder, ...
2,030,908
pragma solidity ^0.4.19; /** * * @title McFly.aero - main contract * @author Copyright (c) 2018 McFly.aero * @author Dmitriy Khizhinskiy * @author "MIT" * */ /** * @title ERC20 Basic smart contract * @author Copyright (c) 2016 Smart Contract Solutions, Inc. * @author "Manuel Araoz <manuelaraoz@gmail.com>" ...
Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_t...
6,201,456
//Address: 0xcdf35c3fe4ccfacb3b1bbedfe71ca3a5ff6f2db1 //Contract name: GenericCrowdsale //Balance: 0 Ether //Verification Date: 3/18/2018 //Transacion Count: 12 // CODE STARTS HERE pragma solidity ^0.4.18; library SafeMath { function mul(uint a, uint b) internal pure returns (uint) { uint c = a * b; asser...
Define distount percents for different token amounts/
function ceilTokens( uint256 num ) public pure returns(uint256) { uint256 part = num % 1000000; return part > 0 ? num.div(1000000).mul(1000000) + 1000000 : num; }
2,505,408
/*** * ██████╗ ███████╗ ██████╗ ██████╗ * ██╔══██╗██╔════╝██╔════╝ ██╔═══██╗ * ██║ ██║█████╗ ██║ ███╗██║ ██║ * ██║ ██║██╔══╝ ██║ ██║██║ ██║ * ██████╔╝███████╗╚██████╔╝╚██████╔╝ * ╚═════╝ ╚══════╝ ╚═════╝ ╚═════╝ * * https://dego.finance * M...
Fee collection for any other token /
function seize(IERC20 token, uint256 amount) external onlyGovernance{ require(token != _dego, "reward"); token.safeTransfer(_governance, amount); }
5,816,751
// SPDX-License-Identifier: GPL-3.0 pragma solidity =0.6.12; /* BEGIN KEYBASE SALTPACK SIGNED MESSAGE. kXR7VktZdyH7rvq v5weRa0zkYfegFM 5cM6gB7cyPatQvp 6KyygX8PsvQVo4n Ugo6Il5bm5f3Wc6 6TBmPpX0GwuU4n1 jj5f1QNCcPGgXgB 2CnpFgQ3gOEvVg6 XP8CXBnyC9E1gRc gI54di8USKNHywe 5kNeA6zdEcwdKsZ 3Ydod13RrV78Qap G7mca59khDyl2mo iCT5Tur...
given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) { require(amountIn > 0, 'ViralswapLibrary: INSUFFICIENT_INPUT_AMOUNT'); require(reserveIn > 0 && reserveOut > 0, 'ViralswapLibrary: INSUFFICIENT_LIQUIDITY'); uint amountInWithFee = am...
10,132,521
./full_match/83/0x1ef4FD8f2C1F0F11F53BB9130d474810Fc49D941/sources/contracts/CToken/CToken.sol
Calculate number of tokens of collateral asset to seize given an underlying amount Used in liquidation (called in ICToken(cToken).liquidateBorrowFresh) cTokenCollateral The address of the collateral cToken actualRepayAmount The amount of cTokenBorrowed underlying to convert into cTokenCollateral tokens return (error...
function liquidateCalculateSeizeTokens( address cTokenCollateral, uint256 actualRepayAmount ) public view returns (uint256, uint256) { address oracle = IComptroller(comptroller).oracle(); uint256 priceBorrowedMantissa = IPriceOracle(oracle).getUnderlyingPrice(address(address(this))); uint256 pri...
9,561,503
pragma solidity 0.5.12; import "./Handler.sol"; import "./library/ReentrancyGuard.sol"; import "./interface/IAave.sol"; contract AaveHandler is Handler, ReentrancyGuard { address public aaveLendingPool; address public aaveLendingPoolCore; // mapping(address => uint256) public interestDetails; struct ...
Authorized function to approves market and HNIToken to transfer handler's underlying token. _underlyingToken Token address to approve./
function approve(address _underlyingToken, uint256 amount) public auth { require( doApprove(_underlyingToken, aaveLendingPoolCore, amount), "approve: Approve aToken failed!" ); super.approve(_underlyingToken, amount); }
2,551,867
/** *Submitted for verification at Etherscan.io on 2021-04-03 */ // SPDX-License-Identifier: BUSL-1.1 // File: @openzeppelin/contracts/utils/EnumerableSet.sol pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * ...
called once by the factory at time of deployment
function initialize( IERC20 _token0, IERC20 _token1, uint32 _ampBps ) external { require(msg.sender == address(factory), "DMM: FORBIDDEN"); token0 = _token0; token1 = _token1; ampBps = _ampBps; }
2,135,916
//Address: 0xc350ebf34b6d83b64ea0ee4e39b6ebe18f02ad2f //Contract name: ExpiringMarket //Balance: 0 Ether //Verification Date: 2/28/2017 //Transacion Count: 3073 // CODE STARTS HERE /* Copyright 2016, 2017 Nexus Development, LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use...
Cancel an offer. Refunds offer maker. read-only offer. Modify an offer by directly accessing offers[id]
function cancel( uint id ) can_cancel(id) synchronized returns ( bool success ) { OfferInfo memory offer = offers[id]; delete offers[id]; var seller_refunded = offer.sell_which_token.transfer( offer.owner , offer.sell_how_much ); assert(seller_refunded); ...
13,109,539
import "./owned.sol"; import "./localsCointoken.sol"; //onlyReputable contract localsInOut is owned { event OfferAdded(uint offerID, uint amount,uint validityStart,uint duration, string descriptionipfs); event Confirmed(uint offerNumber, bool supportsProposal, address confirmator); event OfferClaimed(uint offe...
amount 1% to DAO and rest send to claimer
function executeOffer(uint offerNumber, bytes transactionBytecode) returns (int result) { Offer o = offers[offerNumber]; }
5,546,532
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/lib/ConsiderationErrors.sol
Reverts the current transaction with an "InvalidTime" error message. startTime The time at which the order becomes active. endTime The time at which the order becomes inactive./
function _revertInvalidTime(uint256 startTime, uint256 endTime) pure { assembly { mstore(0, InvalidTime_error_selector) mstore(InvalidTime_error_startTime_ptr, startTime) mstore(InvalidTime_error_endTime_ptr, endTime) revert(Error_selector_offset, InvalidTime_error_length) } }
4,301,443
pragma solidity 0.5.7; pragma experimental ABIEncoderV2; /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ interface IERC20 { function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external retur...
Divides two unsigned integers and returns the remainder (unsigned integer modulo), reverts when dividing by zero./
function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, "SafeMath::mod: Invalid divisor zero"); return a % b; }
1,773,235
./partial_match/1/0xD0C6e59B50C32530C627107F50Acc71958C4341F/sources/contracts/loans/direct/loanTypes/DirectLoanBaseMinimal.sol
Resolving the loan without trasferring the nft to provide a base for the bundle break up of the bundled loans _loanId A unique identifier for this particular loan, sourced from the Loan Coordinator. _loanTerms - The main Loan Terms struct. This data is saved upon loan creation on loanIdToLoan. _loanCoordinator - Th...
function _resolveLoanNoNftTransfer( uint32 _loanId, LoanTerms memory _loanTerms, IDirectLoanCoordinator _loanCoordinator, bool _repaid ) internal { loanRepaidOrLiquidated[_loanId] = true; _escrowTokens[_loanTerms.nftCollateralContract][_loanTerms.nftCollateralId]...
2,861,970
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@open...
Minting for main sale of Borgs
function publicMint(uint256 _amountOfBorgs) public payable { uint256 mintIndex = _tokenIdCounter.current(); for (uint256 i = 1; i <= _amountOfBorgs; i++) { mintIndex++; if(mintIndex <= saleSupply) { _mint(msg.sender, ...
10,258,850
// SPDX-License-Identifier: MIT pragma solidity 0.8.10; import "ERC721Enumerable.sol"; import "SafeMath.sol"; import "Counters.sol"; import "Ownable.sol"; import "Pausable.sol"; import "BPC.sol"; import "BPCSenderRecipient.sol"; import "ExternalFuncs.sol"; contract BPCLottery is ERC721, ERC777SenderRecipientMock, Ow...
Calculate x - y. Revert on overflow. x signed 64.64-bit fixed point number y signed 64.64-bit fixed point number return signed 64.64-bit fixed point number/
function sub(int128 x, int128 y) internal pure returns (int128) { unchecked { int256 result = int256(x) - y; require(result >= MIN_64x64 && result <= MAX_64x64); return int128(result); } }
154,142
// SPDX-License-Identifier: MIT /// @title Timelock for ERC721Governor. pragma solidity ^0.8.6; import { TimelockControllerUpgradeable } from "@openzeppelin/contracts-upgradeable/governance/TimelockControllerUpgradeable.sol"; import { UUPSUpgradeable } from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol"; ...
deployer + self administration register proposers register executors
function __TimelockController_init_unchained( uint256 minDelay, address[] memory proposers, address[] memory executors ) internal onlyInitializing { _setRoleAdmin(TIMELOCK_ADMIN_ROLE, TIMELOCK_ADMIN_ROLE); _setRoleAdmin(PROPOSER_ROLE, TIMELOCK_ADMIN_ROLE); _setRol...
1,691,006
pragma solidity ^0.4.11; /** * @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...
Set the contract that can call release and make the token transferable. Design choice. Allow reset the release agent to fix fat finger mistakes./ We don&39;t do interface check here as we might want to a normal wallet address to act as a release agent
function setReleaseAgent(address addr) onlyOwner inReleaseState(false) public { releaseAgent = addr; }
15,313,862
/** *Submitted for verification at Etherscan.io on 2021-03-23 */ /** *Submitted for verification at Etherscan.io on 2021-03-19 */ // File: zos-lib/contracts/Initializable.sol pragma solidity >=0.4.24 <0.6.0; /** * @title Initializable * * @dev Helper contract to support initializer functions. To use it, repla...
Transfer tokens from one address to another. from The address you want to send tokens from. to The address you want to transfer to. value The amount of tokens to be transferred./
function transferFrom(address from, address to, uint256 value) public validRecipient(to) whenTokenNotPaused returns (bool) { _allowedSATO[from][msg.sender] = _allowedSATO[from][msg.sender].sub(value); uint256 gonValue = value.mul(_gonsPerFragment); _gonBa...
2,419,846
./full_match/1/0x622a1C6a0f49594f6BA11F0B8cE8706F1f14cc8d/sources/contracts/TicketStorage.sol
Returns total amount of tickets./
function getTickets() public view returns (uint16) { return _tickets; }
8,321,547
./partial_match/1/0x067C5714f9c034fda974f909591c75A710C8f6eb/sources/MULTINFT_METAVERSE_NIGHTS.sol
Returns the number of tokens burned by or on behalf of `owner`./
function numberBurned(address owner, uint256 tokenId) public view returns (uint256) { return (_packedAddressData[owner][tokenId] >> _BITPOS_NUMBER_BURNED) & _BITMASK_DATA_ENTRY; }
9,130,748
./partial_match/1/0x48b95265749775310B77418Ff6f9675396ABE1e8/sources/@yield-protocol/yieldspace-tv/src/YieldMath.sol
Calculates the max amount of fyToken a user could sell. sharesReserves yield bearing vault shares reserve amount fyTokenReserves fyToken reserves amount timeTillMaturity time till maturity in seconds e.g. 90 days in seconds k time till maturity coefficient, multiplied by 2^64. e.g. 25 years in seconds g fee coeff...
function maxFYTokenIn( uint128 sharesReserves, uint128 fyTokenReserves, uint128 timeTillMaturity, int128 k, int128 g, int128 c, int128 mu ) public pure returns (uint128 fyTokenIn) { Y = fyToken reserves Z = shares reserves ...
4,008,187
pragma solidity 0.8.13; import "./PoolToken.sol"; import "./BAllowance.sol"; import "./BInterestRateModel.sol"; import "./BSetter.sol"; import "./BStorage.sol"; import "./interfaces/IBorrowable.sol"; import "./interfaces/ICollateral.sol"; import "./interfaces/IImpermaxCallee.sol"; import "./interfaces/IERC20.sol"; imp...
this low-level function should be called from another contract optimistically transfer funds
function borrow(address borrower, address receiver, uint borrowAmount, bytes calldata data) external nonReentrant update accrue { uint _totalBalance = totalBalance; _require(borrowAmount <= _totalBalance, Errors.INSUFFICIENT_CASH); _checkBorrowAllowance(borrower, msg.sender, borrowAmount); if (borrowAmoun...
5,342,670
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "@openzeppelin/contracts/utils/StorageSlot.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "./interfaces/IExternalStorageAccess.sol"; import "hardhat/console.sol"; /// @author Simon Tian /// @title An abstract context base contract abstr...
Returns the address of external storage access contract at slot _EXTERNAL_STORAGE_SLOT./
function _getExternalStorageAccessAddr() internal view returns (address) { return StorageSlot.getAddressSlot(_EXTERNAL_STORAGE_SLOT).value; }
7,311,297
//SPDX-License-Identifier: MIT pragma solidity ^0.8.4; //openzepplin ERC721 NFT functionality import '@openzeppelin/contracts/token/ERC721/ERC721.sol'; // security against transactions for multiple requests import '@openzeppelin/contracts/security/ReentrancyGuard.sol'; import '@openzeppelin/contracts/utils/Counters.s...
two functions to interact with contract 1. create a market item to put it up for sale 2. create a market sale fpr buying and selling between parties nonReentrant is a modifier to prevent reentry attack putting it up for sale - bool - no owner NFT transaction
function makeMarketItem( address nftContract, uint tokenId, uint price ) public payable nonReentrant { require(price >0, 'Price must be atleast one wei'); require(msg.value == listingPrice, 'Price must be equal to listing price'); _tokenIds.increment(); ...
6,400,954
//Address: 0x647f24fc14b75335adf97eb9792ce004471bf35a //Contract name: MitToken //Balance: 0 Ether //Verification Date: 5/24/2018 //Transacion Count: 31 // CODE STARTS HERE pragma solidity ^0.4.18; /** * Math operations with safety checks */ library SafeMath { function mul(uint a, uint b) internal pure return...
Set allowed for other address Allows `_spender` to spend no more than `_value` tokens in your behalf _spender The address authorized to spend _value the max amount they can spend/ To change the approve amount you first have to reduce the addresses` allowed to zero by calling `approve(_spender, 0)` if it is not alre...
function approve(address _spender, uint _value) public returns (bool success) { if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) { revert(); } allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; }
934,827
pragma solidity >=0.5.0 <0.7.0; /** * @author Ricardo Guilherme Schmidt (Status Research & Development GmbH) * @notice based on https://github.com/ethereum/eth2.0-specs/blob/dev/ssz/merkle-proofs.md#merkle-multiproofs but without generalized indexes */ contract MerkleMultiProof { /** * @notice Calculates a...
Check validity of multimerkle proof root merkle root leafs out of order sequence of leafs and it's siblings proofs out of order sequence of parent proofs proofFlag flags for using or not proofs while hashing against hashes./
function verifyMultiProof( bytes32 root, bytes32[] memory leafs, bytes32[] memory proofs, bool[] memory proofFlag ) public pure returns (bool) { return calculateMultiMerkleRoot(leafs, proofs, proofFlag) == root; }
12,854,559
./full_match/1/0x2a09bd75fbB293456E33fF180919a704650219b0/sources/browser/chainBridge/SXBridge.sol
(recipient,tokenId,metadata,feeAmount) = abi.decode(asset, (address,uint256, bytes,uint256)) ;
function _decodeAsset(bytes memory asset) internal pure returns( address recipient, uint256 tokenId, bytes memory metadata, uint256 feeAmount) { return abi.decode(asset, (address,uint256, bytes,uint256)); }
16,483,895
./full_match/4/0xb27e7812F0FfBEC13F8F040B367c3438ea2eE38f/sources/contracts/SimpleStorage.sol
if you store object in memory it only be stored during execution. However, if we store it with storgae the data will be stored even after execution
function addPerson (string memory _name, uint256 _favoriteNumber) public{ people.push(People(_favoriteNumber, _name)); nameToFavoriteNumber[_name] = _favoriteNumber; }
709,395
./full_match/42220/0xDD85f95883a8B1836849AC76CBD7F92D1619e4c0/sources/StrategySushiLPV2_flat.sol
Updates router that will be used for swaps. _unirouter new unirouter address./
function setUnirouter(address _unirouter) external onlyOwner { unirouter = _unirouter; }
16,323,571
./full_match/42220/0xDD85f95883a8B1836849AC76CBD7F92D1619e4c0/sources/StrategySushiLPV2_flat.sol
Updates beefy fee recipient. _beefyFeeRecipient new beefy fee recipient address./
function setBeefyFeeRecipient(address _beefyFeeRecipient) external onlyOwner { beefyFeeRecipient = _beefyFeeRecipient; }
16,323,573
./full_match/1/0x6F1bB529BEd91cD7f75b14d68933AeC9d71eb723/sources/contracts/math-utils/common/Uint.sol
does not revert on overflow
function unsafeSub(uint256 x, uint256 y) pure returns (uint256) { unchecked { return x - y; }}
8,295,374
./full_match/1/0xABE46f13C833Ab07bf9e523F485B53c9a633DD60/sources/contracts/IdleCDO.sol
it's REQUIRED to transfer out any incentive tokens accrued before _incentiveTokens array with new incentive tokens
function setIncentiveTokens(address[] memory _incentiveTokens) external { _checkOnlyOwner(); incentiveTokens = _incentiveTokens; }
8,321,930
pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/crowdsale/distribution/FinalizableCrowdsale.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "../../payment/RefundEscrowWithFee.sol"; /** * @title RefundableCrowdsale * @dev Extension of Crowdsale contract that adds a funding ...
Investors can claim refunds here if crowdsale is unsuccessful/
function claimRefund() public { require(isFinalized, "Crowdsale is not finalized yet"); require(!goalReached(), "Goal of the crowdsale is reached"); escrow.withdraw(msg.sender); }
6,356,083
./full_match/51/0x26f0104Fe1d8b10B9876222a39DbddF4b2B7F729/sources/contracts/Whitelist.sol
This function checks if the input address has given role and platform is not in paused state/
function hasAccessRole(bytes32 role, address address_) public view returns (bool) { return hasRole(role, address_); }
13,235,967
//Address: 0xa3e97b1da9c3684324fe38627c40e94555f39b18 //Contract name: Crowdsale //Balance: 0 Ether //Verification Date: 2/18/2018 //Transacion Count: 12 // CODE STARTS HERE pragma solidity ^0.4.18; /** * @title ICO CONTRACT * @dev ERC-20 Token Standard Complian */ /** * @title SafeMath * @dev Math operations wit...
return true if crowdsale event has ended
function hasEnded() public constant returns (bool) { return now > end_Time; }
2,501,695
/** * Copyright 2017-2022, OokiDao. All Rights Reserved. * Licensed under the Apache License, Version 2.0. */ pragma solidity 0.5.17; pragma experimental ABIEncoderV2; import "State.sol"; import "LoanMaintenanceEvents.sol"; import "PausableGuardian.sol"; import "InterestHandler.sol"; import "InterestOracle.sol"; i...
last The specified observation blockTimestamp The new timestamp tick The active tick return Observation The newly populated observation
function convert( Observation memory last, uint32 blockTimestamp, int24 tick ) private pure returns (Observation memory) { return Observation({ blockTimestamp: blockTimestamp, irCumulative: last.irCumulative + int56(tick) * (blockTimest...
213,897
./full_match/1/0x1A6a41b7adaE4dDb59A50c0cef0B0B62080Ac5F8/sources/NFT-Cashier/Cashier.sol
update the pause purchase status/
function updatePausePurchase(bool status) public onlyOwner { paused_purchase = status; emit UpdatePausePurchase(paused_purchase); }
16,494,656
pragma solidity ^0.5.0; import "@openzeppelin/contracts/ownership/Ownable.sol"; import "../interfaces/IFantomDeFiTokenRegistry.sol"; import "../interfaces/IERC20Detailed.sol"; /** * This utility contract implements an update aware list of * DeFi tokens used across Fantom DeFi protocols. * * version 0.1.0 *...
canDeposit informs if the specified token can be deposited to collateral pool.
function canDeposit(address _token) external view returns (bool) { return tokens[_token].canDeposit; }
6,404,554
// SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.8.9; import { IJustCausePool, IJCDepositorERC721, IERC20, IPool, IPoolAddressesProvider, IWETHGateway } from './Interfaces.sol'; import { JCDepositorERC721 } from './JCDepositorERC721.sol'; import { JustCausePoolAaveV3 } from './JustCausePoolAaveV3.sol'; import "...
Emit AddPool Creates JCP proxy _acceptedTokens List of tokens to be accepted by JCP. _name String name of JCP. _about ipfs hash of pool description of JCP. _picHash ipfs hash of pic of JCP. _metaUri meta info uri for nft of JCP. _receiver address of receiver of JCP donations./
function createJCPoolClone( address[] memory _acceptedTokens, string memory _name, string memory _about, string memory _picHash, string memory _metaUri, address _receiver ) external onlyAcceptedTokens(_acceptedTokens){ require(names[_name] == address(0), ...
5,345,738
./full_match/1/0xbFA41711C50aE6F9fd18F062aDb59D1B817B2C1a/sources/home/joshua/Dropbox/Projects/2020_percom/ape_cash/contracts/ApeToken.sol
mint 1800 APE per held ETH to list on Uniswap
function listOnUniswap() public onlyDeveloper onlyBeforeUniswap { timeListed = now; addWhitelist(uniswapEthPair); uint256 ethBalance = address(this).balance; uint256 apeBalance = ethBalance.mul(uniswapApePerEth); _mint(address(this), apeBalance); _approve(address(t...
9,695,294
// to test issue with nodes breaking with large clients over WS // fixed in web3 with fragmentationThreshold: 8192 pragma solidity ^0.4.17; contract BigFreakingContract { event Transfer(address indexed from, address indexed to, uint value); event Approval( address indexed owner, address indexed spender, uint valu...
TODO: should increase instead
function approve_234(address spender, uint value) public returns (bool ok) { _approvals[msg.sender][spender] = value; emit Approval( msg.sender, spender, value ); return true; }
6,453,947
// SPDX-License-Identifier: MIT pragma solidity >=0.7.0; pragma experimental ABIEncoderV2; import "../Interface/IBerry.sol"; /** * @title UserContract * This contracts creates for easy integration to the Berry System * by allowing smart contracts to read data off Berry */ contract UsingBerry { IBerry private ...
return Returns the getUintVar variable named after the function name./
function disputeCount() external view returns (uint256) { return berry.getUintVar(keccak256("disputeCount")); }
13,124,241
./full_match/80001/0xF524Cc28CB890F5f0514ABA478E23F0B7BCf8f88/sources/contracts/BnBeanLotteryGame.sol
Set max number of tickets Only callable by owner/
function setMaxNumberTicketsPerBuy( uint256 _maxNumberTicketsPerBuy ) external onlyOwner { require(_maxNumberTicketsPerBuy != 0, "Must be > 0"); maxNumberTicketsPerBuyOrClaim = _maxNumberTicketsPerBuy; }
5,584,687
./full_match/80001/0x5f46D4F66d82539A7b6231a0A37af81b24809D6c/sources/contracts/abstract/DIDOpt.sol
this function will be set opt data for every public key inputted, this function able to register public key with new token id if not used is detected, this function will be emit 'SettedOptIn' for offchain logging, this function will return tokenId for inheritance action. publicKey is public key want to be set scope da...
function setOptIn( bytes memory publicKey, string memory scope ) public virtual returns (uint256) { uint256 tokenId = _optTokenId(); require( (publicKey.length == 33 || publicKey.length == 65) && bytes(scope).length > 0 && _canSetOpt(t...
5,552,821
pragma solidity 0.4.20; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function percent(uint value,uint numerator, uint denominator, uint precision) internal pure returns(uint quotient) { uint _numerator = numerator * 10 ** (precision+1); ...
Calculate token price based on an amount of incoming ETH It's an algorithm, hopefully we gave you the whitepaper with it in scientific notation; Some conversions occurred to prevent decimal errors or underflows/overflows in solidity code.
function ethereumToTokens_(uint256 _ethereum) internal view returns(uint256) { uint256 _tokenPriceInitial = tokenPriceInitial * 1e18; uint256 _tokensReceived = ( ( SafeMath.sub( (SqRt ( ...
12,920,317
./full_match/1/0xec39A0Da3F21A3A037Fd72036F8e4e981c62085A/sources/inaaaaa.sol
/ Unstake crXSUSHI `cTokenAmount` into SUSHI from BENTO for benefit of `to` by batching calls to `bento`, `crXSushiToken` and `sushiBar`.
function unstakeSushiFromCreamFromBento(address to, uint256 cTokenAmount) external { } █ ▀▄ █ █ █ █ █ █ ▄ ▀▀▀▀▄ █ ▄ █ █▄▄█ █▀▀▀ ▀▄▄▄▄▀ █ █ █ █ █ █ █ █ █ █ █ ▀ ▀ █ ▀ ▀ */ uint256 amount...
3,185,311
./full_match/43113/0xA938608cb6189309e36dC935F91D5A538bF0B815/sources/contracts/ico.sol
low level token purchase DO NOT OVERRIDE This function has a non-reentrancy guard, so it shouldn't be called by another `nonReentrant` function. beneficiary Recipient of the token purchase/ calculate token amount to be created update state
function buyTokens(address beneficiary) public nonReentrant payable { uint256 weiAmount = msg.value; _preValidatePurchase(beneficiary, weiAmount); uint256 tokens = _getTokenAmount(weiAmount); weiRaised = weiRaised.add(weiAmount); _processPurchase(beneficiary, tokens); ...
7,109,047