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/0x1ec082560ab5938ec8D768211684D57089F4D73c/sources/script/utils/deterministic-deployments/TransparentUpgradeableProxy.sol | Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}./ | function upgradeToAndCall(
address newImplementation,
bytes calldata data
) external payable ifAdmin {
_upgradeToAndCall(newImplementation, data, true);
}
| 2,719,735 |
//Address: 0x42b486cd262a3b52c69dd8df3e040419531af014
//Contract name: Minter
//Balance: 0 Ether
//Verification Date: 4/30/2018
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity 0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/17... | Set targetBondingRate. Only callable by Controller owner _targetBondingRate Target bonding rate as a percentage of total bonded tokens / total token supply/ Must be valid percentage | function setTargetBondingRate(uint256 _targetBondingRate) external onlyControllerOwner {
require(MathUtils.validPerc(_targetBondingRate));
targetBondingRate = _targetBondingRate;
ParameterUpdate("targetBondingRate");
}
| 946,340 |
pragma solidity 0.4.24;
// ----------------------------------------------------------------------------
// 'Pumpkin' token contract
//
// Deployed to : 0x3e18c7E05762054418f4f9FDC8BFb41D8C912578
// Symbol : PUM
// Name : Pumpkin Token
// Total supply: 6,666,666,666
// Decimals : 18
//
// Copyright (c) Pu... | Sell `amount` tokens to contract amount amount of tokens to be sold require(this.balance >= amount.mul(sellPrice)); checks if the contract has enough ether to buy | function sell(uint256 amount) public {
require(address(this).balance >= amount.mul(sellPrice));
}
| 1,389,888 |
... | inject NONSTANDARD NAMING | function MOD258(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { | 12,993,969 |
./partial_match/56/0x9619E3b1b4f7441b0aFcb5BE6242950d1da04f92/sources/DCT.sol | PUBLIC FACING: External helper to return multiple values of daily data with a single call. beginDay First day of data range endDay Last day (non-inclusive) of data range return array of day stake shares total return array of day payout total/ | function dailyDataRange(uint256 beginDay, uint256 endDay)
external
view
returns (uint256[] memory _dayStakeSharesTotal, uint256[] memory _dayPayoutTotal, uint256[] memory _dayDividends)
{
require(beginDay < endDay && endDay <= globals.dailyDataCount, "DCT: range invalid");
... | 11,292,990 |
pragma solidity ^0.8.10;
import "../interfaces/IAllocator.sol";
import "./interfaces/ISwapRouter.sol";
import "./interfaces/IWETH.sol";
import "./interfaces/LiquityInterfaces.sol";
import "../types/BaseAllocator.sol";
error LUSDAllocator_InputTooLarge();
error LUSDAllocator_TreasuryAddressZero();
/**
* Contract de... | Router token swapping functionality Functions for swapping tokens via Uniswap V3 | interface ISwapRouter {
}
pragma solidity >=0.7.5;
struct ExactInputSingleParams {
address tokenIn;
address tokenOut;
uint24 fee;
address recipient;
uint256 deadline;
uint256 amountIn;
uint256 amountOutMinimum;
uint160 sqrtPriceLimitX96;
}
fun... | 6,997,434 |
./full_match/1/0xbfEC5787799A179a2ec84b255FD288962D135494/sources/contracts/router01/DexTracker.sol | Add new Dex This also generate id of the Dex _dexName Name of the Dex _router address of the dex router/ | function addDex(
string calldata _dexName,
address _router,
address payable _wNative,
DexType dexType
) external payable onlyOwner {
_addDex(_dexName, _router, _wNative, dexType);
}
| 16,409,920 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity >=0.8.0;
interface IBridge {
function send(
address _receiver,
address _token,
uint256 _amount,
uint64 _dstChainId,
uint64 _nonce,
uint32 _maxSlippage
) external;
function relay(
bytes calldat... | Execute a message not associated with a transfer. _message Arbitrary message bytes originated from and encoded by the source app contract _sigs The list of signatures sorted by signing addresses in ascending order. A relay must be signed-off by +2/3 of the sigsVerifier's current signing power to be delivered. _signe... | function executeMessage(
bytes calldata _message,
RouteInfo calldata _route,
bytes[] calldata _sigs,
address[] calldata _signers,
uint256[] calldata _powers
) external payable {
bytes32 messageId = computeMessageOnlyId(_route, _message);
require(executedMe... | 1,365,440 |
./full_match/71402/0x6291C16e5553dc70b54974FE19aE0cBfe0Cd0FD6/sources/contracts/ComposableStablePoolProtocolFees.sol | To track protocol fees, we measure and store the value of the invariant after every join and exit. All invariant growth that happens between join and exit events is due to swap fees and yield. For selected tokens, we exclude the yield portion from the computation. Because the invariant depends on the amplification para... | {
using FixedPoint for uint256;
using WordCodec for bytes32;
bytes32 private _lastJoinExitData;
uint256 private constant _LAST_POST_JOIN_EXIT_INVARIANT_OFFSET = 0;
uint256 private constant _LAST_POST_JOIN_EXIT_INVARIANT_SIZE = 233;
uint256 private constant _LAST_JOIN_EXIT_AMPLIFICATION_OFFSET ... | 7,091,994 |
./full_match/80001/0x75b74bA00FCeea8526A4d86F15fAC3988F703377/sources/contracts/templates/ERC1155x20.sol | should this have a false flag or is the revert in the call enough? can/should we use the data attribute of the ERC1155? | function transfer(address to, uint256 amount) external returns (bool) {
safeTransferFrom(msg.sender, to, 0, amount, '');
emit Transfer(msg.sender, to, amount);
return true;
}
| 9,441,203 |
./full_match/1/0x62424eB7CC9648d29D97E072D879fA30638Fb293/sources/contracts/Companion.sol | standard master mint method | function _masterMint(address to, uint256 satoshiId)
private
{
require(!_isPaused,"Mint is currently paused.");
require(_tokensAvailable > 0, "All tokens have been minted already");
_tokenIds.increment();
uint256 newItemId = _tokenIds.current();
_mint(to,newItemId);
... | 8,313,170 |
pragma solidity 0.4.18;
/**
* @title Multisignature wallet
* @dev Allows multiple parties to agree on transactions before execution
* @author Stefan George <stefan.george@consensys.net>
* @author Jakub Stefanski (https://github.com/jstefanski)
*/
contract MultiSigWallet {
uint256 constant public ... | Add a new owner Transaction has to be sent by wallet owner The address of a new owner/ | function addOwner(address owner)
public
onlyWallet
onlyValid(owner)
onlyOwnerDoesNotExist(owner)
onlyValidRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
| 13,015,737 |
./full_match/44787/0x115a323bd8D7101d1DF7B600a3A05b8fB647B65F/sources/contracts/Daos.sol | Decrease the MAX_DAOS variable only if these items aren't sold. If sale doens't go as in our dreams, then we can increase it's value by this burn | function burn(uint256 numDaosToBurn) public onlyDev {
require(numDaosToBurn > 0 && numDaosToBurn <= 1000, "You can only burn a 1 - 1000 at the time");
uint NewMaxPoopies = MAX_DAOS - numDaosToBurn;
require(totalSupply() <= NewMaxPoopies, "There NFT's are allready claimed");
MAX_DAOS ... | 13,241,562 |
pragma solidity ^0.4.23;
/**
* @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;
}
function div(uint256 a,... | SafeMath.sub will throw if there is not enough balance. | function transfer(address _to, uint256 _value, bytes _data, string _custom_fallback) public returns (bool success) {
require(_to != address(0));
require(_to != address(this));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = b... | 12,976,931 |
./full_match/97/0x7aA4ff1B1c8aeE692Dd61613c25B20A7F49aE7D9/sources/contracts/Staking.sol | sets rate for staking only by owner | function setRate(uint256 numinator, uint256 denominator) external onlyOwner {
rate[0] = numinator;
rate[1] = denominator;
}
| 3,268,041 |
./partial_match/1/0x9b6B9325f9EE470BB229F60dd1D24cf8D0F9AcBe/sources/MOE.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("MONEY OVER EVERYTHING", "MOE") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Fact... | 15,523,411 |
./partial_match/1/0xeb32d60A5cDED175cea9aFD0f2447297C125F2f4/sources/LimitOrders.sol | Returns the AssetAmount for the outputMarketId given the order and the inputs./ | function getOutputAssetAmount(
uint256 inputMarketId,
uint256 outputMarketId,
Types.Wei memory inputWei,
Order memory order
)
private
returns (Types.AssetAmount memory)
{
uint256 outputAmount;
uint256 makerFillAmount;
if (order.takerMa... | 2,626,529 |
./full_match/43113/0x4435b10bBaee30E06a43C19D585C8F5A59DcEaa1/sources/contracts/MasterGamer.sol | Update the given pool's HON allocation point plus deposit fee. | function set(
uint256 _pid,
uint256 _allocPoint,
uint256 _depositFeePerMillion,
bool _withUpdate
) external onlyOwner validatePoolByPid(_pid) {
require(_depositFeePerMillion < 1e6, "The deposit fee should be between 0 and 999,999");
if (_withUpdate) {
massUpdatePools();
}
total... | 7,109,385 |
./partial_match/5/0x2ebA8c4EfDB39A8Cd8f9eD65c50ec079f7CEBD81/sources/contracts/L1/rollup/CanonicalTransactionChain.sol | Allows the sequencer to append a batch of transactions. This function uses a custom encoding scheme for efficiency reasons. .param _shouldStartAtElement Specific batch we expect to start appending to. .param _totalElementsToAppend Total number of batch elements we expect to append. .param _contexts Array of batch cont... | function appendSequencerBatch()
external
{
uint40 shouldStartAtElement;
uint24 totalElementsToAppend;
uint24 numContexts;
assembly {
shouldStartAtElement := shr(216, calldataload(4))
totalElementsToAppend := shr(232, calldataload(9))
n... | 16,861,169 |
pragma solidity ^0.5.0;
import './SafeMathLib.sol';
contract HipToken {
using SafeMathLib for uint;
mapping (address => uint) public balances;
mapping (address => uint) public frozenBalances;
mapping (address => mapping (address => uint)) public allowed;
mapping (uint => FrozenTokens) public froz... | deduct add adjust allowance | function transferFrom(address from, address to, uint value) public returns (bool success)
{
uint allowance = allowed[from][msg.sender];
balances[from] = balances[from].minus(value);
balances[to] = balances[to].plus(value);
allowed[from][msg.sender] = allowance.minus(value);
... | 12,833,066 |
./full_match/43113/0x8D3fF256ef77a8686b73D47c0f05e9e72B12031B/sources/CW.sol | mint a token - 90% Sheep, 10% Wolves The first 20% are free to claim, the remaining cost $WOOL Due to buffer considerations, staking is not possible immediately Minter has to wait for 10 mints/ - MAX_PER_MINT, because the last MAX_PER_MINT are mintable by an admin | function mint(uint256 amount) external payable whenNotPaused {
require(tx.origin == _msgSender(), "Only EOA");
require(
minted + amount <= MAX_TOKENS - MAX_PER_MINT,
"All tokens minted"
);
require(amount > 0 && amount <= MAX_PER_MINT, "Invalid mint amount");
... | 7,181,733 |
./full_match/1/0xff368E106EA8782FaB6B2D4AD69739a60C66400E/sources/contracts/Stabilizer/Stabilizer.sol | Get Spread Amount fee = borrow_amount spread_ratio (time / time_per_year) return uint256 calculated spread amount./ | function accruedFee() public view returns (uint256) {
if (sweepBorrowed > 0) {
uint256 period = (block.timestamp - spreadDate) / DAY_SECONDS;
return
(sweepBorrowed * spreadFee * period) /
(DAYS_ONE_YEAR * PRECISION);
}
return 0;
}
... | 3,205,007 |
pragma solidity 0.5.9; // optimization enabled, runs: 10000, evm: constantinople
/**
* @title HomeWork Interface (version 1) - EIP165 ID 0xe5399799
* @author 0age
* @notice Homework is a utility to find, share, and reuse "home" addresses for
* contracts. Anyone can work to find a new home address by searching for... | inject PUBLIC FUNC TO EXTERNAL | function symbol() public pure returns (string memory) { | 15,817,938 |
// SPDX-License-Identifier: MIT
import './abstract/ReaperBaseStrategy.sol';
import './interfaces/IUniswapRouter.sol';
import './interfaces/IMasterChef.sol';
import './interfaces/IUniswapV2Pair.sol';
import './interfaces/IMoneyPot.sol';
import './interfaces/IZap.sol';
import './interfaces/IElectronToken.sol';
import "@... | Withdraws funds and sents them back to the vault. It withdraws {want} from the ProtoFi MasterChef The available {want} minus fees is returned to the vault./ | function withdraw(uint _withdrawAmount) external {
uint wantBalance = IERC20Upgradeable(want).balanceOf(address(this));
if (wantBalance < _withdrawAmount) {
IMasterChef(MASTER_CHEF).withdraw(poolId, _withdrawAmount - wantBalance);
wantBalance = IERC20Upgradeable(want).balanc... | 2,480,509 |
pragma solidity ^0.4.23;
/*
* Creator: Morpheus.Network (Morpheus.Network Classic)
*/
/*
* Abstract Token Smart Contract
*
*/
/*
* Safe Math Smart Contract.
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
contract SafeMath {
function mul(uint256 a, uint256 b... | Set new owner for the smart contract. May only be called by smart contract owner. _newOwner address of new owner of the smart contract/ | function setOwner(address _newOwner) {
require (msg.sender == owner||msg.sender==developer);
owner = _newOwner;
}
| 1,521,582 |
./partial_match/1/0xBCF85224fc0756B9Fa45aA7892530B47e10b6433/sources/src/v0.8/SimpleWriteAccessController.sol | Removes an address from the access list _user The address to remove/ | function removeAccess(address _user) external onlyOwner {
if (accessList[_user]) {
accessList[_user] = false;
emit RemovedAccess(_user);
}
}
| 4,175,581 |
./partial_match/97/0x6fC5a01FDb790415c89deFA0C18416212A3a51C0/sources/BEP20Token.sol | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements - `to` cannot be the zero address./ | function _mint(address account, uint256 amount) internal {
require(account != address(0), "BEP20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
| 11,462,876 |
./partial_match/1/0x59a3fa712bc01F3Af4E791BFF6A408dea2BbF39f/sources/Users/chichke/Documents/Work/Freelance/RealT/bridge-v2-chichke/contracts/operating/ComplianceRegistry.sol | Attach an address to an existing user _userId the user id to which the address will be attached _address the address to attach/ | function _attachAddress(uint256 _userId, address _address) internal {
require(addressUsers[msg.sender][_address] == 0, "UR02");
addressUsers[msg.sender][_address] = _userId;
userAddresses[msg.sender][_userId].push(_address);
emit AddressAttached(msg.sender, _userId, _address);
}
| 2,718,014 |
pragma solidity >=0.7.3;
// SPDX-License-Identifier: UNLICENSED
contract CreditDAO {
struct Election {
uint startBlock;
uint endBlock;
uint totalCrbSupply;
bool electionsFinished;
uint nextCandidateIndex;
mapping(uint => address) candidateIndex;
mapping(addre... | modified in constructor modified in createNewElections modified in sumbitForElection modified in vote modified finishElections | function observe() public view returns (
uint tmp0, uint tmp1, uint tmp2, address tmp3, address tmp4,
uint tmp5, uint tmp6, bool tmp7, uint tmp8, bool tmp9, address tmp10, uint tmp11
) {
tmp0 = elections[nextElectionIndex].startBlock;
tmp1 = elections[nextElectionIndex].endB... | 5,347,692 |
pragma solidity ^0.4.15;
/****************************************************************
*
* Name of the project: Genevieve GXVC New ICO
* Contract name: NewIco
* Author: Juan Livingston @ Ethernity.live
*
****************************************************************/
contract ERC2... | Main function, called internally when ethers are received | function makeSwapInternal() private isNotPaused { | 572,771 |
/**
*Submitted for verification at Etherscan.io on 2020-06-30
*/
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
pragma solidity ^0.5.2;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation o... | inject PUBLIC FUNC TO EXTERNAL | function implementation() public view returns (address) { | 7,233,585 |
./partial_match/56/0x49d11b03ac6C9290F894af93b378d7e27Ce8aBBF/sources/GanjaFarm.sol | Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address.... | function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "BEP20: at this point I have to ask, are you even a real communist?");
require(spender != address(0), "BEP20: did CZ sent you here?");
_allowances[owner][spender] = amount;
emit Approval(owner, s... | 11,242,074 |
./partial_match/1/0x436aAd97C5C4298521a1295F5e55c7BD9ab090c3/sources/FundRequestPrivateSeed.sol | event for token purchase logging purchaser who paid for the tokens beneficiary who got the tokens value weis paid for purchase amount amount of tokens purchased/ | function FundRequestPrivateSeed(uint _rate, address _wallet) {
require(_rate > 0);
require(_wallet != 0x0);
rate = _rate;
wallet = _wallet;
}
| 4,463,727 |
./partial_match/1/0x5EDF3BBFb4Ac9680f2Ab15a13fD2F443F41cAd41/sources/AssassinBot.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Assassin Bot", "ABOT") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = ... | 2,741,498 |
pragma solidity ^0.4.19;
//
/* CONTRACT */
contract SafeMath {
function safeAdd(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function safeSub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function saf... | _________________________________________________________ a buyers allowed limits in holding ico tokens along with financial capacity to buy is checked/ buyer limits buyer funds | function _chkBuyerLmtsAndFinl( address buyer, uint amountTkns, uint priceOfr) internal returns(bool success){
success = false;
bool sucs1 = false;
sucs1 = _chkBuyerLmts( buyer, amountTkns);
ICO ico = ICO( _getIcoAddr() );
bool sucs2 = false;
if( buyer.balance >= ... | 7,901,591 |
/**
*Submitted for verification at Etherscan.io on 2021-12-04
*/
/**
*Submitted for verification at polygonscan.com on 2021-12-03
*/
// File: @openzeppelin/contracts/utils/cryptography/ECDSA.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA)... | Update beneficiary address Settle promise and transfer calculated amount into beneficiary wallet | function settleWithBeneficiary(address _identity, uint256 _amount, uint256 _transactorFee, bytes32 _preimage, bytes memory _promiseSignature, address _newBeneficiary, bytes memory _beneficiarySignature) public {
registry.setBeneficiary(_identity, _newBeneficiary, _beneficiarySignature);
bytes32 _ch... | 15,090,095 |
pragma solidity ^0.4.21;
// File: contracts/P4RTYRelay.sol
/*
* Visit: https://p4rty.io
* Discord: https://discord.gg/7y3DHYF
* Copyright Mako Labs LLC 2018 All Rights Reseerved
*/
interface P4RTYRelay {
/**
* @dev Will relay to internal implementation
* @param beneficiary Token purchaser... | Converts all incoming ethereum to tokens for the caller, and passes down the referral addy (if any) | function buyFor(address _customerAddress, address _referredBy) onlyWhitelisted public payable returns (uint256) {
setReferral(_referredBy);
return purchaseTokens(_customerAddress, msg.value);
}
| 6,464,347 |
pragma solidity ^0.4.18;
/*
* v1.0
* Created by MyEtheroll.com, feb 2018
* Feel free to copy and share :)
* Donations: 0x7e3dc9f40e7ff9db80c3c7a1847cb95f861b3aef
*/
contract Billboard {
uint public cost = 100000000000000; // 0.0001 eth
uint16 public messageSpanStep = 1 minutes;
address owner;
by... | Create message id for linked list./ | function _createId(Message _message) private view returns (bytes32) {
return keccak256(_message.validFrom, _message.validTo, _message.sender, _message.message, length);
}
| 10,132,136 |
pragma solidity ^0.4.24;
import "./properties/Ownable.sol";
import "./properties/Assignable.sol";
import "./Voting.sol";
import "./tokens/Buck.sol";
/**
* @title Contract used to manage Artifacts
*/
contract ArtifactsManager is Assignable {
// The voting contract
Voting private _voting;
// The token used fo... | Propose an artifact to vote/ | function proposeArtifact(uint artifactID, string description, uint proposedPrice) public onlyAssignee returns (bool) {
require(proposedPrice > 0);
Artifact storage a = _artifactsProposed[_artifactsIndex[artifactID]];
require (!a.approved);
if(_artifactsIndex[artifactID] >= 0 && _artifactsIndex[ar... | 12,653,063 |
./full_match/1/0xb44FcB65D5E149983EEC12f1f61aed138c1e45d0/sources/contracts/MinterBurner.sol | Burn tokens is ready to burn and mint calculated reward | function burnAndMint() external onlyRole(MINTER_AND_BURNER_ROLE) {
require(readyToBurn > 0, "MinterBurner: nothing to burn");
require(
IGoMiningToken(Token).balanceOf(address(this)) >= readyToBurn,
"MinterBurner: not enough balance"
);
uint256 amountToMint =... | 4,933,373 |
/**
*Submitted for verification at Etherscan.io on 2020-10-26
*/
// File: contracts/lib/interface/ICelerWallet.sol
pragma solidity ^0.5.1;
/**
* @title CelerWallet interface
*/
interface ICelerWallet {
function create(address[] calldata _owners, address _operator, bytes32 _nonce) external returns(bytes32);
... | CelerWallet interface/ | interface ICelerWallet {
function create(address[] calldata _owners, address _operator, bytes32 _nonce) external returns(bytes32);
function depositETH(bytes32 _walletId) external payable;
function depositERC20(bytes32 _walletId, address _tokenAddress, uint _amount) external;
function withdraw(byt... | 5,426,694 |
pragma solidity ^0.6.0;
import "./interfaces/MarketControllerInterface.sol";
import "./interfaces/HTokenInterface.sol";
import "./interfaces/EIP20Interface.sol";
import "./interfaces/EIP20NonStandardInterface.sol";
import "./interfaces/InterestRateStrategyInterface.sol";
import "./interfaces/DistributorInterface.sol";... | Calculates the exchange rate from the underlying to the HToken This function does not accrue interest before calculating the exchange rate return (error code, calculated exchange rate scaled by 1e18)/ Otherwise: exchangeRate = (totalCash + totalBorrows - totalReserves) / totalSupply/ | function exchangeRateStoredInternal() internal view returns (MathError, uint256) {
uint256 _totalSupply = totalSupply;
if (_totalSupply == 0) {
return (MathError.NO_ERROR, initialExchangeRateMantissa);
uint256 totalCash = getCashPrior();
uint256 cashPlusBorrowsMinusReserves;
Exp memory exchangeRate;
... | 6,356,761 |
./partial_match/4/0x11461ACCfa24Db05b7Cb3c99335766bA02d4f581/sources/DiscoverSpaceX.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.accFbtPerShare... | 8,520,626 |
./full_match/5/0x38DB1BF0Fe525564B73fB0b157d969D496B7165d/sources/DividendToken.sol | Cast a uint256 to a uint128, revert on overflow y The uint256 to be downcasted return z The downcasted integer, now type uint128 | function toUint128(uint256 y) internal pure returns (uint128 z) {
require((z = uint128(y)) == y);
}
| 1,937,491 |
./full_match/40/0x00a4e368a090E08FdA25fd629c489fDB50784836/sources/contracts/iZiSwapPool.sol | @inheritdoc IiZiSwapPool | function liquiditySnapshot(int24 leftPoint, int24 rightPoint) external override view returns(int128[] memory deltaLiquidities) {
require(leftPoint < rightPoint, "L<R");
require(leftPoint >= leftMostPt, "LO");
require(rightPoint <= rightMostPt, "RO");
require(leftPoint % pointDelta ==... | 9,554,281 |
//SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.1;
import "./IERC20.sol";
contract SimpleERC20 is IERC20 {
string public symbol;
string public name;
uint8 public decimals;
uint256 public override totalSupply;
// Owner of this contract
address public owner;
// Balances fo... | Transfer the balance from owner's account to another account | function transfer(address _to, uint256 _amount) external override returns (bool success) {
if (balances[msg.sender] >= _amount && balances[_to] + _amount > balances[_to]) {
balances[msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(msg.sender, _to, _amount);
... | 905,290 |
pragma solidity ^0.8.0;
// SPDX-License-Identifier: MIT
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title CubesNFT
* @dev The Cubes NFT token contract for Latent L... | claimCube is an external function that allows user to claim a token. _cubeId id of the cube to claim/ | function claimCube(uint _cubeId) external payable {
require(_exists(_cubeId), "LatentLifeNFT::claimCube: Cube has not been minted yet.");
require(claimedCubes[_cubeId] == address(0), "LatentLifeNFT::claimCube: Cube has already been claimed,");
require(ownerOf(_cubeId) == msg.sender, "Latent... | 6,213,877 |
pragma solidity ^0.4.18;
/**
* Math operations with safety checks
*/
contract SafeMath {
function safeMul(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) internal returns (uint256) {
assert(b... | A contract attempts to get the coins / | function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
if (_value <= 0) throw;
allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value);
Transfer(_from, _to, _value);
return true;
}
| 511,428 |
./partial_match/1/0x899af34B1d218642e30e46860E4B78fe6E933853/sources/HAROLD.sol | taxes are 0 forever, no function to change these values exclude from paying fees or having max transaction amount | constructor() ERC20("HIDE THE PAIN", "HAROLD") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2P... | 4,291,926 |
// File: contracts/escrow/EscrowBaseInterface.sol
/**
* Copyright 2017–2019, LaborX PTY
* Licensed under the AGPL Version 3 license.
*/
pragma solidity ^0.4.25;
interface EscrowBaseInterface {
function hasCurrencySupport(bytes32 _symbol) public view returns (bool);
function getServiceFeeInfo() external view ... | Computes the index of the highest bit set in 'self'. Returns the highest bit set as an 'uint8'. Requires that 'self != 0'. | function highestBitSet(uint self) internal pure returns (uint8 highest) {
require(self != 0);
uint val = self;
for (uint8 i = 128; i >= 1; i >>= 1) {
if (val & (ONE << i) - 1 << i != 0) {
highest += i;
val >>= i;
}
}
}
| 968,472 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./AMM.sol";
import "../lib/CappedPool.sol";
import "../lib/CombinedActionsGuard.sol";... | addLiquidity in any proportion of tokenA or tokenB This function can only be called before option expiration amountOfA amount of TokenA to add amountOfB amount of TokenB to add owner address of the account that will have ownership of the liquidity/ | function addLiquidity(
uint256 amountOfA,
uint256 amountOfB,
address owner
) external override capped(tokenB(), amountOfB) {
require(msg.sender == configurationManager.getOptionHelper() || msg.sender == owner, "AMM: invalid sender");
_nonCombinedActions();
_before... | 88,907 |
pragma solidity ^0.5.7;
// Abstract contract for the full ERC 20 Token standard
// https://github.com/ethereum/EIPs/issues/20
interface ERC20Token {
/**
* @notice send `_value` token to `_to` from `msg.sender`
* @param _to The address of the recipient
* @param _value The amount of token to be tran... | Initialize contract (used with proxy). Can only be called once _sellingLicenses Sellers licenses contract address _arbitrationLicenses Arbitrators licenses contract address/ | function init(
address _sellingLicenses,
address _arbitrationLicenses
) public {
assert(_initialized == false);
_initialized = true;
sellingLicenses = License(_sellingLicenses);
arbitrationLicenses = ArbitrationLicense(_arbitrationLicenses);
basePrice =... | 1,797,956 |
./partial_match/1/0x00000000Ede6d8D217c60f93191C060747324bca/sources/node_modules/@aperture_finance/uni-v3-lib/src/SqrtPriceMath.sol | Gets the amount1 delta between two prices Calculates liquidity (sqrt(upper) - sqrt(lower)) sqrtRatioAX96 A sqrt price assumed to be lower otherwise swapped sqrtRatioBX96 Another sqrt price liquidity The amount of usable liquidity roundUp Whether to round the amount up, or down return amount1 Amount of token1 requ... | function getAmount1Delta(
uint160 sqrtRatioAX96,
uint160 sqrtRatioBX96,
uint128 liquidity,
bool roundUp
) internal pure returns (uint256 amount1) {
(sqrtRatioAX96, sqrtRatioBX96) = TernaryLib.sort2(sqrtRatioAX96, sqrtRatioBX96);
uint256 numerator = sqrtRatioBX96.s... | 15,622,165 |
./full_match/1/0x6000da47483062A0D734Ba3dc7576Ce6A0B645C4/sources/src/reactors/BaseReactor.sol | @inheritdoc IReactor | function executeWithCallback(SignedOrder calldata order, bytes calldata callbackData)
external
payable
override
nonReentrant
{
ResolvedOrder[] memory resolvedOrders = new ResolvedOrder[](1);
resolvedOrders[0] = resolve(order);
_prepare(resolvedOrders);
... | 9,648,277 |
./partial_match/56/0xd57079d80B57cd18a0fAD9c7b5af4d39C016D5f5/sources/Neatherd.sol | or when resetting it to zero. To increase and decrease it, use solhint-disable-next-line max-line-length | function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
| 11,062,058 |
pragma solidity 0.4.24;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a5d6d1c0c3c4cb8bc2c0cad7c2c0e5c6cacbd6c0cbd6dcd68bcbc0d1">[email protected]</a>>
cont... | Fallback function allows to deposit ether. | function() public
payable
{
if (msg.value > 0)
emit Deposit(msg.sender, msg.value);
}
public
validRequirement(_owners.length, _required)
| 15,391,131 |
./full_match/1/0x86b17741C4B62d40F0824e1cC8A41Bad4B71d7cf/sources/contracts/presale-pool/PreSalePool02.sol | Return the available tokens for purchase return availableTokens Number of total available/ | function getAvailableTokensForSale()
public
view
returns (uint256 availableTokens)
{
return maxCap.sub(tokenSold);
}
| 8,472,561 |
./full_match/1/0xa943F863fA69ff4F6D9022843Fb861BBEe45B2ce/sources/TangleBundle0.sol | Transfers a constant amount of Tangle set by owner to each address in a list of addresses addresses A list of addresses | function cropDust(address[] memory addresses) external {
SLib.S storage s = SLib.getS();
uint viableAddresses = addresses.length;
for (uint i = 0; i < addresses.length; i++) {
if (s.balances[addresses[i]] > 0 && !_isReflected(addresses[i])) {
viableAddresses--;
... | 17,007,046 |
./full_match/1/0x8787ca6A0aFffd8F634D09d7c2eE8D15b326e3f6/sources/src/FeeDistributor.sol | Wrapper around `_userTokenTimeCursor` which returns the start timestamp for `token` if `user` has not attempted to interact with it previously./ This is the first time that the user has interacted with this token. We then start from the latest out of either when `user` first locked vetoken or `token` was first checkpoi... | function _getUserTokenTimeCursor(
address user,
ERC20 token
) internal view returns (uint256) {
uint256 userTimeCursor = _userTokenTimeCursor[user][token];
if (userTimeCursor > 0) return userTimeCursor;
return
Math.max(_userState[user].startTime, _tokenState[t... | 2,980,058 |
./full_match/5/0x5967022766e1cc7Fe2ED78aD76C19563Ed57171F/sources/contracts/CrowdFunding.sol | is everything okay? | function createCampaign(address _owner, string memory _title, string memory _description, uint256 _target, uint256 _deadline, string memory _image) public returns (uint256) {
Campaign storage campaign = campaigns[numberOfCampaigns];
require(campaign.deadline < block.timestamp, "The deadline should ... | 1,874,954 |
./partial_match/1/0xA298c0B0772c27f3DaC7DDCFa7f9bD92A8E6b1D9/sources/src/roller/Strategy.sol | Mint strategy tokens with base tokens. It can be called only when not invested and not ejected. to Recipient for the strategy tokens return minted Amount of strategy tokens minted The base tokens that the user invests need to have been transferred previously, using a batchable router. minted = supply value(deposit) ... | function mintDivested(
address to
) external isState(State.DIVESTED) returns (uint256 minted) {
uint256 baseCached_ = baseCached;
uint256 deposit = base.balanceOf(address(this)) - baseCached_;
baseCached = baseCached_ + deposit;
minted = (_totalSupply * deposit) / baseCa... | 3,996,566 |
/**
* 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... | Retrieves list of investors, their balances, and their current withholding tax percentage _checkpointId Checkpoint Id to query for return address[] list of investors return uint256[] investor balances return uint256[] investor withheld percentages/ | function getCheckpointData(uint256 _checkpointId) external view returns (address[] memory investors, uint256[] memory balances, uint256[] memory withholdings) {
require(_checkpointId <= securityToken.currentCheckpointId(), "Invalid checkpoint");
investors = securityToken.getInvestorsAt(_checkpointId... | 14,073,966 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import "ds-test/test.sol";
import "../ZangNFT.sol";
import "../Marketplace.sol";
import {StringUtils} from "../StringUtils.sol";
interface Hevm {
function prank(address) external;
function expectRevert(bytes calldata) external;
function deal(address,... | 4: 𒀁, 𓃘, 𓇼, 𝅘𝅥𝅰, 🁲, 🌔, 🙄, 🢅, 🨀, | function test_utf_length_with_four_bytes_chars() public {
uint n = StringUtils.utfLength(first_byte(unicode"𒀁"));
assertEq(n, 4);
n = StringUtils.utfLength(first_byte(unicode"𓃘"));
assertEq(n, 4);
n = StringUtils.utfLength(first_byte(unicode"𓇼"));
assertEq(n, 4);... | 923,656 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
/// @title Callback for IUniswapV3PoolActions#flash
/// @notice Any contract that calls IUniswapV3PoolActions#flash must implement this interface
interface IUniswapV3FlashCallback {
/// @notice Called to `msg.sender` after transferring to the re... | Callback for IUniswapV3PoolActionsflash Any contract that calls IUniswapV3PoolActionsflash must implement this interface | interface IUniswapV3FlashCallback {
function uniswapV3FlashCallback(
uint256 fee0,
uint256 fee1,
bytes calldata data
) external;
pragma solidity >=0.5.0;
}
| 2,555,322 |
pragma solidity ^0.4.16;
pragma experimental "v0.5.0";
pragma experimental "ABIEncoderV2";
import {Memory} from "../unsafe/Memory.sol";
library Bytes {
uint internal constant BYTES_HEADER_SIZE = 32;
// Checks if two `bytes memory` variables are equal. This is done using hashing,
// which is much more g... | Copies a section of 'self' into a new array, starting at the provided 'startIndex'. Returns the new copy. Requires that 'startIndex <= self.length' The length of the substring is: 'self.length - startIndex' | function substr(bytes memory self, uint startIndex) internal pure returns (bytes memory) {
require(startIndex <= self.length);
var len = self.length - startIndex;
var addr = Memory.dataPtr(self);
return Memory.toBytes(addr + startIndex, len);
}
| 12,975,791 |
./full_match/11155111/0x6De466Af36959d321eC9dff99E506e061E25B57F/sources/lottery.sol | Pull payment system for winners to withdraw their amount | function withdraw() external {
uint256 amount = pendingWithdrawals[msg.sender];
require(amount > 0, "No funds available to withdraw");
pendingWithdrawals[msg.sender] = 0;
payable(msg.sender).transfer(amount);
}
| 3,805,269 |
// SPDX-License-Identifier: MIT
/*
________ __ _____
\______ \ _____ _______| | __ / _ \ ____ ____
| | \\__ \\_ __ \ |/ / / /_\ \ / ___\_/ __ \
| ` \/ __ \| | \/ < / | \/ /_/ > ___/
/_______ (____ /__| |__|_ \ \____|__ /\___ / \___ >
\/ \... | View function to see pending SWAMPWOLF on frontend./ | function pendingSwampWolf(uint256 _pid, address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 accSwampWolfPerShare = pool.accSwampWolfPerShare;
if (block.number > pool.lastRewardBlock && pool.lp... | 12,891,304 |
pragma solidity 0.5.2;
// File: contracts/ERC20Interface.sol
// https://github.com/ethereum/EIPs/issues/20
interface ERC20 {
function totalSupply() external view returns (uint supply);
function balanceOf(address _owner) external view returns (uint balance);
function transfer(address _to, uint _value) exte... | C1: We are in the 10 minute buffer period OR waiting for an auction to receive sufficient sellVolume Auction has already cleared, and index has been incremented sell order must use that auction index R1.1 | function postSellOrder(address sellToken, address buyToken, uint auctionIndex, uint amount)
public
returns (uint, uint)
if (auctionStart == AUCTION_START_WAITING_FOR_FUNDING || auctionStart > now) {
auctionIndex = latestAuctionIndex;
require(auctionIndex == la... | 5,418,450 |
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity >=0.4.22 <0.9.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
/**
* @notice basic implementation of the Staking Mechanism for Ni... | to add a stakeholder. _stakeHolder The stakeholder to add./ | function _addStakeHolder(address _stakeHolder) internal {
(bool isStaking,) = isStakeHolder(_stakeHolder);
if(!isStaking) stakeHolders.push(_stakeHolder);
}
| 12,791,006 |
./full_match/1/0xa3C8d390c3965D33937865973b6159D37B777C54/sources/src/version/Registry.sol | get asset specific information | function getName(address _asset) external view returns (string memory) {
return assetInformation[_asset].name;
}
| 3,057,380 |
./full_match/4/0xf548d4c9D32f70Ef379b3D875F0BCFc8f6E12890/sources/contracts/Lostboy.sol | switchMinting - Allows, disallows minting | function switchMinting() public onlyOwner {
mintingActive = !mintingActive;
}
| 754,681 |
./partial_match/1/0xb39dAB85FA05C381767FF992cCDE4c94619993d4/sources/contracts/RepaymentController.sol | Called when paying back installment loan with an amount greater than the minimum amount due. Do not call for single payment loan types. If one wishes to repay the minimum, use repayPartMinimum. Pay off the current interest and, if applicable any late fees accrued, and an additional amount to be de... | function repayPart(uint256 loanId, uint256 amount) external override {
if (amount == 0) revert RC_RepayPartZero();
(uint256 minBalanceDue, uint256 lateFees, uint256 numMissedPayments) = getInstallmentMinPayment(loanId);
uint256 _minAmount = minBalanceDue + lateFees;
if (amount < _mi... | 2,778,485 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
/**
* @title PlatinumPass contract
*/
contract PlatinumPass is Pausable, Ownable {
using... | Subscribe or mint a Platinum pass NFT/ Subscribe | function subscribe(address _subscriber) external payable whenNotPaused {
require(minBillingCost <= msg.value, "Ether value sent is not correct");
require(_subscriber != address(0), "Invalid address");
_subscribe(_subscriber, msg.value);
}
| 10,269,595 |
./partial_match/80001/0x39978B5629b33a616e0E23CbbE7467EDEFF639A2/sources/MultiSigWallet.sol | Returns transaction data. transactionId Transaction ID. return data - transaction data. | function getTransactionData(uint256 transactionId)
public
view
ownerExists(msg.sender)
transactionExists(transactionId)
notExecuted(transactionId)
returns (bytes memory data)
{
data = transactions[transactionId].data;
}
| 8,798,764 |
./full_match/1/0xe45e2871206f722ffFFaBB958933b240cDFf564e/sources/contracts/erc_standard.sol | Hash an order, returning the hash that a client must sign, including the standard message prefix return Hash of message prefix and order hash per Ethereum format/ | function _hashForMinting(
uint256 version,
uint256 nonce,
uint256[4] memory pricesAndTimestamps,
string memory ipfsHash,
string memory claimedIpfsHash,
bool claimable
) internal view returns (bytes32) {
return keccak256(abi.encode(address(this), block.chai... | 9,673,862 |
./partial_match/1/0x5bCDC405Cb237996d29fe3Ec779209e65fF2d39C/sources/ERC721A.sol | The nested ifs save around 20+ gas over a compound boolean condition. Clear approvals from the previous owner. This is equivalent to `delete _tokenApprovals[tokenId]`. Underflow of the sender's balance is impossible because we check for ownership above and the recipient's balance can't realistically overflow. Counter o... | function transferFrom(
address from,
address to,
uint256 tokenId
) public payable virtual override onlyAllowedOperator(from){
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner()... | 2,831,795 |
pragma solidity ^0.4.0;
// 1. Debugging, learning how to use the Debugging tool in remix.
// we will go over 3 aspects, 1st we will be Debugging things in a stack
// 2nd Debugging things in memory, 3rd storage.
contract Debugging {
uint[] private vars;
// stack hit Debug and look at stack and s... | storage hit Debug and look at stack and solidity locals | function storageAlloc() {
vars.push(2);
vars.push(3);
assert(vars.length == 4);
}
| 887,766 |
./full_match/73799/0xBF2428ee1685F1908C8FF4098a9a353c10Bc4748/sources/contracts/libraries/LibIssuer.sol | getRevocablePeriod - Retrieves the duration under which issued certificates are revocable return revocablePeriod - the duration during which issued proofs can be revoked/ | function getRevocablePeriod() internal view returns (uint256 revocablePeriod) {
IssuerStorage storage issuer = getStorage();
return issuer.revocablePeriod;
}
| 16,363,252 |
./partial_match/4/0x9361A22e147FeA8984B6598D3281770BD4D49C93/sources/Curve.sol | return The given number raised to the power of 2/ | function pow2(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * a;
require(c / a == a, "ExtendedMath: squaring overflow");
return c;
}
| 8,538,079 |
./full_match/1/0x69d8f2cb6Aa9E274864574a4e9F22e22DbE3b9A5/sources/contracts/interfaces/royalties/IRoyaltyRegistry.sol | Royalty registry interface/ | interface IRoyaltyRegistry is IERC165 {
event RoyaltyOverride(
address owner,
address tokenAddress,
address royaltyAddress
);
function setRoyaltyLookupAddress(
address tokenAddress,
address royaltyAddress
) external;
function getRoyaltyLookupAddress(
address tokenAddress
) external... | 4,890,658 |
./partial_match/1/0xB6Fc6E2385d55CCb83e297Bd92E2Bd89795B47A3/sources/PonyCore.sol | COO 권한을 가진 사용자와 paused가 true일때paused를 false로 설정 | function unPause() public onlyCOO whenPaused {
paused = false;
}
| 4,123,284 |
// SPDX-Lincense-identifier:MIT
pragma solidity ^0.7.0;
import "./SafeMathTyped.sol";
// The MIT License
//
// Copyright (c) 2017-2018 0xcert, d.o.o. https://0xcert.org
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Softw... | Returns the account balance of another account with address _owner. _owner The address from which the balance will be retrieved./ | function balanceOf(
address _owner
)
external
view
returns (uint256 _balance)
{
_balance = balances[_owner];
}
| 314,687 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "@openzeppelin/contracts/utils/math/Math.sol";
import "./interfaces/IOverlayV1Factory.sol";
import "./interfaces/IOverlayV1Market.sol";
import "./interfaces/IOverlayV1Token.sol";
import "./interfaces/feeds/IOverlayV1Feed.sol";
import "./libraries/FixedPo... | Checks the governance per-market risk parameter is valid checks delta won't cause position to be immediately liquidatable given current leverage cap (capLeverage), liquidation fee rate (liquidationFeeRate), and maintenance margin fraction (maintenanceMarginFraction) checks capLeverage won't cause position to be immedia... | function _checkRiskParam(Risk.Parameters name, uint256 value) private {
if (name == Risk.Parameters.Delta) {
uint256 _delta = value;
uint256 capLeverage = params.get(Risk.Parameters.CapLeverage);
uint256 maintenanceMarginFraction = params.get(
Risk.Paramet... | 14,060,263 |
./partial_match/42/0x94Be81De34C4026f534Ecc97E1Eb3B4F952d88ab/sources/DefholdPools.sol | Deposits in the specified pool to startCheck Deposit amountCheck Pool | function deposit(uint256 _pid, uint256 _amount) external nonReentrant {
PoolTemp memory temp;
require(_amount > 0, "deposit something");
uint256 countPool = poolLists.length;
require(_pid < countPool, "Not a valid Pool");
_updatePool(_pid);
if(userList[_pid][msg.sender].totalAmount == 0){
poo... | 8,894,197 |
pragma experimental ABIEncoderV2;
contract C {
struct S {
uint256 a;
uint256[] b;
}
function f0() public pure returns (bytes memory) {
return abi.encode();
}
function f1() public pure returns (bytes memory) {
return abi.encode(1, 2);
}
function f2() publi... | test that memory is properly allocated | function f3() public pure returns (bytes memory r) {
string memory x = "abc";
r = abi.encode(1, x, 2);
bytes memory y = "def";
require(y[0] == "d");
y[0] = "e";
require(y[0] == "e");
}
S s;
| 12,873,751 |
./full_match/1/0x41b84aea119E945f4C275BADA0eD38b8aFE864c8/sources/contracts/roles/ManagerRole.sol | Updates the Manager role status for the account _account The account address _value The Manager role status flag/ | function setManager(address _account, bool _value) public onlyOwner {
_setRoleBearer(ROLE_KEY, _account, _value);
emit SetManager(_account, _value);
}
| 17,169,101 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
*... | Get randomized values for each different trait with a single pseudorandom seed note: we are generating both traits and SVG on the fly based on the seed which is the the only parameter saved in memory Not writing a whole struct allows for serious gas savings on mint, but has a downside that we can't easily address or ch... | function getTraits(uint256 seed)
public
view
returns (string memory svg, string memory properties)
{
uint16[] memory randomInputs = expand(seed, 8);
uint16[] memory traits = new uint16[](9);
traits[1] back
traits[2] bottom
traits[3] clothes
traits[4] mouth
... | 13,972,363 |
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.5.2;
pragma experimental "ABIEncoderV2";
/**
* @title ERC20 interface
* @dev see https://eips.ethereum.org/EIPS/eip-20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function app... | IMetaOracleV2 Set Protocol Interface for operating with any MetaOracleV2 (moving average, bollinger, etc.) CHANGELOG: - read returns uint256 instead of bytes/ | interface IMetaOracleV2 {
function read(
uint256 _dataDays
)
external
view
returns (uint256);
}
Copyright 2019 Set Labs Inc.
}
| 1,000,989 |
pragma solidity >=0.4.22 <0.7.0;
contract SeroInterface {
/**
* the follow topics is system topics,can not be changed at will
*/
bytes32 private topic_sero_issueToken = 0x3be6bf24d822bcd6f6348f6f5a5c2d3108f04991ee63e80cde49a8c4746a0ef3;
bytes32 private topic_sero_balanceOf = 0xcf19eb4... | the follow topics is system topics,can not be changed at will/ convert bytes 32 to string x the string btyes32/ | function bytes32ToString(bytes32 x) internal pure returns (string memory) {
uint charCount = 0;
bytes memory bytesString = new bytes(32);
for (uint j = 0; j < 32; j++) {
byte char = byte(bytes32(uint(x) * 2 ** (8 * j)));
if (char != 0) {
bytesString[ch... | 5,428,425 |
./full_match/1/0xf607014406bc3Fa7aAB224a85A0318b4556e9C28/sources/browser/SingleAuctionLogicV1.sol | Make an official auction unmodifiable once we are certain the parameters are correct Only callable by perpetual altruism | function lock() external{
require(msg.sender == cryFactory, "Only Perpetual altruism can lock the initialization");
initialized = true;
}
| 3,152,016 |
./partial_match/1/0xED886fEc95Efa9FaA8D031FeF57878Ba18485782/sources/CompliantToken.sol | approve transfer/transferFrom request called internally in the rejectTransfer and bulkRejectTransfers functions nonce request recorded at this particular nonce/ | function _approveTransfer(uint256 nonce)
private
checkIsInvestorApproved(pendingTransactions[nonce].from)
checkIsInvestorApproved(pendingTransactions[nonce].to)
returns (bool)
{
address from = pendingTransactions[nonce].from;
address to = pendingTransactions[n... | 4,219,351 |
pragma solidity ^0.5.2;
/*
* A minimum multisig wallet interface. Compatible with MultiSigWallet by Gnosis.
*/
contract WalletBasic {
function isOwner(address owner) public view returns (bool);
}
/**
* @dev MultiOwnable contract.
*/
contract MultiOwnable {
WalletBasic public wallet;
event Mu... | called by any MSW owner to pause, triggers stopped state/ | function pause()
onlyOwner
whenNotPaused
public
{
paused = true;
emit Pause();
}
| 12,728,599 |
./partial_match/1/0xD3111A14E8df0Df749CF881AE414037D732D8d28/sources/ComboOracle_KyberSwapElasticV2.sol | KyberSwap v2 factory Deploys KyberSwap v2 pools and manages control over government fees | interface IFactory {
event PoolCreated(
address indexed token0,
address indexed token1,
uint24 indexed swapFeeUnits,
int24 tickDistance,
address pool
);
event SwapFeeEnabled(uint24 indexed swapFeeUnits, int24 indexed tickDistance);
event VestingPeriodUpdated(uint32 vestingPeriod);
event... | 2,731,335 |
/*
Copyright 2019 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 applicable law or agreed to in writing, ... | Deterministic `IUniswapExchangeQuotes.getTokenToEthInputPrice()`. | function getTokenToEthInputPrice(
uint256 tokensSold
)
external
view
returns (uint256 ethBought)
{
_revertIfShouldFail();
return LibDeterministicQuotes.getDeterministicSellQuote(
salt,
tokenAddress,
_getWethAddress(),
... | 12,751,529 |
/**
*Submitted for verification at Etherscan.io on 2021-08-16
*/
pragma solidity 0.5.14;
/**
* @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 o... | Withdraw a token from an address _token token address _amount amount to be withdrawn/ | function withdraw(address _token, uint256 _amount) external onlySupportedToken(_token) whenNotPaused nonReentrant {
require(_amount != 0, "Amount is zero");
uint256 amount = IBank(globalConfig.bank()).withdraw(msg.sender, _token, _amount);
SavingLib.send(globalConfig, amount, _token);
... | 10,888,212 |
./full_match/43113/0x0fF356982E0aa01eac04A42a2e7E60a6216c3ED8/sources/PUMPKINS/Farm_vault.sol | View function to see pending KINS on frontend. | function pendingkins(uint256 _pid, address _user)
external
view
returns (uint256)
{
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_user];
uint256 acckinsPerShare = pool.acckinsPerShare;
uint256 lpSupply = pool.lpToken.balan... | 13,148,706 |
/**
*Submitted for verification at Etherscan.io on 2019-12-27
*/
/**
Copyright 2019 PoolTogether LLC
This file is part of PoolTogether.
PoolTogether is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation under version... | Withdraw the sender's entire balance back to them./ Update their chances of winning | function withdraw() public nonReentrant notLocked {
uint256 sponsorshipAndFees = sponsorshipAndFeeBalanceOf(msg.sender);
uint256 openBalance = drawState.openBalanceOf(msg.sender);
uint256 committedBalance = drawState.committedBalanceOf(msg.sender);
uint balance = balances[msg.sender];
drawState.... | 14,091,925 |
pragma solidity 0.5.7;
import "./IRSV.sol";
import "../ownership/Ownable.sol";
import "../zeppelin/utils/ECDSA.sol";
/**
* @title The Reserve Relayer Contract
* @dev A contract to support metatransactions via ECDSA signature verification.
*
*/
contract Relayer is Ownable {
IRSV public trustedRSV;
mapping... | Recover the signer's address from the hash and signature. | function _recoverSignerAddress(bytes32 hash, bytes memory sig)
internal pure
returns (address)
{
bytes32 ethMessageHash = ECDSA.toEthSignedMessageHash(hash);
return ECDSA.recover(ethMessageHash, sig);
}
| 13,072,966 |
pragma solidity ^0.4.25;
import "./Register.sol";
import "./Counters.sol";
import "./Roles.sol";
contract IBAC002Receiver {
/**
* @notice Handle the receipt of an NFT
* @dev The BAC002 smart contract calls this function on the recipient
*/
function onBAC002Received(address operator, address fr... | Returns an URI for a given asset ID./ | function assetURI(uint256 assetId) external view returns (string memory) {
require(_exists(assetId), "BAC002Metadata: URI query for nonexistent asset");
return _assetURIs[assetId];
}
| 12,696,220 |
pragma solidity 0.5.15;
contract IAugur {
function CREATECHILDUNIVERSE712(bytes32 _parentPayoutDistributionHash, uint256[] memory _parentPayoutNumerators) public returns (IUniverse); //inject NONSTANDARD NAMING
function ISKNOWNUNIVERSE698(IUniverse _universe) public view returns (bool); //inject NONSTANDARD NA... | inject NONSTANDARD NAMING | function SAVEORDER165(Order.Data memory _orderData, bytes32 _tradeGroupId, IOrders _orders) internal returns (bytes32) { | 2,554,118 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.