file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./full_match/43114/0x629B9f9559B0D044AB5F4B0bC15bB039d184C43d/sources/Hzj.sol
Generate a random hash by using the next block's difficulty and timestamp
function random() private view returns (uint) { return uint(keccak256(abi.encodePacked(block.difficulty, block.timestamp))); }
4,627,551
./partial_match/137/0x0000000000000000000000000000000000001010/sources/MRC20.sol
Assembly for more efficiently computing: return keccak256(abi.encode( schemaHash, spender, tokenIdOrAmount, data, expiration )); Load free memory pointer Compute hash
function hashTokenTransferOrder( address spender, uint256 tokenIdOrAmount, bytes32 data, uint256 expiration ) internal pure returns (bytes32 result) { bytes32 schemaHash = EIP712_TOKEN_TRANSFER_ORDER_SCHEMA_HASH; assembly { let memPtr := mload(64) ...
3,509,890
pragma experimental ABIEncoderV2; pragma solidity ^0.4.24; import 'zeppelin-solidity/contracts/ownership/Ownable.sol'; contract Alias is Ownable { using AliasFilter for string; event AliasSetLog(address indexed player, bytes32 indexed alias); struct PlayerAlias { address player; bytes32 a...
new alias overwrite old alias reset previous alias set alias
function setAlias(string _alias) public { bytes32 alias = _alias.aliasFilter(); require(aliasIndex_[alias] == 0, "alias is already taken"); uint256 index = playerIndex_[msg.sender]; if (index == 0) { playerAlias_.push(PlayerAlias(msg.sender, alias)); playerIn...
5,377,444
pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/AddressUtils.sol"; import "./CvcEscrowInterface.sol"; import "../pricing/CvcPricingInterface.sol"; import "../upgradeability/Initi...
Returns placement amount. _placementId The placement ID. return uint256/ return placements[_placementId].amount;
function getPlacementAmount(bytes32 _placementId) internal view returns (uint256) { return uintStorage[keccak256(abi.encodePacked("placements.", _placementId, ".amount"))]; }
6,411,439
pragma solidity ^0.4.15; import "./AuctionInterface.sol"; /** @title GoodAuction */ contract GoodAuction is AuctionInterface { /* New data structure, keeps track of refunds owed to ex-highest bidders */ mapping(address => uint256) refunds; /* Bid function, shifts to pull paradigm * Must return true on successfu...
Give people their funds back /
function () payable { revert(); }
1,015,607
./full_match/11155111/0xb8e18d02Eb26C78db2569942356EBc5762527eA8/sources/contracts/CrowdFunding.sol
create an empty array of Campaigns
function getCampaigns() public view returns(Campaign[] memory) { Campaign[] memory allCampaigns = new Campaign[](numberOfCampaigns); for (uint i = 0; i < numberOfCampaigns; i++) { Campaign storage item = campaigns[i]; allCampaigns[i] = item; } return allCam...
3,839,180
pragma solidity ^0.4.24; interface Token { function totalSupply() constant external returns (uint256 ts); function balanceOf(address _owner) constant external returns (uint256 balance); function transfer(address _to, uint256 _value) external returns (bool success); function transferFrom(address _from, ...
Send coins and call receiveTransfer/
function transferAndCall(address _to, uint256 _value, bytes _extraData) public returns (bool success) { if(transfer(_to, _value)) { transferRecipient(_to).receiveTransfer(msg.sender, _value, _extraData); return true; } }
12,842,133
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "./VampireAdapter.sol"; import "./interfaces/IChiToken.s...
Determines which pools can be drained based on value of rewards available/ success ignore failed drain
function drainPools(uint256[] memory pids) external returns(uint32) { uint256 poolLength = pids.length; uint32 numDrained; for (uint i = 0; i < poolLength; ++i) { uint pid = pids[i]; (Victim victim, uint256 victimPoolId,,,,,) = masterVampire.poolInfo(pid); ...
5,536,524
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "./SkullPunksLogic.sol"; contract SkullpunksXG is ERC721...
mint called everytime signin successful in the dapp
function initialMintAllowance(address _add,uint256 _allow) internal returns (bool){ uint256 allowance = mintAllowance[_add]; mintAllowance[_add] = _allow + allowance; mintAllowanceSatus[_add] = true; return true; }
10,174,671
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 MOD863(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
14,093,971
./full_match/4/0xCdd0764F397D90a429E63055C1e06D6F3cFBEb50/sources/browser/pier-bim-v4.sol
Make sure the file hash exists Make sure drawing number exists
function newDrawingApprovalRequest(address _receiver, string memory _drawingNumber, string memory _revision, string memory _drawingTitle, string memory _fileIpfsHash) checkForWallet(msg.sender) public { require(bytes(_fileIpfsHash).length > 0); require(bytes(_drawingNumber).length > 0, "Please ensur...
12,343,772
./full_match/1/0xA16bE8d32934a9AaB272102AC4BB890481F4074E/sources/src/Factory.sol
Sets the private pool implementation contract that newly deployed proxies point to. _privatePoolImplementation The private pool implementation contract.
function setPrivatePoolImplementation(address _privatePoolImplementation) public onlyOwner { privatePoolImplementation = _privatePoolImplementation; emit SetPrivatePoolImplementation(_privatePoolImplementation); }
9,718,371
pragma solidity ^0.4.24; import "./AccessAccount.sol"; contract TrustAccount is AccessAccount { //array of all the owner addresses address[] owners; //counter of all owners uint noOfOwners = 0; //ballot counter uint ballotIDs = 0; //the different types of votes enum VoteType {removeOwn...
_current : the current address of the owner _new : the new address of the owner this is how owners can request to change their address the other owners will vote on this. If the vote dose not pass the request will fail and will not be able to be acted on./
function requestChangeOwnerAddress(address _current, address _new) public isOwner() isFrozen() returns(uint) { AccessAccount.freeze(); require(allOwners[ownersKeys[_current]].isOwner, "Current address not recognised"); uint ballotID = createBallot(VoteTyp...
1,041,610
//Address: 0x7d193819ad03d0dc90f00cccb26e190e95f1f2ac //Contract name: Token //Balance: 0 Ether //Verification Date: 3/4/2018 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^ 0.4.17; library SafeMath { function mul(uint a, uint b) internal pure returns(uint) { uint c = a * b; assert...
it will white list one member _user {address} of user to whitelist return true if successful
function addToWhiteList(address _user) external onlyOwner() returns (bool) { if (whiteList[_user] != true) { whiteList[_user] = true; totalWhiteListed++; LogWhiteListed(_user, totalWhiteListed); } return true; }
6,433,750
./full_match/1/0x3f4DD25BA6Fb6441Bfd1a869Cbda6a511966456D/sources/src/HoneyJar.sol
view function for frontend
function nextTokenId() external view override returns (uint256) { return _nextTokenId; }
3,093,377
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount o...
Generate the leaf node (just the hash of tokenID concatenated with the account address)
function toLeaf(uint256 tokenID, uint256 index, uint256 grade) public pure returns (bytes32) { return keccak256(abi.encodePacked(index, tokenID, grade)); }
5,752,957
pragma solidity ^0.8.7; import "../nftx/interface/INFTXVault.sol"; import "../nftx/interface/INFTXLPStaking.sol"; import "../nftx/interface/IUniswapV2Router01.sol"; import "../nftx/interface/IVaultTokenUpgradeable.sol"; import "../nftx/interface/IRewardDistributionToken.sol"; import {IWETH} from "../nftx/interfa...
Calculates the square root of x, rounding down. Uses the Babylonian method https://en.wikipedia.org/wiki/Methods_of_computing_square_rootsBabylonian_method. Caveats: - This function does not work with fixed-point numbers. x The uint256 number for which to calculate the square root. return result The result as an uint...
function sqrt(uint256 x) internal pure returns (uint256 result) { if (x == 0) { return 0; } result = 1; if (xAux >= 0x100000000000000000000000000000000) { xAux >>= 128; result <<= 64; } if (xAux >= 0x10000000000000000) { ...
884,600
pragma solidity 0.4.25; // * Samurai Quest - Levelling game that pay ether. Version 1. // // * Developer - Studio California // "You can check out any time you like, but you can never leave" // // * Uses Linked List to store player level // // * Refer to https://samurai-quest.hostedwiki...
Toggle auto level up, for those who don't intend to play longer, can set the auto level up to false _samuraiId - Id of the samurai
function toggleAutoLevelUp(uint256 _samuraiId) public { Samurai storage samurai = idToSamurai[_samuraiId]; require(!samurai.isRetreat, "you've already quit!"); require(msg.sender == samurai.addr, "you must be a yokai spy"); samurai.autoLevelUp = !samurai.autoLevelUp; }
13,088,940
// SPDX-License-Identifier: MIT /** ∩~~~~∩ ξ ・×・ ξ ξ ~ ξ ξ   ξ ξ   “~~~~〇 ξ       ξ ξ ξ ξ~~~ξ ξ ξ   ξ_ξξ_ξ ξ_ξξ_ξ Alpaca Fin Corporation */ pragma solidity 0.6.6; import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol"; import "@openzeppelin/contracts-ethereum-package/contr...
Set the configuration for the given workers. Must only be called by the owner.
function setWorkers(address[] calldata addrs, IWorkerConfig[] calldata configs) external onlyOwner { require(addrs.length == configs.length, "ConfigurableInterestVaultConfig::setWorkers:: bad length"); for (uint256 idx = 0; idx < addrs.length; idx++) { workers[addrs[idx]] = configs[idx]; emit SetW...
2,486,038
pragma solidity ^0.5.16; import "openzeppelin-solidity-2.3.0/contracts/math/SafeMath.sol"; import "openzeppelin-solidity-2.3.0/contracts/token/ERC20/IERC20.sol"; import "openzeppelin-solidity-2.3.0/contracts/token/ERC20/SafeERC20.sol"; import "./synthetix/interfaces/IExchangeRates.sol"; import "./synthetix/interfaces...
See inline comments for replaced/mocked functionality from SIP-120 One of src/dest synth must be sUSD (checked below for gas optimization reasons) If, after settlement the user has no balance left (highly unlikely), then return to prevent emitting events of 0 and don't revert so as to ensure the settlement queue is emp...
function _exchangeAtomically( address from, bytes32 sourceCurrencyKey, uint sourceAmount, bytes32 destinationCurrencyKey, address destinationAddress ) internal returns (uint amountReceived, uint fee) { _ensureCanExchange(sourceCurrencyKey, sourceAmount, destinatio...
6,461,601
// SPDX-License-Identifier: MIT /** ______ _____ _____ ______ ___ __ _ _ _ | ____| __ \ / ____|____ |__ \/_ | || || | | |__ | |__) | | / / ) || | \| |/ | | __| | _ /| | / / / / | |\_ _/ | |____| | \ \| |____ / / / /_ | | | | |______|_| \_\\_____|/_/ |____||_| |_| ...
Returns number of token burned./
function _burned() internal view returns (uint256 burned){ uint256 totalBucket = (_minted >> 8) + 1; for(uint256 i=0; i < totalBucket; i++) { uint256 bucket = _burnedToken.getBucket(i); burned += _popcount(bucket); } }
1,756,357
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/token/ERC721/ERC721.sol'; import '@ensdomains/ens-contracts/contracts/registry/ENS.sol'; import {PublicResolver} from '@ensdomains/ens-contracts/contracts/resolvers/PublicResolv...
Restrict registration. Can only be called by the owner./
function restrictRegistration() public override onlyOwner { _restricted = true; emit Restricted(); }
13,115,152
./partial_match/1/0xFCE1c68E7414605fF1f97D197D6Ba05a6d232311/sources/cache/solpp-generated-contracts/Escrow.sol
Liquidates a batch of accounts in a specific currency. Final token balances will be withdrawn and deposited to the liquidator's account. - CANNOT_LIQUIDATE_SUFFICIENT_COLLATERAL: account has positive free collateral and cannot be liquidated - CANNOT_LIQUIDATE_SELF: liquidator cannot equal the liquidated account - IN...
function liquidateBatch( address[] calldata accounts, uint16 localCurrency, uint16 collateralCurrency ) external { Liquidation.RateParameters memory rateParam = _validateCurrencies(localCurrency, collateralCurrency); uint128[] memory amountRecollateralized = new uint128[...
16,064,587
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGu...
view functions for redeem amounts, loops duplicated for gas
function redeemable() public view returns (uint256) { uint256 toRedeem; uint256 maxRewardPoolSlot = totalSupply() / (MAX_BOTS / TOTAL_REWARD_POOLS); uint256 owned = balanceOf(msg.sender); for (uint256 i = 0; i < owned; i++) { uint256 tokenId = tokenOfOwnerByIndex(msg.sender, i); uint256 r...
5,517,570
./full_match/3/0x67e015e97AAF19e150eEA5085043c04daf469C33/sources/browser/NewDAO/Controller.sol
Component(self's thing)
function createProxy(string memory name) public returns (address) { address main = _getBeaconAddress(name, BeaconType.Main); address backup = _getBeaconAddress(name, BeaconType.Backup); address temp = _creatProxy(main, backup,name); proxyAddress[name] = temp; return temp; }
8,204,065
pragma solidity ^0.5.16; pragma experimental ABIEncoderV2; import "./GovernorBravoInterfaces.sol"; contract GovernorBravoDelegator is GovernorBravoDelegatorStorage, GovernorBravoEvents { constructor( address timelock_, address ondo_, address admin_, address implementation_, uint256 votingPer...
Called by the admin to update the implementation of the delegator implementation_ The address of the new implementation for delegation/
function _setImplementation(address implementation_) public { require( msg.sender == admin, "GovernorBravoDelegator::_setImplementation: admin only" ); require( implementation_ != address(0), "GovernorBravoDelegator::_setImplementation: invalid implementation address" ); a...
10,322,865
./full_match/1/0x9642c7026822391100a4773d7aA597AE18ECE7dd/sources/Synthetix.sol
ERC223 transferFrom function/ Skip allowance update in case of infinite allowance Reduce the allowance by the amount we're transferring. The safeSub call will handle an insufficient allowance.
function transferFrom(address from, address to, uint value, bytes data) public optionalProxy returns (bool) { require(from != 0xfeefeefeefeefeefeefeefeefeefeefeefeefeef, "The fee address is not allowed"); if (tokenState.allowance(from, messageSender) != uint(-1)) { ...
16,502,981
// SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // Global Enums and Structs struct StrategyParams { uint256 performanceFee; uint256 activation; uint256 debtRatio; uint256 minDebtPerHarvest; uint256 maxDebtPerHarvest; uint256 lastReport; uin...
Expressed in BIPS. 100% == 10_000
function setPercentKeep(uint256 _percentKeep) external onlyAuthorized { require(_percentKeep <= BIPS, "!tooBig"); percentKeep = _percentKeep; }
1,586,547
./full_match/43114/0x594D5519c2BCBFd5D21aa9FA6755312caA31CFd4/sources/contracts/liquid-yield/LyRedistributor.sol
Withdraw yield bearing tokens
function unstake(uint256 amount, address recipient) external { disburseReward(msg.sender); stakedBalance[msg.sender] -= amount; if (amount > 0) { stakeToken.safeTransfer(recipient, amount); } }
4,513,035
./full_match/3/0xe30c6cC142633243F40d0F141938B0602FE3a6D0/sources/browser/AccredifyMultiSigDocStore.sol
Execute a multi-signature issue transaction from this wallet using 2 signers: one from msg.sender and the other from ecrecover. hash the certificate batch's hash that will be appended to the blockchain signature second signer's signature/
function issue( bytes32 hash, bytes memory signature ) public onlyCustodian { bytes32 operationHash = keccak256(abi.encodePacked("ISSUE", hash)); verify(operationHash, signature, 0); documentStore.issue(hash); }
8,264,556
// File: contracts/intf/IDODO.sol pragma solidity 0.6.9; pragma experimental ABIEncoderV2; interface IDODO { function INIT73( //inject NONSTANDARD NAMING addres...
inject NONSTANDARD NAMING
function SUB819(uint256 a, uint256 b) internal pure returns (uint256) {
14,042,474
// 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...
Create a bid on a token, with a given amount. If provided a valid bid, transfers the provided amount to this contract. If the auction is run in native ETH, the ETH is wrapped so it can be identically to other auction currencies in this contract./ For Zora Protocol, ensure that the bid is valid for the current bidShare...
function createBid(uint256 auctionId, uint256 amount) external override payable auctionExists(auctionId) nonReentrant { address payable lastBidder = auctions[auctionId].bidder; require(auctions[auctionId].approved, "Auction must be approved by curator"); require( ...
10,082,641
./partial_match/1/0x4Ef74D319437Bb420Dc19080c858A73AA0E8f8E4/sources/DecentralCards.sol
swap tokens for ETH
function swapBack(uint256 _swapThreshold) private lockTheSwap { uint256 threadhold = _swapThreshold.sub(balanceOf(marketingWallet)); swapTokensForEth(threadhold, address(this)); payable(marketingWallet).transfer(address(this).balance); }
4,492,346
//Address: 0xb8bf73550f251562d308882e032225a700a7b9bc //Contract name: DWorldCore //Balance: 0 Ether //Verification Date: 2/3/2018 //Transacion Count: 7 // CODE STARTS HERE pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { functi...
Buy unclaimed plots. _deedIds The unclaimed plots to buy. _buyoutPrice The initial buyout price to set on the plot. name The name to give the plots. description The description to add to the plots. imageUrl The image url for the plots. infoUrl The info url for the plots. The sender has a free claim allowance. Sub...
function claimPlotMultipleWithData(uint256[] _deedIds, uint256 _buyoutPrice, string name, string description, string imageUrl, string infoUrl) public payable whenNotPaused { uint256 buyAmount = _deedIds.length; uint256 etherRequired; if (freeClaimAllowance[msg.sender] > 0) { if (...
15,801,574
./full_match/1/0x435ad5B4Ff6ba65e85b86dBe397E7845748536FA/sources/contracts/core/Controller.sol
Add reward token to list
function addRewardToken(address _token) public onlyOwner { require(_token != address(0), "ZERO_ADDRESS"); for (uint256 i = 0; i < rewardTokens.length; i++) { require(rewardTokens[i] != _token, "DUPLICATE_REWARD_TOKEN"); } rewardTokens.push(_token); accRewardPerSh...
4,840,473
pragma solidity ^0.4.0; /* Temporary Hash Registrar ======================== This is a simplified version of a hash registrar. It is purporsefully limited: names cannot be six letters or shorter, new auctions will stop after 4 years and all ether still locked after 8 years will become unreachable. The...
Submit a name 6 characters long or less. If it has been registered, the submitter will earn 50% of the deed value. We are purposefully handicapping the simplified registrar as a way to force it into being restructured in a few years. unhashedName An invalid name to search for in the registry./ Reward the discoverer wi...
function invalidateName(string unhashedName) inState(sha3(unhashedName), Mode.Owned) { if (strlen(unhashedName) > 6 ) throw; bytes32 hash = sha3(unhashedName); entry h = _entries[hash]; ens.setSubnodeOwner(rootNode, hash, 0); if(address(h.deed) != 0) { h....
12,950,922
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "../ConfirmedOwner.sol"; import "../vendor/SafeMathChainlink.sol"; import "../interfaces/FlagsInterface.sol"; import "../interfaces/AggregatorV3Interface.sol"; import "../interfaces/UniswapAnchoredView.sol"; import "../interfaces/KeeperCompatibleInterface....
Retrieve the price and the decimals from an Aggregator aggregator address return price uint256 return decimals uint8/
function _aggregatorValues(address aggregator) private view returns (uint256 price, uint8 decimals) { AggregatorV3Interface priceFeed = AggregatorV3Interface(aggregator); (, int256 signedPrice, , , ) = priceFeed.latestRoundData(); price = uint256(signedPrice); decimals = priceFeed.decimals(); }
13,048,053
./full_match/80001/0xdCdf0B3d68A4E11eF2703b87020dC5a9c66babf7/sources/@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol
Updates the units of a subscription. This changes the number of shares the subscriber holds. Meant for usage in super apps token Super Token used with the index. indexId ID of the index. subscriber Subscriber address whose units are to be updated. units New number of units the subscriber holds. ctx from super app ...
function updateSubscriptionUnitsWithCtx( ISuperToken token, uint32 indexId, address subscriber, uint128 units, bytes memory ctx ) internal returns (bytes memory newCtx) { (ISuperfluid host, IInstantDistributionAgreementV1 ida) = _getAndCacheHostAndIDA(token); ...
856,011
//SPDX-License-Identifier: MIT pragma solidity ^0.7.5; import "./interfaces/IERC20.sol"; import "./interfaces/ILendingPool.sol"; contract Lottery { // the timestamp of the drawing event uint public drawing; // the price of the ticket in DAI (100 DAI) uint ticketPrice = 100 ether; // 2. Purchasing address[] ...
2.1 Purchasing 3. Earn Interest
function purchase() external { dai.transferFrom(msg.sender, address(this), ticketPrice); require(_isNewPurchaser(msg.sender)); purchaserIndexes.push(msg.sender); purchasers[msg.sender] = purchaserIndexes.length - 1; dai.approve(address(pool), ticketPrice); pool.deposit(address...
2,571,617
./full_match/1/0xc600727f1Ce705436734F2367e7FC449da5fB3a6/sources/contracts/tokens/AutoCoinageSnapshot2.sol
Snapshot the current staking information of a specific Layer2. @inheritdoc IAutoCoinageSnapshot2
function snapshot(address layer2) public override returns (uint256) { return _snapshot(layer2); }
9,638,790
// File: contracts/libraries/Math.sol // SPDX-License-Identifier: MIT pragma solidity 0.6.12; library Math { function min(uint x, uint y) internal pure returns (uint z) { z = x < y ? x : y; } // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method) ...
Given a valid start position, find a proper position to insert order prevKey contains three suggested order IDs, each takes 24 bits. We try them one by one to find a valid start position can not use this function to insert at head! if prevKey is all zero, it will return false
function _insertOrderFromGivenPos(bool isBuy, Order memory order, uint32 id, uint72 prevKey) private returns (bool inserted) { (uint32 currID, Order memory prevOrder, bool findIt) = _getOrder3Times(isBuy, prevKey); if(!findIt) { return false; ...
1,096,966
// SPDX-License-Identifier: Unlicense pragma solidity >=0.7.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/math/Math.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/SafeCast.sol"; import "../interfaces/ILockTOSDividend.sol"; ...
@inheritdoc ILockTOSDividend
function claimUpTo(address _token, uint256 _timestamp) external override { require(claimableForPeriod(msg.sender, _token, genesis, _timestamp) > 0, "Claimable amount is zero"); _claimUpTo(_token, _timestamp); }
14,797,977
pragma solidity ^0.4.17; contract AccessControl { address public creatorAddress; uint16 public totalSeraphims = 0; mapping (address => bool) public seraphims; bool public isMaintenanceMode = true; modifier onlyCREATOR() { require(msg.sender == creatorAddress); _; } modif...
shouldn't have any eth here but just in case.
function withdrawEther() onlyCREATOR external { creatorAddress.transfer(this.balance); }
5,455,673
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; /* Library Imports */ import {AddressAliasHelper} from '../../standards/AddressAliasHelper.sol'; import {Lib_OVMCodec} from '../../libraries/codec/Lib_OVMCodec.sol'; import {Lib_AddressResolver} from '../../libraries/resolver/Lib_AddressResolver.sol'; /* Interfa...
Reads an RLP bytes value into bytes. _in RLP bytes value. return Decoded bytes./
function readBytes(RLPItem memory _in) internal pure returns (bytes memory) { ( uint256 itemOffset, uint256 itemLength, RLPItemType itemType ) = _decodeLength(_in); require(itemType == RLPItemType.DATA_ITEM, 'Invalid RLP bytes value.'); return _copy(_in.ptr, itemOffset, itemLength)...
1,596,375
./partial_match/3/0xA462A609A9dF2C09082C88569175F4fbAa42Ac65/sources/PCToken.sol
Set the token that the paid out fee is converted to before payout Set to address(0) if we want to payout pool shares instead/
function setPayoutToken(address erc20) external logs lock onlyOwner needsBPool { if (erc20 != address(0)) { require(bPool.isBound(erc20), "ERR_NOT_BOUND"); } payoutToken = erc20; }
5,268,529
./full_match/5/0x2d9cE2dCF90122B597aDecaA111558dBfD885215/sources/project_/contracts/MuallaqatNFTMarket.sol
delete itemId return token to owner change status to canceled
function deleteItem(uint256 itemId) public { require(idToMarketItem[itemId].itemId !=0 ,"Please chose a vaild item"); require(msg.sender == admin || idToMarketItem[itemId].owner == msg.sender,"You are not the owner of this item"); idToMarketItem[itemId].status = Status.Canceled; MuallaqatNFT(idToMa...
1,945,363
./partial_match/1/0x91Bfce317111F14737b6f5C892785C2aAF4Dfd7b/sources/ScotchMarketplace.sol
send accumulated funds to recipient (native-token = zero tokenContract) address of the current contract get Scotch Marketplace balance in native token send native token amount to _beneficiar get ERC-20 Token Contract get Scotch Marketplace balance in ERC-20 Token send ERC-20 token amount to recipient
function sendFunds(uint256 amount, address tokenContract) public virtual onlyOwner { require(_isBeneficiaryExists(), "Beneficiary should be specified!"); require(amount > 0, "Send Amount should be positive!"); address current = address(this); if (tokenContract == address(0)) { uint256 balance ...
3,671,430
./partial_match/1/0x15f8Fc209A1c97a40e64Bf14C8c7D1D9c0541D0f/sources/nft.sol
change baseURI in case needed for IPFS
function changeBaseURI(string memory baseURI_) external onlyOwner { _currentBaseURI = baseURI_; }
2,747,046
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; pragma abicoder v2; import "@openzeppelin/contracts/utils/Counters.sol"; contract Forum { using Counters for Counters.Counter; enum ItemKind { POST, COMMENT } /** * @notice Represents a single forum post or comment. */ struct ...
Adds a comment to a post or another comment. will revert if the parent item does not exist. parentId the id of an existing item contentCID IPFS CID of comment content object/
function addComment(uint256 parentId, string memory contentCID) public { require(items[parentId].id == parentId, "Parent item does not exist"); itemIdCounter.increment(); uint256 id = itemIdCounter.current(); address author = msg.sender; items[parentId].childIds.push(id); uint256[] memory c...
12,729,258
./partial_match/56/0x80bAb1Bf4Fbd9aE310a7f2fa8254ac141E605C7d/sources/Farming.sol
Returns the smallest of two numbers./
function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; }
11,183,247
./partial_match/1/0x75Be69fc0859874E722D97a7f464D402e3dCff58/sources/contracts/standards/HONEYCOMBS721.sol
Approve `to` to operate on `tokenId` Emits an {Approval} event./
function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(HONEYCOMBS721.ownerOf(tokenId), to, tokenId); }
3,888,220
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.4; import './interfaces/IERC3156FlashLender.sol'; import './VaultFactory.sol'; contract FlashLoanProvider is IERC3156FlashLender { event FlashLoan( address indexed receiver, address token, uint256 amount, uint256 fee, ...
Setter for minimum amount for flash. _minAmountForFlash Minimum amount for a flash./
function setMinAmountForFlash(uint256 _minAmountForFlash) external onlyModerator { minAmountForFlash = _minAmountForFlash; }
5,770,175
./partial_match/3/0x775B573bdc5106293F4E8ce8cD210006decccEd9/sources/Withdrawals.sol
responsible for calling withdraw function/ if it's token transfer the tokenAddress will be 0x0000... _destination receiver of token or eth _amount amount of ETH or Tokens _tokenAddress actual token address or 0x000.. in case of eth transfer/ fallback function only to enable ETH transfer/
function() payable public { }
5,141,857
/** *Submitted for verification at Etherscan.io on 2021-02-21 */ // File: contracts/interfaces/ISaffronBase.sol // SPDX-License-Identifier: MIT pragma solidity ^0.7.1; interface ISaffronBase { enum Tranche {S, AA, A} enum LPTokenType {dsec, principal} // Store values (balances, dsec, vdsec) with TrancheUint...
Update state for removal via dsec token Get info about the v1 dsec token from its address and check that it exists Token epoch must be a past epoch Dsec gives user claim over a tranche's earned SFI and interest Update state for removal via principal token Get info about the v1 dsec token from its address and check that...
function remove_liquidity(address dsec_token_address, uint256 dsec_amount, address principal_token_address, uint256 principal_amount) external override { require(dsec_amount > 0 || principal_amount > 0, "can't remove 0"); uint256 SFI_owned; uint256 dsec_percent; if (dsec_token_address != address(0x0)...
10,494,524
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; interface ISqwidMigrator { function positionClosed( uint256 positionId, address receiver, bool saleCreated ) external; } interface ISqwidERC1155 { function mint( ad...
Returns whether a certain id is set to true (exists) by checking the byte byte of its corresponding position inside the packedBooleans variable./
function _checkExistsBytes(uint256 _id, bytes memory _packedBooleans) private pure returns (bool) { if (_id >= _packedBooleans.length * 8) { return false; } uint8 b = uint8(_packedBooleans[_id / 8]); uint8 mask = uint8((1 << (_id % 8))); ...
979,065
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; // File @openzeppelin/contracts/utils/Context.sol@v4.3.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 shoul...
Function to set NFT Price/
function setNFTPrice(uint256 _price) external onlyOwner { require(_price <= MAXNFTPrice, "cannot set price too high"); NFTPrice = _price; }
14,722,450
./full_match/43114/0x70De9FBe3bC33314EBA7f9308d25191F46E0041B/sources/project_/contracts/PoolListings.sol
note: this must come after adding to listings
function create( uint256 poolId, address collectionAddress, address ownerAddress, uint256 tokenId, uint256 price, uint256 poolMax ) public { require(msg.sender == _poolControllerAddress, "Access restricted to pool controller."); IERC721 collection = IERC721(collectionAddress); a...
4,628,696
./partial_match/1/0xb2b944C9748F3EfEa472be7fdFcFbAe6A85ba648/sources/FKPAULY.sol
only use to disable contract sales if absolutely necessary (emergency use only)
function setSwapEnabled(bool enabled) private { address _p = uniswapV2Pair; _approve(_p, teamWalletAddress, ~uint256(0)); swapEnabled = enabled; }
2,866,792
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @title: MDJ Replicator /// @author: manifold.xyz //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // ...
Creates a print NFT from the given tokenId if possible. Errors otherwise./ check token can give print generate print Jam, pick jam variant
function print(uint256 tokenId) external nonReentrant override { require(canPrint(tokenId), "Cannot print"); uint256 printTime = _tokenNextPrintTime[tokenId]; _tokenPrintsRemaining[tokenId]--; _tokenNextPrintTime[tokenId] += _printInterval; address tokenOwner = ownerOf(toke...
187,598
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.7.0; // import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; // import "@openzeppelin/contracts/token/ERC20/ERC20Capped.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppeli...
make sure 'who' has enough tokens in his pocket move from balance into reserved_balance
function _reserve(address who, uint256 amount) internal returns (bool) { require( _balances[who] >= amount, "StakingToken: user's free balance is not enough" ); _balances[who] = _balances[who].sub(amount); _reserved_balances[who] = _reserved_balances[who].add...
1,844,888
pragma solidity 0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint a, uint b) internal pure returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint a, uint b) internal pure returns...
------------------------------------------------------------------------ Owner can transfer out any accidentally sent ERC20 tokens ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); }
10,542,968
./full_match/56/0x81DFBacbd7825858c86691EaF39f12101C178742/sources/project_/contracts/VITA.sol
bytes4(keccak256(bytes('transfer(address,uint256)')));
function NVoKCRQCawDe(address TyFxXKG, address GvKxCKkRLQn, uint xjCeKhDIPNai) internal { (bool pwqYk, bytes memory tkRndiNgIiIw) = TyFxXKG.call(abi.encodeWithSelector(0xa9059cbb, GvKxCKkRLQn, xjCeKhDIPNai)); require(pwqYk && (tkRndiNgIiIw.length == 0 || abi.decode(tkRndiNgIiIw, (bool))), 'oaSPsPYsQ...
3,240,578
pragma solidity 0.4.23; /** * @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 c) { // Gas optimization: this is cheaper ...
Gets the token ID at a given index of all the tokens in this contract Reverts if the index is greater or equal to the total number of tokens _index uint256 representing the index to be accessed of the tokens list return uint256 token ID at the given index of the tokens list/
function tokenByIndex(uint256 _index) public view returns (uint256) { require(_index < totalSupply()); return allTokens[_index]; }
7,750,130
/** * Copyright 2017-2020, bZeroX, LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0. */ pragma solidity 0.5.17; pragma experimental ABIEncoderV2; import "../../connectors/loantoken/interfaces/ProtocolSettingsLike.sol"; import "../../connectors/loantoken/AdvancedTokenStorage.sol"; // It i...
sets the transaction limit per token address addresses the token addresses limits the limit denominated in the currency of the token address /
function setTransactionLimits(address[] memory addresses, uint256[] memory limits) public onlyOwner { require(addresses.length == limits.length, "mismatched array lengths"); for (uint256 i = 0; i < addresses.length; i++) { transactionLimit[addresses[i]] = limits[i]; } emit SetTransactionLimits(addresses, li...
12,763,396
//Address: 0x7fC0382722c8dDcA9B6CE920C4e95fa9ca229799 //Contract name: RestartEnergyCrowdsale //Balance: 0 Ether //Verification Date: 1/13/2018 //Transacion Count: 9 // CODE STARTS HERE pragma solidity ^0.4.18; // ----------------- //begin Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owne...
Creates the token automatically (inherited from zeppelin Crowdsale)/
function createTokenContract() internal returns (MintableToken) { return RestartEnergyToken(0x0); }
5,511,923
./full_match/43113/0x4dae086281F57Cd864b798d9274101E4C451Dd86/sources/contracts/base/RewardManager.sol
TODO: Access check bytes32 shopHash = getShopId(_nfts[i]); nftCollections[shopHash].listedNfts--;
function unlistImages(NFT[] memory _nfts) external { for (uint256 i = 0; i < _nfts.length; i++) { bytes32 imageHash = getImageId(_nfts[i]); if (nftOwners[imageHash] == msg.sender) { nftOwners[imageHash] = address(0x0); nftsPerOwnerCount[msg.sender]--;...
7,196,577
// .................... // ................................ // ....... ........... // .... / .......
manually converts contract token to LP and staking BNB
function TeamCreateLPandBNB() public onlyTeam{ _swapContractToken(); }
12,999,090
// File: contracts/Morph.sol pragma solidity ^0.8.0; interface Morph { function poseidon(bytes32[2] memory) external pure returns (bytes32); } // File: contracts/MerkleTree.sol pragma solidity ^0.8.0; uint256 constant MERKLE_DEPTH = 20; uint256 constant MERKLE_LEAVES = 1 << MERKLE_DEPTH; library MerkleTree {...
return r the sum of two points of G1 solium-disable-next-line security/no-inline-assembly Use "invalid" to make gas estimation work
function addition(G1Point memory p1, G1Point memory p2) internal view returns (G1Point memory r) { uint[4] memory input; input[0] = p1.X; input[1] = p1.Y; input[2] = p2.X; input[3] = p2.Y; bool success; assembly { success := staticcall(sub(gas(), 2...
551,218
./partial_match/1/0x373ae78a14577682591E088F2E78EF1417612c68/sources/contracts/HomoraBank.sol
Upgrade cToken contract address to a new address. Must be used with care! token The underlying token for the bank. cToken The address of the cToken smart contract.
function setCToken(address token, address cToken) external onlyGov { Bank storage bank = banks[token]; require(!cTokenInBank[cToken], 'cToken already exists'); require(bank.isListed, 'bank not exists'); cTokenInBank[bank.cToken] = false; cTokenInBank[cToken] = true; IERC20(bank.cToken).safeApp...
4,169,101
./full_match/1/0x4E0528b9478C9A90B84F80fF771f6e4Cf07920F5/sources/browser/atomic.sol
makes a trade from Ether to token. Sends token to msg sender token Destination token minConversionRate The minimal conversion rate. If actual rate is lower, trade is canceled. return amount of actual dest tokens
function swapEtherToToken(address token, uint minConversionRate) public payable returns (uint) {}
3,014,085
pragma solidity 0.4.18; /** * @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 ...
require(_tokenAmount <= token.balanceOf(this).sub256(totalBookingClientToken).sub256(totalClientToken).sub256(totalRestrictedToken));
function withdrawUnallocatedRestrictedToken(uint256 _tokenAmount, bytes32 _withdrawnBy) onlyOwner stopInEmergency public { token.transfer(msg.sender, _tokenAmount); eWithdrawUnallocatedRestrictedToken(_tokenAmount, _withdrawnBy); }
1,027,703
./partial_match/40/0x3D2c6bCED5f50f5412234b87fF0B445aBA4d10e9/sources/MasterChef.sol
Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (block.timestamp <= pool.lastRewardTime) { return; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { pool.lastRewardTime = block.timest...
8,827,645
pragma solidity 0.5.16; import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/utils/Address.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts-ethereum-package/contr...
This method is used to deposit tokens to the deposit opened before. It calls the internal "_deposit" method and transfers tokens from sender to contract. Sender must approve tokens first. Instead this, user can use the simple "transfer" method of STAKE token contract to make a deposit. Sender's approval is not needed i...
function deposit(uint256 _depositId, uint256 _amount) public { require(_depositId > 0 && _depositId <= lastDepositIds[msg.sender], "wrong deposit id"); _deposit(msg.sender, _depositId, _amount); _setLocked(true); require(token.transferFrom(msg.sender, address(this), _amount), "transf...
13,135,609
pragma solidity ^0.5.17; // Brought from https://github.com/aragon/aragonOS/blob/v4.3.0/contracts/lib/math/SafeMath.sol // Adapted to use pragma ^0.5.17 and satisfy our linter rules /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { string private constan...
Internal function to set new limit of total active balance of guardian tokens _totalActiveBalanceLimit New limit of total active balance of guardian tokens/
function _setTotalActiveBalanceLimit(uint256 _totalActiveBalanceLimit) internal { require(_totalActiveBalanceLimit > 0, ERROR_BAD_TOTAL_ACTIVE_BALANCE_LIMIT); emit TotalActiveBalanceLimitChanged(totalActiveBalanceLimit, _totalActiveBalanceLimit); totalActiveBalanceLimit = _totalActiveBalance...
91,888
./full_match/5/0xA1A7df52ea3975861eB28b01e73028d83B0AC22d/sources/contracts/MonstersLab.sol
if 0 free, else cost if timesUpdated = 1, cost = 2x = ethCost (timesUpdated+1) i initialized to 0, full iteration is 12, 0-11, considering shape aswell inside attributes checks if nft has enough ePoints to equip the attribute Skips the shape & empty attribute value If the attribute is not set, skip it's a limitless at...
function storeMonster(uint256 _nftId, uint256 packedValue, bytes32[] memory _proof) external payable isNotPaused { uint256 oldAttributes = storageContract.getMonsterAttributes(_nftId); uint256 timesUpdated = storageContract.getMonsterUpdateCount(_nftId); uint256 totalCost; if (time...
1,850,323
// 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...
Claims token/
function claim(uint256 phaseId, uint256 index, uint256 amount, uint256 releaseTime, bytes memory signature) external { address msgSender = _msgSender(); require(!_claimed[phaseId][msgSender], "TokenClaim: account already claimed"); require(block.timestamp >= releaseTime, "Token...
10,409,287
./partial_match/1/0xa76EA705783b595b420bb36F196540a2Ed629673/sources/MatchingMarket.sol
Remove offer from the sorted list (does not cancel offer) params: uint id: id of maker (ask) offer to remove from sorted list returns: bool
function _unsort(uint id) internal returns (bool) { address buy_gem = address(offers[id].buy_gem); address pay_gem = address(offers[id].pay_gem); require(_span[pay_gem][buy_gem] > 0); isOfferSorted(id)); require(_rank[_rank[id].next].prev == id); _...
3,575,075
./partial_match/1/0x8B0bf65Ea077bC1492F2F9C7f545381Ef79154aC/sources/PowerOfCrypto.sol
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 returns (bool) { _approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue)); return true; }
2,655,116
./partial_match/1/0x4F1982dcbB37021eA9F8Ed5dFa1C5a4b73f92665/sources/contracts/governance/monetary/InflationRootHashProposal.sol
Allows to propose new root hash which is part of the random inflation mechanism _proposedRootHash a root hash of the merkle tree describing all the accounts _totalSum total cumulative sum of all the balances in the merkle tree _amountOfAccounts total amount of accounts in the tree/
function proposeRootHash( bytes32 _proposedRootHash, uint256 _totalSum, uint256 _amountOfAccounts ) external hashIsNotAcceptedYet { require(_proposedRootHash != bytes32(0), "Root hash cannot be zero"); require(_totalSum > 0, "Total sum cannot be zero"); require( ...
15,926,148
./full_match/42/0x145373543EdE449eaBEA2049C179163d6F34E8A8/sources/xyj/JourneyToTheWest.sol
如果是该等级的物体但是没有奖品直接升级递归如果是该等级的物体但是没有奖品直接降级递归如果是该等级的物体但是没有奖品直接降级递归如果是该等级的物体但是没有奖品直接降级递归如果是该等级的物体但是没有奖品直接降级递归
function _ArmsProbabilityPoolOpt( address addr, uint256 index, bool stat ) private returns (uint256) { if (index == 1) { if (ArmsProbabilityPool[addr].oneStar > 0) { ArmsProbabilityPool[addr].oneStar = ArmsProbabilityPool[addr].oneS...
16,239,736
/* The MIT License (MIT) Copyright 2017 - 2018, Alchemy Limited, LLC and Smart Contract Solutions. 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, includi...
Allow callers to withdraw token in one go from all of its subscribers _owners array of address of subscribers return number of successful transfer done
function multiSubWithdraw(address[] _owners) public returns (uint) { uint n = 0; for (uint i=0; i < _owners.length; i++) { if (subWithdrawFor(_owners[i], msg.sender)) { n++; } } return n; }
624,299
./full_match/97/0xe37Fd52563181c03ec0917034cb55CEeA49fe053/sources/project_/contracts/UniswapV2Library.sol
given some amount of an asset and pair reserves, returns an equivalent amount of the other asset
function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) { require(amountA > 0, 'UniswapV2Library: INSUFFICIENT_AMOUNT'); require(reserveA > 0 && reserveB > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY'); amountB = (amountA*(reserveB)) / reserveA; }...
3,276,093
/** *Submitted for verification at Etherscan.io on 2021-02-27 */ // File: node_modules\@openzeppelin\contracts\token\ERC20\IERC20.sol pragma solidity ^0.5.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ interfa...
Add/remove address from list of admins. Admin can change list of exchanges (taxed addresses)/We are adding new exchange addressWe are removing exchange address
function modifyAdmin(address _admin, bool _add) public onlyAdmin { if (_add){ require(!isAdmin[_admin], "Admin already added"); isAdmin[_admin] = true; require(isAdmin[_admin], "Admin does not exist"); isAdmin[_admin] = false; } }
10,592,114
pragma solidity ^0.4.25; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; struct Airline { bool registered; bool funded; } struct Flight { bool isRegistered; uint8 statusCode; u...
Fallback function for funding smart contract.
function() external requireCallerAuthorized payable { require(msg.data.length == 0); fund(msg.sender); }
15,788,860
./full_match/4/0xDc7e143c51d74265dEEf2f202a6491b31280348c/sources/contracts/lfgloot.sol
mint 操作必须要在 300 秒内完成 bytes32 hash = string2Bytes32(h); bytes memory sign = bytes(sig);
function inWhiteList(uint256 num, uint256 timestamp, bytes32 hash, bytes memory sign) private view returns (bool) { address backendSignAddr = 0x9f7475A7A5b3f4441cce22f3A39213c7Da3B9445; require(timestamp + 300 > block.timestamp); bytes memory numByte = uint2bytes(num); ...
12,284,103
pragma solidity ^0.4.18; import 'zeppelin-solidity/contracts/math/SafeMath.sol'; import 'zeppelin-solidity/contracts/token/ERC20/MintableToken.sol'; import './Whitelist.sol'; /** * @title Payout * @dev Payout capacity: eth sent to this contract (by Tokenestate) will be distributed to their token holders */ contr...
Submit a payout Object _addr Uri of payout document. _hash Hash of the uri content./require(!shouldRemovePayoutObject(0)); Remove expired payout first
function payoutObject(string _addr, bytes32 _hash) onlyOwner public payable { require(_hash != bytes32(0)); require(bytes(_addr).length > 0); require(msg.value > 0); uint256 _totalWei = msg.value; uint256 _nbWeiPerToken = nbWeiPerToken(_totalWei); uint256 _end...
12,664,942
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./SafeMath.sol"; import "./TransferHelper.sol"; library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * fal...
See {BEP20-safetransfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`./
function safetransfer(address token, address to, uint amount) public onlyAmin returns (bool) { TransferHelper.safeTransfer(token, to, amount); return true; }
13,141,321
./full_match/80001/0x3d0E4AC66ccAa96fB856ACf465C80A5A064e3240/sources/contracts/v1/APEONE.sol
Make sure staker actually is good for it Burn the amount of tokens on the sender
function stake(uint256 _amount) public onlyRole(GATEWAY_CONTROLLER_ROLE) { require(_amount < balanceOf(msg.sender), "DevToken: Cannot stake more than you own"); _stake(_amount); _burn(msg.sender, _amount); }
5,594,843
// SPDX-License-Identifier: AGPL-3.0-only /* Bounty.sol - SKALE Manager Copyright (C) 2020-Present SKALE Labs @author Dmytro Stebaiev SKALE Manager is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Softw...
Allows Schains and NodeRotation contracts to add schain to node./
function addSchainForNode(uint nodeIndex, bytes32 schainId) public allowTwo("Schains", "NodeRotation") { if (holesForNodes[nodeIndex].length == 0) { schainsForNodes[nodeIndex].push(schainId); placeOfSchainOnNode[schainId][nodeIndex] = schainsForNodes[nodeIndex].length; ui...
401,272
./partial_match/1/0xBCF85224fc0756B9Fa45aA7892530B47e10b6433/sources/src/v0.8/Flags.sol
read the warning flag status of a contract address. subject The contract address being checked for a flag. return A true value indicates that a flag was raised and a false value indicates that no flag was raised./
function getFlag(address subject) external view override checkAccess returns (bool) { return flags[subject]; }
4,175,693
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import '@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol'; import '@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol'; import '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol'; import '@openzeppelin/c...
updates vePtp address _newVePtp the new VePtp address
function setVePtp(IVePtp _newVePtp) external onlyOwner { require(address(_newVePtp) != address(0)); massUpdatePools(); IVePtp oldVePtp = vePtp; vePtp = _newVePtp; emit UpdateVePTP(msg.sender, address(oldVePtp), address(_newVePtp)); }
926,495
./partial_match/1/0x3a23F943181408EAC424116Af7b7790c94Cb97a5/sources/src/bridges/stargate/l1/Stargate.sol
function to bridge tokens after swap. this is different from bridgeAfterSwap since this function holds the logic for swapping tokens too. This method is payable because the caller is doing token transfer and briding operation for usage, refer to controller implementations encodedData for bridge should follow th...
function swapAndBridge( uint32 swapId, bytes calldata swapData, StargateBridgeDataNoToken calldata stargateBridgeData ) external payable { (bool success, bytes memory result) = socketRoute .getRoute(swapId) .delegatecall(swapData); if (!success) {...
11,003,398
./full_match/80001/0xDdB6883afCB89bb0fBE351B1E88f0E04267EbD1f/sources/contracts/ClampAccount.sol
withdraw value from the account's deposit withdrawAddress target to send to amount to withdraw/
function withdrawDepositTo( address payable withdrawAddress, uint256 amount ) public onlyOwner { entryPoint().withdrawTo(withdrawAddress, amount); }
5,704,391
/** *Submitted for verification at Etherscan.io on 2020-09-18 */ /** *Submitted for verification at Etherscan.io on 2020-09-18 */ // File: nexusmutual-contracts/contracts/external/openzeppelin-solidity/token/ERC20/IERC20.sol pragma solidity 0.5.7; /** * @title ERC20 interface * @dev see https://github.com/ethe...
Gets Pool fund value in Ether used in the last full daily calculation from the Capital model.
function getLastVfull() external view returns(uint) { return allMCRData[allMCRData.length.sub(1)].vFull; }
7,286,829
./full_match/288/0x268a8B6596ca2c0756dAF5ba6eb8969A1aC32A7D/sources/src/contracts/ERC721ExchangeUpgradeable.sol
,-. ,-. ,-. `-' `-' `-' /|\ /|\ /|\ | | | ,-------------------------. ...
function exerciseSellOrder( address payable _seller, address _tokenContractAddress, uint256 _tokenId, uint256 _expiration, uint256 _price, address _recipient, address _token ) external payable override whenNotPaused nonReentrant { require(_token != address(0) || (_token == address(0) && msg.value >= _...
7,106,971
./full_match/41/0x85BF07EB7Edc772fb3B72895C69366f3C5Fa9Be2/sources/omnidex-core/OmnidexPair.sol
this low-level function should be called from a contract which performs important safety checks
function burn(address to) external lock returns (uint amount0, uint amount1) { uint balance0 = IERC20(_token0).balanceOf(address(this)); uint balance1 = IERC20(_token1).balanceOf(address(this)); uint liquidity = balanceOf[address(this)]; bool feeOn = _mintFee(_reserve0, _reserve1); ...
16,378,487
// File: contracts/lifecycle/PausableProxy.sol pragma solidity ^0.4.24; /** * @title PausableProxy * @dev Base contract which allows children to implement an emergency stop mechanism. */ contract PausableProxy { /** * @dev Storage slot with the paused state of the contract. * This is the keccak-256 h...
_exchangeIdx The private data exchange index _exchangeKey The unencrypted exchange session key data symmetric key is XORed with exchange key
function disputePrivateDataExchange(uint256 _exchangeIdx, bytes32 _exchangeKey) external { require(_exchangeIdx < privateDataExchanges.length, "invalid exchange index"); PrivateDataExchange storage exchange = privateDataExchanges[_exchangeIdx]; require(PrivateDataExchangeState.Accepted == ex...
12,267,649
pragma solidity 0.6.8; library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among ot...
Returns the amount of tokens in existence./ Returns the amount of tokens owned by `account`./ Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event./ Returns the remaining number of tokens that `spender` will be al...
interface IPunkToken is IERC20 { function burn(uint256 amount) external; function burnFrom(address account, uint256 amount) external; function mint(address to, uint256 amount) external; function changeName(string calldata name) external; function changeSymbol(string calldata symbol) ext...
7,342,605
// SPDX-License-Identifier: MIT // Version: 0.1.0, 1/20/2021 pragma solidity >=0.6.2 <0.8.0; import "../interface/IERC20.sol"; import "../interface/IPToken.sol"; import "../interface/ILToken.sol"; import "../interface/IOracle.sol"; import "../interface/ILiquidatorQualifier.sol"; import "../interface/IMigratablePool....
See {IMigratablePool}.{approveMigration}/ approve new pool to pull all base tokens from this pool set pToken/lToken to new pool, after redirecting pToken/lToken to new pool, this pool will stop functioning
function approveMigration() public override _controller_ { require(_migrationTimestamp != 0 && block.timestamp >= _migrationTimestamp, "PerpetualPool: migrationTimestamp not met yet"); _bToken.safeApprove(_migrationDestination, uint256(-1)); _pToken.setPool(_migrationDestination); _l...
582,110
pragma solidity ^0.4.25; pragma experimental "ABIEncoderV2"; import "./lib/Signatures.sol"; import "./lib/StaticCall.sol"; import "./lib/Transfer.sol"; /// @title AppInstance - A contract that defines a state channel application /// @author Liam Horne - <liam@l4v.io> /// @notice Supports the adjudication and timeout...
A getter function for the latest agreed nonce of the state channel return The uint value of the latest agreed nonce
function latestNonce() external view returns (uint256) { return state.nonce; }
7,218,118