file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
// SPDX-License-Identifier: CC-BY-4.0 pragma solidity >=0.4.22 <0.9.0; import "../../common/Version.sol"; import "../../common/Frozen.sol"; import "../../libs/SafeMath.sol"; contract Credit is Version, Frozen { // Using SafeMath for our calculations with uints. using SafeMath for uint; /** @de...
Function to get the whole credit information. return borrower return description return requestedAmount return requestedRepayments return remainingRepayments return interest return returnAmount return state return active return address(this).balance/
function getCreditInfo() public view returns (address, bytes32, uint, uint, uint, uint, uint, uint, State, bool, uint) { return ( borrower, description, requestedAmount, requestedRepayments, repaymentInstallment, remainingRepayments, interest, ...
12,915,672
//SPDX-License-Identifier: Unlicense pragma solidity 0.8.3; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./PSI.sol"; contract DeepGems is ERC721 { constructor(address psiContract, string memory baseURI) ERC721("Deep Gems", "DEEP...
Add psi into new tokenId, minus 5% Add gem to unactivated gems mapping
function reforge(uint256 oldtokenId) public returns (uint256) { require( state_unactivatedGems[oldtokenId] == msg.sender, "gem is already activated, you don't own it, or it does not exist" ); delete state_unactivatedGems[oldtokenId]; uint256 newTokenId = _fo...
14,949,807
// SPDX-License-Identifier: Apache-2.0-or-later /* Copyright 2021 Rigo 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 b...
Creates a new position wrapped in a NFT Call this when the pool does exist and is initialized. Note that if the pool is created but not initialized a method does not exist, i.e. the pool is assumed to be initialized. params The params necessary to mint a position, encoded as `MintParams` in calldata return tokenId Th...
function mint(INonfungiblePositionManager.MintParams calldata params) external payable returns ( uint256 tokenId, uint128 liquidity, uint256 amount0, uint256 amount1 ) { if (Token(params.token0).allowance(address(this), UNIS...
12,971,090
./full_match/1/0x60072780a44D30D4c8852Be8BD12aeC5Ff1253ff/sources/contracts/ETH/convex/DOLA-FRAXBP/convexDFStrat.sol
set new fee config address to fetch fees
function setFeeConfig(address _feeConfig) external onlyOwner { feeConfig = IFeeConfig(_feeConfig); emit SetFeeConfig(_feeConfig); }
2,985,714
./partial_match/56/0xc9bCF3f71E37579A4A42591B09c9dd93Dfe27965/sources/MilkshakeSwapToken.sol
Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as...
function getPriorVotes(address account, uint blockNumber) external view returns (uint256) { require(blockNumber < block.number, "MilkshakeSwap::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { ...
11,154,365
pragma solidity ^0.5.16; import "./ComptrollerInterface.sol"; import "./CTokenInterfaces.sol"; import "./ErrorReporter.sol"; import "./Exponential.sol"; import "./EIP20Interface.sol"; import "./EIP20NonStandardInterface.sol"; import "./InterestRateModel.sol"; /** * @title Compound's CToken Contract * @notice Abstra...
Validates liquidateBorrow and reverts on rejection. May emit logs. cTokenBorrowed Asset which was borrowed by the borrower cTokenCollateral Asset which was used as collateral and will be seized liquidator The address repaying the borrow and seizing the collateral borrower The address of the borrower actualRepayAmo...
function liquidateBorrowVerify( address cTokenBorrowed, address cTokenCollateral, address liquidator, address borrower, uint actualRepayAmount, uint seizeTokens) external { cTokenBorrowed; cTokenCollateral; liquidator; borrower; ...
263,545
//SPDX-License-Identifier: MIT pragma solidity 0.8.10; import { Bridge_Initializer } from "./CommonTest.t.sol"; import { StandardBridge } from "../universal/StandardBridge.sol"; import { L2StandardBridge } from "../L2/L2StandardBridge.sol"; import { CrossDomainMessenger } from "../universal/CrossDomainMessenger.sol"; ...
depositETHTo - emits ETHDepositInitiated - calls optimismPortal.depositTransaction - EOA or contract can call - ETH ends up in the optimismPortal depositETHTo on the L1 bridge should be called the L1 bridge should call L1CrossDomainMessenger.sendMessage TODO: assert on OptimismPortal being called and the event being em...
function test_depositETHTo() external { assertEq(address(op).balance, 0); vm.expectEmit(true, true, true, true); emit ETHDepositInitiated(alice, bob, 600, hex"dead"); vm.expectEmit(true, true, true, true); emit ETHBridgeInitiated(alice, bob, 600, hex"dead"); vm.exp...
6,440,400
// SPDX-License-Identifier: MIT /** * ░█▄░█▒█▀░▀█▀░░▒█▀▄▒▄▀▄░▀▄▀░█▄▒▄█▒██▀░█▄░█░▀█▀░░░▄▀▀▒█▀▄░█▒░░█░▀█▀░▀█▀▒██▀▒█▀▄░▄▀▀ * ░█▒▀█░█▀░▒█▒▒░░█▀▒░█▀█░▒█▒░█▒▀▒█░█▄▄░█▒▀█░▒█▒▒░▒▄██░█▀▒▒█▄▄░█░▒█▒░▒█▒░█▄▄░█▀▄▒▄██ * * Made with 🧡 by Kreation.tech */ pragma solidity ^0.8.9; import {AddressUpgradeable} from "@openzeppelin...
internal logic for computing the pending payment of an `account` given the token historical balances and already released amounts./
function _pendingPayment(address account, uint256 totalReceived, uint256 alreadyReleased) private view returns (uint256) { return (totalReceived * shares[account]) / 10_000 - alreadyReleased; }
14,032,979
//Address: 0x9d8ccb797d92296104f9c1d5676e4de843726462 //Contract name: MyTestToken //Balance: 0 Ether //Verification Date: 2/12/2018 //Transacion Count: 2 // CODE STARTS HERE pragma solidity ^0.4.16; contract owned { address public owner; function owned() public { owner = msg.sender...
0 = unfreeze; 1 = frozen by 10 minutes; 2 = frozen by 30 minutes; 3 = frozen by 1 hour 4 = frozen by 2 hours; 5 = frozen by 1 day; 6 = frozen by 2 days
function freezingStatus() view public returns (string) { if(tipoCongelamento == 0) return ( "Tokens free to transfer!"); if(tipoCongelamento == 1) return ( "Tokens frozen by 10 minutes."); if(tipoCongelamento == 2) return ( "Tokens frozen by 30 minutes."); if(tipoCongela...
12,606,289
./partial_match/1/0xffbaC21a641Dcfe4552920138D90F3638B3c9fba/sources/Governance.sol
Method to claim junk and accidentally sent tokens for Ether any other erc20
function rescueTokens( IERC20 _token, address payable _to, uint256 _balance ) external onlyGovernance { require(_to != address(0), "TORN: can not send to zero address"); if (_token == IERC20(0)) { uint256 totalBalance = address(this).balance; uint256 balance = _balance == 0 ? totalB...
2,613,358
./partial_match/1/0x1de3770476C6B1b6C9D1496594cDf3019F8cB233/sources/Sulfur.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("Sulfur", "SULFUR") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUni...
4,254,131
./partial_match/8453/0x0022e65771d68d1d5cc4959CaB0D7B6Fe8977EbF/sources/Hand.sol
This variable should never be directly accessed by users of the library: interactions must be restricted to the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add this feature: see https:github.com/ethereum/solidity/issues/4637
function _beforeTokenTransfer( address from, address to, uint256 amount function _afterTokenTransfer( address from, address to, uint256 amount } pragma solidity ^0.8.0; } pragma solidity ^0.8.0; struct Counter { }
16,710,866
./full_match/421613/0xc1d97DF7C9991A0f5BB3Bd87d0FceF914167895e/sources/project_/contracts/items/ItemTypes.sol
Returns a list of all active items by tokenID tokenID Id of NFT Store total number of items into a local variable if no items added, return an empty array Loop through the items to determine the count Check if item is in use Increment total Loop through the items Check if item is in use Add itemID to array
function getItemsByTokenID(uint256 tokenID) external view returns (uint256[] memory itemsByToken) { uint256 total = totalItems; uint256 totalByToken = 0; if ( total == 0 ) { return new uint256[](0); for(uint256 i = 1; i < total+1;) { ...
11,572,655
// SPDX-License-Identifier: Unlicense pragma solidity >=0.8.4; import "./PRBMath.sol"; /// @title PRBMathUD60x18Typed /// @author Paul Razvan Berg /// @notice Smart contract library for advanced fixed-point math that works with uint256 numbers considered to have 18 /// trailing decimals. We call this number represent...
Calculates 1 / x, rounding toward zero. Requirements: - x cannot be zero. x The unsigned 60.18-decimal fixed-point number for which to calculate the inverse. return result The inverse as an unsigned 60.18-decimal fixed-point number. 1e36 is SCALE SCALE.
function inv(PRBMath.UD60x18 memory x) internal pure returns (PRBMath.UD60x18 memory result) { unchecked { } }
1,827,472
/* Copyright 2020 Swap Holdings Ltd. 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 writ...
Unset a Trading Rule only callable by the owner of the contract, removes from a mapping senderToken address Address of an ERC-20 token the delegate would send signerToken address Address of an ERC-20 token the consumer would send/
function unsetRule(address senderToken, address signerToken) external onlyOwner { _unsetRule(senderToken, signerToken); }
13,108,801
/** ________ .__ __ __ .__ ________ / _____/_____ | | _____ | | ___/ |_|__| ____ / _____/_____ ____ ____ / \ ___\__ \ | | \__ \ | |/ /\ __\ |/ ___\ / \ ___\__ \ / \ / ___\ \ \_\ \/ __ \| |__/ __ \| < | | | \ \___...
Image URI / Convert string to bytes so we can check if it's empty or not.
function tokenURI(uint256 tokenId) public view override(ERC721Upgradeable) returns (string memory) { require(_exists(tokenId), 'Token does not exist'); return bytes(revealedTokenURI).length > 0 ? string(abi.encodePacked(revealedTokenUR...
1,323,384
pragma solidity 0.5.17; Import Import Import Import Import contract Swap is OwnerPausable, ReentrancyGuard { using SafeERC20 for IERC20; using SafeMath for uint256; using MathUtils for uint256; using SwapUtils for SwapUtils.Swap; SwapUtils.Swap public swapStorage; IAllowlist public allowlis...
A simple method to calculate prices from deposits or withdrawals, excluding fees but including slippage. This is helpful as an input into the various "min" parameters on calls to fight front-running This shouldn't be used outside frontends for user estimates. amounts an array of token amounts to deposit or withdrawal...
function calculateTokenAmount(uint256[] calldata amounts, bool deposit) external view returns(uint256) { return swapStorage.calculateTokenAmount(amounts, deposit); }
2,549,441
./full_match/1/0x60E4d786628Fea6478F785A6d7e704777c86a7c6/sources/contracts/MutantApeYachtClub.sol
Prevent default sequence
function setStartingIndices() external startingIndicesNotSet { require( collectionStartingIndexBlock != 0, "Starting index block must be set" ); uint256 elapsed = getElapsedSaleTime(); require( elapsed >= publicSaleDuration && publicSaleStartTime >...
3,049,522
./full_match/3/0x80D6b8AAb16BfAD41E67AAA0cE30f7b2D0E43297/sources/contracts/DNT2.sol
Declaration of roles in the network. Govern the amount of tokens with a min and a max. Keep track of total burned and minted token. The initial supply of the token. Keep track of number of transactions
{ bytes32 public constant Owner = keccak256("Owner"); bytes32 public constant Minter = keccak256("Minter"); bytes32 public constant Burner = keccak256("Burner"); bytes32 public constant Admin = keccak256("Admin"); bytes32 public constant liquidityProvider = keccak256("liquidityProvider"); ...
14,251,810
pragma solidity ^0.4.18; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // ...
owner = msg.sender; for test's
function ContractStakeToken(address _owner) public { require(_owner != address(0)); owner = _owner; }
13,014,825
pragma solidity ^0.4.4; contract Health { /** * @notice a mapping of companies to companyAddress public keys * * @example * "Medi Corp" -> "0x9L1m03nl0Pc5ns4kh2Kp34kl23fjskoL2m" * companyAddress[companyHash] = Public Key */ mapping (bytes32 => address) public companyAddress; /** * @notice ...
Remove Medicine from companyAddress hash keccak256 hash of Medicine information/
function removeMedicineRecord(bytes32 hash) isRegistered public { delete medicines[keccak256(companies[msg.sender])][hash]; _MedicineRemoved(companies[msg.sender], hash); }
980,829
./partial_match/1/0xf3e5398d52B1D667DB1974741e6fDb7B9EDf90A8/sources/contracts/contract/minipool/RocketMinipool.sol
Returns the address of the minipool's previous delegate (or address(0) if not set)
function getPreviousDelegate() external view returns (address) { return rocketMinipoolDelegatePrev; }
3,594,365
./partial_match/1/0x031AA05Da8bf778dFC36D8D25cA68CBB2fC447c6/sources/contracts/BlurExchange.sol
Cancel an order, preventing it from being matched. Must be called by the trader of the order order Order to cancel/ Assert sender is authorized to cancel order. /
function cancelOrder(Order calldata order) public { require(msg.sender == order.trader); bytes32 hash = _hashOrder(order, nonces[order.trader]); require(cancelledOrFilled[hash] == false, "Order already cancelled or filled"); if (!cancelledOrFilled[hash]) { cancelledOrF...
4,340,315
// SPDX-License-Identifier: MIT pragma solidity >= 0.6.0 <0.8.0; pragma experimental ABIEncoderV2; interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view re...
See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for...
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount)); return true; }
75,196
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; import {MemberToken} from "@orcaprotocol/contracts/contracts/MemberToken.sol"; import {ControllerV1} from "@orcaprotocol/contracts/contracts/ControllerV1.sol"; import {TimelockController} from "@openzeppelin/contracts/governance/TimelockController.so...
Calculate the specific pod guardian role identifier This role is able to remove pod members and veto pod proposals
function getSpecificPodGuardianRole(uint256 _podId) public pure override returns (bytes32) { return keccak256(abi.encode(_podId, "_ORCA_POD", "_GUARDIAN")); }
9,855,901
./partial_match/42/0xE83C770b57F6b5fB5118Aa3fC67f4B9B4bcdf7b6/sources/RewardEscrowV2.sol
Function to allow any address to migrate vesting entries from previous reward escrow / Ensure account escrow balance is not zero / remove address for migration from old escrow / iterate from the nextVestingIndex, skipping already vested entries / iterate and migrate old escrow schedules from vestingSchedules[nextVestin...
function migrateVestingSchedule(address addressToMigrate) external systemActive { require(escrowMigrationPending[addressToMigrate], "No escrow migration pending"); uint numEntries = oldRewardEscrow().numVestingEntries(addressToMigrate); require(totalEscrowedAccountBalance[addressToMigrate]...
8,893,038
./full_match/1/0x678D837fA15eba2B59f6CD5F9F4C580AC2Dfc269/sources/contracts/interfaces/IERC173.sol
ERC-173 Contract Ownership Standard Note: the ERC-165 identifier for this interface is 0x7f5828d0 is ERC165 /
interface IERC173 { event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); function owner() external view returns (address owner_); function transferOwnership(address _newOwner) external; pragma solidity 0.8.10; }
16,595,315
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; interface IController { function jars(address) external view returns (address); function rewards() external view returns (address); function devfund() external view returns (address); function treasury() external view returns (address); f...
Anyone can harvest it at any given time. I understand the possibility of being frontrun But ETH is a dark forest, and I wanna see how this plays out i.e. will be be heavily frontrunned? if so, a new strategy will be deployed. Collects SUSHI tokens 10% is locked up for future gov Donates DUST
function harvest() public override onlyBenevolent { ISushiChef(masterChef).deposit(poolId, 0); uint256 _sushi = IERC20(sushi).balanceOf(address(this)); if (_sushi > 0) { uint256 _keepSUSHI = _sushi.mul(keepSUSHI).div(keepSUSHIMax); IERC20(sushi).safeTransfer( ...
1,137,957
/* * Copyright 2021 ConsenSys Software 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...
Add a token mapping and set the token contract configuration. This can only be called if the token has not been set-up yet. _thisBcTokenContract Address of ERC 721 contract on this blockchain. _otherBcId Blockchain ID where the corresponding ERC 721 contract resides. _otherTokenContract Address of ERC 7...
function addContractFirstMapping( address _thisBcTokenContract, uint256 _otherBcId, address _otherTokenContract, bool _thisIsTheHomeBlockchain ) external { require( hasRole(MAPPING_ROLE, _msgSender()), "ERC721 Bridge: Must have MAPPING role" ...
12,848,648
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {ITokenStore} from './ITokenStore.sol'; import {TokenStore} from './TokenStore.sol'; abstract contract TokenStoreProxy is ITokenStore { /* ========== EVENTS ========== */ event TokenStoreChanged( address indexed operator, address...
========== EVENTS ========== / ========== STATE VARIABLES ========== / ========== VIEW FUNCTIONS ========== /
function totalSupply() public view override returns (uint256) { return TokenStore(tokenStore).totalSupply(); }
5,469,480
pragma ton-solidity >=0.42.0; pragma AbiHeader time; pragma AbiHeader pubkey; pragma AbiHeader expire; //================================================================================ // /// @title DNSDebot /// @author Augual.Team /// @notice Debot for Augual.DeNS service //=========================================...
========================================
function onWhoIs(DnsWhois _whoisInfo) public { ctx_whois = _whoisInfo; string regType; ctx_whois.domainName, ctx_whois.endpointAddress.value, ctx_whois.comment, ctx_whois.ownerAddress.value, ctx_whois.dtCreated, ctx_whois.dtExpires, ...
13,073,314
./full_match/137/0xfb7505d89307F2F97A2247B4795C11F9efc90A26/sources/contracts/CourseContract.sol
Teacher Functions"Start Course" Button, locks in enrollments and sponsorship payments
function updateCourseStatus() external onlyRole(TEACHER){ require(courseStatus==false); require(paymentStatus==true); require(payment == sponsorshipTotal, "Course has not been fully sponsored yet :("); uint256 studentFunds = address(this).balance - sponsorshipTotal; require(s...
4,725,665
./partial_match/1/0xc6fF1586F8Cb450aDC29Ea4de8B96286154f5b84/sources/Methereum.sol
approve token transfer to cover all possible scenarios add the liquidity
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { _approve(address(this), address(dexRouter), tokenAmount); address(this), tokenAmount, liquidityWallet, block.timestamp ); }
11,032,892
./full_match/7001/0x031583961EE654951353Bea6d34338Ac26E90A4A/sources/contracts/ZetachainAthens3/ZetaRegistry_zetachain.sol
internal function to check if domain is expired tokenId tokenID of the token being checked return bool true if domain is expired/
function isExpired(uint256 tokenId) internal view returns (bool) { if (registryLookUp[tokenId].expirationDate == 0) return true; return registryLookUp[tokenId].expirationDate < block.timestamp; }
13,228,716
pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-tran...
Private sale minting (reserved for toad owners)
function mintWithToad(uint toadId) public nonReentrant { require(mintIsActive, "Mint must be active to mint"); require(toadContract.ownerOf(toadId) == msg.sender, "Not the owner of this toad"); require(!_exists(toadId), "This toad already has sockz."); _safeMint(msg.sender, toadId);...
1,986,940
// SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity 0.8.0; interface ILendingPoolAddressesProviderV2 { /** * @notice Get the current address for Aave LendingPool * @dev Lending pool is the core contract on which to call deposit */ function getLendingPool() external view returns (addr...
Get the total bAsset value held in the platform _aToken aToken for which to check balance return balance Total value of the bAsset in the platform/
function _checkBalance(IAaveATokenV2 _aToken) internal view returns (uint256 balance) { return _aToken.balanceOf(address(this)); }
626,337
pragma solidity ^0.4.19; pragma experimental ABIEncoderV2; contract Anticorruption{ struct BasicInfo{ // Basic info of every entity } struct SchemesInfo{ // Schemes basic Info } function AddEntity(uint AdharcardNo, string name, address BankAccountNo) { // Add...
GetMoneyForEntityForPerticularSchemes
function MoneyForEntityForPerticularSchemes(string name) returns (uint Money) { }
5,458,865
pragma solidity ^0.8.0; // SPDX-License-Identifier: MIT /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount...
Safe swingby transfer function, just in case if rounding error causes pool to not have enough SWINGBYs.
function safeSWINGBYTransfer(address _to, uint256 _amount) internal { uint256 swingbyBal = swingby.balanceOf(address(this)); if (_amount > swingbyBal) { swingby.transfer(_to, swingbyBal); swingby.transfer(_to, _amount); } }
13,914,158
/** *Submitted for verification at Etherscan.io on 2021-09-05 */ /** *Submitted for verification at Etherscan.io on 2021-08-27 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implemente...
Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner./
function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "zero address"); _setOwner(newOwner); }
6,711,127
//Address: 0x0e786d42fd70e4a51ab5f80aa5da19e74337e7f2 //Contract name: Swap //Balance: 0 Ether //Verification Date: 4/16/2018 //Transacion Count: 160 // CODE STARTS HERE pragma solidity ^0.4.20; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function m...
\x18Bitcoin Signed Message:\n{message.size.chr}{message}
function createBSMHash(string payload) pure internal returns (bytes32) { string memory prefix = "\x18Bitcoin Signed Message:\n"; return sha256(sha256(prefix, bytes1(bytes(payload).length), payload)); }
5,398,964
./full_match/97/0xfe6DeA2E52214BDa566B68694D950037fc53755C/sources/MediTown.sol
owner withdraw the nft when it is not borrowed
function withdrawnft( uint256 nft_id, address nft_programe_address, uint256 gameland_nft_id ) public { require(!borrow_or_not[gameland_nft_id], "The nft is borrowed"); require( msg.sender == nft_owner[gameland_nft_id], "Only owner can withdraw NFT"...
3,282,052
./partial_match/1/0x4236daD647Dfd74C102089731174f1EbE170287f/sources/IRule.sol
IRule IRule interface./
interface IRule { function isTransferValid( address _from, address _to, uint256 _amount) external view returns (bool isValid); function detectTransferRestriction( address _from, address _to, uint256 _amount) external view returns (uint8); function canReturnTransferRestrictionCode(uint8 _restrictionC...
15,911,813
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./FreeRiderNFTMarketplace.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "./FreeRiderBuyer.sol"; interface UniswapV2Pair { function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; } interface IUnis...
exchange the loaned weth to eth buy all nfts for free with a single 15 eth loan, because of the bug in the marketplace contract that incorrectly determines the seller's address as the buyer's in line 80 exchange back the 15 eth to weth pay back the flash loantransfer them to buyer
function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external override { weth.withdraw(amount0); weth.transfer(address(uniswapPair), weth.balanceOf(address(this))); for (uint256 i = 0; i < tokenIds.length; i++) { nft.safeTransferFrom(address(thi...
12,872,043
./full_match/5/0x21d0608b0944147199E4a63C97678f47E69B6c70/sources/ParagonsDAOPlayerXP.sol
Remove `_minter` from having minting right _minter Address that will have minting rights removed
function removeMinter(address _minter) external onlyOwner { minter[_minter] = false; }
1,926,768
./partial_match/1/0x7F8ea0146D78d90dbD215956d36a3E6c3694B8f4/sources/LSDStakingPool.sol
Get Claim Amount By LP Staking
function getClaimAmountByLP( address _address ) public view override returns (uint256) { UserByLP memory user = usersByLP[_address]; if (block.timestamp >= user.lastTime + ONE_DAY_IN_SECS) { IUniswapV2Pair pair = IUniswapV2Pair(uniLPAddress); ( ui...
4,094,076
/** * SEED Platform Generator ATDeployer */ pragma solidity ^0.5.2; /** * @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 *...
Add the subscriber to the whitelist. _subscriber The subscriber to add to the whitelist. _maxAmnt max amount that a subscriber can hold (in set tokens)./
function addToWhitelist(address _subscriber, uint256 _maxAmnt) external onlyWLOperators { require(_subscriber != address(0), "_subscriber is zero"); require(!whitelist[_subscriber].permitted, "already whitelisted"); whitelistLength++; whitelist[_subscriber].permitted = true; ...
896,011
./full_match/1/0x3c1164531d5857029ae5412E49999306547834d8/sources/@rmrk-team/evm-contracts/contracts/RMRK/equippable/RMRKMinifiedEquippable.sol
@inheritdoc IERC5773/
function isApprovedForAllForAssets( address owner, address operator ) public view virtual returns (bool) { return _operatorApprovalsForAssets[owner][operator]; }
9,657,760
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../../ValueVaultMaster.sol"; interface IStrategy { function approve(IERC20 _token) external; function approveForSpender(IERC20 _token, a...
See {IStrategy-deposit}./
function deposit(address _vault, uint256 _amount) public override _non_reentrant_ { require(valueVaultMaster.isVault(msg.sender), "sender not vault"); sodaPool.deposit(poolMap[_vault].poolId, _amount); _balances[_vault] = _balances[_vault].add(_amount); }
12,956,058
./partial_match/1/0xAb01E3b18b5611f44081408454A6A25f5110C11C/sources/XRPM.sol
calculate fee burn the tokenssend the fee to the contract
function _transfer( address sender, address recipient, uint256 amount ) internal override { require(amount > 0, "Transfer amount must be greater than zero"); require(!blacklisted[sender] && !blacklisted[recipient], "Error: Blacklsited!"); if (!exemptFee[sender] &...
3,549,813
./full_match/80001/0x43414E03A16Db12Fc93517102c0E87Ae4bE431db/sources/contracts/upgradeable/tokens/Vehicles.sol
solhint-disable-next-line ordering, func-name-mixedcase
function __Vehicles_init_unchained() internal onlyInitializing { nextTokenId = 1; }
5,573,314
pragma solidity 0.4.24; import "./SafeMath.sol"; /** * @title Roles * @dev Library for managing addresses assigned to a Role. * @dev more info: https://github.com/OpenZeppelin/openzeppelin-contracts/tree/release-v2.3.0/contracts/access */ library Roles { struct Role { mapping (address => bool) bearer;...
CouncilAmount get the amount of white list return the amount of white list/
function CouncilAmount() public view returns (uint256) { return CouncilAddress.length; }
1,787,093
./full_match/4/0xf5A75c51a5Eec837feA1F0e774969acb2CBbBe9F/sources/contracts/features/token/ERC1155/base/ERC1155BaseInternal.sol
revert if applicable transfer recipient is not valid ERC1155Receiver operator executor of transfer from sender of tokens to receiver of tokens id token ID amount quantity of tokens to transfer data data payload/
function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155Received( ...
813,700
./full_match/3/0xb528830ae89d61cd0CC36B8D760B8F7a00A9C040/sources/contracts/GameCompetition.sol
This function is called to find whether a game competitor
function getWinnerGameCompetitor(uint256 competitionId) public view returns ( address sender, address winner, uint256 winningDate ) { WinnerGameCompetition storage c = _winnerGameCompetitionMapping[competitionId]; return (...
8,210,783
/** *Submitted for verification at Etherscan.io on 2022-03-23 */ // SPDX-License-Identifier: MIT pragma solidity 0.8.9; abstract contract Context { function _msgSender() internal vi...
exclude from paying fees or having max transaction amount
constructor() ERC20("Endgame", "ENDGAME") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair =...
10,497,904
// SPDX-License-Identifier: GPL-3.0-or-later // 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 dis...
_token0 == swapRequest.tokenOut
function _getSwapBalanceArrays( SwapRequest memory swapRequest, uint256 balanceTokenIn, uint256 balanceTokenOut ) private view returns ( uint256[] memory balances, uint256 indexIn, uint256 indexOut ) { balanc...
1,706,653
./partial_match/1/0xc8024fB5C7beD98CcE0e498E54B7D89816B3521B/sources/GenesisLiquidityPool.sol
Changes the value of the base redeem fee Max allowed value is 0.5%
function setRedeemFee(uint32 value) external onlyOwner { require(value <= 5000); baseRedeemFee = value; }
3,668,717
./full_match/80001/0xf4f036a18961f7Ab421145bac1f27f0F73BFb643/sources/contracts/Role.sol
add a single privilege to role _roleName (string) _privilegeHash (bytes32)/
function addRolePrivilege( string memory _roleName, bytes32 _privilegeHash ) private returns (bytes32[] memory) { roles[_roleName].privileges.push(_privilegeHash); return roles[_roleName].privileges; }
5,596,786
pragma solidity ^0.4.22; import "zeppelin-solidity/contracts/token/ERC20/ERC20.sol"; import '../moneyflow/ether/WeiExpense.sol'; import '../IDaoBase.sol'; /** * @title WeiGenericTask * @dev Basic contract for WeiTask and WeiBounty * * 4 types of tasks: * PrePaid * PostPaid with known neededWei amount * ...
who will complete this task
function setEmployee(address _employee) external onlyOwner { emit WeiGenericTask_SetEmployee(_employee); employee = _employee; }
12,972,955
/** *Submitted for verification at Etherscan.io on 2022-04-14 */ // SPDX-License-Identifier: MIT pragma solidity ^0.5.17; // File @openzeppelin/contracts/GSN/[email protected] /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these ar...
Overridden to allow for updatable exchange rate return the number of token units a buyer gets per wei./
function rate() public view returns (uint256) { return _exchangeRate; }
2,150,424
./full_match/80001/0xd1dDAbD98265B2971eE35BD1406A31EF4D0A7F9f/sources/contracts/LKRoyalties.sol
LK_Sec_Owners memory lkm;
function get_LK_Royalties_sales_data(uint tid, uint256 arrayid) public view returns (LK_Sec_Owners memory lkm){ lkm=Token_LK[tid].LK_Sales_Details[tid][arrayid]; return(lkm); }
5,592,066
./full_match/5/0xd102E26AF31bC307B665d7B012c65E7b106C9B6C/sources/contracts/MetaLegions.sol
Set a new URI for token
function setTokenURI(uint256 _tokenId, string memory _baseURI) public onlyOwner { (uint256 batchId, ) = _getBatchId(_tokenId); if (isEncryptedBatch(batchId)) { revert("Not for delayed tokens."); _setBaseURI(batchId, _baseURI); emit onURIChange...
7,043,750
./partial_match/1/0x5874C8b973Ec5dFf6827887DCd0c4d79D268f816/sources/MotoDogs.sol
Update token price in USD. newPrice The new token price/
function setUSDPrice(uint256 newPrice) external onlyOwner { usdPrice = newPrice; }
4,379,674
./full_match/3/0x099119D769525b8C8170003601cC6Df0eF1d15D4/sources/contracts/Bidify.sol
Support receiving NFTs function supportsInterface(bytes4 interfaceId) external pure override returns (bool) { return interfaceId == 0x150b7a02; }
function onERC721Received(address operator, address, uint256 tokenId, bytes calldata) external returns (bytes4) { require(operator == address(this), "someone else sent us a NFT"); _lastReceived = tokenId; return IERC721Receiver.onERC721Received.selector; }
14,175,646
pragma solidity ^0.5.17; import "../../openzeppelin/Ownable.sol"; import "../../interfaces/IERC20.sol"; import "../Staking/IStaking.sol"; import "../IFeeSharingProxy.sol"; import "./IVestingFactory.sol"; import "./IVesting.sol"; import "./ITeamVesting.sol"; import "../../openzeppelin/SafeMath.sol"; contract VestingRe...
sets vesting factory address _vestingFactory the address of vesting factory contract/
function setVestingFactory(address _vestingFactory) public onlyOwner { _setVestingFactory(_vestingFactory); }
12,638,126
./full_match/1/0xBf618CCb282e5De9D4BDB76E8584504D235A2Cc8/sources/contracts/LisaCrowdsaleSimple.sol
Returns AT allocation for a given buyer. owner Address of the seller or a participant of this crowdsale. return uint256 Amount of AT tokens allocated for a given buyer./
function getAllocationFor( address owner ) public view override returns (uint256) { if (status() == CrowdsaleStatus.SUCCESSFUL && owner != seller) { return 0; } return getTokenAmount(allocationsBT[owner]); }
4,824,248
/** *Submitted for verification at Etherscan.io on 2020-02-11 */ // File: @aragon/os/contracts/common/EtherTokenConstant.sol /* * SPDX-License-Identitifer: MIT */ pragma solidity ^0.4.24; // aragonOS and aragon-apps rely on address(0) to denote native ETH, in // contracts where both tokens and ETH are accept...
Open a sell order worth `@tokenAmount(self.token(): address, _amount)` against `_collateral.symbol(): string` _seller The address of the seller _collateral The address of the collateral token to be returned _amount The amount of bonded token to be spent/
function openSellOrder(address _seller, address _collateral, uint256 _amount) external auth(OPEN_SELL_ORDER_ROLE) { require(isOpen, ERROR_NOT_OPEN); require(_collateralIsWhitelisted(_collateral), ERROR_COLLATERAL_NOT_WHITELISTED); requ...
451,662
./partial_match/80001/0x66B8c38b52Cf69B543f0eA0FdAcf701Cf7502703/sources/contracts/BundleV1.sol
Set the settlement token contract/
function setSettlementToken(address tokenAddress) public virtual { require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "BundleCollection: must have admin role to modify"); settlementToken = IERC20(tokenAddress); }
8,815,135
./full_match/137/0xc4e40bEa23cd8Bb669A3E7Cf7a5BE7c60a3AEb0c/sources/contracts/Atricrypto3.sol
If no enough amount of free funds can transfer will trigger exit position get updated, accurate value to withdrawEnter position again
function withdraw() external returns (bool) { require(TAG == true, 'TAG ERROR.'); uint256 withdraw_amount = balanceOf(msg.sender); uint256 value = withdraw_amount.mul(totalAssets).div(totalSupply_); User memory user = users[msg.sender]; uint256[5] memory splitValue = getSpli...
3,746,242
/** * Copyright CENTRE SECZ 2018 - 2021 * * 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, modify, merge, pub...
Increases the minter's allowance if and only if the minter is an active minter. An minter is considered active if minterManager.isMinter(minter) returns true./
function incrementMinterAllowance(uint256 _allowanceIncrement) public onlyController returns (bool) { require( _allowanceIncrement > 0, "Allowance increment must be greater than 0" ); address minter = controllers[msg.sender]; requir...
5,429,416
./full_match/1/0x1aa960084BA2Ad046DB652c9a7169e3BF6dcDb72/sources/src/vaults/yields/YieldVaultUpgradeable.sol
@inheritdoc BaseVaultUpgradeable
function previewBurnDebt(uint256) public pure override returns (uint256) {}
9,608,840
// File: contracts/base/ReentrancyGuard.sol // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be a...
This function is used to unstake the staked tokens. PS: tokens which are locked cannot be unstaked within lockoutTime of locking period uint token-ids are taken in an array format.
function unstakeTokens(uint[] memory tokenIds) external isNotPaused{ claimRewards(tokenIds); for (uint i; i< tokenIds.length; i++) { stake storage currentToken = stakedTokens[tokenIds[i]]; userStaked[msg.sender][currentToken.arrayPosition] = userStaked[msg.sender][userStaked[...
6,293,572
pragma solidity 0.4.24; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper...
The Ownable constructor sets the original `owner` of the contract to the sender account./
function Ownable() { owner = msg.sender; }
937,102
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; import "./IExternalTokenTypeImplementation.sol"; /** * @title An extendable type of implementation, for an executable token type. * Extends the `IExternalTokenTypeImplementation` interface. * @author Veronica Coutts <hello@vee.dev> @vonnie610 (twi...
An extendable type of implementation, for an executable token type. Extends the `IExternalTokenTypeImplementation` interface. Veronica Coutts <hello@vee.dev> @vonnie610 (twitter) A standard for an executable token type, specifying how the executable data is formatted and accessed./
interface IExecutableTokenType is IExternalTokenTypeImplementation { function getImplementationType() external view override returns (bytes32 implementationType); function getExecutables(uint256 _tokenId) external view returns ( address[] memo...
1,831,023
// File: openzeppelin-solidity-2.3.0/contracts/ownership/Ownable.sol pragma solidity ^0.5.16; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * This module is used through inheritanc...
Mint function to mint a new token given a tokenId and assign it to an address Reverts if the tokenId is 0 or the token already exist to address the address to assign the token to tokenId uint256 ID of the token to mint/
function mintWithTokenURI( address to, uint256 tokenId, string memory uri ) public onlyOwner isValidAddress(to) { require(bytes(uri).length > 0, "URI must be supplied"); _mint(to, tokenId); tokenURIs[tokenId] = uri; emit TokenURISet(tokenId, uri); } ...
211,533
// SPDX-License-Identifier: MIT // File: contracts/MerkleProof.sol // OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Trees proofs. * * The proofs can be generated using the JavaScript library ...
See {IPausable-setSaleState}. Requirements: - Caller must be the contract owner./
function setSaleState( SaleState newState_ ) external onlyOwner { _setSaleState( newState_ ); }
14,920,313
//Address: 0xa7776e2595053414f21f903e5270973d3292b659 //Contract name: Crowdsale //Balance: 0 Ether //Verification Date: 3/5/2018 //Transacion Count: 5 // CODE STARTS HERE pragma solidity ^ 0.4.17; library SafeMath { function mul(uint a, uint b) pure internal returns(uint) { uint c = a * b; ass...
allow on manual addition of contributors _backer {address} of contributor to be added @parm _amountTokens {uint} tokens to be added
function addManualContributor(address _backer, uint _amountTokens) external onlyOwner() { Backer storage backer = backers[_backer]; backer.tokensToSend = backer.tokensToSend.add(_amountTokens); if (backer.tokensToSend == 0) backersIndex.push(_backer); total...
7,269,753
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGu...
_from: block timestamp from which the reward is calculated _to: block timestamp before which the reward is calculated return Return reward multiplier over the given _from to _to block/
function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256) { return (rewardPerDay * (_to - _from)) / 1 days; }
5,353,300
pragma solidity ^0.5.12; import "./IERC721.sol"; import "./IRC721Receiver.sol"; import "./PandaStorage.sol"; contract PandaToken is IERC721, Ownable, PandaStorage, Initializable{ function initialize(string memory _tName, string memory _tSymbol) public initializer{ _TokenName= _tName; _TokenSymbo...
Enable or disable approval for a third party ("operator") to manage all of `msg.sender`'s assets Emits the ApprovalForAll event. The contract MUST allow multiple operators per owner. _operator Address to add to the set of authorized operators _approved True if the operator is approved, false to revoke approval
function setApprovalForAll(address _operator, bool _approved) external{ require( msg.sender != address(0),"ERROR: it is the 0 address"); require(_operatorApproval[msg.sender][_operator] != _approved,"ERROR: Operator flag is the same as sent value"); _operatorApproval[msg.sender][_operator] ...
958,852
./partial_match/40/0x42341F9AEe18EeDf64953C4A9ce9fBa8D4b13C6A/sources/perpetuals/core/VaultPriceFeed.sol
If flag is raised we shouldn't perform any critical operations
function getPrimaryPrice(address _token, bool _maximise) public override view returns (uint256) { address priceFeedAddress = priceFeeds[_token]; require(priceFeedAddress != address(0), "VaultPriceFeed: invalid price feed"); if (chainlinkFlags != address(0)) { bool isRaised = ICh...
8,825,903
//Address: 0x2cc6ca9c3023a6a876fd54a03f68281c7aad0e8b //Contract name: ICOPreSale //Balance: 0 Ether //Verification Date: 6/14/2018 //Transacion Count: 6 // CODE STARTS HERE pragma solidity ^0.4.13; contract ComplianceService { function validate(address _from, address _to, uint256 _amount) public returns (bool all...
Registers how many tokens have each investor and how many ethers they spent (When ICOing through PayIn this function is not called)/
function deposit(address _investor, uint256 _tokenAmount) onlyICOContract public payable returns (bool) { if (state != State.Active) { error('deposit: state != State.Active'); return false; } deposited[_investor] = deposited[_investor].add(msg.value); tokensAcquired[_investor] = tokensAcquired[_investor]...
6,402,480
./full_match/5/0xbD6f49305069Ad9285d1673a3b6e2c9e41f480F9/sources/browser/GCLub.sol
Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openzeppelin-contracts/pull/522
function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SM: multip ovf"); return c; }
1,948,733
./full_match/1/0x717Cd7F661960da49396707844c014A0f91Bbdf6/sources/contracts/AlluoVaultUpgradeable.sol
Claims all rewards Used when looping rewards
function claimRewardsFromPool() public { (, , , address pool, , ) = CVX_BOOSTER.poolInfo(poolId); ICvxBaseRewardPool(pool).getReward(); }
17,084,791
// File: contracts\lib\TransferHelper.sol // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.6; // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove(address token, address to, uint value) intern...
Unfreeze token, ntoken and nest balances Balances ledger tokenAddress Destination token address tokenValue token amount ntokenAddress Destination ntoken address ntokenValue ntoken amount nestValue nest amount If tokenAddress is ntokenAddress, add it to ntokenValue tokenAddress is not ntokenAddress, unfreeze it If...
function _unfreeze3( mapping(address=>UINT) storage balances, address tokenAddress, uint tokenValue, address ntokenAddress, uint ntokenValue, uint nestValue ) private { UINT storage balance; if (ntokenAddress == tokenAddress) { ...
52,795
./partial_match/8453/0x1934d4E056D534Edb1BB2169a99aCEF584dcb8bf/sources/BoobsToken.sol
Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as...
function getPriorVotes(address account, uint blockNumber) external view returns (uint256) { require(blockNumber < block.number, "cub::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0...
16,724,821
// SPDX-License-Identifier: MIT pragma solidity >=0.5.16 <0.7.0; library TokenFlags { uint32 internal constant BIT_PAUSABLE = 0; uint32 internal constant BIT_MINTABLE = 1; uint32 internal constant BIT_BURNABLE = 2; uint32 internal constant BIT_ETH_REFUNDABLE = 3; uint32 internal constant BIT_ERC2...
Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`...
function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "Transfer from the zero address"); require(recipient != address(0), "Transfer to the zero address"); _beforeTokenTransfer(sender, recipient, a...
13,669,161
./full_match/1/0xD8969609d81d4D72dc0a4cF533178Bf72788d9F3/sources/contracts/vaults/SingleAssetVaultBase.sol
solhint-disable-next-line not-rely-on-time
function _calculateLockedProfit() internal view returns (uint256) { uint256 lockedFundRatio = (block.timestamp - lastReport) * lockedProfitDegradation; return lockedFundRatio < DEGRADATION_COEFFICIENT ? lockedProfit - (lockedFundRatio * lockedProfit) / DEGRADATION_COEFFICIENT : 0; }
4,964,689
pragma solidity ^0.5.0; // Safe math library SafeMath { function add(uint a, uint b) internal pure returns (uint c) { c = a + b; require(c >= a); } function sub(uint a, uint b) internal pure returns (uint c) { require(b <= a); c = a - b; } function mul(...
Returns the Wei balance of the vault contract ALL TOKENS UNCLUDING ETHER ARE DISPLAYED AS 10^-18 THE BASE UNIT OF CURRENCY
function getEthBalance() public view returns(uint) { return address(this).balance; }
893,039
./full_match/80001/0xa0Ea6B1FCaF8d5b61152E7757CDa5F3ca10c37E5/sources/contracts/ERC3525GettingStarted.sol
from_ がオペレーターかトークンの所有者であることの確認は重複するため不要 require( from_ == ownerOf(tokenId_) | msg.sender == owner, "ERC3525GettingStarted: transfer of token that is not owned" ); to が認証済であることを確認
function transferFrom( address from_, address to_, uint256 tokenId_ ) public payable virtual override { require( "ERC3525GettingStarted: transfer to unauthorized recipient" ); transferFrom(from_, to_, tokenId_); }
9,467,660
./full_match/80001/0xf9Aab85a7e2C91dBDc105D8D7f6912d340372306/sources/FlashloanDodo.sol
Note: CallBack function executed by DODOV2(DVM) flashLoan pool
function DVMFlashLoanCall( address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data ) external { _flashLoanCallBack(sender, baseAmount, quoteAmount, data); }
5,648,326
// SPDX-License-Identifier: AGPL-3.0-only //Code from: https://github.com/m1guelpf/lil-web3/blob/main/src/LilFlashloan.sol pragma solidity ^0.8.13; import { ERC20 } from "@rari-capital/solmate/src/tokens/ERC20.sol"; /// @title Flash Borrower Interface /// @author Miguel Piedrafita /// @notice Contracts must implemen...
Update the fee percentage for a specified ERC20 token, only available to the manager of the contract token The ERC20 token you're updating the fee percentage for fee The fee percentage for this token, multiplied by 100 (for example, 10% is 10_00)
function setFees(ERC20 token, uint256 fee) public payable { if (msg.sender != manager) revert Unauthorized(); if (fee > 100_00) revert InvalidPercentage(); emit FeeUpdated(token, fee); fees[token] = fee; }
5,516,881
pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/introspection/ERC165.sol"; import "./IRegistry.sol"; contract Registry is IRegistry, ERC165 { struct OrganizationRegistration { bytes32 organizationName; address owner; // member indexing note: // case (members[some...
check to see if this organization exists check to see if this repo exists
function getTypeRepositoryByName(bytes32 orgName, bytes32 repositoryName) external view returns (bool found, bytes32 name, bytes32 path, bytes uri, bytes32[] tags) { if(orgsByName[orgName].organizationName == bytes32(0x0)) { found = false; return; } if(o...
12,630,422
./full_match/1/0x60e31A1a38213Ec3Ba1C7345EA49C8b57f7bA4D7/sources/browser/ERC2665V1.sol
ERC-721 Non-Fungible Token Standard, optional metadata extension See https://eips.ethereum.org/EIPS/eip-721 Note: the ERC-165 identifier for this interface is 0x5b5e139f.
interface ERC721Metadata /* is ERC721 */ { function name() external view returns(string memory _name); function symbol() external view returns(string memory _symbol); function tokenURI(uint256 _tokenId) external view returns(string memory); } }
8,304,849
// File: @openzeppelin/contracts/introspection/IERC1820Registry.sol pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the global ERC1820 Registry, as defined in the * https://eips.ethereum.org/EIPS/eip-1820[EIP]. Accounts may register * implementers for interfaces in this registry, as well as query support...
Returns list of transaction IDs in defined range. from Index start position of transaction array. to Index end position of transaction array. pending Include pending transactions. executed Include executed transactions. return _transactionIds Returns array of transaction IDs.
function getTransactionIds( uint256 from, uint256 to, bool pending, bool executed ) public view returns (uint256[] memory _transactionIds) { uint256[] memory transactionIdsTemp = new uint256[](transactionCount); uint256 count = 0; uint256 i; for (i...
13,496,426
pragma solidity 0.7.0; library AdditionalMath { using SafeMath for uint256; function max16(uint16 a, uint16 b) internal pure returns (uint16) { return a >= b ? a : b; } function min16(uint16 a, uint16 b) internal pure returns (uint16) { return a < b ? a : b; } /** ...
the max locked tokens in most cases will be in the current period but when the staker locks more then we should use the next period unbond worker if staker withdraws last portion of NU
function withdraw(uint256 _value) external onlyStaker { uint16 currentPeriod = getCurrentPeriod(); uint16 nextPeriod = currentPeriod + 1; StakerInfo storage info = stakerInfo[msg.sender]; uint256 lockedTokens = Math.max(getLockedTokens(info, currentPeriod, nextPeriod), ...
7,397,461
//Address: 0x91923a5fe80e1246aa137e8bcc0ec94d42432ab0 //Contract name: OptionsExchange //Balance: 0 Ether //Verification Date: 3/1/2018 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.20; /* Options Exchange ======================== An Exchange for American Options, which are also reversible until ...
Transfer funds from an Option to a user's balance. Not externally callable.
function transferOptionToUser(bytes32 optionHash, address to, address token, uint256 amount) private { require(optionBalance[optionHash][token] >= amount); optionBalance[optionHash][token] = optionBalance[optionHash][token].sub(amount); userBalance[to][token] = userBalance[to][token].add(amount); }
1,008,260
./partial_match/1/0x21A7288DDca0Cf406d0dF0c8A1Db15F94Caf4bEc/sources/@spanning/contracts/Spanning.sol
Creates a function request for a delegate to execute. Note: This can result in either a local or cross-domain transaction. programAddress - Address to be called payload - ABI-encoding of the desired function call/
function makeRequest(bytes32 programAddress, bytes memory payload) internal virtual { delegate_.makeRequest(programAddress, payload); }
4,024,910
pragma solidity ^0.5.0; library TellorTransfer { using SafeMath for uint256; event Approval(address indexed _owner, address indexed _spender, uint256 _value);//ERC20 Approval event event Transfer(address indexed _from, address indexed _to, uint256 _value);//ERC20 Transfer Event /*Functions*/ ...
Allows the user to get the latest value for the requestId specified _requestId is the requestId to look up the value for return bool true if it is able to retreive a value, the value, and the value's timestamp/
function getCurrentValue(uint256 _requestId) public view returns (bool ifRetrieve, uint256 value, uint256 _timestampRetrieved) { return getDataBefore(_requestId,now); }
1,755,528
./partial_match/1/0xe3587F0EA66a16Dc34A3614d6b6c6Ca67513bbca/sources/DOGBIE.sol
Maximum tx size and wallet size exclude from paying fees or having max transaction amount
constructor() ERC20("DOGBIE", "DOGBIE") { address uniswapRouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(uniswapRouter); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Rout...
2,584,575
pragma solidity ^0.5.0; import "../openzeppelin-solidity/contracts/math/SafeMath.sol"; import "../openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol"; import "./Claimable.sol"; import "./IFund.sol"; contract Governance is Claimable { using SafeMath for uint256; IFund public fund; ERC20Detailed...
Start new poll _targetContract address of contract where we want to execute transaction _transaction transaction to be executed _startTime voting start time _endTime voting close time/
function newPoll( address _targetContract, bytes memory _transaction, uint256 _startTime, uint256 _endTime ) public onlyFundHolder { require(state == State.Votable); require(_targetContract != address(0)); require(_startTime >= now && _endTime > _startTime); require(_tran...
5,441,069
// SPDX-License-Identifier: MIT pragma solidity 0.7.4; pragma experimental ABIEncoderV2; import "./CannonState.sol"; import "./TicketFactory.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; /** * @title Nifty Cannon * @author Cliff Hall * @notice Allows direct or deferred transfer of NFTs from one sender ...
Claim a specific Volley awaiting the caller There must be one or more Volleys awaiting the recipient This contract must already be approved as an operator for the NFTs specified in the Volley. _index the index of the volley in the recipient's list of will-call volleys/ Pick up the specified volley
function claimVolley(uint256 _index) external { require(pickupVolley(_index), "Will call pickupVolley failed"); }
1,069,503