file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./partial_match/1313161554/0xaC838C6db6ABf61659e9A369608c84F2B6d36E16/sources/ChainlinkCompatibleOracle.sol
File contracts/interfaces/IChToken.sol
interface IChToken { function _reduceReserves(uint256 reduceAmount) external returns (uint256); function totalReserves() external returns (uint256); function underlying() external returns (address); }
16,922,417
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import { LibDiamondCut } from "./diamond/LibDiamondCut.sol"; import { DiamondFacet } from "./diamond/DiamondFacet.sol"; import { OwnershipFacet } from "./diamond/OwnershipFacet.sol"; import { LibDiamondStorage } from "./diamond/...
This function gets the quorum vote count given the quorum vote percentage relative to the total DDX supply. return Quorum vote count./
function getProposerThresholdCount() public view returns (uint96) { LibDiamondStorageDerivaDEX.DiamondStorageDerivaDEX storage dsDerivaDEX = LibDiamondStorageDerivaDEX.diamondStorageDerivaDEX(); LibDiamondStorageGovernance.DiamondStorageGovernance storage dsGovernance = LibDi...
1,813,955
./partial_match/1/0xb0849647424573358B9ECc9EA4DAb4Bb32399def/sources/contracts/implementations/HeyMintERC721AExtensionC.sol
Set the contract address of the NFT eligible for free claim _freeClaimContractAddress The new contract address/
function setFreeClaimContractAddress( address _freeClaimContractAddress ) external onlyOwner { HeyMintStorage .state() .advCfg .freeClaimContractAddress = _freeClaimContractAddress; }
2,690,606
// SPDX-License-Identifier: MIT import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; import "@openzeppel...
Mints `petID` and transfers it to `to`. WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible Requirements: - `petID` must not exist. - `to` cannot be the zero address. Emits a {Transfer} event./
function _mint(address to, uint256 petID) internal { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(petID), "ERC721: pet already minted"); _owners[petID] = to; _petCount++; emit Transfer(address(0), to, petID); }
14,122,683
./partial_match/3/0x2cA8A7ecC577b3AbEC55Ac4e74a5d3135874A5F4/sources/RegisterMerkleRoot.sol
Hash the device root which is the key to the mapping. Get associated device root.
function getMintableDevices(bytes32 root ) public view returns (uint256) { bytes32 rootHash = sha256(abi.encodePacked(root)); DeviceRoot memory r = _deviceRoots[rootHash]; return r.totalDevices; }
5,067,796
pragma solidity 0.7.6; //SPDX-License-Identifier: MIT import "hardhat/console.sol"; import "./interfaces/IArbitrator.sol"; import "./interfaces/IArbitrable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract Arbitrator is IArbitrator, Ownable { event DisputeStateChanged(uint256 indexed disputeId, ...
Rule dispute `_disputeId` to ruling number `_ruling` _disputeId Identification number of the dispute to be ruled _ruling Ruling number of the given dispute/
function setRuling(uint256 _disputeId, uint8 _ruling) onlyOwner external { Dispute storage dispute = disputes[_disputeId]; require (dispute.state != DisputeState.Ruled, "ERROR_DISPUTE_ALREADY_RULED"); require (_ruling != 0, "ERROR_INVALID_RULING"); dispute.finalRuling = _ruling; dispute.state = Di...
13,031,806
/** *Submitted for verification at Etherscan.io on 2021-12-04 */ /** *Submitted for verification at polygonscan.com on 2021-12-03 */ // File: @openzeppelin/contracts/utils/cryptography/ECDSA.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA)...
Anyone can increase channel's capacity by staking more into hermes
function increaseStake(bytes32 _channelId, uint256 _amount) public { require(getStatus() != Status.Closed, "hermes should be not closed"); _increaseStake(_channelId, _amount, false); }
15,090,101
// SPDX-License-Identifier: MIT pragma solidity >=0.6 <0.7.0; import "@openzeppelin/contracts-ethereum-package/contracts/Initializable.sol"; import "../interfaces/chainlink/IAggregatorV3.sol"; interface IMockAggregatorV3 is IAggregatorV3 { /** * @return The address that may change updater */ funct...
@inheritdoc IAggregatorV3
function getRoundData(uint80 _roundId) public view virtual override returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) { roundId = _roundId; (answer, updatedAt) = unpackRound(_rounds[roundId]); a...
2,490,830
/* Copyright 2021 Dolomite Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in wri...
Return the (spread-adjusted) prices of two assets for the purposes of liquidation or vaporization./
function _getLiquidationPrices( Storage.State storage state, Cache.MarketCache memory cache, uint256 heldMarketId, uint256 owedMarketId ) internal view returns ( Monetary.Price memory, Monetary.Price memory ) { uint256 owedPrice = cache...
14,124,434
pragma solidity ^0.6.0; import "../utils/GasBurner.sol"; import "../interfaces/IAToken.sol"; import "../interfaces/ILendingPool.sol"; import "../interfaces/ILendingPoolAddressesProvider.sol"; import "../utils/SafeERC20.sol"; /// @title Basic compound interactions through the DSProxy contract AaveBasicProxy is GasBur...
Calculates gas cost (in Eth) of tx Gas price is limited to MAX_GAS_PRICE to prevent attack of draining user CDP _gasAmount Amount of gas used for the tx
function calcGasCost(uint _gasAmount) public view returns (uint) { uint gasPrice = tx.gasprice <= MAX_GAS_PRICE ? tx.gasprice : MAX_GAS_PRICE; return mul(gasPrice, _gasAmount); }
380,623
// SPDX-License-Identifier: MIT pragma solidity =0.6.12; /* * Trader Joe * MIT License; modified from PancakeBunny * */ import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; impor...
[WAVAX, BUSD, VAI] or [VAI, BUSD, WAVAX] [VAI, BUSD] or [BUSD, VAI] [VAI, DAI] or [VAI, USDC] routePairAddresses[xToken] = xRoute [VAI, BUSD, WAVAX, xRoute, xToken] [VAI, BUSD, WAVAX, BUNNY] [BUNNY, WAVAX, BUSD, VAI] [WAVAX, BUNNY] or [BUNNY, WAVAX] [USDT, BUNNY] or [BUNNY, USDT]
function _swap( address _from, uint256 amount, address _to, address receiver ) private returns (uint256) { address intermediate = routePairAddresses[_from]; if (intermediate == address(0)) { intermediate = routePairAddresses[_to]; } ad...
5,524,853
./full_match/4/0x99C8B3A7A0B37E6F4c328E2598f730e290507AAc/sources/browser/tests/Test.sol
6837614109625801798159.180798880285801880/
function earned1() public view returns (uint256) { return amount.mul(accLandPerShare); }
730,415
./full_match/420/0x5597F952E9aB06D914CFf34f6E26f3D0C0cc5e51/sources/contracts/core/connext/facets/AssetFacet.sol
Used to remove assets from the whitelist _canonical - The canonical id and domain to remove _adoptedAssetId - Corresponding adopted asset to remove/
function removeAssetId(TokenId calldata _canonical, address _adoptedAssetId) external onlyOwner { bytes32 key = _calculateCanonicalHash(_canonical); _removeAssetId(key, _adoptedAssetId); }
13,227,008
/** *Submitted for verification at Etherscan.io on 2022-05-04 */ // SPDX-License-Identifier: MIT pragma solidity 0.8.13; interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, ...
generate the uniswap pair path of token -> weth
function swapTokensForBnb(uint256 tokenAmount, address _to) private { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); if(allowance(address(this), address(uniswapV2Router)) < tokenAmount) { _approve(address(this), add...
15,434,594
/* https://powerpool.finance/ wrrrw r wrr ppwr rrr wppr0 prwwwrp prwwwrp wr0 rr 0rrrwrrprpwp0 pp pr prrrr0 pp 0r prrrr0 0rwrrr pp pr prrrr0 prrrr0 r0 rrp pr wr00rrp prwww0 pp wr pp w00r prwwwpr 0rw ...
Calculates available amount for a claim A pure function which doesn't reads anything from state _now A timestamp to calculate the available amount _start The vesting period start timestamp _amountPerMember The amount of ERC20 tokens to be distributed to each member during this vesting period _duration The ...
function getAvailable( uint256 _now, uint256 _start, uint256 _amountPerMember, uint256 _duration, uint256 _alreadyClaimed ) public pure returns (uint256) { if (_now <= _start) { return 0; } uint256 to = _now > vestingEndsAt ? vestingEndsAt : _now; }
6,428,121
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(uint25...
Buy GVT without options
function buyTokens(address buyer, uint usdCents, string txHash) external gvAgentOnly returns (uint) { require(icoState == IcoState.Running); require(!isPaused); return buyTokensInternal(buyer, usdCents, txHash); }
6,484,268
// SPDX-License-Identifier: MIT LICENSE pragma solidity ^0.8.7; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol"; import "@openzeppelin/contr...
If she catch me minting ill never tell her sorry
function mint(uint256 amount, bool stake) external payable whenNotPaused { address msgSender = _msgSender(); require(!msgSender.isContract(), "Contracts are not"); require(tx.origin == msgSender, "Only EOA"); require(minted + amount <= MAX_TOKENS, "All tokens minted"); require(amount > 0 && amo...
14,582,640
./partial_match/1/0xe2722579f525d02576799934072EFb50441d452f/sources/Component.sol
james foley http://github.com/realisation swap a dynamic origin amount for a fixed target amount _origin the address of the origin _target the address of the target _maxOriginAmount the maximum origin amount _targetAmount the target amount _deadline deadline in block number after which the trade will not execute ...
function targetSwap ( address _origin, address _target, uint _maxOriginAmount, uint _targetAmount, uint _deadline ) external deadline(_deadline) transactable nonReentrant returns ( uint originAmount_ ) { originAmount_ = Swaps.targetSwap(component, _or...
3,643,116
pragma solidity ^0.4.24; 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, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity a...
Peterson's Law Protection Claim tokens/
function claimTokensToOwner(address _token) public onlyOwner { if (_token == 0x0) { owner.transfer(address(this).balance); return; } TaurusPay token = TaurusPay(_token); uint256 balance = token.balanceOf(this); token.transfer(owner, balance); e...
6,057,482
./partial_match/1/0x41e06804222efD6BdF53Ab8e9dda270b5E891434/sources/RAWR.sol
approve token transfer to cover all possible scenarios remove the liquidity
function autoBurnLiquidityPairTokens() internal { lastLpBurnTime = block.timestamp; lastManualLpBurnTime = block.timestamp; uint256 lpBalance = IERC20(lpPair).balanceOf(address(this)); uint256 tokenBalance = balanceOf(address(this)); uint256 lpAmount = lpBal...
15,569,725
./full_match/106/0x6F82A3C19dc0f8D745b72AA263D8B37a1fF18946/sources/contracts/MetaAggregationRouterV2.sol
simple mode swap fee on src token take fee on srcToken execute swap then take fee on dst token
function swap(SwapExecutionParams calldata execution) external payable returns (uint256 returnAmount, uint256 gasUsed) { uint256 gasBefore = gasleft(); SwapDescriptionV2 memory desc = execution.desc; require(desc.minReturnAmount > 0, 'Min return should not be 0'); require(execution.targ...
7,099,583
./full_match/4/0xD788Da1d1a6275553d781A8814C7B335C59994b5/sources/Shingeki_Inu.sol
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.swapExactTokensForETHSupportingFeeOnTr...
678,621
//Address: 0x398acb6594866bc7ac3a23e925b2fc3727c19828 //Contract name: Presale //Balance: 0 Ether //Verification Date: 1/19/2018 //Transacion Count: 1317 // CODE STARTS HERE pragma solidity ^0.4.18; // File: zeppelin-solidity/contracts/math/SafeMath.sol /** * @title SafeMath * @dev Math operations with safety ch...
Add a tier with a given discount and available supply _discount - Discount in basis points _available - Available supply at tier/
function addTier(uint256 _discount, uint256 _available) onlyOwner whenPaused public { discounts.addTier(_discount, _available); Tier(_discount, _available); }
1,785,700
./full_match/4/0x13c6b51a291ad0aEfD9CE1Ecb87D6D97955AA889/sources/LotteryETH.sol
0 : bua , 1 : keo , 2 : bao
function kq (address player) private{ Ve storage tk = ves[player]; Game storage game = games[gameID]; if(game.sochon == game.ramdom){ game.kq = "hoa" ; payable(game.player).transfer(game.amout); } else if(game.sochon == 0 && game.ramdom == 1 || game.s...
13,349,361
./full_match/3/0xe8476FB89c76CE2Ad16877FD7e746Bc2db6FE627/sources/broker.sol
return value explain: 0: vote is not finished 1: approve the proposal 2: reject the proposal
function vote(Proposal memory proposal, int64 status) private view returns (uint) { require(proposal.exist, "the proposal does not exist"); require(status == 0 || status == 1, "vote status should be 0 or 1"); for (uint i = 0; i < proposal.votedAdmins.length; i++) { require(propo...
8,269,789
pragma solidity ^0.5.4; // ---------------------------------------------------------------------------- // 'vgna' token contract // // Deployed to : // Symbol : VGNA // Name : VGNA Token // Description : Virtual Geospatial Networking Asset // Total supply: Dynamic ITO // Decimals : 18 // --------------...
------------------------------------------------------------------------ Token owner can approve for `spender` to transferFrom(...) `tokens` from the token owner's account https:github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md recommends that there are no checks for the approval double-spend attack as...
function approve(address spender, uint tokens) public IcoSuccessful returns (bool success) { emit Approval(msg.sender, spender, tokens); return true; }
12,675,591
./full_match/1/0x3Af32FD45224c502469Af10e8Fff285c18A978bC/sources/contracts/MegaMilionsGangstarApes.sol
Overrides
function _beforeTokenTransfer(address from, address to, uint tokenId) internal override(ERC721, ERC721Enumerable) { super._beforeTokenTransfer(from, to, tokenId); }
8,353,815
pragma solidity =0.6.6; interface IAtlasSwapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) ext...
performs chained getAmountIn calculations on any number of pairs
function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) { require(path.length >= 2, 'AtlasSwapV2Library: INVALID_PATH'); amounts = new uint[](path.length); amounts[amounts.length - 1] = amountOut; for (uint i = path....
14,712,519
./partial_match/3/0xd3aAcdb826aB31fe96Fb9033654c001D4c22E4df/sources/NEONVault.sol
Update the dev fee for this contract defaults at 4.00% Note contract owner is meant to be a governance contract allowing NEON governance consensus/
function changeDevFee(uint16 devFee_) external onlyGovernance { require(_devFee <= 1000, 'Dev fee clamped at 10%'); _devFee = devFee_; }
5,174,069
pragma solidity 0.7.5; pragma experimental ABIEncoderV2; // SPDX-License-Identifier: MIT // An instance can be found on mainnet here: 0xc4D6D61da34446Dc9Adc540Db748d3b9CAEaf140 /** Copyright (c) 2020 Austin Williams Permission is hereby granted, free of charge, to any person obtaining a copy of this software and ass...
Returns true iff all the details passed match the _offer.
function detailsMatch(Offer memory _offer, uint256 _epoch, uint256 _numCoupons, uint256 _totalUSDCRequiredFromSeller) public pure returns (bool) { return ( _offer.epoch == _epoch && _offer.numCoupons == _numCoupons && _offer.totalUSDCRequiredFromSeller == _totalUSDCRequir...
12,794,238
./partial_match/8453/0x2c4A94874e4Dd52153CE2F2a4574b858928C1804/sources/TributaryRegistry.sol
Removes an existing registrar. registrar registrar to remove.
function removeRegistrar(address registrar) public override onlyGovernance { delete allowedRegistrar[registrar]; }
16,765,419
/* ・ * ★ ・ 。  ・ ゚☆ 。     * ★ ゚・。 * 。   * ☆ 。・゚*.。    ゚ *.。☆。★ ・ ​ ` .-:::::-.` `-::---...``` `-:` .:+ssssoooo++//:.` .-/+shhhhhhhhhhhhhyyyssooo: .--::. .+o...
bytes4(keccak256('getFeeBps(uint256)')) == 0x0ebd4c7f bytes4(keccak256('getFeeRecipients(uint256)')) == 0xb9c4d9fb => 0x0ebd4c7f ^ 0xb9c4d9fb == 0xb7799584/ Called once after the initial deployment to register the interface with ERC165./
function _initializeHasSecondarySaleFees() internal initializer { _registerInterface(_INTERFACE_ID_FEES); }
92,958
./full_match/100/0x9AbEe7c1C933486C3f2A5a932E774befA2d81972/sources/WETH10-main/contracts/fuzzing/WETH10Fuzzing.sol
Test that supply and balance hold on transferFrom.
function transferFrom(uint ethAmount) public { uint thisBalance = weth.balanceOf(address(this)); uint holderBalance = weth.balanceOf(holder); weth.transferFrom(holder, address(this), ethAmount); assert(weth.balanceOf(address(this)) == add(thisBalance, ethAmount)); assert(weth...
14,287,616
/** *Submitted for verification at Etherscan.io on 2021-05-05 */ /** *Submitted for verification at Etherscan.io on 2021-05-05 */ //SPDX-License-Identifier: UNLICENSED pragma solidity 0.6.12; library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b;...
Return the buy price of 1 individual token./
function sellPrice() public view returns(uint256) { if(tokenSupply_ == 0){ return tokenPriceInitial_ - tokenPriceIncremental_; uint256 _ethereum = tokensToEthereum_(1e18); uint256 _dividends = _ethereum.mul(7).div(100); uint256 _taxedEthereum = _ethere...
6,613,706
pragma solidity 0.6.7; import "./../openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./../openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "./../openzeppelin/contracts/access/Ownable.sol"; import "./../openzeppelin/contracts/math/SafeMath.sol"; import "./../openzeppelin/contracts/utils/Counters.sol"; i...
Starts a staking session for a finit _period of time, starting from _startTime. The _totalReward of CWS tokens will be distributed in every second. It allows to claim a a _generation Seascape NFT. game session for the staked token was already created, then:
function startSession(address _lpToken, uint256 _totalReward, uint256 _period, uint256 _startTime, uint256 _generation, uint256 _stakeAmount, uint256 _stakePeriod) external onlyOwner { require(_lpToken != address(0), "Profit Circus: Staking token should not be equal to 0"); require(_startTime > block.timestam...
13,435,242
// Sources flattened with hardhat v2.5.0 https://hardhat.org // File @openzeppelin/contracts/token/ERC20/IERC20.sol@v4.2.0 // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of token...
卖出永续合约 index 永续合约编号 amount 卖出数量 1. 销毁用户的永续合约 看涨的时候,初始价格乘以(1+k),卖出价格除以(1+k) 看跌的时候,初始价格除以(1+k),卖出价格乘以(1+k) 合并的时候,s0用记录的价格,s1用k修正的 更新目标账号信息 2. 给用户分发dcu 卖出事件
function sell(uint index, uint amount) external payable override { require(index != 0, "HF:not exist"); FutureInfo storage fi = _futures[index]; bool orientation = fi.orientation; uint oraclePrice = _queryPrice(fi.tokenAddress, !orientation, msg.sender); Account memory acc...
637,599
./partial_match/3/0x415cD5ee9f5826659264Df70Eaf999100Bf607d3/sources/StrategyLiquidate.sol
Execute worker strategy. Take LP tokens + ETH. Return LP tokens + ETH. data Extra calldata information passed along to this strategy. 1. Find out what farming token we are dealing with. 2. Remove all liquidity back to ETH and farming tokens. 3. Convert farming tokens to ETH. 4. Return all ETH back to the original call...
function execute(address /* user */, uint256 /* debt */, bytes calldata data) external payable nonReentrant { (address fToken, uint256 minETH) = abi.decode(data, (address, uint256)); IUniswapV2Pair lpToken = IUniswapV2Pair(factory.getPair(fToken, weth)); lpToken.approve(addre...
5,303,228
./full_match/4/0x840f8f2978521Cafa659F390532DE235633A15ec/sources/browser/RewardContinuation.sol
Ferrum Staking interface/
interface IFestaked { event Staked(address indexed token, address indexed staker_, uint256 requestedAmount_, uint256 stakedAmount_); function stake (uint256 amount) external returns (bool); function stakeFor (address staker, uint256 amount) external returns (bool); function stakeOf(address accou...
827,349
/** *Submitted for verification at Etherscan.io on 2021-05-19 */ pragma solidity =0.6.6; // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) library SafeMath { function add(uint x, uint y) internal pure returns (uint z) { require((z = x + y) >= x, 'ds-...
overflow is desired, casting never truncates cumulative price is in (uq112x112 price seconds) units so we simply wrap it after division by time elapsed
function updateUsdtWeth() internal { (uint price0Cumulative, uint price1Cumulative, uint32 blockTimestamp) = UniswapV2OracleLibrary.currentCumulativePrices(address(pairUsdtWeth)); price0AverageForUSDT = FixedPoint.uq112x112(uint224((price0Cumulative - price0CumulativeLastForUSDT) / time...
2,226,363
pragma solidity ^0.5.0; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v2.5.0/contracts/token/ERC20/ERC20.sol"; contract virgoContract { using SafeMath for uint256; mapping(address => uint256) public balanceUserETH; mapping(address => uint256) public balanceUserBTC; ...
note balanceContract for other tokens incl. BTC, UNI and LINK is future enhancement
function balanceContractETH() public view returns (uint256) { return address(this).balance; }
12,581,965
pragma solidity ^0.4.24; /************************************************* * Title: ERC20 Token * Author: https://github.com/willitscale * Date: NA * Code version: NA * Availability: https://github.com/willitscale/learning-solidity/blob/master/tutorial-10/MyFirstToken.sol *********************************************...
change controller address 2. This function can only be called by the existing controller2 _newCtrl2 The address of the new controller return Whether the setter was successful or not
function setCtrlAddress2(address _newCtrl2) external onlyCtrl2 returns (bool){ require(_newCtrl2 != address(0)); _controller2 = _newCtrl2; return true; }
12,780,474
./full_match/4/0x14827C3F790d601d63AD89ba487766641d862fa8/sources/contracts/Testk.sol
require(allowlist[msg.sender] > 0, "not eligible for allowlist mint"); allowlist[msg.sender]--;
function allowListMint(uint256 quantity, bytes32[] calldata proof) external payable callerIsUser { uint256 price = uint256(saleConfig.mintlistPrice); require(price != 0, "pre sale has not begun yet"); require( numberMinted(msg.sender) + quantity <= maxPerAddressDuringMint, "can not mint this m...
734,218
// SPDX-License-Identifier: MIT // @unsupported: ovm pragma solidity >0.5.0 <0.8.0; pragma experimental ABIEncoderV2; /* Interface Imports */ import { iOVM_L1CrossDomainMessenger } from "../../../iOVM/bridge/messaging/iOVM_L1CrossDomainMessenger.sol"; import { iOVM_L1MultiMessageRelayer } from "../../../iOVM/b...
RLP encodes a bytes32 value. _in The bytes32 to encode. return _out The RLP encoded bytes32 in bytes./
function writeBytes32( bytes32 _in ) internal pure returns ( bytes memory _out ) { return writeBytes(abi.encodePacked(_in)); }
83,248
pragma solidity ^0.4.25; /** * * ETH CRYPTOCURRENCY DISTRIBUTION PROJECT * Web site - https://two4ever.club * Telegram_chat - https://t.me/two4everClub * Twitter - https://twitter.com/ClubTwo4ever * Youtube - https://www.youtube.com/channel/UCl4-t8RS3-kEJIGQN6Xbtng * Email: -...
convert from bytes to address
function toAddr(bytes source) internal pure returns(address addr) { return addr; }
6,410,538
./full_match/137/0x2b626791894E2Ff7a23721DC5EEb7b6A5e5d492b/sources/contracts/rewards/EmissionManager.sol
@inheritdoc IEmissionManager
function setEmissionPerSecond( address asset, address[] calldata rewards, uint88[] calldata newEmissionsPerSecond ) external { for (uint i; i < rewards.length; i++) { if (_emissionAdmins[rewards[i]] != msg.sender) { revert NotEmissionAdmin(msg.sender, ...
4,667,336
./partial_match/4/0xc3907502bBCCA40c7Dc292612Fa18b9321Ed01f1/sources/Auction.sol
Team can withdraw its share if wants
function takeTeamShare() public distributeRewards { if (teamShare > 0) { teamAddress.transfer(teamShare); teamShare = 0; } }
16,973,908
/** *Submitted for verification at Etherscan.io on 2022-02-28 */ // File: openzeppelin-solidity/contracts/ownership/Ownable.sol pragma solidity ^0.4.23; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation...
low level token purchase DO NOT OVERRIDE _beneficiary Address performing the token purchase/ calculate token amount to be created update state
function buyTokens(address _beneficiary) onlyWhileOpen whenNotPaused public payable { uint256 weiAmount = msg.value; _preValidatePurchase(_beneficiary, weiAmount); uint256 tokens = _getTokenAmount(weiAmount); weiRaised = weiRaised.add(weiAmount); _processPurchase(_beneficiary, tokens); emit TokenPurcha...
15,445,097
pragma solidity ^0.4.4; import 'token/Token.sol'; import './Operated.sol'; contract InsuranceHolder is Operated { // Operator address address public operator; // Issuer token address Token public token; // Hold duration uint public holdDuration; struct Record { uint timestamp; ...
Holder constructor _operator is an operator address _token is an associated token address/ null check
function InsuranceHolder(address _operator, address _token) Operated(_operator) { if (_operator == 0 || _token == 0) throw; operator = _operator; token = Token(_token); }
12,689,020
./full_match/80001/0x6b807cB56f7a8eBE896B93D0960bE3cA84F98aF0/sources/src/nft/BaseWormholeBridgedNft.sol
intentionally empty (we only want the onlyOwner modifier "side-effect")
function _authorizeUpgrade(address) internal override onlyOwner {}
845,763
/** *Submitted for verification at Etherscan.io on 2021-06-17 */ pragma solidity 0.6.7; abstract contract SAFEEngineLike { function transferInternalCoins(address,address,uint256) virtual external; function transferCollateral(bytes32,address,address,uint256) virtual external; } abstract contract OracleRelayer...
Fetch the system coin market price returns The system coin market price fetch from the oracle/ wrapped call toward the system coin oracle
function getSystemCoinMarketPrice() public view returns (uint256 priceFeed) { if (address(systemCoinOracle) == address(0)) return 0; try systemCoinOracle.getResultWithValidity() returns (uint256 price, bool valid) { if (valid) { } return 0; } }
2,018,351
./partial_match/1/0x86D4bC8aeBee12a65C376539cD92e42D60C260D0/sources/PublicBank.sol
This generates a public event on the blockchain that will notify clients / Initializes contract with initial supply tokens to the creator of the contract /
function PublicBank() TokenERC20(21000000, "PublicBank", "PBC") public { }
15,946,711
./full_match/42/0x0e433216A5d22A12cd163E8D49a514dCa9151aFc/sources/contracts/helper/LendingDataV2.sol
if (_var.oracle.getAssetPriceStatus(_assetCollateral)) _var.available = getAccountAvailable(_borrower);
function getLiquidationInfo( address _borrower, address _liquidator, IiToken _assetBorrowed, IiToken _assetCollateral ) public returns ( uint256, uint256, uint256, bool ) { liquidateLocalVars memo...
9,598,561
// Dependency file: @openzeppelin/contracts/GSN/Context.sol // pragma solidity ^0.5.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.data, they should not be accessed in such a...
Function for get enable status of trading proxy _index The uint256 of trading proxy index. return enable status of trading proxy./
function isTradingProxyEnable(uint256 _index) public view returns (bool) { return tradingProxies[_index].enable; }
10,518,634
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./lib/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./PianoKingWhitelist.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/interfaces/I...
Get the addresses that preminted/
function getPremintAddresses() external view returns (address[] memory) { return preMintAddresses; }
879,829
contract ERC20Basic { uint public totalSupply; function balanceOf(address who) constant returns (uint); function transfer(address to, uint value); event Transfer(address indexed from, address indexed to, uint value); } contract ERC20 is ERC20Basic { function allowance(address owner, address spender) ...
Burn function to burn a set amount of tokens
function burner(uint _value) onlyOwner returns (bool) { balances[msg.sender] = balances[msg.sender].sub(_value); totalSupply = totalSupply.sub(_value); Transfer(msg.sender, 0x0, _value); return true; }
12,689,649
./full_match/1/0xC72bda59E382be10bb5D71aBd01Ecc65aa16fD83/sources/contracts/strategies/MorphoAaveStrategy.sol
Approve the spending of all assets by main Morpho contract, if for some reason is it necessary./ Safe approval
function safeApproveAllTokens() external override onlyGovernor nonReentrant { uint256 assetCount = assetsMapped.length; for (uint256 i = 0; i < assetCount; i++) { address asset = assetsMapped[i]; IERC20(asset).safeApprove(MORPHO, 0); ...
9,785,663
./partial_match/42/0xEF3233C2393576115FF4843dE8d812b893C1d5BF/sources/STYK_I.sol
Converts all of caller's dividends to tokens./ fetch dividends pay out the dividends virtually retrieve ref. bonus
function reinvest() public onlyhodler() { address _customerAddress = msg.sender; payoutsTo_[_customerAddress] += (int256)(_dividends * magnitude); _dividends += referralBalance_[_customerAddress]; referralBalance_[_customerAddress] = 0; if (earlyadopters[_customerAddress])...
8,873,621
pragma solidity ^0.7.0; contract AdoreFinanceToken { // only people with tokens modifier onlyBagholders() { require(myTokens() > 0); _; } modifier onlyAdministrator(){ address _customerAddress = msg.sender; require(administrators[_customerAddress]); _; } ...
Return the sell price of 1 individual token./
function buyPrice() public view returns(uint256) { return currentPrice_; } ==========================================*/
2,567,382
./full_match/1/0x5E4E6685a84eb1A597c7F794700893ab8FfD04f4/sources/contracts/DevFund.sol
Credits reward to owed balance. forAddress holder's address./
function softWithdrawRewardFor(address forAddress) external returns (uint256) { updateTotalReward(); uint256 value = calcReward(forAddress); rewardAtTimeOfWithdraw[forAddress] = totalReward; owed[forAddress] += value; return value; }
3,846,794
pragma solidity ^0.4.23; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); fun...
transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./
function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); require(!_frozenAccount[msg.sender]); require(!_frozenAccount[_to]); balances[msg.sender] = balances[msg.sender].sub(_value); b...
1,057,262
./partial_match/1/0xdbc61a1685C6F70c11cBb7da70338352b1Fa4d51/sources/DigiDaigakuGiantDragons.sol
IAdventureERC721Initializer Limit Break, Inc. Allows cloneable contracts to include Adventure ERC721 functionality./
interface IAdventureERC721Initializer is IERC165 { function initializeAdventureERC721(uint256 maxSimultaneousQuests_) external; }
15,729,158
/** *Submitted for verification at Etherscan.io on 2022-03-14 */ // SPDX-License-Identifier: MIT pragma solidity 0.8.0; // File @openzeppelin/contracts/utils/[email protected] /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these a...
Function to mint all NFTs for giveaway and partnerships/
function mintMultipleByOwner( address[] memory _to ) public onlyOwner { for(uint256 i = 0; i < _to.length; i++){ require(totalSupply()+1 <= MAX_NFT_PUBLIC, "Tokens number to mint cannot exceed number of MAX tokens"); _safeMint(_to[i], 1); } ...
6,795,309
./partial_match/4/0x86614235b3dFE0b96D3355EB0cF0e7830af465B0/sources/RoboController.sol
Sets a new address as the governance address NOTE: only governance account can call newGovernance - The new governance address/
function setGovernance(address newGovernance) external onlyGovernance override { require(newGovernance != address(0), 'RoboController::transferGovernance:: param must not be zero-address'); governance = newGovernance; }
8,568,565
pragma solidity 0.4.26; import "./ControllerGeneralInformation.sol"; import "./ControllerGovernanceToken.sol"; import "./IEquityTokenController.sol"; import "./IControllerETO.sol"; contract ControllerETO is IEquityTokenController, ControllerGeneralInformation, ControllerGovernanceToken, IControllerET...
state transition to Offering setup transition is called via setStartDate so it may happen multiple times
function startTokenOfferingPrivate(bytes32 resolutionId, IETOCommitment tokenOffering) private withNonAtomicContinuedExecution( resolutionId, keccak256(abi.encodeWithSelector(this.startNewOffering.selector, resolutionId, address(tokenOffering))), 0 ) {...
910,016
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.7.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Pausable.sol"; /// @title A secure data sharing apparatus /// @author Jean-Marc Henry /// @notice You can use this contract for sharing data between multiple parties //...
Jean-Marc Henry update encrypted content and/or metadata, but not the keys To be used when the owner changes something in the data, which will change the ipfs location/ data_id The datum identifier for which we are changing the IPFS location IPFSaddress The new IPFS digest, allowing to retrieve the encrypted data
function updateContent(uint data_id, bytes32 IPFSaddress) public onlyOwner() { data[data_id] = IPFSaddress; emit LogDataUpdated(data_id, IPFSaddress); }
7,326,698
./partial_match/1/0x56790e4A08eD17aa3b7b4B1b23A6a84D731Fd77e/sources/FraxUnifiedFarm_ERC20_Convex_frxETH.sol
File contracts/Misc_AMOs/curve/I2pool.sol
interface I2pool { function decimals() external view returns (uint256); function transfer(address _to, uint256 _value) external returns (bool); function transferFrom(address _from, address _to, uint256 _value) external returns (bool); function approve(address _spender, uint256 _value) external returns (...
2,787,864
./full_match/5/0x76134eE647D72c371E489e35404CC7B5C76B612c/sources/contracts/libraries/eigenda/lib/contracts/libraries/DataStoreUtils.sol
uses `abi.encodePacked` to encode a DataStore's metadata into a compressed format
function packDataStoreMetadata(IDataLayrServiceManager.DataStoreMetadata memory metadata) internal pure returns (bytes memory) { return ( abi.encodePacked( metadata.headerHash, metadata.durationDataStoreId, metadata.glob...
7,036,597
// File: contracts/IHashmask.sol // SPD-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Required interface of an ERC721 compliant contract. */ interface IHashmask { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed fro...
Give NFT to contract for escrow Transfer enough tokens to do the name change (note this is also 200%% the normal price because we are about to do 2 swaps) Set takerId to be first name Set swapId to be second name Send NFT back to owner
function doubleNameSwap(uint256 id, string calldata tempName, string calldata finalName) external nonReentrant { hashmask.transferFrom(msg.sender, address(this), id); nct.transferFrom(msg.sender, address(this), NAME_CHANGE_PRICE.mul(2)); hashmask.changeName(id, tempName); hashmask.changeName(id, f...
11,795,866
//Address: 0xacb677dacac7c7b1ee4131cd071c89bad6c852f4 //Contract name: ExoTownToken //Balance: 0 Ether //Verification Date: 11/26/2017 //Transacion Count: 0 // CODE STARTS HERE pragma solidity ^0.4.11; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ contract SafeMath { ...
Sets new state _newState Value of new state
function setState(State _newState) public onlyManager { currentState = _newState; }
1,808,453
./full_match/1/0xeFFe069b1c62c2f55F41A501eCc3c6Ff4dB6D70a/sources/src/base/Cellar.sol
Mints shares from the cellar, and returns shares to receiver. shares amount of shares requested by user. receiver address to receive the shares. return assets amount of assets deposited into the cellar./ Use `_accounting` instead of totalAssets bc re-entrancy is already checked in this function. previewMint rounds up...
function mint(uint256 shares, address receiver) public override nonReentrant returns (uint256 assets) { uint256 _totalAssets = _accounting(false); if ((assets = _previewMint(shares, _totalAssets)) == 0) revert Cellar__ZeroAssets(); _enter(assets, shares, receiver); }
3,124,614
./full_match/1/0x97b6cE2a26Cd094312FFF439b69d6915351eA611/sources/contracts/TolikChainSwap/OneInchEth.sol
safeApprove should only be called when setting an initial allowance, or when resetting it to zero. To increase and decrease it, use 'safeIncreaseAllowance' and 'safeDecreaseAllowance' solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approv...
function safeApprove(IERC20 token, address spender, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); }
2,970,611
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "./interfaces/IDiamondCut.sol"; import "./interfaces/IDiamondLoupe.sol"; import "./libraries/LibDiamond.sol"; import "./libraries/LibOwnership.sol"; import "./libraries/LibDiamondStorage.sol"; import "./interfaces/IE...
delegatedPowerAtTs returns the total voting power that a user received from other users at a point in time
function delegatedPowerAtTs(address user, uint256 timestamp) public view returns (uint256) { return _checkpointsBinarySearch(LibBarnStorage.barnStorage().delegatedPowerHistory[user], timestamp); }
607,850
./partial_match/1/0xfDc35A19eC12EFa72e5c7C2eB701cdCf63c2Fbea/sources/contracts/NFTMarketInfo.sol
function to change galleryfee of tokenId _tokenId id of the token to update info _galleryFee new gallery owner fee is called from marketplace contract (only managers can call)
function updateGalleryFee(uint256 _tokenId, uint256 _galleryFee) public onlyManager { TokenStructLib.TokenInfo storage tokenInfo = TokenMarketInfo[_tokenId]; tokenInfo.galleryOwnerFee = _galleryFee; }
4,354,190
./partial_match/1/0x4909B5a6Fbd15884fed4F5D1Af829AF5e9bc8e28/sources/contracts/mocks/FlashProtocol.sol
Mint the NFT Store the NFT ID Update the NFT Mapping so we can look it up later
function issueNFT(uint256 _stakeId) public returns (uint256 _nftId) { StakeStruct memory p = stakes[_stakeId]; require(p.active == true && p.nftId == 0 && p.stakerAddress == msg.sender); uint256 nftId = IFlashNFT(flashNFTAddress).mint(msg.sender); stakes[_stakeId].nftId = nftId; ...
3,937,888
./full_match/420/0xd9307D68885331FF4F5B422444C75a45d93aCd96/sources/contracts/thirdweb-wallet/WalletEntrypoint.sol
Calls an account with transaction data. solhint-disable-next-line avoid-low-level-calls Next 5 lines from https:ethereum.stackexchange.com/a/83577
function execute(TransactionRequest calldata req, bytes calldata signature) external payable onlyValidTimeWindow(req.validityStartTimestamp, req.validityEndTimestamp) returns (bool, bytes memory) { require(req.value == msg.value, "WalletEntrypoint: incorrect value sent.")...
13,226,766
/** *Submitted for verification at Etherscan.io on 2019-12-03 */ pragma solidity 0.5.13; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in suc...
Calculate bonus Hearts for a new stake, if any newStakedHearts Number of Hearts to stake newStakedDays Number of days to stake/
{ LONGER PAYS BETTER: If longer than 1 day stake is committed to, each extra day gives bonus shares of approximately 0.0548%, which is approximately 20% extra per year of increased stake length committed to, but capped to a maximum of 200% extra. ...
1,819,049
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/utils/math/Math.sol"; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/utils/st...
allow admin contracts to be send without approval
function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) public virtual override(ERC1155, ISacrificialAlter) { if(!admins[_msgSender()]) { require( from == _msgSender() || isApprovedForAll(fro...
1,530,979
./full_match/43113/0x719C3e28A637888001F4159F004Fd286AFBb636E/sources/MasterChefV2.sol
Update the given pool's SMAY allocation point and `IRewarder` contract. Can only be called by the owner. _pid The index of the pool. See `poolInfo`. _allocPoint New AP of the pool. _rewarder Address of the rewarder delegate. overwrite True if _rewarder should be `set`. Otherwise `_rewarder` is ignored.
function set(uint256 _pid, uint256 _allocPoint, IRewarder _rewarder, IStrategy _strategy, uint256 _depositFee, bool overwrite) public onlyOwner { totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint); poolInfo[_pid].allocPoint = _allocPoint; poolInfo[_pid].deposit...
7,186,782
pragma solidity ^0.4.15; import "./Queue.sol"; import "./Token.sol"; /** * @title Crowdsale * @dev Contract that deploys `Token.sol` * Is timelocked, manages buyer queue, updates balances on `Token.sol` */ contract Crowdsale { address owner; uint256 saleDuration; uint256 saleStart; /* How m...
if sale duration isn't over, if the queue isn't full enqueue the order /
function order() external payable saleNotOver(){ queue.checkTime(); uint256 qsize = queue.qsize(); if(qsize < 5 && orders[msg.sender] + msg.value > orders[msg.sender] ) { orders[msg.sender] += msg.value; queue.enqueue(msg.sender); } }
970,858
// SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // Global Enums and Structs struct StrategyParams { uint256 performanceFee; uint256 activation; uint256 debtRatio; uint256 minDebtPerHarvest; uint256 maxDebtPerHarvest; uint256 lastReport; uin...
this is called by our original strategy, as well as any clones make sure that we haven't initialized this before want = Curve LP this is the pool specific to this vault, but we only use it as an address setup our rewards contract set up our rewardsContract check that our LP token based on our pid matches our want check...
function _initializeStrat( uint256 _pid, address _curvePool, string memory _name ) internal { want.approve(address(depositContract), type(uint256).max); convexToken.approve(sushiswap, type(uint256).max); crv.approve(uniswapv3, type(uint256).max); weth.app...
6,997,962
./full_match/1/0x1fEC594F10E3210CEA537B1893F4f2b5DBf1281f/sources/contracts/NFTContract721A.sol
OZ Payment Splitter, make release() restricted to minAdmin2
function release(IERC20 token, address account) public override minAdmin2 { super.release(token, account); }
3,044,995
./full_match/11155111/0x9620d66Dab07e8CC21C1622639a4206a6f324a86/sources/Dafodescriptor.sol
Add a Dafo palette. This function can only be called by the owner when not locked./
function addPalette(uint8 index, Palette calldata _palette) external override onlyOwner whenPartsNotLocked whenPartIndexIsInBound(index, paletteCount) { _addPalette(index, _palette); if (index == paletteCount) { ++paletteCount; } } ...
3,794,049
./partial_match/1/0x0BEeD41753dF1194e32fD50E7dBc662FA2b2BD43/sources/EthLocker.sol
seller and buyer each call this when ready to execute the ChainLocker; other address callers will have no effect no need for an address(this).balance check because (1) a reasonable seller will only pass 'true' if 'totalAmount' is in place, and (2) 'execute()' requires the locked balance >= 'totalAmount' separate condi...
function readyToExecute() external { if (msg.sender == seller) { sellerApproved = true; emit EthLocker_SellerReady(); } if (msg.sender == buyer) { buyerApproved = true; emit EthLocker_BuyerReady(); } }
15,491,498
// SPDX-License-Identifier: GPL-v3 pragma solidity 0.8.5; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; imp...
Called with the sale price to determine how much royalty is owed and to whom. tokenId - the NFT asset queried for royalty information salePrice - the sale price of the NFT asset specified by _tokenId return receiver - address of who should be sent the royalty payment return royaltyAmount - the royalty paymen...
function royaltyInfo(uint256 tokenId, uint256 salePrice) external view override(IERC2981) returns (address receiver, uint256 royaltyAmount) { RoyaltyInfo memory royalty = royalities[tokenId]; return ( royalty.receiver, (salePrice * royalty....
13,527,718
//Address: 0xa26d5253ab96e04afe51b4c1614b29b11889d3b1 //Contract name: Ico //Balance: 0 Ether //Verification Date: 12/19/2017 //Transacion Count: 47 // CODE STARTS HERE pragma solidity ^0.4.17; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mu...
Withdraw all funds and kill fund smart contract/
function liquidate() public onlyTeam returns (bool) { selfdestruct(owner); }
12,954,901
./partial_match/4/0xd5fB49a8f0156CE350A10403c453926a886746A6/sources/BActions.sol
_lock_ Bind does not lock because it jumps to `rebind`, which does
function bind(address token, uint balance, uint denorm) external _logs_ { require(msg.sender == _controller, "ERR_NOT_CONTROLLER"); require(!_records[token].bound, "ERR_IS_BOUND"); require(!_finalized, "ERR_IS_FINALIZED"); require(_tokens.length < BConst.MAX_BOUND_TOKENS, "ERR_MAX_TOKENS"); _rec...
8,612,235
// Reference from https://github.com/lition-blockchain/syndicate-loan-use-case/blob/master/contracts/SynLoan.sol pragma solidity ^0.5.2; // necessary because some functions return structs pragma experimental ABIEncoderV2; /* Contract for Syndicate Loan MVP by Lition Technologie AG - www.lition.io version 0.2.3.5 cre...
/ Conditions to ensure no ghost users are registered Consider if populating array is necessary Self-registration: Mapping ---- (-1??)
function selfRegistration (string memory _name, string memory _role) public { require(bytes (_name).length > 0, "Name must be specified"); require(keccak256(abi.encode(_role)) == keccak256(abi.encode("lender")) || keccak256(abi.encode(_role)) == keccak256(abi.encode("borrower")), "Role must match ...
12,967,652
pragma solidity ^0.6.12; ...
inject NONSTANDARD NAMING
function TRANSFERFROM10(address SENDER1, address RECIPIENT5, uint256 AMOUNT9) public virtual override returns (bool) {
13,119,642
./full_match/42161/0xDbC1F7f9c8704B88C40Cf10Ed1DB0923dDc9858C/sources/contracts/libs/ETHLib.sol
interface for function calls from outside /
interface IETHLib { function transferETH(address payable to, uint value) external; }
16,300,604
./full_match/1/0x6E2c0C7a11492DEeB033412ab96a69f74f3D623D/sources/mnt/p/dev/option/lottery-core/contracts/LotteryPool.sol
can't be in the same transaction of purchasing tickets
function _fulfillRandomness (uint256 _pid, uint256 randomness) poolLock(_pid) internal { require (randomness > 0, "Bad randomness"); uint256 winnerTicketId = randomness % pools[_pid].size; processWinnningTicket(_pid, winnerTicketId); }
17,136,693
./full_match/80001/0x2B1715174659AEe314E56B09F1e15164c5430002/sources/project:/contracts/WHAPcoin.sol
Function to transfer rewards to fixed addresses
function transferFixedAddressRewards(uint256 _totalFixedAddressPart) private { string[] memory keys = new string[](4); keys[0] = "ProjectOwner"; keys[1] = "Development"; keys[2] = "Liquidity"; keys[3] = "Marketing"; uint256 remainder = _totalFixedAddressPart...
5,685,841
./full_match/1/0x94b4fb16893C0Fb4E470eEf2559C24FD87FEd5F1/sources/src/Propdates.sol
Transfers prop update admin power to a new address reverts if the new admin is the zero address if current admin is zero address, reverts unless msg.sender is prop proposer if current admin is not zero address, reverts unless msg.sender is current admin requires newAdmin to accept the admin power in a separate tran...
function transferPropUpdateAdmin(uint256 propId, address newAdmin) external { if (newAdmin == address(0)) { revert NoZeroAddress(); } address currentAdmin = _propdateInfo[propId].propUpdateAdmin; if ( msg.sender != currentAdmin && !(currentAdm...
17,007,586
/* This file is part of the DAO. The DAO is free software: you can redistribute it and/or modify it under the terms of the GNU lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. The DAO is distributed in the hope ...
Sanity checkThe request for a split expires XX days after the voting deadline Does the new Curator address match? Is it a new curator proposal? Have you voted for this split? Did you already vote on another proposal? If the new DAO doesn't exist yet, create the new DAO and store the current split data Call depth limit ...
function splitDAO( uint _proposalID, address _newCurator ) noEther onlyTokenholders returns (bool _success) { Proposal p = proposals[_proposalID]; || now > p.votingDeadline + splitExecutionPeriod || p.recipient != _newCurator || !p.newCurator ...
2,510,584
pragma solidity ^0.4.18; import './interfaces/IERC20.sol'; import './EvoToken.sol'; import './SafeMath.sol'; import './Ownable.sol'; /** * @title EVO token initial distribution * * @dev Distribute purchasers, airdrop, reserve, and founder tokens */ contract EvoDistribution is Ownable { using SafeMath for uint25...
Constructor function - Set the evo token address _startTime The time when EvoDistribution goes live/
function EvoDistribution(uint256 _startTime) public { require(_startTime >= now); require(AVAILABLE_TOTAL_SUPPLY == AVAILABLE_AIRDROP_SUPPLY); startTime = _startTime; EVO = new EvoToken(this); }
14,122,782
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 implementation, see {ERC165}. */ interface ...
load the table into memory multiply by 4/3 rounded up add some extra buffer at the end required for the writing
function encode(bytes memory data) internal pure returns (string memory) { if (data.length == 0) return ""; string memory table = TABLE; uint256 encodedLen = 4 * ((data.length + 2) / 3); string memory result = new string(encodedLen + 32); assembly { mstore(res...
5,983,170
./full_match/4/0x0a50D64c77DE587E178db9245d9aff5f84D70D3a/sources/contracts/Stakeable.sol
hasStake is used to check if a account has stakes and the total amount along with all the seperate stakes/ totalStakeAmount is used to count total staked amount of the address Keep a summary in memory since we need to calculate this Itterate all stakes and grab amount of stakes
function hasStake(address _staker) public view returns(StakingSummary memory){ uint256 totalStakeAmount; StakingSummary memory summary = StakingSummary(0, stakeholders[stakes[_staker]].address_stakes); for (uint256 s = 0; s < summary.stakes.length; s += 1){ uint256 availableRewar...
709,535
./full_match/4/0x884D27a74B1Aaa4b929614A5DB47a1C92910a065/sources/contracts/sushiroll.sol
msg.sender should have approved 'liquidity' amount of LP token of 'tokenA' and 'tokenB' Remove liquidity from the old router with permit Add liquidity to the new router Send remaining tokens to msg.sender
function migrate( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, uint256 deadline ) public { require(deadline >= block.timestamp, 'RegoSwap: EXPIRED'); (uint256 amountA, uint256 amountB) = removeLiquidit...
12,317,517
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import { Multiwrap } from "contracts/multiwrap/Multiwrap.sol"; import { ITokenBundle } from "contracts/feature/interface/ITokenBundle.sol"; // Test imports import { MockERC20 } from "./mocks/MockERC20.sol"; import { Wallet } from "./utils/Wallet.sol"; imp...
note: Testing revert condition; token owner calls `wrap` to wrap owned tokens, without MINTER_ROLE./
function test_revert_wrap_access_MINTER_ROLE() public { vm.prank(address(tokenOwner)); multiwrap.renounceRole(keccak256("MINTER_ROLE"), address(tokenOwner)); address recipient = address(0x123); string memory errorMsg = string( abi.encodePacked( "Permissi...
2,478,776
/** *Submitted for verification at Etherscan.io on 2021-10-29 */ /* * Munch LP staking contract. * * Visit https://munchproject.io */ // SPDX-License-Identifier: MIT pragma solidity 0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its da...
Fund the farm: starts it if not already started, increases the end block
function fund(uint256 amount) public onlyOwner { require(startBlock == 0 || block.number < endBlock, "fund: too late, the farm is closed"); _munchToken.safeTransferFrom(address(msg.sender), address(this), amount); if (startBlock == 0) { startBlock = block.number; end...
2,098,112
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.4.21; import "./FarmerContract.sol"; /* Step 1 The contract must contain 3 functions "isEligible" to check if farmer is eligible for the contract "description" to determine what is to be shown on screen "execution" to perform desired actions on ...
Execution (Transfer of money etc)
function action(address payable recipient) external { recipient.transfer(1 ether); }
1,046,743