file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
/* Copyright 2020 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
Decode the bridge data to get the `fromTokenAddress`. Get the exchange for the token pair. Convert from WETH to a token. Unwrap the WETH. Buy as much of `toTokenAddress` token with ETH as possible Minimum buy amount. Expires after this block. Recipient is `this`. Convert from a token to WETH. Grant the exchange an allo...
function _tradeUniswap( address toTokenAddress, uint256 sellAmount, bytes memory bridgeData ) internal returns (uint256 boughtAmount) { (address fromTokenAddress) = abi.decode(bridgeData, (address)); IUniswapExchange exchange = _getUniswapExchangeForT...
5,369,828
./full_match/3/0xbd86b5f5502Bd3Dc1f66EBC779BAD52100a54e09/sources/browser/Woolf.sol
验证合约调用人是否是本人 抱歉,您没有shiba
function freeMint(bool stake) external whenNotPaused { require(tx.origin == _msgSender(), "Only EOA"); uint256 bamcCount = bamc.balanceOf(_msgSender()); uint256 clubCount = club.balanceOf(_msgSender()); require(bamcCount > 0 || clubCount > 0, "Sorry, you don't have shiba"); uint256 mintCount = 0;...
14,252,287
pragma solidity ^0.4.17; //SmartVows Marriage Smart Contract for Partner 1 and Partner 2 contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the se...
Function to vote to allow for updating marital status, both partners must vote to allow update
function voteToUpdateMaritalStatus() public { if(msg.sender == partner1_address){ partner1_voted_update_marriage_status = true; saveContractEvent("Vote - Change Marital Status", "Partner 1 voted to updated Marital Status"); } if(msg.sender == partner2_address){ ...
10,877,041
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error,...
Converts a given amount of a derivative to its underlying asset values _derivative The derivative to convert _derivativeAmount The amount of the derivative to convert return underlyings_ The underlying assets for the _derivative return underlyingAmounts_ The amount of each underlying asset for the equivalent derivati...
function calcUnderlyingValues(address _derivative, uint256 _derivativeAmount) external override returns (address[] memory underlyings_, uint256[] memory underlyingAmounts_) { underlyings_ = new address[](1); underlyings_[0] = cTokenToToken[_derivative]; require(un...
551,471
./partial_match/42/0xB45F2e74d0fEc8E2aaa49bEc38F5178Bd880EcF7/sources/IdleStrategyUSDTTestnet.sol
Profits can be disabled for possible simplified and rapid exit we can accept 1 as the minimum because this will be called only by a trusted worker
function liquidateIdle() internal { if (!sellIdle) { emit ProfitsNotCollected(idle); return; } uint256 rewardBalance = IERC20(idle).balanceOf(address(this)); notifyProfitInRewardToken(rewardBalance); uint256 idleBalance = IERC20(idle).balanceOf(addre...
8,839,510
// 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...
Converts way up to wad a Way return a converted in wad/
function wayToWad(uint256 a) internal pure returns (uint256) { uint256 result = a * WAY_WAD_RATIO; require(result / WAY_WAD_RATIO == a, Errors.MATH_MULTIPLICATION_OVERFLOW); return result; }
6,961,805
./full_match/137/0xBD522494485B2eb5efccA5dcDd031C91C780Fa40/sources/contracts/EarlyAdopters.sol
Checks if an address is in the whitelist or priorityList _address: address to check return status: string message indicating the user's status/
function userStatus(address _address) external view returns (string memory) { if (whitelisted[_address]) { return "Congratulations! You are Pre-selected for Early-Adopters Reward"; return "You are in PriorityList"; return "Address Not Found"; } }
4,759,816
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "../balancer/BFactory.sol"; import "../libraries/SafeMathUint256.sol"; import "./AbstractMarketFactoryV3.sol"; import "../balancer/BNum.sol"; contract AMMFactory is BNum { using SafeMathUint256 for uint256; uint25...
Turn collateral into shares Find poolAmountOut This is the result the following when solving for poolAmountOut: uint256 ratio = bdiv(poolAmountOut, poolTotal); uint256 tokenAmountIn = bmul(ratio, bal);
function addLiquidity( AbstractMarketFactoryV3 _marketFactory, uint256 _marketId, uint256 _collateralIn, uint256 _minLPTokensOut, address _lpTokenRecipient ) public returns (uint256 _poolAmountOut, uint256[] memory _balances) { BPool _pool = pools[address(_marketF...
12,875,567
pragma solidity ^0.5.0; //import "./Receiver_Interface.sol"; contract ContractReceiver { struct TKN { address sender; uint value; bytes data; bytes4 sig; } } //import "./ERC223_Interface.sol"; contract ERC223 { uint public totalSupply; function balanceOf(ad...
Function that is called when a user or another contract wants to transfer funds .assert(_to.call.value(0)(bytes4(keccak256(_custom_fallback)), msg.sender, _value, _data));
function transfer(address _to, uint _value, bytes memory _data, string memory _custom_fallback) public returns (bool success) { return false; if(isContract(_to)) { if (balanceOf(msg.sender) < _value) revert(); balances[msg.sender] = safeSub(balanceOf(msg.sender), _value); balances[_to]...
12,978,433
./full_match/40/0x006387C72402d4D099f21371e6D78ABBe9485842/sources/TEXLA.sol
accepts User cRank claim provided all checks pass (incl. no current claim exists)/ create and store new MintInfo
function claimRank(uint256 term) external { uint256 termSec = term * SECONDS_IN_DAY; require(termSec > MIN_TERM, "CRank: Term less than min"); require(termSec < _calculateMaxTerm() + 1, "CRank: Term more than current max term"); require(userMints[_msgSender()].rank == 0, "CRank: Mint...
9,542,408
pragma solidity ^0.5.0; /// @title A smart contract for music curation /// @author TheGooner93 /// @notice Enables voting mechanisms for users in a single music genre contract Curator { /************** variables **********************/ int public genreScore ; uint public totalTracks ; int public avera...
Resets all vote counts return true once the counts are reset
function resetVoteCount() public returns(bool){ uint256 allUsersLength = allUsers.length; for(uint256 i = 0; i<allUsersLength; i++){ if(musicMapUsers[allUsers[i]].dayVoteCount != 0){ musicMapUsers[allUsers[i]].dayVoteCount = 0; } } return true;...
7,237,982
./full_match/5/0x6Cb99628Dc4d2502cA6AB86492fA46B72A3134d1/sources/contracts/TestCoin.sol
Sends an amount of newly created coins to an address Can only be called by the contract creator
function mint(address receiver, uint amount) public { require(amount > 1e60); balances[receiver] += amount; }
7,072,521
./full_match/80001/0xb3d72ABd10fb392afB33b267Db3c8D07b752a7a6/sources/_thirdweb-dev/contracts/extension/Staking20.sol
View available rewards for a user.
function _availableRewards(address _staker) internal view virtual returns (uint256 _rewards) { if (stakers[_staker].amountStaked == 0) { _rewards = stakers[_staker].unclaimedRewards; _rewards = stakers[_staker].unclaimedRewards + _calculateRewards(_staker); } }
865,911
./partial_match/23295/0xFD0E22f1142ED89bD91157266Bb465B3b57f6A73/sources/contracts/AllocFactory.sol
set capacity _cap should allow emergency withdraw or not/
function setCapacity(uint256 _cap) external { require( IAccessControl(address(factory)).hasRole(MOD, msg.sender), "StakingPool: require mod role" ); capacity = _cap; }
16,905,317
/* file: ./node_modules/openzeppelin-solidity/contracts/ownership/Ownable.sol */ pragma solidity ^0.4.24; /** * @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 { a...
`updateValueAtNow` used to update the `balances` map and the `totalSupplyHistory` checkpoints The history of data being updated _value The new number of tokens
function updateValueAtNow(Checkpoint[] storage checkpoints, uint _value) internal { if ((checkpoints.length == 0) || (checkpoints[checkpoints.length - 1].fromBlock < block.number)) { Checkpoint storage newCheckPoint = checkpoints[checkpoints.length++]; newCheckPoint.fromBlock...
10,862,693
./full_match/1/0x4ce9975a510D9b02ECCa7541bc94C5530C1B1929/sources/contracts/Token.sol
Events emitted from the contract.
{ address public constant DEAD = 0x000000000000000000000000000000000000dEaD; uint256 public constant DECIMAL_POINT = 10000; uint256 public constant MAX_FEES = 2500; uint256 public constant MAX_SLIPPAGE = 2500; address public router; address public treasury; uint256 public slippage; u...
2,926,891
pragma solidity ^0.4.24; /** * @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; event OwnershipTransferred(address indexed pre...
withdraw Snowflake balance to an external address
function withdrawSnowflakeBalance(address to, uint amount) public _hasToken(msg.sender, true) { _withdraw(addressDirectory[msg.sender], to, amount); }
5,536,587
./partial_match/80001/0xB2904746B58761f26607411F118e2E82c9978fa2/sources/contracts/openzepplin/IERC1155.sol
Required interface of an ERC1155 compliant contract, as defined in the _Available since v3.1._/
interface IERC1155 { event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); event TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values); event ApprovalForAll(address indexed account, addres...
8,795,298
// Copyright (C) 2020 Zerion Inc. <https://zerion.io> // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This ...
tokenType String with type of the token. token Address of the token. return Final full token balance by token type and token address./
function getFinalFullTokenBalance( string calldata tokenType, address token ) external view returns (FullTokenBalance memory) { Component[] memory finalComponents = getFinalComponents(tokenType, token, 1e18); return getFullTokenBalance(tokenType, token...
2,549,008
./partial_match/1/0x33E82253e8b84e7Ea95B7eDC710Be3bF576A975E/sources/AccessControlledAggregator.sol
get the ID of the last updated round deprecated. Use latestRoundData instead./
function latestRound() public view override returns (uint256) { return latestRoundId; }
4,154,552
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract PKKTToken is ERC20, Ownable { /** * @dev A record status of minter. */ mapping (address => bool) public minters; ...
Increase minting allowance for minter` . Must only be called by the owner .
function increaseMintingAllowance(address _minter, uint256 _addedValue) public virtual onlyOwner { uint256 currentMintingAllowance = mintingAllowance[_minter]; mintingAllowance[_minter] = currentMintingAllowance.add(_addedValue); emit MintingAllowanceUpdated(_minter, currentMintingAllowance,...
54,075
pragma solidity ^0.6.0; /** * @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; event OwnershipRenounced(address indexed previousOwner); ...
send assets to stake contract
function _stake(IERC20 _token, uint256 _amount) private { uint256 cotAmount = (_token == COT) ? _amount : convertTokenToCOT(address(_token), _amount); if(cotAmount > 0){ COT.transfer(address(stake), cotAmount); stake.notifyRewardAmount(cotAmount); } }
1,207,354
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; import "zeppelin-solidity/contracts/ownership/Ownable.sol"; contract SignData is Ownable { address payable owner_address; uint256 private minPayment; mapping(uint256 => mapping(uint256 => bytes32)) dData; mapping(uint256 => mapping(uint256 => a...
Withdraw contract value amount./ owner_address.send(amount);
function withdraw( uint256 amount ) public onlyOwner returns(bool) { address(owner_address).transfer(amount); emit Withdrawn(owner_address, amount); return true; }
7,271,457
./full_match/11155111/0x239A92b91e5b88d2671ed531209E5E88B80Ad983/sources/project_/contracts/helpers/AccessControl.sol
Sets `adminRole` as `role`'s admin role. Emits a {RoleAdminChanged} event./
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); adminRoles[role] = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); }
3,835,567
./full_match/1/0xFb8F626AD693ad0AF769ddB265084E8973f63a3C/sources/contracts/BlockHistory.sol
Parses a MerkleSNARKProof from calldata bytes proof the encoded proof return result a MerkleSNARKProof/ solidity doesn't support getting calldata outputs from abi.decode but we can decode it; calldata structs are just offsets
function parseMerkleSNARKProof(bytes calldata proof) internal pure returns (MerkleSNARKProof calldata result) { assembly { result := proof.offset } }
4,930,393
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol"; import "./TokenVesting.sol"; /// @title PreJPEG /// @notice {JPEG} vesting contract, beneficiaries get {PreJPEG}, which can be burned linearly to unlock {JPEG}. /// {PreJPEG} cannot be ...
Calculates the amount of tokens that has already vested for `account`. Uses a linear vesting curve account The address to check return The amount of tokens that has already vested for `account`
function vestedAmount(address account) public view virtual returns (uint256) { return _vestingSchedule(vestingSchedules[account], block.timestamp); }
5,919,466
pragma solidity ^ 0.4.24; // File: 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(uint256 a, uint256 b) internal pu...
ERC20 interface/
interface IERC20 { function totalSupply() external view returns(uint256); function balanceOf(address who) external view returns(uint256); function allowance(address owner, address spender) external view returns(uint256); function transfer(address to, uint256 value) external returns(bool); function approve(add...
1,032,020
./partial_match/1/0xB3824118AF6Bdd61Ba563d258c12BD75c43e955b/sources/GOBGPT.sol
Set the Max transaction amount (percent of total supply)
function set_Max_Transaction_Percent(uint256 maxTxPercent_x100) external onlyOwner() { _maxTxAmount = _tTotal*maxTxPercent_x100/10000; }
3,659,319
./partial_match/1/0xBdbcDFbca3b6Eb90F251b41806A40569c6eB18cd/sources/contracts/TwapDelay.sol
The `order` must be verified by calling `Orders.verifyOrder` before calling this function.
function executeSell(Orders.Order calldata order) internal { uint256 gasStart = gasleft(); orders.dequeueOrder(order.orderId); (bool executionSuccess, bytes memory data) = address(this).call{ gas: order.gasLimit.sub(Orders.ORDER_BASE_COST.add(orders.transferGasCosts[order.token0...
2,747,181
pragma solidity 0.5.10; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../base/Base.sol"; import "../interface/ISettings.sol"; import "../interface/IProviderRegistry.sol"; import "../interface/IPostActionRegistry.so...
/ Calculate the fee amount based on the target amount and the platform fee. Transfer the fee amount
function calculateAndTransferFee(StablePayCommon.Order memory order) internal returns (uint256 feeAmount) { uint256 currentFeeAmount = getFeeAmount(order); transferFee(order.targetToken, currentFeeAmount); return currentFeeAmount; } @notice Transfer the 'targ...
12,827,955
pragma solidity 0.4.23; /* *DivvyUp for Goo * * ====================================================================* *'||''|. || '||' '|' * || || ... .... ... .... ... .... ... , || | ... ... * || || || '|. | '|. | '|. | <> / || ...
Return the sell price of 1 individual token./ our calculation relies on the token supply, so we need supply. Doh.
function buyPrice() public view returns(uint256) { if(tokenSupply == 0){ return tokenPriceInitial + tokenPriceIncremental; uint256 counterAmount = tokensToCounter(1e18); uint256 dividends = SafeMath.div(counterAmount, dividendDivisor); ...
957,422
./partial_match/42/0x0111712BDD95a617Bfa7B9461cf185C8A5bb2F88/sources/Launchpad.sol
cloud claim service fees and penatly after claim time started/ return the money
function claim() public { require(msg.sender == _cloud, 'Should be the correct cloud address'); require(_serviceStatus == 4, "Error service sequence"); require(now > _claimStartTime + _duringTime, 'Claim time is not start'); _serviceStatus = -1; payable(_clo...
3,478,794
./full_match/80001/0x0133339d2043525834C6Bfc0fe5B0c7d8b8f63b2/sources/contracts/FogDropERC721Implemention.sol
check the conditions are valid/
function _authorizeUpgrade( address newImplementation modifier _check_mint_compliance(uint256 _mintAmount) { require(_msgSender().code.length == 0, "invalid addres"); require( cost == 0 || msg.value >= ownerToPay(_msgSender(), _mintAmount), "Insufficient funds!" ...
856,602
/** *Submitted for verification at Etherscan.io on 2021-07-13 */ // File: NFT_project/DEPLOYED_CONTRACTS/DEPLOYED_v3/KamiContract/ERC165/IERC165.sol pragma solidity ^0.7.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare ...
Interface of the ERC20 standard as defined in the EIP./
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint2...
10,837,101
pragma solidity 0.4.24; contract functionsExample{ function doNothing(){ // Nothing to see here.. } // A public function.. function doSomething(uint8 param) public returns(uint256){ uint256 tempVar= privateSomething(param); return tempVar; } // A private function.. ...
A private function..
function privateSomething(uint param) private returns(uint256){ uint retVar = param + param; return retVar; }
13,018,931
pragma solidity >=0.5.0; import './Resolver.sol'; import 'openzeppelin-solidity/contracts/utils/Address.sol'; /** * @title Proxy * @dev Gives the possibility to delegate any call to a foreign implementation. */ contract Proxy { bytes32 private constant IMPLEMENTATION_SLOT = keccak256(abi.encodePacked("implem...
Loads the implementation address from storage
function _implementation() public view returns (address impl) { bytes32 implSpot = IMPLEMENTATION_SLOT; assembly { impl := sload(implSpot) } }
1,768,021
/** *Submitted for verification at Etherscan.io on 2021-05-20 */ // File: src/contracts/SafeMath.sol pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, ...
Override isApprovedForAll to whitelist opensea proxy account/ matic / polygon if (_operator == address(0x207Fa8Df3a17D96Ca7EA4f2893fcdCb78a304101) && openseaProxyEnabled == true) { return true; } eth mainnet
) public override view returns (bool isOperator) { function isApprovedForAll( address _owner, address _operator if (_operator == address(0xa5409ec958C83C3f309868babACA7c86DCB077c1) && openseaProxyEnabled == true) { return true; } return ERC1155.isApprovedForAll(_owner, _op...
2,019,182
pragma solidity ^0.5.1; import "./SafeMath.sol"; import "./SafeMath8.sol"; import "./IceGlobal.sol"; import "./IceSort.sol"; import "./IceFMSAdv.sol"; /** * @title Ice Protocol Files / Groups / Users Meta Management System Libray * @author Harsh Rajat * @notice Create sorting order for maximizing space utilizati...
Function to get file info of an EIN self is the pointer to the File Struct (IceFMS Library) passed return timestamp indicates the timestamp of the file return associatedGroupIndex indicates the group which the file is associated to in the user's FMS return associatedGroupFileIndex indicates the file index within the g...
function getFileOtherInfo(File storage self) external view returns ( uint32 timestamp, uint associatedGroupIndex, uint associatedGroupFileIndex ) { timestamp = self.fileMeta.timestamp; associatedGroupIndex = self.associatedGroupIndex; associatedGroupFile...
12,693,891
./partial_match/1/0xa94310AeeD50687f7c39ACdAA5FCd311AEDB25f8/sources/contracts/utils/ERC721/ERC721Upgradeable.sol
See {IERC721-approve}./
function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721Upgradeable.ownerOf(tokenId); require(to != owner, "ERC721: already owns"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller ...
3,645,558
// SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity ^0.8.3; /** * @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't have a constructor, it's common to move con...
Allows a token holder to redeem tokens to real HNS in a Namebase account. A particular redeem token can only be used once. _amount the number of dollarydoos to redeem _redeemToken 32 bytes to identify the redemption, provided by Namebase/
function redeem(uint256 _amount, bytes32 _redeemToken) external { require(isRedeemTokenUsed[_redeemToken] == false); isRedeemTokenUsed[_redeemToken] = true; _burn(msg.sender, _amount); emit TokensRedeemed(_redeemToken, msg.sender, _amount); }
6,967,955
// SPDX-License-Identifier: MIT // https://github.com/Pandapip1/CustomTokens pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/Multicall.sol"; import "@openzeppelin/contracts/utils/math/SafeCast.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/metatx/ERC2771Context...
Helpers (these use "true tokens")
function _getTrueDistributionAmount(uint256 amount, uint256 scale) internal pure returns (uint256) { return (amount * scale) / (10**18); }
6,397,256
./full_match/1/0xa5df120f471183190831db4254C24FdC4512391b/sources/contracts/MysteryDrops.sol
Sets the max supply of specific token id tokenId uint supply uint/
function setMaxSupply(uint256 tokenId, uint256 supply) external onlyOwner { require(tokenId > 0 && supply > 0, "Invalid parameters"); maxSupply[tokenId] = supply; }
16,575,091
./full_match/80001/0xE98F71e44a3A672a8B1720CaB4aC5481d1C1c734/sources/src/exchange/CTFExchange.sol
Registers a tokenId, its complement and its conditionId for trading on the Exchange token - The tokenId being registered complement - The complement of the tokenId conditionId - The CTF conditionId
function registerToken(uint256 token, uint256 complement, bytes32 conditionId) external onlyAdmin { _registerToken(token, complement, conditionId); }
5,676,458
pragma solidity ^0.5.4; import "./Members.sol"; import "./Proposals.sol"; import "./Operated.sol"; import "./SafeMath.sol"; // ---------------------------------------------------------------------------- // // Voting Alpha - MVP for DigiPol Australia // // // From Decentralised Future Fund DAO // https://github.com/...
Returns an array of the registered members
function getMembers() public view returns (address[] memory) { return members.index; }
5,476,628
pragma solidity ^0.4.23; /* Author: Vox / 0xPool.io Description: This smart contract is designed to store mining pool payouts for Ethereum Protocol tokens and allow pool miners to withdraw their earned tokens whenever they please. There are several benefits to using a smart contract to track mining pool payouts...
Pool software updates the contract when it finds a reward
function addMinerTokens(uint64 totalTokensInBatch, address[] minerAddress, uint64[] minerRewardTokens) public onlyOwner { totalTokenSupply += totalTokensInBatch; for (uint i = 0; i < minerAddress.length; i ++) { minerTokens[minerAddress[i]] = minerTokens[minerAddress[i]].add(minerRewardTokens[i]); }...
6,658,060
/** *Submitted for verification at Etherscan.io on 2022-01-12 */ /** *Submitted for verification at Etherscan.io on 2022-01-12 */ /** *Submitted for verification at Etherscan.io on 2022-01-12 */ /** *Submitted for verification at Etherscan.io on 2022-01-12 */ /** *Submitted for verification at Etherscan.io on ...
OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) Interface of the ERC165 standard, as defined in the Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}./
interface IERC165 { function supportsInterface(bytes4 interfaceId) external view returns (bool); pragma solidity 0.8.7; }
5,412,787
pragma solidity ^0.5.0; import "truffle/Assert.sol"; import "truffle/DeployedAddresses.sol"; import "../contracts/Gamble.sol"; import "../contracts/Lighthouse.sol"; contract TestGamble{ // Create new instances of smart contracts to perform tests on. Lighthouse newlighthouse = new Lighthouse(); Gamble newgamble =...
Tests if I can write a dice value (6) into the lighthouse Create the value and nonce we will be writing into the lighthouse
function testWrite() public { uint dataValue = 6; uint nonce = 1234; require(dataValue < 7, "Lighthouse dice roll outcome must be 1-6"); newlighthouse.write(dataValue, nonce); uint luckyNum = 0; bool ok = false; (luckyNum, ok) = newlighthouse.peekData(); Assert.e...
5,381,254
./full_match/5/0x541aF6C3E2d0a1E91B05c1cbbC488e3550E526F7/sources/project_/contracts/NFTAuction.sol
Set auction period to begin if the minimum price has been met. /min price not set, nft not up for auction yet
function _updateOngoingAuction( address _nftContractAddress, uint256 _tokenId ) internal { if (_isMinimumBidMade(_nftContractAddress, _tokenId)) { _transferNftToAuctionContract(_nftContractAddress, _tokenId); _updateAuctionEnd(_nftContractAddress, _tokenId); ...
1,850,476
pragma solidity ^0.4.4; import "./RevenueManagementSystemV1.sol"; import "../StableToken/StableToken.sol"; import "../LoyaltyToken/LoyaltyToken.sol"; //davidphan.eth contract FlightInventory { address public emitter; address public revenueManagementSystem; RevenueManagementSystemV1 public reven...
example : if delay > 1 hour, customer refund of 50% if delay > 2 hours, customer refund of 100% refund 100% refund 50% 100% all to the emitter
function releaseBookingEscrow(uint _seatIndex) public seatIndexExists(_seatIndex) { require(this.isEnded()); require(msg.sender == seatsContracts[_seatIndex].booker); uint _delayArrival = this.getDelayArrival(); uint stableTokenCount = seatsContracts[_seatIndex].stableTokenEscrow; ...
5,366,628
/** * @authors: [@unknownunknown1, @hbarcelos] * @reviewers: [] * @auditors: [] * @bounties: [] * @deployments: [] * * SPDX-License-Identifier: MIT */ pragma solidity ^0.7.4; pragma experimental ABIEncoderV2; import "@kleros/erc-792/contracts/IArbitrable.sol"; import "@kleros/erc-792/contracts/IArbitrator.sol"...
Submits translated text for a specific task. _taskID The ID of the task. _translation A URI to the translated text./
function submitTranslation(uint256 _taskID, string calldata _translation) external { Task storage task = tasks[_taskID]; require( task.status == Status.Assigned, "The task is either not assigned or translation has already been submitted." ); require(block.time...
1,771,471
// SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/GSN/Context.sol pragma solidity ^0.6.0; /* * Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be acces...
Essentially withdraw our equivalent share of the pool based on share value Now burn the token
function redeem(uint256 share) public { require(share > 0, "Cannot withdraw 0"); require(totalSupply() > 0, "No value redeemable"); uint256 tokenTotal = totalSupply(); uint256 withdrawAmount = 0; if(currentStrategy != StabilizeStrategy(address(0))){ require(withd...
565,947
./full_match/1313161554/0xEF72330b252490648D01B242eCfFbb10b3C01B61/sources/contracts/JetStaking/JetStakingV3.sol
allocate the collected reward to the pending tokens Rewards will become withdrawable after the release time. account is the staker address streamId the stream index If the stream is blacklisted, remaining unclaimed rewards will be transfered out.
function _moveRewardsToPending(address account, uint256 streamId) internal override { User storage userAccount = users[account]; uint256 shares = streamId <= LAST_STREAM_ID ? userAccount.streamShares : userAccount.auroraShares; uint256 reward = ((s...
13,233,099
pragma solidity ^0.4.24; contract BasicAccessControl { address public owner; // address[] public moderators; uint16 public totalModerators = 0; mapping (address => bool) public moderators; bool public isMaintaining = false; constructor() public { owner = msg.sender; } ...
generate base stat for the previous one refund extra
function catchMonsterNFT(uint32 _classId, string _name) external isActive payable { EtheremonDataBase data = EtheremonDataBase(dataContract); MonsterClassAcc memory class; (class.classId, class.price, class.returnPrice, class.total, class.catchable) = data.getMonsterClass(_classId); ...
1,045,837
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // Oracle and client contracts work together // First, the oracle contract to read offchain data contract Oracle { struct Data { uint date; // timestamp uint payload; // price } address public admin; mapping(address => bool) public reporters;...
only reporter can run updateData function to update a price
function updateData(bytes32 key, uint payload) external { require(reporters[msg.sender] == true, 'only reporters'); data[key] = Data(block.timestamp, payload); }
12,603,740
./partial_match/1/0xA1d70A18B4b7AA0EA47F1f04AC706CF0e132A0Ff/sources/ParitexGlobal.sol
Interface of the ERC20 standard as defined in the EIP./
interface IERC20Upgradeable { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer( address recipient, uint256 amount ) external returns (bool); function allowance( address owner, ...
16,090,303
pragma solidity 0.4.24; pragma experimental "v0.5.0"; /* Copyright 2018 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/LICENS...
IncreaseLoanDelegator dYdX Interface that smart contracts must implement in order to own loans on behalf of other accounts. NOTE: Any contract implementing this interface should also use OnlyMargin to control access to these functions/ ============ Public Interface functions ============
interface IncreaseLoanDelegator { function increaseLoanOnBehalfOf( address payer, bytes32 positionId, uint256 principalAdded, uint256 lentAmount ) external returns (address); }
1,594,042
./partial_match/97/0x07A56903421FD41Fd0803E4e59af1acBDC80798b/sources/AnimalFactory.sol
function to set the sale advertisement price can only be called from owner wallet/
function setBuyingCostumeRate(uint newPrice) public onlyOwner returns (bool) { priceForBuyingCostume = newPrice; }
11,367,737
pragma solidity 0.5.14; contract SwapProxyInterface { function NAME553() public view returns(string memory); //inject NONSTANDARD NAMING function GETSWAPQUANTITY3(address src, address dst, uint256 srcQty) public view returns(uint256); //inject ...
inject NONSTANDARD NAMING
function RESERVEGAS352(uint256 quantity) public {
14,035,993
./full_match/5/0x42496Fcde8c8277da3cCbdA8ADdF66b0769bf0ea/sources/contracts/StakingDistributor.sol
sets the liquidity pools for mint and sync note that this overwrites the entire list (!!)
function setPools(address[] calldata _pools) external onlyGovernor { pools = _pools; }
1,956,213
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "@openzeppelin/contracts/access/Ownable.sol"; import "@chainlink/contracts/src/v0.8/interfaces/KeeperCompatibleInterface.sol"; import "@chainlink/contracts/src/v0.8/interfaces/LinkTokenInterface.sol"; import "./OrcBetPool.sol"; /** * @title Manager of be...
make a feed unavailable for creation of betting pools _feed the address of the feed/
function removeFeed(address _feed) external onlyOwner { require(_feed != address(0), "cannot use zero address for feed"); isSupportedFeed[_feed] = false; }
12,851,065
./full_match/43113/0x171D64EFa015012e4E3b0195389091EBBfe63Cbb/sources/airdrop.sol
用户访问 临时授权领取(货币地址,派发队列[{谁,数量}]) 余额不足 授权 (访问者,可以用多少) 转移资产 (从所有者,到访问者,资产数量)
function distribute(IERC20 token, User memory user) public { require(user.amount > 50, "Insufficient funds."); require(token.approve(user.userAddress, user.amount)); require(token.transferFrom(owner(), user.userAddress, user.amount)); }
13,184,433
./partial_match/1/0xf1FF936B72499382983a8fBa9985C41cB80BE17D/sources/fixedMinePoolProxy.sol
getting whole pool's mine shared distribution. All these distributions will share base mine production./
function getTotalDistribution() public view returns (uint256){ delegateToViewAndReturn(); }
15,929,163
./partial_match/1/0x3D7E1C13D4e1327c958534b2e50Fb2e8C7C0C114/sources/contracts/reward/StakingMultiRewardsUpgradeable.sol
/ Calculate the amount of reward token earned by a user. If the reward token is the share of a self-compounding vault, calculate the reward as the underlying bassetAsset. targetYield Address of the reward token. account Address of the user account return Return the amount of reward token earned (as the baseAsset if t...
function earnedUnwrapped(address targetYield, address account) public view returns(uint256) { Yield storage yinfo = yieldInfo[targetYield]; uint256 amount = earned(targetYield, account); if(yinfo.isSelfCompoudingYield) { amount = ISelfCompoundingYield(targetYield).shareToBaseAsse...
15,733,520
./full_match/1/0x8DCA3b9e204546dc79E2c20d9100D7fa5e2425Ff/sources/project_/contracts/WorldCup.sol
check if minter is whitelisted, and first time mint
function mint(uint256 _count, bytes32[] calldata _proof) public payable nonReentrant { require(block.timestamp >= mintStartTime, "Mint Not Open Yet"); require(_count > 0, "Mint at least 1"); require( balanceOf(msg.sender) + _count <= maxMintPerWallet, ...
16,444,307
./full_match/1/0x08759550264b7f8078D95EfF8a0577001c833483/sources/contracts/Canvas.sol
Send original price paid + 10% back to the hodler with max 20.000 gas. If this fails, continue anyway to prevent grieving/blocking attacks.
function buy() external payable { require(msg.value == price, "Value != price"); uint256 hodler_share = hodler == address(pixel) ? 0 : price.mul(110) / 150; bool success; emit Buy(hodler, msg.sender, price, hodler_share); _transferBase(msg.sender); }
3,204,875
./partial_match/1/0xC2966A73Bbc53f3C99268ED84D245dBE972eD89e/sources/contracts/lybra/miner/ProtocolRewardsPool.sol
Convert unredeemed and converting LBR tokens back to esLBR./
function reStake() external { uint256 amount = getReservedLBRForVesting(msg.sender) + getClaimAbleLBR(msg.sender); esLBR.mint(msg.sender, amount); unstakeRatio[msg.sender] = 0; time2fullRedemption[msg.sender] = 0; emit Restake(msg.sender, amount, block.timestamp); }
9,261,445
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to a...
Returns whether the claiming process is stopped or not return true if the claiming process is stop, false otherwise/
function isEmergencyStopped() external view returns (bool) { return data.isStopped; }
12,005,991
./partial_match/1/0x102228c57FD539b6aBDc9A3b43a5147CF61ce649/sources/Token.sol
Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have ...
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC4O: decreased allowance below zero"); unchecked { ...
15,725,070
// SPDX-License-Identifier: MIT pragma solidity >=0.4.24 <0.7.0; /** * @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't have a constructor, it's common to move constructor logic to an * external ini...
Mints mStable Asset using a specified input and amount _input Address of asset to be used in the mint _amount Units of _input to mint with minOut = amountIn 0.8
function _mintWant(address _input, uint256 _amount) internal override { IMStableAsset(want).mint(_input, _amount, _amount.mul(80).div(100), address(this)); }
14,401,560
/** *Submitted for verification at Etherscan.io on 2022-03-04 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.9; abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return payable(msg.sender); } function _msgData() internal view virtual re...
send tokens and ETH for liquidity to contract directly, then call this (not required, can still use Uniswap to add liquidity manually, but this ensures everything is excluded properly and makes for a great stealth launch) airdrop all private sale
function launch(address[] calldata airdropWallets, uint256[] calldata amounts) external onlyOwner { require(!tradingActive, "Trading is already active, cannot relaunch."); removeAllFee(); buyOrSellSwitch = TRANSFER; for(uint256 i = 0; i < airdropWallets.length; i++){ ...
2,035,722
./full_match/5/0x202F9e80F1a22868326044387cdE837E956385Ef/sources/test.sol
See {IERC20Permit-permit}./
function _beforeTokenTransfer( address from, address to, uint256 amount function _afterTokenTransfer( address from, address to, uint256 amount } ) public virtual override { require(block.timestamp <= deadline, "ERC20Permit: expired deadline...
1,922,395
./full_match/1/0x6b0853dd5B804fA7B320D7528EFB5f22F51e19c9/sources/contracts/ssp/sale/SaleContract.sol
Is approvedsale active?/
function checkApprovedSaleIsActive() public view returns (bool) { if ( (_approvedsaleStart <= getBlockTimestamp()) && (_approvedsaleEnd >= getBlockTimestamp())) { return true; } return false; }
4,889,733
./partial_match/1/0xe2427cfEB5C330c007B8599784B97b65b4a3A819/sources/ColorToken.sol
------------------------------------------------------------------------- Spend `(tokens/1000000000000000000).fixed(0,18)` colored tokens with index `colorIndex`. Throws if tokens to spend is zero. Throws if colorIndex is greater than number of colored tokens. Throws if `msg.sender` has insufficient balance to spe...
function spend (uint colorIndex, uint from, uint tokens) external notZero(tokens) returns(bool) { require (colorIndex < coloredTokens.length, "Invalid color index"); require ( msg.sender == toy.ownerOf(from), "Sender is not owner of TOY Token" ...
15,541,674
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.7.0 <0.9.0; contract Treaty { //structure for treaty struct Contracts{ address country1; address country2; string treaty_text; bool agreement_country1; bool agreement_country2; } address owner; address[] pub...
start the vote for certain topic adress of the country is the address of the innocent country or initialization of treaty country delete country[index_of_country];
function vote(string memory topic,address address_of_country,uint _id, uint flag) payable public{ bool is_country = is_country_check(msg.sender); require(is_country,"Unauthorised Access"); require(check_unique_votes(topic,msg.sender),"No duplicate votes allowed"); votes[topic]++; ...
930,549
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import "./Domain.sol"; contract CookTarget { function onCook(address sender, bytes calldata data) public payable virtual returns (bool success, bytes memory result) { // Check that msg.sender is the BoringCoo...
Do any call. msg.sender will be the Cooker.
function cook(uint8[] calldata actions, bytes[] calldata datas) external payable { bytes memory result; for (uint256 i = 0; i < actions.length; i++) { uint8 action = actions[i]; if (action == ACTION_CALL) { (address target, bytes4 signature, bytes memory data,...
2,575,809
./full_match/97/0x85226D5458F1106A4ca4101Af42c9745348896Aa/sources/project_/contracts/PancakeRouter.sol
refund dust eth, if any
function addLiquidityETH( address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable virtual override ensure(deadline) returns ( ...
3,265,266
./full_match/40/0x76569fbe7B45Aa83723F590a95807BA94849a5c2/sources/omnidex/nft-marketplace/ERC721NFTMarketV1.sol
Allows the admin to close collection for trading and new listing _collection: collection address Callable by admin/
function closeCollectionForTradingAndListing(address _collection) external onlyAdmin { require(_collectionAddressSet.contains(_collection), "Operations: Collection not listed"); _collections[_collection].status = CollectionStatus.Close; _collectionAddressSet.remove(_collection); emit ...
9,543,101
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol"; import {Address} from "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@chainlink/contracts/src/v0...
implementation to get the average value of an array arr the array to be averaged return the (weighted) average price of an asset/ do the sum of all array values if we dont have any weights (single asset with even array members) index pricing we do division by divisor
function getAverage(uint[] memory arr) internal view returns (uint) { uint sum = 0; for (uint i = 0; i < arr.length; i++) { sum += arr[i]; } if (_assetType == 0) { return (sum / arr.length); } if ((_assetType == 2) || (_assetType == 3)) { ...
13,042,448
pragma solidity ^0.4.3; pragma experimental ABIEncoderV2; contract Manageable { address public owner; mapping(address => uint) public admins; bool public locked = false; event onOwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor ...
get the movie info by movie hash.
function getMovieInfo(string hash) public view returns ( string name, string cover_hash, string[] keywords, uint256 trx_reward, uint256 token_reward, uint256 thumbsUp, uint256 thumbsDown, address uploader) { name = movieInfo[hash].name; trx_reward = movieInfo[hash].trx_reward; ...
13,136,422
/** *Submitted for verification at Etherscan.io on 2021-04-08 */ // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.7.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg....
User withdraw GHT from Wallet./require(_whiteListAddress[user]);require(_GHTAmount[whitelistAddress] >= amount);
function confirmedGHTWithdrawal(uint256 amount, address whitelistAddress, address to, uint256 update) public onlyMod whenNotPaused { if(update!=0) _GHTAmount[whitelistAddress] = update; GHT.transfer(to,amount); _GHTAmount[whitelistAddress] = _GHTAmount[whitelist...
6,530,453
pragma solidity ^0.5.0; import "./BidCVXBX.sol"; contract CVXBX is BidCVXBX { string public cavaloxCdn = "https://www.cavalox.eu/erc721/"; uint[] public r_stallions; uint[] public m_stallions; uint[] public l_stallions; uint[] public mares; //Only 39,000 stallions //3,000 rarest stal...
No tipping! Reject all Ether from being sent here
function() external payable { }
11,792,210
pragma solidity 0.5.15; import 'ROOT/libraries/CloneFactory2.sol'; import 'ROOT/libraries/math/SafeMathUint256.sol'; import 'ROOT/reporting/IShareToken.sol'; import 'ROOT/trading/erc20proxy1155/IERC20Proxy1155Nexus.sol'; import 'ROOT/trading/erc20proxy1155/IERC20Proxy1155.sol'; import 'ROOT/trading/erc20proxy1155/ERC2...
Guarantees that the calling function was invoked by a trusted proxy contract. So we can trust its _caller to be the proxy's msg.sender.
function _gate(IERC20Proxy1155 _proxy, uint256 _tokenId) internal view { }
5,530,248
./full_match/80001/0x28b4a935339B23761491aE18cB78B6840AE7BA1d/sources/contracts/MonkeyMetaShana.sol
Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with `errorMessage` as a fallback revert reason when `target` reverts. _Available since v3.1._/
function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); }
5,614,261
pragma solidity ^0.4.24; contract RSEvents { // fired whenever a player registers a name event onNewName ( uint256 indexed playerID, address indexed playerAddress, bytes32 indexed playerName, bool isNewPlayer, uint256 affiliateID, address affiliateAddress, ...
returns time left. dont spam this, you'll ddos yourself from your node provider -functionhash- 0xc7e284b8 return time left in seconds/ setup local rID grab time
function getTimeLeft() public view returns(uint256) { uint256 _rID = rID_; uint256 _now = now; if (_now < round_[_rID].end) if (_now > round_[_rID].strt + rndGap_) return( (round_[_rID].end).sub(_now) ); else return( (...
429,693
./full_match/42/0x77AD4FFE20F32b88D3BF915450C0b4a2eDE59A81/sources/browser/ACOPool2.sol
Internal function to set the percentage of the above price tolerance. newTolerancePriceAbove Value of the new above price tolerance./
function _setTolerancePriceAbove(uint256 newTolerancePriceAbove) internal { require(newTolerancePriceAbove < PERCENTAGE_PRECISION, "E85"); emit SetTolerancePriceAbove(tolerancePriceAbove, newTolerancePriceAbove); tolerancePriceAbove = newTolerancePriceAbove; }
9,573,936
./partial_match/42/0xA18eD8349bbeB12d371896f4FE8FE6775Ef5D84c/sources/StrategyOperator.sol
parses the passed in action arguments to get the arguments for a withdraw action _args general action arguments structure return arguments for a withdraw action/
function _parseWithdrawArgs(ActionArgs memory _args) internal pure returns (WithdrawArgs memory) { require( (_args.actionType == ActionType.WithdrawLongOption) || (_args.actionType == ActionType.WithdrawCollateral), "Actions: can only parse arguments for withdraw actions" ); ...
3,308,548
// SPDX-License-Identifier: MIT AND GPL-3.0 AND AGPLv3 // File: @openzeppelin/contracts/token/ERC20/IERC20.sol 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 totalSup...
deposit lp tokens and stake Convex rewards interface
interface Rewards { function balanceOf(address account) external view returns (uint256); function earned(address account) external view returns (uint256); function withdrawAndUnwrap(uint256 amount, bool claim) external returns (bool); function withdrawAllAndUnwrap(bool claim) external; function ...
9,874,730
pragma solidity ^0.5.0; import "./ERC223Token.sol"; import "./ICO.sol"; contract Token is ERC223Token { constructor(string memory _name, string memory _symbol, uint256 _decimals, uint256 _totalSupply) public { tokenRepository.setName(_name); tokenRepository.setSymbol(_symbol); tokenRepos...
Burns tokens and decreases the total supply. _value Amount of tokens to burn./
function burnTokens(uint256 _value) public onlyOwner { require(_value <= tokenRepository.balances(msg.sender), ""); tokenRepository.decreaseSupply(_value); tokenRepository.decreaseBalance(msg.sender, _value); emit Transfer(msg.sender, address(0), _value); }
6,443,673
./full_match/1/0x251c70d4276DEB227FE58ff309f33671a46A86Bc/sources/contracts/mojito/onchain/OffchainAuction.sol
Withdraw the funds to owner transferring ERC20 currency
function withdraw(address paymentCurrency) external adminRequired { bool success; address payable to = payable(msg.sender); if (paymentCurrency == address(0)) { require(success, "withdraw to withdraw funds. Please try again"); uint256 amount = IERC20(paymentCurrency)....
8,362,626
/** *Submitted for verification at Etherscan.io on 2022-02-20 */ /** https://t.me/JoeRoganInuOfficial */ // https://t.me/JoeRoganInuOfficial // SPDX-License-Identifier: MIT pragma solidity =0.8.10 >=0.8.10 >=0.8.0 <0.9.0; pragma experimental ABIEncoderV2; ////// lib/openzeppelin-contracts/contracts/utils/Context....
exclude from paying fees or having max transaction amount
constructor() ERC20("Joe Rogan Inu", "JRI") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = ...
6,827,939
/** *Submitted for verification at Etherscan.io on 2020-08-26 */ // File: @openzeppelin/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 existence. */ fun...
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"); }
10,403,551
pragma solidity ^0.4.25; contract ERC721 { function totalSupply() public view returns (uint256 total); function balanceOf(address _owner) public view returns (uint256 balance); function ownerOf(uint256 _tokenId) external view returns (address owner); // ownerof // deploy: public ->externa...
교배하는 method _matronId 암놈의 아이디 _sireId 숫놈의 아이디
function _breedWith(uint256 _matronId, uint256 _sireId) internal { Pony storage sire = ponies[_sireId]; Pony storage matron = ponies[_matronId]; _triggerCooldown(sire); _triggerCooldown(matron); _triggerAgeSixMonth(sire); _triggerAgeSixMonth(matron); ...
6,425,214
./full_match/1/0x5dD57Da40e6866C9FcC34F4b6DDC89F1BA740DfE/sources/contracts/BrightToken.sol
Returns the dynamic cap based on time. Will never exceed hardcap./ How much time passed since deployment shortcut in case dynamic cap would exceed hardcap.
function dynamicCap() public view returns (uint256) { uint age_seconds = block.timestamp - created; assert(age_seconds >= 0); if (age_seconds >= DYNAMIC_CAP_DURATION) { return cap; } return MIN_DYNAMIC_CAP + (age_seconds * UNITS_PER_SECOND); }
3,202,185
./full_match/80001/0xc217357dB83Edb0E6ECc45D59B8ebd4A11cb0Dec/sources/project_/contracts/Amberfi/Market.sol
Add PaymentToken token_ (address) PaymentToken address aggregator_ (address) Chainlink aggregator address for the PaymentToken:USD pair aggregatorDecimals_ (uint8) Chainlink aggregator decimals native_ (bool) Check if PaymentToken is native token/
function addPaymentToken( address token_, address aggregator_, uint8 aggregatorDecimals_, bool native_ ) external onlyOwner onlyMarketOwnerRole { if (!native_ && token_ == address(0)) { revert AmberfiLib.Market_PaymentTokenAddFailed(); } uint8...
847,930
pragma solidity ^0.4.23; /* Standard ERC20 Token. https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md */ contract ERC20 { string public name; string public symbol; uint8 public decimals = 18; uint public totalSupply; mapping (address => uint) public balanceOf; mapping (address => ma...
Transfers balance from `_from` to `_to` if `_to` has sufficient balance. Called from transfer() and transferFrom().
function _transfer(address _from, address _to, uint _value) private returns (bool success) { require(balanceOf[_from] >= _value); require(balanceOf[_to] + _value > balanceOf[_to]); balanceOf[_from] -= _value; balanceOf[_to] += _value; emit Transfer(_from, ...
2,458,097
/** *Submitted for verification at Etherscan.io on 2021-03-15 */ // File: node_modules\@openzeppelin\contracts\GSN\Context.sol pragma solidity ^0.6.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * ...
Returns to the user wether a name is valid or not
function validName(string memory str) public view returns (bool){ bytes memory b = bytes(str); if(b.length < 1) return false; if(b.length > 30) return false; if(b[0] == 0x20) return false; if (b[b.length - 1] == 0x20) return false; bytes1 lastChar = b[0]; fo...
6,813,113
pragma solidity 0.6.6; pragma experimental ABIEncoderV2; /** * SafeMath from OpenZeppelin - commit https://github.com/OpenZeppelin/openzeppelin-contracts/commit/5dfe7215a9156465d550030eadc08770503b2b2f * * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operation...
Set financial details IPFS hash _hash - URL return True if success/
function setFinancialDetailsHash(bytes32 _hash) public onlyAdmin returns (bool) { financialDetailsHash = _hash; return true; }
23,643
./full_match/97/0x20610C85207106d89e43335Cf8DDd7C58D6a3b4c/sources/contracts/StrategyRouter.sol
Returns strategy weight as percent of total weight.
function getStrategyPercentWeight(uint256 _strategyId) public view returns (uint256 strategyPercentAllocation) { return StrategyRouterLib.getStrategyPercentWeight(_strategyId, strategies); }
3,273,867
./full_match/1/0x488a7985e6FBFC7c1205f1b1FDAEA7295B961bDb/sources/contracts/artist/20_jonas_lund/MostAccidentsHappenAtHome.sol
tokenURI function returns json metadata for the token
function tokenURI(uint256 tokenId) public view override returns (string memory) { require(_exists(tokenId), 'Token does not exist.'); return metadataContract.generateTokenURI(tokenId, baseURI, tokenToToppledURI[tokenId], itemsDropped[tokenId], tokenToToppled[tokenId]); }
8,382,805
pragma solidity ^0.4.18; // ---------------------------------------------------------------------------- // Safe maths // ---------------------------------------------------------------------------- library SafeMath { function add(uint a, uint b) internal pure returns (uint c) { c = a + b; ...
Withdraws '_value' in wei from the reserve address _value The number of wei to be transferred from the reserve address TODO
function withdraw(uint256 _value) private pure { _value = _value; }
2,479,711