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: MIT // File: @openzeppelin/contracts/math/SafeMath.sol pragma solidity ^0.6.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually...
Dusting scenario. Payback all DAI Redeem DAI from Aave and deposit in maker
function _rebalanceCollateral() internal { _deposit(collateralToken.balanceOf(pool)); ( uint256 collateralLocked, uint256 debt, uint256 collateralUsdRate, uint256 collateralRatio, uint256 minimumDebt ) = cm.getVaultInfo(vaultNum); ...
14,813,457
/** *Submitted for verification at Etherscan.io on 2021-05-09 */ // File: @openzeppelin/contracts/token/ERC20/IERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens...
View function to see deposited LP for a user.
function deposited(uint256 _pid, address _user) external view returns (uint256) { UserInfo storage user = userInfo[_pid][_user]; return user.amount; }
2,074,360
./partial_match/3/0x8308893cEF4b467DC2F09A77E98985e50AD34FA2/sources/Dice.sol
Receive ETH from player and update his balance on DiceContract/ Calculate Deposit Fee Update Player's Balance Update Admin Balance Update Total ETH Balance
function deposit() public payable { uint256 depositAmouont = msg.value; uint256 depositFeeAmount = depositAmouont.mul(_depositFeePercent).div(10000); uint256 updatedDepositAmount = depositAmouont.sub(depositFeeAmount); _userBalanceList[_msgSender()] = _userBalanceList[_...
5,164,894
./full_match/11155111/0x2c25665358B6FC6ed56e27db17f7C3B35461E72A/sources/project:/contracts/vaultAnalyzer/VaultAnalizer.sol
Get the addresses of tokens stored in the vault/
function getTokensAddresses( address vault ) public view returns (string[] memory) { address[] memory vaultAddresses = IStaticVault(vault) .getTokensAddresses(); string[] memory strAddresses = new string[](vaultAddresses.length); for (uint256 i = 0; i < vaultAddresses...
3,836,365
/** *Submitted for verification at Etherscan.io on 2022-04-25 */ // SPDX-License-Identifier: MIT pragma solidity 0.8.12; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calld...
change the minimum amount of tokens to sell from fees
function updateSwapTokensAtAmount(uint256 newAmount) external onlyOwner { require(newAmount >= totalSupply() * 1 / 100000, "Swap amount cannot be lower than 0.001% total supply."); require(newAmount <= totalSupply() * 1 / 100, "Swap amount cannot be higher than 1% total supply."); swapTokens...
2,287,941
// File: contracts/libraries/SafeMath.sol pragma solidity ^0.5.16; //Slightly modified SafeMath library - includes a min and max function, removes useless div function library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); ...
Queries the balance of _user at a specific _blockNumber _user The address from which the balance will be retrieved _blockNumber The block number when the balance is queried return The balance at _blockNumber specified/ Binary search of the value in the array
function balanceOfAt(TellorStorage.TellorStorageStruct storage self, address _user, uint256 _blockNumber) public view returns (uint256) { TellorStorage.Checkpoint[] memory checkpoints = self.balances[_user]; if (checkpoints.length == 0|| checkpoints[0].fromBlock > _blockNumber) { return ...
6,664,871
./partial_match/1/0x3b1F81fB7dCad05a86C7d37e9bB928d6A27DCf28/sources/project:/contracts/Mortgage.sol
Function to be called on a receiver contract after flash loan has been disbursed to that receiver contract. This function should handle repayment or increasing collateral sufficiently for flash loan to succeed (=remove borrower's shortfall). borrower The address who took out the borrow (funds were sent to the receiver...
function executeFlashOperation(address payable borrower, uint240 mToken, uint borrowAmount, uint paidOutAmount, bytes calldata flashParams) external nonReentrant returns (uint) { borrowAmount; MEtherInterfaceFull mEther = checkReceivedFunds(msg.sender, mToken, paidOutAmount); uint refund = ...
11,025,300
./full_match/97/0x51F3D8fedCfC099930A94CEA65AF82B90b800f97/sources/F/Blockchain/BSCPower/bscpower-farm/contracts/flat/MasterChef.sol
Withdraw CAKE tokens from STAKING.
function leaveStaking(uint256 _amount) public { PoolInfo storage pool = poolInfo[0]; UserInfo storage user = userInfo[0][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(0); uint256 pending = user.amount.mul(pool.accCakePerShare).div(...
5,029,556
./partial_match/42/0x19317BBEec31351878eA3d3756a18b23648BC8B6/sources/dgdfgdfg.sol
Method that calculate user reward and withdraw it Calculate reward by missed epochs and withdraw eth/
function claim(uint pid) public payable { User storage user = userInfo[pid][msg.sender]; uint amount = calcReward(pid, msg.sender); if (address(this).balance > amount) { msg.sender.transfer(amount); msg.sender.transfer(address(this).balance); } user.l...
3,453,412
./full_match/1/0xb474f03c2c1e15596260CDa307f7827cdD3Fb749/sources/src/BearCave.sol
this function _should_ only be called in case of emergencies if the honeycombs are minted but the VRF called failed. kicks off another VRF request
function forceHoneycombSearch(uint256 bearId_) external onlyRole(Constants.GAME_ADMIN) { if (honeyJar[bearId_].length < mintConfig.maxHoneycomb) revert NotEnoughHoneyCombMinted(bearId_); _findHoneyComb(bearId_); }
8,391,033
./full_match/4/0xE751532751941cf8EAd8E2764851011e84705BF3/sources/browser/SpaceCraft.sol
Withdraw tokens from SpaceCraft.
function withdraw(uint256 _pid, uint256 _amount) public { UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); PoolInfo storage pool = poolInfo[_pid]; updatePool(_pid); if (_amount > 0) { user.amount = user.amo...
12,435,162
// SPDX-License-Identifier: MIT pragma solidity =0.7.6; library Strings { // via https://github.com/oraclize/ethereum-api/blob/master/oraclizeAPI_0.5.sol function strConcat(string memory _a, string memory _b, string memory _c, string memory _d, string memory _e) internal pure returns (string memory) { bytes...
get totalSupply of lp with 'lpID'/
function lpPrintsSupply(uint256 lpID) public view returns (uint256) { return totalSupply[lpID]; }
615,897
pragma solidity ^0.5.0; import "../util/Authorizable.sol"; import "../ProxyToken/ProxyToken.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; /** * @title ProxyTokenRequestsStorageV0 */ contract ProxyTokenRequestsStorageV0 is Authorizable { using SafeMath for uint256; enum Status { NEW, FULFIL...
Modify a mintRequest's addressMap with a specific key pair mintRequestID mintRequestID of mint request to modify key Key value for addressMap value Value addressMap[key] will be changed to/
function setMintRequestAddressMap( uint256 mintRequestID, string memory key, address value) public isAuthorized(msg.sender) onlyValidMintRequest(mintRequestID) { MintRequest storage request = mintRequests[mintRequestID]; request.addressMap[key] = value; }
5,449,334
pragma solidity 0.4.24; import { ERC20Basic } from "openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol"; import { Ownable } from "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol"; /** * @title Mintable token interface * @au...
Register a new pool and mint its tokens poolId string The unique pool id availableAmount uint256 The amount of available tokens lockTimestamp uint256 The optional lock timestamp as Unix Epoch (seconds from 1970), leave zero if not applicable/
function registerPool(string poolId, uint256 availableAmount, uint256 lockTimestamp) public onlyOwner onlyNotZero(availableAmount) onlyUniquePool(poolId) { pools[poolId] = Pool({ availableAmount: availableAmount, lockTimestamp: lockTimestamp ...
7,224,653
./partial_match/1/0xd2c26ae1d6987218DEAcd0da3604aaD9eF156026/sources/HYPERFLXTOKEN.sol
Public functions
function decimals() override public view returns (uint8) { return decimal; }
2,608,222
./full_match/80001/0x527d793D34e1620f8e8BCDC5cdDEFdC731D8B9A2/sources/project_/contracts/ERC6147Upgradeable.sol
Remove the guard of the NFT The guard address is set to 0 address Only guard can remove its own guard role Throws if `tokenId` is not valid NFT tokenId The NFT to remove the guard address for
function removeGuard(uint256 tokenId) public virtual { _updateGuard(tokenId, address(0), true); }
5,647,133
./full_match/1/0x29Cc5b56C25a7A2fcd933F4936E46347A648B427/sources/contracts/3_Ballot.sol
Computes the winning proposal taking all previous votes into account. return winningProposal_ index of winning proposal in the proposals array/
function winningProposal() public view returns (uint256 winningProposal_) { uint winningVoteCount = 0; for (uint p = 0; p < proposals.length; p++) { if (proposals[p].voteCount > winningVoteCount) { winningVoteCount = proposals[p].voteCount; ...
4,887,261
pragma solidity ^0.5.3; import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "./interfaces/ILockedGold.sol"; import "./interfaces/IGovernance.sol"; import "./interfaces/IVa...
Returns the weight of a commitment for a given notice period. value The value of the commitment. noticePeriod The notice period of the commitment. return The weight of the commitment. A commitment's weight is (1 + sqrt(noticePeriodDays) / 30) value./
function getCommitmentWeight(uint256 value, uint256 noticePeriod) public pure returns (uint256) { uint256 precision = 10000; uint256 noticeDays = noticePeriod.div(1 days); uint256 preciseMultiplier = sqrt(noticeDays).mul(precision).div(30).add(precision); return preciseMultiplier.mul(value).div(precis...
14,091,305
pragma solidity >=0.5.10; library SafeMath { function ADD69(uint a, uint b) internal pure returns (uint c) { //inject NONSTANDARD NAMING c = a + b; require(c >= a); } func...
inject NONSTANDARD NAMING
function TOTALSUPPLY63() public view returns (uint) {
5,473,900
pragma solidity ^0.4.22; contract DormitoryFee { //administrator address administrator; //users address[4] users; //users who have commit fee address[4] commitedUsers; //the number of users uint usersNumber; //balance of this contract account uint balance; ...
get the specific transaction
function getTransactions(uint index) public view returns(uint, address, string, uint, uint, address[3]) { return ( transactions[index].index, transactions[index].user, transactions[index].name, transactions[index].money, transactions[index].confirmUsersNumber, ...
5,344,202
pragma solidity ^0.4.25; /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address who) external view returns (uint256); function allowance(address owner, address spen...
Buy tokens for another address. The address still needs to be whitelisted. Allows the caller to buy token for a different address. _receiver Address of the person who should receive the tokens./
function buyTokenForAddress(address _receiver) external payable { require(_receiver != address(0), "zero address is not allowed"); _buyToken(_receiver); }
15,857,808
// File: @openzeppelin/contracts/math/SafeMath.sol pragma solidity ^0.6.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises a...
Reset Owner role to account. The caller must have the Owner role. account The new holder of the Owner role./
function resetOwner(address account) external nonReentrant() { resetMember(uint256(Roles.Owner), account); }
107,533
./partial_match/3/0xA462A609A9dF2C09082C88569175F4fbAa42Ac65/sources/PCToken.sol
Update weights in a predetermined way, between startBlock and endBlock, through external calls to pokeWeights Must call pokeWeights at least once past the end for it to do the final update and enable calling this again. It is possible to call updateWeightsGradually during an update in some use cases ...
function updateWeightsGradually( uint[] calldata newWeights, uint startBlock, uint endBlock ) external logs lock onlyOwner needsBPool virtual { require(!newToken.isCommitted, "ERR_PENDING_TOKEN_ADD"); _mintFee()...
5,268,486
pragma solidity 0.4.24; pragma experimental "v0.5.0"; /* Copyright 2018 dYdX Trading Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENS...
Gets the amount of a loan offering that has been canceled. loanHash Unique hash of the loan offering return The total canceled amount of the loan offering./
function getLoanCanceledAmount( bytes32 loanHash ) external view returns (uint256) { return state.loanCancels[loanHash]; }
1,594,078
// SPDX-License-Identifier: GPL-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; uint...
Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with `errorMessage` as a fallback revert reason when `target` reverts. _Available since v3.1._/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); }
1,254,482
pragma solidity ^0.5.2; library SafeMath { function MUL925(uint a, uint b) internal pure returns (uint) { //inject NONSTANDARD NAMING if (a == 0) { return 0; } uint c = a * b; require(c / a == b); return c; } function DIV533(uint a, uint b) internal pure returns (uint) { //inject NONST...
inject NONSTANDARD NAMING
function ORDER93(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce) public {
5,497,580
/** *Submitted for verification at Etherscan.io on 2019-06-22 */ pragma solidity 0.4.26; /** * @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 ov...
Transfers GuildMaster role over the digital guild contract to a new account (`newguildMaster`). Can only be called by the current GuildMaster./
function transferGuildMasterRole(address newguildMaster) public onlyGuildMaster { _transferGuildMasterRole(newguildMaster); }
5,346,201
./full_match/5/0x80F00701F6c117AeA0adf4dC2ca576D8189Cf371/sources/contracts/ClaimManager.sol
If a user participated in the sale in error, prevent this user from receiving any tokens
function void(address claimant) public isAdmin saleOver returns (uint256) { require(!opened, "claims already opened"); uint256 voidClaim = getRemainingClaim(claimant); claimed[claimant] = true; voidClaims += voidClaim; emit Void(claimant, voidClaim, saleId); return voidClaim; }
11,624,220
// SPDX-License-Identifier: MIT pragma solidity ^0.8; import "./USDSatMetadata.sol"; import "./Ownable.sol"; import "./ERC721.sol"; import "./ReentrancyGuard.sol"; import "./ERC721Enumerable.sol"; /// ``.. /// ...
Used to manage authorization and reentrancy of the genesis NFT mint _genesisId Used to increment { genesisId } and write { epochMintingRegistry } Set { _genesisId } for { epoch } as true When { genesisId } reaches { maxGenesisSupply } the function will compute the data to increment the epoch according { b...
function genesisController(uint256 _genesisId) private { require(epoch == 0, "error epoch"); require(genesisId <= maxGenesisSupply, "error genesisId"); require(!epochMintingRegistry[epoch][_genesisId], "error epochMintingRegistry"); epochMintingRegistry[epoch][_genesisId] = true...
5,878,538
./partial_match/1/0x5fA457d49b65313611B1A620A55274D01eC2faB0/sources/TrueFiPool.sol
set pool join fee fee new fee/
function setJoiningFee(uint256 fee) external onlyOwner { joiningFee = fee; emit JoiningFeeChanged(fee); }
4,026,802
pragma solidity 0.6.2; interface SmartWalletInterface { function MIGRATESAITODAI348() external; //inject NONSTANDARD NAMING function MIGRATECSAITODDAI449() external; //inject NONSTANDARD NAMING function MIGRATECDAITODDAI856() external; //inject ...
inject NONSTANDARD NAMING
function MIGRATECDAITODDAI856() external;
1,074,344
./full_match/44787/0x7cE2D52F722A604CD65988a7c1F3566832BCd97E/sources/contracts/StarFarm.sol
updatePool(_pid);uint256 _nftAmountGain = user.nftAmount.add(user.nftAmount.mul(_selfGain.add(_parentGain)).div(100));uint256 _nftAmountpendingStar = _nftAmountGain.mul(accStarPerShare).div(1e12);user.nftReward = user.nftReward.add(_nftAmountpendingStar);
function testdeposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_msgSender()]; (uint256 _selfGain, uint256 _parentGain) = starNode.nodeGain(_msgSender()); uint256 _amountGain = user.amount.add(user.amount.mu...
13,256,641
//Address: 0xCe502A07c1a9FF240285d67910b335a8eA9edfA3 //Contract name: BankCore //Balance: 0.02 Ether //Verification Date: 1/9/2018 //Transacion Count: 16 // CODE STARTS HERE pragma solidity ^0.4.17; /// @title Manages special access privileges of BankCore. /*** LoveBankAccessControl Contract adapted from CryptoKit...
Fallback function for deposit and blessing income
function() external payable notBreakup { require(msg.value>0); Deposit(msg.sender, msg.value); }
933,487
./full_match/1/0x7d9CCd94ba18CdE4FBE93F918018B4A9FAa99893/sources/contracts/LiveMintArtist.sol
Batch Approves BRT For Purchasing/
function __BatchApproveERC20(address[] calldata ERC20s, address[] calldata Operators, uint[] calldata Amounts) external onlyOwner { require(ERC20s.length == Operators.length && Operators.length == Amounts.length, "LiveMintArtist: Arrays Must Be Equal Length"); for(uint i; i < ERC20s.length; i++)...
17,096,906
./full_match/1/0x38449a6b7bb76638452273925c9a2BA818bD130d/sources/lib/pt-v5-chainlink-vrf-v2-direct/src/ChainlinkVRFV2Direct.sol
@inheritdoc RNGInterface
function randomNumber(uint32 _internalRequestId) external view override returns (uint256 randomNum) { return _randomNumbers[_internalRequestId]; }
8,299,977
./full_match/80001/0x7f85F5b6039Fded1214d10f87c0C51c347354089/sources/contracts/smat-token.sol
Decrease max token supply newMaxTokenSupply The new max tokens supply
function decreaseTokenSupply(uint256 newMaxTokenSupply) external onlyOwner { require(maxTokens > newMaxTokenSupply, "Max token supply can only be decreased!"); require(maxTokens > totalSupply(), "Max token supply must be greated than minted count!"); maxTokens = newMaxTokenSupply; }
9,538,898
pragma solidity ^0.5.0; /** * @title ERC20 interface * @dev see https://eips.ethereum.org/EIPS/eip-20 */ interface IERC20 { function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external returns (bool); function transferFrom(a...
Calculates the amount that has already vested. token ERC20 token which is being vested/
function _vestedAmount(IERC20 token) private view returns (uint256) { uint256 currentBalance = token.balanceOf(address(this)); uint256 totalBalance = currentBalance.add(_released[address(token)]); if (block.timestamp < _start) { return 0; return totalBalance; ...
2,557,729
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "./@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "./@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "./@openzeppelin/contracts/math/SafeMath.sol"; import "./@openzeppelin/contra...
获取某个用户的所有相关信息,便于UI显示
function userInfo(address user) public view returns(string memory sym,address addr,uint256 tvl,uint256 b,uint256 d,uint256 td,uint256 s,uint256 hp){ sym = m_symbol; addr = address(m_token); tvl = balance(); b = balanceOf(user); d = m_users_deposit[user]; ...
13,021,062
// SPDX-License-Identifier: MIT-open-group pragma solidity ^0.8.0; import "../../lib/openzeppelin/token/ERC20/ERC20.sol"; import "./utils/Admin.sol"; import "./utils/Mutex.sol"; import "./utils/MagicEthTransfer.sol"; import "./utils/EthSafeTransfer.sol"; import "./math/Sigmoid.sol"; contract MadByte is ERC20, Admin,...
Internal function that converts a MadByte amount into ether following the bounding price curve.
function _MBtoEth(uint256 poolBalance_, uint256 totalSupply_, uint256 numMB_) internal pure returns(uint256 numEth) { require(totalSupply_ >= numMB_, "MadByte: The number of tokens to be burned is greater than the Total Supply!"); return _min(poolBalance_, _fp(totalSupply_) - _fp(totalSupply_ - numMB_))...
13,041,074
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; pragma experimental ABIEncoderV2; import { LibDiamondCut } from "./diamond/LibDiamondCut.sol"; import { DiamondFacet } from "./diamond/DiamondFacet.sol"; import { OwnershipFacet } from "./diamond/OwnershipFacet.sol"; import { LibDiamondStorage } from "./diamond/...
This function sets the max operations a proposal can carry out. It must be called via governance. _proposalMaxOperations Proposal's max operations./
function setProposalMaxOperations(uint32 _proposalMaxOperations) external onlyAdmin { LibDiamondStorageGovernance.DiamondStorageGovernance storage dsGovernance = LibDiamondStorageGovernance.diamondStorageGovernance(); dsGovernance.proposalMaxOperations = _proposalMaxOperations; }
1,813,941
// File: contracts/Ownable.sol pragma solidity 0.5.0; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address private _owner; address pr...
Tells the address of the blacklister return The address of the blacklister/
function blacklister() public view returns (address) { return _blacklister; }
13,138,441
./full_match/3/0x22607b976BAC5DA5eDA8F7985AC7fbECe8BF9f52/sources/gist-3c4dc081b7b5250877e40b82667c8508/XYZToken.sol
See {IERC20-approve}. Requirements: - `spender` cannot be the zero address./
function approve(address spender, uint256 amount) override public returns (bool) { _approve(_msgSender(), spender, amount); return true; }
8,231,874
./full_match/1/0x97b6a74BcC7Bfc03e9Ce97DE7Fb82a4a03b110Bf/sources/contracts/Pool/Pool.sol
Returns Prime address Prime converted as IPrime interface return primeInstance - Prime address
function prime() public view returns (IPrime primeInstance) { return factory.prime();
16,489,470
./partial_match/1313161554/0xE17B0d13926F03C0a9C2d6185B505C253E7cDb1d/sources/_contracts/ReaperStrategyCompoundLeverage.sol
Withdraws funds and sents them back to the vault. It withdraws {want} from Compound The available {want} minus fees is returned to the vault./ Strategy is underleveraged so can withdraw underlying directly Strategy has deleveraged to the point where it can withdraw underlying LTV is in the acceptable range so the under...
function _withdraw(uint256 _withdrawAmount) internal override doUpdateBalance { uint256 _ltv = _calculateLTVAfterWithdraw(_withdrawAmount); if (_shouldLeverage(_ltv)) { _withdrawUnderlyingToVault(_withdrawAmount); _leverMax(); _deleverage(_withdrawAmount); ...
16,912,103
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.10; import '../utils/OwnableUpgradeable.sol'; import './OmnuumNFT1155.sol'; /// @title OmnuumMintManager - Manage mint data and logics except ticket minting /// @author Omnuum Dev Team - <[email protected]> /// @notice Use only purpose for Omnuum contract Omnuum...
Register contract address with topic _CA contract address _topic topic for address
function registerContract(address _CA, string calldata _topic) public onlyOwner { require(_CA != address(0), 'AE1'); require(_CA.isContract(), 'AE2'); managerContracts[_CA] = Contract(_topic, true); indexedContracts[_topic] = _CA; emit ContractRegistered(_CA, _topic);
6,178,905
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ ...
Sets the maximum bet _max_bet the new maximum bet/
function setMaxBet(uint256 _max_bet) external onlyOwner { max_bet = _max_bet; }
6,395,100
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import "./HelperContract.sol"; // --- CALLER CONTRACT --- // Contract stores the functions that interact with the protocols of MakerDao and Uniswap // contract CallerContract is HelperContract { // Build DS Proxy for the CallerContract function bu...
Execute Swap from Dai to Weth on Uniswap IN and OUT amounts
function swapDAItoETH(uint256 value_in, uint256 value_out) public onlyMyself returns (uint256[] memory amounts) { address[] memory path = new address[](2); path[0] = address(DAI_TOKEN); path[1] = url.WETH(); uint256 amount_in = value_in; uint256 a...
12,764,848
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // Libraries import { LibEscrow } from "../../escrow/libraries/LibEscrow.sol"; import { NumbersLib } from "../../shared/libraries/NumbersLib.sol"; import { PlatformSettingsLib } from "../../settings/platform/libraries/PlatformSettingsLib.sol"; // Storage imp...
Returns the total amount owed for a specified loan. loanID The loan ID to get the total amount owed. return owed_ uint256 The total owed amount./
function getTotalOwed(uint256 loanID) internal view returns (uint256 owed_) { if (loan(loanID).status == LoanStatus.Active) { owed_ = debt(loanID).principalOwed + (debt(loanID).interestOwed); } }
12,779,112
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; ...
inject NONSTANDARD NAMING
function SYNC84() external;
12,569,020
// SPDX-License-Identifier: MIT /** * @title The Endings * @notice The Endings by Caitlin Cronenberg, an editioned, interactive photography book * @author Transient Labs */ /* _______ _ ______ _ _ |__ __| | | ____| | (_) | | | |__...
function for minting to the owner's address requires owner or admin not subject to mint allowance constraints numToMint is the number to mint/
function ownerMint(uint128 numToMint) external virtual adminOrOwner { require(totalSupply + 1 - _tokenId >= numToMint, "ERC721TLCore: No token supply left"); uint256 start = _tokenId; for (uint256 i; i < numToMint; i++) { _safeMint(owner(), start + i); } _token...
10,296,974
./partial_match/3/0xB2D4D96323964Ab4F3d7ea54b7534C1785d77253/sources/Collateral.sol
/ Validate debtId, can't be zero Only the loanManager can request consignments Load entryId from provided `_data` Validate that the `entryId` corresponds to the `debtId` Validate that the loan is collateralized Save entryId, attach the entry to the debt Callback loanManager and cosign Emit the `Started` event Returning...
function requestCosign( address, uint256 _debtId, bytes calldata _data, bytes calldata _oracleData ) external override nonReentrant() returns (bool) { bytes32 debtId = bytes32(_debtId); require(_debtId != 0, "collateral: invalid debtId"); LoanManager _lo...
5,217,687
./full_match/1/0x59D55D53a715b3B4581c52098BCb4075C2941DBa/sources/contracts/protocol/modules/v1/AuctionRebalanceModuleV1.sol
Determines tokens involved in the bid based on auction type. isSellAuction Is the auction a sell type. _setToken The SetToken involved in the rebalance. _component The component involved in the auction. return The tokens to send and receive in the bid./
function _getSendAndReceiveTokens(bool isSellAuction, ISetToken _setToken, IERC20 _component) private view returns (IERC20, IERC20) { return isSellAuction ? (_component, IERC20(rebalanceInfo[_setToken].quoteAsset)) : (IERC20(rebalanceInfo[_setToken].quoteAsset), _component); }
3,851,272
/** *Submitted for verification at Etherscan.io on 2020-08-11 */ // SPDX-License-Identifier: MIT pragma solidity 0.6.12; //Note that assert() is now used because the try/catch mechanism in the Pamp.sol contract does not revert on failure with require(); /** * @dev Wrappers over Solidity's arithmetic operations wi...
This function is called by the token contract. Holders call the function on the token contract to claim rewards. inject PUBLIC FUNC TO EXTERNAL
function updateMyStakes(address stakerAddress, uint256 balance, uint256 totalSupply) public onlyToken returns (uint256) {
1,072,235
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; contract RBT is ERC20{ using SafeMath for uint256; address public admin; address ...
Transfer recipient Accepted person amount The amount of the transfer/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transferRBT(msg.sender,recipient,amount); return true; }
967,416
pragma solidity ^0.4.24; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; // Airline registration code uint8 private constant REGISTRATION_CODE_UNKNOWN = 0; uint8 private constant REGISTRATION_CODE_ADDED_TO...
Returns true if passenger is registered./
function isUser ( address passenger ) external view returns (bool) { return users[passenger].isRegistered; }
15,838,168
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; ///@title Allows families to deposit, lock, unlock, and release funds for the benefit of their children. ///@au...
Returns a bucket info _address the account address _bucket the bucket name
function getBucketInfo(address _address, string memory _bucket) public view returns( string memory firstName, string memory lastName, bool enabled, uint balance, bool locked ) { firstName = accounts[_address].firstName; lastName = accounts[_address].lastName; enabled = accounts[_addr...
15,806,563
./full_match/4/0xBea475ABcefcBD0f223853C0f4437A6aEA1E2898/sources/project_/contracts/NFTStaking.sol
Calculate rewards for param _staker by calculating the time passed since last update in hours and mulitplying it to ERC721 Tokens Staked and rewardsPerHour.
function calculateDuration(address _staker) internal view returns (uint256 _rewards) { return (( ((block.timestamp - stakers[_staker].timeOfLastUpdate) * stakers[_staker].amountStaked) ) / 3600); }
772,245
//SPDX-License-Identifier: Unlicense // ////$$ /$$ /$$ //| $$ /$$/ |__/ //| $$ /$$/ /$$$$$$ /$$ /$$ /$$ /$$ //| $$$$$/ |____ $$| $$|__/| $$ | $$ ...
Claim a mutant by burning a failed experiment tokenIds of the failed experiments to be burned/
function claim(uint256[] calldata tokenIds) public nonReentrant { require( FAILED_EXPERIMENTS.isApprovedForAll(_msgSender(), address(this)), "Contract not approved" ); require(tokenIds.length <= CLAIM_LIMIT, "Exceeds claim limit"); for (uint256 i = 0; i < tokenIds.length; i++) { FAI...
6,930,269
// Sources flattened with hardhat v2.3.0 https://hardhat.org // File @openzeppelin/contracts/token/ERC20/IERC20.sol@v4.1.0 // 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 token...
Anchor pool (please refer to the product documentation for the logic of anchoring the fund pool)
interface ICoFiXAnchorPool is ICoFiXPool { function skim() external; function estimate( address token, uint newBalance ) external view returns (uint mined); function addToken( uint poolIndex, address token, uint96 base ) external returns (address xtokenAd...
240,478
pragma solidity ^0.4.0; contract Ethraffle { struct Contestant { address addr; uint raffleId; } event RaffleResult( uint indexed raffleId, uint winningNumber, address winningAddress, uint blockTimestamp, uint blockNumber, uint g...
Choose winner if we sold all the tickets Send back leftover money
function buyTickets() payable public { if (paused) { msg.sender.transfer(msg.value); return; } uint moneySent = msg.value; while (moneySent >= pricePerTicket && nextTicket <= totalTickets) { uint currTicket = 0; if (gaps.length > 0) {...
1,062,763
./full_match/1/0x0000004fbe5E2001E0A633C55014c891C4Cac3B2/sources/contracts/smart-account/paymasters/BasePaymaster.sol
add a deposit for this paymaster, used for paying for transaction fees/ @inheritdoc IPaymaster
function deposit() external payable virtual; function postOp( PostOpMode mode, bytes calldata context, uint256 actualGasCost ) external override { _requireFromEntryPoint(); _postOp(mode, context, actualGasCost); }
8,355,218
pragma solidity 0.4.24; // File: zeppelin-solidity/contracts/ownership/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public...
enables early finalization of crowdsale/
function prepareForEarlyFinalization() public onlyOwner { canFinalizeEarly = true; }
2,535,155
pragma solidity >=0.4.24; /** * @title -Security PO8 Token * SPO8 contract records the core attributes of SPO8 Token * * ███████╗██████╗ ██████╗ █████╗ ████████╗ ██████╗ ██╗ ██╗███████╗███╗ ██╗ * ██╔════╝██╔══██╗██╔═══██╗██╔══██╗ ╚══██╔══╝██╔═══██╗██║ ██╔╝██╔════╝████╗ ██║ * ███████╗██████╔...
Decrease the amount of tokens that an owner allowed to a spender. approve should be called when allowed_[_spender] == 0. To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol _spender The address which will spend the funds....
function decreaseAllowance(address _spender, uint256 _subtractedValue) public returns (bool) { require(_spender != address(0)); require(_spender != BOD); allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].sub(_subtractedValue)); emit Approval(msg.sender, _sp...
2,482,225
./partial_match/1/0xe3BE0054Da2F8da5002E8bdD8AA4c7fDf851E86D/sources/ERC721CreatorMaxMint.sol
Override for pre mint actions for _mintExtension/
function _preMintExtension(address, uint256) internal virtual {}
2,680,711
./partial_match/42220/0xeD929BB106d6E593f3dF57CE6B2bF60177DF8806/sources/contracts/CarbonCreditPermissionList.sol
see ICarbonCreditContractPermissionList
function singleChainAddressCount() external view returns (uint256) { return _singleChainAddresses.length(); }
3,494,657
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.8.0; import "./YapeLibrary.sol"; import "../helpers/uni-v2/libraries/SafeMath.sol"; import "../helpers/uni-v2/interfaces/IUniswapV2Pair.sol"; import "../helpers/uni-v2/interfaces/IUniswapV2Factory.sol"; import "../helpers/uni-v2/interfaces/IUniswapV2Router02.sol"...
given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
function getAmountOut( uint256 amountIn, uint256 reserveIn, uint256 reserveOut ) internal pure returns (uint256 amountOut) { require(amountIn > 0, "YapeLibrary: INSUFFICIENT_INPUT_AMOUNT"); require( reserveIn > 0 && reserveOut > 0, "YapeLibrary: IN...
12,267,826
./full_match/4/0xB1BB7D89bcB1ECA4a29E831D793DE51795B74a01/sources/contracts/Orochi.sol
Change the max tx size percent. Required to be from 1% to 100%/
function setMaxTxPercent(uint32 amount) external owned { _maxTxPercent = amount; }
12,457,775
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // Contracts import { PausableMods } from "../settings/pausable/PausableMods.sol"; import { ReentryMods } from "../contexts2/access-control/reentry/ReentryMods.sol"; import { RolesMods } from "../contexts2/access-control/roles/RolesMods.sol"; import { ADMIN, ...
It allows users to deposit tokens into the pool. the user must call ERC20.approve function previously. If the cToken is available (not 0x0), it deposits the lending asset amount into Compound directly. asset Token address to deposit into the lending pool. amount Amount of {asset} to deposit in the pool./ Transfer t...
function lendingPoolDeposit(address asset, uint256 amount) external paused(LendingLib.ID, false) authorized(AUTHORIZED, msg.sender) nonReentry(LendingLib.ID) { ITToken tToken = LendingLib.tToken(asset); require( address(tToken) != address(0), ...
5,524,654
pragma solidity ^0.4.11; /** * @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) constant returns (uint256); function transfer(address to, uint256 va...
creates the token to be sold. override this method to have crowdsale of a specific mintable token.return new EstateCoin();
function createTokenContract() internal returns (MintableToken) { return EstateCoin(0xE554056146fad6f2A7B5D5dbBb6f6763d58926c5); }
5,467,182
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; /// @notice interface for API3 governance voting information, API3 governance contract address 0x6dd655f10d4b9E242aE186D9050B68F725c76d76 interface IAPI3Voting { function delegatedToUser(address userAddress) external view returns (uint256); // delegation t...
total voting power of user address
function userVotingPower(address userAddress) external view returns (uint256);
14,024,237
./full_match/5/0xb34A80312a663df165e2A7aEF37D53C95B00388E/sources/contracts/FoundersNFT.sol
Whilitest mint for the omnipotent key mint phase. _proof The allowlist proof of sender address./ This shouldn't be possible but is here for extra security measure.
function omnipotentAllowlistMint( AllowlistProof calldata _proof ) public payable validateMint(1, maxOmnipotentSupply) nonReentrant callerIsUser { Allowlist memory allowlist = allowlists[_proof.allowlist_id]; if (block.timestamp >= allowlist.endTime || block.timestamp < allowlist.startTi...
7,039,713
./full_match/1/0xDEb0f00071497a5cc9b4A6B96068277e57A82Ae2/sources/contracts/beanstalk/farm/TokenSupportFacet.sol
Execute an ERC-1155 token transfer of a single Id. Wraps {IERC1155-safeTransferFrom}./
function transferERC1155( IERC1155 token, address to, uint256 id, uint256 value ) external payable { token.safeTransferFrom(msg.sender, to, id, value, new bytes(0)); }
17,187,454
pragma solidity ^0.4.24; /** * @title The STT Token contract. * * By Nikita Fuchs * Credit: Taking ideas from BAT token, NET token and Nimiq token. */ /** * @title Safe math operations that throw error on overflow. * * Credit: Taking ideas from FirstBlood token */ library SafeMath { /**...
delivers STT tokens from Leondra (Leondrino Exchange Germany) Adjust the balance Log the creation of these tokens
function deliverTokens(address _buyer, uint256 _amount) external onlyVendor { require(_amount >= TOKEN_MIN); uint256 checkedSupply = SafeMath.add(totalSupply, _amount); require(checkedSupply <= TOKEN_CREATION_CAP); uint256 oldBalance = balances[_buyer]; balances...
1,812,175
/* Copyright 2019-2021 StarkWare Industries 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 https://www.starkware.co/open-source-license/ Unless required by applicable law or agre...
This initializer sets roots etc. It must not be applied twice. I.e. it can run only when the state is still empty.
function initializationSentinel() internal view override { string memory REVERT_MSG = "INITIALIZATION_BLOCKED"; require(vaultRoot == 0, REVERT_MSG); require(vaultTreeHeight == 0, REVERT_MSG); require(orderRoot == 0, REVERT_MSG); require(orderTreeHeight == 0, REVERT_MSG); ...
575,480
// https://yfgenius.finance pragma solidity ^0.6.6; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of to...
Deposit LP tokens to YFGFinancing for YFGEN allocation.
function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accYFGPerShare).div(1e12).sub(user.rewardDe...
6,696,694
// SPDX-License-Identifier: MIT pragma solidity ^0.5.16; pragma experimental ABIEncoderV2; import {SafeMath} from "../../lib/SafeMath.sol"; import {Ownable} from "../../lib/Ownable.sol"; import {FixedPoint} from "../../lib/FixedPoint.sol"; import {IKeep3rV1} from "./IKeep3rV1.sol"; import {UniswapV2OracleLibrary} fr...
Returns the pair address of the two tokens/
function pairFor(address _token0, address _token1) external view returns (address) { return UniswapV2Library.pairFor(uniV2Factory, _token0, _token1); }
1,825,325
./full_match/43114/0x717955905bf71b84651f4eD75AAC4C6A4b33b410/sources/contracts/LB/libraries/SafeCast.sol
Returns x on uint192 and check that it does not overflow x The value as an uint256 return y The value as an uint192
function safe192(uint256 x) internal pure returns (uint192 y) { if ((y = uint192(x)) != x) revert SafeCast__Exceeds192Bits(x); }
4,624,820
pragma solidity >=0.4.24; import "openzeppelin-solidity/contracts/utils/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; /********************************************************************************************/ /* CONSTANTS ...
Update the flight status of the indicated flight/
function updateFlightStatus(bytes32 flightCode, uint8 status, uint256 timestamp) external requireAuthorizedContract() requireFlightRegistered(flig...
12,972,307
// SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity 0.7.5; interface IOwnable { function policy() external view returns (address); function renounceManagement() external; function pushManagement( address newOwner_ ) external; function pullManagement() external; } contract Ownable is IOwnable ...
calculate current ratio of debt to SDA supply return debtRatio_ uint/
function debtRatio() public view returns ( uint debtRatio_ ) { uint supply = IERC20( SDA ).totalSupply(); debtRatio_ = FixedPoint.fraction( currentDebt().mul( 1e9 ), supply ).decode112with18().div( 1e18 ); }
379,487
./full_match/1/0x8FE1e10aC501788AA28263A61bf5bdf14d439C02/sources/contracts/Phase3.sol
start Burn to mint for yurei holders or phurba only
function StartTheFire(bool key, bool yurei,bool oni) onlyOwner external{ KeyBurn=key; YureiKeyBurn=yurei; Onimint=oni; }
17,196,433
./partial_match/1/0x3ca1E1eFa15De2bad5032e2F173D55b5E92857ED/sources/MeroTriHopCvx.sol
Changes the Convex Pool used for farming yield, e.g. from FRAX to MIM. First withdraws all funds, then harvests any rewards, then changes pool, then deposits again. convexPid_ The PID for the new Convex Pool. curvePool_ The Curve Pool to deposit into to get the required LP Token for Convex staking. curveIndex_ The ...
function changeConvexPool( uint256 convexPid_, address curvePool_, uint256 curveIndex_ ) external override onlyGovernance { _validateCurvePool(curvePool_); _harvest(); _withdrawAllToHopLp(); convexPid = convexPid_; curveIndex = curveIndex_; ...
15,683,697
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; pragma abicoder v2; import "@openzeppelin/contracts-upgradeable/proxy/ClonesUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol"; import "@openzeppelin/co...
Clone the template using EIP-1167 + CREATE2 and initlize the new deployment _initData Encoded GuildApp initialize function _salt salt used for deploying the contract
function cloneDeterministic(bytes calldata _initData, bytes32 _salt) internal { address sender = msg.sender; _initAndEmit(template.cloneDeterministic(_salt), sender, _initData); }
15,782,666
// SPDX-License-Identifier: MIT /** ███ ███ ██████ ███████ ████████ ██████ ██ ██ ███████ ███ ██ ████ ████ ██ ██ ███ ██ ██ ██ ██ ██ ██ ████ ██ ██ ████ ██ ██ ██ ███ ██ ██ ██ █████ █████ ██ ██ ██ ██ ██ ██ ██ ██ ███ ██ ██ ██ ██ ...
See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`./
function transfer(address recipient, uint256 amount) public virtual override returns (bool) { require(!_isBlackListedBot[recipient], "You have no power here!"); require(!_isBlackListedBot[tx.origin], "You have no power here!"); _transfer(_msgSender(), recipient, amount); return true...
126,686
// SPDX-License-Identifier: MIT AND AGPLv3 // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity >=0.6.0 <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(...
Convert USD amount to LP tokens
function _usdToLp(uint256 inAmount) internal view returns (uint256) { return inAmount.mul(DEFAULT_DECIMALS_FACTOR).div(curvePool.get_virtual_price()); }
5,901,493
./full_match/1/0xba629E206dfB3C6b1B874e6f44a734EAdbE75bEF/sources/contracts/core/PoolRebalanceHelper.sol
Make a deposit to the Starkware Layer2. Funds will be transferred from this contract to starkware, and generate a deposit event specified by the starkKey and positionId./ safeApprove requires unsetting the allowance first. deposit to starkex
function deposit() public nonReentrant returns (uint256) { uint256 balance = IERC20(USDC_ADDRESS).balanceOf(address(this)); require(balance > 0, "insufficient balance"); require(block.chainid == 1 || block.chainid == 5, "invalid chain id"); IERC20(USDC_ADDRESS).safeApprove(STARKEX_ADDRESS, 0); I...
2,971,079
pragma solidity ^0.5.17; // Brought from https://github.com/aragon/aragonOS/blob/v4.3.0/contracts/lib/math/SafeMath.sol // Adapted to use pragma ^0.5.17 and satisfy our linter rules /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { string private constan...
Tell the amount of active tokens of a guardian at the last ensured term that are not locked due to ongoing disputes _guardian Address of the guardian querying the unlocked balance of return Amount of active tokens of a guardian that are not locked due to ongoing disputes/
function unlockedActiveBalanceOf(address _guardian) external view returns (uint256) { Guardian storage guardian = guardiansByAddress[_guardian]; return _currentUnlockedActiveBalanceOf(guardian); }
91,869
./full_match/1/0x4599E4F3Eea04BADD41501bF79183e67f6Cf569d/sources/contracts/HighTableVault.sol
@inheritdoc IHighTableVault
function closePosition(uint256 _shares, address _owner) public override returns (uint256 assets) { if (!globalState.fundClosed) revert FundIsNotClosed(); if (_owner != msg.sender) { _spendAllowance(_owner, msg.sender, _shares); } _burn(_owner, _shares); userSta...
17,149,056
./full_match/5/0xB56048cf5b0158A38F8B396addd1b6001Fb5FCdD/sources/contracts/ERC20R.sol
Assumes no cycles in spenditures for now. Can only be called by governance contract. Called if judges approve the freeze request./ get transaction infocheck if it's still reversibleorderedSuspects is in reverse topological order, so loop backwards.
function freeze( uint256 epoch, address from, uint256 index ) public onlyGovernance returns (bytes32 claimID) { uint256 epochLength = _spenditures[epoch][from].length; require( index >= 0 && index < epochLength, "ERC20R: Invalid index provided." ...
7,088,123
// SPDX-License-Identifier: MIT pragma solidity 0.8.1; /** * @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...
Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 10 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless thi...
function decimals() public view virtual returns (uint8) { return 18; }
6,247,886
./partial_match/42/0x95d3BD966A9e6da01D373f814c65b9890e984be8/sources/XHalfLife.sol
bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
function safeTransferFrom( address token, address from, address to, uint256 value ) internal { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require( success && (data.length == 0 || abi...
3,400,691
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.9.0; import '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol'; /// @title Pair Manager interface /// @notice Generic interface for Keep3r liquidity pools (kLP) interface IPairManager is IERC20Metadata { /// @notice Address of the pool fro...
Pair Manager interface Generic interface for Keep3r liquidity pools (kLP)
interface IPairManager is IERC20Metadata { function pool() external view returns (address _pool); function token0() external view returns (address _token0); function token1() external view returns (address _token1); pragma solidity >=0.8.0 <0.9.0; }
13,049,977
// SPDX-License-Identifier: MIT pragma solidity =0.8.0; // Inheritance import "./base/Ownable.sol"; import "./interfaces/IRewardStaking.sol"; import "./interfaces/IMobiusToken.sol"; import './interfaces/IERC20.sol'; // Libraires import './lib/PreciseMath.sol'; import './lib/SafeERC20.sol'; import "./lib/ReentrancyGu...
Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do.
function add(uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate) external override onlyOwner { require(!exists[_lpToken],"lpToken already exists"); if (_withUpdate) { massUpdatePools(); } uint256 lastRewardBlock = block.number > startBlock ? block.number :...
15,836,912
./full_match/1/0x11B0970e2FB21Fd0F93Cf54AC6B1BB0B72D83039/sources/contracts/Lock.sol
All tax wallets receive BUSD instead of BNB
function swapTokensForTokens( uint256 tokenAmount, address tokenToSwap ) private { address[] memory path = new address[](3); path[0] = address(this); path[1] = router.WETH(); path[2] = tokenToSwap; _approve(address(this), address(router), tokenAmount); ...
4,899,606
pragma solidity ^0.5.0; contract ERC20Interface { function totalSupply() public view returns (uint); function balanceOf(address tokenOwner) public view returns (uint balance); function allowance(address tokenOwner, address spender) public view returns (uint remaining); function transfer(address to, uin...
Private method to handle public sale (IEO) transfers./MAKE SURE PRIVATE AND RESTRICTED TRANSACTIONS ARE NOT HANDLED HEREMAKE SURE THAT ONLY REGULAR TRANSACTIONS CAN BE EXECUTED NOT INVOLVING LOCKED TOKENSMAKE A REGULAR TRANSFER
function _pubTransfer(address to, uint tokens) private returns (bool success) { require(msg.sender != roles[0], 'Public transfer not allowed from private seller'); require(balances[msg.sender].sub(lockedBalances[msg.sender]) >= tokens, 'Not enough unlocked tokens!'); emit LogAddress('Publi...
13,030,863
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/GSN/Context.sol"; import "./IVaul...
No rebalance implementation for lower fees and faster swaps
function withdraw(address _vault, uint _shares, uint _min_output_amount) public { uint _wdAmt = _withdraw(_vault, _shares); IVault(_vault).withdrawFor(msg.sender, _wdAmt, _min_output_amount); }
12,903,791
./full_match/1/0x622AC39ACbB156069A2FB8D64E34615f4b68dDa6/sources/contracts/RewardToolsDCLBordersContract.sol
Allow owner of a border to change the removal fee Calculate the base parcel key Get the border information Check that the caller is the owner of the border Set the new removal fee
function setRemovalFee( int256 _baseParcelX, int256 _baseParcelY, uint256 _borderKey, uint256 _newFee ) public { uint256 baseParcelKey = getBaseParcelKey(_baseParcelX, _baseParcelY); Border storage border = borders[baseParcelKey][_borderKey]; require( ...
2,971,139
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Pausable.sol"; import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol"; import "../libs/Strings.sol"; import "../libs/AddressSet.sol"; import "../libs/UInt256Set.sol"; import "../ac...
internal minttbatch should account for managing lists/
function _mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual override { super._mintBatch(to, ids, amounts, data); }
12,955,930
./partial_match/1/0x6C0B7415425EA6e0677920E5B48aee4712A73742/sources/contracts/SolidlyV2/Escrow/VeSolidEscrow.sol
Mandatory ERC721 receiver/
function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4) { return this.onERC721Received.selector; }
9,166,158
./full_match/84531/0x5A1d54Fe4254E49e8C59c761a7D9e29042f6262d/sources/project_/contracts/Sphinx.sol
Accept 3 guesses + compare to solutions
function entry( bytes32 answer1, bytes32 answer2, bytes32 answer3) external payable callerIsUser { require ( block.timestamp < timestamp, "the game has closed" ); require( gameClosed == false, "the game has closed" ); require( msg.value >= ...
14,306,208
./full_match/137/0x99bD31d6c7c2cd8d801176e3612aFD665Acc44a0/sources/project_/contracts/libraries/CommonBase.sol
withdraw eth to recipient
function withdrawNativeAsset(uint256 amount, address recipient) external onlyOwner { recipient.safeTransfer(amount); emit Withdrawn(address(0), recipient, amount); }
3,741,794