file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; // File: contracts/lib/AddressUtil.sol // Copyright 2017 Loopring Technology Limited. /// @title Utility Functions for addresses /// @author Daniel Wang - <daniel@loopring.org> /// @author Brecht Devos - <brecht@loopring...
Try to transfer the tokens If the transfer was successful there's nothing left to do. However, if the transfer failed the tokens are still in the contract and can be withdrawn later to `to` by anyone by using `withdrawFromApprovedWithdrawal.
function distributeWithdrawal( ExchangeData.State storage S, address from, address to, uint16 tokenID, uint amount, bytes memory extraData, uint gasLimit ) public { bool success = transferTokens( S, ...
334,432
./partial_match/1/0x47a4762F6531944Fee3663cf59a9A1a41e74b075/sources/MomijiTokenManager.sol
interface of MomijiToken/
interface IMomijiToken { function tokenQuantityWithId(uint256 tokenId) view external returns(uint256); function tokenMaxQuantityWithId(uint256 tokenId) view external returns(uint256); function mintManuallyQuantityWithId(uint256 tokenId) view external returns(uint256); function creators(uint256 tokenId) ...
2,594,193
pragma solidity >=0.4.25 <0.6.0; contract TweederCore { /* mapping between user address and tweeds structs */ mapping (address => TweederTypes.Tweeds) userTweedMap; mapping (bytes32 => TweederTypes.TweedReplies) tweedRepliesMap; /* unused event */ event Transfer(address in...
Function: editTweed -------------------- Updates a post from storage uint tweedIndex: index of the tweed on the owner storage string memory newContent: tweed's new content returns: returns: success status as boolean/
function editTweed(uint tweedIndex, string memory newContent) public returns(bool) { if(!TweederCoreUtils.isContentValid(newContent)) return false; TweederTypes.Tweed memory editedTweed = userTweedMap[msg.sender].tweeds[tweedIndex]; editedTweed.content.text = newContent; editedTweed...
1,766,542
pragma solidity ^0.5.3; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "./UsingRegistry.sol"; /** * @title Holds a whitelist of addresses for which transfers should not be * frozen so that network initialization can take place. */ ...
Gets the number of registered contracts return The length of registeredContracts/
function getRegisteredContractsLength() external view returns (uint256 length) { return registeredContracts.length; }
15,797,935
./partial_match/42220/0xb2bFEd6dfd98fe8B3F1dDA71f1C42698Bf5dA326/sources/contracts/Badges.sol
See {IERC721-_beforeTokenTransfer}./
function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { require( hasRole(DEFAULT_ADMIN_ROLE, _msgSender()) || hasRole(badgeRole(_badgeType[tokenId]), _msgSender()), "ERC721: caller is not allow...
3,496,897
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; import "./interfaces/IUniswapV2Pair.sol"; import "./interfaces/IWETH.sol"; import "./libraries/SafeMath.sol"; import "./libraries/TokenInfo.sol"; contract Narwhal { using SafeMath for uint256; using TokenInfo for bytes32; address public immutable uniswapF...
returns sorted token addresses, used to handle return values from pairs sorted in this order
function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) { require(tokenA != tokenB, "UniswapV2Library: IDENTICAL_ADDRESSES"); (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA); require(token0 != address(0), "UniswapV2L...
5,548,216
./full_match/1/0x8943C7bAC1914C9A7ABa750Bf2B6B09Fd21037E0/sources/lazylion.sol
Returns the license for tokens
function tokenLicense(uint256 _id) public view returns (string memory) { require(_id < totalSupply(), "CHOOSE A LION WITHIN RANGE"); return LICENSE_TEXT; }
8,480,030
./full_match/3/0xE4e5bccA10AA67d84CFe62752158B4ce8af7a525/sources/Untitled-1.sol
grąžinama informacija saugoma kontrakte t.y kūrėjo adreses ir kontrakto balansas
function grazintiInformacija() public view returns(address _kurejoAdresas, uint256 _kontraktoBalansas){ _kurejoAdresas = kurejoAdresas; _kontraktoBalansas = address(this).balance; }
14,198,049
./full_match/4/0x29671b937dB4B771bEbA4B07EEaEf029b58c9797/sources/stake-wise/collectors/Pool.sol
See {IPool-setWithdrawalCredentials}./
function setWithdrawalCredentials(bytes32 _withdrawalCredentials) external override onlyAdmin { withdrawalCredentials = _withdrawalCredentials; emit WithdrawalCredentialsUpdated(_withdrawalCredentials); }
764,700
./partial_match/1/0xb1c23d9ca977aB301417332Def6f91AcBD410A96/sources/src/extensions/SupplyVault.sol
Sets the recipient for the skim function.
function setRecipient(address newRecipient) external onlyOwner { _setRecipient(newRecipient); }
16,140,487
./full_match/3/0x19eBb244B3F6BEb79631684b09B900284Ea3a651/sources/contracts/DNT1.sol
See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`./ checks that the balance of sender is larger or equal to amount. Calculate burn and mint. Check if sender is OwnerAddress, if so, mint.
function transfer(address recipient, uint256 amount) public virtual override returns (bool) { uint256 toBeBurned = calculateBurn(amount); uint256 toBeMinted = calculateMint(amount); uint256 reserveBalanceAfterBurn = SafeMath.sub(balanceOf(ownerAddress),toBeBurned); uint256 r...
8,274,946
./partial_match/1/0xa2a6141F7d0C5abb70e33d8d9cB7337D8934245A/sources/contracts/BitwaveMultiSend.sol
input validation use the erc20 abi loop through to addresses and send value
function sendErc20(address _tokenAddress, address[] memory _to, uint256[] memory _value) public restrictedToOwner returns (bool _success) { require(_to.length == _value.length); require(_to.length <= 255); ERC20 token = ERC20(_tokenAddress); for (uint8 i = 0; i < _to.length; i++) {...
15,649,679
// File: node_modules\@openzeppelin\contracts\introspection\IERC165.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of con...
xref:ROOT:erc1155.adocbatch-operations[Batched] version of {_mint}. Requirements: - `ids` and `amounts` must have the same length. - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value./
function _mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address op...
11,817,098
pragma solidity ^0.4.16; contract Token3CC { /* This creates an array with all balances */ mapping (address => uint256) public balanceOf; /* This generates a public event on the blockchain that will notify clients */ event Transfer(address indexed from, address indexed to, uint256 value); ...
This creates an array with all balances / This generates a public event on the blockchain that will notify clients / Public variables of the token / Initializes contract with initial supply tokens to the creator of the contract /
function Token3CC() public { owner = msg.sender; balanceOf[msg.sender] = initialSupply; }
5,448,444
./partial_match/4/0xF857F36B15F4aDCc08B300c9b72b6C8a7f6F6b76/sources/SimplePOS.sol
given the subscription details, generate a hash and try to kind of follow the eip-191 standard and eip-1077 standard from my dude @avsa if there are requirements from the deployer, let's make sure those are met exactly
function getSubscriptionHash( ) public view returns (bytes32) { require( requiredToAddress == address(0) || to == requiredToAddress, "requiredToAddress Failure" ); require( requiredTokenAddress == address(0) || tokenAddress == requiredTokenAddress, "requiredTokenAddre...
8,529,105
/** *Submitted for verification at Etherscan.io on 2021-05-06 */ pragma solidity 0.5.10; // ---------------------------------------------------------------------------- // WUMI token contract (2021) // // Symbol : WUMI // Name : WUMI // Total supply : 1.175.000 (burnable) // Decimals : 18 // ------...
------------------------------------------------------------------------ Token owner can approve for `spender` to transferFrom(...) `tokens` from the token owner's account. The `spender` contract function `receiveApproval(...)` is then executed ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes memory data) public isRunning returns (bool success) { _approve(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data); return true; }
10,786,944
./full_match/11155111/0xCA59cCeb39bE1808d7aA607153f4A5062daF3a83/sources/contracts/governance/Governed.sol
Admin function for pending governor to accept role and update governor. This function must called by the pending governor./
function acceptOwnership() external { address oldPendingGovernor = pendingGovernor; require( oldPendingGovernor != address(0) && msg.sender == oldPendingGovernor, "Caller must be pending governor" ); address oldGovernor = governor; governor = oldPen...
3,832,577
// File: contracts/lib/SafeMathInt.sol /* MIT License Copyright (c) 2018 requestnetwork Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rig...
Pauses or unpauses the execution of rebase operations. paused Pauses rebase operations if this is true./
function setRebasePaused(bool paused) external { require(msg.sender == timelock || msg.sender == address(0x89a359A3D37C3A857E62cDE9715900441b47acEC)); rebasePaused = paused; emit LogRebasePaused(paused); }
362,630
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@o...
Function 'generateTurtle' mints a new Turtle NFT for the user
function generateTurtle( uint256 _score, string memory _tokenURI, uint8 v, bytes32 r, bytes32 s ) public nonReentrant { bytes32 message = keccak256( abi.encodePacked(_score, msg.sender, _tokenURI) ); bytes32 messageHash = message.toEthSignedMessageHash(); address walletAdd...
1,785,753
// SPDX-License-Identifier: MIT pragma solidity ^0.6.2; ...
inject NONSTANDARD NAMING
function NAME322() public view returns (string memory) {
12,773,215
//SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./libraries/math/SafeMath.sol"; import "./libraries/token/IERC20.sol"; import "./interfaces/IXVIX.sol"; import "./interfaces/IFloor.sol"; contract XVIX is IERC20, IXVIX { using SafeMath for uint256; struct TransferConfig { bool active; ...
onlyAfterHandover guards against a possible gov attack vector since XLGE participants have their funds locked for one month, it is possible for gov to create a safe address and keep XVIX tokens there while destroying all other safes this would raise the value of the tokens kept in the safe address with the onlyAfterHan...
function destroySafe(address _account) public onlyGov onlyAfterHandover enforceMaxSupply { require(safes[_account], "XVIX: account is not a safe"); safes[_account] = false; uint256 balance = balances[_account]; _safeSupply = _safeSupply.sub(balance); uint256 normalBalance =...
2,554,202
/** *Submitted for verification at Etherscan.io on 2020-12-04 */ // File: @openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol 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 ex...
LP allows collateral to be used to mint new options bTokens and wTokens will be held in this contract and can be traded back and forth. The amount of lpTokens is calculated based on total pool value/ Move collateral into this contract If first LP, mint options, mint LP tokens, and send back any redemption amount Ensure...
function provideCapital(uint256 collateralAmount, uint256 lpTokenMinimum) public { collateralToken.safeTransferFrom( msg.sender, address(this), collateralAmount ); if (lpToken.totalSupply() == 0) { enforceDepositLimit(...
10,594,734
pragma solidity =0.6.6; interface IDEXFactory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external vi...
REMOVE LIQUIDITY (supporting fee-on-transfer tokens)
function removeLiquidityBNBSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountBNBMin, address to, uint deadline ) public virtual override ensure(deadline) returns (uint amountBNB) { (, amountBNB) = removeLiquidity( token, WBNB, liquidity, amountTokenMin, amountBNBMin, address(...
13,137,431
pragma ton-solidity >= 0.52.0; pragma AbiHeader time; pragma AbiHeader pubkey; pragma AbiHeader expire; //================================================================================ // import "../interfaces/ILiquidFTRoot.sol"; import "../interfaces/IOwnable.sol"; import "../contracts/LiquidFTWallet.sol"; //=====...
We know for sure that initiator in "mint" process is RTW owner;
{ uint32 functionId = slice.decode(uint32); if (functionId == tvm.functionId(LiquidFTWallet.receiveTransfer)) { uint128 amount = slice.decode(uint128); _totalSupply -= amount; _ownerAddress.transfer(0, true, 128); } }
14,086,938
pragma solidity ^0.4.15; /** * @title VersioningProxy * @author Enrique Piqueras - <epiquerass@gmail.com> * @notice A base contract for managing the deployment of versions of another contract, the managed contract. */ contract VersioningProxy { /* Structs */ struct Deployment { bytes32 tag; ...
Returns all deployed version tags. return All of the deployed version tags./
function allTags() external view returns(bytes32[] _tags) { return tags; }
5,362,897
./full_match/80001/0xe75DEa14d684b4D91067e6C40C159c33eF36D1AA/sources/contracts/Ignite/Tournament.sol
TournamentWithRequests,/ TournamentWithGroups, TournamentWithRounds
function isParticipant(address player) public view override( ITournament ) returns (bool) { return playerIDs[player] > 0; }
5,556,401
./partial_match/1/0x00000000Ede6d8D217c60f93191C060747324bca/sources/src/UniV3Automan.sol
@inheritdoc IUniV3Automan
function reinvest( INPM.IncreaseLiquidityParams memory params, uint256 feePips, bytes calldata swapData, uint256 permitDeadline, uint8 v, bytes32 r, bytes32 s ) external returns (uint128 liquidity, uint256 amount0, uint256 amount1) { checkFeeSanity...
15,622,527
pragma solidity ^0.5.12; /** * @title Helps contracts guard against reentrancy attacks. * @author Remco Bloemen <remco@2π.com>, Eenae <alexey@mixbytes.io> * @dev If you mark a function `nonReentrant`, you should also * mark it `external`. */ contract ReentrancyGuard { /// @dev counter to allow mutex lock with...
A convenience function providing the caller with the current amount needed (in wei) to fulfill this order. _wizardId The id of the wizard NFT whose order we would like to see the details of. _basicTournamentAddress The address of the tournament that this order pertains to. Note that each Wizard has an independent ...
function getCurrentPriceForOrder(uint256 _wizardId, address _basicTournamentAddress) external view returns (uint256){ Order memory order = orderForWizardIdAndTournamentAddress[_basicTournamentAddress][_wizardId]; uint256 power; ( , power, , , , , , , ) = BasicTournament(_basicTournamentAddre...
14,066,860
./full_match/42/0x0be1f7C49A4C0d4721f1F10e18388b3eA8E2f54D/sources/contracts/VsnFactory.sol
verify create user token balance is > _amount_percent
function createSocialLink( address _toUser, address _token, uint256 _amount, uint256 _percent, uint256 _lockTime ) external override onlyPercentLimit(_percent) validToken(_token,_amount,_percent) lockTimeLimit(_lockTime) ch...
9,589,250
pragma solidity ^0.4.25; // It's important to avoid vulnerabilities due to numeric overflow bugs // OpenZeppelin's SafeMath library, when used correctly, protects agains such bugs // More info: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2018/november/smart-contract-insecurity-bad-arithmetic/ impo...
Register an oracle with the contract Require registration fee
function registerOracle ( ) public payable { require(msg.value >= REGISTRATION_FEE, "Registration fee is required"); uint8[3] memory indexes = generateIndexes(msg.sender); or...
13,118,130
./full_match/4/0x7607d3f9B4716382DC52e21f07f5dbA0103996b5/sources/browser/RST1.sol
} else { return Constants.getBaseContractionFactor(); } }
function _getMaxBurnRate() internal view returns (uint256) { if (isBootstrap) { return maxMintRate - 1; return maxBurnRate; } } else { }
12,313,741
pragma solidity ^0.4.10; contract GasToken2 { ////////////////////////////////////////////////////////////////////////// // RLP.sol // Due to some unexplained bug, we get a slightly different bytecode if // we use an import, and are then unable to verify the code in Etherscan //////////////...
Mints `value` new sub-tokens (e.g. cents, pennies, ...) by creating `value` new child contracts. The minted tokens are owned by the caller of this function.
function mint(uint256 value) public { for (uint256 i = 0; i < value; i++) { makeChild(); } s_head += value; s_balances[msg.sender] += value; }
956,775
./partial_match/1/0x34BB76F3EAD9d5D2a2DbA3F040072a6524E2DC7F/sources/TransferOnlySGATokenManager.sol
Return the contract address which implements the SGRToken./
function getSGRTokenContractAddress() public view returns (address) { return getContractAddress(_ISGRToken_); }
3,663,946
pragma solidity ^0.4.22; contract SimpleAuction { // 拍卖的参数。 address public beneficiary; // 时间是unix的绝对时间戳(自1970-01-01以来的秒数) // 或以秒为单位的时间段。 uint256 public auctionEnd; // 拍卖的当前状态 address public highestBidder; uint256 public highestBid; //可以取回的之前的出价 mapping(address => uint256) pen...
取回出价(当该出价已被超越) 这里很重要,首先要设零值。 因为,作为接收调用的一部分, 接收者可以在 `send` 返回之前,重新调用该函数。 这里不需抛出异常,只需重置未付款
function withdraw() public returns (bool) { uint256 amount = pendingReturns[msg.sender]; if (amount > 0) { pendingReturns[msg.sender] = 0; if (!msg.sender.send(amount)) { pendingReturns[msg.sender] = amount; return false; } ...
1,017,506
pragma solidity ^0.5.11; contract ServiceProvider { struct Service { uint code; address owner; string serviceType; string serviceName; string location; uint startdate; uint enddate; string instructor; uint256 costs; } ...
codeIndexAllServices
function deleteService(uint code) public { require(totalServices > 0, 'No services are found'); for(uint256 i = 0; i < serviseCreator[msg.sender].length; i++){ if(codesEqual(code, serviseCreator[msg.sender][i].code)){ serviseCreator[msg.sender][i] = serviseCreator[msg....
7,231,048
./full_match/1/0x41cB4a771FdD019ADBF4685bd4885fbBeedE1784/sources/contracts/EvilNoundlesVRF.sol
migrate the old contract over Look up the types for each. Claim each token they ask to migrate. Verify it has not already been migrated. Verify the owner if the sender.
function migrateOldNoundles(uint256[] memory tokens) public payable { require(migrationEnabled, "Migration is not enabled"); uint8[] memory foundTypes = BetaTheory.getTypeByTokenIds(tokens); uint256 offset = 0; for(uint256 i = 0; i < tokens.length; i += 1){ if(alrea...
3,121,488
pragma solidity 0.5.16; import "@openzeppelin/contracts-ethereum-package/contracts/math/Math.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts-ethereum-package/contr...
Chooses the best strategy and re-invests. If the strategy did not change, it just calls doHardWork on the current strategy. Call this through controller to claim hard rewards./ ensure that new funds are invested too
function doHardWork() whenStrategyDefined onlyControllerOrGovernance external { invest(); IStrategy(strategy()).doHardWork(); }
1,463,886
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.6.12; pragma experimental ABIEncoderV2; import "hardhat/console.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol"; import {FixedPointMath} from "../libraries/Fixe...
Updates the pool. _ctx the pool context.
function update(Data storage _data, Context storage _ctx) internal { _data.accumulatedRewardWeight = _data.getUpdatedAccumulatedRewardWeight(_ctx); _data.lastUpdatedBlock = block.number; }
94,386
./partial_match/1/0x1b344763062c7b04cc815D3278B6BB71a7F7FCeF/sources/RoomNFT.sol
SPDX-License-Identifier-FLATTEN-SUPPRESS-WARNING: MIT
interface IRoomContractMin { function _beforeTokenTransfer( address from, address to, uint256 tokenId } pragma solidity ^0.8.0; struct TokenObject { address token_address; uint256 token_id; uint256 room_id; uint256 price; uint256 amount; ...
3,549,413
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; // /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the am...
Withdraw all funds, normally used when migrating strategies additional protection so we don't burn the funds
function withdrawAll() external returns (uint256 balance) { require(msg.sender == controller, "!controller"); IUniStakingRewards(uniStakingPool).exit(); balance = IERC20(want).balanceOf(address(this)); uint256 rewarAmount = IERC20(rewardUni).balanceOf(address(this)); addres...
43,470
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./interfaces/IFeeDistri...
set protocol revenue recipient Can be called by admin _protocolRevenueRecipient new protocol revenue recipient/
function setProtocolRevenueRecipient(address _protocolRevenueRecipient) external onlyOwner { require( _protocolRevenueRecipient != address(0), "!_protocolRevenueRecipient" ); protocolRevenueRecipient = _protocolRevenueRecipient; emit NewProtocolRevenueRecipient(_protoco...
2,487,852
./full_match/100/0x3f7c5935e1ee6D4910A753b2B6229C8e0D53E57b/sources/contracts/LP.sol
Make new bet. Emits bet token(s) to `msg.sender`. core address of the Core the bet is intended amount amount of tokens to bet expiresAt the time before which bet should be made data customized bet data/
function bet( address core, uint128 amount, uint64 expiresAt, ICoreBase.BetData calldata data ) external override { TransferHelper.safeTransferFrom( token, msg.sender, address(this), amount ); _bet(msg.sender...
14,285,297
./full_match/44787/0x36894871A4542f94eA0dF2C71e47fb4Ea5A06359/sources/feature-v2/Feature.sol
Pay receiver. To be called if the service is provided. _claimID The index of the claim./
function pay(uint256 _claimID) public { Claim storage claim = claims[_claimID]; Transaction storage transaction = transactions[claim.transactionID]; require(transaction.isExecuted == false, "The transaction should not be executed."); require(claim.timeoutClaim <= block.timestamp, "T...
13,242,849
// SPDX-License-Identifier: MIT pragma solidity 0.8.5; import {InitializedProxy} from "./InitializedProxy.sol"; import {PartyBid} from "./PartyBid.sol"; import {Structs} from "./Structs.sol"; /** * @title PartyBid Factory * @author Anna Carroll * * WARNING: A malicious MarketWrapper contract could be used to ste...
validate token exists (must set nftContract & tokenId before _getOwner) if split is non-zero, validate that party split won't retain the total token supply if token gating is non-zero call totalSupply to verify that address is ERC-20 token contract
function __Party_init( address _nftContract, uint256 _tokenId, Structs.AddressAndAmount calldata _split, Structs.AddressAndAmount calldata _tokenGate, string memory _name, string memory _symbol ) internal { require(msg.sender == partyFactory, "Party::__Par...
1,075,035
./partial_match/1/0xF1819686a9332Eeb66a7fc22a9Bc08A1AcA3aB2d/sources/VacSale.sol
Interface of the ERC20 standard as defined in the EIP./
interface IERC20 { event Transfer(address indexed from, address indexed to, uint256 value); event Approval( address indexed owner, address indexed spender, uint256 value ); function totalSupply() external view returns (uint256); function balanceOf(address account) external...
4,201,588
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './interfaces/IAtlantisV1Pool.sol'; import './interfaces/IAtlantisV1Factory.sol'; import './interfaces/IAtlantisV1PoolDeployer.sol'; import './interfaces/IERC20Minimal.sol'; import './interfaces/callback/IAtlantisV1MintCallback.sol'; import './interfaces/...
Gets and updates a position with the given liquidity delta owner the owner of the position tickLower the lower tick of the position's tick range tickUpper the upper tick of the position's tick range tick the current tick, passed to avoid sloads if we need to update the ticks, do it clear any tick data that is no lo...
function _updatePosition( address owner, int24 tickLower, int24 tickUpper, int128 liquidityDelta, int24 tick ) private returns (Position.Info storage position) { position = positions.get(owner, tickLower, tickUpper); bool flippedLower; bo...
2,542,121
./full_match/1/0x6C1C3012f6Ac0dBB750e33f93E1bA350012A6653/sources/contracts/periphery/manager/PoolManagerLocker.sol
Restricted lp fee update mechanism/
function changeLpFee(uint96 /*newFeeLp_*/ ) public pure override { revert PoolManagerUnsupportedOperation(); }
3,043,352
pragma solidity ^0.4.24; // File: /rhem/contracts/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 owner; /** ...
Check if locked/
function isLocked() public view returns(bool) { return _isLocked; }
7,298,939
pragma solidity >=0.5.4 <0.6.0; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external; } /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies ...
Update the TAO Content State of a T(AO) Content _contentId The ID of the Content _taoId The ID of the TAO that initiates the update _taoContentState The TAO Content state value, i.e Submitted, Pending Review, or Accepted to TAO _updateTAOContentStateV The V part of the signature for this update _updateTAOContentSt...
function updateTAOContentState( bytes32 _contentId, address _taoId, bytes32 _taoContentState, uint8 _updateTAOContentStateV, bytes32 _updateTAOContentStateR, bytes32 _updateTAOContentStateS ) public { require (contentIndex[_contentId] > 0); require (AOLibrary.isTAO(_taoId)); (,, bytes32 _contentUsag...
12,664,038
pragma solidity ^0.4.24; /** *This contracts helps clone factories and swaps through the Deployer.sol and MasterDeployer.sol. *The address of the targeted contract to clone has to be provided. */ contract CloneFactory { /*Variables*/ address internal owner; /*Events*/ event CloneCreated(address i...
Used to test callback _oraclizeID unique oraclize identifier of call _result Result of API call in string format/
function callback(uint _result, bytes32 _oraclizeID) public { QueryInfo storage currentQuery = info[_oraclizeID]; require(_oraclizeID == queryID); currentQuery.value = _result; currentQuery.called = false; if(currentQuery.value == 0){ currentQuery.value = 1; ...
6,426,562
./full_match/1/0xf853E037378bc734D298D76CE7B59CFB66279226/sources/contracts/15Love.sol
added this check so that collection can be under capped if needed but can never increase from initial total
function updateMaxSupplyTotal(uint256 _number) public onlyRole(DEFAULT_ADMIN_ROLE) { require(_number <= maxSupply, "Public supply can not exceed total defined."); maxSupplyTotal = _number; }
3,848,780
pragma solidity >= 0.6.2 < 0.7.0; import "./Owned.sol"; import "./StandardToken.sol"; import "./Authority.sol"; import "./Controlled.sol"; //投票合约 contract Ballot is StandardToken, Controlled, Authority { //合约创建的时候执行,执行合约的人是第一个owner constructor() public { // owner = msg.sender; } //ballot str...
目前获胜编号 proporsals; index0 = true;index1 = false;
function winningProposal() public view returns(uint _winningProposal) { require(!iflastvotefinish, "myvote error3 : no vote runing right now"); uint winningCount = 0; for (uint prop = 0; prop < proporsals.length; prop++) { if (winningCount < proporsals[prop].voteCount) { ...
12,701,315
pragma solidity ^0.4.25; //import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/math/SafeMath.sol"; /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two numbers, reverts on overflow. */ function mul(u...
return true if crowdsale event has ended
function hasEnded() public constant returns (bool) { return block.number > endBlock; }
7,247,371
/* Mainstreet MITs Explanatory Language Each Subscriber to the Fund will execute a subscription agreement and agree the terms of a partnership agreement relating to the Fund. On acceptance of its subscription by the Fund, execution of the partnership agreement and entry on the Fund's limited partner records, a...
Constructor. _mainstreetCrowdfund Address of crowdfund contract. _intellisys Address to receive intellisys' tokens. _start Timestamp when the token becomes active./
function MainstreetToken(address _mainstreetCrowdfund, address _intellisys, uint _start, bool _testing) { mainstreetCrowdfund = _mainstreetCrowdfund; intellisys = _intellisys; start = _start; testing = _testing; }
12,960,045
./partial_match/1/0xe402a39F788f90607A50254fAf56316E6a78231A/sources/FraxFarmRageQuitter_Gelato_FRAX_DAI.sol
Exits all stakes Get all locked stake of the user
function ragequitAll() nonReentrant external { uint256 _totalLiquidity; IFarm.LockedStake[] memory lockedStakes = farm.lockedStakesOf(msg.sender); for (uint256 i; i < lockedStakes.length; i++) { uint256 _liquidity = lockedStakes[i].liquidity; if (_liquidity > 0) { ...
15,570,593
// SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity ^0.8.0; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can...
MasterChef.deposit() looks up the pool LP tokens are being deposited from in a storage array by indexThe indices are only available in event logs, so this function could be called either by a bot or Vault.createVault Add info about pool _pool Sushiswap pool _pid Id of Pool from Sushiswap pathFromSushi Conversion r...
function addPool( address _pool, uint256 _pid, address[] calldata pathFromSushi ) external whenNotPaused isAuthorized(OLib.STRATEGIST_ROLE) { require(!pools[_pool]._isSet, "Pool ID already registered"); require(_pool != address(0), "Cannot be zero address"); IMasterChef.PoolInfo memory poolI...
12,257,698
/* ____ __ __ __ _ / __/__ __ ___ / /_ / / ___ / /_ (_)__ __ _\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ / /___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\ /___/ * Synthetix: Issuer.sol * * Latest source (may be newer): https://github.com/Synthetixio/synthetix/blob/master/contracts/Iss...
https:docs.synthetix.io/contracts/source/interfaces/isynthetixstate Views Mutative functions
interface ISynthetixState { function debtLedger(uint index) external view returns (uint); function issuanceData(address account) external view returns (uint initialDebtOwnership, uint debtEntryIndex); function debtLedgerLength() external view returns (uint); function hasIssued(address account) extern...
540,855
./partial_match/1/0x9c12d9b1223130B641154d8d3DB35F91D81c8dfd/sources/InBitToken.sol
Returns the total amount of all unlockable tokens for a specified address. _of The address to query the unlockable token count of
function getUnlockableTokens(address _of) public view returns (uint256 unlockableTokens) { for (uint256 i = 0; i < lockReason[_of].length; i++) { unlockableTokens = unlockableTokens.add(tokensUnlockable(_of, lockReason[_of][i])); } }
16,074,275
./partial_match/1/0x1201FAa7258A48b820619dD57Cd8FdEb25D49b2c/sources/@balancer-labs/v2-solidity-utils/contracts/helpers/ScalingHelpers.sol
Applies `scalingFactor` to `amount`, resulting in a larger or equal value depending on whether it needed scaling or not./ Upscale rounding wouldn't necessarily always go in the same direction: in a swap for example the balance of token in should be rounded up, and that of token out rounded down. This is the only place ...
function _upscale(uint256 amount, uint256 scalingFactor) pure returns (uint256) { return FixedPoint.mulDown(amount, scalingFactor); }
4,228,029
./full_match/5/0xB23F0796e592A91467E5D42F3368Cd722E7f0251/sources/contracts/medrecords.sol
Retrieve appointment details from appointment page and store the details into the blockchain
function setAppointment(address _addr, string memory _date, string memory _time, string memory _diagnosis, string memory _prescription, string memory _description, string memory _status) public { require(isDoctor[msg.sender]); Appointments storage a = appointments[_addr]; a.doctorad...
11,630,149
// SPDX-License-Identifier: MIT pragma solidity =0.8.4; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '../vaults/UpgradableTokenVault.sol'; /** * Upgradable Contract that will be used in futuere for the community rewards */ contract UpgradableCommunityRewardDistributor_V1 is UpgradableTok...
Initalize the vault/
function initialize() public initializer { __RetrieveToken_init(); }
1,500,289
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; /* Interface Imports */ import { IL1ERC721Bridge } from "./IL1ERC721Bridge.sol"; import { IL2ERC721Bridge } from "../../L2/messaging/IL2ERC721Bridge.sol"; import { IERC721 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; /* Library Imports */ import { ...
Performs the logic for deposits by informing the L2 Deposited Token contract of the deposit and calling a handler to lock the L1 NFT. (e.g. transferFrom) _l1Token Address of the L1 ERC721 we are depositing _l2Token Address of the L1 respective L2 ERC721 _from Account to pull the deposit from on L1 _to Account to gi...
function _initiateERC721Deposit( address _l1Token, address _l2Token, address _from, address _to, uint256 _tokenId, uint32 _l2Gas, bytes calldata _data ) internal { IERC721(_l1Token).transferFrom(_from, address(this), _tokenId); bytes memor...
6,380,536
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/con...
When the protocol is recollateralizing, we need to give a discount of IVORY to hit the new CR target Thus, if the target collateral ratio is higher than the actual value of collateral, minters get IVORY for adding collateral This function simply rewards anyone that sends collateral to a pool with the same amount of IVO...
function recollateralize(uint256 _collateral_amount, uint256 _share_out_min) external returns (uint256 share_out) { require(recollat_paused == false, "Recollat is paused"); require((ITreasury(treasury).globalCollateralBalance() + _collateral_amount) <= pool_ceiling, "Pool ceiling"); uint25...
12,560,259
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.6.12; import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol'; import {IReserveInterestRateStrategy} from '../../interfaces/IReserveInterestRateStrategy.sol'; import {WadRayMath} from '../libraries/math/WadRayMath.sol'; import {PercentageMa...
Divides two way, rounding half up to the nearest way a Way b Way return The result of a/b, in way/
function wayDiv(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, Errors.MATH_DIVISION_BY_ZERO); uint256 halfB = b / 2; require(a <= (type(uint256).max - halfB) / WAY, Errors.MATH_MULTIPLICATION_OVERFLOW); return (a * WAY + halfB) / b; }
6,961,794
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <=0.8.7; //import "hardhat/console.sol"; import "prb-math/contracts/PRBMathUD60x18.sol"; // describes the logic of taxes contract TaxContract { using PRBMathUD60x18 for uint256; event OnReward(address indexed account, uint256 value); // who and how muc...
returns the reward coefficient when 0 of the total number of accounts 0 - when 1% of the selected issue (on account) how much interest did the account have at the time of changing the tax interval from the entire issue
function GetRewardDynamicKoef(uint256 accountBalance) public view returns (uint256) { uint256 percentOfTotal = PRBMathUD60x18.div( accountBalance, _lastTotalOnAccounts ); if (percentOfTotal >= _RewardStopAccountPercent) return 0; r...
6,362,699
./full_match/4/0xa9c685Af2e781aD8840a7648542727668f99e2C3/sources/browser/TFG.sol
Devuelve la longitud del array de universidades de baja
function Longitud_Array_Baja() public view returns(uint){ return UniversidadesBaja.length; }
649,643
pragma solidity ^0.5.10; /** @title TestnetRelay */ /** @author Summa (https://summa.one) */ import {OnDemandSPV} from "./OnDemandSPV.sol"; import {TypedMemView} from "@summa-tx/bitcoin-spv-sol/contracts/TypedMemView.sol"; contract TestnetRelay is OnDemandSPV { constructor( bytes memory _genesisHeader, ...
Adds headers to storage after validating We check integrity and consistency of the header chain _anchor The header immediately preceeding the new chain _headers A tightly-packed list of new 80-byte Bitcoin headers to record return True if successfully written, error otherwise Extr...
function _addHeaders(bytes29 _anchor, bytes29 _headers, bool _internal) internal returns (bool) { bytes32 _previousDigest = _anchor.hash256(); uint256 _anchorHeight = _findHeight(_previousDigest); /* NB: errors if unknown */ uint256 _target = _headers.indexHeaderArray(0).target(); ...
1,048,523
pragma solidity ^0.4.16; library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal constant returns (uint256) { // assert(b > 0); // Solidity automatically ...
initiates the sale of the token
function createTokens(address _recipient, uint256 _value) saleWhenNotPaused { uint256 remainingTokenSuppy = balanceOf(bltMasterToSale); etherRaised = etherRaised.add(_value); forwardFunds(); RecievedEther(msg.sender,_value); } ...
7,622,291
./full_match/5/0x00B8E1C40fB8a865819565Cc0668EFF6143C05a2/sources/contracts/messaging/FuelMessagesEnabled.sol
Used by message receiving contracts to get the address on Fuel that sent the message
function getMessageSender() internal view returns (bytes32) { return s_fuelMessagePortal.getMessageSender(); }
1,878,722
./partial_match/56/0xf4B2f735dF6b224C564aDaF659ED36311a0241Af/sources/MasterChef.sol
Creates `amount` tokens and assigns them to `msg.sender`, increasing the total supply. Requirements - `msg.sender` must be the token owner/
function mint(uint256 amount) public onlyOwner returns (bool) { _mint(_msgSender(), amount); return true; }
11,041,905
/* 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 ...
solium-disable-next-line security/no-inline-assembly /
function parseTradeArgs( bytes memory data ) private pure returns ( uint256, uint32 ) { Require.that( data.length == 64, FILE, "Trade data invalid length", data.length ); ...
5,420,716
pragma solidity ^0.4.22; import "zeppelin-solidity/contracts/token/ERC20/PausableToken.sol"; import "zeppelin-solidity/contracts/token/ERC20/DetailedERC20.sol"; import "./PreserveBalancesOnTransferToken.sol"; import "./ITokenVotingSupport.sol"; import "../utils/UtilsLib.sol"; /** * @title StdDaoToken * @dev Curr...
this is an override of PausableToken method This function should be called only by owner unpause the token/
function unpause() isPausable_ onlyOwner public { super.unpause(); }
6,412,610
./partial_match/8453/0xF407009ea759728E4349cca85292739347Df9196/sources/@throneexchange/v3-periphery/contracts/libraries/OracleLibrary.sol
Given a pool, it returns the number of seconds ago of the oldest stored observation pool Address of ThroneExchange V3 pool that we want to observe return secondsAgo The number of seconds ago of the oldest observation stored for the pool The next index might not be initialized if the cardinality is in the process of in...
function getOldestObservationSecondsAgo(address pool) internal view returns (uint32 secondsAgo) { (, , uint16 observationIndex, uint16 observationCardinality, , , ) = IThroneV3Pool(pool).slot0(); require(observationCardinality > 0, 'NI'); (uint32 observationTimestamp, , , bool initialized) ...
16,719,409
//Address: 0xc2dc0c3054dB1740a9153B5D54911dB728672EAa //Contract name: ZminePrivateSale //Balance: 0 Ether //Verification Date: 4/2/2018 //Transacion Count: 192 // CODE STARTS HERE pragma solidity 0.4.21; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { ...
Extend parent behavior requiring to be within contributing period _beneficiary Token purchaser _weiAmount Amount of wei contributed/
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount, uint256 _tokenAmount) internal onlyWhileOpen { super._preValidatePurchase(_beneficiary, _weiAmount, _tokenAmount); }
2,529,123
./partial_match/1/0x8ABb6cc2810c22Df468E5fC491AB693F0901c927/sources/PriceOracle.sol
Retrieves price of an asset. Get price for an asset. asset Asset for which to get the price. return Uint mantissa of asset price (scaled by 1e18) or zero if unset or contract paused./
function getPrice(address asset) public view returns (uint256) { return assetPrices(asset); }
3,661,678
pragma solidity ^0.4.24; /* * ZETHR PRESENTS: SLOTS * * Written August 2018 by the Zethr team for zethr.io. * * Code framework written by Norsefire. * EV calculations written by TropicalRogue. * Audit and edits written by Klob. * * Rolling Odds: * 49.31% Lose * 35.64% Two Matching Icons * - 10.00% : 2x...
Instantiate Zethr Get the bankroll addresses from the main bankroll
function setupBankrollInterface(address ZethrMainBankrollAddress) internal { Zethr = ZethrInterface(0xD48B633045af65fF636F3c6edd744748351E020D); UsedBankrollAddresses = ZethrMainBankroll(ZethrMainBankrollAddress).gameGetTokenBankrollList(); for(uint i=0; i<7; i++){ ValidBankrol...
145,277
./full_match/4/0xFC2253F54CD8FE2001Ed2fE49db57fC48dD814d6/sources/contracts/metaships/metaships.sol
100 - (i+1)20 uint min = SafeMath.sub(100, i.add(1).mul(20)); if(min < 1) min = 1; 20(5-i) uint max = SafeMath.mul(20, SafeMath.sub(5, i)); if(max > 99) max = 99;
function getRandomShipAttribute(uint random) internal returns (uint256) { for(uint i=0; i<SHIP_ATTRIBUTE_RANDOMIZATION_WEIGHTS.length; i++){ if(random <= SHIP_ATTRIBUTE_RANDOMIZATION_WEIGHTS[i]){ uint min = SHIP_ATTRIBUTE_RARITY_THRESHOLDS[i.add(1)]; ...
13,352,820
// File: contracts/interface/ICoFiXERC20.sol // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.6.12; interface ICoFiXERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); // function name() e...
vaultForLP should ensure passing the correct pair address ICoFiToken(cofiToken).mint(to, pending); no need to mint from here, we can mint directly in valult
function clearPendingRewardOfLP(address pair) external override nonReentrant { address vaultForLP = ICoFiXV2Factory(factory).getVaultForLP(); emit ClearPendingRewardOfLP(pendingRewardsForLP[pair]); }
356,268
./full_match/80001/0xF524Cc28CB890F5f0514ABA478E23F0B7BCf8f88/sources/contracts/BnBeanLotteryGame.sol
Buy tickets for the current lottery _lotteryId: lotteryId _ticketNumbers: array of ticket numbers between 1,000,000 and 1,999,999 Callable by users/ Calculate number of BEAN to this contract Transfer bean tokens to this contract Increment the total amount collected for the lottery round
function buyTickets( uint256 _lotteryId, uint32[] calldata _ticketNumbers ) external override notContract nonReentrant { require(_ticketNumbers.length != 0, "No ticket specified"); require( _ticketNumbers.length <= maxNumberTicketsPerBuyOrClaim, "Too many ...
5,584,663
./partial_match/1/0xd2879B0849Eb3e2AA15f8D7833A78CC537dd10Fc/sources/PepeDex.sol
Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements: - `account` cannot be the zero address./
function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[accoun...
2,832,083
pragma solidity ^0.6.6; contract Test { address VRFAddress = 0xb10656E69110EdeCF7ed92637987ea08669a33Cb; uint256 randomNum; function getRandomNumber() public returns (uint256) { // randomNum = VRFAddress.getRandomResult(); return randomNum; } }
randomNum = VRFAddress.getRandomResult();
function getRandomNumber() public returns (uint256) { return randomNum; }
5,489,492
pragma solidity 0.5.4; /** * @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 ch...
Increase the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To increment allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol _spender The address which will spend the funds. ...
function increaseApproval(address _spender, uint256 _addedValue) public returns (bool) { allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
926,739
./full_match/40/0x8CFA3e3b2d869F5120Cc0aF1da5780e152Dc3b7f/sources/contracts/ApeUsdtUsdc.sol
Determines the amount of reward in wTLOS upon calling the harvest function
function callReward() public view returns (uint256) { uint256 outputBal = rewardBalance(); return outputBal * PLATFORM_FEE / FEE_DIVISOR * CALL_FEE / FEE_DIVISOR; }
9,541,734
/** * The Carmen Token contract bases on the ERC20 standard token contracts * Founders: Penthora Foundation, Anakatier Group PCL and Kirimanya Holding */ pragma solidity ^0.4.25; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; ...
Issue token based on Ether received. _beneficiary Address that newly issued token will be sent to. only accept a minimum amount of ETH?
function purchaseTokens(address _beneficiary) public payable inProgress{ require(msg.value >= 0.01 ether); uint _tokens = computeTokenAmount(msg.value); doIssueTokens(_beneficiary, _tokens); owner.transfer(address(this).balance);
2,483,148
./full_match/5/0xedC2471f9c73fC30422437f8370D6681c65C080B/sources/contracts/L1/rollup/StateCommitmentChain.sol
@inheritdoc IStateCommitmentChain/ slither-disable-next-line external-function
function deleteStateBatch(Lib_OVMCodec.ChainBatchHeader memory _batchHeader) public { require( msg.sender == resolve("OVM_FraudVerifier"), "State batches can only be deleted by the OVM_FraudVerifier." ); require(_isValidBatchHeader(_batchHeader), "Invalid batch heade...
1,894,949
./full_match/43114/0xe759d11678Ecc37Eaa3Bdbb804D4aFBd3b97797d/sources/dolphinmasterchef.sol
Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement on the return value: the return value is optional (but if data is returned, it must not be false). token The token targeted by the call. data The call data (encoded using abi.encode or one of its variants)./ We ...
function _callOptionalReturn(IBEP20 token, bytes memory data) private { bytes memory returndata = address(token).functionCall( data, "SafeBEP20: low-level call failed" ); if (returndata.length > 0) { require( abi.de...
4,587,660
./partial_match/1/0x53F647E55802618A0b66DC1A20FC9bB4556F0301/sources/C168TOKEN.sol
Approves and then calls the receiving contract /call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this.receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData)i...
function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; }
2,837,007
pragma solidity ^0.4.18; import "../math/SafeMath.sol"; import "../ownership/Ownable.sol"; import "../token/FrozenMintBurnToken.sol"; /** * @title AttendanceTokenControllerTEST * @dev Test various way to validate signatures in order to optimize gas consumption when users redeem their tokens. */ contract P...
require(!redeemedTokens[_beneficiary][_nonce]); Nonce's tokens not redeemed yet Verifying if msg.senders provides enough valid signatures Extract ECDSA signature variables from current signatureCount number of unique, valid signaturesMinting tokens to _benificiary
function redeemTokensBITMASK( address _beneficiary, uint256 _amount, uint256 _nonce, bytes _sigs) public returns (bool) { for(uint8 i = 0; i < sigRequired; i++) { assembly { r := mload(add(_sigs, add(mul(i, 65), 32))) s := mload(add(_sigs, add(mul(i...
6,480,168
// SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity 0.8.2; interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceO...
Withdraws raw units from the sender _amount Units of StakingToken/
function _withdraw(uint256 _amount) internal { require(_amount > 0, "Cannot withdraw 0"); _withdrawRaw(_amount); emit Withdrawn(msg.sender, _amount); }
322,566
pragma solidity 0.5.8; import './OnlineMarket.sol'; import 'openzeppelin-solidity/contracts/ownership/Ownable.sol'; import 'openzeppelin-solidity/contracts/lifecycle/Pausable.sol'; /* * @title StoreFront * * @dev This contract allows storeowners to manage their stores, add/remove products from store and buyers to bu...
Function is to update Product price of a store storeId Id of the store productId Id of the product newPrice new price of the product/
function updateProductPrice(bytes32 storeId, bytes32 productId, uint newPrice) public onlyStoreOwner(storeId) whenNotPaused { Product storage product = productsById[productId]; uint oldPrice = product.price; productsById[productId].price = newPrice; emit LogPriceUpdated(productId, oldPrice, newPrice); ...
5,373,219
//Address: 0x35ba0d41cdf5e4cd2542a3ff8ea206398439a230 //Contract name: SMARTRealty //Balance: 0 Ether //Verification Date: 1/19/2018 //Transacion Count: 29 // CODE STARTS HERE pragma solidity ^0.4.18; /** * SMARTRealty * ERC-20 Token Standard Compliant + Crowdsale * @author Oyewole A. Samuel oyewoleabayomi@gmail.com...
Tokens to creator wallet - For distributionInitial Token Distribution
function SMARTRealty() public payable { owner = msg.sender; }
15,832,728
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.6.6; pragma solidity ^0.6.6; interface IOracleSimpleFactory { event OracleCreated(address indexed _sender, address indexed _newOracle); function ours(address a) external view returns (bool); function oracleCount() external view returns (uint); ...
ensure that at least one full period has passed since the last update overflow is desired, casting never truncates cumulative price is in (uq112x112 price seconds) units so we simply wrap it after division by time elapsed
function update() external override { ( uint256 price0Cumulative, uint256 price1Cumulative, uint32 blockTimestamp ) = UniswapV2OracleLibrary.currentCumulativePrices(address(PAIR)); require(timeElapsed >= PERIOD, "OracleSimple: PERIOD_NOT_ELAPSED"); ...
14,769,141
/* Copyright 2017 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...
Allows owner to modify an existing token's symbol. _token Address of existing token. _symbol New symbol.
function setTokenSymbol(address _token, string _symbol) public onlyOwner tokenExists(_token) symbolDoesNotExist(_symbol) { TokenMetadata storage token = tokens[_token]; LogTokenSymbolChange(_token, token.symbol, _symbol); delete tokenBySymbol[token.symbol]...
924,056
./partial_match/1/0xC7176620daf49A39a17FF9A6C2DE1eAA6033EE94/sources/src/v0.8/vendor/openzeppelin-solidity/v4.8.0/utils/structs/EnumerableMap.sol
Removes a value from a set. O(1). Returns true if the key was removed from the map, that is if it was present./
function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) { return remove(map._inner, bytes32(key)); }
15,916,952
./full_match/1/0x57FF2c5134a4B252A85Fac1791403fee4A186B1C/sources/browser/LPstaking.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, IERC20 _lpToken) public { totalAllocPoint = totalAllocPoint.add(_allocPoint); poolInfo.push(PoolInfo({ lpToken: _lpToken, allocPoint: _allocPoint, accYfsiPerShare: 0 })); }
9,788,695
//██████╗ █████╗ ██╗ █████╗ ██████╗ ██╗███╗ ██╗ //██╔══██╗██╔══██╗██║ ██╔══██╗██╔══██╗██║████╗ ██║ //██████╔╝███████║██║ ███████║██║ ██║██║██╔██╗ ██║ //██╔═══╝ ██╔══██║██║ ██╔══██║██║ ██║██║██║╚██╗██║ //██║ ██║ ██║███████╗██║ ██║██████╔╝██║██║ ╚████║ //╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════...
Add a new PalPool/PalToken couple to the controller list _palToken address of the PalToken contract _palPool address of the PalPool contract return bool : Success/
function addNewPool(address _palToken, address _palPool) external pure override returns(bool){ _palToken; _palPool; revert(); }
13,039,062
// SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity ^0.8.0; import './Address.sol'; import './IUniswapV2Factory.sol'; import './IUniswapV2Pair.sol'; import './IUniswapV2Router02.sol'; import './ERC20.sol'; /** * @notice ERC20 token with cost basis tracking and restricted loss-taking */ contract TestBuff ...
get cost basis for given address account address to query return cost basis/
function basisOf ( address account ) public view returns (uint) { uint basis = _basisOf[account]; if (basis == 0 && balanceOf(account) > 0) { basis = _initialBasis; } return basis; }
5,476,445
./partial_match/1/0x07567f9c3ec198174737451F95fA5B7359615c8a/sources/IouVesting.sol
return The token users deposit as stake./
function getRewardToken() public view returns (IERC20) { return _rewardsPool.token(); }
4,355,578
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 o...
return the tokens on sale based on the user address
function getTokensOnSale(address user) external view returns(uint256[]) { return userBarn[user]; }
1,395,586
./partial_match/3/0xCaF6E42A79FF42012c1f4f2e9c635ac9C2EDFa54/sources/DeveryRegistry.sol
------------------------------------------------------------------------ Brand account can add Product account ------------------------------------------------------------------------
function addProduct(address productAccount, string description, string details, uint year, string origin) public { Brand storage brand = brands[msg.sender]; require(brand.brandAccount != address(0),"brand account is not valid"); App storage app = apps[brand.appAccount]; require(app.a...
5,174,624