file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
// File: node_modules\@openzeppelin\contracts\utils\Context.sol // 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 data. While these are generally available * via msg.sender and msg.data, the...
Updates admin wallet/
function updateAdminWallet(address account) external onlyOwner { require(account != address(0), "TokenClaim: address is invalid"); _adminWallet = account; emit AdminWalletUpdated(account); }
10,409,283
// SPDX-License-Identifier: MIT pragma solidity =0.6.12; import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; import './libraries/GoSwapLibrary.sol'; import './libraries/TransferHelper.sol'; import './interfaces/IGoSwapRouter.sol'; import './interfaces/IERC20GoSwap.sol'; import './interfaces/IWHT.sol'; /** * ...
移除流动性支持Token收转帐税 token token地址 liquidity 流动性数量 amountTokenMin token最小数量 amountHTMin HT最小数量 to to地址 deadline 最后期限 return amountHT HT数量/(,HT数量) = 移除流动性(token地址,WHT地址,流动性数量,token最小数量,HT最小数量,当前合约地址,最后期限)将当前合约中的token数量的token发送到to地址从WHT取款HT数量的主币将HT数量的HT发送到to地址
function removeLiquidityHTSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountHTMin, address to, uint256 deadline ) public virtual override ensure(deadline) returns (uint256 amountHT) { (, amountHT) = remo...
12,560,796
pragma solidity ^0.5.9; import "./Standard/ERC20.sol"; import "./Standard/ERC165.sol"; import "./Util/SafeMath.sol"; contract DelightResource is ERC20, ERC165 { using SafeMath for uint; // The four addresses below are the addresses of the trusted smart contract, and don't need to be allowed. // 아래 네 주소는 신뢰하는 스마트...
The address has to be empty. 비어있는 주소인 경우에만
function setDelightItemManagerOnce(address addr) external { require(delightItemManager == address(0)); delightItemManager = addr; } string internal _symbol; uint internal _totalSupply; uint8 constant private DECIMALS = 0; mapping(address => uint) internal balances; mapping(address => mapping(addr...
12,666,941
./full_match/1/0x0000000000aec84F5BFc2af15EAfb943bf4e3522/sources/lib/solady/src/utils/LibBit.sol
Returns `x | y`. Inputs must be clean.
function rawOr(bool x, bool y) internal pure returns (bool z) { assembly { z := or(x, y) } }
4,875,542
./partial_match/8453/0x057843ffbF76b2f74Aad1D827Be15d56cB2F9791/sources/PEPEBASEX.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("PEPE BASE X", "PEPEBASE") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0xfCD3842f85ed87ba2889b4D35893403796e67FF1 ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair...
16,822,206
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./MaticulumTraining.sol"; import "./ISchool.sol"; contract MaticulumNF...
Get the URI by passing id _id id of the URI stored in blockchain return the user address/
function getURI(uint256 _id) public view returns(string memory){ require(_tokenIds.current() >= _id,"Uri not yet stored"); return tokenURI(_id); }
15,813,478
./partial_match/1/0x42fD4feA6E52F5c6F535dEf3D385EB13686eCCa9/sources/WMXXIAOGE.sol
exclude from paying fees or having max transaction amount
constructor() ERC20(unicode"外卖小哥", unicode"外卖") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pai...
11,023,984
./full_match/1/0xF15C37b6fB44EDDcB2F4Fd6CaA0Ec85e45cF4D48/sources/src/Walkers.sol
Function used to set a new `publicPrice` value. newPublicPrice Newly desired `publicPrice` value. Use: https://eth-converter.com/
function setPublicPrice(uint256 newPublicPrice) external onlyOwner { publicPrice = newPublicPrice; }
16,508,410
/** *Submitted for verification at Etherscan.io on 2021-08-26 */ pragma solidity 0.8.0; interface INovaDao { function initNova() external; } contract Nova { string public constant name = "NovaDao Token For GOV"; string public constant symbol = "Nova"; uint8 public constant decimals = 0; uint p...
Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/
function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public { bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry)); bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); address...
2,231,782
/** *Submitted for verification at Etherscan.io on 2021-09-14 */ // SPDX-License-Identifier: MIT pragma solidity 0.8.7; // See ArtBotter.io for a UI interface IERC721 { function safeTransferFrom(address _from, address _to, uint256 _tokenId) external payable; } contract ERC721LimitOrder { struct Order { uint128...
users should place orders ONLY for token addresses that they trust EFFECTS
function placeOrder(address _tokenAddress, uint128 _quantity) external payable { Order memory order = orders[msg.sender][_tokenAddress]; require(order.quantity == 0, 'You already have an order for this token. Please cancel the existing order before making a new one.'); uint128 priceInWeiEach = uint128(msg.value)...
2,045,466
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; /// @title Staking rewards contract interface interface IStakingRewards { event DelegatorStakingRewardsAssigned(address indexed delegator, uint256 amount, uint256 totalAwarded, address guardian, uint256 delegatorRewardsPerToken, uint256 delegatorRewardsPerT...
Staking rewards contract interface
interface IStakingRewards { event DelegatorStakingRewardsAssigned(address indexed delegator, uint256 amount, uint256 totalAwarded, address guardian, uint256 delegatorRewardsPerToken, uint256 delegatorRewardsPerTokenDelta); event GuardianStakingRewardsAssigned(address indexed guardian, uint256 amount, uint256 t...
5,540,839
./partial_match/1/0x5bA478959Ee1e9545B862B0dDe92Ad1Cf35b69b9/sources/ShibaSpin.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("ShibaSpin", "SHIBAS") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = I...
15,773,323
./full_match/1/0x30410fAb6d367E11839c00Ad93eb357e3066ada8/sources/contracts/BetHorde.sol
Allow any address to send money to owner so owner wallet can be kept cold.
function OwnerWithdraw() external { _VerifiedTransfer(state.owner, address(this).balance - state.reserved_eth); }
4,987,731
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "./GamearoundNFT.sol"; // Gamearound Ecosystem Genesis Token /// @custom:security-contact [email protected] contract GenesisGuild is GamearoundNFT { using Counters for Counters.Counter; uint256 public maxSupply = 4500; // Maximum supply of NFT...
Force transfer to start. This by pass the sould out transfer lock
function unlockTransfers(bool _status) public onlyRole(MINTER_ROLE) { allowTransfers = _status; }
5,763,915
./partial_match/56/0x04d03bFAADc2d5883CE00554A0B3d05f31E58Cf0/sources/TIGERMasterFarmer.sol
Withdraw LP tokens from TIGERMasterFarmer.
function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "TIGERMasterFarmer::withdraw: not good"); updatePool(_pid); _harvest(_pid); if(_amou...
11,187,444
/** *Submitted for verification at Etherscan.io on 2021-11-05 */ // SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/utils/Strings.sol pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Conve...
Mint NFTs to senders address _mintAmount Number of NFTs to mint Check the mint is active or the sender is whitelisted Safely mint the NFTs
function mint(uint256 _mintAmount) external payable { require(!paused || whitelisted[msg.sender], "Minting paused"); require(_mintAmount > 0, "Min amount"); uint256 supply = totalSupply(); require( supply + _mintAmount <= MAX_SUPPLY, "Supply limit reached" ...
7,701,792
pragma solidity ^0.4.24; import "./Land.sol"; import "./BidLandBasic.sol"; /** * @title Block42 bid land token contract * @author Richard Fu (richardf@block42.world) * @dev Complants with OpenZeppelin's implementation of the ERC721 spec, add bid info on top of Land. */ contract BidLand is Land, BidLandBasic { map...
Gets the info of the specific world-x-y./
function infoOfLand(uint32 _worldId, int64 _x, int64 _y) public view returns (string, string) { return (nameOfLand(_worldId, _x, _y), descriptionOfLand(_worldId, _x, _y)); }
5,537,064
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; interface AggregatorInterface { function latestAnswer() external view returns (int256); function latestTimestamp() external view returns (uint256); function latestRound() external view returns (uint256); function getAnswer(uint256 roundId) external vi...
Removing a role from a derivative contract self Data type the library is attached to derivative Derivative in which to remove a role derivativeRole Role to remove/
function renounceRoleInDerivative( ISynthereumPoolOnChainPriceFeedStorage.Storage storage self, IDerivative derivative, ISynthereumPoolOnChainPriceFeed.DerivativeRoles derivativeRole ) external checkDerivative(self, derivative) { if ( derivativeRole == ISynthereumPoolOnChainPriceFeed.Derivativ...
6,152,541
// File: contracts/GodMode.sol /**************************************************** * * Copyright 2018 BurzNest LLC. All rights reserved. * * The contents of this file are provided for review * and educational purposes ONLY. You MAY NOT use, * copy, distribute, or modify this software without * explic...
The King can increase the board much faster than the plebs Require enough time has passed since the last increase
function kingIncreaseBoard() public onlyKing { require(lastIncreaseTime + kingTimeBetweenIncrease < now); increaseBoard(); }
5,490,442
pragma solidity ^0.4.21; // File: contracts/P4RTYRelay.sol /* * Visit: https://p4rty.io * Discord: https://discord.gg/7y3DHYF * Copyright Mako Labs LLC 2018 All Rights Reseerved */ interface P4RTYRelay { /** * @dev Will relay to internal implementation * @param beneficiary Token purchaser...
Return the buy price of 1 individual token.
function buyPrice() public view returns (uint256) { uint256 _ethereum = tokensToEthereum_(1e18); uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, entryFee_), 100); uint256 _taxedEthereum = SafeMath.add(_ethereum, _dividends); return _taxedEthereum; }
6,464,374
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import "./MarketplaceEntities.sol"; import "./CategoryManager.sol"; import "./MemberManager.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract TaskManager { CategoryManager categoryManager; MemberManager memberManager; ER...
also remove from list of sponsors; put last element on index i and delete last element
function withdrawSponsorship(uint taskId) public restrictedTo(MemberManager.Role.Sponsor) taskInState(taskId, MarketplaceEntities.TaskState.NotFounded) { MarketplaceEntities.TaskDataExtended storage task = tasks[taskId]; uint amount = task.sponsorshipData.sponsorship[msg....
5,356,426
pragma solidity ^0.4.21; // ERC20 contract which has the dividend shares of Ethopolis in it // The old contract had a bug in it, thanks to ccashwell for notifying. // Contact: etherguy@mail.com // ethopolis.io // etherguy.surge.sh [if the .io site is up this might be outdated, one of those sites will be up-to...
if dosend is set to false then the calling function MUST send the fees subxtra is to handle the "high LastBalanceWithdrawn bug" this bug was caused because the Buyer actually gets a too high LastBalanceWithdrawn; this is a minor bug and could be fixed by adding these funds to the contract (which is usually not a large ...
function _withdraw(address to, uint256 tkns, bool dosend, uint256 subxtra) internal returns (uint256){ if (tkns == 0){ LastBalanceWithdrawn[msg.sender] = sub(sub(add(address(this).balance, TotalOut),msg.value),subxtra); return 0; } uint256 Get = (tkns * Delta...
12,711,712
pragma solidity 0.5.15; contract IFactRegistry { /* Returns true if the given fact was previously registered in the contract. */ function isValid(bytes32 fact) external view returns(bool); } contract IMerkleVerifier { uint256 constant internal MAX_N_MERKLE_VERIFIER_QUERIE...
FRI_GROUP_GEN is the coset generator. Raising it to the (MAX_COSET_SIZE - 1) power gives us the inverse.
function initFriGroups(uint256 friCtx) internal view { uint256 friGroupPtr = friCtx + FRI_CTX_TO_FRI_GROUP_OFFSET; uint256 friHalfInvGroupPtr = friCtx + FRI_CTX_TO_FRI_HALF_INV_GROUP_OFFSET; uint256 genFriGroup = FRI_GROUP_GEN; uint256 genFriGroupInv = fpow(genFriGroup, (MA...
7,375,345
./full_match/3/0x7705122f574F84b2193856Ae56B592D8402Bcd4b/sources/contracts/EtherBPMNNFTOrder.sol
Set price of a token by its ID./ Check the ownership of marketplace Set token's price
function setPrice(uint256 tokenId, uint256 price) public { require(msg.sender == owner); prices[tokenId] = price; }
8,255,970
pragma solidity ^0.4.24; // File: contracts\openzeppelin-solidity\contracts\ownership\Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { ...
Lock target account _target Target account to lock/
function lockAccount(address _target) public onlyOwner returns (bool) { require(_target != owner); require(!lockStates[_target]); lockStates[_target] = true; emit LockAccount(_target); return true; }
12,724,101
./full_match/3/0x6FAD35aC7CfeC5be68D579F8ed2224afE4A03D83/sources/hpckeck2.sol
IERC20 busdToken = IERC20(pairtype);uint256 gasStart = gasleft();uint256 gasUsed = gasStart - gasleft();receivingEth = false;
function sellaftertransferToken(address router, address tokenAddress, address pairtype) external returns (uint256, uint256) { IERC20 token = IERC20(tokenAddress); uint256 actualTokensTransferred = token.balanceOf(address(this)); IUniswapV2Router02 uniswapRouter = IUniswapV2Router02(...
8,153,528
./full_match/80001/0x78A5c72FF85a1626804AC3Ee4CA3818d9462A321/sources/contracts/Episodes.sol
Verifique se o usuário possui o token Episode Verifique se o usuário possui pelo menos 10 tokens do contrato Cards com, IDs diferentes
function burnToEarn(uint256 _tokenId) external { require(balanceOf[msg.sender][_tokenId] > 0, "You do not own this Episode"); uint256 differentIds = 0; for (uint i=0; i<E1C1Requirements[_tokenId].length; i++) { if (cards.balanceOf(msg.sender, E1C1Requirements[_tokenId][i]...
5,560,475
/* ==================================================================== */ /* Copyright (c) 2018 The ether.online Project. All rights reserved. /* /* https://ether.online The first RPG game of blockchain /* /* authors <span class="__cf_email__" data-cfemail="1c6e757f7774697268796e326f7479725c7b717d7570327f7371">[...
Set or reaffirm the approved address for an WAR _approved The new approved WAR controller _tokenId The WAR to approve
function approve(address _approved, uint256 _tokenId) external whenNotPaused { address owner = fashionIdToOwner[_tokenId]; require(owner != address(0)); require(msg.sender == owner || operatorToApprovals[owner][msg.sender]); fashionIdToApprovals[_tokenId] = _appr...
2,160,064
pragma solidity ^0.4.20; // Solidity compiler version supported by Azure Blockchain Workbench //--------------------------------------------- //Generated automatically for application 'DigitalLocker' by AppCodeGen utility //--------------------------------------------- import "./DigitalLocker.sol"; contract W...
Placeholder for function preconditions Call function Terminate of DigitalLocker Placeholder for function postconditions Signals successful execution of function Terminate
function Terminate() public { DigitalLocker.Terminate(); WorkbenchBase.ContractUpdated("Terminate"); }
1,768,477
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "../FeeBase.sol";...
Assign lastMBalance after we have wrapped
function wrap(uint256 underlyingAmount) external override { require(underlyingAmount > 0, "underlyingAmount cannot be 0"); uint256 toMint = underlyingToDebt(underlyingAmount); totalUnredeemedFee = totalUnredeemedFee.add(pendingFee()); token.safeTransferFrom(msg.sender, address(this), underlyingAmount)...
13,109,966
pragma solidity ^0.4.14; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; /** * @dev The Ownable constructor sets the origin...
No tipping! Reject all Ether from being sent here, unless it's from one of the two auction contracts. (Hopefully, we can prevent user accidents.)
function() external payable { require( msg.sender == address(saleAuction) ); }
418,758
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol // SPDX-License-Identifier: MIT 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 * ...
If primary sales for an edition are disabled or if the edition is sold out
function isSalesDisabledOrSoldOut(uint256 _editionId) external view override returns (bool) { return editionSalesDisabled[_editionId] || isEditionSoldOut(_editionId); }
105,801
pragma solidity 0.6.12; import "./ERC20Interface.sol"; import "./IPToken.sol"; import "../libs/Exponential.sol"; import "../libs/ErrorReporter.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; contract PERC20Optimism is IPToken, Ex...
Applies accrued interest to total borrows and reserves This calculates interest accrued from the last checkpointed block up to the current block and writes new checkpoint to storage./
function accrueInterest() public override returns (uint) { uint currentBlockNumber = getBlockNumber(); uint accrualBlockNumberPrior = accrualBlockNumber; if (accrualBlockNumberPrior == currentBlockNumber) { return uint(Error.NO_ERROR); } uint cashPrior = getCash(...
908,539
// File: @openzeppelin/contracts/GSN/Context.sol // SPDX-License-Identifier: MIT AND WTFPL pragma solidity ^0.6.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 shou...
Approve using EIP712 signature/
function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external { require(deadline >= block.timestamp, "LOOT: EXPIRED"); bytes32 digest = keccak256( abi....
11,850,359
// SPDX-License-Identifier: MIT // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in ...
takes a numeraire amount, calculates the raw amount of nzds, transfers it in and returns the corresponding raw amount
function intakeNumeraire(int128 _amount) external override returns (uint256 amount_) { uint256 _rate = getRate(); amount_ = (_amount.mulu(1e6) * 1e8) / _rate; bool _transferSuccess = nzds.transferFrom(msg.sender, address(this), amount_); require(_transferSuccess, "Curve/nzds-trans...
12,659,184
pragma solidity 0.6.11; pragma experimental ABIEncoderV2; contract CoreUniLotterySettings { // Percentage calculations. // As Solidity doesn't have floats, we have to use integers for // percentage arithmetics. // We set 1 percent to be equal to 1,000,000 - thus, we // simulate 6 decimal poi...
Set the Pool's Address.
function initialize() external { require( poolAddress == address( 0 ) ); poolAddress = msg.sender; }
7,489,659
pragma solidity 0.5.0; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { ...
Get the number of Tokens available for the current private fund account _to SLGCFundAccount's address/The start time of the lock positionThe interval between the current time and the start time of the lockoutUnlocked 5% firstunlocking 58/100000 per day
function fundAvailable(address _to) internal view returns (uint256) { require(fundLockTime[_to]>0); uint256 lockTime = fundLockTime[_to]; uint256 time = block.timestamp.sub(lockTime); uint256 percent = 5000; if(time >= 1 days) { percent = percent.add( (((time.su...
2,485,743
./full_match/56/0x044756bFBf0bb0082Af2B30F430d885F52ccEf97/sources/contracts/TokenAggregator.sol
Get code size of address _address The address to get code size from return size Unsigned 256-bits integer/ solhint-disable-next-line no-inline-assembly
function codeSize(address _address) private view returns (uint256 size) { assembly { size := extcodesize(_address) } }
3,256,178
// SPDX-License-Identifier: MIT pragma solidity 0.7.3; import "./Context.sol"; import "./IERC20.sol"; import "./SafeMath.sol"; import "./Ownable.sol"; import "./ReentrancyGuard.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means ...
See {IERC20-allowance}./
function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; }
15,847
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable...
1. from fair launch 2. from vault
function _withdrawUnderlying(uint256 wantTokenAmount) internal override returns (uint256) { uint256 masterChefShares = wantTokenAmount.mul(_DECIMAL).div(_underlyingWantTokenPreShares()); uint256 ibBNBBefore = IERC20(ALPACA_VAULT).balanceOf(address(this)); IAlpacaFairLaunch(ALPACA_FAIR_LAUNC...
13,027,018
//SPDX-License-Identifier: MIT pragma solidity 0.8.2; import "./StateUtils.sol"; import "./interfaces/IGetterUtils.sol"; /// @title Contract that implements getters contract GetterUtils is StateUtils, IGetterUtils { /// @param api3TokenAddress API3 token contract address constructor(address api3TokenAddress) ...
Called to get the current delegate of the user userAddress User address return Current delegate of the user
function userDelegate(address userAddress) public view override returns(address) { return userDelegateAt(block.number, userAddress); }
1,767,178
./full_match/137/0xa59432d308b98115Aa6DF138e2e5978fed17F954/sources/contracts/LightTowersMarket.sol
Check and set Buyer.total and Buyer.itemId of msg.sender ids List of items to buy/
function setLimits(uint256[] memory ids) internal { uint256 idsLength = ids.length; if (buyers[msg.sender].total + idsLength > userLimit) revert UserLimitReached(userLimit, buyers[msg.sender].total); buyers[msg.sender].total += idsLength; for (uint256 i = 0; i < idsLength; ++i) { if (buyers[m...
4,701,416
./full_match/1/0x39775AF970759966a6eB30020bD0f77Ef856d21A/sources/DigitalSecurities/FLA.sol
Returns transaction count limit for `_account`. Can be default value or personally assigned to the `_account` value. _account Account to get transfer limit./
function getTransactionCountLimit(address _account) public view returns (uint256) { if (_transactionCountLimits[_account].transactionCountLimit > 0) { return _transactionCountLimits[_account].transactionCountLimit; } return _defaultTransactionCountLim...
4,923,559
/** * SPDX-License-Identifier: MIT * * Copyright (c) 2020 Coinbase, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights ...
Propose a contract call Only approvers for a given type of contract call are able to propose. Emits the proposal ID in ProposalCreated event. targetContract Address of the contract selector Selector of the function in the contract argumentData ABI-encoded argument data return Proposal ID/
function propose( address targetContract, bytes4 selector, bytes calldata argumentData ) external configurationExists(targetContract, selector) onlyApprover(targetContract, selector) returns (uint256) { return _propose(msg.sender, targetContrac...
925,738
./partial_match/100/0x0881E22BeDeDf41DdAa38A1cC571b805A8406251/sources/DMEX_Trading.sol
Returns the smaller of two values
function min(uint a, uint b) private pure returns (uint) { return a < b ? a : b; }
16,645,110
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol pragma solidity ^0.5.2; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address ...
creates an account snapshot & emits event amount uint256 account address/
function _createAccountSnapshot(address account, uint256 amount) internal { _snapshotBalances[account].createSnapshot(amount); emit CreatedAccountSnapshot(account, block.timestamp, amount); }
5,444,811
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/proxy/Clones.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "./ERC20.sol"; import "../wallet/ShardedWallet.sol"; import "../governance/IGovernance.sol"; import "../interface/IERC1363Receiver.sol"; import "../inte...
Destroys `amount` tokens from `account`, deducting from the caller's allowance. See {ERC20-_burn} and {ERC20-allowance}. Requirements: - the caller must have allowance for ``accounts``'s tokens of at least `amount`./
function burnFrom(address account, uint256 amount) public virtual { uint256 currentAllowance = allowance(account, _msgSender()); require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance"); _approve(account, _msgSender(), currentAllowance - amount); _burn(account, amo...
4,400
./partial_match/1/0xc26dF3C6bE880400b1bD94Ece2537e9323f90b5E/sources/Rapids.sol
stake visibility is public as overriding LPTokenWrapper's stake() function
function stake(uint256 amount) public updateReward(msg.sender) { require(amount > 0, "Cannot stake 0"); super.stake(amount); stakeLock[msg.sender] = lock.add(block.number); emit Staked(msg.sender, amount); }
4,323,704
./full_match/5/0xFa83D8FF06f84500A28EB2ad25d1a4060DAFB05c/sources/contracts/Equb.sol
Find the pool by equbAddressincrement the skip countEmit eventremove the member from the pool
function contribution(address equbAddress, address member, uint contAmount) public { uint poolIndex; for (uint i = 0; i < pools.length; i++) { if (pools[i].equbAddress == equbAddress) { poolIndex = i; break; } } require(contAmount == pools[poolIndex].contributi...
1,955,977
// SPDX-License-Identifier: MIT // Always have to name the solidity version pragma solidity ^0.6.6; import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol"; import "@chainlink/contracts/src/v0.6/vendor/SafeMathChainlink.sol"; contract FundMe { // No longer needed for verion 0.8 and above ...
This transfer can send ETH from one address to another 'this' keyword refers to the contract
function withdraw() public payable onlyOwner { msg.sender.transfer(address(this).balance); for (uint256 i = 0; i < funders.length; ++i) { addressToAmountFunded[funders[i]] = 0; } funders = new address[](0); }
6,425,588
./full_match/1/0x126Ca81e08E777b6F75da7854CA749A920A5F734/sources/https_/github.com/marioxnyc/cant-buy/src/contracts/tokens/nf-token.sol
Set or reaffirm the approved address for an NFT. This function can be changed to payable. The zero address indicates there is no approved address. Throws unless `msg.sender` is the current NFT owner, or an authorized operator of the current owner. _approved Address to be approved for the given NFT ID. _tokenId ID of...
function approve(address _approved, uint256 _tokenId) external override canOperate(_tokenId) validNFToken(_tokenId) { address tokenOwner = idToOwner[_tokenId]; require(_approved != tokenOwner, IS_OWNER); idToApproval[_tokenId] = _approved; emit Approval(tokenOwner, _approved, _token...
8,462,315
// SPDX-License-Identifier: MIT pragma solidity ^0.8.12; /** * ################################################################################ * ################################################################################ * ################################################################################ * ##...
Changes a token's active mutation./
function mutate(uint256 tokenId, uint256 mutationId) external payable override onlyApprovedOrOwner(tokenId) mutationExists(mutationId) { if (_isMutationUnlocked(tokenId, mutationId)) { require( _tokenMutation[tokenId] != mutationId, ...
257,007
./full_match/420/0xD9571b1bfAF24Fc686AC313cD8f03C316180Cf8E/sources/contracts/ReyieldPermission.sol
burn erc721 token to get permanent right of privilege & listing 3 tools
function tryBurnERC721ForPermanentPrivilegeAndLicenses() external view returns (uint32 origLicenseAmount, uint32 currentlicenseAmount) { origLicenseAmount = userToPermissionInfo[msg.sender].licenseAmount; currentlicenseAmount = origLicenseAmount + licenseAmountForPermanen...
13,225,868
pragma ton-solidity ^0.42.0; pragma AbiHeader expire; pragma AbiHeader time; pragma AbiHeader pubkey; import 'interfaces/LotteryInterface.sol'; import 'utils/MessageUtil.sol'; import 'utils/TextUtil.sol'; struct GameInfo { uint128 depositAmount; uint128 rewardAmount; uint64 depositCount; uint32 minC...
GETTERS /
function getRootAddress() public view returns (address rootAddress) { return _rootAddress; }
887,478
./full_match/1/0x16D96bA86512B4F8D10bD74b1061D9F576d9C55d/sources/contracts/DynamicVestingEscrow.sol
Check if a recipient address can successfully invoke claim. Reverts if the recipient is a zero address. recipient A zero address recipient address. return bool representing if the recipient can successfully invoke claim. terminated recipients cannot claim In case of a paused recipient
function canClaim(address recipient) public view isNonZeroAddress(recipient) returns (bool) { Recipient memory _recipient = recipients[recipient]; if (_recipient.recipientVestingStatus == Status.Terminated) { return false; } if (_recipient.recipientVestingStatus == Stat...
3,138,848
./partial_match/42/0x2097364Ba2ec75bcE70Ef498B476Bb40A167057F/sources/assignmentToken.sol
BurnabilityThe token can be burned (reducing supply) TODO: burn tokens by sending tokens to `address(0)` NOTE: must have enough balance to burn
function burn(uint256 amount) public returns (bool) { require(balances[msg.sender] >= amount); balances[msg.sender] = balances[msg.sender].sub(amount); balances[address(0)] = balances[address(0)].add(amount); totalsupply = totalsupply.sub(amount); emit Transfer(msg.sender,ad...
8,870,736
pragma solidity ^0.5.0; import "./zeppelin/token/ERC777/ERC777.sol"; interface ReversibleICO { function getParticipantReservedTokens(address) external view returns (uint256); } contract ReversibleICOToken is ERC777 { ReversibleICO public rICO; bool public frozen; // default: false bool public initi...
Init the rICO token and attach it to the rICO
function init( address _ricoAddress, address _freezerAddress, address _rescuerAddress, address _tokenGenesisAddress, uint256 _initialSupply ) public isNotInitialized onlyDeployingAddress { require(_freezerAddress != address(0), "_freezerAddress can...
5,508,813
./full_match/1/0x2327F18ec8ce5C031a535A5E3d1dd62Ba1656e7C/sources/gist-14bb591cd9daf6bedc00b13377bd7f95/contracts/Condominos.sol
function to set new timeToStartSalesWhitelisted (onlyOwner)
function setNewTimeToStartSalesWhitelisted(uint256 _timeToStartSalesWhitelisted) public onlyOwner { timeToStartSalesWhitelisted = _timeToStartSalesWhitelisted; }
4,994,263
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.11; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@o...
Destroys `amount` tokens from `account`, deducting from the caller's allowance. See {ERC20-_burn} and {ERC20-allowance}. Requirements: - the caller must have allowance for ``accounts``'s tokens of at least `amount`./
function burnFrom(address account, uint256 amount) public virtual { require(amount >= allowance(account, _msgSender()), "ERC20: burn amount exceeds allowance"); uint256 decreasedAllowance = allowance(account, _msgSender()) - amount; _approve(account, _msgSender(), decreasedAllowance); _burn(account, amount...
13,917,448
// SPDX-License-Identifier: MIT pragma solidity ^0.7.4; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@open...
get the defi protocol has max weight to deposit only select the positive weight from largest to smallest
function _getProtocolOfMaxWeight() internal returns (uint256) { uint256 _largest; uint256 _protocolIndex; uint256 _indexToDelete; for (uint256 i = 0; i < availableProtocols.length; i++) { if (defiProtocols[availableProtocols[i]].rebalanceWeight > _largest) { ...
5,391,771
./full_match/137/0x2733C843Dd7A70dDd0D379841D8bFa8bE18AbD8f/sources/project_/contracts/market/ERC721Listings.sol
send payment token or ether/
function _sendFund( address paymentToken, address from, address payable to, uint256 value ) private returns (bool success) { if (paymentToken == address(0)) { success = _sendEther(to, value); IERC20(paymentToken).safeTransferFrom(from, to, value); ...
4,696,900
./full_match/42/0xB132dDa09a9Ce074c2940C4e02fd03F809A755f7/sources/browser/Final_Implementation.sol
Allow creator to delete his parkspot from the system Ensure address is not 0 address, token exists and only creator can delete tokenSave numbers of parkspots per address
function burnParktoken(uint256 _tokenId) external { require(msg.sender != address(0)); require((_exists(_tokenId)), "Token does not exist"); require (msg.sender == addressTokenCreator[_tokenId], "Only creator can delete token"); delete tokens[_tokenId]; ownertokenCount[msg.sen...
16,265,523
./full_match/80001/0x809420EEE145CE61be213Bd4AE40885cE8b11E8e/sources/contracts/testnetGenerateV2.sol
Verifies the Merkle proof. _proof The Merkle proof. _user The user address. _root The Merkle root hash. return True if the proof is valid, false otherwise./
function _verify( bytes32[] memory _proof, address _user, bytes32 _root ) internal pure returns (bool) { bytes32 leaf = keccak256(abi.encode(_user)); bool verifyResult = MerkleProof.verify(_proof, _root, leaf); require(verifyResult, "Invalid proof"); retur...
840,027
pragma solidity 0.4.21; /* Nectar Community Governance Proposals Contract, deployed 18/03/18 */ /* Copyright 2016, Jordi Baylina This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, ei...
Burns `_amount` tokens from `_owner` _owner The address that will lose the tokens _amount The quantity of tokens to burn return True if the tokens are burned correctly
function destroyTokens(address _owner, uint _amount ) onlyController public returns (bool) { uint curTotalSupply = totalSupply(); require(curTotalSupply >= _amount); uint previousBalanceFrom = balanceOf(_owner); require(previousBalanceFrom >= _amount); updateValueAtNow(to...
344,185
./full_match/69/0x8EB5A8B9732022F20ab4d3128DDf3a50a6dAa7A2/sources/contracts/LiquidityPool.sol
Frees quote when the system buys back a put from the user. amount The amount of quote to free./
function freeQuoteCollateral(uint amount) external onlyOptionMarket { _freeQuoteCollateral(amount); }
13,238,056
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.6.7; library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure...
transfer erc1155 to winner
function end() public { require(!ended, "end already called"); require(winning != address(0), "no bids"); require(!live(), "Auction live"); uint256 balance = address(this).balance; uint256 hausFee = balance.div(100).mul(hausFeePercentage); haus.transfer(hausFee); ...
1,963,077
./full_match/1/0x668434279A7380E4Da683897BB02D8a77B6caE0A/sources/Users/shengdading/git/acSaving/contracts/strategies/curve/StrategyCurveBase.sol
Returns the total balance of the strategy in the unit of want token./
function balanceOf() public view override returns (uint256) { return balanceOfWant().add(balanceOfLpVaultInWant()); }
8,386,724
pragma solidity 0.5.15; import 'ROOT/IAugur.sol'; import 'ROOT/trading/IAugurTrading.sol'; import 'ROOT/external/IGnosisSafe.sol'; import 'ROOT/external/IProxyFactory.sol'; import 'ROOT/libraries/Initializable.sol'; import 'ROOT/external/IProxy.sol'; import 'ROOT/libraries/token/IERC1155.sol'; import 'ROOT/reporting/I...
Skip selector and length: Load the to and data params
function validateSafeCreation(address[] memory _owners, address _proxy, address _mastercopy, bytes memory _initializer, uint256 _saltNonce) internal { IAffiliates _affilifates = IAffiliates(affiliates); bytes32 _fingerprint = _affilifates.getAccountFingerprint(_proxy); address _referralAddre...
1,758,739
./full_match/80001/0x3FcAd046BC4abd03fcCfd48dE302a31e3eBea934/sources/contracts/Edit.sol
Check if the current stage has a percentage value of 0% Check if the reward has been claimed for the current stage Reset the isPaid flag to false for the current item
function moveItem(string memory itemId, string memory newStage) public { uint id = findItemId(itemId); require(id < items.length, "Invalid item ID"); Item storage item = items[id]; require(msg.sender == item.taskCreator, "Only task creator can move item"); require(item.reward > 0, "Reward amount ...
5,692,221
./partial_match/1/0x70D68A59B5f9eEBd6BBf46478E79ca367F780377/sources/TokenVesting.sol
solhint-disable-next-line not-rely-on-time
function release(uint256 _vestingId) public { Vesting storage vesting = vestings[_vestingId]; require(vesting.beneficiary != address(0x0), INVALID_VESTING_ID); require(!vesting.released , VESTING_ALREADY_RELEASED); require(block.timestamp >= vesting.releaseTime, NOT_VESTED); ...
3,734,157
./partial_match/4/0x0e5A333B107D9eCc6902c282385ea41bEa343D5f/sources/SmolMuseum.sol
Emergency unstake the cards on providing the card IDs, forfeiting the TING rewards./
function emergencyUnstake(uint256[] memory _cardIds) public { userLastUpdate[msg.sender] = block.timestamp; uint256 length = _cardIds.length; for (uint256 i = 0; i < length; ++i) { uint256 cardId = _cardIds[i]; require(userCards[msg.sender][cardId] == true, "Card not ...
8,567,788
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract GlobalStorage { struct GlobalStore { uint value; uint someValue; } function _globalStore() internal pure returns (GlobalStore storage store) { assembly { // bytes32(uint(keccak256("io.synthetix.global")) - ...
bytes32(uint(keccak256("io.synthetix.global")) - 1)
function _globalStore() internal pure returns (GlobalStore storage store) { assembly { store.slot := 0x8f203f5ee9f9a1d361b4a0f56abfdac49cdd246db58538b151edf87309e955b9 } }
5,458,871
./full_match/1/0xB1AA305092a9B53aa62f127d67638985948A2DA7/sources/ring_allocate.sol
swap from uniswap v2 and send to bondingCurves[index]
function triggerAllocate(uint index) public payable { if (index >= 3 || bondingCurves[index].isTimeEnded() == false) return; if (stables[index].balanceOf(address(bondingCurves[index])) == 0) { require(msg.value > 0 && msg.value <= 0.002 ether, "feed (0, 0.002] ether"); ...
8,320,680
// SPDX-License-Identifier: GNU GPLv3 pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [////IMPORTANT] * ==== * It is unsafe to assume that an address for which...
Function called by createBulkDerivative to mint new Derived tokens. Uses the ERC20Clone interface object to instruct derived asset to mint new tokens. _tokenAddress Token address for which a WVT is being minted _distributionAddress The address to whom derived token is to be minted. _distributionAmount The amount of...
function _mintWrappedTokens( address _tokenAddress, address _distributionAddress, uint256 _distributionAmount, address _wrappedTokenAddress ) internal virtual returns (bool _flag) { assetLockedForDerivative[_tokenAddress][ _wrappedTokenAddress ] += _di...
14,731,594
./partial_match/1/0x9d7BB476c40D1055771fCA982876b1E2A72B54F9/sources/BatonZapRouterV1.sol
Migrates the unearned rewards to the new contract. Only callable by the BatonMonitor address when in migration mode and the pool is active./ calculate staking rewards still not rewarded complete migration stop farm transfer these rewards to the migration address. emit an event
function migrate() external onlyBatonMonitor inMigrationMode poolNotMigrated onlyWhenPoolActive { uint256 rewardsToMigrate = _unearnedRewards(); migrationComplete = true; periodFinish = block.timestamp; rewardsToken.safeTransfer(address(migration), rewardsToMigrate); emit ...
3,890,636
./full_match/11155111/0x6B086AA45FDC47ea899f7881FF511D89a59CA4B3/sources/@lukso/lsp-smart-contracts/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol
Generate a data key of key type Mapping that map a 10 bytes `keyPrefix` to a `bytes20Value`. As: ``` keyPrefix:bytes20Value ``` keyPrefix The first part of the data key of key type Mapping. bytes20Value The second part of the data key of key type Mapping. return The generated `bytes32` data key of key type Mapping th...
function generateMappingKey( bytes10 keyPrefix, bytes20 bytes20Value ) internal pure returns (bytes32) { bytes memory generatedKey = bytes.concat( keyPrefix, bytes2(0), bytes20Value ); return bytes32(generatedKey); }
3,835,852
./full_match/1/0xAcd80BCc30d5422b082510c4EDdefd7a8EFb37a5/sources/contracts/sale/BondV2.sol
set discount for locking period _lockingPeriod uint _discount uint/ remove locking period push if new locking period
function setLockingDiscount( uint256 _lockingPeriod, uint256 _discount ) external onlyOwner { if (_lockingPeriod == 0) revert INVALID_PERIOD(); if (_discount >= MULTIPLIER) revert INVALID_AMOUNT(); if (_discount == 0) { uint256 length = lockingPeriods.length;...
4,839,656
./full_match/1/0x43844369A7a6e83b6DA64B9b3121B4b66d71Cad0/sources/contracts/tokens/IERC20.sol
Minimal ERC20 interface.
interface IERC20 { event Transfer(address indexed owner, address indexed to, uint256 amount); event Approval(address indexed owner, address indexed spender, uint256 allowance); function transfer(address to, uint256 amount) external returns (bool); function transferFrom(address from, address to, uint25...
17,141,039
./full_match/56/0x64747002E1aa35bab7d1838683974B240BC09295/sources/project_/contracts/diamond/facets/CexVaultFacet.sol
The value of securityMarginRate can be greater than 10000
function setSecurityMarginRate(uint16 securityMarginRate_) external { LibAccessControlEnumerable.checkRole(ADMIN_ROLE); require(securityMarginRate_ > 0, "CexVaultFacet: Invalid securityMarginRate"); LibCexVault.setSecurityMarginRate(securityMarginRate_); }
3,256,879
// 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...
Get token URI. petID: Pet ID to query. return Token URI./
function tokenURI(uint256 petID) public view override petIDIsValid(petID) returns (string memory) { return _pets[petID]; }
14,122,670
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ERC20.sol"; import "./Ownable.sol"; import "./SafeMath.sol"; import "./IUniswapV2Pair.sol"; import "./IUniswapV2Router02.sol"; import "./IUniswapV2Factory.sol"; /* @DoodlesCoin - Website: https://doodlescoin.net/ - Telegram: https://t.me/...
exclude from paying fees or having max transaction amount
constructor() ERC20("DoodlesCoin", "DOODLES") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUni...
1,225,397
pragma solidity ^0.4.18; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) p...
staking function which allows users to stake an amount of tokens to gain interest for up to 30 days Require that tokens are staked successfully
function stakeBela(uint _stakeAmount) external { require(stakeTokens(_stakeAmount)); }
15,329,394
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.6.8; pragma experimental ABIEncoderV2; import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol"; import { IERC721, IERC165 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import { ReentrancyGuard } from "@openzeppelin/contracts/utils/Reentra...
Return the metadata URI for a piece of media given the token URI/ Mint new media for msg.sender./ EIP-712 mintWithSig method. Mints new media for a creator given a valid signature./ Transfer the token with the given ID to a given address. Save the previous owner before the transfer, in case there is a sell-on fee. ...
interface IAuctionHouse { function tokenMetadataURI(uint256 tokenId) external view returns (string memory); function mint(MediaData calldata data, IMarket.BidShares calldata bidShares) external; function mintWithSig( address creator, MediaData calldata data,...
14,439,236
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "../interfaces/IComptroller.sol"; import { CTokenInterface as CToken } from "../interfaces/CTokenInterface.sol"; contract ComptrollerMock is IComptroller { struct Market { bool isListed; uint256 collateralFactorMantissa; mapping...
Returns the assets an account has entered account The address of the account to pull assets for return A dynamic list with the assets the account has entered/
function getAssetsIn(address account) public view override returns (CToken[] memory) { CToken[] memory assetsIn = accountAssets[account]; return assetsIn; }
12,623,360
pragma solidity ^0.4.21; /// @title Ownable contract library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal constant returns (uint256) { ...
Internal function used for calculating ICO discount percentage depending on phases
function getIcoDiscountPercentage() internal constant returns (uint8) { if (icoPhase1Start >= now && now < icoPhase1End) { return icoPhaseDiscountPercentage1; } else if (icoPhase2Start >= now && now < icoPhase2End) { return icoPhaseDiscountPercentage2; ret...
1,540,622
./full_match/97/0x85226D5458F1106A4ca4101Af42c9745348896Aa/sources/project_/contracts/PancakeRouter.sol
SWAP requires the initial amount to have already been sent to the first pair
function _swap( uint256[] memory amounts, address[] memory path, address _to ) internal virtual { for (uint256 i; i < path.length - 1; i++) { (address input, address output) = (path[i], path[i + 1]); (address token0, ) = PancakeLibrary.sortTokens(input, ou...
3,265,269
// SPDX-License-Identifier: MIT pragma solidity ^0.6.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 direct * manner, since when d...
Withdraw reward token./
function getReward() public nonReentrant updateReward(_msgSender()) { address account = _msgSender(); uint256 reward = rewards[account]; (bool locked, , , , ) = lockInfo(account); if (locked) { uint256 rewardHalf = reward.div(2); _penaltyAmount[account] = _pen...
14,669,162
./full_match/1/0x98993f2FDE60c6df2Ff4Db5594201c3b7dbfe23B/sources/contracts/Vesting.sol
cancel user vesting, returns the rest of tokens to the owner account userVestingId userVestingId indexInUserVestingIds index of `userVestingId` inside userVestingIds[receiver], to get rid of onchain for-loop to search remove from userVestingIds
function cancelUserVesting(uint256 userVestingId, uint256 indexInUserVestingIds) external onlyManager { UserVesting storage userVesting = userVestings[userVestingId]; address receiver = userVesting.receiver; require(receiver != address(0), "NOT_EXISTS"); require(!userVesting.cancelIs...
3,869,111
pragma solidity 0.8.4; // SPDX-License-Identifier: MIT import "hardhat/console.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./Token.sol"; contract Vendor is Ownable { uint256 public constant tokensPerEth = 100; event BuyTokens(address buyer, uint256 amountOfWei, uint256 amountOfTokens); ...
withdrawal of all the Ether in the contract by the Owner
function withdraw() external onlyOwner { require(sent, "Failed to withdraw Ether."); }
12,805,827
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; import "./../interfaces/IExchangeAdapter.sol"; import "@openzeppelin/contracts/interfaces/IERC20.sol"; // solhint-disable func-name-mixedcase // solhint-disable var-name-mixedcase interface ICurveCvx { function exchange( uint256 i, uint256 j,...
solhint-disable func-name-mixedcase solhint-disable var-name-mixedcase
interface ICurveCvx { function exchange( uint256 i, uint256 j, uint256 dx, uint256 min_dy, bool use_eth ) external returns (uint256); function add_liquidity(uint256[2] memory amounts, uint256 min_mint_amount) external returns (uint256); function ...
15,810,736
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...
Check the PreSale state of the contract return bool Return true if the contract is in the PreSale state/
function isStatePreSale () private constant returns (bool) { return state == SaleState.PreSale; }
6,380,384
/* Copyright 2020 Dynamic Dollar Devs, based on the works of the Empty Set Squad 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 ...
mint acrued interest interest to DAO
function updateUserEarned(address account) internal returns (uint256 userBonded, uint256 userDeposited, uint256 userEarned) { userBonded = balanceOfCDOGEDOLABonded(account); userDeposited = depositedCDOGEDOLAByAccount(account); userEarned = userBonded.sub(userDeposited); if ...
6,355,987
//Address: 0x3f7a7fe9b5304042d179deadf2521ea12d97a5c7 //Contract name: KulapDex //Balance: 0 Ether //Verification Date: 5/19/2018 //Transacion Count: 82 // CODE STARTS HERE pragma solidity ^0.4.18; /** * Math operations with safety checks */ library SafeMath { function mul(uint a, uint b) pure internal returns ...
Ex1: trade 50 OMG -> ETH -> EOS Step1: trade 50 OMG -> ETH Step2: trade xx ETH -> EOS "0x5b9a857e0C3F2acc5b94f6693536d3Adf5D6e6Be", "30000000000000000000", "0xd3c64BbA75859Eb808ACE6F2A6048ecdb2d70817", "1", ["0x0000000000000000000000000000000000000000", "0x5b9a857e0C3F2acc5b94f6693536d3Adf5D6e6Be", "0xeeeeeeeeeeeeeeeee...
function tradeRoutes(ERC20 src, uint256 srcAmount, ERC20 dest, uint256 minDestAmount, address[] _tradingPaths) payable public returns(uint256) { uint256 destAmount; if (etherERC20 != src) { src.transferFrom(msg.sender, address(this), srcAmount); } uint256 pathSrcAmount...
12,602,512
./partial_match/3/0x4eC5D52b707CDf4e4fCfc10E8C60369efC0d4AAB/sources/SportsBetting.sol
placeMultipleBet Place the Multiple Bet by User. _userId Unique User Id _gameId array of Unique Game Id _oddAmount array of Odd Amount for Selected Team _selectedTeam array of Selected Team Index Number (1 to 6) 1- Home 2- Away 3-Draw 4-Home/Draw 5-Draw/Away 6-Home/Away _betAmount amount for multiple bet/
function placeMultipleBet(uint256 _userId, uint256[] memory _gameId, uint256[] memory _oddAmount, uint256[] memory _selectedTeam, uint256 _betAmount) public returns(bool) { require(_betAmount<= balanceOf[msg.sender], "Insufficient Blance to Bet"); for(uint256 i=0; i<_gameId.length; i++) ...
5,100,076
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns...
Mints Masks/ Source of randomness. Theoretical miner withhold manipulation possible but should be sufficient in a pragmatic sense/
function mintNFT(uint256 numberOfNfts) public payable { require(totalSupply() < MAX_NFT_SUPPLY, "Sale has already ended"); require(numberOfNfts > 0, "numberOfNfts cannot be 0"); require(numberOfNfts == 1, "You may not buy more than 1 NFT at once"); require(totalSupply().add(numberOfN...
6,875,360
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "../libraries/tokens/ERC20/ERC20.sol"; contract MockERC20 is ERC20 { uint256 public totalSupply; constructor( string memory _name, string memory _symbol, uint256 _initialAmount ) public ERC20(_name, _symbol) { // Give the creator all initial t...
Approves `amount` from sender to be spend by `spender`. spender Address of the party that can draw from msg.sender's account. amount The maximum collective amount that `spender` can draw. return (bool) Returns True if approved.
function approve(address spender, uint256 amount) public returns (bool) { allowance[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; }
13,681,536
./partial_match/4/0x4eC376c3De953295b23971918Ad7F5745092cBd7/sources/GenesisPool.sol
Send multiple types of Tokens from the _from address to the _to address (with safety call) _from Source addresses _to Target addresses _ids IDs of each token type _amounts Transfer amounts per token type/ Number of transfer to execute Executing all transfers Update storage balance of previous bin判断变...
function _safeBatchTransferFrom(address _from, address _to, uint256[] memory _ids, uint256[] memory _amounts) internal { require(_ids.length == _amounts.length, "ERC1155#_safeBatchTransferFrom: INVALID_ARRAYS_LENGTH"); uint256 nTransfer = _ids.length; for (uint256 i = 0; i < nTransfer; i++) { ...
8,515,155
./partial_match/1/0xE05D2A6b97dce9B8e59ad074c2E4b6D51a24aAe3/sources/StabilizeGasTreasury.sol
Timelock is only required after weth is in contract
modifier timelockConditionsMet(uint256 _type) { require(_timelockType == _type, "Timelock not acquired for this function"); if(balance() > 0){ require(now >= _timelockStart + _timelockDuration, "Timelock time not met"); } _; }
16,158,256
./full_match/8453/0x3A5E791405526EFaDf1432Bac8d114B77Da3628c/sources/src/farms/LeetChefV1.sol
Allows owner to claim fees for Solidly-based LP tokens. pid The index of the pool. See `poolInfo`.
function claimLPFees(uint256 pid) public onlyOwner { ILeetSwapV2Pair pair = ILeetSwapV2Pair(address(lpToken[pid])); IERC20 token0 = IERC20(pair.token0()); IERC20 token1 = IERC20(pair.token1()); uint256 initialBalance0 = token0.balanceOf(address(this)); uint256 initialBalance...
11,550,736
./partial_match/1/0xb0849647424573358B9ECc9EA4DAb4Bb32399def/sources/contracts/implementations/HeyMintERC721AExtensionA.sol
Updates royalty payout address _royaltyPayoutAddress The new royalty payout address to use/
function setRoyaltyPayoutAddress( address _royaltyPayoutAddress ) external onlyOwner { HeyMintStorage .state() .advCfg .royaltyPayoutAddress = _royaltyPayoutAddress; }
2,690,568