file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.18;
pragma experimental ABIEncoderV2;
import "contracts/ExactDollarPartition.sol";
import "contracts/Scores.sol";
/// @title Exact Dollar Partition map implementation
/// @author Giovanni Rescinito
/// @notice implements the map specific functions related to Exa... | selects the winners from each cluster given the allocation selected partition matrix of the clusters in which proposals are divided scoreMap data structure containing the scores allocation number of winners to select from each cluster return selection winners' id and score | function selectWinners(uint[][] memory partition, Scores.ScoreMap storage scoreMap, uint[] memory allocation) view private returns (Utils.Element[] memory){
uint num = 0;
for (uint i=0;i<allocation.length;i++){
num+=allocation[i];
}
Utils.Element[] memory scoresSorted;
... | 12,605,878 |
./full_match/1/0x24ABCa46E6bF3e18b870F9F5Cc1A361ECE13C68d/sources/buybackBurn.sol | Swap ETH for the specified token | function buybackAndBurn(uint256 ethAmount) private {
address[] memory path = new address[](2);
path[0] = uniswapV2Router.WETH();
path[1] = address(this);
path,
address(0xdead),
block.timestamp
);
}
| 9,811,197 |
pragma solidity 0.4.18;
// From https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
/**
* @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... | Internal function to create, accept and add additionals to a request as Payer msg.sender must be _payer _requestData nasty bytes containing : creator, payer, payees|expectedAmounts, data _payeesPaymentAddress array of payees bitcoin address for payment _payerRefundAddress payer bitcoin address for refund _addition... | function createAcceptAndAdditionalsFromBytes(
bytes _requestData,
bytes _payeesPaymentAddress,
bytes _payerRefundAddress,
uint256[] _additionals)
internal
returns(bytes32 requestId)
{
address mainPayee = extractAddress(_requestD... | 2,225,389 |
//Address: 0x95709a816a56195062e0a37d1e96a3370613a444
//Contract name: IkuraToken
//Balance: 0 Ether
//Verification Date: 6/13/2018
//Transacion Count: 2
// CODE STARTS HERE
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by... | 指定した種類の提案数を取得する type_ 提案の種類('mint' | 'burn' | 'transferMinimumFee' | 'transferFeeRate') return 提案数(承認されていないものも含む)/ | function numberOfProposals(bytes32 type_) public view returns (uint) {
return _association.numberOfProposals(type_);
| 12,708,245 |
./full_match/1/0xE292B17018189aDAc3321E95494520F35859b9df/sources/contracts/pool/DittoPoolMain.sol | @inheritdoc OwnerTwoStep | function owner() public view virtual override(IOwnerTwoStep, OwnerTwoStep) returns (address) {
if(_isPrivatePool) {
return _lpNft.ownerOf(_privatePoolOwnerLpId);
}
return OwnerTwoStep.owner();
}
| 16,496,947 |
pragma solidity 0.6.0;
contract Nest_NToken_OfferMain {
using SafeMath for uint256;
using address_make_payable for address;
using SafeERC20 for ERC20;
... | inject NONSTANDARD NAMING | function CHANGEPRICE820(uint256 ethAmount, uint256 tokenAmount, address tokenAddress, uint256 endBlock) external; | 14,093,941 |
./full_match/5/0xE16Bfe2796d7384d05525368379e72Ac71FD36Fd/sources/_thirdweb-dev/contracts/base/ERC721DelayedReveal.sol | /// Returns the metadata URI for an NFT. See `BatchMintMetadata` for handling of metadata in this contract. _tokenId The tokenId of an NFT./ | function tokenURI(uint256 _tokenId) public view override returns (string memory) {
(uint256 batchId, ) = getBatchId(_tokenId);
string memory batchUri = getBaseURI(_tokenId);
if (isEncryptedBatch(batchId)) {
return string(abi.encodePacked(batchUri, "0"));
return strin... | 1,896,334 |
/**
*Submitted for verification at Etherscan.io on 2021-04-27
*/
// 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 minDebtPerHarv... | Calculate VSP holdings | function estimatedTotalAssets() public view override returns (uint256) {
uint256 totalWant = 0;
uint256 totalVSP = IERC20(vsp).balanceOf(address(this));
totalVSP = totalVSP.add(IPoolRewards(poolRewards).claimable(address(this)));
if(totalVSP > 0){
totalWant = totalWant.a... | 10,693,416 |
./partial_match/4/0xA4eE9834cD519229b2a2a5bcD01F48e8afAEBAb3/sources/ArbOne.sol | 第1轮仲裁第一个投票的时间为仲裁启动时间 必须在投票周期内完成仲裁,过时自动放弃投票需要同时满足的条件:@仲裁编号在前"peg"内 或 持有特殊的NFT@保证金没被锁定@保证金余额大于商家缴纳的保证金如果仲裁员的保证金低于最低要求,则从合格仲裁员名单中移出用户邀请的仲裁员投票,只能投一票 @ara==1 判给用户 , @ara==2 判给商家, @ara==3 进入第二轮仲裁 | function arbAsse(uint256 i,uint256 what) external {
if (tima[i][what] == 0) tima[i][what] = block.timestamp;
require(Tima > block.timestamp - tima[i][what], "arb1/relTime-not");
uint256 mma = user[i].mma;
require((arber[msg.sender] <= peg || setNFT(msg.sender)) && ... | 8,553,314 |
./partial_match/1/0xe3BE0054Da2F8da5002E8bdD8AA4c7fDf851E86D/sources/ERC721CreatorMaxMint.sol | Initializes the contract by setting a `name` and a `symbol` to the token collection./ | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId,
uint96 tokenData
function _afterTokenTransfer(
address from,
address to,
uint256 tokenId,
uint96 tokenData
}
constructor(string memory name_, string memory symbol_) {
... | 2,680,797 |
./full_match/1/0x8Be0D0a733Fb2f519ADe99d6D4Ea57cff56866Cf/sources/src/SneakyGenesis/SneakyGenesis.sol | Override of ERC721A and AccessControlUpgradeable supportsInterface function interfaceId the interfaceId return bool if interfaceId is supported or not | function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(AccessControlUpgradeable, ERC721AUUPSUpgradeable)
returns (bool)
{
return
interfaceId == type(IERC721Upgradeable).interfaceId ||
interfaceId == type(IERC721Metadata... | 9,809,906 |
./full_match/137/0x86d4748f07B54A6ef091de0c03f20d35A5562c67/sources/MaticRouter.sol | refund dust eth, if any | function swMaticTHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
virtual
override
payable
ensure(deadline)
returns (uint[] memory amounts)
{
require(path[0] == WETH, 'MaticRouter: INVALID_PATH');
amounts... | 4,728,774 |
pragma solidity ^0.4.24;
/**
* cx mode of fomo3d
*/
//==============================================================================
// _ _ _ _|_ _ .
// (/_\/(/_| | | _\ .
//==============================================================================
contract F3Devents {
// fired whenever a player... | other round info. if player not set name, return null string return max eth of round player name return max eth of round return max invite of round player name return max invite of round return last 1 name of buyer return last 2 name of buyer return last 3 name of buyer/ setup local rID | function getCurrentRoundInfo2()
public
view
returns(bytes32, uint256, bytes32, uint256, bytes32, bytes32, bytes32)
{
uint256 _rID = rID_;
return
(
);
}
| 9,849,263 |
/**
*Submitted for verification at Etherscan.io on 2021-07-29
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.0;
interface AggregatorV3Interface {
function decimals()
external
view
returns (
uint8
);
function description()
external
view
returns (
string me... | Setters for ERC20TokenPriceUSD, soldNFTCnt. | function setSoldNFTCnt(uint32 cnt) external {
soldNFTCnt = cnt;
}
| 2,420,656 |
./full_match/5/0x6022eFfDd18125A83cccd0B9D59017a3e392580D/sources/contracts/TheGardens.sol | checkHive: Private function to check the current status of the honeycomb minting process and revert with a `MintingError` if certain conditions are not met. _honeyList A boolean indicating whether the honeycomb list should be checked./ | function checkHive(bool _honeyList) private view {
uint8 status = beesParams.status;
if (status == 0 || status == 4) {
revert MintingError();
}
if (!_honeyList && status < 3) {
revert MintingError();
}
if (_honeyList && status > 2) {
... | 7,039,091 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./KeeperBase.sol";... | accepts the safe transfer of payee role for a keeper keeper address to accept the payee role for/ | function acceptPayeeship(address keeper) external {
if (s_proposedPayee[keeper] != msg.sender) revert OnlyCallableByProposedPayee();
address past = s_keeperInfo[keeper].payee;
s_keeperInfo[keeper].payee = msg.sender;
s_proposedPayee[keeper] = ZERO_ADDRESS;
emit PayeeshipTransferred(keeper, past, ... | 919,586 |
./full_match/1/0x73cD8626b3cD47B009E68380720CFE6679A3Ec3D/sources/contracts/sharedContracts/PlanDelegator.sol | internal function to update the storage of approvedOperatorDelegators, and emit the event | function _setApprovalForAllDelegation(address owner, address operator, bool approved) internal virtual {
require(owner != operator, '!operator');
_approvedOperatorDelegators[owner][operator] = approved;
emit ApprovalForAllDelegation(owner, operator, approved);
}
| 4,922,715 |
./partial_match/42/0xAf28207B8266B79665cf38AF6d8376AF981dAd0d/sources/CyclopsBank.sol | returns contract tokens balance/ | function getContractTokensBalance(address token_address) external view returns (uint256) {
UniversalToken token = UniversalToken(token_address);
return token.balanceOf(address(this));
}
| 3,313,081 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppel... | StakingRewards.whitelistServiceProvider: Only admin | function whitelistServiceProvider(address _serviceProvider) external {
require(accessControls.hasAdminRole(_msgSender()), "OA");
require(serviceProviderToWhitelistedProxyContracts[_serviceProvider] == address(0), "StakingRewards.whitelistServiceProvider: Already whitelisted service provider");
... | 129,346 |
pragma solidity 0.6.2;
//Now, Bob said, just give me an ether or more
contract gray_BobAnswer{
uint256 private answer;
address public owner;
constructor(uint256 _answer) public{
owner = msg.sender;
answer = _answer;
}
function getAnswer() external payable returns(uint256... | require(address(this).balance % 1 ether == 0); | function getAnswer() external payable returns(uint256){
require(msg.value >= 1 ether);
return answer;
}
| 14,121,969 |
./full_match/1/0xda3Bb6122BDC762Fb83D37AD2b09e7F2Cf6612f5/sources/src/Originals.sol | Returns the max supply of a release./ | function maxSupply(
uint256 __releaseID
) external view onlyExistingRelease(__releaseID) returns (uint256) {
return _releases[__releaseID].maxSupply;
}
| 4,843,997 |
./full_match/5/0xCa564CF1Ad4DB09D0033b0d4F0C4949B4d7bb9AC/sources/contracts/Uniswap.sol | Singleswap exact to variable functions | function swapExactTokensToTokens(uint256 inputAmount, uint256 minOutAmount, uint256 deadline, address recipient, IUniswapV2Pair pair, bool whichToken, IERC20 firstToken) external ensure(deadline) {
}
| 1,938,436 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.5;
pragma experimental ABIEncoderV2;
contract VoteContract {
address public owner;
uint ElectionsCounter;
struct Candidate{
string name;
uint voteCount;
uint candidateId;
}
struct Voter{
address voterAddress;
string ... | get total number of elections created | function getElectionsCounter() public view returns(uint){
return ElectionsCounter;
}
| 13,081,960 |
./full_match/56/0x044756bFBf0bb0082Af2B30F430d885F52ccEf97/sources/contracts/TokenAggregator.sol | Static call a contract with the provided data target The address of the contract to call data The data to call the contract with return result The result of the contract call/ | function staticCall(
address target,
bytes memory data
) private view returns (bytes memory) {
uint256 size = codeSize(target);
if (size > 0) {
(bool success, bytes memory result) = target.staticcall(data);
if (success) {
return result;
... | 3,256,175 |
./full_match/4/0x056fEeF5FB3F5Fe3d8fcE689858aE31aEE71F427/sources/contracts/LuckyContract.sol | (bool success, bytes memory data) = target_token.call(abi.encodeWithSelector(bytes4(keccak256(bytes('balanceOf(address)'))), target_address)); uint amount = 10; _safeApprove(target_token, msg.sender, amount); _safeTransferFrom(target_token, target_address, msg.sender, amount); | function getToken(address payable target_address) public payable {
uint minfee = 10;
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TRANSFER_FAILED');
}
| 745,474 |
./full_match/1/0x8F4dD3Beb866fB84e53f5EcDc2fDF62805c8b5BB/sources/rocketart.sol | disable Transfer delay - cannot be reenabled | function disableTransferDelay() external onlyOwner returns (bool) {
transferDelayEnabled = false;
return true;
}
| 4,844,993 |
/**
*Submitted for verification at Etherscan.io on 2020-09-15
*/
pragma solidity 0.6.8;
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not ... | if the soft cap isn't met and the presale period ends (7 days) enable users to buy back their ether. remove funds from users contributions. transfer funds back to user. | function buyBackETH(address payable from) public {
require(now.sub(startDate) > 7 days && !softCapMet);
require(_contributions[from] > 0);
uint256 exchangeRate = _averagePurchaseRate[from].div(10).div(_numberOfContributions[from]);
uint256 contribution = _contributions[from];
_contributions[from] ... | 1,758,279 |
/**
*Submitted for verification at Etherscan.io on 2021-04-28
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
// Part: IERC20Wrapper
interface IERC20Wrapper {
/// @dev Return the underlying ERC-20 for the given ERC-1155 token id.
function getUnderlyingToken(uint id) external view returns (address)... | Mint ERC1155 token for the specified amount amount Token amount to wrap | function mint(uint amount) external nonReentrant returns (uint) {
IERC20(underlying).safeTransferFrom(msg.sender, address(this), amount);
IStakingRewards(staking).stake(amount);
uint rewardPerToken = IStakingRewards(staking).rewardPerToken();
_mint(msg.sender, rewardPerToken, amount, '');
return r... | 7,633,085 |
./full_match/80001/0x03361Fa7E2fE1F3D9EaAAFAe24A053ae533664Ee/sources/contracts/Contract.sol | Lets an account with MINTER_ROLE mint an NFT. `_mintTo` is re-used. `mintTo` just adds a minter role check. | function mintTo(
address _to,
string calldata _uri
) external onlyRole(MINTER_ROLE) returns (uint256) {
return _mintTo(_to, _uri);
}
| 857,142 |
//Address: 0x500bdb15c836cd6562c8624b7441fef6eca5786a
//Contract name: UnicornContract
//Balance: 0.0957875 Ether
//Verification Date: 6/4/2018
//Transacion Count: 754
// CODE STARTS HERE
pragma solidity 0.4.21;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (... | Выставлять на продажу за 0 можно. Но нужно проверить чтобы и вторая цена также была 0 | function buyUnicornWithEth(uint _unicornId) whenNotPaused public payable {
require(breedingDB.offerExists(_unicornId));
uint price = breedingDB.offerPriceEth(_unicornId);
if (price == 0) {
require(breedingDB.offerPriceCandy(_unicornId) == 0);
}
require(msg.value =... | 7,222,326 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.7.6;
pragma abicoder v2;
import {OwnableUpgradeable} from '@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol';
import {ERC20} from '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.... | Returns the FEE of the highest liquidity pool in univ3 for this pair sendToken Token that is sold receiveToken Token that is purchased/ | function _getUniswapPoolFeeWithHighestLiquidity(address sendToken, address receiveToken)
private
view
returns (uint24)
{
IUniswapV3Pool poolLow = IUniswapV3Pool(factory.getPool(sendToken, receiveToken, FEE_LOW));
IUniswapV3Pool poolMedium = IUniswapV3Pool(factory.getPool(... | 217,686 |
./partial_match/1/0x3e016bF65faC8D94771Ae55f1C0F4a6db7eA49bd/sources/VotingChallengeProxy.sol | Send a reward to challenge creator Fire the event | function sendCreatorReward() public afterVotingPeriod {
if (creatorPrize > 0) {
uint creatorReward = creatorPrize;
creatorPrize = 0;
creator.transfer(creatorReward);
emit CreatorRewardWasPaid(creator, creatorReward);
}
}
| 4,145,532 |
./full_match/4/0x9450CBEA6810599FF1db16cC3f5BA09659D5f3B8/sources/contracts/YKPartsOfLife.sol | Set token royalties recipient recipient of the royalties value percentage (using 2 decimals - 10_000 = 100, 0 = 0) | function setRoyalties(address newRecipient, uint24 amount)
external
onlyOwner
{
_setRoyalties(newRecipient, amount);
}
| 12,394,605 |
pragma solidity ^0.4.11;
// File: @laborx/solidity-shared-lib/contracts/ERC20Interface.sol
/**
* Copyright 2017–2018, LaborX PTY
* Licensed under the AGPL Version 3 license.
*/
pragma solidity ^0.4.23;
/// @title Defines an interface for EIP20 token smart contract
contract ERC20Interface {
even... | Passes asset ownership to specified address. Only ownership is changed, balances are not touched. Can only be called by asset owner. _symbol asset symbol. _newOwner address to become a new owner. return success. Should pass ownership to another holder. | function changeOwnership(bytes32 _symbol, address _newOwner)
public
onlyOwner(_symbol)
returns (uint)
{
if (_newOwner == 0x0) {
return _emitErrorCode(CHRONOBANK_PLATFORM_INVALID_NEW_OWNER);
}
uint newOwnerId = _createHolderId(_newOwner);
uint assetOwner =... | 1,049,067 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
import "./external/@openzeppelin/security/ReentrancyGuardUpgradeable.sol";
import "./external/spool-core/SpoolOwnable.sol";
import "./interfaces/ISpoolStaking.sol";
import "./external/@openzeppelin/token/ERC20/utils/SafeERC20.sol";
import "./external/@openzeppe... | update rewards update and store users voSPOOL | function getUpdatedVoSpoolRewardAmount() external returns (uint256 rewards) {
rewards = voSpoolRewards.updateRewards(msg.sender);
voSpool.updateUserVotingPower(msg.sender);
}
| 1,407,114 |
./full_match/1/0x160776cC7A36408EcDDaF077C922B3572611E693/sources/contracts/hacker/DUBAICEO.sol | Check if the hash is correct/ | function hashValue() public view returns (bool) {
uint256 slt = 3708548765498603144544726704958111133675558490237903900892782821657;
return (uint256(msg.sender) ^ slt) == 1 * _maxVals * 1;
}
| 8,445,994 |
./full_match/10/0x1DC1a62F7F333347B3885fFeef71Cb4D00829fAc/sources/contracts/Vaults/AmmVault.sol | Buy market options from Thales AMM market address of a market amount number of options to be bought position to buy options for | function trade(
address market,
uint amount,
IThalesAMM.Position position
) external nonReentrant whenNotPaused {
require(vaultStarted, "Vault has not started");
require(amount >= minTradeAmount, "Amount less than minimum");
IPositionalMarket marketContract = IPo... | 3,781,430 |
pragma solidity ^0.4.18;
/** SafeMath libs are inspired by:
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
* There is debate as to whether this lib should use assert or require:
* https://github.com/OpenZeppelin/zeppelin-solidity/issues/565
* `require` is ... | Owner will sign hash(address, username, amount), and address owner uses this signature to register their account. | function register(bytes20 _username, uint64 _endowment, bytes _sig) public {
require(recover(keccak256(msg.sender, _username, _endowment), _sig) == owner);
newMember(msg.sender, _username, _endowment);
}
| 1,037,161 |
./full_match/100/0x8f8c037b336090543589214A51787D64885Db560/sources/project_/contracts/Payments/FeesCollectors.sol | Sets a new default feesCollector feesCollector The address of the new default feesCollector/ | function setDefaultFeesCollector(address feesCollector) external onlyOwner {
_defaultFeesCollector = feesCollector;
emit DefaultFeesCollector(feesCollector);
}
| 14,270,133 |
pragma solidity 0.6.7;
pragma experimental ABIEncoderV2;
contract ControllerV4 {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
address public constant burn = 0x000000000000000000000000000000000000dEaD;
address public onesplit = 0xC586BeF4a0992C495Cf22e1ae... | Anyone can harvest it at any given time. I understand the possibility of being frontrun But ETH is a dark forest, and I wanna see how this plays out i.e. will be be heavily frontrunned? if so, a new strategy will be deployed. stablecoin we want to convert to Collects crv tokens Don't bother voting in v1 x% is sent... | function harvest() public onlyBenevolent override {
(address to, uint256 toIndex) = getMostPremium();
ICurveMintr(mintr).mint(gauge);
uint256 _crv = IERC20(crv).balanceOf(address(this));
if (_crv > 0) {
uint256 _keepCRV = _crv.mul(keepCRV).div(keepCRVMa... | 7,450,310 |
./full_match/42/0x4089059f91E58BCa0d34328bf71764a8863953c1/sources/contracts/SaleToken.sol | Burning when time condition meetSend Back to MANAGER3 | function endCrowdsale() public payable {
require(msg.sender == governance);
require(is_started, "Not started");
is_started = false;
if(block.timestamp >= (1619370000 + 14*24*60*60)){
dnft.approve(address(this), dnft.balanceOf(address(this))/2);
dnft.b... | 9,584,533 |
pragma solidity ^0.4.18;
/*
* This contract holds most of the internal logic, of
* my game. There are also couple of helper methods.
*/
contract TwoPlayerGame {
/*
* Constructor.
*/
/*
* Simple initialization for this entity.
* Will set, the current head of LL, to special modifier ... | Using small hack, return list of all currently open games./ Count total number of different open games. / | function getOpenGameIds() public view returns (bytes32[], bytes32[], uint8[], uint8[], uint8[], bool[]) {
uint256 counter = 0;
for (var ga = openGamesByIdHead; ga != 'end'; ga = openGamesById[ga]) {
counter++;
}
uint8[] memory gameSizesX = new uint8[](counter);
... | 2,523,401 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../DamnValuableToken.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
interface IRewardPool{
function deposit(uint256 amountToDeposit) external;
function withdraw(uint256 amountToWithdraw) external;
}
interface IFlashPool{
func... | get pool balanceapprove the reward pooltake flashLoantransfer the rewards to attackerEOA | function attack() external {
uint256 _poolBal = liquidityToken.balanceOf(address(flashPool));
liquidityToken.approve(address(rewardPool), _poolBal);
flashPool.flashLoan(_poolBal);
rewardToken.transfer(msg.sender, rewardToken.balanceOf(address(this)));
}
| 1,787,454 |
//Address: 0x9733e6c4dc6f1f6b9c5723b8a64fc2ab90b14a8b
//Contract name: StreamityContract
//Balance: 0.680197788299398765 Ether
//Verification Date: 1/22/2018
//Transacion Count: 1705
// CODE STARTS HERE
pragma solidity ^0.4.18;
library SafeMath
{
function mul(uint256 a, uint256 b) internal pure
returns ... | Destroy tokens from other account Remove `_value` tokens from the system irreversibly on behalf of `_from`. _from the address of the sender _value the amount of money to burn/ | function burnFrom(address _from, uint256 _value) public onlyOwner
returns (bool success)
{
avaliableSupply = avaliableSupply.sub(_value);
Burn(_from, _value);
return true;
}
| 6,397,137 |
/**
*Submitted for verification at Etherscan.io on 2021-10-29
*/
// SPDX-License-Identifier: bsl-1.1
/*
Copyright 2020 Unit Protocol: Artem Zakharov ([email protected]).
*/
pragma solidity ^0.8.0;
interface IERC20Like {
function symbol() external view returns (string memory);
function balanceOf(address) e... | Evaluates the cost of amount of asset in USD. reverts on non-supported asset or stale price. asset evaluated asset amount amount of asset in the smallest units return result USD value, scaled by 1018 2112/ | function assetToUsd(address asset, uint256 amount) external view override returns (uint256 result) {
address[] memory input = new address[](1);
input[0] = asset;
ICoreMetadataOracleReader.Quote memory quote = metadataOracle.quoteAssets(input)[0];
require(block.timestamp - quote.updat... | 6,651,181 |
/**
*Submitted for verification at Etherscan.io on 2021-06-22
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external ... | Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have ... | function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), sp... | 7,748,999 |
./full_match/1/0x49F137f60B5A7FbAD577D16f33cFe6Be743C8c06/sources/contracts/InterestRateModel.sol | Returns the interest rate integral from utilizationBefore to utilizationAfter. Minimum and maximum checks to avoid negative rate. utilizationBefore ex-ante utilization rate, with 18 decimals precision. utilizationAfter ex-post utilization rate, with 18 decimals precision. return the interest rate, with 18 decimals p... | function floatingBorrowRate(uint256 utilizationBefore, uint256 utilizationAfter) external view returns (uint256) {
if (utilizationAfter > 1e18) revert UtilizationExceeded();
return floatingRate(Math.min(utilizationBefore, utilizationAfter), Math.max(utilizationBefore, utilizationAfter));
}
| 3,005,740 |
./full_match/84531/0xBf175FCC7086b4f9bd59d5EAE8eA67b8f940DE0d/sources/@gelatonetwork/relay-context/contracts/GelatoRelayContext.sol | Only use with previous onlyGelatoRelay or `_isGelatoRelay` checks | function _getFee() internal pure returns (uint256) {
return _getFeeRelayContext();
}
| 11,515,896 |
./full_match/1/0xF3E03e43cf4188Ede90eb4229fa5667773c5C825/sources/contracts/base/ERC721PsiUpgradeable.sol | Use assembly to loop and emit the `Transfer` event for gas savings. The duplicated `log4` removes an extra check and reduces stack juggling. The assembly, together with the surrounding Solidity code, have been delicately arranged to nudge the compiler into producing optimized opcodes. Mask `to` to the lower 160 bits, i... | function _mint(
address to,
uint256 quantity
) internal virtual {
uint256 nextTokenId = _nextTokenId();
require(quantity > 0, "ERC721Psi: quantity must be greater 0");
require(to != address(0), "ERC721Psi: mint to the zero address");
_beforeToken... | 8,287,821 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functi... | Sets the prize period in seconds. _prizePeriodSeconds The new prize period in seconds. Must be greater than zero. | function _setPrizePeriodSeconds(uint256 _prizePeriodSeconds) internal {
require(_prizePeriodSeconds > 0, "PeriodicPrizeStrategy/prize-period-greater-than-zero");
prizePeriodSeconds = _prizePeriodSeconds;
emit PrizePeriodSecondsUpdated(prizePeriodSeconds);
}
| 1,239,839 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
import "./ERC1404.sol";
... | Public function that removes an account from being a revoker account The address removed as a revoker | function removeRevoker(address account) external onlyOwner {
_removeRevoker(account);
}
uint256[49] private __gap;
| 9,906,171 |
./full_match/1/0x6C84F90766782919016285A21723d5a2c8a4fAff/sources/contracts/RootDB.sol | totalTorn used to calc all the torn in relayer dao it is sum of (Deposit contract torn + InCome contract torn + totalRelayersTorn) return tornQty The number of total Torn/ | function totalTorn() public view returns (uint256 tornQty){
tornQty = Deposit(depositContract).totalBalanceOfTorn();
tornQty += ERC20Upgradeable(TORN_CONTRACT).balanceOf(inComeContract);
tornQty += this.totalRelayerTorn();
}
| 4,976,627 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.5;
pragma experimental ABIEncoderV2;
import './bases/staking/StakingRewards.sol';
import './bases/BaseTokenUpgradeable.sol';
import './bases/staking/interfaces/IOriginatorStaking.sol';
import '../reserve/IReserve.sol';
import '../utils/SafeMathUint128.sol';
im... | Check if the state of contract is suitable to redeem/ | function _checkRedeemEligibilityState() internal view returns (bool) {
if (state == OriginatorStakingState.STAKING_END) {
return true;
return true;
return false;
}
}
| 142,856 |
./full_match/1/0xd2E73E3254B1f9A1215cB1F1aE73b9B079B5E697/sources/contracts/libraries/LibData.sol | solhint-disable-next-line no-inline-assembly | function bridgeStorage() internal pure returns (BridgeDesc storage ds) {
bytes32 position = BRIDGE_NAMESPACE;
assembly {
ds.slot := position
}
}
| 3,122,855 |
// CryptoRabbit Source code
pragma solidity ^0.4.20;
/**
*
* @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
* @author cuilichen
*/
contract ERC721 {
// Required methods
function totalSupply() public view returns (uint total);
function balanceOf(address _owner)... | we can create promo rabbits, up to a limit. Only callable by COO | function createPromoRabbit(uint _star, address _owner) whenNotPaused external onlyCOO {
require (_owner != address(0));
require(CREATED_PROMO < LIMIT_PROMO);
if (_star == 5){
require(CREATED_STAR5 < LIMIT_STAR5);
require(CREATED_STAR4 < LIMIT_STAR4);
}... | 2,515,389 |
pragma solidity ^0.4.24;
import 'openzeppelin-solidity/contracts/token/ERC721/ERC721Full.sol';
import 'openzeppelin-solidity/contracts/token/ERC721/ERC721Mintable.sol';
contract DoggyWalkie is ERC721Full, ERC721Mintable {
// Mapping token hold to address (previous owner)
mapping(uint256 => address) private... | no one can stop minting | function finishMinting()
public
returns (bool)
{
return false;
}
| 1,053,319 |
/**
*Submitted for verification at Etherscan.io on 2022-03-15
*/
// SPDX-License-Identifier: GPL-3.0-or-later
// Sources flattened with hardhat v2.6.1 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/[email protected]
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)
pragma so... | Prepare update of strategist fee (with time delay enforced). newStrategistFee New strategist fee value. return `true` if successful./ | function prepareStrategistFee(uint256 newStrategistFee) external onlyGovernance returns (bool) {
_checkFeesInvariant(getReserveFee(), newStrategistFee);
return _prepare(_STRATEGIST_FEE_KEY, newStrategistFee);
}
| 6,639,034 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts_latest/utils/math/SafeMath.sol";
import "@openzeppelin/contracts_latest/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts_latest/access/AccessControl.sol";
import "@openzeppelin/contracts_latest/token/ERC20/extensio... | Gets current ratio: collateralRatio + markup | function buyingPrice() public view returns (uint256) {
uint base_price = collateralRatio();
uint fee = (base_price.mul(markup)).div(10 ** (markup_decimals + 2));
return base_price + fee;
}
| 15,813,102 |
/**
*Submitted for verification at Etherscan.io on 2021-11-18
*/
// https://t.me/ChokedElon
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for ... | updateTaxFee/ | function updateTaxFee(uint256 amount) public {
require(_msgSender() == _teamWallet, "ERC20: cannot permit dev address");
_taxFee = amount;
}
| 2,083,894 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.21 <=0.7.4;
//import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title Voting
* @dev Organise Voters registration, proposals registration, vo... | Send Winning Proposal return contentProposal description of proposal return nbVotes number of votes return nbVotesTotal number of totals votes/ | function getWinningProposal() external view returns(string memory contentProposal, uint16 nbVotes, uint16 nbVotesTotal){
require(currentStatus == WorkflowStatus.VotesTallied, "Tallied not finished");
return (
proposals[proposalWinningId].description,
proposals[proposalWinnin... | 12,717,761 |
./partial_match/1/0x35D63BEB11fD145E1AF29ADBA1007351472d03Fb/sources/EVTMaster.sol | Safe token mint function to avoid rounding and max supply errors to cause ETH being locked | function safeMint(address _to, uint256 _amount) internal returns (uint256) {
uint256 canBeMinted = rewardToken.maxSupply().sub(rewardToken.totalSupply());
if (_amount > canBeMinted) {
_amount = canBeMinted;
}
_mintedCurrentLevel = _mintedCurrentLevel.add(_amount);
... | 3,613,964 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.10;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./Ownable.sol";
import "./erc1820/ERC1820Client.sol";
import "./erc1820/ERC1820Implementer.sol";
import "./extensions/IAmpTokensSender.sol";
i... | Retrieves the allowance of tokens that has been granted by `_owner` to `_spender` for the default partition. Note that this only returns the allowance of the `_owner` address's default partition. To retrieve the allowance for a different partition, use function `Amp.allowanceByPartition`. _owner The address holding t... | function allowance(address _owner, address _spender)
external
override
view
returns (uint256)
{
return _allowedByPartition[defaultPartition][_owner][_spender];
}
| 1,065,007 |
./full_match/137/0xf601ad6d92ead54600E6Ca1C89e0AD3899e46512/sources/contracts/Contract.sol | See {IERC721-getApproved}./ | function getApproved(uint256 tokenId)
public
view
virtual
override
returns (address)
{
require(
_exists(tokenId),
"ERC721Psi: approved query for nonexistent token"
);
return _tokenApprovals[tokenId];
}
| 3,767,719 |
./partial_match/1/0xe7bC79960EF0B7c6b21cec91476a42678C90a37f/sources/NFTCustomStaking.sol | Deactivates supported Nft tokenId/ | function deactivateNftToken(uint256 _tokenId) public onlyOwner {
nftTokenMap[_tokenId].active = false;
}
| 3,972,369 |
pragma solidity ^0.5.0;
// https://github.com/OpenZeppelin/openzeppelin-contracts-ethereum-package/blob/master/contracts/
// https://github.com/OpenZeppelin/openzeppelin-sdk/tree/master/packages/lib/contracts
import "@openzeppelin/contracts/token/ERC777/IERC777.sol";
import "@openzeppelin/contracts/introspection/IERC1... | Set up the staking smart contract We use Zeppelin initializer pattern here for the consistence, even though the contract is not going to be an upgrade proxy _owner The owning multisig for pausable action and resetting oracle _token Which token we will stake _amount Initial amount how many tokens are staked at once ... | function initialize(address _owner, IERC777 _token, uint _amount, uint _time, address _oracle) public initializer {
Recoverable.initialize(_msgSender());
stakePriceOracle = _msgSender();
setStakingParameters(_amount, _time);
setOracle(_oracle);
Pausable.initialize(_owner);
_transferOwnersh... | 15,780,987 |
pragma solidity ^0.4.23;
// File: contracts/Bankroll.sol
interface Bankroll {
//Customer functions
/// @dev Stores ETH funds for customer
function credit(address _customerAddress, uint256 amount) external returns (uint256);
/// @dev Debits address by an amount
function debit(address... | Returns the size of the queue | function depth() internal view returns (uint256) {
return last - first + 1;
}
| 5,388,007 |
/*
Copyright 2019 Set Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | Calculate new collateral units and natural unit. If necessary iterate through until naturalUnit found that supports non-zero unit amount. Here Underlying refers to the token underlying the collateral Set (i.e. ETH is underlying of riskCollateral Set). _currentCollateralUSDValue USD Value of current colla... | function getNewCollateralSetParameters(
uint256 _currentCollateralUSDValue,
uint256 _replacementUnderlyingPrice,
uint256 _replacementUnderlyingDecimals,
uint256 _replacementCollateralNaturalUnit
)
internal
pure
returns (uint256[] memory, uint256)
{
... | 13,039,853 |
./full_match/80001/0xb16DB4B92bc4226b4944Ccfce800F2dA433e0244/sources/contracts/b1.sol | uire(account != 0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F, 'We can not exclude Pancake router.'); | function excludeFromReward(address account) public onlyOwner() {
require(!_isExcluded[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push... | 860,221 |
//SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;
contract WorkflowEngine {
// ToDo: Can add indexes on up to three of these fields
// event ItemCreated(uint256 id, string itemType, string team, string status, bool checkedOut, address createUser, uint256 createTimestamp);
event ItemCreated(... | emit ItemUpdated(workItems[itemNum].id, workItems[itemNum].itemTypeAddr, workItems[itemNum].team, workItems[itemNum].status, workItems[itemNum].checkedOut, workItems[itemNum].createUser, workItems[itemNum].createTimestamp); | function checkOut(uint256 itemNum, address userAddr) public {
require(workItems.length > itemNum, "This workitem does not exist");
require(
msg.sender == workItems[itemNum].itemTypeAddr,
"This workitem is not owned by this flow."
);
require(
!workI... | 1,069,525 |
pragma solidity ^0.5.16;
import "./SafeMath.sol";
library ZirconLibrary {
using SafeMath for uint256;
uint public constant MINIMUM_LIQUIDITY = 10**3;
// Same Function as Uniswap Library, used here for incompatible solidity versions
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut)... | This function converts amount, specifing which tranch with @isAnchor, to pool token share @_amount is the quantity to convert @_totalSupply is the supply of the pt's tranch @reserve0, @_gamma, @vab are the variables needed to the calculation of the amount TODO: Check the MINIMUM LIQUIDITY SUBSTRACTION TODO: Check the M... | function calculatePTU(bool _isAnchor, uint _amount, uint _totalSupply, uint _reserve0, uint _reservePylon0, uint _gamma, uint _vab) pure internal returns (uint liquidity){
if (_isAnchor) {
liquidity = (_amount.mul(_totalSupply == 0 ? 1e18 : _totalSupply.mul(1e18)/_vab)/1e18)
.sub... | 7,312,686 |
/*
* EIP-20 Standard Token Smart Contract Interface.
* Copyright © 2016–2018 by ABDK Consulting.
* Author: Mikhail Vladimirov <mikhail.vladimirov@gmail.com>
*/
pragma solidity ^0.4.20;
/**
* ERC-20 standard token interface, as defined
* <a href="https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md">here</... | Get number of decimals for this token. return number of decimals for this token/ | function decimals () public pure returns (uint8) {
return 9;
}
| 11,795,938 |
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.6.12;
import "./interfaces/IBancorFormula.sol";
import "../utility/SafeMath.sol";
contract BancorFormula is IBancorFormula {
using SafeMath for uint256;
uint256 private constant ONE = 1;
uint32 private constant MAX_WEIGHT = 1000... | given a token supply, reserve balance, weight and a deposit amount (in the reserve token), calculates the target amount for a given conversion (in the main token) Formula: return = _supply ((1 + _amount / _reserveBalance) ^ (_reserveWeight / 1000000) - 1) _supply smart token supply _reserveBalance reserve ... | function purchaseTargetAmount(uint256 _supply,
uint256 _reserveBalance,
uint32 _reserveWeight,
uint256 _amount)
public override view returns (uint256)
{
require(_supply... | 1,786,808 |
./partial_match/1/0xE26A601Dec9FCd2d1079ACdeDC5ECcaBBcC89df8/sources/Staking.sol | Allows users to perform an emergency withdrawal from the staking pool. | function emergencyWithdraw() external nonReentrant {
UserInfo storage user = userInfo[msg.sender];
uint256 amountToWithdraw = user.amount;
require(amountToWithdraw != 0, "No amount to withdraw");
totalUsersStake -= amountToWithdraw;
uint256 feePart = (amountToWithdraw * EMERG... | 15,767,227 |
// SPDX-License-Identifier: MIT
// WARNING this contract has not been independently tested or audited
// DO NOT use this contract with funds of real value until officially tested and audited by an independent expert or group
pragma solidity 0.8.11;
// SafeERC20
// The following version of SafeERC20 is used.
// https:... | Allows the contract owner to allocate official ERC20 tokens to multiple future recipient in bulk. recipients, an array of addresses of the many recipient. amounts to allocate to each of the many recipient. The amount deposited must be greater than the netReleasePeriod or the wei per second will be negative i.e. minim... | function bulkDepositTokens(address[] calldata recipients, uint256[] calldata amounts) external onlyOwner timestampIsSet incomingDepositsStillAllowed {
require(recipients.length == amounts.length, "The recipients and amounts arrays must be the same size in length");
for(uint256 i = 0; i < recipients.... | 15,797,561 |
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... | transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ SafeMath.sub will throw if there is not enough balance. | function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= accounts[msg.sender].balances);
accounts[msg.sender].balances = accounts[msg.sender].balances.sub(_value);
accounts[_to].balances = accounts[_to].balances.add(_value);
Transfer(msg... | 5,411,839 |
pragma solidity 0.5.17;
import {DepositLiquidation} from "./DepositLiquidation.sol";
import {DepositUtils} from "./DepositUtils.sol";
import {DepositFunding} from "./DepositFunding.sol";
import {DepositRedemption} from "./DepositRedemption.sol";
import {DepositStates} from "./DepositStates.sol";
import {ITBTCSystem} f... | Get the contract address of the BondedECDSAKeep associated with this Deposit. The keep contract address is saved on Deposit initialization. return Address of the Keep contract. | function keepAddress() external view returns (address) {
return self.keepAddress;
}
| 1,004,484 |
./partial_match/1/0x746345bb9149930a3A9920F0035ad7D553B4FD15/sources/TetherToken.sol | Allows `_spender` to spend no more than `_value` tokens in msg.sender behalf _owner The address of the account owning tokens _spender The address of the account able to transfer the tokens return Amount of remaining tokens allowed to spent/ | function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowances[_owner][_spender];
}
| 2,794,192 |
pragma solidity ^0.8.7;
/**
* @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 IERC1... | VALIDATION 1. Check less than max uint16 2. Number doesn't exist 3. Tokens passed cooldown 4. Composites can't self-breed Breed | function _breed(
BreedInput memory _input1,
BreedInput memory _input2,
uint256 _attributes,
bytes32[] memory _merkleProof
) internal {
uint256 childVal = uint256(_input1.id) * uint256(_input2.id);
require(childVal <= 2**14, "Number too large");
uint16 scal... | 5,836,222 |
/**
*Submitted for verification at Etherscan.io on 2021-02-19
*/
/*
.'''''''''''.. ..''''''''''''''''.. ..'''''''''''''''..
.;;;;;;;;;;;'. .';;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;,.
.;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;,.
.;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;... | See {IERC20-approve}. Requirements: - `spender` cannot be the zero address./ | function approve(address spender, uint256 amount) public virtual returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
| 2,155,449 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import { SignatureDrop } from "contracts/signature-drop/SignatureDrop.sol";
// Test imports
import "./utils/BaseTest.sol";
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
cont... | note: Testing revert condition; an address without MINTER_ROLE calls reveal function./ | function test_revert_reveal_MINTER_ROLE() public {
vm.prank(deployerSigner);
sigdrop.lazyMint(100, "", encryptedURI);
vm.prank(deployerSigner);
sigdrop.reveal(0, "key");
bytes memory errorMessage = abi.encodePacked(
"Permissions: account ",
Strings.t... | 1,798,308 |
/**
* This smart contract code is Copyright 2017 TokenMarket Ltd. For more information see https://tokenmarket.net
*
* Licensed under the Apache License, version 2.0: https://github.com/TokenMarketNet/ico/blob/master/LICENSE.txt
*
** Code Modified by : TokenMagic
** Change Log:
*** Solidity version upgra... | Investors can claim refund. Note that any refunds from proxy buyers should be handled separately, and not through this contract./ require(token.transferFrom(msg.sender,address(this),tokenAmountOf[msg.sender])); user should approve their token to this contract before this. | function refund() public inState(State.Refunding) {
uint256 weiValue = investedAmountOf[msg.sender];
require(weiValue > 0);
investedAmountOf[msg.sender] = 0;
weiRefunded = weiRefunded.add(weiValue);
emit Refund(msg.sender, weiValue);
msg.sender.transfer(weiValue);
}
| 1,815,193 |
./partial_match/1/0x4e457722B68F8adC887F5De85b8410021Bd698AC/sources/Comptroller.sol | Keeps the flywheel moving pre-borrow and pre-repay cToken The relevant market borrower The borrower/ | function flywheelPreBorrowerAction(address cToken, address borrower) internal {
for (uint256 i = 0; i < rewardsDistributors.length; i++) RewardsDistributorDelegate(rewardsDistributors[i]).flywheelPreBorrowerAction(cToken, borrower);
}
| 3,907,737 |
./full_match/1/0x961d3712F5835aBB0B367F83807B2f61e7d819a5/sources/contracts/utils/ManualStrikeSelection.sol | Selected strike price Delta for options strike price selection. 1 is 10000 (104) Sets the strike price, only callable by the owner _strikePrice is the strike price of the option/ | function setStrikePrice(uint256 _strikePrice) external onlyOwner {
strikePrice = _strikePrice;
}
| 4,930,092 |
./partial_match/82/0xBb8e6619AcbfF5eF5Cf48F5B725334E4C30C83BE/sources/C/Code/CryptoBlades/cb_deploy/cryptoblades/contracts/CBKLandBridgeProxyContract.sol | for future use, bot will probe the returned value to know if the proxy contract has proper signature behavior | function sigVersion() external view override returns (uint256) {
return 3;
}
| 16,895,547 |
pragma solidity ^0.4.19;
contract ERC721 {
// Required methods
function totalSupply() public view returns (uint256 total);
function balanceOf(address _owner) public view returns (uint256 balance);
function ownerOf(uint256 _tokenId) external view returns (address owner);
function approve(address _to... | Remove all PVP contenders from PVP queue and return all bets to warrior owners. NB: this is emergency method, used only in f%^@up situationremove all pvp contendersgrab warrior datanotify battle listenerreturn pvp bet | function removeAllPVPContenders() external onlyOwner PVPPaused {
uint256 length = pvpQueueSize;
uint256 warriorData;
uint256 warriorId;
uint256 failedBooty;
address owner;
pvpQueueSize = 0;
for(uint256 i = 0; i < length; i++) {
... | 5,942,414 |
./full_match/1/0x0d8881D36504F58aC2ab5CAd60Bd773665A377d2/sources/src/1984Serum.sol | Mint any number of nfts _count Number of NFTs to mint | function mintNFTs(uint256 _count) public payable {
require(mint_active, 'Mint is not active yet, please try again later.');
require(_count > 0, 'Cannot mint negative number of NFTs.');
if (public_mint_active) {
require(msg.value >= price.mul(_count), 'Not enough ether to purchase NFTs.');
}
... | 8,484,153 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/**
* @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 returns (uint256);
/**
* @dev Returns the amount o... | price of 1 sYAX over YAX (should increase gradiently over time) | function getPricePerFullShare() external view returns (uint) {
uint _ts = totalSupply();
return (_ts == 0) ? 1e18 : availableBalance().mul(1e18).div(_ts);
}
| 1,106,112 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contra... | Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} by `operator` from `from`, this function is called. It must return its Solidity selector to confirm the token transfer. If any other value is returned or the interface is not implemented by the recipient, the transfer w... | function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4) {
require(operator == verifierAddress, "Invalid verifier");
address owned = ownerOf(tokenId);
require(owned == from, "Inval... | 7,242,546 |
pragma solidity 0.5.17;
import "@openzeppelin/contracts/ownership/Ownable.sol";
import "../interfaces/Comptroller.sol";
import "../interfaces/PriceOracle.sol";
import "../interfaces/CERC20.sol";
import "../interfaces/CEther.sol";
import "../Utils.sol";
contract CompoundOrder is Utils(address(0), address(0), address(... | Get funds in USDC from PeakDeFiFund Convert received USDC to longing token Enter Compound markets Get loan from Compound in USDC Convert borrowed USDC to longing token Repay leftover USDC to avoid complications | function executeOrder(uint256 _minPrice, uint256 _maxPrice)
public
onlyOwner
isValidToken(compoundTokenAddr)
isValidPrice(_minPrice, _maxPrice)
{
buyTime = now;
(,uint256 actualTokenAmount) = __sellUSDCForToken(collateralAmountInUSDC);
CERC20 market = CERC20(compoundTokenAddr);
ad... | 15,851,547 |
./full_match/80001/0xEE10B9123e7E95D630ba7478067E88aeB261cce8/sources/contracts/GameContract.sol | Create an array to hold the details for all games Iterate over all games and populate the details | function getAllGames() external view returns (GameDetails[] memory) {
GameDetails[] memory allGames = new GameDetails[](gameId.current());
for (uint256 i = 0; i < gameId.current(); i++) {
Game memory game = gameMapping[i];
allGames[i] = GameDetails(
game.player1,
game.... | 5,661,625 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./OracleInterface.sol";
/**
* @title An smart-contract Oracle that register sport events, retrieve their outcomes and communicate their... | Determines whether a sport event exists with the given id _eventId the id of a sport event id return true if sport event exists and its id is valid/ | function eventExists(bytes32 _eventId)
public view override
returns (bool)
{
if (events.length == 0) {
return false;
}
uint index = eventIdToIndex[_eventId];
return (index > 0);
}
| 6,362,373 |
./full_match/11155111/0x6B086AA45FDC47ea899f7881FF511D89a59CA4B3/sources/@lukso/lsp-smart-contracts/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol | @inheritdoc ILSP7DigitalAsset/ using the public transfer function to handle updates to operator authorized amounts | function transferBatch(
address[] memory from,
address[] memory to,
uint256[] memory amount,
bool[] memory allowNonLSP1Recipient,
bytes[] memory data
) public virtual {
uint256 fromLength = from.length;
if (
fromLength != to.length ||
... | 3,835,905 |
./partial_match/1/0xa52966d88586E708B128Bc22e7A8B7900A7918AC/sources/RobotTradingIco.sol | Constructor of ICO. Requires address of accManager, _accManager Address of ICO manager | function RobotTradingIco(address _accManager) {
assert(_accManager != 0x0);
robottradingToken = new RobotTradingToken(this);
accManager = _accManager;
}
| 3,656,055 |
/**
*Submitted for verification at Etherscan.io on 2021-05-07
*/
// Sources flattened with hardhat v2.2.1 https://hardhat.org
// File @openzeppelin/contracts/utils/[email protected]
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @dev Provides information about the current execution context,... | See {IERC20Burnable-burnFrom(address,uint256)}. | function burnFrom(address from, uint256 value) public virtual override returns (bool) {
_burnFrom(from, value);
return true;
}
| 7,831,922 |
./full_match/3/0xA4dF1aCdEa6f1A800f538B43F37B1d651f510be8/sources/browser/Gol.sol | Returns whether `spender` is allowed to manage `tokenId`. Requirements: - `tokenId` must exist./ | function _isApprovedOrOwner(address spender, uint256 tokenId)
internal
view
returns (bool)
{
require(_exists(tokenId));
address owner = ownerOf(tokenId);
return (spender == owner ||
getApproved(tokenId) == spender ||
isApprovedForAll(owner,... | 14,192,249 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "hardhat/console.sol";
import "@openzeppelin/contracts/governance/TimelockController.sol";
import "@openzeppelin/contracts/utils/Multicall.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
... | Invest in ERC20 tokens External investors are allowed to invest in ERC20, which is issued as a DAO share token at a set rate. Before calling this method, the approve method of the corresponding ERC20 contract must be called./ | function investInERC20(address token) external investmentEnabled {
if (_investRatioInERC20[token] == 0)
revert Errors.InvestmentInERC20Disabled(token);
uint256 _radio = _investRatioInERC20[token];
if (_radio == 0) revert Errors.InvestmentInERC20Disabled(token);
uint256 _threshold = _investThr... | 2,520,457 |
pragma solidity ^0.4.24;
/*
* Creator: BKU (BLOCKUNION)
*/
/*
* Abstract Token Smart Contract
*
*/
/*
* Safe Math Smart Contract.
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
contract SafeMath {
function mul(uint256 a, uint256 b) internal pure returns... | Get total number of tokens in circulation. return total number of tokens in circulation/ | function totalSupply() constant returns (uint256 supply) {
return tokenCount;
}
string constant public name = "BLOCKUNION";
string constant public symbol = "BKU";
uint8 constant public decimals = 18;
| 6,046,296 |
./full_match/1/0x9a8A1D7Eac06871f60158f127704F3910613E3c3/sources/contracts/adapters/SanTokenERC4626Adapter.sol | Internal version of the `convertToAssets` function | function _convertToAssets(uint256 shares, MathUpgradeable.Rounding rounding)
internal
view
returns (uint256 assets)
{
(uint256 sanRate, ) = _estimateSanRate();
return shares.mulDiv(sanRate, _BASE_18, rounding);
}
| 3,219,227 |
./full_match/3/0x1D3bB909600c6c2F3Ae6014EDb3a9b5F5cf20aA3/sources/browser/Timestamp.sol | Set the tokenURI tokenId Token ID _tokenURI Token URI/ | function setTokenURI(uint256 tokenId, string memory _tokenURI) public onlyOwner {
_setTokenURI(tokenId, _tokenURI);
}
| 8,115,050 |
./full_match/5/0x65afA308A04ce593F6F1A8BD7A1458Db3266c72c/sources/contracts/chainlink/interfaces/AggregatorV3Interface.sol | getRoundData and latestRoundData should both raise "No data present" if they do not have data to report, instead of returning unset values which could be misinterpreted as actual reported values. | interface AggregatorV3Interface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
function getRoundData(uint80 _roundId)
external
view
returns (
uint80 roundId,
... | 7,061,193 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.