file_name
stringlengths
71
779k
comments
stringlengths
0
29.4k
code_string
stringlengths
20
7.69M
__index_level_0__
int64
2
17.2M
/* .'''''''''''.. ..''''''''''''''''.. ..'''''''''''''''.. .;;;;;;;;;;;'. .';;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;,. .;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;,. .;;;;;;;;;,. .,;;;;;;;;;;;;;;;;;;;;,. .;;;;;;;;;;;;;;;;;;;;,. ';;;;;;;;'. .';;;;;;;;;;;;;;;;;;...
ensure enough curve.fi pool tokens are available Check if current available amount of TUSD is enough and withdraw remainder from gauge neededAmount amount required/
function withdrawFromGaugeIfNecessary(uint256 neededAmount) internal { uint256 currentlyAvailableAmount = curvePool.token().balanceOf(address(this)); if (currentlyAvailableAmount < neededAmount) { curveGauge.withdraw(neededAmount.sub(currentlyAvailableAmount)); } }
1,201,455
./full_match/42/0x61584B0EC1f8e324510b661aF252216Da6d38E7F/sources/contracts/aave.sol
encode payload to later receive it in `executeOperation` (thus avoiding use of storage)console.log("- Requesting flash-loan");
function attack(address victimAddress, uint256 amount, uint256[] calldata calls) external { require(msg.sender == owner); address[] memory assets = new address[](1); assets[0] = address(weth); uint256[] memory amounts = new uint256[](1); amounts[0] = amount; uint25...
16,238,364
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount o...
Tells if `drip` can currently be called stakingParams Parameters of the concerned staking contract return If the `updateFrequency` has passed since the last drip
function _isDripAvailable(StakingParameters memory stakingParams) internal view returns (bool) { return block.timestamp >= _nextDripAvailable(stakingParams); }
5,936,533
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; pragma experimental ABIEncoderV2; /********************************************************************** ████████╗██╗░░░░░██████╗░ ░░██████╗████████╗░█████╗░██╗░░██╗██╗███╗░░██╗░██████╗░ ╚══██╔══╝██║░░░░░██╔══██╗░ ██╔════╝╚══██╔══╝██╔══██╗██║░██╔╝██║████╗░██║██╔...
(,uint _realpower) = _minerRealPower();
function mineInfo(address account) public override view returns(uint[12] memory,address) { address[] storage referees = _referedMiners[account]; uint _minerRefTotal = 0; uint _count = referees.length; uint _minerStatus = 0; for (uint i=0; i<referees.length; i++) { ...
12,777,160
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import {ERC721BasicMint} from "../erc721/presets/ERC721BasicMint.sol"; //===================================================================================================================== /// 🐻 ( ♥‿♥) OOGA BOOGA BONGA BEARA ( ♥‿♥) 🐻 //=======================...
Public function that mints a specified number of ERC721 tokens. numMint uint16: The number of tokens that are going to be minted./
function mint(uint16 numMint) public payable virtual nonReentrant whenPublicMintingOpen whenNotPaused opensAt(launchTime, "Minting has not started yet") costs(numMint, priceInWei) { _mint(numMint); }
1,195,063
//Address: 0x066eee2be6388f8c19983185906ed89724c7b4cd //Contract name: RntToken //Balance: 0 Ether //Verification Date: 1/10/2018 //Transacion Count: 11 // CODE STARTS HERE pragma solidity ^0.4.15; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { functio...
SafeMath.sub will throw if there is not enough balance.
function transfer(address _to, uint _value) public canTransfer(msg.sender) whenNotPaused returns (bool success) { require(_to != address(0)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); ...
6,383,707
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; /// @notice Interface of the `SmartWalletChecker` contracts of the protocol interface SmartWalletChecker { function check(address) external view returns (bool); } /// @title SmartWalletWhitelist /// @author Curve Finance and adapted by Angle Core Team (https...
Commits to change the admin _admin New admin of the contract
function commitAdmin(address _admin) external { require(msg.sender == admin, "!admin"); future_admin = _admin; }
42,376
pragma solidity ^0.4.11; /** * Copyright 2017 Veterapreneur * * 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, modif...
donations, no tokens only thanks!/
function donation(address grantor) public payable { require (grantor != 0x0); balances[grantor] = balances[grantor].add(msg.value); FundTransfer(msg.sender, msg.value, true); }
12,805,044
pragma solidity ^0.5.0; import "@openzeppelin/upgrades/contracts/Initializable.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol"; import "openzeppelin-solidity/contracts/cryptography/ECDSA.sol"; import "./RelayerRole.sol"; /* * @dev 联盟容器,负责管理联盟内的合约、账户、交易中继 */ contract Contain...
verify parameters encode transfer argument call ERC20 token emit event
function relayTransfer( address tokenAddress, address sender, address recipient, uint256 amount ) public onlyRelayer(msg.sender) returns(bool) { require(tokenAddress != address(0), "token address is invalide"); require(sender != address(0), "sender address is inva...
12,777,979
// SPDX-License-Identifier: AGPL-3.0-only /* ValidatorService.sol - SKALE Manager Copyright (C) 2019-Present SKALE Labs @author Dmytro Stebaiev @author Artem Payvin @author Vadim Yavorsky SKALE Manager is free software: you can redistribute it and/or modify it under the terms of the GNU Af...
Returns node addresses linked to the msg.sender./
function getMyNodesAddresses() external view override returns (address[] memory) { return getNodeAddresses(getValidatorId(msg.sender)); }
10,226,672
./full_match/1/0x567c09B55294998d7a6F2A3A948e8fD331531B88/sources/contracts/UMA/common/implementation/FixedPoint.sol
Raises an `Signed` to the power of an unscaled uint256, reverting on overflow. E.g., `b=2` squares `a`. This will "floor" the result. a a FixedPoint.Signed. b a uint256 (negative exponents are not allowed). return output is `a` to the power of `b`./
function pow(Signed memory a, uint256 b) internal pure returns (Signed memory output) { output = fromUnscaledInt(1); for (uint256 i = 0; i < b; i = i.add(1)) { output = mul(output, a); } }
9,749,076
pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; contract Entrope is ERC721, Ownable { string public _base; // Token p...
Mints `_count` tokens to `_to`./
function awardTokens(uint256 _count, address _to) public onlyOwner returns (uint256[] memory) { uint256[] memory ids = new uint256[](_count); for (uint256 i = 0; i < _count; i++) { uint256 newItemId = _tokenIds.current(); _tokenIds.increment(); ...
1,481,261
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol pragma solidity ^0.4.24; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * See https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(ad...
Tells if interest earning was enabled for particular token. return true, if interest bearing is enabled./
function isInterestEnabled(address _token) public view returns (bool) { return boolStorage[keccak256(abi.encodePacked("interestEnabled", _token))]; }
1,093,402
./full_match/97/0xA0FA3d6133657669CF03890c12c3aE1C48e641db/sources/contracts/sd/sd2.sol
helping function that deploys the contract and returns it's address (avoids storing all the bytecode in a tmp variable) n: the name of the token symbol: The symbol of the token fee: the fees that should be applied (0.1% = 1 and 1000 = 0) fee[0] = backingFeeBuy fee[1] = burningFeeBuy fee[2] = liquidityFeeBuy ...
function dep(string memory n, string memory symbol, uint supply, uint[12] memory fee, bool sb, address ownerAddr, address backingTokenAddress) external returns (address){ return address(new SMARTDeFi(n, symbol, supply, fee, sb, ownerAddr, backingTokenAddress)); }
5,039,460
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.7.0 <0.8.0; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/cryptography/ECDSA.sol"; import "./base/WrapManager.sol"; import "./interfaces/ERC721TokenReceiver.sol"; /// @title Wrap protocol locking contract, based on Gno...
Get current multisig administrator return Administrator address
function getAdministrator() public view returns (address) { return administrator; }
1,765,169
./partial_match/1/0x86b919f8a5D94dD8622D30dDcB51FbFe721F22F0/sources/DI.sol
Safety hatch to withdraw any NFTs stuck in this contract
function transferUntransferredToken(uint[] calldata _tokenIDs, address _recipient) external { require(approvedTeamMinters[msg.sender], "Minter not approved"); for (uint i; i < _tokenIDs.length; i++) { _transferToken (_tokenIDs[i], _recipient); } }
2,816,702
pragma solidity ^0.5.0; contract Decentragram { string public name = "Decentragram"; // Store Posts uint256 public postCount = 0; mapping(uint256 => Image) public images; struct Image { uint256 id; string hash; string description; uint256 tipAmount; address...
Tip Posts Make sure the post id is valid Fetch the image Fetch the author Paying the author by the tip amount Increment the tip amount Update the image Emit the event
function tipImageOwner(uint256 _id) public payable { require(_id > 0 && _id <= postCount); Image memory _image = images[_id]; address payable _author = _image.author; address(_author).transfer(msg.value); _image.tipAmount = _image.tipAmount + msg.value; images[_id...
12,993,905
pragma solidity ^0.4.17; contract Adoption { address cooAddress=0x000; address ceoAddress=0x000; address cfoAddress=0x000; uint256 public secondsPerBlock = 15; mapping (address => uint) balances; event Transfer(address indexed _from, address indexed _to, uint256 _value); fu...
Adopting a Fish价格需要和鱼绑定
function adopt(uint FishId,address owner) public payable returns (bool) { bool success = false; adopters[FishId] = msg.sender; owner.transfer(this.balance); return success; address seller=genFish[tmpFishId].owner; require(genFish[tmpFishId].owner!=msg.sender); if(forsale(t...
6,396,431
/* The MIT License (MIT) Copyright (c) 2016 DFINITY Stiftung 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, mo...
Send any remaining balance to the foundation wallet/
function empty() returns (bool) { return foundationWallet.call.value(this.balance)(); }
1,050,733
./partial_match/1/0xf43f8ca2a52574edd3A38D9aFf7552D4571302cE/sources/Doggies.sol
Reverts if the `tokenId` has not been minted yet./
function _requireMinted(uint256 tokenId) internal view virtual { require(_exists(tokenId), "ERC721: invalid token ID"); }
9,270,888
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "./Math.sol"; /// @notice Logic to manipulate MoneyPool data. library MoneyPool { using SafeMath for uint256; /// @notic...
/ Use the old end if the current time is still within the duration. Otherwise, use the closest multiple of the duration from the old end.
function _determineNextStart(Data storage self) internal view returns (uint256) { uint256 _end = self.start.add(self.duration); if (_end.add(self.duration) > now) return _end; uint256 _distanceToStart = (now.sub(_end)).mod(self.duration); return now.sub(_d...
12,954,737
// 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. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when d...
Hook that is called before any token transfer. This includes minting do nothing
function _beforeTokenTransfer( address from, address to, uint tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _totalSupply += 1; _removeTokenFromOwnerEnumeration(from, tokenId); ...
450,311
./partial_match/1313161554/0x22914C3c46649E40480442b065859FB0857Bb247/sources/_contracts/lib/PreciseUnitMath.sol
Performs the power on a specified value, reverts on overflow./ Using safemath multiplication prevents overflows
function safePower(uint256 a, uint256 pow) internal pure returns (uint256) { require(a > 0, "Value must be positive"); uint256 result = 1; for (uint256 i = 0; i < pow; i++) { uint256 previousResult = result; result = previousResult.mul(a); } return ...
16,944,095
./full_match/5/0x05F31dDE1E0b6243C622a56762C2DE32B5A5EC1c/sources/contracts/Contract.sol
Function to show a decorated list of all registered doctors
function showOurDoctors() public view returns (Doctors[] memory) { uint256 doctorCount = allDoctors.length; Doctors[] memory doctorsss = new Doctors[](doctorCount); for (uint256 i = 0; i < doctorCount; i++) { address doctorAddress = allDoctors[i]; Doctor storage doctor = doctors[doctorA...
1,867,746
./full_match/1313161554/0xd7A812a5d2CC96e78C83B0324c82269EE82aF1c8/sources/bastion-protocol/contracts/Comptroller.sol
Add the market to the borrower's "assets in" for liquidity calculations cToken The market to enter borrower The address of the account to modify return Success indicator for whether the market was entered/ market is not listed, cannot join already joined no space, cannot join
function addToMarketInternal(CToken cToken, address borrower) internal returns (Error) { Market storage marketToJoin = markets[address(cToken)]; if (!marketToJoin.isListed) { return Error.MARKET_NOT_LISTED; } if (marketToJoin.accountMembership[borrow...
13,232,453
// 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...
Swaps `amountIn` of one token for as much as possible of another along the specified path params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata return amountOut The amount of the received token
function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut); struct ExactOutputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountOut; ...
26,839
./partial_match/1/0xB00A2994AE8bBC4F099D1B1054C3571A3b69710a/sources/@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol
This function is used to initialize the ERC165 interface. This function should only be called during the initialization phase./
function __ERC165_init() internal onlyInitializing { }
3,609,675
./partial_match/1/0x18a5452117714ccE0d8FaECeFDFdB4783140AF74/sources/MainDispatcher.sol
Prepare memcpy pointers. solium-disable-next-line security/no-inline-assembly Copy initializer data to be passed to the EIC. solium-disable-next-line security/no-inline-assembly
function callExternalInitializer( bytes memory data, address externalInitializerAddr, uint256 dataSize) private { require(externalInitializerAddr.isContract(), "NOT_A_CONTRACT"); require(dataSize <= data.length, "INVALID_DATA_SIZE"); bytes memory extInitData =...
3,649,059
./full_match/1/0x29F933645F8086719236825A28d04D8A055D98dB/sources/_arbitrum/token-bridge-contracts/contracts/tokenbridge/ethereum/gateway/L1ArbitrumGateway.sol
this function is public so users can query how much calldata will be sent to the L2 before execution it is virtual since different gateway subclasses can build this calldata differently ( ie the standard ERC20 gateway queries for a tokens name/symbol/decimals )
function getOutboundCalldata( address _l1Token, address _from, address _to, uint256 _amount, bytes memory _data ) public view virtual override returns (bytes memory outboundCalldata) { bytes memory emptyBytes = ""; outboundCalldata = abi.encodeWithSelecto...
8,380,388
// SPDX-License-Identifier: MIT LICENSE pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; impor...
Must check this, as getTokenTraits will be allowed since this contract is an admin
function isTokenStaked(uint256 tokenId, bool isTraining) external view override returns (bool) { uint64 lastTokenWrite = wndNFT.getTokenWriteBlock(tokenId); require(lastTokenWrite < block.number, "hmmmm what doing?"); IWnD.WizardDragon memory s = wndNFT.getTokenTraits(tokenId); if(s.isWizard) { ...
10,475,437
/** *Submitted for verification at Etherscan.io on 2021-04-23 */ /************************************************************************** * ____ _ * / ___| | | __ _ _ _ ___ _ __ * | | _____ | | / _` || | | | / _ \| '__| * ...
Function to mint tokens internal _to The address that will receive the minted tokens. _amount The amount of tokens to mint./
function mintInternal(address _to, uint256 _amount) internal virtual { totalSupply_ = totalSupply_ + _amount; balances[_to] = balances[_to] + _amount; allTimeMinted_ = allTimeMinted_ + _amount; emit Mint(_to, _amount); emit Transfer(address(0), _to, _amount); }
7,735,612
./full_match/5/0x984B044Da8f666Db69FBA4aad1642C9D8042172d/sources/contracts/occ.sol
This will pay HashLips 5% of the initial sale. You can remove this if you want, or keep it in to support HashLips and his channel. ============================================================================= ============================================================================= This will payout the owner 95% of...
function withdraw() public payable onlyOwner { require(hs); require(os); }
11,613,004
./partial_match/1/0xbc6a1af02c09fc1514B95eC98756ccAa95e8Af2e/sources/GEtherBridge.sol
Cancels the liquidity pool migration by reseting the procedure to its original state. This method is exposed publicly. return _migrationRecipient The address of the former recipient./
function cancelPoolMigration(Self storage _self) public returns (address _migrationRecipient) { require(_self.state == State.Migrating, "migration not initiated"); _migrationRecipient = _self.migrationRecipient; _self.state = State.Allocated; _self.migrationRecipient = address(0); _self.migrationUnlockTime ...
2,650,888
./full_match/80001/0x8626997aF41ad43687273B3Fb72F354993EB90a2/sources/contracts/Certichain.sol
functionsrequire(entities[_id].id != _id, "error: User already exist"); Make sure company name exist Make sure company name exist Make sure company name exist Make sure company name exist add new entity instance of enityupdate indice entity emit event update User
function addEntity (address _id, string memory _role, string memory _name,string memory _logoUrl, string memory _location, string memory _email, string memory _phone, string memory _username, string memory _website) public validAddress(_id){ ...
9,477,596
./full_match/137/0x30a75165DC937Bbb096f9Aac1068a972C984B5Df/sources/cake.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...
{ require(blockNumber < block.number, "CAKE::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; function delegates(address delegator) external view returns (address) } } function delegateBySig( address delegatee, ...
3,755,966
pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // SPDX-License-Identifier: MIT /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume th...
Set sale address nftSaleAddress Sale contract/
function setNftSaleAddress(address nftSaleAddress) public onlyAdmin { require(_nftSaleAddress == address(0)); _nftSaleAddress = nftSaleAddress; }
10,133,016
/** *Submitted for verification at Etherscan.io on 2021-05-25 */ // SPDX-License-Identifier: MIT pragma solidity ^0.7.6; // /* * @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.da...
Sposto il balance dello smart contract
function sendVaultBalance(uint256 _amount, address payable _receiver) public onlyOwner whenNotPaused { require(address(this).balance>= _amount, "Not enought WEI in the balance"); _receiver.transfer(_amount); }
10,828,951
./partial_match/1/0xE4764f9cd8ECc9659d3abf35259638B20ac536E4/sources/contracts/protocol/ParticleExchange.sol
Common pre market sell checks, for both pull and push based flow/
function _sellNftToMarketCheck(Lien calldata lien, uint256 amount, address msgSender, uint256 msgValue) internal { if (lien.loanStartTime != 0) { revert Errors.LoanStarted(); } if (lien.lender == address(0)) { revert Errors.BidNotTaken(); } }
4,052,309
pragma solidity 0.5.12; pragma experimental ABIEncoderV2; contract Token { ...
inject NONSTANDARD NAMING
function OWNEROF291(uint256 _tokenId) public view returns (address _owner);
12,856,794
/** * MIT License * =========== * * Copyright (c) 2021 Phoenix * * 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...
update phoenix wallet address. This address will be responsible for holding commission on tokens transfer Only Phoenix can call _user The address of phoenixCrw wallet return Bool value/
function updatePhoenixAddress(address _user) external onlyPhoenix returns (bool) { phoenixCrw = _user; return true; }
1,046,762
pragma solidity ^0.4.17; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public constant returns (uint256); function transfer(address to, uint2...
decrease phase supply and add user phase balance
function updatePhaseSupplyAndBalance(uint256 _tokens) internal { uint256 current_time = now; if(current_time > start_time && current_time < phase_1_Time){ phase_1_balances[msg.sender] = phase_1_balances[msg.sender].add(_tokens); phase_1_remaining_tokens = phase_1_remaining_tokens - _tokens; } ...
13,100,471
// Based on https://github.com/HausDAO/Molochv2.1 // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.4; // import "hardhat/console.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * availabl...
transfer shares to loot
function processGuildKickProposal(uint256 proposalIndex) public nonReentrant { _validateProposalForProcessing(proposalIndex); uint256 proposalId = proposalQueue[proposalIndex]; Proposal storage proposal = proposals[proposalId]; require(proposal.flags[5], "must b...
32,975
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; import "../../common/implementation/FixedPoint.sol"; import "../../common/implementation/Testable.sol"; import "../interfaces/FinderInterface.sol"; import "../interfaces/OracleInterface.sol"; import "../interfaces/Votin...
Returns the current voting phase, as a function of the current time. return Phase to indicate the current phase. Either { Commit, Reveal, NUM_PHASES_PLACEHOLDER }./
function getVotePhase() external override view returns (Phase) { return voteTiming.computeCurrentPhase(getCurrentTime()); }
14,033,670
pragma solidity ^0.4.24; // produced by the Solididy File Flattener (c) David Appleton 2018 // contact : dave@akomba.com // released under Apache 2.0 licence contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function t...
Determine if the transfer is pending/
function isPending() public view returns (bool) { return !complete; }
1,027,431
pragma solidity ^0.4.11; /* This FYN token contract is derived from the vSlice ICO contract, based on the ERC20 token contract. Additional functionality has been integrated: * the function mintTokens() only callable from wallet, which makes use of the currentSwapRate() and safeToAdd() helpers * the function mintR...
A helper to notify if overflow occurs
function safeToAdd(uint a, uint b) private constant returns (bool) { return (a + b >= a && a + b >= b); }
6,421,023
pragma solidity ^0.4.2; /* Initially from : https://github.com/chriseth/solidity-examples/blob/master/queue.sol Changed by: Jimmy Paris Changed to be a queue of Demande (as a record of the asker's address and the asked value) */ contract QueueDemande { struct Demande{ address demandeur; uint...
check if a minimum value is asked in the queue, return false if it's asked by a specific address
function containMinValueFromOther(uint256 _minValue, address exceptAddr) returns (bool) { return containMinValueFromOther(requests, _minValue, exceptAddr); }
2,518,890
// 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...
Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements - `to` cannot be the zero address./
function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "Mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); em...
13,669,162
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.6.0 <0.7.0; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/con...
Checks if the Prize Pool can receive liquidity based on the current cap _amount The amount of liquidity to be added to the Prize Pool return True if the Prize Pool can receive the specified amount of liquidity
function _canAddLiquidity(uint256 _amount) internal view returns (bool) { uint256 tokenTotalSupply = _tokenTotalSupply(); return (tokenTotalSupply.add(_amount) <= liquidityCap); }
23,336
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.7.0; pragma abicoder v2; import "./TradingAction.sol"; import "./ActionGuards.sol"; import "./nTokenMintAction.sol"; import "./nTokenRedeemAction.sol"; import "../SettleAssetsExternal.sol"; import "../FreeCollateralExternal.sol"; import "../../math/SafeInt256...
Minimum value signed 64.64-bit fixed point number may have./ Maximum value signed 64.64-bit fixed point number may have./ Convert signed 256-bit integer number into signed 64.64-bit fixed point number. Revert on overflow. x signed 256-bit integer number return signed 64.64-bit fixed point number/
function fromInt (int256 x) internal pure returns (int128) { require (x >= -0x8000000000000000 && x <= 0x7FFFFFFFFFFFFFFF); return int128 (x << 64); }
12,555
pragma solidity ^0.4.18; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; } contract OysterShell { // Public variables of SHL string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; ...
Transfers the director to a new address/
function transferDirector(address newDirector) public onlyDirectorForce { director = newDirector; }
1,463,663
./partial_match/3/0xc17650b3ECC76ba6cc8236C41Ed1b6A48Ea3cff5/sources/LnDebtSystem.sol
default transferFrom
function transferFrom( address from, address to, uint value ) external virtual override optionalProxy returns (bool) { return _transferFromByProxy(messageSender, from, to, value); }
5,065,323
pragma solidity ^0.4.20; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ 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; } funct...
Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(transferEnabled || isOwner()); balances[_from] = balances[_from].sub(_value); balanc...
5,832,633
pragma solidity ^0.5.0; /// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution. /// @author Stefan George - <stefan.george@consensys.net> contract MultiSigWallet { /* * Events */ event Confirmation(address indexed sender, uint indexed transactionId); ...
Web3 call functions/ Returns number of confirmations of a transaction. transactionId Transaction ID. return Number of confirmations.
function getConfirmationCount(uint transactionId) public view returns (uint count) { for (uint i = 0; i < owners.length; i++) if (confirmations[transactionId][owners[i]]) count += 1; }
363,922
./full_match/1/0xE40782171Fd4f583c98E41bD889b702bA9574BBB/sources/contracts/ETHGen.sol
Determines whether the member has sold any memberships yet at all/
function hasMembers(address _owner) view public returns(bool) { return membershipsSold(_owner) > 0; }
3,109,591
./full_match/100/0xF4572223496ECFeEF8A11b059180de4906c75627/sources/project_/contracts/agreements/InstantDistributionAgreementV1.sol
required condition check uint256(vars.sdata.units); adjust publisher's deposits update subscription data and adjust subscriber's balance nothing to be recorded in this case
function claim( ISuperfluidToken token, address publisher, uint32 indexId, address subscriber, bytes calldata ctx ) external override returns(bytes memory newCtx) { AgreementLibrary.authorizeTokenAccess(token, ctx); require(subscriber !...
14,280,678
./partial_match/1/0xBdbcDFbca3b6Eb90F251b41806A40569c6eB18cd/sources/contracts/libraries/Orders.sol
allocate gas refund
function sell( Data storage data, SellParams calldata sellParams, TokenShares.Data storage tokenShares ) external { uint256 tokenTransferCost = data.transferGasCosts[sellParams.tokenIn]; require(tokenTransferCost != 0, 'OS0F'); checkOrderParams( data, ...
2,747,256
./full_match/56/0x06D2c0EEFfC8c18e53ca0775766471D492af6473/sources/project_/contracts/LightningSwapBase.sol
Convert coin amount and BTC amount to the same precision (18 decimals) Calculate BTC price relative to the token with 8 decimal precision
function calculateBTCtoNativeCoinPrice( uint8 coinDecimals, uint256 coinAmount, string memory invoice ) public pure returns (uint256) { (, uint256 btcAmount) = parseInvoice(invoice); uint256 adjustedCoinAmount = coinAmount * (10 ** (18 - coinDecimals)); uint256 a...
3,226,443
/** * Kleros Liquid * https://contributing.kleros.io/smart-contract-workflow * @reviewers: [@clesaege] * @auditors: [] * @bounties: [{duration: 14days, link: https://github.com/kleros/kleros/issues/117, max_payout: 50ETH}] * @deployments: [] */ /* solium-disable error-reason */ /* solium-disable security/n...
Changes the `feeForJuror` property value of a specified subcourt. _subcourtID The ID of the subcourt. _feeForJuror The new value for the `feeForJuror` property value./
function changeSubcourtJurorFee(uint96 _subcourtID, uint _feeForJuror) external onlyByGovernor { courts[_subcourtID].feeForJuror = _feeForJuror; }
5,495,848
/** *Submitted for verification at Etherscan.io on 2021-11-19 */ // Sources flattened with hardhat v2.3.0 https://hardhat.org // File contracts/interfaces/IVArmor.sol pragma solidity ^0.6.12; interface IVArmor { function getPriorTotalVotes(uint256 blockNumber) external view returns(uint96); function getPrio...
admin can bypass this
function cancel(uint proposalId) public { ProposalState state = state(proposalId); require(state != ProposalState.Executed, "GovernorAlpha::cancel: cannot cancel executed proposal"); Proposal storage proposal = proposals[proposalId]; require(varmor.getPriorVotes(proposal.proposer, s...
2,115,577
// SPDX-License-Identifier: unlicensed // Cowri Labs, Inc. pragma solidity ^0.8.0; import {ABDKMath64x64 as ABDKMath} from "./ABDKMath64x64.sol"; contract DemoPool { using ABDKMath for int128; using ABDKMath for uint256; // ABDK Constants int128 internal constant ONE = 0x10000000000000000; int1...
Compute λ, which is the linear scale factor between the current utility and the utility of the identity curve λ = utility / utilityOfIdentityCurve use λ to compute y', which is the projection of the current balance of y onto the identity curve. y' = balanceOfY / λ Reordering these operations: y' = balanceOfY / utility ...
function _xForYAndUtil(uint256 balanceOfY, uint256 currentUtility) internal view returns(uint256 balanceOfX) { int128 yPrime = balanceOfY.divu(currentUtility).mul(utilityOfIdentityCurve); require(yPrime > 0, "UtilityError :: Invalid y'"); int128 xPrime; xPrime = ( ...
14,087,075
pragma solidity ^0.4.25; /// @dev Interface required by league roster contract to access /// the mintPlayers(...) function interface CSportsRosterInterface { /// @dev Called by core contract as a sanity check function isLeagueRosterContract() external pure returns (bool); /// @dev Called to indicate that...
Called to create a team for use in CSports. _escrow(...) Verifies that all of the tokens presented are owned by the sender, and transfers ownership to this contract. This assures that the PlayerTokens cannot be sold in an auction, or entered into a different contest. CALLED ONLY BY CONTEST CONTRACT Also note ...
function createTeam(address _owner, uint32[] _tokenIds) public returns (uint32) { require(msg.sender == contestContractAddress); require(_tokenIds.length == playersPerTeam); coreContract.batchEscrowToTeamContract(_owner, _tokenIds); uint32 _teamId = _createTeam(_owner, _tokenIds); emit TeamCre...
11,678,957
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.7; //17 contract Owned { address public ownerAddr; //18 modifier onlyOwner() { require(msg.sender == ownerAddr); _; } constructor() { ownerAddr = msg.sender; } function transferOwnership(address _newOwner) p...
18 added modifier and commented the corresponding code inside this function Only the current owner can set a new ownerAddr require(msg.sender == ownerAddr); The new address cannot be nullhttps:stackoverflow.com/questions/48219716/what-is-address0-in-solidity
function transferOwnership(address _newOwner) public onlyOwner { require(_newOwner != address(0)); ownerAddr = _newOwner; }
1,027,811
./full_match/5/0x5f1B2f00a6251C1CA68FB08312DF5A125e6f45EF/sources/lib/forge-std/src/Test.sol
Start perpetual prank from an address that has some ether tx.origin is set to the origin parameter
function startHoax(address who, address origin) internal { vm.deal(who, 1 << 128); vm.startPrank(who, origin); }
1,900,952
//Address: 0xcdc4423531df5f3f87d1ff54047c769fe488c49f //Contract name: Eurno //Balance: 0.0000000000001 Ether //Verification Date: 6/13/2018 //Transacion Count: 2 // CODE STARTS HERE pragma solidity 0.4.24; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/...
Function to withdraw foreign tokens stored in this contract. _tokenContract is the smart contract address of the token to be withdrawn./
function withdrawForeignTokens(address _tokenContract) onlyOwner public returns (bool) { ForeignToken token = ForeignToken(_tokenContract); uint256 amount = token.balanceOf(address(this)); return token.transfer(owner, amount); }
12,845,911
// SPDX-License-Identifier: MIT pragma solidity 0.6.11; import "./Interfaces/ISortedTroves.sol"; import "./Interfaces/ITroveManager.sol"; import "./Interfaces/IBorrowerOperations.sol"; import "./Dependencies/SafeMath.sol"; import "./Dependencies/Ownable.sol"; import "./Dependencies/CheckContract.sol"; import "./Depen...
Returns the maximum size of the list/
function getMaxSize() external view override returns (uint256) { return data.maxSize; }
950,744
// SPDX-License-Identifier: MIT pragma solidity ^0.6.6; // From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol // Subject to the MIT license. /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wr...
allows a keeper to activate/register themselves after bonding/
function activate() external { require(bondings[msg.sender] != 0, "Keep3r::activate: bond first"); require(bondings[msg.sender] < now, "Keep3r::activate: still bonding"); if (firstSeen[msg.sender] == 0) { firstSeen[msg.sender] = now; keeperList.push(msg.sender); ...
2,301,030
./partial_match/4/0xf4C85324342dAB393320b683A684886185ECBa6D/sources/contracts/prize-strategy/PeriodicPrizeStrategy.sol
Adds an external ERC20 token type as an additional prize that can be awarded Only the Prize-Strategy owner/creator can assign external tokens, and they must be approved by the Prize-Pool _externalErc20 The address of an ERC20 token to be awarded
function addExternalErc20Award(IERC20 _externalErc20) external onlyOwnerOrListener requireAwardNotInProgress { _addExternalErc20Award(_externalErc20); }
16,985,442
./partial_match/42220/0x7ef2EA0939Fa35f3fA78616E3E12246324739203/sources/lib/staked-celo/contracts/Manager.sol
Returns the array of active groups. return The array of active groups./
function getGroups() external view returns (address[] memory) { return activeGroups.values(); }
3,497,666
//Address: 0x00416B9d728069eDB0cEb04bC2b203fA7336d1F1 //Contract name: AversafeSeedCrowdsale //Balance: 0 Ether //Verification Date: 11/29/2017 //Transacion Count: 36 // CODE STARTS HERE /* Copyright 2017 Cofound.it. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file ex...
Recovers ERC20 tokens other than eth that are send to this address @owner refunds the erc20 tokens _tokenAddress address of the erc20 token _to address to where tokens should be send to _amount amount of tokens to refund
function salvageTokensFromContract(address _tokenAddress, address _to, uint _amount) onlyOwner public { ERC20TokenInterface(_tokenAddress).transfer(_to, _amount); }
1,003,039
pragma solidity 0.8.6; import "JellyMinterAccess.sol"; contract JellyAccessControls is JellyMinterAccess { /// @notice Role definitions bytes32 public constant SMART_CONTRACT_ROLE = keccak256("SMART_CONTRACT_ROLE"); event SmartContractRoleGranted( address indexed beneficiary, address ind...
Initializes access controls. _admin Admins address./
function initAccessControls(address _admin) public { require(!initAccess, "Already initialised"); _setupRole(DEFAULT_ADMIN_ROLE, _admin); initAccess = true; }
141,356
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import {ERC721Tradable} from "./base/ERC721Tradable.sol"; import { Counters } from "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/utils/Base64.sol"; // ,,_ // zd$$...
Set the royalties for the whole contract. Our intention is to set it to 10% in perpetuity. recipient the royalties recipient - will always be pr1s0nart, for regulatory reasons. value royalties value (between 0 and 10000)/
function setRoyalties(address recipient, uint256 value) external onlyCreator { _setRoyalties(recipient, value); }
14,034,883
// SPDX-License-Identifier: MIT pragma experimental ABIEncoderV2; pragma solidity ^0.6.12; import "./Interfaces/LiquidityMathModelInterface.sol"; import "./MToken.sol"; import "./Utils/ErrorReporter.sol"; import "./Utils/ExponentialNoError.sol"; import "./Utils/AssetHelpers.sol"; import "./Moartroller.sol"; import "./...
Checks to see if an address has the role of being an allocator _address Address being checked for ROLE_ALLOCATE return true or false whether the address has ROLE_ALLOCATE assigned/
function checkAsAllocator(address _address) public view returns (bool) { return hasRole(ROLE_ALLOCATE, _address); }
11,818,546
./full_match/1285/0xC4B590a0E2d7e965a2Fb3647d672B5DD97E8d068/sources/src/Periphery/Receiver.sol
set Executor _executor the Executor address
function setExecutor(address _executor) external onlyOwner { executor = IExecutor(_executor); emit ExecutorSet(_executor); }
833,621
pragma solidity ^0.4.18; // solhint-disable-line contract ERC20Interface { function transfer(address to, uint256 tokens) public returns (bool success); } contract Halo3D { function buy(address) public payable returns(uint256); function transfer(address, uint256) public returns(bool); function myToke...
Collect information about doge farm dividents amount
function getContractDividends() public view returns(uint256) { return tokenContract.myDividends(true); }
6,766,259
./partial_match/1/0xddE1cDDBBC4bfc0D2E9F5B2957456A2B651aAa6B/sources/Cycle.sol
In the future, this contract would call a trusted Oracle instead of being set by its owner
function setEth(uint _newEth) public { require(msg.sender == owner); ethToJot = _newEth; }
9,408,876
// SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view retu...
Change the strategy address --------------------
function startChangeStrategy(address _address) external onlyGovernance { _timelockStart = now; _timelockType = 2; _timelock_address = _address; }
6,897,710
./full_match/1/0x4F702C962f7c06375B277042B77D1434A44fB581/sources/trb.sol
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), "Ownable: new owner is the zero address" ); _owner = newOwner; }
16,428,528
./partial_match/3/0x9A1Dd51e567BfAA3F95101FC55862d1fc7fce8C3/sources/MarathonCompetition.sol
Check whether distance registration is valid or not distance: uint distance to check return boolean/
function validDistance(uint distance) private view returns (bool) { for(uint i = 0; i < allowedDistances.length; i++) { if(allowedDistances[i] == distance) { return true; } } return false; for(uint i = 0; i < allowedDistances.length; i++) { ...
5,251,624
./full_match/5/0x82B6a4f93D84C95fE106f3e81DA557Ec9b1A7951/sources/project_/contracts/FOHLE_Router.sol
refund dust eth, if any
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external virtual override payable ensure(deadline) returns (uint[] memory amounts) { require(path[0] == WETH, 'FOHLE_Router: INVALID_PATH'); amounts ...
1,909,435
./partial_match/1/0x30fC62b88010D4D0d0a68f0c74ed5D94E53e3bcf/sources/TokenSwap.sol
swap inToken to outToken with respected exchangeRatio Transfer the inToken from the caller to the burn address Calculate the amount to send to the caller Transfer the outToken from the wallet to the caller Emit an event
function tokenSwap(uint256 inAmount) public nonReentrant() { require(inAmount > 0, "TokenSwap: inAmount cannot be zero"); IERC20(inTokenAddress).safeTransferFrom( address(msg.sender), burnAddress, inAmount ); uint256 outAmount = inAmount * exchan...
4,042,915
// SPDX-License-Identifier: Apache-2.0 pragma solidity >=0.6.0 <0.7.0; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "./ERC20Managed.sol"; import "./Curve.sol"; import "./FeeLib.sol"; import "@nomiclabs/buidler/console.sol"; /** * `BondingCurveFac...
`transferReserve`: Transfers an `amount` of `reserveToken` to `to` Requires caller to be the owner This is a convinience function so that the controller can have control of transfering reserve token without complicated approvals and allowances/
function transferReserve(address to, uint256 amount) external onlyOwner returns (bool) { return reserveToken.transfer(to, amount); }
5,470,567
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import '@openzeppelin/contracts/utils/math/SafeMath.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/utils/introspection/ERC165Checker.sol'; /* Interface ...
Add credit for a Turing helper contract _addBalanceAmount the prepaid amount that the user want to add _helperContractAddress the address of the turing helper contract/ Transfer token to this contract
function addBalanceTo( uint256 _addBalanceAmount, address _helperContractAddress ) public onlyInitialized { require(_addBalanceAmount != 0, 'Invalid amount'); require(Address.isContract(_helperContractAddress), 'Address is EOA'); require( ERC165Checker.supportsInterface(_helperContractAddr...
12,562,915
pragma solidity ^0.4.17; contract LatiumX { string public constant name = "LatiumX"; string public constant symbol = "LATX"; uint8 public constant decimals = 8; uint256 public constant totalSupply = 300000000 * 10 ** uint256(decimals); // owner of this contract address public owner; ...
function to withdraw Latium tokens that are unlocked at this moment withdraw all available tokens update tiers data
function withdraw(uint256 _amount) onlyOwner { var (unlockedTokens, excessTokens) = canBeWithdrawn(); uint256 totalAmount = unlockedTokens + excessTokens; require(totalAmount > 0); if (_amount == 0) { _amount = totalAmount; } require(totalAmount >= _amount...
7,963,834
./full_match/5/0x48466f3a11F4EFdFC5D107f24ff79D21C7EdE01F/sources/contracts/utils.sol
linear-gradient value 2: percent of target balance days to go
function verify(MintRequest calldata req, bytes calldata signature) external view returns (bool success, address signer); function mintWithSignature(MintRequest calldata req, bytes calldata signature) external payable returns (address signer); } ) public vie...
1,892,627
/** * This code is licensed under the MIT License * * Copyright (c) 2019 Aion Foundation https://aion.network/ * * 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, in...
Processes a message transfer request originated on the Ethereum chain Each source transaction is processed once and identified using the transaction hash Additionally, transactions are nonced to keep the order on both chains _sourceTransactionHash Transaction hash from the Ethereum adapter which contains the BridgeTr...
function processTransfer( bytes32 _sourceTransactionHash, address _recipientContract, bytes _data, uint128 _gas, uint128 _sourceTransferId, bytes32[] _publicKey, bytes32[] _signaturePart1, bytes32[] _signaturePart2 ) public onlyRelayer ...
12,720,358
/** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value...
Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to...
4,804,538
./full_match/1/0x84524bAa1951247b3A2617A843e6eCe915Bb9674/sources/contracts/MainHelper.sol
Internal increas function for lending shares of a postion {_nftId} and {_poolToken}./
function _increasePositionLendingDeposit( uint256 _nftId, address _poolToken, uint256 _shares ) internal { userLendingData[_nftId][_poolToken].shares += _shares; }
8,497,290
/* ==================================================================== */ /* Copyright (c) 2018 The TokenTycoon Project. All rights reserved. /* /* https://tokentycoon.io /* /* authors rickhunter.shen@gmail.com /* ssesunding@gmail.com /* ===============================================...
Safe transfer by trust contracts
function safeTransferByContract(uint256 _tokenId, address _to) external whenNotPaused { require(safeContracts[msg.sender]); require(_tokenId >= 1 && _tokenId <= wonderArray.length); address owner = tokenIdToOwner[_tokenId]; require(owner != address(0)); ...
7,233,561
./full_match/42/0x6e0a19B17fFa7a773b03178F47d8328AC3B11855/sources/browser/generalized_batching_solution.sol
Receive a flash loan. unUsedParam initiator The initiator of the loan. unUsedParam token The loan currency. unUsedParam amount The amount of tokens lent. unUsedParam fee The additional amount of tokens to repay. data Arbitrary data structure, intended to contain user-defined parameters. return The keccak256 hash of "E...
function onFlashLoan( address, /*initiator*/ address, /*token*/ uint256, /*amount*/ uint256, /*fee*/ bytes calldata data ) external override returns (bytes32) { _decodeAndCall(data); return keccak256('ERC3156FlashBorrower.onFlashLoan'); }
16,245,423
pragma solidity ^0.4.15; /** * @title Queue * @dev Data structure contract used in `Crowdsale.sol` * Allows buyers to line up on a first-in-first-out basis * See this example: http://interactivepython.org/courselib/static/pythonds/BasicDS/ImplementingaQueueinPython.html */ contract Queue { /* State variables */...
Places `addr` in the first empty position in the queue / YOUR CODE HERE
function enqueue(address addr) { if (curNumber != size) { orders[curNumber-1] = Order(addr, now); curNumber ++; } }
5,509,671
./partial_match/1/0x18e4C8Ba4022a081Dc473768BfFeB1D7E40CaD44/sources/DOGGY100X.sol
Update wallet that receives fees and newly added LP/
function updateTeamWallet(address newWallet) external onlyOwnerOverriden { _fundingWallet = newWallet; }
4,188,946
./full_match/137/0xcF9d2BD7b4335cD038C5Dae0C12e681185307437/sources/project_/contracts/Pool.sol
/ calculates the performance/admin fee (takes a cut - the admin percentage fee - from the pool's interest, strategy rewards). calculates the "gameInterest" (net interest) that will be split among winners in the game calculates the rewardTokenAmounts that will be split among winners in the game when there's no winners, ...
function _calculateAndSetAdminAccounting(uint256 _grossInterest, uint256[] memory _grossRewardTokenAmount) internal { if (winnerCount == 0 && !emergencyWithdraw) { adminFeeAmount[0] = _grossInterest; totalGameInterest = _grossInterest; for (uint256 i = 0; i < ...
3,766,996
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity 0.6.12; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "./interfaces/ILiquidityProtectionStats.sol"; /** * @dev This con...
seeds the total amount of protected reserve tokens per liquidity provider Requirements: - the caller must have the ROLE_SEEDER role/
function seedProviderAmounts( address[] calldata providers, IDSToken[] calldata poolTokens, IReserveToken[] calldata reserveTokens, uint256[] calldata reserveAmounts ) external seederOnly { uint256 length = providers.length; for (uint256 i = 0; i < length; i++) { ...
928,148
pragma solidity ^0.5.17; interface IERC20 { function TOTALSUPPLY3() external view returns (uint256); //inject NONSTANDARD NAMING function BALANCEOF367(address account) external view returns (uint256); //inject NONSTANDARD NAMING function TR...
inject NONSTANDARD NAMING
function SHOULDREBALANCE692() external view returns (bool) {
12,996,895
// @notice This contract is in progress!! // SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contra...
get the DaiEthPriceFeed (18 decimals) from Chainlink (look at consrtuctor for contract addresses) _amountInDai the amount of Dai
function getPriceFeed(uint256 _amountInDai) public view returns (uint256) { (, int256 price, , , ) = daiEthPriceFeed.latestRoundData(); return (uint256(price) * _amountInDai) / 1e18; } modifier moreThanZero( uint256 amount, uint256 strikePrice, uint256 premiumCost
12,641,440
./full_match/1/0x600bAcC8D793Fe487703973987f1a3016c4BB8Ae/sources/pond.sol
See {IERC20-transferFrom}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. - `from` mu...
function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; }
2,914,572
pragma solidity 0.4.23; ////////////////////////////// ///// ERC20Basic ////////////////////////////// /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); functi...
Function to convert component into {Set} Tokens Please note that the user's ERC20 component must be approved by their ERC20 contract to transfer their components to this contract. _quantity uint The quantity of Sets desired to issue in Wei as a multiple of naturalUnit/ Transfers the sender's components to the contract...
function issue(uint _quantity) isMultipleOfNaturalUnit(_quantity) isNonZero(_quantity) public returns (bool success) { for (uint16 i = 0; i < components.length; i++) { address currentComponent = components[i].address_; uint currentUnits = components[i].unit_; uint preTransferBalance...
1,464,884
pragma solidity ^0.4.24; import "./AdvancedERC721.sol"; import "./ERC721Operator.sol"; import "../../node_modules/eip820/contracts/ERC820Implementer.sol"; import "../../node_modules/openzeppelin-solidity/contracts/token/ERC721/ERC721Mintable.sol"; import "../../node_modules/openzeppelin-solidity/contracts/token/ERC721...
Mints a new NFT assigning it an id equal to the latest index
function mintWithoutId(address _to) public onlyMinter { uint256 tokenId = totalSupply(); mint(_to, tokenId); }
13,113,642
// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity 0.6.12; import "../utility/TokenHandler.sol"; import "../utility/ContractRegistryClient.sol"; import "./interfaces/IConverter.sol"; import "./interfaces/IConverterFactory.sol"; import "./interfaces/IConverterRegistry.sol"; import "./interfaces/IC...
returns the converter anchor associated with a given convertible token at a given index _index index return anchor associated with the given convertible token at the given index/
function getConvertibleTokenAnchor(IERC20Token _convertibleToken, uint256 _index) public view override returns (IConverterAnchor) { return IConverterRegistryData(addressOf(CONVERTER_REGISTRY_DATA)).getConvertibleTokenSmartToken(_convertibleToken, _index); }
5,387,336
pragma solidity ^0.4.11; // ---------------------------------------------------------------------------------------------- // Fixed supply token contract // Enjoy. (c) BokkyPooBah 2017. The MIT Licence. // ---------------------------------------------------------------------------------------------- // ...
totalSupply = _totalSupply;
function totalSupply() constant returns (uint256 totSupply) { return _totalSupply; }
15,366,330