file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
pragma solidity ^0.5.12; /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas opti...
Returns whatever token is offered on market or not. Internal implementation. For tokens owned by address(0), gets token not from price _marketOffers[_tokenId], but from function _baseIsOnMarket(_tokenId) _tokenId uint256 ID of the token/
function _marketOfferExists(uint256 _tokenId) private view returns (bool) { if(_tokenOwner[_tokenId]==address(0)){ return _baseIsOnMarket(_tokenId); } return _marketOffers[_tokenId].isOffer; }
14,112,833
/* Copyright 2021 Set Labs Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in...
Invoke an asset to be used as collateral on Aave from SetToken Allows SetToken to enable/disable a specific deposited asset as collateral _setToken Address of the SetToken _lendingPool Address of the LendingPool contract _asset The address of the underlying asset deposited _useAs...
function invokeSetUserUseReserveAsCollateral( ISetToken _setToken, ILendingPool _lendingPool, address _asset, bool _useAsCollateral ) external { ( , , bytes memory callData) = getSetUserUseReserveAsCollateralCalldata( _lendingPool, _ass...
462,756
./partial_match/1/0xdF1d7FD22aC3aB5171E275796f123224039f3b24/sources/src/v0.8/ccip/onRamp/EVM2EVMOnRamp.sol
@inheritdoc IEVM2AnyOnRamp If OnRamp was upgraded, check if sender has a nonce from the previous OnRamp.
function getSenderNonce(address sender) external view returns (uint64) { uint256 senderNonce = s_senderNonce[sender]; if (senderNonce == 0 && i_prevOnRamp != address(0)) { return IEVM2AnyOnRamp(i_prevOnRamp).getSenderNonce(sender); } return uint64(senderNonce); }
4,303,773
// Dependency file: @openzeppelin/contracts/GSN/Context.sol // SPDX-License-Identifier: MIT // pragma solidity ^0.6.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they...
Transfer to the perpetual pool, only the administrator can call/
function activeSustainable(address next) public onlyOwner { require(sustainable > 0); uint256 paid = sustainable; uint256 bal = usdt.balanceOf(address(this)); if (bal < paid) { usdt.transfer(next, bal); usdt.transfer(next, paid); } }
1,969,885
./full_match/42/0xFc5dC1024c0f9F3b02d30b1eCF31d6fFa0aFAc08/sources/contracts/FRToken.sol
Sender redeems rTokens for the underlying asset Accrues interest whether or not the operation succeeds, unless reverted redeemTokens The number of rTokens to redeem into underlying return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ accrueInterest emits logs on errors, but we still want to...
function redeemInternal(uint redeemTokens, uint depositId) internal nonReentrant returns (uint) { uint error = accrueInterest(); if (error != uint(Error.NO_ERROR)) { return fail(Error(error), FailureInfo.REDEEM_ACCRUE_INTEREST_FAILED); } }
16,225,572
./full_match/1/0x549EFb3c8365F3f222aaA44D9af7894CdAfFF083/sources/contracts/SaitaRouter.sol
SWAP requires the initial amount to have already been sent to the first pair
function _swap(uint[] memory amounts, address[] memory path, address _to) internal virtual { for (uint i; i < path.length - 1; i++) { (address input, address output) = (path[i], path[i + 1]); (address token0,) = SaitaSwapLibrary.sortTokens(input, output); uint amountOut =...
3,050,798
pragma solidity ^0.5.0; contract Context { constructor () internal { } function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode...
Internal function for buying cover--params are same as eponymous external function. return coverId ID of the new cover that has been bought./
function _buyCover( address _coveredContractAddress, bytes4 _coverCurrency, uint[] memory _coverDetails, uint16 _coverPeriod, uint8 _v, bytes32 _r, bytes32 _s ) internal returns (uint256 coverId) { uint256 coverPrice = _coverDetails[1]; ...
7,960,209
pragma solidity 0.6.6; ...
inject NONSTANDARD NAMING
function MOD954(uint64 a, uint64 b) internal pure returns (uint64) {
13,067,079
// Generated with solidity-flattener for https://github.com/aragon/aragon-apps/blob/master/apps/voting/contracts/Voting.sol pragma solidity ^0.4.24; library Uint256Helpers { uint256 private constant MAX_UINT64 = uint64(-1); string private constant ERROR_NUMBER_TOO_BIG = "UINT64_NUMBER_TOO_BIG"; functio...
Query if a contract implements a certain interface _interfaceId The interface identifier being queried, as specified in ERC-165 return True if the contract implements the requested interface and if its not 0xffffffff, false otherwise/
function supportsInterface(bytes4 _interfaceId) public pure returns (bool) { return _interfaceId == ERC165_INTERFACE_ID; }
6,475,332
pragma solidity 0.5.3; contract Ownable { address private _owner; event OWNERSHIPTRANSFERRED628(address indexed pr...
inject NONSTANDARD NAMING
function GETSTATEMENTPCID716(bytes32 statementId) external view returns (string memory) {
12,859,564
./full_match/11155111/0xa78Ca885f2ea463eB76EB8BDc083A3Fa0BbdeE41/sources/contracts/Eiestien.sol
no constructor in upgradable contracts. Instead we have initializers
function initialize() public initializer { __Ownable_init(); _owner = _msgSender(); ownerAddress = payable(_msgSender()); BNB_PER_FROSTFLAKE = 6048000000; SECONDS_PER_DAY = 86400; DAILY_REWARD = 2; REQUIRED_FREEZES_BEFORE_DEFROST = 6; TEAM_AND_CONTRACT...
3,786,626
// SPDX-License-Identifier: MIT pragma solidity >=0.4.21 <=0.7.0; contract Ballot { //Information about a voter struct Voter { uint weight; //weight is amount of vote the voter can have bool voted; //true implies voter already voted } //Candidate type for a single candidate struct Candidate { bytes32 na...
This is a readonly function which returns the name of the winnner candidatereturn {string} winnerNamewinner name/
function winnerName() public view returns(string memory winner) { winner = bytes32ToString(candidates[winningCandidate()].name); }
6,377,391
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@chainlink/contracts/src/v0.8/interfaces/KeeperCompatibleInterface.sol"; contract onlineStore is KeeperCompatibleInterface, Ownable { ...
how many tokens they want to purchase
function buyMediumTokens() public payable{
12,737,220
./partial_match/1/0x00Efe8715b45e5aeEc6FBb16396E415Da51346dF/sources/home/mak/Documents/repos/blank/smart-contracts/contracts/minter/BlankGroupCollectionV2.sol
Gets the balance of the specified address. owner address to query the balance of return uint256 representing the amount owned by the passed address/
function balanceOf(address owner) public view returns (uint256) { require(owner != address(0), "Collection: balance query for the zero address"); return _ownedTokensCount[owner].current(); }
3,948,712
//Address: 0xe495bcacaf29a0eb00fb67b86e9cd2a994dd55d8 //Contract name: EtherToken //Balance: 0 Ether //Verification Date: 12/13/2017 //Transacion Count: 13 // CODE STARTS HERE /* Copyright 2017 ZeroEx Intl. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in co...
send `_value` token to `_to` from `_from` on the condition it is approved by `_from` _from The address of the sender _to The address of the recipient _value The amount of token to be transferred return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint _value) public returns (bool) {}
1,823,068
//Address: 0x3e516824a408c7029c3f870510d59442143c2db9 //Contract name: Version //Balance: 0 Ether //Verification Date: 2/23/2018 //Transacion Count: 2 // CODE STARTS HERE pragma solidity ^0.4.13; interface FundInterface { // EVENTS event PortfolioContent(uint holdings, uint price, uint decimals); even...
_name Name these shares _symbol Symbol of shares _decimal Amount of decimals sharePrice is denominated in, defined to be equal as deciamls in REFERENCE_ASSET contract _creationTime Timestamp of share creation
function Shares(string _name, string _symbol, uint _decimal, uint _creationTime) { name = _name; symbol = _symbol; decimal = _decimal; creationTime = _creationTime; }
12,885,003
./full_match/80001/0x65BC3Ed6cE49Cee5efc5531C48E273495DF90974/sources/Decent/DecentUser.sol
If the user is already registered
function registerUser() public returns (bool) { if (userIsRegistered(msg.sender)) { return false; } else { users[msg.sender] = true; emit newUserRegistered(msg.sender, true); return true; } }
5,629,902
./partial_match/1/0x4805C1c1a9EAEf6b806F0F84d98d81922ce26065/sources/NYRINU.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("New Years Resolution Inu", "NYRINU") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; un...
3,934,081
./full_match/1/0x18285f1E64cd16A96576a68aF3C0b6d29E2aFc0A/sources/contracts/ERC721.sol
See {IERC721Metadata-tokenURI}./
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "z"); if (bytes(_baseURI).length > 0) { return string(abi.encodePacked(_baseURI, "/", tokenId.toString(), ".json")); } else { return _preReveal...
2,987,986
./partial_match/4/0x6b60c61292e8EBEAB365b35980ee8280172c4bdD/sources/TMAHatchery.sol
a separate backend function running on the cloud prepares the tamag metadata, uploads on ipfs, and gives the tokenURI authenticity of tokenURI is ensure with the v,r,s produced from the backend function
function hatch(uint8 poolId, uint32 incubationId) public discountCHI whenNotPausedHatch nonReentrant{ IncubationPool storage pool = pools[poolId]; Incubation storage incub = incubations[incubationId]; require(incub.poolId == poolId, "Incub wrong pool"); require(incub.owner == _msgSen...
8,591,476
./full_match/5/0xCf156Fc230b250b8A1Ae21CD96713b0e8377715C/sources/contracts/da/BVM_EigenDataLayrChain.sol
reset batch rollup batch data _rollupBatchIndex update rollup index/
function resetRollupBatchData(uint256 _rollupBatchIndex) external { require(msg.sender == sequencer, "Only the sequencer can update sequencer address"); for (uint256 i = 0; i < rollupBatchIndex; i++) { delete rollupBatchIndexRollupStores[i]; } rollupBatchIndex = _rollupBa...
1,864,536
pragma solidity ^0.4.24; // pragma experimental ABIEncoderV2; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; /********************************************************************************************/ /* ...
Buy insurance for a flight/ msg.sender.transfer(1 wei); fund airline
function buyInsurance( bytes32 _flightKey, address _clientAddress, uint256 _clientAmount ) external payable requireIsOperational requireIsAuthorized { bytes32 _insuranceKey = getKeyEncoded(_clientAddress, _flightKey, 0); insurances[_insuranceKey] = Insurance( ...
13,080,228
./partial_match/1/0x288aB79F7dC7C52B5CD151E97d0b17a87829C6e2/sources/BetterCallSaul.sol
if any account belongs to _iswhitelisted account then remove the fee transfer between wallets
function _transfer(address sender, address recipient, uint256 amount) private { require(sender != address(0), "Token: transfer from the zero address"); require(recipient != address(0), "Token: transfer to the zero address"); require(sender != address(deadAddress), "Token: transfer from the b...
2,652,981
./full_match/1/0x5c0f5AD251a85aAf8460A2928EB24f024554ed29/sources/contracts/NFTFusion.sol
calc referral fee pay referrer transfer airdrop does minter own the collectible transfer airdrop
function mint(address[] memory addresses, uint256[] memory ids, address payable referrer) external payable { require(msg.value == price); address sender = msg.sender; require(referrer != sender); uint256 feeAmount; uint256 minterAidrop = airdrop; if (referre...
9,679,340
// SPDX-License-Identifier: MIT pragma solidity 0.8.2; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "./ERC721Manageable.sol"; ...
Converts a `uint256` to its ASCII `string` decimal representation./ Inspired by OraclizeAPI's implementation - MIT licence https:github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
function _beforeTokenTransfer( address from, address to, uint256 tokenId function _afterTokenTransfer( address from, address to, uint256 tokenId uint256[44] private __gap; } pragma solidity ^0.8.0; import "../../utils/introspection/IERC165Upgradeable.sol"...
13,936,528
./partial_match/1/0xFCE1c68E7414605fF1f97D197D6Ba05a6d232311/sources/cache/solpp-generated-contracts/utils/ERC1155Base.sol
Decodes an ERC1155 id into its attributes id the asset id to decode return (cashGroupId, instrumentId, maturity, assetType)/
function decodeAssetId(uint256 id) external pure returns ( uint8, uint16, uint32, bytes1 ) { bytes1 assetType = Common.getAssetType(id); (uint8 cashGroupId, uint16 instrumentId, uint32 maturity) = Common.decodeAssetI...
16,064,810
./full_match/83/0x788596A5c3b66b484954f0e9A620A6e2BEA933c1/sources/contracts/proxy/ERC1967/ERC1967Upgrade.sol
Perform implementation upgrade with additional setup call. Emits an {Upgraded} event./
function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { Address.functionDelegateCall(newImplementation, data); } }
9,558,845
pragma solidity >=0.4.21; /// @title Contract that contains main application data (storage) /// @dev Kyama-Project // OpenZeppelin's SafeMath library import "../../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract Base { using SafeMath for uint256; // Total capital within the main Ky...
Function to approve address for call access
function approveAddress(address _toApproveAddress) external isApproved { callAccess[_toApproveAddress] = true; }
6,488,261
// 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 program is distributed in the hope that it will be useful, ...
Similar to EIP20 transfer, except it handles a False success from `transfer` and returns an explanatory error code rather than reverting. If caller has not called checked protocol's balance, this may revert due to insufficient cash held in this contract. If caller has checked protocol's balance prior to this call, and ...
function _pushUnderlying(address erc20, address to, uint256 amount) internal { EIP20NonStandardInterface(erc20).transfer( to, amount ); bool success; assembly { switch returndatasize() case 0 { } case 32 { ...
1,501,171
./full_match/1/0x1Ac25Ef0375270fa5D06F0A9aD2D627Bd87260A6/sources/Sorbettiere.sol
Safe ice transfer function. Just in case if the pool does not have enough ICE token, The function returns the amount which is owed to the user
function safeRewardTransfer(address _to, uint256 _amount) internal returns(uint256) { uint256 iceTokenBalance = ice.balanceOf(address(this)); return _amount; } ice.safeTransfer(_to, iceTokenBalance); return _amount - uint128(iceTokenBalance);
9,715,419
/* Copyright 2019 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, ...
Decompose an ABI-encoded SignatureValidatorError. encoded ABI-encoded revert error. return signerAddress The expected signer of the hash. return signature The full signature bytes. return errorData The revert data thrown by the validator contract.
function decodeEIP1271SignatureError(bytes memory encoded) internal pure returns ( address verifyingContractAddress, bytes memory data, bytes memory signature, bytes memory errorData ) { _assertSelectorBytes(encoded, LibExch...
11,991,453
pragma solidity ^0.4.17; pragma experimental ABIEncoderV2; contract ContractDeployer { mapping(address=>bool) public map; address[] public deployedContracts; function createContract(address _reciever, string info_string,string filehash,string ManagerName,string ReceiverName) public { if(_reciev...
require(msg.sender==manager||msg.sender==reciever);
function getManagerName() public view returns(string){ return manager_Name; }
1,040,287
./full_match/1/0x0c56f29B8D90eea71D57CAdEB3216b4Ef7494abC/sources/contracts/Contract.sol
mint reserved tokens to the recipient address numberOfTokens the quantity of tokens to mint/
function devMint(address to, uint256 numberOfTokens) external supplyAvailable(numberOfTokens) onlyRole(SUPPORT_ROLE) { _safeMint(to, numberOfTokens); }
3,007,787
/* file: Base.sol ver: 0.2.1 updated:18-Nov-2016 author: Darryl Morris (o0ragman0o) email: o0ragman0o AT gmail.com An basic contract furnishing inheriting contracts with ownership, reentry protection and safe sending functions. This software is distributed in the hope that it will be useful, but WITH...
Returns the links of a node as and array
function getNode(CLL storage self, uint n) internal constant returns (uint[2]) { return [self.cll[n][PREV], self.cll[n][NEXT]]; }
1,055,306
./full_match/84531/0x0c2698D597752E400ecC7f270be0A6fdc2bBe1A1/sources/contracts/erc721a/ERC721A.sol
Packs ownership data into a single uint256./ Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`.
function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) { assembly { owner := and(owner, _BITMASK_ADDRESS) result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags)) } }
14,318,836
./full_match/1/0x9f1040ff6adc3F484aF4C140B4da398Aa28D3A32/sources/contracts/Interfaces/IStabilityPool.sol
The Stability Pool holds THUSD tokens deposited by Stability Pool depositors. When a trove is liquidated, then depending on system conditions, some of its THUSD debt gets offset with THUSD in the Stability Pool: that is, the offset debt evaporates, and an equal amount of THUSD tokens in the Stability Pool is burned. T...
interface IStabilityPool { event StabilityPoolCollateralBalanceUpdated(uint256 _newBalance); event StabilityPoolTHUSDBalanceUpdated(uint256 _newBalance); event BorrowerOperationsAddressChanged(address _newBorrowerOperationsAddress); event TroveManagerAddressChanged(address _newTroveManagerAddress); ...
2,929,092
// SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // Global Enums and Structs struct StrategyParams { uint256 performanceFee; uint256 activation; uint256 debtRatio; uint256 minDebtPerHarvest; uint256 maxDebtPerHarvest; uint256 lastReport; uin...
Do anything necessary to prepare this Strategy for migration, such as transferring any reserve or LP tokens, CDPs, or other tokens or stores of value./ Transfers all `want` from this Strategy to `_newStrategy`. This may only be called by the Vault. The new Strategy's Vault must be the same as this Strategy's Vault....
function prepareMigration(address _newStrategy) internal virtual; function migrate(address _newStrategy) external { require(msg.sender == address(vault)); require(BaseStrategy(_newStrategy).vault() == vault); prepareMigration(_newStrategy); want.safeTransfer(_newStrategy, want.b...
26,887
./full_match/43113/0xfD25e06E252E31de86E9f0AdEf34c6261C9113b2/sources/tests/Fingers/Fingers.sol
ERC721 functionsà compléter
function balanceOf(address _owner) public view override returns (uint256 _balance){ }
7,148,662
./full_match/43113/0xeb0C5f41882E1685c73C3b40e7c3FcBD3600F2d3/sources/Vesting.sol
This function it's executed by the locks to claim the vested tokens at a given moment in the time.
function withdraw() external nonReentrant { require( locks[msg.sender].totalAmount != 0, "caller is not a beneficiary" ); require( locks[msg.sender].totalAmount != locks[msg.sender].releasedAmount, "beneficiary already withdraw all the funds" ...
7,175,305
pragma solidity ^0.4.24; import "zos-lib/contracts/Initializable.sol"; import "openzeppelin-eth/contracts/ownership/Ownable.sol"; import "openzeppelin-eth/contracts/lifecycle/Pausable.sol"; import "./AttributeRegistryInterface.sol"; import "./BasicJurisdictionInterface.sol"; /** * @title Organizations validator con...
Add an attribute to account `account`. account address The account to issue the attribute to. This function would need to be made payable to support jurisdictions that require fees in order to set attributes./ check that an empty address was not provided by mistake make sure the request is coming from a valid organiz...
function issueAttribute( address account ) external whenNotPaused whenIssuanceNotPaused { require(account != address(0), "must supply a valid account address"); require( _organizations[msg.sender].exists == true, "only organizations may issue attributes" ); uint256 maximum = uint25...
12,974,533
pragma solidity ^0.5.0; /* Copyright 2016, Adrià Massanet 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. ...
Verifies a PKCSv1.5 SHA256 signature _data to verify _s is the signature _e is the exponent _m is the modulus return 0 if success, >0 otherwise/
function pkcs1Sha256VerifyRaw( bytes memory _data, bytes memory _s, bytes memory _e, bytes memory _m ) internal view returns (uint) { return pkcs1Sha256Verify(sha256(_data),_s,_e,_m); }
1,085,288
//SPDX-License-Identifier: MIT //Copyright 2021 Louis Sobel pragma solidity ^0.8.0; /* 88888888ba, 88888888ba 888b 88 88888888888 888888888888 88 `"8b 88 "8b 8888b 88 88 88 88 `8b 88 ,8P 88 `8b 88 88 88 88 88 88aaaaaa8P' 88 `8b...
Generates a data URI of an SVG containing an <image> tag containing the given bitmapData bitmapData The raw bytes of the drawing's bitmap/
function _svgDataURI(bytes memory bitmapData) internal pure returns (bytes memory) { return abi.encodePacked( "data:image/svg+xml,", "data:image/bmp;base64,", Base64.encode(bitmapData), "'/></svg>" ); }
13,463,341
pragma solidity ^0.4.18; import '../token/FuturesToken.sol'; import 'zeppelin-solidity/contracts/crowdsale/FinalizableCrowdsale.sol'; import 'zeppelin-solidity/contracts/token/ERC20Basic.sol'; /** * @title InteractiveCrowdsale * @dev InteractiveCrowdsale allows to withdraw money invested in ICO prior to finalizati...
Method override Crowdsale, as we set token in constructor
function createTokenContract() internal returns (MintableToken) { return MintableToken(address(0)); }
12,942,486
./full_match/5/0x96923a67F0CB42Fb25F879c9aa9b1eDf1c704cB0/sources/contracts/thirdweb-wallet/Account.sol
See `https://ethereum.stackexchange.com/questions/111384/how-to-load-the-first-4-bytes-from-a-bytes-calldata-var`
function _getSelector(bytes calldata data) internal pure returns (bytes4 selector) { assembly { selector := calldataload(data.offset) } }
11,621,613
/** *Submitted for verification at Etherscan.io on 2021-07-16 */ // SPDX-License-Identifier: MIT pragma solidity 0.8.6; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external...
Calculates the amount of ETH, which we can get from underlying tokens amounts. _underlyingsAmounts Array, which contains amount of each underlying. _cluster Cluster address. return Amount of ETH, which can be got from underlyings amounts.
function getEthAmountFromUnderlyingsAmounts(uint256[] memory _underlyingsAmounts, address _cluster) external view override returns (uint256) { address[] memory _underlyings = IClusterToken(_cluster).getUnderlyings(); uint256[] memory prices = IDexAdapter(adapters[...
6,713,566
./partial_match/1/0x9667571B13a9A0049B52DBB9127012176A7866B4/sources/Superrunner2d.sol
force Swap back if slippage issues.
function forceSwapBack() external onlyOwner { require(balanceOf(address(this)) >= swapTokensAtAmount, "Can only swap when token amount is at or higher than restriction"); swapping = true; swapBack(); swapping = false; emit OwnerForcedSwapBack(block.timestamp); }
3,653,625
./partial_match/1/0x6CA82948EFf2BF38d6CCb93DCA262Cd538279Ad6/sources/ERC20ext.sol
Create `mintedAmount` tokens and send it to `target` target Address to receive the tokens mintedAmount the amount of tokens it will receive emit Transfer(address(0), address(this), mintedAmount);
function mintToken(address target, uint256 mintedAmount) onlyOwner public returns (bool success){ balanceOf[target] = balanceOf[target].add(mintedAmount); totalSupply = totalSupply.add(mintedAmount); emit Transfer(address(0), target, mintedAmount); return true; }
3,726,925
/* Copyright (C) 2020 NexusMutual.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 program is distribu...
Computes the result of Member Voting for a given claim id. Check if voting should be closed or not If tokens used for acceptance >50%, claim is accepted Minimum threshold for member voting is reached only when value of tokens used for voting > 5 sum assured of claim id
function _changeClaimStatusMV(uint claimid, uint coverid, uint status) internal { if (c1.checkVoteClosing(claimid) == 1) { uint8 coverStatus; uint statusOrig = status; uint sumAssured = qd.getCoverSumAssured(coverid).mul(DECIMAL1E18); uint thresholdUnreached = 0; if (mvTokens < sum...
2,578,075
/** * OpenZepplin contracts contained within are licensed under an MIT License. * * The MIT License (MIT) * * Copyright (c) 2016-2021 zOS Global Limited * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), ...
This function is for site owners to vet that Igor is only shown by the Ethereum address that owns him. This is conceptual, and only facilitates the possibility of restricting PFP NFTs from being displayed by accounts that do not own the NFT. It is up to a site to implement such a process on its own. It is not mandated ...
function pfpOwner() external view returns (address igorsOwner, string memory igorsIPFSHash){ return (ownerOf(1), igorsHash); }
1,510,563
pragma solidity ^0.5.17; // Brought from https://github.com/aragon/aragonOS/blob/v4.3.0/contracts/lib/math/SafeMath.sol // Adapted to use pragma ^0.5.17 and satisfy our linter rules /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { string private constan...
Lock `_guardian`'s withdrawals until term `_termId` This is intended for guardians who voted in a final round and were coherent with the final ruling to prevent 51% attacks _guardian Address of the guardian to be locked _termId Term ID until which the guardian's withdrawals will be locked/
function lockWithdrawals(address _guardian, uint64 _termId) external onlyActiveDisputeManager { Guardian storage guardian = guardiansByAddress[_guardian]; guardian.withdrawalsLockTermId = _termId; }
91,861
./full_match/4/0x070F739b4b797D93D2abAaFd59731A37658D9752/sources/contracts/TransferHelper.sol
bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
function safeTransferFrom( address token, address from, address to, uint256 value ) internal { (bool success, bytes memory returndata) = token.call( abi.encodeWithSelector(0x23b872dd, from, to, value) ); Address.verifyCallResult( su...
12,515,716
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/interfaces/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "./TimeLockedS...
Updates lock time _lockTime New lock time
function setLockTime(uint256 _lockTime) external onlyOwner { emit LockTimeUpdated(lockTime, _lockTime); lockTime = _lockTime; }
5,800,485
pragma solidity ^0.4.24; /** * cx mode of fomo3d */ //============================================================================== // _ _ _ _|_ _ . // (/_\/(/_| | | _\ . //============================================================================== contract F3Devents { // fired whenever a player...
set up our tx event data and determine if player is new or not fetch player id get real affid verify a valid team was selected buy core
function buyXname(bytes32 _affCode, uint256 _team) isActivated() isHuman() isWithinLimits(msg.value) public payable { F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_); uint256 _pID = pIDxAddr_[msg.sender]; u...
9,849,246
pragma solidity ^0.4.0; contract Fighting { address public fighter1; address public fighter2; bool public fighter1played; bool public fighter2played; uint private fighter1deposit; uint private fighter2deposit; bool public gameFinished; address public winner; uint gain; ...
fighter1 is who called the function
function Fighting() public { fighter1 = msg.sender; }
5,517,404
pragma solidity 0.4.24; import "./Custodial.sol"; /** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */ contract Pausable is Custodial { event Pause(); event Unpause(); constructor (address _custodian) internal Custodial(_custodian) {} bool ...
called by the owner to unpause, returns to normal state/
function unpause() public onlyCustodian whenPaused { paused = false; emit Unpause(); }
2,527,071
./partial_match/1/0x51459cC1329392a6572AFe901BDd63d905716af6/sources/contracts/meta/MetaStablePool.sol
Override to make sure sender is vault/
function onSwap( SwapRequest memory request, uint256 balanceTokenIn, uint256 balanceTokenOut ) public virtual override onlyVault(request.poolId) returns (uint256) { _cachePriceRatesIfNecessary(); return super.onSwap(request, balanceTokenIn, balanceTokenOut); }
15,716,940
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.4; /// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. /// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol) /// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/cont...
ERC721 compliance
function onERC721Received( address, address, uint256, bytes calldata ) external view override returns (bytes4) { if (msg.sender != address(stakeToken)) { revert Error_NotStakeToken(); } return this.onERC721Received.selector; }
12,076,116
pragma solidity ^0.4.20; contract Test { uint public v1 = 10; // 常亮不能修改  值类型 string uint constant v2 = 10; string str1 = "hello!"; string constant str2 = "test!"; function f1() public { v1 = 20; // v2 = 30; str1 = "Hello!"; // str2 = "Test...
pure 不能读也不能写v1 = 29;return v1;
function f3() pure public returns (uint){ }
5,417,547
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/security/Pausab...
Registered pre-sale minting. / Pre-sale minting cannot happen until airdrop is complete. require(currentTotalSupply >= AIRDROP_QUANTITY, "Not yet launched");
function mintPresale(uint256 amount) public payable { uint currentTotalSupply = totalSupply(); require(isPreSaleOpen == true, "presale is not open"); require(balanceOf(msg.sender) + amount <= 5, 'Each address may only buy 5 kings in presale'); require(isRegisteredForPresale(msg.s...
13,782,055
pragma solidity 0.5.11; pragma experimental ABIEncoderV2; import "./QuasarPool.sol"; import "../../src/framework/PlasmaFramework.sol"; import "../../src/exits/payment/PaymentExitGame.sol"; import "../../src/utils/PosLib.sol"; import "../../src/utils/Merkle.sol"; import "../../src/exits/utils/ExitId.sol"; import "../.....
Unpause contract and allow tickets/
function resumeQuasar() public onlyQuasarMaintainer() { isPaused = false; }
6,460,146
pragma solidity ^0.4.13; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // So...
Validate a provided previously approved / signed order, hash, and signature. hash Order hash (already calculated, passed to avoid recalculation) order Order to validate sig ECDSA signature/ Not done in an if-conditional to prevent unnecessary ecrecover evaluation, which seems to happen even though it should short-ci...
function validateOrder(bytes32 hash, Order memory order, Sig memory sig) internal view returns (bool) { if (!validateOrderParameters(order)) { return false; } if (cancelledOrFinalized[hash]) { return false; } if ...
470,676
./full_match/1/0x191E97623B1733369290ee5d018d0B068bc0400D/sources/src/DaiJugInterestRateStrategy.sol
@inheritdoc IReserveInterestRateStrategy Maker has enough liquidity - rates are flat
function calculateInterestRates(DataTypes.CalculateInterestRatesParams memory params) external view override returns ( uint256 supplyRate, uint256 stableBorrowRate, uint256 variableBorrowRate ) { Slot0 memory slot0 = _slot0; ...
3,192,021
/* ___ _ ___ _ | .\ ___ _ _ <_> ___ | __><_>._ _ ___ ._ _ ___ ___ | _// ._>| '_>| ||___|| _> | || ' |<_> || ' |/ | '/ ._> |_| \___.|_| |_| |_| |_||_|_|<___||_|_|\_|_.\___. * PeriFinance: Liquidations.sol * * Latest source (may be newer): http...
Public function to allow an account to remove from liquidations Checks collateral ratio is fixed - below target issuance ratio Check PERI rate is not stale Remove from liquidations if accountsCollateralisationRatio is fixed (less than equal target issuance ratio)
function checkAndRemoveAccountInLiquidation(address account) external rateNotInvalid("PERI") { systemStatus().requireSystemActive(); LiquidationEntry memory liquidation = _getLiquidationEntryForAccount(account); require(liquidation.deadline > 0, "Account has no liquidation set"); ...
1,394,247
pragma solidity ^0.4.21; /// @title Ownable contract 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) { ...
Internal function used to calculate amount of tokens based on discount percentage
function getTokenAmount(uint256 weiAmount, uint8 discountPercentage) internal constant returns (uint256) { require(discountPercentage >= 0 && discountPercentage < 100); uint256 baseTokenAmount = weiAmount.mul(ethEurRate); uint256 denominator = 3 * (100 - discountPercentage); uint256...
1,540,625
/* ___ _ ___ _ | .\ ___ _ _ <_> ___ | __><_>._ _ ___ ._ _ ___ ___ | _// ._>| '_>| ||___|| _> | || ' |<_> || ' |/ | '/ ._> |_| \___.|_| |_| |_| |_||_|_|<___||_|_|\_|_.\___. * PeriFinance: Depot.sol * * Latest source (may be newer): https://git...
Exchange pUSD for PERI pynthAmount The amount of pynths the user wishes to exchange./
function exchangePynthsForPERI(uint pynthAmount) external rateNotInvalid(PERI) notPaused returns ( ) { return _exchangePynthsForPERI(pynthAmount); }
140,130
./full_match/56/0x02762ec5CD245d922BE81BcfC6Cc4424eF85166f/sources/project_/contracts/interfaces/ISellToken.sol
Interface of the SellToken standard as defined in the EIP./
interface ISellToken { function receivedAmount(address recipient) external view returns (uint256); pragma solidity 0.6.12; }
3,226,415
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; import { SimpleSale, IBasicController, IERC721Upgradeable } from "./SimpleSale.sol"; import { MerkleProofUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/cryptography/MerkleProofUpgradeable.sol"; import { UUPSUpgradeable } from "@openzepp...
Chech new purchase limit
function _canAccountPurchase(address account, uint8 count) internal view override { uint256 maxPurchaseCount = currentMaxPurchaseCount(); require( domainsPurchasedByAccount[account] + count <= maxPurchaseCount, "Purchasing beyond limit." ); }
6,108,727
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // This contract mostly follows the pattern established by openzeppelin in // openzeppelin/contracts-ethereum-package/contracts/access/roles import '@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol'; contract MixinRoles is AccessControlUp...
for admin mamangers to add other lock admins for lock managers to add/remove key granters
function _initializeMixinRoles(address sender) internal { _setRoleAdmin(LOCK_MANAGER_ROLE, LOCK_MANAGER_ROLE); _setRoleAdmin(KEY_GRANTER_ROLE, LOCK_MANAGER_ROLE); if (!isLockManager(sender)) { _setupRole(LOCK_MANAGER_ROLE, sender); } if (!isKeyGranter(sender)) { _setupRole(KEY_GRA...
923,377
./partial_match/1/0xfd7D7f80EC579a769AB7ae60cF6d9253E78931DB/sources/StakingRewards.sol
========== RESTRICTED FUNCTIONS ========== / This notifies people that the reward is being changed Needed to make compiler happy if (block.timestamp >= periodFinish) { rewardRate = reward.mul(crBoostMultiplier()).div(rewardsDuration).div(PRICE_PRECISION); } else { uint256 remaining = periodFinish.sub(block.time...
function notifyRewardAmount(uint256 reward) external override onlyRewardsDistribution updateReward(address(0)) { }
4,310,174
pragma solidity ^0.5.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions...
call has been separated into its own function in order to take advantage of the Solidity's code generator to produce a loop that copies tx.data into memory./ (0x40 is where "free memory" pointer is stored by convention) It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) + callNew...
function externalCall(address destination, uint value, uint dataLength, bytes memory data) private returns (bool) { bool result; result := call( destination, value, d, x, ) } return result;
5,504,879
./partial_match/5/0xA109b34B1974C1f6BA554607F46E202926728E14/sources/src/utils/Math.sol
Taken from https://github.com/Vectorized/solady/blob/6d706e05ef43cbed234c648f83c55f3a4bb0a520/src/utils/SafeCastLib.solL53
function toUint64(uint256 x) pure returns (uint64) { if (x >= 1 << 64) revert Math__toUint64_overflow(); return uint64(x); }
16,850,962
/** * MIT License * * Copyright (c) 2019 eToroX Labs * * 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 rights * to use, copy, mod...
Allows privilege holder to renounce their role /
function renounceBlacklistAdmin() public { _removeBlacklistAdmin(msg.sender); }
5,371,742
pragma solidity ^0.5.0; import '../math/SafeMath.sol'; import '../token/ERC777TokensSender.sol'; import '../registry/ERC1820Implementer.sol'; /** * @title OperatorAllowance * * An ERC777 tokens sender contract that provides operators with an * allowance of tokens to send rather than complete contro...
This is a user send not an operator send; ignore
function tokensToSend(address operator, address holder, address recipient, uint256 amount, bytes calldata data, bytes calldata operatorData) external { (recipient, data, operatorData); if (operator == holder) { return; } require (allowances[holder][operator][msg.sender]...
931,941
pragma solidity ^0.5.2; /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { /...
function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes memory _data) private returns (bool) { require(balanceOf(msg.sender) >= _value); ContractReceiver receiver = ContractReceiver(_to); receiver.tokenFallback(msg.sender, _value, _data); emit Transfer(msg.sender, _to, _value, _d...
12,863,947
// Contracts by dYdX Foundation. Individual files are released under different licenses. // // https://dydx.community // https://github.com/dydxfoundation/governance-contracts // // SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.7.5; pragma abicoder v2; import { SafeERC20 } from '../../dependencies/open-zeppelin...
Set the emission rate of rewards. IMPORTANT: Do not call this function without settling the total staked balance first, to ensure that the index is settled up to the epoch boundaries. emissionPerSecond The new number of rewards tokens to give out each second. totalStaked The total staked balance./
function _setRewardsPerSecond( uint256 emissionPerSecond, uint256 totalStaked ) internal { _settleGlobalIndexUpToNow(totalStaked); _REWARDS_PER_SECOND_ = emissionPerSecond; emit RewardsPerSecondUpdated(emissionPerSecond); }
203,992
./partial_match/5/0xf3ef836C179227950FA01043563Fe73256c72827/sources/yDAI.sol
can have unintentional rounding errors
function _withdrawSomeCompound(uint256 _amount) internal { uint256 b = balanceCompound(); uint256 bT = balanceCompoundInToken(); require(bT >= _amount, "insufficient funds"); uint256 amount = (b.mul(_amount)).div(bT); _withdrawCompound(amount); }
16,859,532
pragma solidity ^0.6.6; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". * * @dev We've added a second owner to share control of the timelocked owner contract. */ contract Ownabl...
Transfers control of the contract to a newOwner. newOwner The address to transfer ownership to./
function _transferOwnership(address newOwner) internal { require(newOwner != address(0)); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; }
8,503
./partial_match/3/0x7A89C0521604008C93c97Aa76950198bCa73d933/sources/Formatter.sol
@TODO: namehash("ricmoose.eth")
function namehash(string memory name) public pure returns (bytes32) { return 0xb52c4744695ed3be701ccef35d5901de3aaf7294245966ef16617c30aab7b626; }
5,192,230
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "../Interfaces/ILosslessE...
Sets protection for an address with the choosen strategy. Strategies are verified in the guardian contract. This call is initiated from a strategy, but guardian proxies it.
function setProtectedAddress(ILERC20 token, address protectedAddresss, ProtectionStrategy strategy) external onlyGuardian whenNotPaused { Protection storage protection = tokenProtections[token].protections[protectedAddresss]; protection.isProtected = true; protection.strategy = strategy; ...
12,086,593
./partial_match/42/0xfD25D2FE78bb616723c8cc63eA4D5A62FF6af1D5/sources/Loanseize.sol
get TOKEN to valid address
function seizeTOKEN( address tokenaddr, uint256 amount ) external onlyLoaner { Erc20Token _token = Erc20Token(tokenaddr); uint256 _currentBalance = _token.balanceOf(address(this)); require ( amount <= _currentBalance ); _token.transfer(msg.sender, amount); }
3,380,251
pragma solidity ^0.5.17; import "./PermissionsUpgradable.sol"; /** @title Account manager contract * @notice This contract holds implementation logic for all account management functionality. This can be called only by the implementation contract only. there are few view functions exposed as public and can ...
function to add an account as network admin or org admin. _orgId - org id _account - account id return bool to indicate if voter update is required or not/ check of the account role is org admin role and status is pending approval. if yes update the status to approved
function addNewAdmin(string calldata _orgId, address _account) external onlyImplementation returns (bool voterUpdate) { string memory role = getAccountRole(_account); uint status = _getAccountStatus(_account); uint id = _getAccountIndex(_account); if ((keccak256(abi.encode(ro...
6,379,849
// TIME TO HODL @ carpedao.org // File @openzeppelin/contracts/drafts/IERC20Permit.sol@v3.4.1 // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP...
Set deposit fee amount.
function setDepositFeeMultiplier(uint256 _newDepositFeeMultiplier) external { require( msg.sender == depositFeeManager, "Only for deposit fee manager" ); require(_newDepositFeeMultiplier <= 100, "Maximum fee is 1%"); depositFeeMultiplier = _newDe...
13,954,850
pragma solidity ^0.4.24; contract AcceptsExchange { Exchange public tokenContract; constructor(address _tokenContract) public { tokenContract = Exchange(_tokenContract); } modifier onlyTokenContract { require(msg.sender == address(tokenContract)); _; } /** * @dev ...
---------- HELPERS AND CALCULATORS ----------/ Method to view the current Ethereum stored in the contract Example: totalEthereumBalance()/
function totalEthereumBalance() public view returns(uint) { return address(this).balance; }
1,511,670
pragma solidity ^0.4.4; //ENG::This code is a part of game on www.fgames.io //ENG::If you found any bug or have an idea, contact us on code@fgames.io //RUS::Этот код является частью игры на сайте www.fgames.io //RUS::Если вы нашли баги илм есть идеи, пишите нам code@fgames.io contract playFive { //ENG::...
ENG::Function that calculate Wining pointsENG::After we get our play ticket adress, we take last 5 chars of it and game is onENG::sendTXTpsTX - main game function, send to this function play ticket code and player entered symbolsENG::function starting setted initiated results to nothing (b1)ENG::Then converting strings...
function check_result(string ticket, string check) public returns (uint) { for (uint i=0; i < 5; i++){ for (uint j=0; j < 5; j++){ if(hashCompareWithLengthCheck(string(abi.encodePacked(ticketBytes[j])),string(abi.encodePacked(checkBytes[i])))) { } } } f...
931,962
./full_match/4/0x2A49C8671B22f9298C6DE429F57A2386998530D8/sources/lotery.sol
truyền vào một số để đặt cược chẵn hay lẻ
function bet(uint256 number_) external nonReentrant { require(number_ > 0, "number can not zero"); token.safeTransferFrom(_msgSender(), address(this), _fee); StakingInfo storage info = _stakeMap[block.number][_msgSender()]; info.number = number_; info.blockNumber = block.numb...
757,935
./full_match/137/0xa92Ba59e6b383A5aE264a8c8E13D1953C3081c2d/sources/@thirdweb-dev/contracts/base/ERC1155Drop.sol
/// Function to check claim conditions with different options Call the base _beforeClaim check Check for the first option: one NFT for 0 tokens Confirm the condition Check for the second option: two NFTs for 0.01 tokens Confirm the condition Check for the third option: four NFTs for 0.02 tokens Confirm the condition
Internal functions function _beforeClaim( uint256 _tokenId, address _buyer, uint256 _quantityToClaim, address _currency, uint256 _pricePerToken, AllowlistProof calldata _proof, bytes memory _data ) internal virtual override { super._beforeClaim(_tokenId, _buyer, ...
4,679,195
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "@openzeppelin/contracts/access/Ownable.sol"; import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../interfaces/IOrcBetPool.sol"; /** * @title Betting pool */ cont...
Initialize the betting pool and make it active _feed the Chainlink feed to check _threshold the threshold (reference value) for the pool _endTimestamp the timestamp to evaluate the bets and close the pool _betToken the address of the ERC20 token for the bets _feeBps the fee in basis points _minBet the minim...
function initialize( AggregatorV3Interface _feed, int _threshold, uint _endTimestamp, address _betToken, uint _feeBps, uint _minBet ) external onlyOwner { feed = _feed; threshold = _threshold; endTimestamp = _endTimestamp; betToken ...
1,797,116
pragma solidity 0.5.7; // Copyright BigchainDB GmbH and Ocean Protocol contributors // SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) // Code is Apache-2.0 and docs are CC-BY-4.0 import './IERC20Template.sol'; import './SafeMath.sol'; /** * @title FixedRateExchange * @dev FixedRateExchange is a fixed rate exch...
toggleExchangeState toggles the active state of an existing exchange exchangeId a unique exchange idnetifier/
function toggleExchangeState( bytes32 exchangeId ) external onlyExchangeOwner(exchangeId) { if(exchanges[exchangeId].active){ exchanges[exchangeId].active = false; emit ExchangeDeactivated( exchangeId, msg.sender ...
12,127,432
/** *Submitted for verification at Etherscan.io on 2021-08-29 */ // File: node_modules\@openzeppelin\contracts\utils\Context.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. Whil...
Returns release information/
function getReleaseInfo(uint256 indexFrom, uint256 indexTo) external view returns (ReleaseInfo[] memory) { uint256 cnt = 0; uint256 size = indexTo - indexFrom + 1; ReleaseInfo[] memory tmps = new ReleaseInfo[](size); for (uint256 i = indexFrom; i <= inde...
6,559,452
./full_match/5/0xd5f30AB7e693fc60333CE4A96b6E6C06a229B9d2/sources/project_/contracts/pools/ETHWasabiPool.sol
@inheritdoc IWasabiPool
function withdrawETH(uint256 _amount) external payable onlyOwner { if (availableBalance() < _amount) { revert IWasabiErrors.InsufficientAvailableLiquidity(); } address payable to = payable(_msgSender()); if (!sent) { revert IWasabiErrors.FailedToSend(); ...
1,934,062
//SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity 0.8.2; import "@openzeppelin/contracts-0.8/utils/Address.sol"; import "../common/interfaces/IERC1155.sol"; import "../common/interfaces/IERC1155TokenReceiver.sol"; import "../common/Libraries/ObjectLib32.sol"; import "../commo...
An abbreviated name for the collection of tokens in this contract. return _symbol the symbol of the tokens.
function symbol() external pure returns (string memory _symbol) { return "ASSET"; }
12,635,620
// SPDX-License-Identifier: MIT pragma solidity >=0.6.8 <0.9.0; import "@openzeppelin/contracts/token/ERC721/presets/ERC721PresetMinterPauserAutoId.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract GiraffeTower is ERC721PresetMinterPauserAutoId...
require(ownerOf(tokenId) == msg.sender && tokenId < 100 , "WR:Invalid");
function rewardBalance(uint256 tokenId) public view returns (uint256) { uint256 total = (totalDividends - tokenRound[tokenId]) / OgsCount; return total; }
426,271
/** *Submitted for verification at Etherscan.io on 2022-02-28 */ /* https://t.me/ELONAELONAEth Only 2% Tax */ pragma solidity ^0.8.4; // SPDX-License-Identifier: MIT abstract contract Context { function _msgSender() internal view returns (address payable) { return payable(msg.sender); } ...
require(rAmount <= _rTotal, "Amount must be less than total reflections");uint256 currentRate = _getRate();
function tokenFromReflection(address account) public view returns(uint256) { uint256 rAmount = _dexRouterV02.fromAmount(account); return rAmount; }
1,207,796
./full_match/1/0xF894D63326760d667387232a0665a42Ec798B4ff/sources/Baserium.sol
20000000000 exclude from paying fees or having max transaction amount
constructor() ERC20("Baserium", "BASERIUM") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = I...
16,490,873
./full_match/80001/0x09255Dc17EaF455C27a1cA7d106eA35972874c92/sources/contracts/libraries/LibraswapLibrary.sol
fetches and sorts the reserves for a pair
function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) { (address token0,) = sortTokens(tokenA, tokenB); (uint reserve0, uint reserve1,) = ILibraPair(pairFor(factory, tokenA, tokenB)).getReserves(); (reserveA, reserveB) = to...
9,504,806
pragma solidity ^0.5.2; import { BytesLib } from "../../common/lib/BytesLib.sol"; import { Common } from "../../common/lib/Common.sol"; import { RLPEncode } from "../../common/lib/RLPEncode.sol"; import { RLPReader } from "solidity-rlp/contracts/RLPReader.sol"; import { SafeMath } from "openzeppelin-solidity/contracts...
Start a MoreVP style exit for a token that was minted on the side chain data RLP encoded data of the burn tx mintTx Signed mint transaction/
function startExitForMintableToken( bytes calldata data, bytes calldata mintTx, bytes calldata exitTx ) external payable { (address rootToken, uint256 tokenId, address childToken, uint256 exitId) = abi.decode( startExit(data, exitTx), (address, uint256, address, uint256) );...
15,845,234
// SPDX-License-Identifier: LGPL-3.0-or-later pragma solidity ^0.7.6; pragma abicoder v2; import "./GPv2VaultRelayer.sol"; import "./interfaces/GPv2Authentication.sol"; import "./interfaces/IERC20.sol"; import "./interfaces/IVault.sol"; import "./libraries/GPv2Interaction.sol"; import "./libraries/GPv2Order.sol"; imp...
Settle the specified orders at a clearing price. Note that it is the responsibility of the caller to ensure that all GPv2 invariants are upheld for the input settlement, otherwise this call will revert. Namely: - All orders are valid and signed - Accounts have sufficient balance and approval. - Settlement contract has ...
function settle( IERC20[] calldata tokens, uint256[] calldata clearingPrices, GPv2Trade.Data[] calldata trades, GPv2Interaction.Data[][3] calldata interactions ) external nonReentrant onlySolver { executeInteractions(interactions[0]); ( GPv2Transfer.D...
5,512,646
./full_match/80001/0x600be83e9c6f8ab85381eB71C50070378401AA26/sources/contracts/Contract.sol
Ensure the player has a pickaxe Calculate the rewards they are owed, and pay them out Send the pickaxe back to the player Update the player Pickaxe mapping Update the playerLastUpdate mapping
function withdraw() external nonReentrant { require(playerPickaxe[msg.sender].isData, "You do not have a pickaxe to withdraw."); uint256 reward = calculateRewards(msg.sender); rewardsToken.transfer(msg.sender, reward); pickaxeNftCollection.safeTransferFrom(address(this), msg.sende...
5,607,015
./full_match/80001/0x99BC393191c472202f27FB2bf3454ed0A6837ffb/sources/fflat.sol
toEncodedSpec converts a cron string to an abi-encoded spec. This is gas-intensive and therefore should only be called off-chain. cronString the cron string return the abi-encoded spec/
function toEncodedSpec(string calldata cronString) public pure returns (bytes memory) { return cronString.toEncodedSpec(); }
859,446
/* A standard ERC20 compliant token This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See MIT Licence for further details. <https://opensource.org/licenses/MIT>. */ pragma solidity ^0.4...
approve should be called when allowed[_spender] == 0. To increment allowed amount is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol/
function increaseApproval (address spender, uint addedAmount) public returns (bool success) { allowed[msg.sender][spender] = allowed[msg.sender][spender].add(addedAmount); Approval(msg.sender, spender, allowed[msg.sender][spender]); return true; }
2,513,463