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/1/0xD358273BADE3C68e78AfDDb3066982aE664F7cd4/sources/contracts/BzzExchange.sol
买入。注意,为了让其他机器人反向操作,因此千万不要调用此方法
function mintTo(uint256 _amount, uint256 _maxCollateralSpend, address _to) public onlyOwner { bzzExchange.mintTo(_amount, _maxCollateralSpend, _to); }
8,323,813
pragma solidity ^0.5.6; import "./ERC721ReceiverDraft.sol"; import "./ERC721ReceiverFinal.sol"; /// @title ERC721Receivable handles the reception of ERC721 tokens /// See ERC721 specification /// @author Christopher Scott /// @dev These functions are public, and could be called by anyone, even in the case /// where...
Handle the receipt of an NFT The ERC721 smart contract calls this function on the recipient after a `safetransfer`. This function MAY throw to revert and reject the transfer. Return of other than the magic value MUST result in the transaction being reverted. Note: the contract address is always the message sender. _o...
function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes memory _data) public returns(bytes4) { _operator; _from; _tokenId; _data; return ERC721_RECEIVED_FINAL; }
7,305,268
./partial_match/1/0x8281f2bECfF37326Eb6cBE33527434611558B031/sources/BundleController.sol
log entry for successful state change
function _changeState(uint256 bundleId, BundleState newState) internal { BundleState oldState = getState(bundleId); _checkStateTransition(oldState, newState); _setState(bundleId, newState); emit LogBundleStateChanged(bundleId, oldState, newState); }
4,153,809
// SPDX-License-Identifier: Unlicensed pragma solidity ^0.8.11; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return payable(msg.sender); } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutab...
True blocks the bots address
function set_antibot(address account, bool active) public onlyOwner() { _antibot[account] = active; }
6,129,242
./partial_match/4/0x0a71D4BFB9d517d38963c5374A22e345c13916d8/sources/ClearingHouseViewer.sol
get margin ratio, marginRatio = (margin + funding payments + unrealized Pnl) / openNotional use spot and twap price to calculate unrealized Pnl, final unrealized Pnl depends on which one is higher _amm IAmm address _trader trader address return margin ratio in 18 digits/
function getMarginRatio(IAmm _amm, address _trader) public view returns (SignedDecimal.signedDecimal memory) { Position memory position = getPosition(_amm, _trader); requirePositionSize(position.size); requireNonZeroInput(position.openNotional); (, SignedDecimal.signedDecimal memory...
16,964,780
pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/introspection/SupportsInterfaceWithLookup.sol"; import "openzeppelin-solidity/contracts/access/Whitelist.sol"; import "./interfaces/VoterRegistry.sol"; /// @title Voting Office /// @dev Contract to manage multiple votings belonging to one registry contr...
Reads the address of the corresponding registry return Address of the VoterRegistry this office belongs to
function getVotersRegistry() external view returns (address) { return _voterRegistry; }
5,397,104
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/acc...
Where any user can stake their ERC20 tokens into a pool in order to farm rewards _pid ID of the pool _amount Amount of ERC20 being staked
function deposit(uint256 _pid, uint256 _amount) external { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount.add(_amount) <= pool.maxStakingAmountPerUser, "deposit: can not exceed max staking amount per user"); updatePoo...
1,641,776
./full_match/43113/0x1DDb0A76b0A9e036D9f5fA38d1f805A501E50324/sources/AMM/amm.sol
Removes liquidity from the pool and releases corresponding Token1 & Token2 to the withdrawer
function withdraw(uint256 _share) external activePool validAmountCheck(shares, _share) returns(uint256 amountToken1, uint256 amountToken2) { (amountToken1, amountToken2) = getWithdrawEstimate(_share); shares[msg.sender] -= _share; totalShares -= _share; totalToken1 -= amountToken1; t...
13,195,832
./partial_match/1/0x592e98898f6ECcfCC46c764EaE12265257E0e793/sources/PumaPayWrapper.sol
Return data is optional
function _callOptionalReturn(address token, bytes memory data) private { bytes memory returndata = token.functionCall(data, 'TokenOperation: low-level call failed'); if (returndata.length > 0) { require(abi.decode(returndata, (bool)), 'TokenOperation: did not succeed'); } }
4,138,914
./full_match/80001/0xb7ed978ad610Ed9c7ff3336b39E708fE5dB7222e/sources/contracts/rankedAccess4.sol
createToken mint the ERC721 Token / NFT with the check that the user have paid $2 to mint the NFT/ Require statement to check the user has paid enough to mint the NFT. Remember to update the error to reflect the actual price Check that the msg.sender has not minted before Mint a single token to the msg.sender automati...
function createToken() public payable { require(msg.value.getConversionRate() >= MINIMUM_USD, "SEND_MORE_MATIC: Chainlink price feeds says give me more than $0.02"); require(!hasMinted[msg.sender], "ALREADY_MINTED"); _mint(msg.sender, 1); require(callSuccess,"TRANSFER_FUND_FAIL"); hasMinted[msg.s...
5,652,852
./full_match/11155111/0xeBABa3Be28Ad08ae07b5E17cBbD6Aa6C0585C080/sources/contracts/Contract.sol
Your custom implementation logic here
function _beforeClaim( uint256 _tokenId, address _receiver, uint256 _quantity, address _currency, uint256 _pricePerToken, AllowlistProof calldata _allowlistProof, bytes memory _data ) internal virtual { }
3,807,297
/** *Submitted for verification at Etherscan.io on 2022-02-27 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.11; /** * * * "The Mesh" by Takens Theorem * * Terms, conditions: Experimental, use at your own risk. Each token provided * as-is and as-available without any and all warranty. By ...
Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length./
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = ""; buffer[1] = ""; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = alphabet[value & 0xf]; value...
2,249,969
/** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/OpenZeppelin/openzeppelin-solidity * * The BG token contract bases on the ERC20 standard token contracts * Company Optimum Consulting - Courbevoie * */ pragma solidity ^0.4.21; /** * @title Safe...
Returns the current Bonus.
function getBonus() public constant returns (uint) { return (Bonus); }
7,654,609
pragma solidity 0.5; import "./ListAsRingLib.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; /** * @title EntityLib * @author Igor Dulger * @dev Handle entity data type (CRUD) */ library EntityLib { using SafeMath for uint; using ListAsRingLib for ListAsRingLib.ListData; struct Enti...
Get entity. self Reference to entity storage. _id entity id. return uint, string, string/
function get( Entities storage self, uint _id ) internal inStorage(self, _id) view returns (uint, string memory, uint) { return ( self.dictionary[_id].id, self.dictionary[_id].data, self.dictionary[_id].version ...
13,131,209
./full_match/5/0x19A4010E859ca3d10F0d928C6665F9a9E3BE4B22/sources/_equilibria/root/token/types/Token6.sol
Converts the token amount into the unsigned fixed-decimal amount according to it's defined decimals amount Token amount to convert return Normalized unsigned fixed-decimal amount/
function fromTokenAmount(uint256 amount) private pure returns (UFixed18) { return UFixed18.wrap(amount * OFFSET); }
1,912,837
./partial_match/1/0x3a23F943181408EAC424116Af7b7790c94Cb97a5/sources/src/controllers/FeesTakerController.sol
function to deduct-fees to fees-taker address on source-chain and bridge amount to destinationChain ensure correct function selector is used to generate transaction-data for bridgeRequest ftbRequest feesTakerBridgeRequest object generated either off-chain or the calling contract using the function-s...
function takeFeesAndBridge( ISocketRequest.FeesTakerBridgeRequest calldata ftbRequest ) external payable returns (bytes memory) { if (ftbRequest.feesToken == NATIVE_TOKEN_ADDRESS) { payable(ftbRequest.feesTakerAddress).transfer( ftbRequest.feesAmount ); ...
11,003,597
./partial_match/1/0x7296333e1615721f4Bd9Df1a3070537484A50CF8/sources/Pool.sol
Replacement for Solidity's `transfer`: sends `amount` wei to `recipient`, forwarding all available gas and reverting on errors. of certain opcodes, possibly making contracts go over the 2300 gas limit imposed by `transfer`, making them unable to receive funds via `transfer`. {sendValue} removes this limitation. IMPORTA...
function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); require( success, "Address: unable to send value, recipient may have reverted" ); }
4,384,311
./full_match/1313161555/0x593929A491663A14772427DE15536a2CD8E53F30/sources/contracts/AuToken.sol
Add reserves by transferring from caller Requires fresh interest accrual addAmount Amount of addition to reserves return (uint, uint) An error code (0=success, otherwise a failure (see ErrorReporter.sol for details)) and the actual amount added, net token fees/ totalReserves + actualAddAmount We fail gracefully unles...
function _addReservesFresh(uint addAmount) internal returns (uint, uint) { uint totalReservesNew; uint actualAddAmount; if (accrualBlockTimestamp != getBlockTimestamp()) { return (fail(Error.MARKET_NOT_FRESH, FailureInfo.ADD_RESERVES_FRESH_CHECK), actualAddAmount); } ...
7,096,426
./partial_match/42/0x4283b75BC37Bc205378352049F91eb5b4f4b05D7/sources/YUANRebaser.sol
Activates rebasing One way function, cannot be undone, callable by anyone/ cannot enable prior to end of rebaseDelay cannot enable without reserve token price
function activate_rebasing() public { require(timeOfTWAPInit > 0, "twap wasnt intitiated, call init_twap()"); require(now >= timeOfTWAPInit + rebaseDelay, "!end_delay"); uint256 price = IPriceOracle(priceOracle).getPrice(reserveToken); require(price > 0, "Reserve token price is not ...
3,450,779
./full_match/41/0x5ad0B16750c9e506b10e5ba8Da904d8FECAe0105/sources/C/_files/masha/work/pancakeswap-clone/public/pancake-farm/contracts/MasterChef.sol
Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do.
function add(uint256 _allocPoint, IBEP20 _lpToken, bool _withUpdate) public onlyOwner { if (_withUpdate) { massUpdatePools(); } uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock; totalAllocPoint = totalAllocPoint.add(_allocPoint); poo...
16,370,680
./full_match/5/0xc8A11706815E2491E78111Cb264F4DBd00e918BA/sources/contracts/CrowdFundingContract.sol
returns address of dontators and dontations in contract with id
function getDontators( uint256 _id ) public view returns (address[] memory, uint256[] memory) { return (campaigns[_id].donators, campaigns[_id].donations); }
1,864,106
pragma solidity 0.8.0; // SPDX-License-Identifier: MIT import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "./interfaces/ILiquidityProvider.sol"; import "@openzeppelin/contracts-u...
Function which migrate user to eTacoChef/
function setUser( uint256 _pid, address _user, uint256 _amount, uint256 _rewardDebt ) external onlyMigrator { require(poolInfo.length != 0, "eTacoChef: Pools must be migrated"); updatePool(_pid); userInfo[_pid][_user] = UserInfo(_amount, _rewardDebt.mul(9)...
1,696,196
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol"; //import "@uniswap/v3-periphery/contracts/interfaces/INonfungiblePositionManager.sol"; //import "@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol"; import "@uniswap/v3-periphery/contra...
balanceOf of tokenId's coinage
function balanceOfCoinage(uint256 tokenId) external view returns (uint256) { return IAutoRefactorCoinageWithTokenId(coinage).balanceOf(tokenId); }
12,109,799
./full_match/44787/0xaE7D6EA88c7536bA6B12682A752e748c45c50DCB/sources/contracts/Mining.sol
Generate a random hash and check if it passes Ensure rewards are not given too quickly Prevent misuse e.g. attempting reward multiple times in same block Reward given to the sender, increases with time taken Adjusts the difficulty - if time increases then lower difficulty Preparation for new proof
function minePOW(uint nonce) public { bytes32 n = bytes32(keccak256(abi.encodePacked(nonce, currentChallenge))); require(n >= bytes32(difficulty), "Mining: invalid hash generated"); uint timeSinceLastProof = (block.timestamp - timeOfLastProof); require(timeSinceLastProof >...
13,248,955
// File: @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}. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. ...
_amount is the amount of idleSAI that one wants to burn
interface IIdleV1 { function redeemIdleToken(uint256 _amount) external returns (uint256 tokensRedeemed); function balanceOf(address _account) external view returns (uint256); function bestToken() external view returns(address); function iToken() external view returns(address); function cToken() exte...
12,556,507
// SPDX-License-Identifier: MIT pragma solidity 0.8.10; import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol"; import "./OrderMixin.sol"; import "./OrderRFQMixin.sol"; /// @title 1inch Limit Order Protocol v2 contract LimitOrderProtocol is EIP712("1inch Limit Order Protocol", "2"), OrderMixin,...
Same as `fillOrder` but allows to specify funds destination instead of `msg.sender` order Order quote to fill signature Signature to confirm quote ownership makingAmount Making amount takingAmount Taking amount thresholdAmount Specifies maximum allowed takingAmount when takingAmount is zero, otherwise specifies mi...
function fillOrderTo( Order memory order, bytes calldata signature, uint256 makingAmount, uint256 takingAmount, uint256 thresholdAmount, address target ) public returns(uint256 /* actualMakingAmount */, uint256 /* actualTakingAmount */) { require(target !=...
1,390,068
// Ronny - Valtonen // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.4; // Use 0.8.4 to not break everything // Import a few things, ERC721 contract and Ownable contract import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "remix_tests.sol"; ...
Function to get player details Look for a matching player ID
function getPlayer(int empid) public view returns( string memory, string memory, string memory, string memory) { uint i; for (i=0; i<emps.length; i++) { Player memory e = emps[i]; if (e.empid==e...
15,849,942
./full_match/1/0x1a801aDD97b35b17ba9968986CEaCD2CD6e74834/sources/contracts/NameflickENSResolver.sol
Disables a contract for a given namehash. namehash The namehash of the node./
function disableContract( bytes32 namehash ) external onlyNodeAuthorized(namehash) { nfts[namehash] = address(0); emit DisableContractResolution(namehash); }
3,138,654
./partial_match/1/0xfeBC247fA2058a914D8C9A5e0F10d21E3700063A/sources/BBuddies.sol
return uri for certain token
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "BBuddies: URI query for nonexistent token"); if(!isRevealed){ return placeholderTokenUri; } }
4,404,148
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import "../interfaces/ERC165Spec.sol"; import "../interfaces/ERC721Spec.sol"; import "../interfaces/AletheaERC721Spec.sol"; import "../lib/StringUtils.sol"; import "../utils/AccessControl.sol"; /** * @title OpenSea ERC721 Factory interface * * @notice In order...
Fires transfer events for each option. Used to change contract "owner" See: OpenSea docs and source code examples, _from transfer optionIds from _to transfer optionIds to/ verify the access permission fire events for each option
function fireTransferEvents(address _from, address _to) public { require(isSenderInRole(ROLE_OS_MANAGER), "access denied"); for (uint256 i = 0; i < options; i++) { emit Transfer(_from, _to, i); } }
7,023,611
pragma solidity 0.4.25; /** * @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 cheap...
Set system address _systemAddress An address to set/
function setSystemAddress(address _systemAddress) public onlyOwner { systemAddress = _systemAddress; }
6,388,614
./partial_match/1/0x7183209867489E1047f3A7c23ea1Aed9c4E236E8/sources/contracts/OKPC.sol
-------------------------------------------------------------------------- / ERC721A / -------------------------------------------------------------------------- / --------------------------------- PUBLIC --------------------------------- / The standar...
function tokenURI(uint256 pcId) public view override returns (string memory) { if (!_exists(pcId)) revert OKPCNotFound(); return IOKPCMetadata(metadataAddress).tokenURI(pcId); }
9,312,714
./full_match/56/0xcf5f8F32A6bC034FFA358714b113e8Fdf7Fbffa0/sources/project_/contracts/PancakeHive.sol
This function will allow admin to remove unused bnb
function withdrawDust() external onlyRole(DEFAULT_ADMIN_ROLE){ _transferEth(msg.sender, address(this).balance); }
3,250,014
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20...
Reflection utilities ---> /
function tokenFromReflection(uint256 rAmount) public view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); }
902,341
./partial_match/42/0xF9712B026A1dEFF115BB5ee5172c76A80D2f6672/sources/XplosiveBNB.sol
Transfer tokens to a specified address. to The address to transfer to. value The amount to be transferred. return True on success, false otherwise./ underlying balance is stored in xBNB, so divide by current scaling factor note, this means as scaling factor grows, dust will be untransferrable. minimum transfer value ...
function transfer(address to, uint256 value) external whenNotPaused returns (bool) { if(_isRebaseWhitelisted(msg.sender)) { uint256 noReValue = value.mul(internalDecimals).div(BASE); uint256 noReNextValue = noReValue.mul(BASE).div(xBNBScalingFactor); ...
9,069,140
/** Source code of Opium Protocol Web https://opium.network Telegram https://t.me/opium_network Twitter https://twitter.com/opium_network */ // File: LICENSE /** The software and documentation available in this repository (the "Software") is protected by copyright law and accessible pursuant to the licens...
Gets Iterate through the list of existing tokens and return the indexes and balances of the tokens owner by the user _owner The adddress we are checking return indexes The tokenIds return balances The balances of each token/
function tokensOwned(address _owner) public view returns (uint256[] memory indexes, uint256[] memory balances) { uint256 numTokens = totalSupply(); uint256[] memory tokenIndexes = new uint256[](numTokens); uint256[] memory tempTokens = new uint256[](numTokens); uint256 count; for (uint256 i = 0; ...
1,368,019
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to ...
@inheritdoc IPrizePool
function getLiquidityCap() external view override returns (uint256) { return liquidityCap; }
2,567,828
./partial_match/42/0xD8ADbda80801278Bd1Bf8C1107DDF035f81a8F64/sources/Unwind.sol
interface for the chai contract Taken from https://github.com/makerdao/developerguides/blob/master/dai/dsr-integration-guide/dsr.sol
interface IChai is IERC20, IERC2612 { function move(address src, address dst, uint wad) external returns (bool); function dai(address usr) external returns (uint wad); function join(address dst, uint wad) external; function exit(address src, uint wad) external; function draw(address src, uint wad) e...
3,381,270
// contracts/DCBM.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "./IDCBM.sol"; import "../Governance/GovernanceWhitelist.sol"; // Digitized commercial bank money experimental implementation contract DCBM is ERC20, GovernanceWhitelist, IDCBM {...
only central bank can delete the contract
function kill(address payable to) onlyRole(COMMERCIAL_BANK) public { selfdestruct(to); }
12,724,323
pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; /** * @title Benqi. * @dev Lending & Borrowing. */ import { TokenInterface } from "../../../common/interfaces.sol"; import { Stores } from "../../../common/stores.sol"; import { Helpers } from "./helpers.sol"; import { Events } from "./events.sol"; import {...
Borrow AVAX/ARC20_Token. Borrow a token using Benqi token The address of the token to borrow. (For AVAX: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) qiToken The address of the corresponding qiToken. amt The amount of the token to borrow. getId ID to retrieve amt. setId ID stores the amount of tokens borrowed./
function borrowRaw( address token, address qiToken, uint256 amt, uint256 getId, uint256 setId ) public payable returns (string memory _eventName, bytes memory _eventParam) { uint _amt = getUint(getId, amt); require(token != address(0) && qiToken != addres...
966,558
pragma solidity ^0.8.0; // Copyright 2020 Keyko GmbH. // SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) // Code is Apache-2.0 and docs are CC-BY-4.0 import {IERC20, ILendingPool, ILendingPoolAddressesProvider, IProtocolDataProvider, IStableDebtToken, IPriceOracleGetter} from '../../../interfaces/IAaveInterfaces.s...
Repay an uncollaterised loan _asset The asset to be repaid _interestRateMode interest rate type stable 1, variable 2 _repayConditionId identifier of the condition id working as lock for other vault methods/
function repay( address _asset, uint256 _interestRateMode, bytes32 _repayConditionId ) public { require(hasRole(CONDITION_ROLE, msg.sender), 'Only conditions'); IERC20(_asset).approve(address(lendingPool), uint256(2**256 - 1)); lendingPool.repay(_asset, ...
5,493,908
pragma solidity ^0.6; import {Ownable} from "../ownership/Ownable.sol"; /** * Defines incentives for others to contribute "good" quality data. */ abstract contract IncentiveMechanism { // to store the number of valid samples and the total submitted number // from a particular contributor (address) struc...
return The current cost (in wei) to update a model with one sample of training data./ currentTimeS The current time in seconds since the epoch. return The amount of wei required to add data at `currentTimeS`./ return The number of samples that have been determined to be good for `submitter`./
function getNextAddDataCost() public virtual view returns (uint); function getNextAddDataCost(uint currentTimeS) public virtual view returns (uint); function numValidForAddress(address submitter) public view returns (uint128) { return addressStats[submitter].numValid; }
13,125,682
// 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...
Changes the underlying Fuse Pool to a new one Redeems cTokens from current fuse pool and mints cTokens of new Fuse Pool _newPoolId Fuse Pool ID/ We usually do infinite approval via approveToken() any way
function migrateFusePool(uint256 _newPoolId) external virtual onlyGovernor { address _newCToken = fusePoolDirectory.getCTokenByUnderlying(_newPoolId, address(collateralToken)); require(address(cToken) != _newCToken, "same-fuse-pool"); require(cToken.redeem(cToken.balanceOf(address(this))) ==...
415,018
// UstxDex.sol // SPDX-License-Identifier: MIT pragma solidity ^0.5.0; import "./ERC20.sol"; import "./ERC20Detailed.sol"; import "./UpStableToken.sol"; import "./IERC20.sol"; import "./ReentrancyGuard.sol"; import "./Pausable.sol"; import "./AdminRole.sol"; import "./SafeMath.sol"; /// @title Up Stable Token eXperi...
Function to get expansion factors return _expFactor and _minExp in thousandths/
function getExpFactors() public view returns (uint256, uint256) { return (_expFactor,_minExp); }
5,352,365
./partial_match/1/0x1a6f7F9c1Ca871380862EE06E252eeCbbA0496c3/sources/CRYPTOCURRENCY.sol
exclude from paying fees
constructor() ERC20("GandalfSigmaBidenDogeTeslaShrek1998HondaCivicBONK", "CRYPTOCURRENCY") { uint256 _buyMarketingFee = 25; uint256 _buyLiquidityFee = 0; uint256 _sellMarketingFee = 25; uint256 _sellLiquidityFee = 0; uint256 totalSupply = 12345678987654321 * 1e9; m...
4,409,508
./full_match/5/0xe15F634A0D10Ccf029C021A7F6C719C6a859F7D9/sources/contracts/TokenGatedAccountFactory.sol
Deploys a new Account for admin.
function _initializeAccount( address _account, address _admin, bytes calldata _data ) internal override { TokenGatedWallet(payable(_account)).initialize(_admin, _data); emit TokenGatedAccountCreated(_account, _data); }
11,591,271
pragma solidity ^0.4.25; import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; import "./TPLERC20PermissionedInterface.sol"; import "../../../AttributeRegistryInterface.sol"; /** * @title Permissioned ERC20 token: restricted by owner, receiver, operator, * total number of owners, and ownership amount. Fu...
Internal function called before transfers with amount of `value` to a receiver at account `to` and from a sender at account `from`. from address The account holding the tokens to be sent. to address The account of the receiver. value uint256 the amount to be transferred./ The sender of the transfer must have the cor...
function _prepareTransfer( address from, address to, uint256 value ) internal whenNotPaused { require( _registry.hasAttribute(from, _validOwnerAttributeTypeID), "Transfer failed - sender is not approved." ); require( _registry.hasAttribute(to, _validOwnerAttributeTypeID), ...
12,775,492
./partial_match/42/0xAfd8Fdb491e8fB399194C0E7281929B634fFda56/sources/CFD.sol
reduce position if old position is larger realizedPnl = unrealizedPnl closedRatio closedRatio = positionResp.exchangedPositionSiz / oldPosition.sizeavoid stack too deepstack too deep, temp use oldPositionposition.margin = remainMargin;
function openReversePosition( IExchange _exchange, Side _side, Decimal.decimal memory _quoteAssetAmount, Decimal.decimal memory _leverage, Decimal.decimal memory _baseAssetAmountLimit ) internal returns (PositionResp memory) { Decimal.decimal memory openNotional =...
3,377,269
./full_match/44787/0x27D0A8bB799eE3a0711Be76c5A11615F22d0Dd84/sources/project_/contracts/LockedNFT.sol
/ get the current offset emissions of this address add offset
function addOffsetEmissions( uint256 tokenId, uint256 emissions, address buyer ) internal { totalOffsetsOf[buyer]++; uint256 currentOffsetsOf = totalOffsetsOf[buyer]; offsetsByAddress[buyer][currentOffsetsOf].vcuOffset = emissions; offsetsByAddress[buyer]...
13,248,620
pragma solidity ^0.4.15; import "./Users.sol"; import "installed_contracts/zeppelin/contracts/ECRecovery.sol"; contract ProductManager is Users { struct Product { uint256 id; uint256 price; uint256 available; uint256 supply; uint256 sold; uint256 interval; s...
address signerAddress = ECRecovery.recover(productHashOf(_productId), vendorSignOf(_productId));
function verifyVendor(uint256 _productId) internal view returns (bool) { bytes memory prefix = "\x19Ethereum Signed Message:\n32"; bytes32 prefixedHash = keccak256(prefix, productHashOf(_productId)); address signerAddress = ECRecovery.recover(prefixedHash, vendorSignOf(_productId)); ...
2,480,795
./full_match/42220/0x33DeF5B052b032bE1955e179FE5d90474dF69c43/sources/contracts/UbeswapOrderBook.sol
Admin function to change the fee rate _fee The new fee
function changeFee(uint256 _fee) external onlyOwner { require(_fee <= MAX_FEE, "UOB: Fee exceeds MAX_FEE"); emit FeeChanged(fee, _fee); fee = _fee; }
16,316,600
./full_match/1/0x3DfA2E3675e984d9d59DE6871411B0897908fBaB/sources/GenericCompound.sol
The current exchange rate as an unsigned integer, scaled by 1e18.
function underlyingBalanceStored() public view returns (uint256 balance) { uint256 currentCr = cToken.balanceOf(address(this)); if (currentCr == 0) { balance = 0; balance = currentCr.mul(cToken.exchangeRateStored()).div(1e18); } }
2,902,370
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/GSN/Context.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/EnumerableSet...
return The total number of supported tokens in Loketh.
function totalSupportedTokens() public view returns (uint) { return supportedTokenNames.length; }
5,393,282
./full_match/1/0xa35A4972D74d4B3e4486163066E5fFed6d62b213/sources/browser/flatgenlenderiron.sol
simple logic. do we get more apr than iron bank charges?if so, is that still true with increased pos?if not, should be reduce?made harder because we can't assume iron bank debt curve. So need to incrementrepay debt if iron bank wants its money backnote we only borrow 1 asset so can assume all our shortfall is from itmi...
function internalCreditOfficer() public view returns (bool borrowMore, uint256 amount) { if(emergencyExit){ return(false, ironBankOutstandingDebtStored()); } uint256 underlyingPrice = ironBank.oracle().getUnderlyingPrice(address(ironBankToken)); if(underlyingPr...
3,044,022
// File: contracts/spec_interfaces/IGuardiansRegistration.sol // SPDX-License-Identifier: MIT pragma solidity 0.6.12; /// @title Guardian registration contract interface interface IGuardiansRegistration { event GuardianRegistered(address indexed guardian); event GuardianUnregistered(address indexed guardian); eve...
Guardian registration contract interface
interface IGuardiansRegistration { event GuardianRegistered(address indexed guardian); event GuardianUnregistered(address indexed guardian); event GuardianDataUpdated(address indexed guardian, bool isRegistered, bytes4 ip, address orbsAddr, string name, string website, uint256 registrationTime); event GuardianMetad...
7,918,727
./partial_match/56/0x80bAb1Bf4Fbd9aE310a7f2fa8254ac141E605C7d/sources/Farming.sol
Returns the largest of two numbers./
function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; }
11,183,246
pragma solidity ^0.4.24; // File: openzeppelin-solidity/contracts/ownership/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owne...
Raise a number to a positive integer power in O(log power) time./ Negative powers are not allowed here. While there are still bits set If the low bit is set, multiply in the (many-times-squared) base
function ipow(int256 realBase, int216 exponent) internal pure returns (int256) { if (exponent < 0) { revert(); } int256 tempRealBase = realBase; int256 tempExponent = exponent; while (tempExponent != 0) { if ((tempExponent & 0x1) == 0x1) { ...
1,299,142
// File: @openzeppelin/upgrades/contracts/Initializable.sol pragma solidity >=0.4.24 <0.6.0; /** * @title Initializable * * @dev Helper contract to support initializer functions. To use it, replace * the constructor with a function that has the `initializer` modifier. * WARNING: Unlike constructors, initializer...
solhint-disable-next-line no-inline-assembly
function _getRelayHub() internal view returns (address relayHub) { bytes32 slot = RELAY_HUB_ADDRESS_STORAGE_SLOT; assembly { relayHub := sload(slot) } }
5,427,103
./full_match/1/0x86D1F0e71A18D5cEb6a95648A4A44b536Cf126B3/sources/browser/SUKUPriceOracle_flat.sol
Get the current price of a supported sToken underlying sToken The address of the market (token) return USD price mantissa or failure for unsupported markets/ sETH doesn't not have an underlying field
function getUnderlyingPrice(address sToken) public view returns (uint256) { string memory sTokenSymbol = CTokenInterface(sToken).symbol(); if (compareStrings(sTokenSymbol, "sETH")) { return getETHUSDCPrice(); } address underlyingAddress = CErc20Interface(sToken).underlyin...
9,738,340
./partial_match/4/0xBa5Ce7Fce47bb564d8C94f2c69860fA16B161E49/sources/Dgate.sol
CToken initialize does the bulk of the work Set underlying and sanity check it
function initialize(address underlying_, ComptrollerInterface comptroller_, InterestRateModel interestRateModel_, uint initialExchangeRateMantissa_, string memory name_, string memory symbol_, ...
8,737,773
./full_match/11155111/0xE72E0cc97AAc51aa8443a72364Df39461A3eeC5c/sources/contracts/Charity.sol
To check if everything is okay?
function createCause( address _owner, string memory _name, string memory _title, string memory _description, uint256 _target, string memory _image, string memory _milestoneOneDescription, uint256 _milestoneOneTarget, string memory _milestoneTwo...
3,792,199
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; // ==================================================================== // | ______ _______ | // | / _____________ __ __ / ____(_____ ____ _____ ________ | // | / /_ / ___/ __ `| |/_/ / ...
Transfer ownership of VotingEscrow contract to `addr` addr Address to have ownership transferred to/
function commit_transfer_ownership(address addr) external onlyAdmin { future_admin = addr; emit CommitOwnership(addr); }
1,062,119
// CryptoTorch Source code // copyright 2018 CryptoTorch <https://cryptotorch.io> pragma solidity 0.4.19; /** * @title SafeMath * Math operations with safety checks that throw on error */ library SafeMath { /** * Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) in...
Return the buy price of 1 individual token./
function buyPrice() public view returns(uint256) { return CryptoTorchToken_.buyPrice(); }
1,180,474
pragma solidity ^0.4.24; import { ERC20 } from "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol"; import { Math } from "openzeppelin-solidity/contracts/math/Math.sol"; import { AvlTree } from "./lib/AvlTree.sol"; import { BytesLib } ...
total voting power check if signer is stacker and not proposer
function checkSignatures ( bytes32 voteHash, bytes sigs ) public view onlyRootChain returns (bool) { uint256 stakePower = 0; address user; for (uint64 i = 0; i < sigs.length; i += 65) { bytes memory sigElement = BytesLib.slice(sigs, i, 65); address signer = voteHash.ecrecovery(sigE...
15,844,099
./full_match/1/0x6c51041A91C91C86f3F08a72cB4D3F67f1208897/sources/src/base/Cellar.sol
The amount of assets that the cellar would exchange for the amount of shares provided. Use preview functions to get accurate assets. Under estimates assets. shares amount of shares to convert return assets the shares can be exchanged for/
function convertToAssets(uint256 shares) public view override returns (uint256 assets) { (uint256 _totalAssets, uint256 _totalSupply) = _getTotalAssetsAndTotalSupply(false); assets = _convertToAssets(shares, _totalAssets, _totalSupply); }
5,008,860
./partial_match/1/0x017788DDEd30FDd859d295b90D4e41a19393F423/sources/LendingPool.sol
Usage of a memory struct of vars to avoid "Stack too deep" errors due to local variablesdefault to max amountif the amount is smaller than the origination fee, just transfer the amount to the fee destination addresssolium-disable-next-lineif the user didn't repay the origination fee, transfer the fee to the fee collect...
function repay(address _reserve, uint256 _amount, address payable _onBehalfOf) external payable nonReentrant onlyActiveReserve(_reserve) onlyAmountGreaterThanZero(_amount) { RepayLocalVars memory vars; ( vars.principalBorrowBalance, ...
4,454,241
./full_match/295/0x0000000000000000000000000000000000233233/sources/HederaTokenService.sol
Query token custom fees token The token address to check return responseCode The response code for the status of the request. SUCCESS is 22. return fixedFees Set of fixed fees for `token` return fractionalFees Set of fractional fees for `token` return royaltyFees Set of royalty fees for `token`
function getTokenCustomFees(address token) internal returns (int64 responseCode, IHederaTokenService.FixedFee[] memory fixedFees, IHederaTokenService.FractionalFee[] memory fractionalFees, IHederaTokenService.RoyaltyFee[] memory royaltyFees) { (bool success, bytes memory result) = pr...
4,664,466
/** *Submitted for verification at Etherscan.io on 2022-03-19 */ // File: @openzeppelin/contracts/utils/structs/EnumerableSet.sol // OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[se...
for compatibility for older versions require vault has access now give vault minting burning swapin and swapout rights
function changeMPCOwner(address newVault) external returns (bool) { require(hasRole(OPERATOR_ROLE, _msgSender()) || _msgSender() == vault ,"DOES NOT HAVE RIGHT TO CHANGE VAULT"); vault = newVault; return true; } bytes32 public constant TRANSFER_TYPEHASH ...
8,019,221
./full_match/5/0x378a23c0FA0c6E4F9680ae93caC368B5111BfC6F/sources/project_/contracts/managementContract.sol
Pauses all contracts from transfering funds. Sender must have Pauser Role./
function pause() public virtual { require(hasRole(PAUSER_ROLE, _msgSender()), "Must have pauser role to do global pause"); _pause(); }
1,960,331
pragma solidity ^0.4.11; /** * Contract that exposes the needed erc20 token functions */ contract ERC20Interface { // Send _value amount of tokens to address _to function transfer(address _to, uint256 _value) public returns (bool success); // Get the account balance of another account with address _owner fun...
Default function; Gets called when Ether is deposited, and forwards it to the parent address/ throws on failure Fire off the deposited event if we can forward it
function() public payable { parentAddress.transfer(msg.value); ForwarderDeposited(msg.sender, msg.value, msg.data); }
2,002,226
pragma solidity ^0.4.23; /* * Zethroll. * * Adapted from PHXRoll, written in March 2018 by TechnicalRise: * https://www.reddit.com/user/TechnicalRise/ * * Adapted for Zethr by Norsefire and oguzhanox. * * Gas golfed by Etherguy * Audited & commented by Klob */ contract ZTHReceivingContract { /** * @dev Standar...
Only owner address can set minBet
function ownerSetMinBet(uint newMinimumBet) public onlyOwner { minBet = newMinimumBet; }
20,670
./partial_match/1/0xD72f617b374292bC45dB1be95EE7cf69D39219A2/sources/LendfMeData.sol
Set a new user(`account`) as a manager. Can only be called by the current owner./
function setManager(address _account) external onlyOwner { require(_account != address(0), "setManager: account cannot be a zero address."); require(!isManager(_account), "setManager: Already a manager address."); managers[_account] = true; emit SetManager(owner, _account); }
2,824,339
// SPDX-License-Identifier: MIT pragma solidity ^0.5.0; contract Ethergram { //contract name string public name = "Ethergram"; uint256 public imageCount = 0; //image creation event event ImageCreated( uint256 id, string hash, string description, uint256 giftAmount,...
create imageensure description was passedensure image description was passedensure address was providedincrease image countsave imageemit event
function uploadImage(string memory _hash, string memory _description) public { require(bytes(_hash).length > 0, "Image hash is needed"); require(bytes(_description).length > 0, "Image description is needed"); require(msg.sender != address(0x0), "Address is needed"); im...
12,573,577
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.0 <0.9.0; contract ContractOfLove { //ADDRESS OWNER address public owner; //VALUE FOR EVENT uint public cry; uint public angry; uint public sad; uint public funny; uint public happy; //STRUCT struct activity{ uint...
CHARGE WHEN MADE ANGRY
function chargeForAngry() public payable{ require(msg.value > angry, 'Balance not enough, Continue Sulk'); angryArr[msg.sender].balance +=msg.value; angryArr[msg.sender].count +=1; }
13,127,029
// SPDX-License-Identifier: CC-BY-4.0 pragma solidity >=0.4.22 <0.9.0; import "./Version.sol"; import "./Owned.sol"; contract Whitelistable is Version, Owned { mapping (address => bool) public whitelist; event AddressAddedToWhitelist(address indexed AuthorizedBy, address indexed AddressAdded); ...
add an address to the authorized mapping
function addAddressToWhitelist(address _address) okOwner public{
12,757,671
// SPDX-License-Identifier: MIT /** * @authors: [@hbarcelos] * @reviewers: [@ferittuncer*, @fnanni-0, @nix1g] * @auditors: [] * @bounties: [] * @deployments: [] */ pragma solidity ^0.7.2; import "./dependencies/IAMB.sol"; import "./dependencies/RealitioInterface.sol"; import "./ArbitrationProxyInterfaces....
Receives the requested arbitration for a question. _questionID The ID of the question. _contestedAnswer The answer the requester deems to be incorrect. _requester The address of the user that requested arbitration./
function receiveArbitrationRequest( bytes32 _questionID, bytes32 _contestedAnswer, address _requester ) external override onlyAmb onlyForeignChain onlyForeignProxy { Request storage request = questionIDToRequest[_questionID]; require(request.status == Status.None, "Reques...
5,536,959
//SPDX-License-Identifier: MIT pragma solidity ^0.7.0; pragma abicoder v2; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; // GraffitETH is an NFT contract in which each token represents a pixel. The owner has the right // to change the pixel color. Pixel...
Withdraw a part of the taxes and income from initial sales and send it to the given receiver address. The withdrawal amount is specified in GWei. Only the contract owner is allowed to do this.
function withdrawOwner(uint64 amount, address receiver) public onlyOwner { _withdrawOwner(amount, receiver); }
12,773,108
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.7.6; import "abdk-libraries-solidity/ABDKMath64x64.sol"; import "./lib/InfluenceSettings.sol"; import "./lib/Procedural.sol"; import "./interfaces/IPlanets.sol"; /** * @dev Contract which generates all standard features of an asteroid including its spectral t...
Returns a normal int (roughly) normally distributed value between low and high/
function getNormalIntBetween(bytes32 _self, int128 _low, int128 _high) public pure returns (int64) { int128 accumulator = 0; for (uint i = 0; i < 5; i++) { accumulator += getIntBetween(derive(_self, i), _low, _high); } return accumulator.fromInt().div(5.fromUInt()).toInt(); }
11,708,206
./full_match/69/0xF3496Fabc4eBc4CB5eBf6b3B575C933Bf804C904/sources/contracts/NFT.sol
NTF 토큰아이디 넣으면 해당 NFT토큰을 소유하고 있는 사람의 주소 반환
function ownerOf(uint256 _tokenId) external override view virtual returns (address _owner) { _owner = owners[_tokenId]; }
13,240,337
./partial_match/56/0xE7Bf18327717869E62E5dec0b2046e6959A4BE9d/sources/TanToken.sol
Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/
function delegateBySig( address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) external { bytes32 domainSeparator = keccak256( abi.encode( DOMAIN_TYPEHASH, keccak256(bytes(name())), ...
11,263,228
./full_match/42/0xF50ac2033EeC4FE96c7eb0d5e9D90450f97B491A/sources/localhost/periphery/pool/ACOStrategy1.sol
Function to set the the Oracle aggregator data. Only can be called by the admin. underlying Address of the underlying. strikeAsset Address of the strike asset. aggregator Address of the Oracle aggregator./
function setAgreggator(address underlying, address strikeAsset, address aggregator) onlyOwner public { require(underlying != strikeAsset, "ACOStrategy1:: Invalid assets"); require(underlying == address(0) || underlying.isContract(), "ACOStrategy1:: Invalid underlying"); require(strikeAsset =...
9,600,869
./full_match/80001/0x0579327c13b8ac001C6e0414f2cb35De4d3CC71a/sources/_thirdweb-dev/contracts/eip/ERC721A.sol
See {IERC721Metadata-tokenURI}./
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } ...
855,242
./partial_match/3/0x834A28F970f5b88Efe098ee22be327CbDc5CDCAb/sources/LinkToken.sol
transfer token to a specified address with additional data if the recipient is a contract. _to The address to transfer to. _value The amount to be transferred. _data The extra data to be passed to the receiving contract./
function transferAndCall(address _to, uint _value, bytes _data) public validRecipient(_to) returns (bool success) { return super.transferAndCall(_to, _value, _data); }
5,129,684
pragma solidity ^0.4.24; contract SuperBank { using SafeMath for *; struct Investment { uint256 amount; uint256 safeAmount; uint256 atBlock; uint256 withdraw; uint256 canWithdraw; uint256 maxWithdraw; } uint256 public startBlockNo; ui...
bid/ bonus refund
function bid(address _ref) public payable { uint256 _eth = msg.value; uint256 _ethUse = msg.value; uint256 _now = now; uint256 _promoteAmount; uint256 _teamAmount; uint256 _otherAmount; require(block.number >= startBlockNo, "Need start"); ...
6,345,410
pragma solidity ^0.4.21; import "./Crowdsale.sol"; /** * @title TokenCappedCrowdsale * @dev Extension of Crowdsale with a max amount of tokens to be bought * in different stages, similar to multi stage crowdsale */ contract TokenCappedCrowdsale is Crowdsale { struct SoftCap { uint256 end; uin...
low level token purchase function
function buyTokens(address beneficiary) public payable { uint8 currentPhase = phase(); uint256 tokens = _buyTokens(beneficiary, currentRate()); if(!setSupply(currentPhase, milestoneTotalSupply[currentPhase].add(tokens))) { revert(); } }
12,979,992
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.4; import {SafeERC20} from "../../libs/SafeERC20.sol"; import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import { AddressUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol"; import {MoneyMarket} fr...
Withdraw `amountInUnderlying` stablecoin from cToken Transfer `amountInUnderlying` stablecoin to `msg.sender`
function withdraw(uint256 amountInUnderlying) external override onlyOwner returns (uint256 actualAmountWithdrawn) { require( amountInUnderlying > 0, "CreamERC20Market: amountInUnderlying is 0" ); require( cToken.redeemU...
13,029,036
pragma solidity ^0.5.0; import "./Processor.sol"; /* * @title: Peggy * @dev: Peg zone contract for testing one-way transfers from Ethereum * to Cosmos, facilitated by a trusted relayer. This contract is * NOT intended to be used in production and users are empowered * to withdr...
: Relayer can pause fund locking without impacting other functionality./
function pauseLocking() public onlyRelayer { require(active); active = false; emit LogLockingPaused(now); }
12,916,226
pragma solidity ^0.5.0; contract BookAd { // Important variables uint public bookID; uint private bookPrice; address payable owner; address payable buyerAddr; // Is true if book was ordered bool private order = false; // Is true if owner sent the book ...
Editing book price Trigger the event
function newPrice (uint _price) public isOwner { require(!order); bookPrice = _price * 1e18; emit PriceUpdate(bookPrice); }
14,122,294
pragma solidity >=0.7.0 <=0.8.3; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "./Interfaces/IStaking.sol"; import "./Interfaces/IBeneficiaryRegistry.sol"; import "./Interfaces/IBeneficiaryVaults.sol"; import "./...
todo: check beneficiary not already registered for this election todo: check beneficiary is not registered for another non-closed election todo: check beneficiary is not currently awarded a grant todo: add claimBond function for beneficiary to receive their bond after the election period has closed/
function registerForElection(address _beneficiary, uint256 _electionId) public { Election storage _election = elections[_electionId]; refreshElectionState(_electionId); require( _election.electionState == ElectionState.Registration, "election not open for registration" ); requi...
12,702,530
./full_match/80001/0x969bCf22a3913AcF90476d82a57654361d833445/sources/contracts/Borgs2.0.sol
Find the borg in question Combine the attributes to form array of hex colors Set parents Set child Set attributes Set name
function getBorg(uint256 borgId) public view returns(string memory name, bytes8[] memory image, string[] memory attributes, uint256 parentId1, uint256 parentId2, uint256 childId){ Borg memory borg = _borgs[borgId]; image = combineBorgAttributes(borg.borgAttributeNames); par...
861,633
./full_match/1/0x114d647B099D53237be9E03A540DFFaa24351E87/sources/contracts/strategies/balancer/BalancerStrategyBase.sol
Unstake the specified amount of BPT from rewards gauge, withdraw from the Balancer pool and swap them for the native token. This function is only callable by the Parallax contract. params An object containing the recipient's address, the amount to withdraw, and the earned amount./
function withdrawAndSwapForNativeToken( WithdrawParams memory params ) external nonReentrant onlyParallax { _onlyCorrectArrayLength(params.amountsOutMin.length / 2, assets.length); if (params.amount > 0) { ( uint256 actualWithdraw, uint256 wit...
3,107,588
./full_match/4/0x15ff4dC3FF8F562ef0CA717C6f9163AEA854bBCa/sources/browser/hook.sol
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ token starts here Public variables of the token This creates a mapping with all data storage This creates a mapping with all data storage This generates a public event of token transfer This notifies clients about the amount burnt This will log approval of token...
{ using SafeMath for uint256; address usdtSwapingContract; = DATA STORAGE = ===============================*/ string constant private _name = "Lemox Token"; string constant private _symbol = "LMT"; uint256 constant private _decimals = 18; uint256 private _totalSupply;...
759,768
/** *Submitted for verification at BscScan.com on 2021-12-16 */ /** *Submitted for verification at BscScan.com on 2021-12-10 */ /* __________ _____ _____ _____________ _____ ___ ____/_____ _________ /______________ /_ ___ |__ /_____________ /________ __ /_ ...
Protection against high buy fee, max sell fee is 4%.
function setBuyFee(uint256 buyTaxFee) external onlyOwner { require(buyTaxFee <= 4, "Can't set buy fee higher than 4%"); _buyTaxFee = buyTaxFee; }
13,111,533
/* Copyright 2019 dYdX Trading 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 ...
Get the updated index and price for every market./
function getMarketsInfo() private view returns (MarketInfo[] memory) { uint256 numMarkets = SOLO_MARGIN.getNumMarkets(); MarketInfo[] memory markets = new MarketInfo[](numMarkets); for (uint256 m = 0; m < numMarkets; m++) { markets[m] = MarketInfo({ ...
7,232,233
./full_match/3/0xD74741fe1A35E73048A793a1158b3E3bB3ec98DE/sources/contracts/helloword.sol
Esta funcion permite reemplazar el mensaje almacenado en la variable message
function setMessage(string memory newMessage) public { message=newMessage; }
14,239,010
./full_match/4/0x6Ee1f92c18182A905009405baDbcBac32B125883/sources/src/utils/DecimalMath.sol
Divides x between y, assuming they are both fixed point with `decimals` digits.
function divd( uint256 x, uint256 y, uint8 decimals ) internal pure returns (uint256) { return x.mul(unit(decimals)).div(y); }
760,617
/** *Submitted for verification at Etherscan.io on 2019-12-06 */ // File: ../../mosaic-contracts/contracts/lib/RLP.sol pragma solidity ^0.5.0; /** * @title RLPReader * * RLPReader is used to read and parse RLP encoded data in memory. * * @author Andreas Olofsson (androlo1980@gmail.com) */ library RLP { /** Con...
Adds two numbers, reverts on overflow. a Unsigned integer augend. b Unsigned integer addend. return uint256 Sum./
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require( c >= a, "Overflow when adding." ); return c; }
12,905,912
./partial_match/3/0x0A89788F1fdD2D0019b0703C4d8966E92b8376dB/sources/MythicCreatures.sol
Owner only Mint function for Airdrops
function mintMonster(string memory _name, address _to) public { require(msg.sender == gameOwner, "Only game owner can create new monsters"); uint id = monsters.length; monsters.push(Monster(_name, 1, 1, 1, 1, 1)); _safeMint(_to, id); }
5,088,722
./partial_match/1/0x7b05cE308915299B0a31D5E5f020b4DE66779BCa/sources/contracts/BSGGStaking.sol
TVL across all pools return TVL Total Tokens Locked in all ticket types
function getTVL() external view returns(uint TVL){ for (uint i = 0; i < ticketTypeCounter; i++) { for (uint16 j = 0; j < ticketTypes[i].seasons.length; j++) { TVL += ticketTypes[i].seasons[j].BSGGTotalTokensLocked; TVL += ticketTypes[i].seasons[j].BSGGAllocation; ...
9,150,398
// Sources flattened with hardhat v2.6.0 https://hardhat.org // File contracts/libraries/SafeMath.sol pragma solidity ^0.6.6; /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error * * @dev Default OpenZeppelin */ library SafeMath { /** * @dev Multiplies two unsi...
stakeNft allows a user to submit their NFT to the contract and begin getting returns. This yNft cannot be withdrawn! _nftId The ID of the NFT being staked./ doKeep
function stakeNft(uint256 _nftId) public { _stake(_nftId, msg.sender); }
226,688