file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/1/0x968348C6135C25e7160AD0671C8C9CA2eD2bb982/sources/libraries/GyroErrors.sol | First, we need to compute the ASCII representation of the error code. We assume that it is in the 0-999 range, so we only need to convert three digits. To convert the digits to ASCII, we add 0x30, the value for the '0' character. With the individual characters, we can now construct the full string. We first append the ... | function _grequire(
bool condition,
uint256 errorCode,
bytes3 prefix
}
}
assembly {
let units := add(mod(errorCode, 10), 0x30)
errorCode := div(errorCode, 10)
let tenths := add(mod(errorCode, 10), 0x30)
errorCode := div(errorCode, 10)
let hundreds := add(mod(... | 15,967,371 |
pragma solidity ^0.5.7;
pragma experimental ABIEncoderV2;
import "openzeppelin-eth/contracts/lifecycle/Pausable.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "solidity-BigNumber/contracts/BigNumber.sol";
import "zos-lib/contrac... | Check if a request is open. lockboxId ID of the lockbox. readerAddress Reader address. return Whether a request for that lockbox is open for that reader./ | function getRequestStatus(
uint256 lockboxId,
address readerAddress
) public view returns (RequestStatus) {
LockboxState storage lb = lockboxes[lockboxId];
Request storage request = lb.requests[readerAddress];
if (!request.exists) {
return RequestStatus.NULL;
}
if (request.challe... | 5,517,922 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "../../interfaces/Manager.sol";
import "../../interfaces/Vat.sol";
import "../../interfaces/Spotter.sol";
import "../../DS/DSMath.sol";
import "../../auth/AdminAuth.sol";
import "../../loggers/DefisaverLogger.sol";
import "../../utils/BotRegistry.sol";
... | Allows owner to change max gas price _maxGasPrice New max gas price | function changeMaxGasPrice(uint256 _maxGasPrice) public onlyOwner {
require(_maxGasPrice < 2000 gwei, "Max gas price over the limit");
MAX_GAS_PRICE = _maxGasPrice;
}
| 1,007,853 |
./full_match/11155111/0x95c941BbeDDA0b2d2592Bd90c5FFd4f203d676Db/sources/contracts/CarRental.sol | Get the user address of an NFT The zero address indicates that there is no user or the user is expired tokenId The NFT to get the user address for return The user address for this NFT | function userOf(uint256 tokenId) public view override virtual returns(address){
return _users[tokenId].driverAddress;
}
| 3,789,641 |
./partial_match/1/0x843bD7a811DC26874Cb2ad9F4A04a8652F65d8e6/sources/contracts/utility/interfaces/IOwned.sol | Owned interface/ | interface IOwned {
function owner() external view returns (address);
function transferOwnership(address newOwner) external;
function acceptOwnership() external;
pragma solidity 0.6.12;
}
| 3,560,810 |
pragma solidity ^0.4.24;
import "zeppelin-solidity/contracts/math/SafeMath.sol";
import "zeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "./IDaico.sol";
contract Daico is IDaico {
using SafeMath for uint;
event InvestEvent(uint _amount, address _sender, uint _total, uint _tapSum, uint _startedAt);
even... | _tapNum – number of the tap _tapD – tap duration _start – start time of the current tap return current voting num – number of the current voting return tapStage – state of the current tap return NewstartTime – start time of the next tap/ _tapNum _start time duration voting1 voting2 ... | function getTapStage(uint _tapNum, uint _tapD, uint _start) public view returns(uint, TapStage, uint) {
bool invC = areAllFundsCollected(_tapNum);
uint RmV = _start + _tapD + roadmapD + votesD;
uint addVRmV = _start + _tapD + addVotesD + roadmapD + votesD;
if((startedAt == 0) && (now < createdAt + investD)) ... | 1,836,705 |
//Address: 0xf7eD56c1AC4d038e367a987258b86FC883b960a1
//Contract name: EDCoreVersion1
//Balance: 1.258461497246029186 Ether
//Verification Date: 3/10/2018
//Transacion Count: 10653
// CODE STARTS HERE
pragma solidity ^0.4.19;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basi... | Split the _train function into multiple parts because of Stack Too Deep error. Determine if the hero training is successful or not, and the resulting genes. Set the new hero genes if updated (sometimes there is no power increase during equipment forging). | ) private {
uint heroPower;
bool isSuper;
(heroPower,,, isSuper,,) = getHeroPower(_heroGenes, _dungeonDifficulty);
uint newHeroGenes;
uint newHeroPower;
(newHeroGenes, newHeroPower) = _calculateNewHeroPower(_dungeonDifficulty, _heroGenes, _equipmentIndex, _tr... | 965,718 |
//Be name khoda
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
// TODO: import openzepplin IERC20
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
interface IERC20 {
f... | validate input special case for 0 sell amount | uint256 _sellAmount) internal view returns (uint256){
require(_supply > 0 && _connectorBalance > 0 && _connectorWeight > 0 && _connectorWeight <= cwScale && _sellAmount <= _supply, "_bancorCalculateSaleReturn Error");
function _bancorCalculateSaleReturn(
uint256 _supply,
uint256 _connectorBalance,
uint32 _c... | 15,799,287 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.1;
import "../interfaces/IPool.sol";
import "../interfaces/ICorePool.sol";
import "./ReentrancyGuard.sol";
import "./SyndicatePoolFactory.sol";
import "../utils/SafeERC20.sol";
import "../token/SyntheticSyndicateERC20.sol";
import "../interfaces/IMigrator.sol";
/**
... | Converts reward SYNR value to stake weight (not to be mixed with the pool weight), applying the 10^12 multiplication on the reward - OR - Converts reward SYNR value to reward/weight if stake weight is supplied as second function parameter instead of reward/weight reward yield reward rewardPerWeight re... | function rewardToWeight(uint256 reward, uint256 rewardPerWeight) public pure returns (uint256) {
return (reward * REWARD_PER_WEIGHT_MULTIPLIER) / rewardPerWeight;
}
| 5,539,102 |
// SPDX-License-Identifier: BUSDL-1.1
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
import {IDetailedERC20} from "contracts/common/Imports.sol";
import {SafeERC20} from "contracts/libraries/Imports.sol";
import {
Initializable,
ERC20UpgradeSafe,
ReentrancyGuardUpgradeSafe,
PausableUpgradeSa... | This "top-up" value should satisfy: top-up USD value + pool underlyer USD value = (reserve %) pool deployed value (after unwinding) Taking the percentage of the pool's current deployed value is not sufficient, because the requirement is to have the resulting values after unwinding capital satisfy the above equation. ... | function getReserveTopUpValue() external view override returns (int256) {
uint256 unnormalizedTargetValue =
_getDeployedValue().mul(reservePercentage);
uint256 unnormalizedUnderlyerValue = _getPoolUnderlyerValue().mul(100);
require(unnormalizedTargetValue <= _MAX_INT256, "SIGNED... | 280,836 |
pragma solidity ^0.5.16;
interface IERC20 {
function TOTALSUPPLY53() external view returns (uint256); //inject NONSTANDARD NAMING
function BALANCEOF768(address account) external view returns (uint256); //inject NONSTANDARD NAMING
function T... | inject NONSTANDARD NAMING | function BALANCEOF768(address account) external view returns (uint256); | 1,054,333 |
pragma solidity ^0.4.24;
library NameFilter {
/**
* @dev filters name strings
* -converts uppercase to lower case.
* -makes sure it does not start/end with a space
* -makes sure it does not contain multiple spaces in a row
* -cannot be only numbers
* -cannot start with 0x
* -rest... | returns player earnings per vaults -functionhash- 0x63066434 return winnings vault return general vault return affiliate vault/ setup local rID if round has ended. but round end has not been run (so contract has not distributed winnings) if player is winner if player is not the winner | function getPlayerVaults(uint256 _pID)
public
view
returns(uint256 ,uint256, uint256)
{
uint256 _rID = rID_;
if (now > round_[_rID].end && round_[_rID].ended == false && round_[_rID].plyr != 0)
{
if (round_[_rID].plyr == _pID)
{
... | 5,799,355 |
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------
// SencTokenSale - SENC Token Sale Contract
//
// Copyright (c) 2018 InfoCorp Technologies Pte Ltd.
// http://www.sentinel-chain.org/
//
// The MIT Licence.
// ------------------------------------------------------... | Airdrop tokens from bounty wallet to contributors as long as there are enough balance | function airdrop(address bountyWallet, address[] dests, uint[] values) public onlyOwner returns (uint) {
require(dests.length == values.length);
uint i = 0;
while (i < dests.length && balances[bountyWallet] >= values[i]) {
this.transferFrom(bountyWallet, dests[i], values[i]);
... | 478,621 |
./full_match/5/0x62D708258BDA7254238b9dedBbAFeebd15CD00Ba/sources/contracts/Supernova.sol | Secondary function to allow minting of male tokens. Only the registered relayer can use this function. recipient - address to mint token to. | function mintMale(address recipient) external {
require(msg.sender == relayer || msg.sender == owner(), "Only relayer/owner can mint");
uint256[] memory emptyArray = new uint256[](0);
_mint(recipient, 1);
emit Supernova(_totalMinted(), emptyArray, 0, "Male", 0);
}
| 11,600,351 |
// 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 in existence.
*/
function totalSupply() external view ret... | Victim actions, requires impersonation via delegatecall | function sellRewardForWeth(address, uint256 rewardAmount, address to) external override returns(uint256) {
sushi.transfer(address(sushiWethPair), rewardAmount);
(uint sushiReserve, uint wethReserve,) = sushiWethPair.getReserves();
uint amountOutput = UniswapV2Library.getAmountOut(rewardAmoun... | 2,068,825 |
./full_match/42/0xb397fc77aC18DDD3Ead391a3Ca64892817De881C/sources/browser/flatten.sol | Cancels a pending withdrawal request./ Reset withdrawal request | function cancelWithdrawal() external onlyPreExpiration() {
PositionData storage positionData = _getPositionData(msg.sender);
require(positionData.requestPassTimestamp != 0);
emit RequestWithdrawalCanceled(msg.sender, positionData.withdrawalRequestAmount.rawValue);
positionData.requ... | 16,255,913 |
pragma solidity 0.6.7;
/**
* @dev Collection of functions related to the address type
*/
contract Address {
/**
* @dev 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-ow... | Atomically 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 {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have ... | function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, sub(_allowances[_msgSender()][spender], subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
| 12,196,495 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
*... | View function to see pending CHKNs on frontend. | function pendingChicken(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accChickenPerScore = pool.accChickenPerScore;
uint256 totalScore = pool.totalScore;
uint256 pr... | 14,410,115 |
./full_match/1/0xd25b9369D3Ba04e8960BE679028a21f145f0FE8C/sources/contracts/OathRings.sol | tokenURI. See {IERC721Metadata-tokenURI}. tokenId token id/ | function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), 'non-existent tokenId');
return oathRingsDescriptor.genericDataURI(tokenId.toString(), hasCouncilRole(tokenId));
}
| 8,337,605 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
... | Update the alloc points for yfi, weth, wbtc rewards defaults at 50, 30, 20 of Note contract owner is meant to be a governance contract allowing Titan governance consensus/ | function changeAllocPointsForSwapReward(
uint16 allocPointForYFI_,
uint16 allocPointForWBTC_,
uint16 allocPointForWETH_
) external onlyOwner {
_allocPointForYFI = allocPointForYFI_;
_allocPointForWBTC = allocPointForWBTC_;
_allocPointForWETH = allocPointForWETH_;
... | 1,308,530 |
pragma solidity ^0.4.18;
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Ba... | sets MYTC token newToken new token/ | function setToken(address newToken) public onlyOwner {
token = MYTCToken(newToken);
}
| 5,930,142 |
./full_match/1/0x215662DB3cF2d7dCC8E8547a40C264381100A947/sources/contracts/UbeFactory.sol | check if an account can pay the fee in WPST | function canBuyTea(address account, uint256 in_wei) public view returns (bool) {
if (token.allowance(account, address(this)) >= in_wei) {
return true;
return false;
}
}
| 2,912,487 |
./full_match/77/0x914330F413E95598FE9FA9e2F4d4472c039113ab/sources/contracts/SelectorTokenGasLimiterManager.sol | Validates that the token amount is inside the limits, calls transferFrom to transfer the tokens to the contract and invokes the method to burn/lock the tokens and unlock/mint the tokens on the other network. The user should first call Approve method of the ERC677 token. token bridge token contract address. _receiver ... | function _relayTokens(
IERC677 token,
address _receiver,
uint256 _value,
bytes memory _data
) internal {
require(!lock());
setLock(true);
token.safeTransferFrom(msg.sender, address(this), _value);
setLock(false);
bridgeSpecificActionsOnTok... | 5,049,189 |
./full_match/80001/0xCBc6cEfdEeE745bF99AcFDA8831925Af3763c5d8/sources/_openzeppelin/contracts-upgradeable/governance/GovernorUpgradeable.sol | Internal vote casting mechanism: Check that the vote is pending, that it has not been cast yet, retrieve voting weight using {IGovernor-getVotes} and call the {_countVote} internal function. Emits a {IGovernor-VoteCast} event./ | function _castVote(
uint256 proposalId,
address account,
uint8 support,
string memory reason,
bytes memory params
) internal virtual returns (uint256) {
ProposalCore storage proposal = _proposals[proposalId];
require(state(proposalId) == ProposalState.Acti... | 5,555,571 |
pragma solidity ^0.4.23;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
require(c / a == b, "Overflow - Multiplication");
return c;
}
/**
*... | Returns the number of payment destinations and amounts pushed to the storage buffer - Load number paid from buffer - | function paid() internal pure returns (uint num_paid) {
if (buffPtr() == bytes32(0))
return 0;
}
| 1,484,935 |
/*
* Origin Protocol
* https://originprotocol.com
*
* Released under the MIT license
* https://github.com/OriginProtocol/origin-dollar
*
* Copyright 2020 Origin Protocol, Inc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files ... | Interface for Aaves Lending Pool/ | interface IAaveLendingPool {
function deposit(
address asset,
uint256 amount,
address onBehalfOf,
uint16 referralCode
) external;
function withdraw(
address asset,
uint256 amount,
address to
) external returns (uint256);
}
| 11,949,631 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.10;
pragma experimental ABIEncoderV2;
import "indexcoop/contracts/adapters/GIMExtension.sol";
import "indexcoop/contracts/interfaces/IBaseManager.sol";
import "indexcoop/contracts/interfaces/IGeneralIndexModule.sol";
import "indexcoop/contracts/lib/PreciseUnitMath.so... | Starts the rebalance process. Only operator may call. If the component list does not match the components voted on by the OwlNFT holders this function will revert _setValue Approximate USD value of the index _components Component list. Must match the compoennts voted on by OwlNFT holders _componentPrices Component... | function startRebalance(
uint256 _setValue,
address[] memory _components,
uint256[] memory _componentPrices
) external onlyOperator {
(address[] memory finalComponents, uint256[] memory weights) = _getWeights();
currentEpochStart = block.timestamp;
if (... | 7,317,704 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.6 <0.8.0;
import {IERC165} from "@animoca/ethereum-contracts-core/contracts/introspection/IERC165.sol";
import {IERC721} from "@animoca/ethereum-contracts-assets/contracts/token/ERC721/interfaces/IERC721.sol";
import {IERC721Receiver} from "@animoca/ethereum-contr... | @inheritdoc IERC165 | function supportsInterface(bytes4 interfaceId) public view override returns (bool) {
return TrustedAgent.supportsInterface(interfaceId) || interfaceId == type(IERC721Receiver).interfaceId;
}
| 12,844,413 |
... | inject NONSTANDARD NAMING | function BALANCEOF30(address account) external view returns (uint256); | 6,417,960 |
// Sources flattened with hardhat v2.8.2 https://hardhat.org
// File contracts/solidity/token/IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20Upgradeable {
/**
* @dev Returns the amount of t... | Deprecated. This function has issues similar to the ones found in {IERC20-approve}, and its usage is discouraged. Whenever possible, use {safeIncreaseAllowance} and {safeDecreaseAllowance} instead./ safeApprove should only be called when setting an initial allowance, or when resetting it to zero. To increase and decrea... | function safeApprove(
IERC20Upgradeable token,
address spender,
uint256 value
) internal {
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalRet... | 178,672 |
pragma solidity = 0.5.16;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20Capped.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/lifecycle/Pausable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import ... | Discounts are additive apply early bird discount | function _getPriceWithDiscounts(Lot memory lot, uint quantity, uint cratesPurchased) private view returns(uint price, uint discount) {
price = lot.price.mul(quantity);
if (initialDiscountActive()) {
discount = price.mul(_initialDiscountPercentage).div(PERCENT_PRECISION);
}
... | 14,094,385 |
./partial_match/3/0xE954DB0fa144a2BD48a6473855cb0A25cdE4049A/sources/BRDReward.sol | Locks BRD and mints xBRD _amount of BRD to stake/ Gets the amount of BRD locked in the contract Gets the amount of xBRD in existence If no xBRD exists, mint it 1:1 to the amount put in Calculate and mint the amount of xBRD the BRD is worth. The ratio will change overtime, as xBRD is burned/minted and BRD deposited + g... | function enter(uint256 _amount) external {
uint256 totalBRD = BRD.balanceOf(address(this));
uint256 totalShares = totalSupply();
if (totalShares == 0 || totalBRD == 0) {
_mint(msg.sender, _amount);
uint256 what = _amount.mul(totalShares).div(totalBRD);
_... | 5,208,417 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../depositary/IDepositaryBalanceView.sol";
import "./IValidator.sol";
contract CollateralBala... | _collateral New collateral address./ | function changeCollateral(address _collateral) external onlyOwner {
require(_collateral != address(0), "CollateralBalanceValidator::changeCollateral: invalid collateral address");
collateral = IDepositaryBalanceView(_collateral);
emit CollateralUpdated(_collateral);
}
| 2,543,274 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.4;
import {IBToken} from "../interfaces/IBToken.sol";
import {IDebtToken} from "../interfaces/IDebtToken.sol";
import {ILendPoolLoan} from "../interfaces/ILendPoolLoan.sol";
import {ILendPool} from "../interfaces/ILendPool.sol";
import {IReserveOracleGetter} fro... | Gets the liquidation bonus of the NFT self The NFT configuration return The liquidation bonus/ | function getLiquidationBonus(DataTypes.NftConfigurationMap storage self) internal view returns (uint256) {
return (self.data & ~LIQUIDATION_BONUS_MASK) >> LIQUIDATION_BONUS_START_BIT_POSITION;
}
| 503,253 |
pragma solidity 0.5.10;
import 'openzeppelin-solidity/contracts/token/ERC20/ERC20.sol';
import 'openzeppelin-solidity/contracts/math/SafeMath.sol';
import {BytesLib} from "@summa-tx/bitcoin-spv-sol/contracts/BytesLib.sol";
import {BTCUtils} from "@summa-tx/bitcoin-spv-sol/contracts/BTCUtils.sol";
import './FundsInte... | Borrower refunds tokens in the case that Lender doesn't accept loan repayment Send tokens back to the Borrower, and close Loan loan The Id of the Loan Note: If Lender does not accept repayment, liquidation cannot occur/ | function refund(bytes32 loan) external {
require(!off(loan), "Loans.refund: Loan cannot be inactive");
require(!sale(loan), "Loans.refund: Loan cannot be undergoing a liquidation");
require(now > acceptExpiration(loan), "Loans.refund: Cannot request refund until after acceptExpiration");
... | 7,298,234 |
./partial_match/1/0xd1B9aF64Ed5CdcaEb58955d82FB384b3e558Df7B/sources/ConvexStrategy.sol | Returns underlying vault | function vault() external view returns (address) {
return address(VAULT);
}
| 9,261,998 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/*
* ApeSwapFinance
* App: https://apeswap.finance
* Medium: https://ape-swap.medium.com/
* Twitter: https://twitter.com/ape_swap
* Telegram: https://t.me/ape_swap
* Announcements: https://t.me/ape_swap_news
* GitHub: ... | Obtain the amount of Golden Banana held by this contract | function goldenBananaReserves() public view returns (uint256) {
return goldenBanana.balanceOf(address(this));
}
| 6,441,477 |
/**
* Copyright 2017-2022, OokiDao. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
import "State.sol";
import "LoanMaintenanceEvents.sol";
import "PausableGuardian.sol";
import "InterestHandler.sol";
import "InterestOracle.sol";
i... | Returns the element stored at position `index` in the set. O(1). Note that there are no guarantees on the ordering of values inside the array, and it may change when more values are added or removed. Requirements: - `index` must be strictly less than {length}./ | function getAddress(Bytes32Set storage set, uint256 index)
internal
view
returns (address)
{
bytes32 value = set.values[index];
address addrvalue;
assembly {
addrvalue := value
}
return addrvalue;
}
| 213,891 |
./full_match/1/0xfacd2eC4647df2Cb758F684C2aAAB56A93288f9e/sources/contracts/test/MockSpokePool.sol | If chainId_ is set then return it, else do nothing and return the parent chainId(). | function chainId() public view override(SpokePool) returns (uint256) {
return chainId_ == 0 ? super.chainId() : chainId_;
}
| 4,938,521 |
/**
*Submitted for verification at Etherscan.io on 2021-02-04
*/
/**
*Submitted for verification at Etherscan.io on 2020-08-15
*/
// File: contracts/sol4/ERC20Interface.sol
pragma solidity 0.4.18;
// https://github.com/ethereum/EIPs/issues/20
interface ERC20 {
function totalSupply() public view returns (uint... | do a trade srcToken Src token srcAmount Amount of src token destToken Destination token destAddress Destination address to send tokens to validate If true, additional validations are applicable return true iff trade is successful can skip validation if done at kyber network level collect src tokens send dest token... | function doTrade(
ERC20 srcToken,
uint srcAmount,
ERC20 destToken,
address destAddress,
uint conversionRate,
bool validate
)
internal
returns(bool)
{
if (validate) {
require(conversionRate > 0);
if (srcToken == E... | 2,245,288 |
// SPDX-License-Identifier: No License
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/utils/EnumerableSet.sol";
import "@openzeppelin/contra... | Deposit LP tokens to ichiFarm for ICHI allocation. call ichiFactor function (add if not enough) | function deposit(uint256 _poolID, uint256 _amount) public {
require(!nonReentrant, "ichiFarm::nonReentrant - try again");
nonReentrant = true;
PoolInfo storage pool = poolInfo[_poolID];
UserInfo storage user = userInfo[_poolID][msg.sender];
if (user.amount > 0) {
... | 942,554 |
./partial_match/1/0x95D4D018F4B21188836b23aAd3eB967378b956C4/sources/contracts/LendingPoolImplementation.sol | Withdraw the lend token from the pool. Only amount minus fees owed to Vendor will be withdrawable _amount Amount of lend token to withdraw from the pool | function withdraw(uint256 _amount) external nonReentrant {
onlyOwner();
onlyNotPaused();
if (
lendToken.balanceOf(address(this)) <
_amount + ((totalFees * protocolFee) / HUNDRED_PERCENT)
) revert InsufficientBalance();
_safeTransfer(lendToken, msg.send... | 4,186,164 |
//Address: 0xec2642cd5a47fd5cca2a8a280c3b5f88828aa578
//Contract name: TxRelay
//Balance: 0 Ether
//Verification Date: 11/30/2017
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity 0.4.15;
// This contract is meant as a "singleton" forwarding contract.
// Eventually, it will be able to forward any transacti... | / 36 is the offset of the first parameter of the data, if encoded properly. 32 bytes for the length of the bytes array, and 4 bytes for the function signature. | function getAddress(bytes b) public constant returns (address a) {
if (b.length < 36) return address(0);
assembly {
let mask := 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
a := and(mask, mload(add(b, 36)))
}
}
| 14,102,530 |
./full_match/4/0xD33Ee6359051a906787131622da2215BAe6281ba/sources/contracts/library/statemachine/StateMachine.sol | Define specific functions for a state state Bytes32 state name allowedFunction Set of functions for that state/ | function addAllowedFunctionForState(bytes32 state, bytes4 allowedFunction)
public
doesStateExist(state)
hasAdminRole(msg.sender)
{
if (!knownSelector[allowedFunction]) {
knownSelector[allowedFunction] = true;
knownSelectors.push(allowedFunction);
}
states[state].allowedFunctions[... | 12,479,062 |
./full_match/137/0x0f80B8e8ab1e8cB6Aa0374c789F7f857020a0706/sources/Shinsekai.sol | Get owner address via id | function ownerOf(uint256 tokenId) public view returns (address) {
if (MINKA.stakerAddress(tokenId) != 0x0000000000000000000000000000000000000000) {
return MINKA.stakerAddress(tokenId);
return KUSHO.ownerOf(tokenId);
}
}
| 4,692,064 |
pragma solidity 0.5.16;
//This smartcontract is based on the one in the solidity documentation
contract PaymentChannel {
mapping(address => uint256) balances; //This is a fake balances, just to simulate an erc-20 token
address payable[2] public addr; // The account sending payments.
uint256 public expira... | Generate the hash messageThis function is public only for test purpose | function generateMessage(address pAddr , uint256 amount, uint256 nonce) public pure returns (bytes32) {
bytes32 h = keccak256(abi.encode(pAddr,amount, nonce));
bytes memory prefix = "\x19Ethereum Signed Message:\n32";
return keccak256(abi.encodePacked(prefix,h));
}
| 12,595,139 |
./full_match/4/0x376fbFD580Ff7A26fA3F82E6BFa524cd22d74f85/sources/_jpegmint/contracts/token/ERC721/ERC721Lean.sol | Transfers `tokenId` from `from` to `to`. As opposed to {transferFrom}, this imposes no restrictions on msg.sender. Requirements: - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. Emits a {Transfer} event./ Clear approvals from the previous owner | function _transfer(
address from,
address to,
uint16 tokenId
) internal virtual {
require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tok... | 13,328,913 |
/**
* UserRegistry.sol
* Mt Pelerin user registry.
* The unflattened code is available through this github tag:
* https://github.com/MtPelerin/MtPelerin-protocol/tree/etherscan-verify-batch-1
* @notice Copyright © 2016 - 2018 Mt Pelerin Group SA - All Rights Reserved
* @notice All matters regarding th... | register a user/ | function registerUser(address _address, uint256 _validUntilTime)
public onlyAuthority
{
registerUserInternal(_address, _validUntilTime);
}
| 15,813,831 |
pragma solidity ^0.4.24;
contract OffersAccessControl {
address public rootAddress;
address public adminAddress;
address public lostAndFoundAddress;
// The total amount of ether (in wei) in escrow owned by Root
uint256 public totalRootEarnings;
// The total amount of ether (in wei) in escrow ... | Assigns a new address to act as the LostAndFound account. Only available to the current Root _newLostAndFound The address of the new lostAndFound address | function setLostAndFound(address _newLostAndFound) external onlyRoot {
require(_newLostAndFound != address(0), "new lost and found cannot be the zero-account");
lostAndFoundAddress = _newLostAndFound;
}
| 6,356,444 |
pragma solidity >=0.5.0 <0.6.0;
import "../compliance/Compliance.sol";
import "../libs/collections/AddressMap.sol";
import "../libs/lifecycle/LockableDestroyable.sol";
import "../libs/math/AdditiveMath.sol";
import "../libs/ownership/Ownable.sol";
import "./IT0ken.sol";
contract T0ken is IT0ken, Ownable, LockableDe... | Approve the spender address to transfer the number of tokens on behalf of the sender Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce th... | function approve(address spender, uint256 tokens)
public
isUnlocked
returns (bool) {
require(holders.exists(msg.sender), "Must be a shareholder");
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
| 7,311,019 |
/**
*Submitted for verification at Etherscan.io on 2021-12-14
*/
// SPDX-License-Identifier: AGPL-3.0-or-later
// File: interfaces/IExodusAuthority.sol
pragma solidity =0.7.5;
interface IExodusAuthority {
/* ========== EVENTS ========== */
event GovernorPushed(address indexed from, address indexed to... | forfeit stake and retrieve EXO return uint/ | function forfeit() external returns (uint256) {
Claim memory info = warmupInfo[msg.sender];
delete warmupInfo[msg.sender];
gonsInWarmup = gonsInWarmup.sub(info.gons);
EXO.safeTransfer(msg.sender, info.deposit);
return info.deposit;
}
| 1,842,893 |
./partial_match/1/0x72AD58f0917deB04eC8b6AdA584ABd0dBe502128/sources/GVault.sol | Simulate the shares issued for a given deposit _assets number of asset tokens being deposited return shares number of shares issued for the number of assets provided | function previewDeposit(uint256 _assets)
public
view
override
returns (uint256 shares)
{
return convertToShares(_assets);
}
| 3,587,091 |
/*
osssssssssssso+- +sssssssssssso+- -ssss+ `sssso`
mMMMMMMMMMMMMMMMNy. hMMMMMMMMMMMMMMMNs` :mMMMh` :mMMMy`
mMMMy//////+oymMMMN: hMMMy///////+yNMMMd .hMMMm: oNMMN+
mMMMo ... | Deposit LP tokens to VendingMachine for ERC20 allocation. remit eth fee according to partner status | function deposit(uint256 _pid, uint256 _amount) public payable {
if(accessTokenRequired){
require(accessToken.balanceOf(msg.sender) >= accessTokenMin, 'Must have minimum amount of access token!');
}
PoolExtras storage poolEx = poolExtras[_pid];
if(poolEx.accessTokenRequi... | 10,971,339 |
./full_match/5/0xc746e9Af554b714299916e370ca5610F4371068b/sources/contracts/FinalNFT.sol | new version uint256 amountToken = calculatePoint(_mintAmount); | function auctionmintNFT(uint256 _mintAmount) public payable checkbalance(){
require(rerefund == 1, "not open");
require(getCallOption() >= _mintAmount, "Buy call option first");
uint256 amountETH = _mintAmount * getAuctionPrice();
require(
balanceOf(msg.sender) + _mintAmo... | 1,881,479 |
/**
*Submitted for verification at Etherscan.io on 2022-03-11
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contrac... | Latest CErc20Delegate implementation for each existing implementation./ | function latestCErc20Delegate(address oldImplementation) external view returns (address, bool, bytes memory) {
CDelegateUpgradeData memory data = _latestCErc20Delegate[oldImplementation];
bytes memory emptyBytes;
return data.implementation != address(0) ? (data.implementation, data.allowResi... | 10,973,030 |
/**
*Submitted for verification at Etherscan.io on 2022-01-10
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* I... | Transfers contract balance to contract owner. Can only be called by the current owner./ | function withdraw() public onlyOwner{
payable(owner()).transfer(address(this).balance);
}
| 15,433,357 |
pragma solidity 0.6.6;
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external view returns (string memory);
function symbol() external view returns (string m... | bytes4(keccak256(bytes('approve(address,uint256)'))); | function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
}
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
add... | 7,547,568 |
./full_match/11155111/0xDFe6772CDa27058B086c7f1c7562d4732e25309B/sources/project_/contracts/WalletFactory/WalletFactory.sol | calculate our own salt based off of args create the clone counterfactually ensure we get an address check size note this takes an additional 700 gas | function deployCloneWallet2WithMultiAuthorizedAddress(
address _recoveryAddress,
bytes memory _authorizedAddresses,
uint256 _cosigner,
bytes32 _salt
)
public
{
require(_authorizedAddresses.length / 20 > 0 && _authorizedAddresses... | 3,823,168 |
./partial_match/1/0xbc6a1af02c09fc1514B95eC98756ccAa95e8Af2e/sources/GEtherBridge.sol | Triggers a flash loan on Dydx and, if unsuccessful, on Aave. The current contract will receive a call back with the loan amount and should repay it, including fees, before returning. See GFlashBorrow.sol. _token The reserve token to flash borrow from. _netAmount The amount to be borrowed without consid... | function _requestFlashLoan(address _token, uint256 _netAmount, bytes memory _context) internal returns (bool _success)
{
_success = DydxFlashLoanAbstraction._requestFlashLoan(_token, _netAmount, _context);
if (_success) return true;
_success = AaveFlashLoanAbstraction._requestFlashLoan(_token, _netAmount, _cont... | 2,650,862 |
/**
* SPDX-License-Identifier: UNLICENSED
*/
pragma solidity =0.6.10;
import {OracleInterface} from "../interfaces/OracleInterface.sol";
import {OpynPricerInterface} from "../interfaces/OpynPricerInterface.sol";
import {Ownable} from "../packages/oz/Ownable.sol";
import {SafeMath} from "../packages/oz/SafeMath.sol";... | updates the pricer for an asset can only be called by the owner _asset asset address _pricer pricer address/ | function updateAssetPricer(address _asset, address _pricer) external onlyOwner {
require(_asset != address(0), "Oracle: cannot set asset to address(0)");
require(stablePrice[_asset] == 0, "Oracle: could not set a pricer for stable asset");
assetPricer[_asset] = _pricer;
emit Pricer... | 461,088 |
pragma solidity ^0.5.0;
import "../../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./Valset.sol";
import "./BridgeBank/BridgeBank.sol";
contract CosmosBridge {
using SafeMath for uint256;
string COSMOS_NATIVE_ASSET_PREFIX = "PEGGY";
/*
* @dev: Public variable declaratio... | : unlockTokens Issues a request for the BridgeBank to unlock funds held on contract/ | function unlockTokens(uint256 _prophecyID) internal {
ProphecyClaim memory prophecyClaim = prophecyClaims[_prophecyID];
bridgeBank.unlock(
prophecyClaim.ethereumReceiver,
prophecyClaim.symbol,
prophecyClaim.amount
);
}
| 6,435,611 |
./full_match/4/0xB1BB7D89bcB1ECA4a29E831D793DE51795B74a01/sources/contracts/Orochi.sol | OrochiBot interface for accepting transfer hooks/ | interface IOrochiBot {
function txHook(address caller, address sender, address receiver, uint256 amount) external;
}
| 12,457,687 |
./full_match/97/0x5C3be4783FfB014ac3FD973321fced360EE3395D/sources/project_/contracts/Vesting.sol | Terminate token grant transferring all vested tokens to the `_recipient` and returning all non-vested tokens to the contract owner Secured to the contract owner only _recipient address of the token grant recipient only transfer tokens if amounts are non-zero. Negative cases are covered by upperbound check in addTokenG... | function revokeTokenGrant(
address _recipient,
uint256 crowdsaleRound
) external {
Grant storage tokenGrant = tokenGrants[_recipient][crowdsaleRound];
uint256 monthsVested;
uint256 amountVested;
(monthsVested, amountVested) = calculateGrantClaim(
_reci... | 3,287,736 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./libs/maths/SafeMath.sol";
import "./libs/string.sol";
import "./interfaces/IERC20.sol";
import "./libs/sort.sol";
struct GlqStaker {
address wallet;
uint256 block_number;
uint256 amount;
uint256 index_at;
bool alread... | Return the total amount of GLQ as incentive rewards in the contract/ | function getTotalIncentive() public view returns (uint256) {
return _totalGlqIncentive;
}
| 1,061,419 |
// SPDX-License-Identifier: MIT
// This is a modified version of Beefy Finance's StrategyAave.sol:
// https://github.com/beefyfinance/beefy-contracts/blob/b96151c4e7badc6ac721b35249c11d31fd527710/contracts/BIFI/strategies/Aave/StrategyAave.sol
pragma solidity ^0.6.12;
import "hardhat/console.sol";
import "@openzepp... | puts the funds to work | function deposit() public whenNotPaused {
uint256 wantBal = availableWant();
if (healthFactor() < risk.minHealthFactor) {
_deleverageAll();
wantBal = IERC20(want).balanceOf(address(this));
}
if (wantBal > 0) {
_leverage(wantBal);
}
}
... | 1,803,940 |
./full_match/1/0x858847c21B075e45727fcB0B544BD843CD750361/sources/project_/contracts/TreasuryManager.sol | remove from convexremove from LP with treasury as receivertransfer to treasurytransfer to treasurytransfer to treasurytransfer to treasury | function removeFromPool(uint256 _amount, uint256 _minAmountOut) external onlyOperator{
require(_minAmountOut > 0, "!min_out");
IConvexStaking(lprewards).withdrawAndUnwrap(_amount, true);
ICurveExchange(exchange).remove_liquidity_one_coin(IERC20(exchange).balanceOf(address(this)), 1, _minAm... | 2,933,409 |
pragma solidity 0.4.20;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
functi... | Function to mint tokens _to The address that will receive the minted tokens. _amount The amount of tokens to mint. return A boolean that indicates if the operation was successful./ | function mint(address _to, uint256 _amount) onlyMinter public returns (bool) {
require(!mintingFinished);
require(totalSupply.add(_amount) <= cap);
passThroughTap(_amount);
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _... | 6,768,365 |
// SPDX-License-Identifier: Apache-2.0
/*
Modifications Copyright 2022 Element.Market
Copyright 2021 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.or... | Get the struct hash of an buy order. order The buy order. return structHash The struct hash of the order. Hash in place, equivalent to: return keccak256(abi.encode( _NFT_BUY_ORDER_TYPE_HASH, order.maker, order.taker, order.expiry, order.nonce, order.erc20Token, order.erc20TokenAmount, f... | function getNFTBuyOrderStructHash(NFTBuyOrder memory order, uint256 hashNonce) internal pure returns (bytes32 structHash) {
bytes32 propertiesHash = _propertiesHash(order.nftProperties);
bytes32 feesHash = _feesHash(order.fees);
assembly {
let typeHashMemBefore := mload(typeHa... | 1,499,124 |
pragma solidity ^0.4.21;
import "./CustodianUpgradeable.sol";
import "./ERC20Proxy.sol";
import "./ERC20Store.sol";
/** @title ERC20 compliant token intermediary contract holding core logic.
*
* @notice This contract serves as an intermediary between the exposed ERC20
* interface in ERC20Proxy and the store o... | Core logic of the ERC20 `transfer` function. This function can only be called by the referenced proxy, which has a `transfer` function. Every argument passed to that function as well as the original `msg.sender` gets passed to this function. NOTE: transfers to the zero address are disallowed. _sender The address i... | function transferWithSender(
address _sender,
address _to,
uint256 _value
)
public
onlyProxy
returns (bool success)
{
uint256 balanceOfSender = erc20Store.balances(_sender);
require(_value <= balanceOfSender);
erc20Store.setBalance(_s... | 5,351,198 |
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.11;
// ============ Nomad Contracts ============
import {BridgeMessage} from "./BridgeMessage.sol";
import {XAppConnectionClient} from "../XAppConnectionClient.sol";
import {Encoding} from "./Encoding.sol";
import {TypeCasts} from "@nomad-xyz/nomad-co... | inherited from ownable | interface IBridgeToken {
function initialize() external;
function name() external returns (string memory);
function balanceOf(address _account) external view returns (uint256);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
functi... | 12,225,077 |
// SPDX-License-Identifier: None
pragma solidity ^0.7.5;
import "./interfaces/IBFactory.sol";
import "./interfaces/IBPool.sol";
import "./interfaces/ICover.sol";
import "./interfaces/ICoverERC20.sol";
import "./interfaces/ICoverRouter.sol";
import "./interfaces/IERC20.sol";
import "./interfaces/IProtocol.sol";
import ... | Get the Cover contract from the token to check if its the claim or noclaim. | function createNewPool(
ICoverERC20 _covToken,
uint256 _covTokenAmount,
IERC20 _pairedToken,
uint256 _pairedTokenAmount
) external override returns (address pool) {
require(address(_pairedToken) != address(_covToken), "CoverRouter: same token");
bytes32 pairKey = _pairKeyForPair(address(_cov... | 1,711,732 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/cont... | Claim. Release the goods and send funds to auctioneer. If no bids, item is returned to auctioneer! auctionId uint. Which listing to claim.auctions[auctionId].tokenContract = address(0);Release the item back to the auctioneerRelease the item to highestBidder | function claim(uint256 auctionId) external nonReentrant {
require(auctionId < auctionCount, "auctionId < auctionCount");
require(
auctionActive[auctionId] == true,
"auctionActive[auctionId] == true"
);
AuctionListing storage al = auctions[auctionId];
r... | 12,884,424 |
./full_match/1/0x73cD8626b3cD47B009E68380720CFE6679A3Ec3D/sources/contracts/sharedContracts/PlanDelegator.sol | internal view function to determine if a delegator, typically the msg.sender is allowed to delegate a token, based on being either the Owner, Delegator or Operator. | function _isApprovedDelegatorOrOwner(address delegator, uint256 planId) internal view returns (bool) {
address owner = ownerOf(planId);
return (delegator == owner ||
isApprovedForAllDelegation(owner, delegator) ||
getApprovedDelegator(planId) == delegator);
}
| 4,922,719 |
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
... | Allows contract owner to update its current BTC pool address. newAddress The updated address of the BTC pool/ | function setBtcPoolAddress(string memory newAddress) external virtual onlyOwner returns (bool) {
_btcPool = newAddress;
emit BtcPoolAddressChanged(newAddress);
return true;
}
string indexed newAddress
);
| 1,425,356 |
./partial_match/1/0x148645F23913DDB250eb946D88AD6902bcD01Baa/sources/contracts/PerpetualFutures.sol | 10 == 1x, 1000 == 100x, etc. | function setMaxLeverage(uint16 _max) external onlyOwner {
require(_max <= 2500);
maxLeverage = _max;
}
| 16,095,192 |
pragma solidity ^0.4.24;
// File: contracts\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 p... | Increase the amount of tokens that an owner allowed to a spender when if not paused and not locked account _spender address which will spend the funds. _addedValue amount of tokens to increase the allowance by./ | function increaseApproval(address _spender, uint256 _addedValue) public
whenNotPaused
whenNotLocked
returns (bool)
{
return super.increaseApproval(_spender, _addedValue);
}
| 10,658,704 |
// 反诈系统的智能合约
// 参考拍卖系统实现
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.21 <0.9.0;
// import "./TokenERC20.sol";
contract AntiFraud {
// 创建完成后所有积分归创建者所有
// 积分发行 -> 由创建者账户转入对应用户账户
// 总积分发行量
uint256 totalCredit;
// 创建者地址
address administrator;
// 余额
mapping(address => uint) balan... | 审核案件资料截图 设定案件是否有效 设定审核警方用户 TODO 更新市民历史上传状态 加入民警历史审核 进行审核的警方用户获得积分+2 审核有效后 市民用户获得积分+5 | function auditScreenshot(uint[] memory _screenshotIndex, bool[] memory _isVaild) external {
for (uint i = 0; i < _screenshotIndex.length; i++) {
require(_screenshotIndex[i] <= screenshotIndex, "Screenshot Not Exists");
allSList[_screenshotIndex[i]].isValid = _isVaild[i];
... | 12,634,478 |
./full_match/11155111/0xC32Cb12A799AE8Db4412D9D99d69cB07F0fdc343/sources/project_/contracts/nftFactory.sol | Create a new ERC721 contract with the given name and symbolTo create new ERC721 ,we need to pass name,symbol and baseURI | function createERC721(string memory _name,
string memory _symbol,
string memory baseURI_)
public onlyOwner
returns (address) {
ERC721 newContract = new dynamicNft(_name, _symbol,baseURI_);
emit ContractCreated(address(newContract), _name, _symbol);
return address(newCo... | 3,836,547 |
pragma solidity 0.5.11;
/*
* @author Cryptonomica Ltd.(cryptonomica.net), 2019
* Github: https://github.com/Cryptonomica/
*
* 'CryptoSharesFactory' is a smart contract for creating smart contract for cryptoshares.
* They can be shares of a real corporation. Every share is an ERC20 + ERC223 Token.
* Smart contracts wit... | ID of the contract/ description of the organization or project, can be short text or a link to website, white paper, github/gitlab repo/ ---- Identity verification for shareholders / _address Address to check keyCertificateValidUntil: if 0, no key certificate registered for this address. If key certificate not expire... | function addressIsVerifiedByCryptonomica(address _address) public view returns (bool){
return cryptonomicaVerification.keyCertificateValidUntil(_address) > now && cryptonomicaVerification.revokedOn(_address) == 0;
}
string public name;
string public symbol;
uint8 public constant decimals... | 5,358,934 |
pragma solidity ^0.4.19;
import "./FishBreeding.sol";
/// @title all functions related to creating fishs
contract FishMinting is FishBreeding {
// Limits the number of fishs the contract owner can ever create.
uint256 public constant PROMO_CREATION_LIMIT = 5000;
uint256 public constant GEN0_CREATION_LIMI... | Creates a new gen0 fish with the random given genes and creates an auction for it. | function createRandomGen0Sale() external onlyOwner {
require(gen0CreatedCount < GEN0_CREATION_LIMIT);
uint256 _genes = uint256(keccak256(block.number, block.timestamp));
uint256 fishId = _createFish(_genes,0, 0, 0, address(this));
_createSale(
fishId,
_comp... | 5,525,541 |
/**
* DISCLAIMER: Under certain conditions, the function pushDividendPayment
* may fail due to block gas limits.
* If the total number of investors that ever held tokens is greater than ~15,000 then
* the function may fail. If this happens investors can pull their dividends, or the Issuer
* can use pushDividendPay... | Return the default excluded addresses return List of excluded addresses/ | function getDefaultExcluded() external view returns(address[] memory) {
return excluded;
}
| 14,073,932 |
pragma solidity ^ 0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function trans... | Adds list of addresses to whitelist. Not overloaded due to limitations with truffle testing. _beneficiaries Addresses to be added to the whitelist/ | function addManyToWhitelist(address[] _beneficiaries) external onlyAuthorized {
for (uint i = 0; i < _beneficiaries.length; i++) {
whitelist[_beneficiaries[i]] = true;
UserAllowed(_beneficiaries[i]);
}
}
| 14,029,857 |
./full_match/56/0x4520b46A0196131A8cfE4805971a327B4511f12f/sources/project_/contracts/0xdb881ff670728f0c9a4a3155ea2a53f954be5e3f_EliteTradeCoin_ETC_2023-02-08_05-34-00.sol | Initializes the contract setting the deployer as the initial owner./ | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
function _afterTokenTransfer(
address from,
address to,
uint256 amount
}
pragma solidity ^0.8.0;
constructor() {
_transferOwnership(_msgSender());
}
| 3,242,764 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.11;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./aave/ILendingPoolAddressesProv... | / aave has 1:1 peg for tokens and atokens there is no redeem function in v2 it is replaced by withdraw in v2 Aave docs recommends using uint(-1) to withdraw the full balance. This is actually an overflow that results in the max uint256 value. | function redeemFromExternalPool() public whenGameIsCompleted {
require(!redeemed, "Redeem operation already happened for the game");
redeemed = true;
if (adaiToken.balanceOf(address(this)) > 0) {
lendingPool.withdraw(address(daiToken), type(uint256).max, address(this));
}
... | 12,692,683 |
./full_match/5/0x9ccDD0Bb22aA073Be7f4021D9bfa89fdD7BfAbdF/sources/project_/contracts/interfaces/IPeripheryPaymentsExtended.sol | Periphery Payments Extended Functions to ease deposits and withdrawals of ETH and tokens function unwrapWETH(uint256 amount, address to) external payable; | interface IPeripheryPaymentsExtended is IPeripheryPayments {
function wrapETH(uint256 value) external payable;
function sweepToken(address token, uint256 amountMinimum) external payable;
function pull(address token, uint256 value) external payable;
pragma solidity >=0.7.5;
}
| 1,959,390 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
import "../common/lifecycle/Initializable.sol";
import "../common/token/ERC20Token.sol";
import "../gateway/GatewayRecipient.sol";
/**
* @title Wrapped wei token
*
* @notice One to one wei consumable ERC20 token
*
* @dev After the transfer to consumer's a... | Starts consuming Add caller as a consumer/ | function startConsuming()
external
{
_addConsumer(_getSender());
}
| 12,559,917 |
./partial_match/1/0x6FBCab3f7ac65f5920454C2A3fb11d748a14876C/sources/gladUniswapMining.sol | claim GLAD based on current state | function claimglad() public whenNotPaused {
updateMiningState();
uint claimableglad = claimableglad(msg.sender);
stakerIndexes[msg.sender] = miningStateIndex;
if(claimableglad > 0){
stakerClaimed[msg.sender] = stakerClaimed[msg.sender].add(claim... | 4,003,158 |
pragma solidity ^0.4.24;
// Is needed to call functions in the Snow contract.
contract Snow {
function buy(address) public payable returns(uint256);
function withdraw() public;
function redistribution() external payable;
function myTokens() public view returns(uint256);
function myDividends(bool) p... | this is the core logic for any buy/reload that happens while a round is live./ if player is new to round early round eth limiter mint the new keys if they bought at least 1 whole key set new leaders set the new leader bool to true gib muni calculate prize and give it to winner adjust airDropPot let event know a tier 3 ... | function core(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
{
if (plyrRnds_[_pID][_rID].keys == 0)
_eventData_ = managePlayer(_pID, _eventData_);
if (round_[_rID].eth < 100000000000000000000 && p... | 359,395 |
./partial_match/1/0xd2d2f538b9D25479E50cb9d1C8d7Ae3055e0d537/sources/Vesting.sol | Function that sets the start date of the Vesting _startDate The start date of the veseting presented as a timestamp/ | function setStartDate(uint256 _startDate) public onlyOwner {
require(_startDate >= now, "Start Date can't be in the past");
startDate = _startDate;
emit LogStartDateSet(address(msg.sender), _startDate);
}
| 4,340,082 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.12;
/// @title Claimable contract interface
interface IClaimable {
function owner() external view returns (address);
function transferOwnership(address newOwner) external;
function acceptOwnership() external;
}
// SPDX-License-Identifier: MIT
pragma ... | converts the specified underlying BNT amount to pool token amount/ | function _underlyingToPoolToken(
uint256 bntAmount,
uint256 poolTokenTotalSupply,
uint256 currentStakedBalance
) private pure returns (uint256) {
return MathEx.mulDivC(bntAmount, poolTokenTotalSupply, currentStakedBalance);
}
| 11,648,858 |
pragma solidity ^0.4.21;
contract Erc20Token {
uint256 public totalSupply; //Total amount of Erc20Token
//Check balances
function balanceOf(address _owner) public constant returns (uint256 balance);
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
... | Constructor function Initializes contract with initial supply tokens to the creator of the contract/ | function KEO() public {
totalSupply = (moneyTotal - moneyFreeze) * 10 ** uint256(decimals);
balances[msg.sender] = totalSupply;
}
| 5,449,185 |
./full_match/1/0x0be1Bf3A5E67269837b775F0b1f4c275753755Fe/sources/@yield-protocol/vault-v2/src/other/notional/NotionalJoin.sol | Before maturity, transfer `amount` `asset` to `user`. user Address of receiver of tokens amount Amount of tokens, always as an fCash amount. After maturity, withdraw if necessary, then transfer `amount.wmul(accrual)` `underlying` to `user`. | function exit(address user, uint128 amount)
external
override
auth
returns (uint128)
{
if (block.timestamp < maturity) {
return _exit(user, amount);
}
}
| 16,443,045 |
./full_match/11155111/0xe9BF8462eA32893661bA3Ab1739ED3e0e68856f8/sources/src/lending/Lender.sol | Balances the borrower's account and adjusts the current amount of funds the borrower can take. borrower a borrower's contract address. debtPayment an amount of outstanding debt since the previous report, that the borrower managed to cover. Can be zero. borrowerFreeFunds a funds that the borrower has earned since the... | function _rebalanceBorrowerFunds(
address borrower,
uint256 debtPayment,
uint256 borrowerFreeFunds,
uint256 loss
) private {
uint256 borrowerAvailableCredit = _availableCredit(borrower);
uint256 borrowerOutstandingDebt = _outstandingDebt(msg.sender);
debt... | 3,794,551 |
./partial_match/1/0xbF91b355F325A9bb50d11eCe74f1f92C502C31aC/sources/contracts/AdoptMeImUglyOfficial.sol | Allows owner to mint tokens to a specified address | function airdrop(address to, uint count) external onlyOwner {
require(_totalMinted() + count <= COLLECTION_SIZE,
"Request exceeds collection size");
_safeMint(to, count);
}
| 3,676,145 |
pragma solidity 0.6.11;
// SPDX-License-Identifier: BSD-3-Clause
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
... | withdraw without caring about Rewards manual update account here without withdrawing pending rewards do not attempt swap here | function emergencyWithdraw(uint amountToWithdraw) public noContractsAllowed {
require(amountToWithdraw > 0, "Cannot withdraw 0 Tokens!");
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(depositTime[msg.sender]) > cliffTime, "You recent... | 1,114,798 |
pragma solidity ^0.4.25;
contract Ownerable{
address public owner;
address public delegate;
constructor() public{
owner = msg.sender;
delegate = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner,"Permission denied");
_;
}
... | Verify user identityQuery administrator privilegesIs order completed? | function deposit(address beneficiary_,uint256 amount_,string ext_) public whenNotPaused{
require(_idMap[msg.sender] != 0,"this address isn't a manager");
Channel storage channelInfo = _channelMap[_idMap[msg.sender]];
require(channelInfo.channelDelegate == msg.sender,"You are not the... | 7,224,076 |
./partial_match/1/0xDB7346f9Cc85ED5c81b7daE8A2Da86255c108E6F/sources/SUCKMYDICK.sol | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
funct... | 2,652,312 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
... | inject NONSTANDARD NAMING | function NONCES443(address owner) external view returns (uint256); | 12,569,002 |
//Address: 0x9f99793f908c58a99f44025c45dd72f2f92fc469
//Contract name: RTKICO
//Balance: 0 Ether
//Verification Date: 12/27/2017
//Transacion Count: 5
// CODE STARTS HERE
//
// compiler: solcjs -o ./build/contracts --optimize --abi --bin <this file>
// version: 0.4.19+commit.c4cbbb05.Emscripten.clang
//
pragma soli... | token should be ERC20-compliant and implement these functions | interface ERC20 {
function transfer(address to, uint256 value) public;
function balanceOf( address owner ) public constant returns (uint);
}
| 7,242,064 |
./partial_match/1/0x155AB9Cd3655Aa6174E1e743a6DA1E208762b03d/sources/CleverMinu.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 safeMul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
| 2,736,919 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.