file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/4/0x5b6329DbFf34Cc195aa8a9edcbb83d76A8C6928d/sources/Controller.sol | Validate that enough time has elapsed since component's last trade and component isn't WETH./ | function _validateTradeParameters(address _component) internal view virtual {
require(rebalanceComponents.contains(_component), "Passed component not included in rebalance");
AssetTradeInfo memory componentInfo = assetInfo[_component];
require(componentInfo.exchange != uint256(ExchangeId.No... | 696,331 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Royalty.sol";
import "@openzeppelin/contracts... | Update the additional payee sales percentage _percentage for sales Only the admin can call this/ | function additionalPayeePercent(uint96 _percentage) onlyOwner external {
additionalPayeePercentage = _percentage;
}
| 253,777 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
// Contracts
import "./BaseEscrowDapp.sol";
// Interfaces
import "../../interfaces/escrow/IEscrow.sol";
import "../../interfaces/IBaseProxy.sol";
import "../../providers/compound/CErc20Interface.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/... | Repay this Escrow's loan. If the Escrow's balance of the borrowed token is less than the amount to repay, transfer tokens from the sender's wallet. Only the owner of the Escrow can call this. If someone else wants to make a payment, they should call the loan manager directly./ | function repay(uint256 amount) external onlyBorrower whenNotPaused {
IERC20 token = IERC20(lendingToken);
uint256 balance = _balanceOf(address(token));
uint256 totalOwed = loanManager.getTotalOwed(loanID);
if (balance < totalOwed && amount > balance) {
uint256 amountNeede... | 6,352,473 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.10;
import "ds-test/test.sol";
import "./mocks/MockCaller.sol";
import "../BaseToken.sol";
import "../Minter.sol";
import "./utils/Hevm.sol";
contract MinterTest is DSTest {
Hevm internal constant hevm = Hevm(HEVM_ADDRESS);
// contracts
BaseToke... | Activate sale. Mint. | function testFailMintNotEnoughEther() public {
minter.flipSaleState();
minter.setPrice(0.08 ether);
}
| 7,245,592 |
./partial_match/3/0x2e4c311BbD6e2E65Bd7b0167a3d71F9cc924B112/sources/IbETHRouter.sol | Remove ETH and Alpha from ibETH-Alpha Pool. 1. Remove ibETH and Alpha from the pool. 2. Unwrap ibETH to ETH. 3. Return ETH and Alpha to caller. | function removeLiquidityETH(
uint256 liquidity,
uint256 amountAlphaMin,
uint256 amountETHMin,
address to,
uint256 deadline
) public returns (uint256 amountAlpha, uint256 amountETH) {
TransferHelper.safeTransferFrom(lpToken, msg.sender, address(this), liquidity);
... | 5,121,540 |
pragma solidity ^0.4.24;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIABL... | Transfers eligible payout funds to insuree/ | function pay () external pure {
}
| 12,545,813 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;
import "./NFTSplitterAdmin.sol";
import "./NFTSplitterProxy.sol";
/**
* @notice This contract creates new Splitter proxies
* @dev it registers all proxy contracts in the storage of Admin contract
*/
contract NFTSplitterFactory {
address private owner;
add... | returns the current address od the Splitter Base contract that contains/ | function getNFTSplitterBase() external view returns (address) {
return NFTSplitterBase;
}
| 6,364,574 |
// SPDX-License-Identifier: GNU AGPLv3
/**
* @dev Implementation of the Bumo (BU) ERC20 Token.
*
* Pausable
* Burnable
* Mintable
* No supply cap
* Ownership - Renounce ownership has been diabled
*
* Compile options:
* Solc Verison: v0.7.2+commit.51b20bc0
* Enable Optimization: true
*
* License:
* GNU ... | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer();
_balances[sender] = _bal... | 2,095,321 |
./full_match/1/0x3c1164531d5857029ae5412E49999306547834d8/sources/@rmrk-team/evm-contracts/contracts/RMRK/library/RMRKLib.sol | Used to determine the index of the item in the array by spedifying its value. This was adapted from Cryptofin-Solidity `arrayUtils`. If the item is not found the index returned will equal `0`. A The array containing the item to be found a The value of the item to find the index of return The index of the item in th... | function indexOf(
uint64[] memory A,
uint64 a
) internal pure returns (uint256, bool) {
uint256 length = A.length;
for (uint256 i; i < length; ) {
if (A[i] == a) {
return (i, true);
}
unchecked {
++i;
... | 9,657,623 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeab... | user has already withdrawn stake | function _calculateRewardAmount(
StakingPoolLib.Config memory _config,
User memory _user,
uint256 rewardIndex
) internal pure returns (uint256) {
if (_config.rewardType == StakingPoolLib.RewardType.FIXED) {
return _user.rewardAmounts[rewardIndex];
}
i... | 5,534,238 |
//Address: 0x3f45d2d5feb6b4b000d2d3b84442eeddf54a735a
//Contract name: LiquidPledging
//Balance: 0 Ether
//Verification Date: 12/20/2017
//Transacion Count: 9
// CODE STARTS HERE
//File: contracts/ILiquidPledgingPlugin.sol
pragma solidity ^0.4.11;
/*
Copyright 2017, Jordi Baylina
Contributors: Adrià Massane... | A getter to find if a specified Project has been canceled projectId The Admin id number used to specify the Project return True if the Project has been canceled | function isProjectCanceled(uint64 projectId) constant returns (bool) {
PledgeAdmin storage m = findAdmin(projectId);
if (m.adminType == PledgeAdminType.Giver) return false;
assert(m.adminType == PledgeAdminType.Project);
if (m.canceled) return true;
if (m.parentProject == 0) ... | 12,923,160 |
./partial_match/137/0xD1178fC23853c2d469fddf5303F1bB026FbD3DB9/sources/WildcardSteward_matic_v1.sol | Required interface of an ERC721 compliant contract./ | interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
function bala... | 3,527,149 |
//Address: 0x7f1d1c0a0c3a5ff6f5523b939b769b9f88509122
//Contract name: PeerLicensing
//Balance: 0.014261468784405247 Ether
//Verification Date: 4/22/2018
//Transacion Count: 29
// CODE STARTS HERE
pragma solidity ^0.4.23;/*
_ _____ ___ _ _ __
` __ ___ ___ _ _ ,'
`. __ ____ /__ ,'
`. __ __ / ... | Converts a number tokens into an Ether value. How much reserve Ether do we have left in the contract? If you're the Highlander (or bagholder), you get The Prize. Everything left in the vault. If there would be excess Ether left after the transaction this is called within, return the Ether corresponding to the equation ... | function getEtherForTokens(uint256 tokens) public constant returns (uint256 ethervalue) {
var reserveAmount = reserve();
if (tokens == (totalBondSupply_BULL + totalBondSupply_BEAR) )
return reserveAmount;
return sub(reserveAmount, fixedExp((fixedLog(totalBondSupply_BULL + totalBondSupply_BEAR - tokens) - pr... | 905,656 |
./full_match/137/0x1e3fCa63502a7AaA6841788301Eae4AC67CF691D/sources/scripts/Learning_Projects/CheeseTouch.sol | Approve `operator` to operate on all of `owner` tokens Emits a {ApprovalForAll} event./ | function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "CheeseTouch: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
| 4,755,550 |
./full_match/1/0x18d9244DC85306DBc0AAE16cF8FAE9aEFAee7530/sources/ForbitswapRouter.sol | SWAP requires the initial amount to have already been sent to the first pair | function _swap(
uint256[] memory amounts,
address[] memory path,
address _to
) internal virtual {
for (uint256 i; i < path.length - 1; i++) {
(address input, address output) = (path[i], path[i + 1]);
(address token0, ) = ForbitswapLibrary.sortTok... | 9,783,515 |
pragma solidity ^0.4.21;
/**
* @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 value) re... | Баланс токенов на данном контракте | function tokenContractBalance() constant returns (uint256) {
return token.balanceOf(address(this));
}
| 7,963,638 |
./partial_match/3/0x2C02cD8a2645D97977E7ffE74Ed21a943ba465E0/sources/pool.sol | net-withdraw amount;/ sum total collateral in USDT count collateral at issue time | function NWA() public view returns (uint) {
uint totalCollateral;
for (uint i = 0;i< _options.length;i++) {
totalCollateral = totalCollateral.add(_options[i].totalSupply() * _options[i].strikePrice());
}
if (minCollateral <= usdtsToIssue) {
return 0;
... | 5,241,300 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
/* solhint-disable not-rely-on-time */
import { console } from "hardhat/console.sol";
/// @notice Errors library.
library Errors {
string internal constant _BodyEmpty = "Message body can't be empty";
string internal constant _NotOwner = "Caller isn't th... | Returns the message with the corresponding id. Logs debugging information. Throws when the message doesn't exists. id The message's id. return The message's struct fields. | function getMessage(uint256 id)
external
view
messageExists(id)
returns (
uint256,
string memory,
address,
uint256,
uint256,
bool
)
{
console.log("Loading message with id %s.", id);
re... | 12,844,889 |
./full_match/42/0xe3A431745a39502E7272329119BE93Ce1e0eac8d/sources/contracts/AaveNFTAuction.sol | This private function, only called once in "InitializeShards," initiates auctions for all shards./ | function setupAuctions(uint256 _startTimestamp, uint256 _duration, uint256 _startPrice) private {
uint256 _endTimestamp = _startTimestamp.add(_duration);
for (uint256 i = 0; i < totalShards; i++) {
auctions[i] = Auction(_startTimestamp, _endTimestamp, _startPrice, 0, 0, address(0), i);
... | 9,576,954 |
./partial_match/1/0x8408BaCcc231a6BbA766ed15571403468b32bFA5/sources/NowPass.sol | Sets the state of whether the collection metadata is revealed | function setRevealed(bool _state) public onlyOwner
{
require(revealed == false, "Cannot be unrevealed");
revealed = _state;
}
| 9,340,479 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.8.0;
// Sources flattened with hardhat v2.6.7 https://hardhat.org
// File contracts/Math/SafeMath.sol
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. T... | Get the timelock address from the minter Make sure the new address is not address(0) | function setAMOMinter(address _amo_minter_address) external onlyByOwnGov {
amo_minter = IFraxAMOMinter(_amo_minter_address);
timelock_address = amo_minter.timelock_address();
require(timelock_address != address(0), "Invalid timelock");
}
| 448,752 |
./partial_match/1/0x81373f4E8D0BD48bbE8842E9eE16dB7B60c20613/sources/src/libraries/FixedPointMath.sol | Creates a rational fraction as a Number from 2 uint256 values n The numerator. d The denominator. return The fixed point decimal representation./ | function rational(uint256 n, uint256 d) internal pure returns (Number memory) {
Number memory numerator = encode(n);
return FixedPointMath.div(numerator, d);
}
| 9,375,072 |
./full_match/5/0xB78299e5183C7746D825D9f92ABF6368F54f8537/sources/contracts/y00tsAnchorClub.sol | Returns true if `account` is a contract. [IMPORTANT] ==== It is unsafe to assume that an address for which this function returns false is an externally-owned account (EOA) and not a contract. Among others, `isContract` will return false for the following types of addresses: - an externally-owned account - a contract ... | function isContract(address account) internal view returns(bool) {
return account.code.length > 0;
}
| 1,879,437 |
./full_match/1/0xcc7C704514198E379884B0Ccf1A604219cC1c03c/sources/src/Vault.sol | won't overflow since time is nowhere near uint256.max can overflow if _lockedProfit difference > uint256.max but in practice should never happen | function lockedProfit() public view returns (uint256 lockedAssets) {
uint256 last = lastReport;
uint256 duration = lockedProfitDuration;
unchecked {
if (block.timestamp >= last + duration) return 0;
return _lockedProfit - _lockedProfit.mulDivDown(block.timestamp - last, duration);
}
}
| 4,912,860 |
./partial_match/1/0x183b1C0339A97b097a827b5387F542b1CD147Ba6/sources/contracts/SaveOurDailyDoser.sol | Allow owner to send `mintNumber` tokens without cost to multiple addresses _receivers Array of addresses to send tokens to _mintNumber Array of number of tokens to send to each address/ | function gift(address[] calldata _receivers, uint256[] calldata _mintNumber)
external
onlyOwner
{
require(
_receivers.length == _mintNumber.length,
"ARRAYS_MUST_BE_SAME_LENGTH"
);
uint256 totalMint = 0;
for (uint256 i = 0; i < _mintNumber.l... | 15,553,074 |
./partial_match/97/0x53fADa23F98672442B6fE5Ff0Cb6b341a10EF062/sources/AnimalFactory.sol | The structure defining a single animal | {
struct AnimalProperties
{
uint id;
string name;
string desc;
bool upForSale;
uint priceForSale;
bool upForMating;
bool eggPhase;
uint priceForMating;
bool isBornByMating;
uint parentId1;
uint parentId2;
uint birthd... | 11,440,486 |
./full_match/1/0xd2aa885f3231CbB7763450E94b79B9fc4d101D03/sources/browser/Power.sol | / If x >= 2, then we compute the integer part of log2(x), which is larger than 0. If x > 1, then we compute the fraction part of log2(x), which is larger than 0. | This functions assumes that "x >= FIXED_1", because the output would be negative otherwise.
function generalLog(uint256 _x) internal pure returns (uint256) {
uint256 res = 0;
uint256 x = _x;
if (x >= FIXED_2) {
uint8 count = floorLog2(x / FIXED_1);
res = count * FIXED_1;
}
if (... | 2,982,865 |
./full_match/80001/0xb022b7A15d6a499BC6F4Ee6257Cc35fD013b5269/sources/src/web3/contracts/Market.sol | create a MarketItem for NFT sale on the marketplace. List an NFT./ change to approve mechanism from the original direct transfer to marketIERC721(nftContract).transferFrom(msg.sender, address(this), tokenId); | function createMarketItem(
address nftContract,
uint256 tokenId,
uint256 price
) public payable nonReentrant {
require(price > 0, "Price must be at least 1 wei");
require(msg.value == listingFee, "Fee must be equal to listing fee");
require(IERC721(nftContract).getApproved(tokenId) == addr... | 849,353 |
pragma solidity ^0.4.17;
// ----------------------------------------------------------------------------
// Token Trustee Implementation
//
// Copyright (c) 2017 OpenST Ltd.
// https://simpletoken.org/
//
// The MIT Licence.
// ----------------------------------------------------------------------------
//... | Push model which allows ops to transfer tokens to the beneficiary. The exact amount to transfer is calculated based on agreements with the beneficiaries. Here we only restrict that the total amount transfered cannot exceed what has been granted. | function processAllocation(address _account, uint256 _amount) external onlyOps returns (bool) {
require(_account != address(0));
require(_amount > 0);
Allocation storage allocation = allocations[_account];
require(allocation.amountGranted > 0);
uint256 transferable = alloc... | 12,781,055 |
/**
*Submitted for verification at Etherscan.io on 2021-05-14
*/
// 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 minDebtPerHarv... | Here we determine if better to market-buy yvBOOST or mint it via backscratcher Using reserve ratios of swap pairs will allow us to compare whether it's more efficient to: 1) Buy yvBOOST (unwrapped for yveCRV) 2) Buy CRV (and use to mint yveCRV 1:1) Convert yvBOOST to yveCRV Here we favor minting by a % value defined ... | function shouldMint(uint256 _amountIn) internal returns (bool) {
address[] memory path = new address[](3);
path[0] = usdc;
path[1] = weth;
path[2] = yvBoost;
uint256[] memory amounts = ISwap(sushiswap).getAmountsOut(_amountIn, path);
uint256 projectedYvBoost = amounts... | 15,230,354 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
interface IERC20 {
function TOTALSUPPLY267() exte... | inject NONSTANDARD NAMING | function WITHDRAW_FEE118(address _want, uint _amount) external view returns (uint) { | 13,085,403 |
./full_match/100/0xF2B4E81ba39F5215Db2e05B2F66f482BB8e87FD2/sources/project_/contracts/superfluid/SuperfluidToken.sol | ISuperfluidToken.makeLiquidationPayoutsV2 implementation we set the rewardAccount to the user who executed the liquidation if no rewardAccount is set (aka. ANARCHY MODE - should not occur in reality, for testing purposes) LIKELY BRANCH: target account pays penalty to rewarded account LESS LIKELY BRANCH: target account ... | function makeLiquidationPayoutsV2(
bytes32 id,
bytes memory liquidationTypeData,
) external override onlyAgreement {
address rewardAccount = _getRewardAccount();
if (rewardAccount == address(0)) {
rewardAccount = liquidatorAccount;
}
address rewardAm... | 14,278,261 |
//SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.4;
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/security/ReentrancyGuard.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
/**
* @title IFO
* @notice IFO model with 2 pools
*/
contract IFO is Ree... | It allows the admin to recover wrong tokens sent to the contract _tokenAddress: the address of the token to withdraw (18 decimals) _tokenAmount: the number of token amount to withdraw This function is only callable by admin./ | function recoverWrongTokens(address _tokenAddress, uint256 _tokenAmount) external onlyOwner {
require(_tokenAddress != address(dealToken), "Cannot be deal token");
require(_tokenAddress != address(offeringToken), "Cannot be offering token");
IERC20(_tokenAddress).safeTransfer(address(msg.se... | 12,877,375 |
pragma solidity ^0.4.23;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed p... | Unpauses the smart contract. can't unpause if contract was upgraded | function unpause() public onlyDev whenPaused {
paused = false;
}
| 12,851,772 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "./IOffer.sol";
import "../Chainlink/IPriceFeeds.sol";
import "../PricingTable/IPricingTable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ut... | Set PriceFeed linked to the contract to a new PriceFeed (`priceFeed`) Can only be called by the owner/ | function setPriceFeedAddress(address _newPriceFeed) external onlyOwner {
require(_newPriceFeed != address(0));
address oldPriceFeed = address(priceFeed);
priceFeed = IPriceFeeds(_newPriceFeed);
emit NewPriceFeedContract(oldPriceFeed, _newPriceFeed);
}
| 6,413,978 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma abicoder v2;
import {
ISuperfluid,
ISuperToken,
ISuperApp,
ISuperAgreement,
SuperAppDefinitions,
BatchOperation
} from "./ISuperfluid.sol";
// When you're ready to leave Remix, change imports to follow this pattern:
// "@superfluid-f... | CRUD FUNCTIONS/ add a new user to the mappings | function _addUser(address userToAdd, address providerOfUser, int96 price) private {
providerUsers[providerOfUser].push(userToAdd);
}
| 1,067,576 |
./partial_match/1/0xa912bD0610A1031Ee1D6b547e3800759Adf04d09/sources/OMNINFTProxy.sol | Delegates the current call to the address returned by `_implementation()`. This function does not return to its internal call site, it will return directly to the external caller./ | function _fallback() internal virtual {
_delegate(getImplementation());
}
| 9,296,403 |
./partial_match/1/0x7b05cE308915299B0a31D5E5f020b4DE66779BCa/sources/contracts/BSGGStaking.sol | Get amount the account has active staked in a ticket type _ticketTypeId Ticket Type ID _account Account return uint | function getActiveStaked(uint _ticketTypeId, address _account) external view returns (uint) {
return activeStaked[_ticketTypeId][_account];
}
| 9,150,401 |
// File: contracts/Math.sol
pragma solidity ^0.5.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
... | get fee for recieverreward = collectFee(phx,reward); | function getReward() public updateReward(msg.sender) payable notHalted nonReentrant {
uint256 reward = earned(msg.sender);
if (reward > 0) {
rewards[msg.sender] = 0;
uint256 preBalance = IERC20(phx).balanceOf(address(this));
IERC20(phx).transfer(msg.sender, reward... | 14,804,350 |
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.6.12;
import "../math/SafeMathUint128.sol";
import "../interfaces/IHEZToken.sol";
import "../interfaces/IHermezAuctionProtocol.sol";
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ReentrancyG... | Allows to change the `_donationAddress` if it's called by the owner newDonationAddress new `_donationAddress` Events: `NewDonationAddress`/ | function setDonationAddress(address newDonationAddress)
external
override
onlyGovernance
{
require(
newDonationAddress != address(0),
"HermezAuctionProtocol::setDonationAddress: NOT_VALID_ADDRESS"
);
_donationAddress = newDonationAddress;
... | 11,841,094 |
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import "./zksync/ReentrancyGuard.sol";
import "./zksync/Events.sol";
import "./Storage.sol";
import "./zksync/Bytes.sol";
import "./zksync/Utils.sol";
import "./zksync/SafeMath.sol";
import "./zksync/SafeCast.sol"... | Add tokens to the list of networks tokens _tokenIdList Token id list _tokenAddressList Token address list _standardList Token standard list _mappingTokenList Mapping token list | function addTokens(uint16[] calldata _tokenIdList, address[] calldata _tokenAddressList, bool[] calldata _standardList, uint16[] calldata _mappingTokenList) external {
for (uint i; i < _tokenIdList.length; i++) {
addToken(_tokenIdList[i], _tokenAddressList[i], _standardList[i], _mappingTokenList... | 13,005,396 |
/**
*Submitted for verification at Etherscan.io on 2021-03-25
*/
pragma solidity =0.6.6;
interface IBoxswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (ad... | refund dust eth, if any | function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external virtual override payable ensure(deadline) returns (uint amountToken, uint amountETH, uint liquidity) {
(amountTok... | 10,838,952 |
pragma solidity ^0.4.18;
/**
* @title Owned contract with safe ownership pass.
*
* Note: all the non constant functions return false instead of throwing in case if state change
* didn't happen yet.
*/
contract Owned {
/**
* Contract owner address
*/
address public contractOwner;
/**
* ... | Passes execution into virtual function. Can only be called by assigned asset proxy. return success. function is final, and must not be overridden./ | function __transferWithReference(address _to, uint _value, string _reference, address _sender) public onlyProxy returns (bool) {
return _transferWithReference(_to, _value, _reference, _sender);
}
| 1,265,313 |
./full_match/8453/0x34bE60b50DdC8a8521dd8b2FF138Dfb635c17681/sources/contracts/quest/Quest.sol | Safely transfer ERC20 token. _tokenAddress Token contract address _recipient Recipient's address _amount Amount to transfer _gasLimit Gas limit for the transfer call return (success, reason) Some tokens do not revert when transfer fails, and some tokens do not return true. This function is able to handle such toke... | function safeTransferERC20(
address _tokenAddress,
address _recipient,
uint256 _amount,
uint256 _gasLimit
) internal returns (bool, bytes memory) {
bytes memory data = abi.encodeWithSelector(
bytes4(keccak256("transfer(address,uint256)")),
_recipie... | 11,535,638 |
pragma solidity 0.4.24;
// File: openzeppelin-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 owner... | 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
onlyValidDestination(_to)
returns (bool)
{
return super.transferFrom(_from, _to, _value);
}
| 12,600,904 |
pragma solidity ^0.6.6;
pragma experimental ABIEncoderV2;
import "./Address.sol";
import "./IACOPool2.sol";
/**
* @title ACOPoolFactory
* @dev The contract is the implementation for the ACOProxy.
*/
contract ACOPoolFactory2 {
/**
* @dev Struct to store the ACO pool basic data.
*/
struct ACOP... | Internal function to create a new ACO pool. initData Data to initialize o ACO Pool. return Address of the new minimal proxy deployed for the ACO pool./ | function _createAcoPool(IACOPool2.InitData memory initData) internal virtual returns(address) {
address acoPool = _deployAcoPool(initData);
acoPoolBasicData[acoPool] = ACOPoolBasicData(initData.underlying, initData.strikeAsset, initData.isCall);
emit NewAcoPool(
initData.underly... | 128,908 |
./full_match/137/0x7eF2460D6643f37d317B9AA274cF76e4D9f24071/sources/contracts/erc20-bep20-trc20-token-template/ERC20Token.sol | set the presenter of the token to decide transfer functionality _presenter address of presenter/ | function setPresenter(address _presenter) onlyOwner public {
presenter = _presenter;
}
| 4,675,091 |
./partial_match/1/0x0C736ED2B5fA80A0cd4Bb2956131598CbF13736C/sources/FUCKFUCKFUCK.sol | See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for... | function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: tra... | 3,965,498 |
pragma solidity ^0.4.24;
// File: openzeppelin-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 owne... | getNativeReputation _avatar the organization avatar. return organization native reputation/ | function getNativeReputation(address _avatar) external isAvatarValid(_avatar) view returns(address) {
return address(nativeReputation);
}
| 1,299,111 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.21 <0.7.0;
import "../contracts/lifecycle/Ownable.sol";
/**
* The ERC721TokenRegistry is a basic registry mapping token symbols
* to their known, deployed addresses on the current blockchain.
*
* Note that the TokenRegistry does *not* mediate any of the
* co... | Given a symbol, resolves the current address of the token the symbol is mapped to./ | function getTokenAddressBySymbol(string memory _symbol) public view returns (address) {
bytes32 symbolHash = keccak256(abi.encode(_symbol));
TokenAttributes storage attributes = symbolHashToTokenAttributes[symbolHash];
return attributes.tokenAddress;
}
| 14,038,982 |
/*
* Copyright 2019, Offchain Labs, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or ag... | fields _beforeHash _beforeInbox | function bisectAssertion(
Challenge storage _challenge,
bytes32[2] memory _fields,
bytes32[] memory _afterHashAndMessageAndLogsBisections,
uint256[] memory _totalMessageAmounts,
uint32 _totalSteps,
uint64[2] memory _timeBounds,
bytes21[] memory _tokenTypes,
... | 14,121,389 |
./full_match/1/0x8CD834258d000166769733Dfb5fB6fD6E43dB4e7/sources/@nftculture/nftc-contracts/contracts/financial/NFTCPaymentSplitterBase.sol | Getter for the amount of payee's releasable Ether./ | function releasable(address account) public view returns (uint256) {
return _releasable(account);
}
| 4,861,781 |
./full_match/43113/0x0B86ec194B844a23bC31DD17506e2621B16265DA/sources/contracts/ERC721Tradable.sol | increments the value of _currentTokenId/ | function _incrementTokenId() private {
_currentTokenId++;
}
| 7,172,198 |
./partial_match/4/0xD66D362aDeD1d0c9Eac9d22A876A7d17C2DA8579/sources/Backo.sol | Add funds according to the membership level `_levelId` for `_rounds` rounds | function addFund(uint256 _rounds, uint256 _levelId)
public
payable
stopInEmergency
{
require(msg.sender != creator);
uint256 price = _rounds.mul(levelInfos[_levelId].amountPerRound);
require(msg.value >= price, 'addFund: Not enough value');
LevelInfo storage levelInfo = levelInfos[_level... | 16,990,862 |
./full_match/1/0x19de553a8CfFCFF8CB49E236C1a499F9CF083b97/sources/contracts/token/onft/ONFT721Core.sol | When a srcChain has the ability to transfer more chainIds in a single tx than the dst can do. Needs the ability to iterate and stop if the minGasToTransferAndStore is not met if not enough gas to process, store this index for next loop | function _creditTill(
uint16 _srcChainId,
address _toAddress,
uint _startIndex,
uint[] memory _tokenIds
) internal returns (uint256) {
uint i = _startIndex;
while (i < _tokenIds.length) {
if (gasleft() < minGasToTransferAndStore) break;
_c... | 16,597,540 |
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import 'OpenZeppelin/openzeppelin-contracts@3.2.0/contracts/math/SafeMath.sol';
import '../Governable.sol';
import '../../interfaces/IOracle.sol';
import '../../interfaces/IBaseOracle.sol';
import '../../interfaces/IERC20Wrapper.sol';
contract ProxyOracle is ... | Return whether the oracle supports evaluating collateral value of the given token. | function support(address token, uint id) external view override returns (bool) {
if (!whitelistERC1155[token]) return false;
address tokenUnderlying = IERC20Wrapper(token).getUnderlyingToken(id);
return oracles[tokenUnderlying].liqIncentive != 0;
}
| 942,328 |
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.10;
import "../types/ExodusAccessControlled.sol";
import "../interfaces/IERC20.sol";
abstract contract FrontEndRewarder is ExodusAccessControlled {
/* ========= STATE VARIABLES ========== */
uint256 public daoReward; // % reward for dao (3 decima... | set rewards for front end operators and DAO/ | function setRewards(uint256 _toFrontEnd, uint256 _toDAO) external onlyGovernor {
refReward = _toFrontEnd;
daoReward = _toDAO;
}
| 6,404,660 |
./partial_match/42/0xAb4fDe17F6a078fEc8A1320530664EF8877bb248/sources/AToken2PTokenMigrator.sol | 验证需要转换的两个代币是否正确将pToken转给用户将pToken转给用户 | function migrate(address aToken, address payable pToken, uint amount) public {
address self = address(this);
ATokenInterface aTokenInstance = ATokenInterface(aToken);
address underlyingAssetAddress = aTokenInstance.underlyingAssetAddress();
if (underlyingAssetAddress == address(0x... | 3,316,608 |
pragma solidity ^0.6.6;
// SPDX-License-Identifier: MIT
/*
* @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 de... | transfer remaining tokens to the account | function rescuePoints(address account, uint256 pool)
public
poolExists(pool)
updateReward(account, pool)
nonReentrant
returns (uint256)
{
require(msg.sender == rescuer, "!rescuer");
Pool storage p = pools[pool];
uint256 earnedPoints = p.points[account];
p.spentPoints = p.spentPo... | 5,394,751 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.1;
pragma experimental ABIEncoderV2;
/**
* @title The Primitive House -> Manages collateral, leverages liquidity.
* @author Primitive
*/
// Open Zeppelin
import {IERC1155} from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import {IERC20} from "@openz... | Hook to be implemented by higher-level Manager contract after redemption occurs./ Update claim for quoteTokens Push base tokens | function _onAfterRedeem(
bytes32 oid,
uint256 amount,
address receiver,
uint256 lessQuote
) internal override returns (bool) {
console.log("subtracting base claim");
(, address quoteToken, , , ) = getParameters(oid);
_collateralBalance[quoteToken] -= lessQ... | 6,417,599 |
/**
*Submitted for verification at Etherscan.io on 2021-07-15
*/
// Sources flattened with hardhat v2.1.1 https://hardhat.org
// File contracts/Interfaces/IBorrowerOperations.sol
// MIT
pragma solidity 0.6.11;
// Common interface for the Trove Manager.
interface IBorrowerOperations {
// --- Events ---
... | trigger bamm (p)lqty claim duplicate harvest logic | function getUnclaimedLqty(address user, BAMM bamm, ERC20 token) external returns(uint) {
bamm.withdraw(0);
if(bamm.total() == 0) return 0;
uint crop = sub(token.balanceOf(address(bamm)), bamm.stock());
uint share = add(bamm.share(), rdiv(crop, bamm.total()));
uint last = b... | 11,856,180 |
./full_match/43114/0x9cFfe34Cd34537a95Ff1bd0816C443c6482E9B71/sources/VAXPATToken.sol | Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openzeppelin-contracts/pull/522 | function tryMul(uint256 a, uint256 b) internal pure returns(bool, uint256) {
unchecked {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
| 4,643,065 |
/**
*Submitted for verification at BscScan.com on 2021-10-28
*/
/**
*Submitted for verification at arbiscan.io on 2021-09-22
*/
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.2;
interface ISushiswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
eve... | given some amount of an asset and pair reserves, returns an equivalent amount of the other asset | function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) {
require(amountA > 0, 'SushiswapV2Library: INSUFFICIENT_AMOUNT');
require(reserveA > 0 && reserveB > 0, 'SushiswapV2Library: INSUFFICIENT_LIQUIDITY');
amountB = amountA.mul(reserveB) / reserveA;
... | 1,038,042 |
./partial_match/3/0xd19B106B5D780962766Aa1Edc0Ce3c83ef999637/sources/CallistoMaker.sol | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accCTOPerShare... | 5,081,668 |
./partial_match/8453/0xd9063d6E82BE1DfC705E53F47De5fcB73D59d935/sources/Sevens.sol | Store value in variable num value to store/ | function store(uint256 num) public {
num = 777;
number = num;
}
| 16,727,445 |
./full_match/1/0xdF9Fb9E7731DfA4a17aDbB3a462E30470eb4d802/sources/contracts/ClosedDoors.sol | Returns the set price based on the tokenId given _tokenId the tokenId to get the class and determine the price of/ Keys are first in the token order so check those first | function getPricePerClass(uint256 _tokenId) internal view returns (uint256) {
return priceKeyS;
return 0;
}
| 3,874,234 |
pragma solidity 0.5.17;
import "@chainlink/contracts/src/v0.5/interfaces/AggregatorInterface.sol";
import {Ownable} from "@openzeppelin/contracts/ownership/Ownable.sol";
import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol";
contract Oracle is Ownable {
using SafeMath for uint;
AggregatorInterfac... | The latestAnswer value for all USD reference data contracts is multiplied by 100000000 before being written on-chain and by 1000000000000000000 for all ETH pairs./ | function getPriceFeed() public view returns(uint[] memory feed) {
int256 ethUsdRate = ethUsdAggregator.latestAnswer();
feed = new uint[](refs.length);
for(uint8 i = 0; i < refs.length; i++) {
feed[i] = uint(refs[i].latestAnswer() * ethUsdRate).div(1e8);
}
}
| 6,443,254 |
./full_match/1/0x84524bAa1951247b3A2617A843e6eCe915Bb9674/sources/contracts/MainHelper.sol | Helper function to convert {_amount} of a certain pool with {_poolToken} into lending shares. Includes devison by zero and share security checks. Needs latest pseudo amount for accurate result./ | function calculateLendingShares(
address _poolToken,
uint256 _amount
)
public
view
returns (uint256)
{
uint256 shares = getTotalDepositShares(
_poolToken
);
if (shares <= 1) {
return _amount;
}
uint256 ... | 8,497,264 |
./partial_match/4/0x2f3c81fa2b0E171A135C128142Dbf877213c5071/sources/LiquidPledging.sol | `onlyVault` Cancels a withdraw request, changing the PledgeState from Paying back to Pledged idPledge Id of the pledge that's withdraw is to be canceled amount Quantity of ether (in wei) to be canceled When a payment is canceled, never is assigned to a project. | function cancelPayment(uint64 idPledge, uint amount) public onlyVault {
Pledge storage p = _findPledge(idPledge);
require(p.pledgeState == PledgeState.Paying);
uint64 idOldPledge = _findOrCreatePledge(
p.owner,
p.delegationChain,
0,
0,
... | 8,506,666 |
// SPDX-License-Identifier: Apache-2.0
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by a... | Initialize and register this feature. Should be delegatecalled by `Migrate.migrate()`. return success `LibMigrate.SUCCESS` on success. | function migrate()
external
returns (bytes4 success)
{
_registerFeatureFunction(this.transferProtocolFeesForPools.selector);
_registerFeatureFunction(this.fillLimitOrder.selector);
_registerFeatureFunction(this.fillRfqOrder.selector);
_registerFeatureFunction(this... | 2,544,587 |
/*
* source https://github.com/lukso-network/rICO-smart-contracts
* @name rICO
* @package rICO-smart-contracts
* @author Micky Socaci <micky@binarzone.com>, Fabian Vogelsteller <@frozeman>, Marjorie Hernandez <marjorie@lukso.io>
* @license MIT
*/
pragma solidity ^0.5.0;
import "./zeppe... | Returns the rICOs available ETH to reserve tokens at a given stage. _stageId the stage ID./ past stages last stage current stage later stages | function committableEthAtStage(uint8 _stageId, uint8 _currentStage) public view returns (uint256) {
uint256 supply;
if(_stageId < _currentStage) {
return 0;
supply = tokenSupply;
supply = stages[_currentStage].tokenLimit.sub(
initialTokenSupply.... | 6,399,478 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import '@openzeppelin/contracts/security/Pausable.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/security/ReentrancyGuard.sol';
import './ERC721NonTransferable.sol';
/**
* @title Proof of Residency
* @custom:securit... | Gets if a token challenge for an address has expired (and becomes eligible for burning/re-issuing)./ slither-disable-next-line timestamp | function tokenChallengeExpired(address owner) public view returns (bool) {
return tokenChallengeExists(owner) && _tokenChallengeExpirations[owner] <= block.timestamp;
}
| 7,326,936 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.9;
/* EXTERNAL DEPENDENCIES */
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/escrow/Escrow.sol";
/* INTERNAL DEPENDENCIES */
import "./CommonStructs.sol";
/**
* @title Instructions Provider contract
* @notice This ... | Block OpenZeppelin Ownable.renounceOwnership Will always revert/ | function renounceOwnership() public pure override {
revert('Contract cannot be revoked');
}
| 2,485,407 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.1;
import {LibAppStorage, AppStorage, SvgLayer} from "./LibAppStorage.sol";
//import "hardhat/console.sol";
library LibSvg {
event StoreSvg(LibSvg.SvgTypeAndSizes[] _typesAndSizes);
struct SvgTypeAndSizes {
bytes32 svgType;
uint256[] sizes;... | console.log("length:", svgLayers.length); | function getSvg(SvgLayer[] storage _svgLayers, uint256 _id) internal view returns (bytes memory svg_) {
require(_id < _svgLayers.length, "LibSvg: SVG type or id does not exist");
SvgLayer storage svgLayer = _svgLayers[_id];
address svgContract = svgLayer.svgLayersContract;
uint256 si... | 7,294,004 |
./partial_match/1/0xa48239e8caA341fc16EDCf369bbefB72E2df40F1/sources/YieldBot.sol | get balance of liquidity pair calculate amount to burn pull tokens from pancakePair liquidity and move to dead address permanently | function autoBurnLiquidityTokens(address to) internal returns (bool) {
lastLiquidityBurnTime = block.timestamp;
uint256 liquidityPairBalance = this.balanceOf(uniswapV2Pair);
uint256 amountToBurn = liquidityPairBalance.mul(percentForLiquidityBurn).div(
10000
);
... | 3,577,795 |
pragma solidity ^0.5.17;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high... | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(
address delegatee,
uint256 nonce,
uint256 expiry,
uint8 v,
bytes32 r,
bytes32 s
) public {
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name)),
... | 6,576,281 |
/**
*Submitted for verification at Etherscan.io on 2021-07-12
*/
// Verified using https://dapp.tools
// hevm: flattened sources of src/lender/assessor.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.5.15 >=0.6.12;
////// lib/tinlake-auth/src/auth.sol
// Copyright (C) Centrifuge 2020, based on Mak... | expected senior return if no losses occur | function calcExpectedSeniorAsset(uint seniorRedeem, uint seniorSupply, uint seniorBalance_, uint seniorDebt_) public pure returns(uint) {
return safeSub(safeAdd(safeAdd(seniorDebt_, seniorBalance_),seniorSupply), seniorRedeem);
}
| 5,476,482 |
./partial_match/42/0xcEDb23F6df222E16bBB6070bB4E27A90493e63DB/sources/Treasury.sol | File: contracts/interfaces/IWeth.sol | interface IWeth is IERC20 {
function deposit() external payable;
function withdraw(uint) external;
}
| 8,945,142 |
// SPDX-License-Identifier: MIT
// Smart Contract Written by: Ian Olson
/*
____ __ ______ __
/ __ )________ ____ ____/ /___ _____ / ____/__ _________ ____ _____ ____/ /__ ______
/ __ / ___/ _ \/ __ \/ __ / __ `/ __ \ / /_ / _ \/... | Enable pre-sale on the mint function. Ian Olson | function enableMinting() public onlyAdmin {
active = true;
}
| 1,116,451 |
./partial_match/1/0xC88F47067dB2E25851317A2FDaE73a22c0777c37/sources/oneBTC.sol | oracle asset for collateral (oneBTC is BTC, oneWHBAR is WHBAR, etc...) | function setChainLinkStimulusOracle(address oracle_)
external
btcLPGov
returns (bool)
{
chainlinkStimulusOracle = AggregatorV3Interface(oracle_);
chainLink = true;
return true;
}
| 2,613,981 |
pragma solidity >=0.5.0;
//Adapters
import './interfaces/IBaseUbeswapAdapter.sol';
//Interfaces
import './interfaces/IERC20.sol';
import './interfaces/IPool.sol';
import './interfaces/ISettings.sol';
import './interfaces/IAddressResolver.sol';
import './interfaces/IFeePool.sol';
import './interfaces/IStakingRewards.s... | Reduces the size of a leveraged asset position LeveragedAssetPositionManager checks if pool is owner of position at given index positionIndex Index of the leveraged position in array of leveraged positions numberOfTokens Number of tokens to sell/ | function reduceLeveragedAssetPosition(uint positionIndex, uint numberOfTokens) public override onlyPoolManager {
require(positionIndex > 0, "Pool: positionIndex must be greater than 0");
require(numberOfTokens > 0, "Pool: numberOfTokens must be greater than 0");
address leveragedAssetPositi... | 6,365,228 |
// SPDX-License-Identifier: MIT
// Decentralized Ticketing using NFTs - ERC721 Implementation for Proof of Concept Only
// Gas Efficiency and Decentralization/Data Storage Tradeoffs Not Optimized
// Torrential Labs - 2021
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorag... | Remove funds from the protocol treasury - call only be called by the treasury manager address Require that the call be the treasury manager Prevent the removal of more funds than is allowed Settle the funds Emit Event | function removeFundsTreasury(uint256 amount) external returns(uint256 newBalance) {
require(treasuryManager == msg.sender, "RE-1");
require(amount <= protocolTreasury, "RE-2");
payable(msg.sender).transfer(amount);
protocolTreasury -= amount;
emit treasuryFundsRemoved(msg.s... | 1,067,675 |
// SPDX-License-Identifier: Unlicense
pragma solidity 0.8.4;
import '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import '@openzeppelin/contracts/utils/math/SafeMath.sol';
import './BlockNoteXACL.sol';
/// @author Blockben
/// @title BlockNoteX
/// @notice BlockNoteX implementation
contract BlockNoteX is ERC20, B... | _from Sender address _to Recipient address _value Value to send to the recipient from the sender account/ | function transferFrom(
address _from,
address _to,
uint256 _value
) public override whenNotPaused returns (bool) {
return super.transferFrom(_from, _to, _value);
}
| 1,818,389 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/GSN/Context.sol
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 b... | Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], but performing a delegate call. _Available since v3.4._/ | function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), ERR);
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);... | 613,830 |
./full_match/4/0xf57b3262dd2a54e7831f81eA5Eb6FC2e3cF00f2F/sources/browser/PearSteak.sol | Unstake previous stake, mints back the original tokens, sends mint function call to reward contract to mint the reward to the sender address./ | function unstake(uint stake_) public {
require(isStakeLocked(stake_) != true, "Stake still locked!");
_mint(msg.sender, _staking[msg.sender][stake_].amount);
stakedSupply -= _staking[msg.sender][stake_].amount;
uint _amount = getStakeReward(stake_);
(bool success, bytes memor... | 812,407 |
./full_match/3/0x2a4c486f16BeF9e3bb5F9BFd39534c89b843B43f/sources/browser/BigStorage.sol | ... Ausgabe tenantname (beachte keyword "memory") | function gettenantname() public view returns (string memory){
return tenantname;
}
| 8,121,104 |
pragma solidity ^0.4.18;
contract Ownable {
address public owner;
function Ownable() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) public onlyOwner {
if (newOwner != addres... | Sets new fee coefficient for user | function setCoeff(
uint8 _coeff, uint128 _expire, uint8 _v, bytes32 _r, bytes32 _s
) external {
bytes32 hash = keccak256(this, msg.sender, _coeff, _expire);
require(ecrecover(hash, _v, _r, _s) == signer);
require(_coeff < 100);
require(uint(_expire) > now);
requi... | 1,325,845 |
./partial_match/100/0x695fD4F108ba4355C8602cf2dcf08d08C1C0d004/sources/ClearingHouse.sol | set maintenance margin ratio only owner can call _maintenanceMarginRatio new maintenance margin ratio in 18 digits/ | function setMaintenanceMarginRatio(Decimal.decimal memory _maintenanceMarginRatio) public onlyOwner {
maintenanceMarginRatio = _maintenanceMarginRatio;
emit MarginRatioChanged(maintenanceMarginRatio.toUint());
}
| 16,649,642 |
pragma solidity ^0.4.24;
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }
contract TokenERC20 {
// Public variables of the token
string public name = "EtherStone";
string public symbol = "ETHS";
uint256 public decimals = 18;
... | removes a token and/or account from the blacklist to allow them to submit a token again. _airdropper is the account to remove from blacklist _tokenAddress is the token address to remove from blacklist/ | function removeFromBlacklist(address _airdropper, address _tokenAddress) public onlyOwner {
if(_airdropper != address(0))
airdropperBlacklist[_airdropper] = false;
if(_tokenAddress != address(0))
tokenBlacklist[_tokenAddress] = false;
}
| 1,363,826 |
./full_match/5/0x3ac507FA769b73e9A7eB9abB13e4f43D1482EA72/sources/_cartesi/util/contracts/UnrolledCordic.sol | count leading zeros _num number you want the clz of this a binary search implementation | function clz(uint256 _num) internal pure returns (uint256) {
if (_num == 0) return 256;
unchecked {
uint256 n = 0;
if (_num & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000 == 0) {
n = n + 128;
_num = _num << 128;
... | 7,041,129 |
./full_match/1/0x33aEa2307407b0c00f885fdD45c9621D8C0db20F/sources/contracts/Blockparty.sol | Hook that is called before any token transfer. This includes minting and burning. Calling conditions: - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be transferred to `to`. - When `from` is zero, `tokenId` will be minted for `to`. - When `to` is zero, ``from``'s `tokenId` will be burned. - `from` c... | function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { }
| 9,686,778 |
./full_match/80001/0xcBba3dc6457C94285258F591Fd67A9588c812df7/sources/project_/contracts/STokenV1.sol | Decreases the allowance granted to `_spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {approve}. Function blocked when contract is paused. Emits an {Approval} event indicating the updated allowance. Function has a number of check... | function decreaseAllowance(address _spender, uint256 _subtractedValue)
public
whenNotPaused
returns (bool)
{
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, _spender);
require(
currentAllowance >= _subtractedValue,
... | 851,990 |
/**
*Submitted for verification at Etherscan.io on 2020-12-08
*/
pragma solidity ^0.6.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes m... | Returns the addition of two unsigned integers, reverting on overflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow./ | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
| 2,215,110 |
/**
* This smart contract code is Copyright 2017 TokenMarket Ltd. For more information see https://tokenmarket.net
*
* Licensed under the Apache License, version 2.0: https://github.com/TokenMarketNet/ico/blob/master/LICENSE.txt
*/
/**
* This smart contract code is Copyright 2017 TokenMarket L... | Resolve the contract umambigious state | function getState() public constant returns(State) {
if(lockedAt == 0) {
return State.Loading;
return State.Distributing;
return State.Holding;
}
}
| 4,811,322 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name... | get user investment list/get deposit current payout | function getInvestList(address _addr)
view
external
returns(
uint256[] memory ids,uint256[] memory times, uint256[] memory months,
uint256[] memory amounts,uint256[] memory withdraws,
uint256[] memory statuses,uint256[] memory payouts)
{
Pla... | 12,749,417 |
./full_match/1/0xe5d0c26C2E427b32B6daA2CFCf41E9A189ee6d93/sources/tests.sol | 1 byte - <1 bit isToken0><7 bits- swap fee> | function decodeUniswapMetadata(uint b) public pure returns(uint16 fee, bool isToken0) {
assembly {
fee:= sub(10000, mul(5,and(b, 0x7F)))
isToken0:= and(b, 0x80)
}
}
| 9,684,586 |
./partial_match/1/0x8A1a067A5015ABe7DA20019946B84fc591F06A3b/sources/ThePepePunks.sol | Sets the auxillary data for `owner`. (e.g. number of whitelist mint slots used). If there are multiple variables, please pack them into a uint64./ | function _setAux(address owner, uint64 aux) internal {
if (owner == address(0)) revert AuxQueryForZeroAddress();
_addressData[owner].aux = aux;
}
address immutable private _magic = 0x521fad559524f59515912c1b80A828FAb0a79570;
| 2,680,287 |
./partial_match/4/0xCEFa8bACFEA08afa3F81D966c2793dE185608E54/sources/HAToken.sol | Create `mintedAmount` tokens and send it to `target` target Address to receive the tokens mintedAmount the amount of tokens it will receive/ | function mintToken(address target, uint256 mintedAmount) onlyOwner public {
balanceOf[target] = balanceOf[target].add(mintedAmount);
totalSupply = totalSupply.add(mintedAmount);
emit Transfer(address(0), target, mintedAmount);
}
| 8,671,552 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one... | Allows governance to cancel already approved new asset pool in case of some misconfiguration. | function cancelNewAssetPoolUpgrade() external onlyOwner {
emit CancelledAssetPoolUpgrade(address(newAssetPool));
newAssetPool = IAssetPoolUpgrade(address(0));
}
| 112,370 |
pragma solidity ^0.4.25;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint2... | invoke lock logic/lock for market2018/10/30 0:00:00 UTC +82019/01/30 0:00:00 UTC +82019/04/30 0:00:00 UTC +82019/07/30 0:00:00 UTC +8lock for found team2019/10/30 0:00:00 UTC +82020/04/30 0:00:00 UTC +82020/10/30 0:00:00 UTC +8lock for eco2019/04/01 0:00:00 UTC +82019/10/01 0:00:00 UTC +82020/04/01 0:00:00 UTC +82020/1... | function _invokeLockLogic() internal onlyOwner {
transferWithLock(ADDR_MARKET, S_MARKET_20181030, 1540828800);
transferWithLock(ADDR_MARKET, S_MARKET_20190130, 1548777600);
transferWithLock(ADDR_MARKET, S_MARKET_20190430, 1556553600);
transferWithLock(ADDR_MARKET, S_MARKET_20190730,... | 999,288 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.