file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity ^0.4.21;
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
contract Whitelister is Ownable {
address public whitelister_address;
//User: can be buyer or seller
struct User {
//code for country of citizenship
uint countryCode;
//KYC AI ap... | change whitelister Address | function changeWhiteLister(address whitelisterAddress) public onlyOwner {
require(whitelisterAddress != 0);
whitelister_address = whitelisterAddress;
}
| 12,576,482 |
//Address: 0x26d08b9d227933a85e855656dc46ab889e183c88
//Contract name: PlaykeyICO
//Balance: 10,247.750944192281253374 Ether
//Verification Date: 10/30/2017
//Transacion Count: 3402
// CODE STARTS HERE
pragma solidity ^0.4.15;
contract PlaykeyICO {
// Constants
// =========
uint256 public constant tokensPer... | Allow token transfer. | function defrost() external icoOnly {
tokensAreFrozen = false;
}
| 1,770,710 |
./partial_match/100/0xd840f57b84Eb281fb045FC271c07d37C3cf4E206/sources/DMEX_Base.sol | Decreases user balance | function subBalance(address token, address user, uint256 amount) private
{
if (availableBalanceOf(token, user) < amount) throw;
updateBalance(token, user, safeSub(balanceOf(token, user), amount));
}
| 16,661,368 |
./full_match/3/0xD68416bf45Bb2127dfc8d8BCA58FE0D06711bAcF/sources/browser/KingOfTheHill.sol | require("KingOfTheHill: Irration percentage") | function setStrengthBonus(uint256 percentage) public onlyOwner() {
_strengthBonus = percentage;
}
| 8,264,498 |
./full_match/82/0x31C222e0D862827137ab5D4e8EE30c41Cc915a96/sources/contracts/oracle/implementation/OptimisticOracleV2.sol | Sets which callbacks should be enabled for the request. identifier price identifier to identify the existing request. timestamp timestamp to identify the existing request. ancillaryData ancillary data of the price being requested. callbackOnPriceProposed whether to enable the callback onPriceProposed. callbackOnPr... | function setCallbacks(
bytes32 identifier,
uint256 timestamp,
bytes memory ancillaryData,
bool callbackOnPriceProposed,
bool callbackOnPriceDisputed,
bool callbackOnPriceSettled
) external override nonReentrant() {
require(
_getState(msg.sender... | 7,093,977 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import { SafeMath } from '@openzeppelin/contracts/utils/math/SafeMath.sol';
import { ERC20 } from './open-zeppelin/ERC20.sol';
import { IFTPAntiBot } from './interfaces/IFTPAntiBot.sol';
import { KibbleAccessControl } from './KibbleAccessControl.sol';
import { K... | Delegates power from signatory to `_delegatee` _delegatee The address to delegate votes to _nonce The contract state required to match the signature _expiry The time at which to expire the signature _v The recovery byte of the signature _r Half of the ECDSA signature pair _s Half of the ECDSA signature pair | function delegateBySig(
address _delegatee,
uint256 _nonce,
uint256 _expiry,
uint8 _v,
bytes32 _r,
bytes32 _s
) external {
bytes32 structHash = keccak256(
abi.encode(DELEGATE_TYPEHASH, _delegatee, _nonce, _expiry)
);
bytes32 digest = keccak256(
abi.encodePacked('\x19\... | 13,656,681 |
pragma solidity ^0.8.1;
/*
Notes
- contract is trusted and usable by only 1 (owner)
- storing strings in solidity is not ideal due to expense; demo purposes only
- storing hashes of ipfs hashes is not a solution
*/
contract Store {
// state variables
address public owner;
// array of CIDs
strin... | function that adds a CID to the stored cidArray only the owner of the contract is allowed to add a CID _cid is string of file data (expensive) push new CID to array | function addCID(string memory _cid) public onlyOwner {
cidArray.push(_cid);
}
| 12,617,992 |
pragma solidity ^0.5.16;
/**
* @title StableMath
* @dev Accesses the Stable Math library using generic system wide variables for managing precision
* Derives from OpenZeppelin's SafeMath lib
*/
library StableMath {
/** @dev Scaling units for use in specific calculations */
uint256 private constant fullScal... | Returns the subtraction of two unsigned integers, reverting on overflow. / | function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
require(b <= a, "StableMath: subtraction overflow");
c = a - b;
}
| 924,916 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
pragma abicoder v2;
import "../internal/portfolio/PortfolioHandler.sol";
import "../internal/balances/BalanceHandler.sol";
import "../internal/settlement/SettlePortfolioAssets.sol";
import "../internal/settlement/SettleBitmapAssets.sol";
import "../inter... | prettier-ignore prettier-ignore prettier-ignore | function loadNTokenPortfolioNoCashGroup(nTokenPortfolio memory nToken, uint16 currencyId)
internal
view
{
nToken.tokenAddress = nTokenAddress(currencyId);
(
uint256 lastInitializedTime,
uint8 assetArrayLength,
bytes5 parameters
) = getN... | 309,903 |
./partial_match/1/0xcBe79cEca09092648995B2CCdf91cA5ECD1EdEc9/sources/InverseToken.sol | Define Start + End Index | function getMintingFee(uint256 cash) public view returns (uint256) {
uint256 startIndex = 0;
uint256 endIndex = mintingFeeBracket.length - 1;
uint256 middleIndex = endIndex / 2;
if (cash <= mintingFeeBracket[middleIndex]) {
endIndex = middleIndex;
startIndex ... | 4,016,471 |
./partial_match/1/0xa1a5143b4044cC3B710FfB8D7130b24a542536f0/sources/lib/forge-std/src/safeconsole.sol | Selector of `log(bool,uint256,bool,uint256)`. | function log(bool p0, uint256 p1, bool p2, uint256 p3) internal pure {
bytes32 m0;
bytes32 m1;
bytes32 m2;
bytes32 m3;
bytes32 m4;
assembly {
m0 := mload(0x00)
m1 := mload(0x20)
m2 := mload(0x40)
m3 := mload(0x60)
... | 16,053,123 |
./partial_match/83/0xAA49141eEa36ce1A26Fc49DC2ff9983494FfA70B/sources/contracts/farmings/AlgebraFarming.sol | @inheritdoc IAlgebraFarming | function setOwner(address _owner) external override onlyOwner {
require(_owner != owner);
owner = _owner;
emit Owner(_owner);
}
| 8,828,334 |
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
/* Internal Imports */
import { CanonicalTransactionChain } from "./CanonicalTransactionChain.sol";
import { StateCommitmentChain } from "./StateCommitmentChain.sol";
/**
* @title SequencerBatchSubmitter
* @notice Helper contract that allows the sequencer to... | Append equal sized batches of transactions and state roots to their respective chains. _txBatch An array of transactions. _txBatchTimestamp The timestamp that will be submitted with the tx batch - this timestamp will likely lag behind the actual time by a few ... | function appendTransitionBatch(
bytes[] memory _txBatch,
uint _txBatchTimestamp,
bytes[] memory _stateBatch
) public onlySequencer {
require(
_stateBatch.length == _txBatch.length,
"Must append the same number of state roots and transactions"
);
... | 12,692,561 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
// Part: OpenZeppelin/openzeppelin-contracts@4.3.2/Address
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is un... | Drop 1, after 75% minting 5 ETH are transferred to 20 random scissors owners (pull payment, 0.5 ETH each) Get 20 random tokenId numbers from 0...(maxDrop3)/4 Add payment in escrow contract | function _secondGiveAway() internal {
second_prize_winners = new address[](TH_SECOND_PRIZE_MAX_WINNERS);
uint256 div = top_75_pct / TH_SECOND_PRIZE_MAX_WINNERS;
uint256 seed = rand(div) + 1;
for(uint256 i = 0; i < TH_SECOND_PRIZE_MAX_WINNERS; i++) {
second_pri... | 586,493 |
pragma solidity >=0.4.21 <0.7.0;
pragma experimental ABIEncoderV2; // TO ALLOW RETURNING STRUCTS AND ARRAYS FROM FUNCTIONS
contract Main {
// MAX SIZE OF LANDS AND OWNERS AVAILABLE IN OUR BLOCKCHAIN
uint constant ARR_SIZE = 16;
struct Land {
string landName;
string coordination; //30.... | TRANSFER LAND REGISTRY FROM AN EXISTING OWNER TO ANOTHER ONE CHECK IF THE ORIGINAL OWNER DOES INDEED HAVE THE LAND REGISTERED TO HIS/HER ADDRESS require(msg.value == registryFee); REMOVE ORIGINAL OWNER ASSOCIATION WITH THE LAND | function transferLand(uint _landId, uint _originalOwnerId, uint _newOwnerId) external payable {
if (lands[_landId-1].ownerAddress == owners[_originalOwnerId-1].ownerAddress) {
for (uint i = 0; i < ARR_SIZE; i++){
if(owners[_originalOwnerId-1].ownedLandsIDs[i] == _landId){
... | 5,508,407 |
./full_match/80001/0x5D5B9Db9297dd8a88a69b41771fa42A2B98b75cA/sources/contracts/drop/DropERC20.sol | Lets an account claim tokens. Get the claim conditions. Verify inclusion in allowlist. Verify claim validity. If not valid, revert. when there's allowlist present --> verifyClaimMerkleProof will verify the _proofMaxQuantityPerTransaction value with hashed leaf in the allowlist when there's no allowlist, this check is t... | function claim(
address _receiver,
uint256 _quantity,
address _currency,
uint256 _pricePerToken,
bytes32[] calldata _proofs,
uint256 _proofMaxQuantityPerTransaction
) external payable nonReentrant {
require(isTrustedForwarder(msg.sender) || _msgSender() ==... | 857,053 |
./full_match/1/0xBEbB92Ed09688e64DC38c240B600D0B1d504EE56/sources/lib/aera-contracts/contracts/v1/AeraVaultV1.sol | Enable or disable swap. Will only be called by enableTradingRiskingArbitrage(), enableTradingWithWeights() and disableTrading(). swapEnabled Swap status. slither-disable-next-line reentrancy-events | function setSwapEnabled(bool swapEnabled) internal {
poolController.setSwapEnabled(swapEnabled);
emit SetSwapEnabled(swapEnabled);
}
| 3,080,282 |
pragma solidity 0.4.25;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: t... | change the allowance for a specific spender/ | function approve(address _spender, uint256 _tokensAmount) public {
require(msg.sender == address(token));
token.approve(_spender, _tokensAmount);
}
| 12,779,090 |
/**
*Submitted for verification at Etherscan.io on 2022-03-05
*/
/**
*Submitted for verification at Etherscan.io on 2022-02-08
*/
// Verified using https://dapp.tools
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10 >=0.8.10 >=0.8.0 <0.9.0;
pragma experimental ABIEncoderV2;
////// lib/openzeppelin-contract... | exclude from paying fees or having max transaction amount | constructor() ERC20("SIMP Token", "SIMP") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IU... | 6,714,040 |
/**
*Submitted for verification at Etherscan.io on 2021-09-06
*/
// File: @openzeppelin/contracts/utils/Counters.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This can... | Get minting limit (for a single transaction) based on current token supply | function getCurrentMintLimit() public pure returns (uint8) {
return 30;
}
| 7,721,071 |
./partial_match/1/0xe05c45635EC5610440c77e215EF122cdD7f2d314/sources/src/core/vaults/BaseVault.sol | Sets addresses for different settings _type of address: 0 - Manager 1 - FeeRecipient 2 - Pauser 3 - Whitelist _address is the new address/ | function _setAddress(uint256 _type, address _address) internal virtual {
AddressType addressType = AddressType(_type);
if (AddressType.Manager == addressType) {
emit AddressSet(_type, manager, _address);
manager = _address;
emit AddressSet(_type, feeRecipient, _a... | 9,222,236 |
./partial_match/1/0x76c5449F4950f6338A393F53CdA8b53B0cd3Ca3a/sources/BT.sol | Change the minter address minter_ The address of the new minter/ | function setMinter(address minter_) external {
require(msg.sender == minter, "BT::setMinter: only the minter can change the minter address");
emit MinterChanged(minter, minter_);
minter = minter_;
}
| 9,185,173 |
pragma solidity ^0.4.24;
import "../../contracts/InterestRateModel.sol";
/**
* @title A Fixed Interest Rate Model for tests
* @author Compound
* @notice Interest rates should be scaled by 10e18
*/
contract FixedInterestRateModel is InterestRateModel {
uint supplyRate;
uint borrowRate;
constructo... | Gets the current borrow interest rate based on the given asset, total cash and total borrows The return value should be scaled by 1e18, thus a return value of `(true, 1000000000000)` implies an interest rate of 0.000001 or 0.0001% per block. _asset The asset to get the interest rate of _cash The total cash of t... | function getBorrowRate(address _asset, uint _cash, uint _borrows) view public returns (uint, uint) {
return (0, borrowRate);
}
| 986,991 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
import "./libraries/SafeMath.sol";
import "./libraries/IterableMapping.sol";
import "./Ownable.sol";
import "./ERC20.sol";
import "./interfaces/IUniswapV2Router02.sol";
import "./interfaces/IUniswapV2Factory.sol";
/**
@title Pool Party token
@author kef... | split the contract balance into halves capture the contract's current BNB balance. this is so that we can capture exactly the amount of BNB that the swap creates, and not make the liquidity event include any BNB that has been manually sent to the contract swap _amount for BNB how much BNB did we just swap into add liqu... | function swapAndLiquify(uint256 _amount) private {
uint256 half = _amount.div(2);
uint256 otherHalf = _amount.sub(half);
uint256 initialBalance = address(this).balance;
uint256 newBalance = address(this).balance.sub(initialBalance);
addLiquidity(otherHalf, newBalance);
... | 5,380,573 |
./full_match/5/0xFF21Ca030aFDC36e746a73c19AdF9DeD597713De/sources/project_/contracts/Base.sol | Initialize the contract and it's inherited contracts, data is then stored on the proxy for future use/changes name_ the name of the contract symbol_ the symbol of the contract/_mint(address(0x0), 10); | function initialize(string memory name_, string memory symbol_) public initializer {
__ERC721A_init(name_, symbol_);
MAX_SUPPLY = 10000;
MAX_TOKENS_PER_WALLET = 20;
TOKEN_PRICE = 0.05 ether;
saleOpens = 0;
saleCloses = 99999999999999;
setOwner(msg.sender);
... | 1,873,391 |
pragma solidity ^0.4.26;
/// import base contracts, interfaces, libraries from latest gitHUB
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public con... | - set new address to sent all incoming tokens. _newTokenHolder address to sent all incoming tokens./ | function setTokenHolder(address _newTokenHolder) public onlyOwner {
tokenHolder = _newTokenHolder;
}
| 1,352,038 |
./full_match/1/0x86Ebcd1bC876782670FE0B9ea23d8504569B9ffc/sources/contracts/accumulator/veSDTFeeFraxProxy.sol | internal function to swap CRV to FRAX slippageCRV = 100 for 1% max slippage _amount amount to swap | function _swapOnSushi(uint256 _amount) internal returns (uint256) {
uint256[] memory amounts = IUniswapRouter(SUSHI_ROUTER).getAmountsOut(_amount, fxsToFraxPath);
uint256 minAmount = (amounts[fxsToFraxPath.length - 1] * (10000 - maxSlippage)) / (10000);
uint256[] memory outputs = IUniswapRouter(SUSHI_ROUTER).s... | 16,425,906 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
import "./Interfaces/IPriceFeed.sol";
import "./Interfaces/ITellorCaller.sol";
import "./Dependencies/AggregatorV3Interface.sol";
import "./Dependencies/SafeMath.sol";
import "./Dependencies/Ownable.sol";
import "./Dependencies/CheckContract.sol";
import "./Depe... | Get the relative price difference between the oracles. Use the lower price as the denominator, i.e. the reference for the calculation. | function _bothOraclesSimilarPrice( ChainlinkResponse memory _chainlinkResponse, TellorResponse memory _tellorResponse) internal pure returns (bool) {
uint scaledChainlinkPrice = _scaleChainlinkPriceByDigits(uint256(_chainlinkResponse.answer), _chainlinkResponse.decimals);
uint scaledTellorPrice = _s... | 897,731 |
pragma solidity ^0.5.9;
pragma experimental ABIEncoderV2;
/*
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
... | Calculates the fill results for the maker and taker in the order matching and writes the results to the fillResults that are being collected on the order. leftOrder The left order that is being maximally filled. All of the information about fill amounts can be derived from this order and the righ... | function _calculateCompleteRightFill(
LibOrder.Order memory leftOrder,
uint256 rightMakerAssetAmountRemaining,
uint256 rightTakerAssetAmountRemaining
)
private
pure
returns (MatchedFillResults memory matchedFillResults)
{
matchedFillResults.right.maker... | 567,228 |
pragma solidity ^0.5.0;
import { GameCommon } from "./GameCommon.sol";
import { IGameItem, GameItem } from "./GameItem.sol";
import { IGamePlayer } from "./GamePlayer.sol";
import { AddressSet } from "./AddressSet.sol";
interface IGameFactory {
function CreateGameItem(IGameStore gameStore, string calldata itemKey,... | get all items registered to this game | function GetAllItems() external view returns (address[] memory)
{
return AllItems.addresses;
}
| 15,781,443 |
//SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;
import './ArrayLibUInt.sol';
/**
* @dev A gas optimized uint32[] implementation. Uses the ArrayLibUInt with bitLength = 32.
*
*
*/
library ArrayLibUInt32 {
/**
* @dev Get length of the array
* @param slot storage slot
* @return length
... | Append val to the end of the array, increasing its length. slot storage slot val value/ | function push(bytes32 slot, uint32 val) internal {
ArrayLibUInt.push(32, slot, val);
}
| 13,043,257 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/AccessCo... | do nothing if sold out | function setAvailableForSale( uint _mType, bool _avail ) public onlyRole(MINTER_ROLE) {
if ( isSoldOut(_mType) != true )
_membershipAvailableofSale[_mType] = _avail;
}
| 12,079,632 |
pragma solidity 0.5.17;
pragma experimental ABIEncoderV2;
interface iuniswap2 { //inject NONSTANDARD NAMING
// To convert DAI to ETH
function SWAPEXACTTOKENSFORETH53(uint AMOUNTIN88, uint AMOUNTOUTMIN99, address[] calldata PATH78, address TO76, uin... | inject NONSTANDARD NAMING | function SETRETIREMENTYELDTREASURY49(address payable _TREASURY6) public ONLYOWNER61 { | 7,220,479 |
pragma solidity ^0.5.0;
pragma solidity ^0.5.0;
pragma solidity ^0.5.0;
pragma solidity ^0.5.0;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint... | Grant the items to the caller Emit the Transfer/Mint event. the 0x0 source address implies a mint It will also provide the circulating supply info. | function mintFungibleSingle(uint256 _id, address _to, uint256 _quantity) external onlyOperator {
require(isFungible(_id));
balances[_id][_to] = _quantity.add(balances[_id][_to]);
emit TransferSingle(msg.sender, address(0x0), _to, _id, _quantity);
onTransfer20(address(0x0), _to, _i... | 12,999,902 |
./full_match/1/0x0b1b37c0d376e72d523319c6592f3A24D39912fD/sources/contracts/gauges/uniswapv3/UniswapV3Base.sol | Private function to remove a token from this extension's token tracking data structures. This has O(1) time complexity, but alters the order of the _allTokens array. tokenId uint256 ID of the token to be removed from the tokens list/ To prevent a gap in the tokens array, we store the last token in the index of the tok... | function _removeTokenFromAllTokensEnumeration(uint256 tokenId) internal {
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[tokenId];
uint256 lastTokenId = _allTokens[lastTokenIndex];
delete _allTokensIndex[tokenId];
_allTokens.pop();
... | 3,068,017 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.8.0;
// ====================================================================
// | ______ _______ |
// | / _____________ __ __ / ____(_____ ____ _____ ________ |
// | / /_ / ___/ __ `| |/_/ /... | Can only be triggered by owner or governance, not custodian Tokens are sent to the custodian, as a sort of safeguard | function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyByOwnGov {
TransferHelper.safeTransfer(address(tokenAddress), msg.sender, tokenAmount);
}
| 1,004,470 |
./partial_match/8453/0xBB505c54D71E9e599cB8435b4F0cEEc05fC71cbD/sources/contracts/lendingpool/LendingPool.sol | initialize a reserve pool for an asset new a eToken contract | function initReserve(address asset) external onlyOwner notPaused {
uint256 id = nextReserveId;
nextReserveId += 1;
string memory name = string(
abi.encodePacked(
ERC20(asset).name(),
"(ExtraFi Interest Bearing Token)"
)
);
... | 16,698,341 |
./full_match/80001/0x560Fa62c1AB6395DA0F87bcFe691C6b0610CF2e4/sources/contracts/interfaces/IModule.sol | IModule Set Protocol Interface for interacting with Modules./ | interface IModule {
function removeModule() external;
Copyright 2020 Set Labs Inc.
pragma solidity 0.6.10;
} | 5,659,183 |
pragma solidity ^0.8.0;
// SPDX-License-Identifier: MIT
import "../core/DaoConstants.sol";
import "../core/DaoRegistry.sol";
import "../extensions/bank/Bank.sol";
import "../guards/AdapterGuard.sol";
import "../utils/Signatures.sol";
import "../utils/PotentialNewMember.sol";
/**
MIT License
Copyright (c) 2020 Openl... | Redeems a coupon to add a new member. dao is the DAO instance to be configured authorizedMember is the address that this coupon authorized to become a new member amount is the amount of units that this member will receive nonce is a unique identifier for this coupon request signature is message signature for verif... | function redeemCoupon(
DaoRegistry dao,
address authorizedMember,
uint256 amount,
uint256 nonce,
bytes memory signature
) external reentrancyGuard(dao) {
uint256 currentFlag = _flags[address(dao)][nonce / 256];
require(
getFlag(currentFlag, non... | 5,530,243 |
// SPDX-License-Identifier: Apache-2.0
/*
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.org/licenses/LICENSE-2.0
Unless required by a... | Get the canonical hash of an RFQ order. order The RFQ order. return orderHash The order hash. | function getRfqOrderHash(LibNativeOrder.RfqOrder memory order)
public
view
returns (bytes32 orderHash)
{
return _getEIP712Hash(
LibNativeOrder.getRfqOrderStructHash(order)
);
}
| 12,952,259 |
pragma solidity ^0.5.13;
pragma experimental ABIEncoderV2;
import './Outcome.sol';
import '@openzeppelin/contracts/math/SafeMath.sol';
import './interfaces/IAssetHolder.sol';
/**
* @dev An implementation of the IAssetHolder interface. The AssetHolder contract escrows ETH or tokens against state channels. It allows a... | Transfers the funds escrowed against `channelId` to the beneficiaries of that channel. No checks performed. Transfers the funds escrowed against `channelId` and transfers them to the beneficiaries of that channel. No checks performed. channelId Unique identifier for a state channel. allocationBytes The abi.encode of... | function _transferAll(bytes32 channelId, bytes memory allocationBytes) internal {
Outcome.AllocationItem[] memory allocation = abi.decode(
allocationBytes,
(Outcome.AllocationItem[])
);
uint256 balance = holdings[channelId];
uint256 numPayouts = 0;
ui... | 12,873,551 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.7.0;
import "./lib/ReEncryptionValidator.sol";
import "./lib/SignatureVerifier.sol";
import "./StakingEscrow.sol";
import "./proxy/Upgradeable.sol";
import "../zeppelin/math/SafeMath.sol";
import "../zeppelin/math/Math.sol";
/**
* @title Adjudicator
*... | Revoke policy or arrangement using owner's signature _policyId Policy id _node Node that will be excluded, zero address if whole policy will be revoked _signature Signature of owner, EIP191 version 0x45 ('E')/ | function revoke(bytes16 _policyId, address _node, bytes calldata _signature)
external returns (uint256 refundValue)
{
checkOwnerSignature(_policyId, _node, _signature);
return refundInternal(_policyId, _node, true);
}
| 1,393,397 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "contracts/drop/DropERC721.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
// Test imports
import "../utils/BaseTest.sol";
contract SubExploitContract is ERC721Holder, ERC1155Holder {
DropERC721 internal drop;
address payable int... | Lets an account claim NFTs. | function claimDrop(
address _receiver,
uint256 _quantity,
address _currency,
uint256 _pricePerToken,
bytes32[] calldata _proofs,
uint256 _proofMaxQuantityPerTransaction
) external {
drop.claim(_receiver, _quantity, _currency, _pricePerToken, _proofs, _proo... | 7,273,135 |
/**
*Submitted for verification at Etherscan.io on 2021-07-13
*/
/**
*Submitted for verification at Etherscan.io on 2020-03-13
*/
pragma solidity 0.4.24;
// File: contracts/generic/Restricted.sol
/*
Generic contract to authorise calls to certain functions only from a given address.
The address authorised ... | implement it in derived contract / | function getAllSignersCount() external view returns (uint allSignersCount) {
return allSigners.length;
}
| 10,695,798 |
./full_match/8453/0xb65b019982aca61AC84144cc577d52B7E2155BAb/sources/contracts/base/PotPool.sol | overflow fix according to https:sips.synthetix.io/sips/sip-77 | function notifyTargetRewardAmount(address _rewardToken, uint256 reward)
public override
onlyRewardDistribution
updateRewards(address(0))
{
require(reward < uint(-1) / 1e18, "the notified reward cannot invoke multiplication overflow");
uint256 i = getRewardTokenIndex(_rew... | 11,538,853 |
./full_match/5/0x82B6a4f93D84C95fE106f3e81DA557Ec9b1A7951/sources/project_/contracts/libraries/FOHLE_Library.sol | fetches and sorts the reserves for a pair | function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {
(address token0,) = sortTokens(tokenA, tokenB);
(uint reserve0, uint reserve1,) = IFOHLE_Pair(pairFor(factory, tokenA, tokenB)).getReserves();
(reserveA, reserveB) = t... | 1,909,442 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.11;
import "./spool/SpoolExternal.sol";
/**
* @notice Implementation of the central Spool contract.
*
* @dev
* The Spool implementation is the central part of the system.
* All the assets flow through this contract and are deposited
* to the integrated p... | Get strategy pending struct, depending on if the strategy do hard work has already been executed in the current index strategy Strategy data (see Strategy struct) interactingIndex Global index for which to get the struct return pending Storage struct containing all unprocessed deposits and withdrawals for the `intera... | function _getStrategyPending(Strategy storage strategy, uint256 interactingIndex) private view returns (Pending storage pending) {
if (_isNextStrategyIndex(strategy, interactingIndex)) {
pending = strategy.pendingUser;
pending = strategy.pendingUserNext;
}
}
| 11,832,737 |
./partial_match/1/0x134f00a389d7B429b4ec14712599b853b694f782/sources/coreDAI.sol | We check if numbers are supplied 1:1 And get the total number of them. 0 % tokens cannnot be permitted we check the decimals of current token decimals is not part of erc20 standard, and is safer to provide in the caller tokenDecimals[loop] = IERC20(_addresses[loop]).decimals();_numTokensWrapped++; we might just assign... | function __ERC95_init(string memory name, string memory symbol, address[] memory _addresses, uint8[] memory _percent, uint8[] memory tokenDecimals) public initializer {
ContextUpgradeSafe.__Context_init_unchained();
require(_addresses.length == _percent.length, "ERC95 : Mismatch num toke... | 3,691,116 |
// SPDX-License-Identifier: Apache-2.0
/*
* Copyright 2021, Offchain Labs, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*... | Increase the withdrawable funds for the given address owner Address of the account to add withdrawable funds to/ | function increaseWithdrawableFunds(address owner, uint256 amount) internal {
uint256 initialWithdrawable = _withdrawableFunds[owner];
uint256 finalWithdrawable = initialWithdrawable.add(amount);
_withdrawableFunds[owner] = finalWithdrawable;
emit UserWithdrawableFundsUpdated(owner, i... | 577,879 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.11;
pragma experimental ABIEncoderV2;
import "deps/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "deps/@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "deps/@openzeppelin/contracts-upgradeable/math/MathUpgr... | Balance of want currently held in strategy positions | function balanceOfPool() public view override returns (uint256) {
if (withdrawalSafetyCheck) {
}
CVXToWant(LOCKER.lockedBalanceOf(address(this))).add(
CVXToWant(IERC20Upgradeable(CVX).balanceOf(address(this)))
);
return (valueInLocker);
}
| 1,604,832 |
./full_match/80001/0x62895d00d81Ecbd775afD46385f59c6f0e132e94/sources/contracts/rental/AssetPool1155.sol | get the token count check the asset param deposit the assets update the user balance and totalLiquidity update UserAssetInfo add a new UserAssetInfo update the existing UserAssetInfo | function deposit(
address _asset,
uint256[] calldata _tokenIds,
uint256[] calldata _amounts
) external onlyActivatedPool onlyActivatedAsset(_asset) nonReentrant whenNotPaused {
uint256 tokenCount = _tokenIds.length;
if (!IERC165(_asset).supportsInterface(INTERFACE_ID_ERC... | 9,434,488 |
pragma solidity ^0.4.11;
/// @dev `Owned` is a base level contract that assigns an `owner` that can be
/// later changed
contract Owned {
/// @dev `owner` is the only address that can call a function with this
/// modifier
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
... | Internal function to determine if an address is a contract _addr The address being queried return True if `_addr` is a contract | function isContract(address _addr) constant internal returns (bool) {
if (_addr == 0) return false;
uint256 size;
assembly {
size := extcodesize(_addr)
}
return (size > 0);
}
| 1,088,487 |
./full_match/1/0xC0425F0c7f84956d21Ad767abd1892344783BE29/sources/contracts/Interfaces/IWHSwapRouter.sol | LIBRARY FUNCTIONS | interface IWHSwapRouter {
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactTokensForTokensAndWrap(
uint amountIn,
uint... | 9,642,126 |
./full_match/11155111/0xec4aa3326ECf0248E07a1Fc47F39e78e4EAfd39f/sources/contracts/AssetE.sol | change to internal when done testing | function convertUSDtoWEI(uint256 amountUSD) public view returns (uint256, uint256, uint256) {
(, int priceInt, , , ) = priceFeedUSD.latestRoundData();
require(priceInt > 0, "Asset: Failed to get the ETH price");
uint256 price = uint256(priceInt) / 1e8;
... | 3,787,015 |
./full_match/5/0x7E739Af6cb9BD1c618f51278A32F40b5c2e69bE6/sources/contracts/bond/BondGranter.sol | Assigns a bond with its parameters tokenId uint256 maturity uint256 seconds principal uint256 in wei imageCID string Requirements: - Principal amount can not be 0 - Maturity must be greater than the first element of the set of interests/ | function _issueBond(uint256 tokenId, uint256 maturity, uint256 principal, string memory imageCID) internal virtual {
require(principal > 0, "BondGranter::Principal is 0");
require(maturity >= maturities[0], "BondGranter::Maturity must be greater than the first interest");
uint256 interest = ... | 7,072,153 |
./full_match/1/0x000000000055217587F821917562867172942189/sources/src/AutoSniper.sol | fulfillNonCompliantMarketplaceOrder is a variant on fulfillOrder, used for markets that don't allow purchases through contracts. The fulfiller EOA will fulfill the order, and then use this function to get it to the sniper. wethSubsidy the amount of WETH that needs to be converted. claims an array of claims that the s... | function fulfillNonCompliantMarketplaceOrder(SniperOrder calldata order, Claim[] calldata claims, uint256 wethSubsidy) external onlyFulfiller {
_checkGuardrails(order.tokenAddress, order.marketplace, order.autosniperTip, order.to);
uint256 totalValue = order.value + order.autosniperTip + order.valid... | 16,488,579 |
./full_match/80001/0xB9593478BeC11EBEc52657C0489F0fED2E1aa61F/sources/contracts/Store2.sol | require(amountPaid >= order.total, "Insufficient payment amount");require(_total >= order.total, "Insufficient payment amount"); Verificar que el monto pagado sea suficiente para cubrir el total de la orden Realizar acciones adicionales relacionadas con el pago, como registrar el pago en un sistema externo o transferi... | function payOrder(uint256 _orderIdx) external payable {
Order storage order = orders[_orderIdx];
uint256 amountPaid = msg.value;
require(orders[orderId].isActive == true, "Invalid order");
require(orders[orderId].paid == false, "Order already paid");
(bool sent, ) = payab... | 9,482,577 |
./full_match/1/0x34AcFF419B262f3400D6AA17BD5b99a8c81E9726/sources/contracts/router/modules/exchanges/SwapModule.sol | Assumes all swaps have the same token in Execute the swap | function ethToExactOutput(
Swap[] calldata swaps,
address refundTo,
bool revertIfIncomplete
) external payable nonReentrant refundETHLeftover(refundTo) {
uint256 swapsLength = swaps.length;
for (uint256 i; i < swapsLength; ) {
Swap calldata swap = swaps[i];
uint256 length = swap.t... | 8,354,296 |
./full_match/5/0x7F0f99Aa51B88B3784D71712CBbf069dDE7abC46/sources/Staking.sol | A method to the aggregated stakes from all stakeholders. return uint256 The aggregated stakes from all stakeholders./ | function totalStakes() public view returns (uint256) {
uint256 _totalStakes = 0;
for (uint256 s = 0; s < stakeholders.length; s += 1) {
_totalStakes = _totalStakes.add(stakes[stakeholders[s]]);
}
return _totalStakes;
}
| 1,856,635 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface ILayerZeroUserApplicationConfig {
// @notice set the configuration of the LayerZero messaging library of the specified version
// @param _version - messaging library version
// @param _chainId - the chainId for the pending config change
... | decode mint the tokens back into existence on destination chain | function _LzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) override internal {
(address toAddr, uint tokenId) = abi.decode(_payload, (address, uint));
_safeMint(toAddr, tokenId);
}
| 1,100,195 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "./libraries/PoolDepositable.sol";
import "./libraries/Tierable.sol";
import "./libraries/Suspendable.sol";
import "./libraries/PoolVestingDepositable.sol";
/** @title Loc... | Deposit tokens to pool at `poolIndex`/ | function _savePoolDeposit(
address from,
address to,
uint256 amount,
uint256 poolIndex
) private {
require(
poolIndex < vestingPoolsLength(),
"PoolVestingDepositable: Invalid poolIndex"
);
UserVestingPoolDeposit storage poolDeposit ... | 11,945,863 |
pragma solidity ^0.5.0;
import "@nomiclabs/buidler/console.sol";
//import "openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/ownership/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./aave/interfaces/ILendi... | Set investment threshold return investmentThresholdSet | function setInvestmentThreshold(uint256 investmentThreshold)
public
returns (uint256 investmentThresholdSet)
{
accounts[msg.sender].investmentThreshold = investmentThreshold;
return accounts[msg.sender].investmentThreshold;
}
| 12,940,792 |
./full_match/44787/0x91Fe60b5A375feF35F076F16565f6B24229EB0dD/sources/contracts/bond/BondGranter.sol | Returns the actual value of the bond with its interest principal uint256 interest uint256 timeElapsed uint256/ | function _bondValue(uint256 principal, uint256 interest, uint256 timeElapsed) internal view virtual returns (uint256) {
return principal + Math.mulDiv(principal, interest * timeElapsed, 100 ether);
}
uint256[49] private __gap;
| 13,253,460 |
./full_match/1284/0xC3a6F635a4696Cbf8436f9e917F16D4e4D9673Fe/sources/project_/contracts/Oracle.sol | / check most frequent cases first: all reports are the same or no reports yet | function _getQuorumReport(
uint256 _quorum
) internal view returns (bool, uint256) {
uint256 _length = currentReportVariants.length;
if (_length == 1) {
return (currentReportVariants[0].getCount() >= _quorum, 0);
return (false, type(uint256).max);
}
... | 16,368,204 |
./full_match/4/0xdDD707391fD0ea2c5FebAE66e15D045BcCC122Ec/sources/contracts/test.sol | when you call a function you can send ETH along with the function call, msg.value is the amount of eth you sent If the function doesn't revert, msg.value is successfully added to the contract's balance | function mint(uint amount) external payable {
require(canMint, "Minting is disabled!");
require(totalSupply < MAX_SUPPLY, "NFT sold out!");
require(msg.value == (MINT_PRICE * amount), "Invalid ETH amount provided");
tokens[totalSupply++] = msg.sender;
}
| 12,438,008 |
./partial_match/1/0xcE57701b4045C0B992f9B80Ad150e12e5423695C/sources/contracts/avalanche/Avalanche.sol | stake for another user, used to migrate to this pool | function depositFor(address _from, address _user, uint256 _amount)
external
override
OnlySlopes
{
_deposit(_from, _user, _amount);
}
| 2,838,667 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "../../common/implementation/FixedPoint.sol";
// Simple contract used to withdraw liquidations using a DSProxy from legacy contracts (1.2.2 and below).
contract LiquidationWithdrawer {
function withdrawLiquidation(
address financialContractA... | compute the round end time as a function of the round Id. data input data object. roundId uniquely identifies the current round. return timestamp unix time of when the current round will end./ | function computeRoundEndTime(Data storage data, uint256 roundId) internal view returns (uint256) {
uint256 roundLength = data.phaseLength.mul(uint256(VotingAncillaryInterface.Phase.NUM_PHASES_PLACEHOLDER));
return roundLength.mul(roundId.add(1));
}
| 99,124 |
./partial_match/1/0x3E65f43084F767343C4549a9ac424d89e44F4BEb/sources/contracts/RamenDao.sol | allows the owner to change the signer address used for specialmint | function changeSigner(address newSigner) onlyOwner external {
signer = newSigner;
emit ChangedSigner(newSigner);
}
| 3,659,257 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount o... | Calculates APR from Compound's Liquidity Mining Program amountToAdd Amount to add to the `totalSupplyInWant` (for the `aprAfterDeposit` function) `supplySpeed` is in `COMP` unit -> the following operation is going to put it in `want` unit Added for testing purposes and to handle the edge case where there is nothing le... | function _incentivesRate(uint256 amountToAdd) internal view returns (uint256) {
uint256 supplySpeed = comptroller.compSupplySpeeds(address(cToken));
uint256 totalSupplyInWant = (cToken.totalSupply() * cToken.exchangeRateStored()) / 1e18 + amountToAdd;
supplySpeed = _comptoWant(supplySpeed);
... | 1,475,924 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error,... | Bootstrap mode - Disable RP Access (only RP can call this to hand over full control to the DAO) | function bootstrapDisable(bool _confirmDisableBootstrapMode) override external onlyGuardian onlyBootstrapMode onlyLatestContract("rocketDAONodeTrusted", address(this)) {
require(_confirmDisableBootstrapMode == true, "You must confirm disabling bootstrap mode, it can only be done once!");
setBool(kec... | 594,234 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Math operations with safety checks that throw on error. This contract is based
* on the source code at https://goo.gl/iyQsmU.
*/
library SafeMath {
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minue... | dev Transfers _value amount of tokens to address _to, and MUST fire the Transfer event. The function SHOULD throw if the _from account balance does not have enough tokens to spend. param _to The address of the recipient. param _value The amount of token to be transferred./ | function transfer(
address _to,
uint256 _value
)
public
override
returns (bool _success)
{
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
... | 14,867,718 |
pragma solidity ^0.5.10;
import './interfaces/SyscoinClaimManagerI.sol';
import './interfaces/SyscoinSuperblocksI.sol';
import './SyscoinErrorCodes.sol';
import './SyscoinParser/SyscoinMessageLibrary.sol';
// @dev - Manages a battle session between superblock submitter and challenger
contract SyscoinBattleManager is ... | - To be called when a challenger is convicted | function convictChallenger(bytes32 sessionId, address challenger, bytes32 superblockHash, bool timedOut) internal {
BattleSession storage session = sessions[sessionId];
sessionDecided(sessionId, superblockHash, session.submitter, session.challenger, timedOut);
disable(sessionId);
emi... | 14,018,856 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
abstract contract ContextMixin {
function msgSender()
internal
view
returns (address payable sender)
{
if (msg.sender == address(this)) {
bytes memory array = msg.data;
uint256 index = msg.data.leng... | Mints masks for the BSC bridge/ | function mintMaskFromBridge(address _to, uint256 _mintIndex) external {
require(totalSupply() < MAX_MASK_SUPPLY, "Sale over");
require(totalSupply().add(1) <= MAX_MASK_SUPPLY, "Over supply");
require(msg.sender == bridgeContract, "Not bridge");
_safeMint(_to, _mintIndex);
}
| 1,728,645 |
./full_match/84531/0x66060aCe714aF665044c75b54e4e039182757a44/sources/contracts/relayer/IBaseRelayerLibrary.sol | Resolve an amount from a possible chained reference. This is internal, since some wrappers call it independently./ | function _resolveAmount(uint256 amount) internal returns (uint256) {
return _isChainedReference(amount) ? _getChainedReferenceValue(amount) : amount;
}
| 14,308,989 |
pragma solidity ^0.4.2;
// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
// @author Dieter Shirley <dete@axiomzen.co> (https://github.com/dete)
contract ERC721 {
// Required methods
function approve(address _to, uint256 _tokenId) public;
function balanceOf(address _owner) pu... | Integer division of two numbers, truncating the quotient./ assert(b > 0); Solidity automatically throws when dividing by 0 assert(a == b c + a % b); There is no case in which this doesn't hold | function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
| 5,503,555 |
./full_match/97/0xCaE50fAddA69ED53012949Df76fb9B4F8f13049A/sources/contracts/t-rex/registry/TrustedIssuersRegistry.sol | See {ITrustedIssuersRegistry-getTrustedIssuerClaimTopics}./ | function getTrustedIssuerClaimTopics(IClaimIssuer _trustedIssuer) external view override returns (uint256[] memory) {
require(trustedIssuerClaimTopics[address(_trustedIssuer)].length != 0, "trusted Issuer doesn't exist");
return trustedIssuerClaimTopics[address(_trustedIssuer)];
}
| 5,021,631 |
pragma solidity ^0.7.0;
contract EventOrderAntipattern {
function a() public {
// Code to be executed in any state
}
}
| Code to be executed in any state | function a() public {
}
| 1,798,755 |
pragma solidity ^0.4.22;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed p... | tokenIdからRocに関するすべての関連情報を返します。 _tokenId トークンID | function getRoc(uint _tokenId)
external
view
returns (
uint rocId,
string dna,
uint marketsFlg
) {
Roc memory roc = rocs[_tokenId];
rocId = uint(roc.rocId);
dna = string(roc.dna);
marketsFlg = uint(roc.marketsFlg);
}
| 5,500,391 |
/**
*Submitted for verification at Etherscan.io on 2021-02-19
*/
pragma solidity ^0.5.16;
/**
* @title Bird's BController Interface
*/
contract BControllerInterface {
/// @notice Indicator that this is a BController contract (for inspection)
bool public constant isBController = true;
/*** Assets Yo... | The sender liquidates the borrowers collateral. The collateral seized is transferred to the liquidator. borrower The borrower of this bToken to be liquidated repayAmount The amount of the underlying borrowed asset to repay bTokenCollateral The market in which to seize collateral from the borrower return uint 0=succ... | function liquidateBorrow(address borrower, uint repayAmount, BTokenInterface bTokenCollateral) external returns (uint) {
(uint err,) = liquidateBorrowInternal(borrower, repayAmount, bTokenCollateral);
return err;
}
| 286,098 |
./full_match/1/0xd5324D3e0Fe24FaB2f05fd70b342aA209119E568/sources/contracts/ConcurrentPermissionedExecutors.sol | Example: blocksPerSlot = 3, numberOfExecutors = 2 Block number 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | ... --------------------------------------------- slotIndex 0 | 0 | 0 | 1 | 1 | 1 | 2 | 2 | 2 | 3 | ... --------------------------------------------- exec... | function calcExecutorIndex(
uint256 _currentBlock,
uint256 _blocksPerSlot,
uint256 _numberOfExecutors
)
public
pure
virtual
returns (uint256 executorIndex, uint256 remainingBlocksInSlot)
{
uint256 slotIndex = _currentBlock / _blocksPerSlot;
... | 16,475,755 |
pragma solidity 0.4.15;
import '../ownership/MultiownedControlled.sol';
import '../security/ArgumentsChecker.sol';
import 'zeppelin-solidity/contracts/math/SafeMath.sol';
import 'zeppelin-solidity/contracts/ReentrancyGuard.sol';
/// @title registry of funds sent by investors
contract FundsRegistry is ArgumentsChecke... | records an investment register investor register payment | function invested(address _investor)
external
payable
onlyController
requiresState(State.GATHERING)
{
uint256 amount = msg.value;
require(0 != amount);
assert(_investor != m_controller);
if (0 == m_weiBalances[_investor])
m_investors.p... | 5,460,195 |
./partial_match/1/0x1F3BAD0bBf6188CaCCA024d09a1475d6c88fA5B1/sources/GST.sol | Destroy tokens Remove `_value` tokens from the system irreversibly _value the amount of money to burn/ | function burn(uint256 _value) public returns(bool success) {
emit Burn(msg.sender, _value);
return true;
}
| 15,474,878 |
./partial_match/80001/0x7C682dd6E5d569C2e38EA148032098B839B11c9F/sources/contracts/libraries/TickTree.sol | get position of single 1-bit it is assumed that word contains exactly one 1-bit, otherwise the result will be incorrect word The word containing only one 1-bit | function getSingleSignificantBit(uint256 word) internal pure returns (uint8 singleBitPos) {
assembly {
singleBitPos := iszero(and(word, 0x5555555555555555555555555555555555555555555555555555555555555555))
singleBitPos := or(singleBitPos, shl(7, iszero(and(word, 0x00000000000000000000000000000000FFFFFF... | 8,801,370 |
./partial_match/1313161554/0x27Bc45c2A25f57CbE59FeB829BeEe26Bd97726aB/sources/PLYStrategy.sol | Harvests reward from Aurigami protocol. return Harvested rewards.Harvest from comptroller Harvest from auToken | function _harvest() internal override returns (uint256) {
uint256 wantBalanceBefore = want.balanceOf(address(this));
address comp = IAuERC20(auToken).comptroller();
uint256 earnedRewardPLY = IComptrollerAurigami(comp).rewardAccrued(REWARD_TYPE_PLY, address(this));
if (earnedRewardPL... | 16,926,647 |
./full_match/4/0x0dB47DbBcB33F35749691BC6360F2b1f9914575f/sources/browser/Untitled.sol | called by the owner to pause, triggers stopped state/ | function pause() public onlyPauser {
paused = true;
emit Pause();
}
| 686,181 |
./partial_match/42/0x8A321C64792da6E4B4c58fD0473Fb656E2cEB976/sources/MasterChef.sol | change the TMR(teamMintRate) | function changeteamMintrate(uint256 _newTMR) public onlyOwner {
require(_newTMR <= maxteamMintrate, "too high value");
teamMintrate = _newTMR;
}
| 3,469,431 |
./full_match/43113/0x23F98960F5a2Df62fFd3d6402d65DcF578dF738f/sources/AmmFactory.sol | update the logic contract for this proxy contract _newImplementation the address of the new AmmFactory implementation only the admin address may call this function | function updateImplementation(address _newImplementation)
external
onlyOwner
{
require(
_newImplementation != address(0x0),
"Invalid _newImplementation"
);
_updateCodeAddress(_newImplementation);
}
| 13,151,856 |
/*
Copyright 2017 Loopring Project Ltd (Loopring Foundation).
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... | Decrease the amount of tokens that an owner allowed to a spender. approve should be called when allowed[_spender] == 0. To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol _spender The address which will spend the funds. ... | function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
allowed[msg.sender][_s... | 7,271,777 |
pragma solidity 0.4.24;
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address pu... | Method for pausing token sale | function pause() public onlyOwner whenStarted whenNotFinalized whenNotPaused {
super.pause();
}
| 12,915,904 |
./full_match/80001/0xc346Bce9AffD346AdD35B18Af9516Cd2F8107722/sources/contracts/mojito/sothebys/Marketplace.sol | Verifies the Signature with the required Signer _order Order struct consists of the listedtoken details _signature Signature generated when signing the hash(order details) by the signer _signer Address of the Signer isVerified Signature is verified or not | function _verifySignature(
Order memory _order,
bytes memory _signature,
address _signer
) internal view returns (bool isVerified) {
return
keccak256(
abi.encode(
_order.uuid,
_order.tokenId,
... | 5,668,587 |
./full_match/421613/0x1A7AD9355654e4D11Be7b018aEEb22735FdfdBA2/sources/project_/contracts/UnilimitFactory.sol | compute Uni pool address and check that it's already created existsWe assume the settler address exists? or require(msg.sender == settlerAddress) ?create contract | function deployPair(
address tokenA,
address tokenB,
uint24 fee,
address settlerAddress
)
external
override
returns (
UniV3TradingPair newPair
){
address poolAddress = uniswapV3Factory.getPool(tokenA, tokenB, fee);
require(poolAddress != a... | 11,566,715 |
./full_match/1/0xE816ff1f2026Dc26E40Cafa3369080C095FEEc07/sources/src/Crowdfund.sol | Check if sail raise duration is over return true if sail raise still open for contributions/ | function _isRaiseOpen() internal view returns (bool) {
return block.timestamp < endDuration;
}
| 2,997,224 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import "../interfaces/IStakeVaultFactory.sol";
import {StakeVaultProxy} from "../stake/StakeVaultProxy.sol";
import {Stake2VaultProxy} from "../stake/Stake2VaultProxy.sol";
import "../common/AccessibleCommon.sol";
//import "hardhat/console.sol";
/// @title A fa... | Create a vault that hold reward, _cap is allocated reward amount. _phase phase number _addr the array of [token, paytoken, _stakefactory, defiAddr] _intInfo array of [_stakeType, _cap, _saleStartBlock, _stakeStartBlock] owner the owner adderess return a vault address | function create(
uint256 _phase,
address[4] calldata _addr,
uint256[4] calldata _intInfo,
address owner
) external override returns (address) {
require(
vaultLogics[_phase] != address(0),
"StakeVaultFactory: zero vault logic "
);
ad... | 12,130,788 |
./full_match/80001/0xbd36272007F2c1BfDb3C62fC523df0417e5e876F/sources/VeritreeVersion1/veritree-factory.sol | planting_partner_memory[_from] = plantingPartner; | function _stake(address _from, uint256 _tokenId, uint256 _quantity) internal {
require(initialized, "Staking System: the staking has not started");
require(
nft.ownerOf(_tokenId) == _from,
);
plantingPartnerStake storage plantingPartner = planting_partner_memory[_from];
... | 5,695,799 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
interface IERC20 {
function TOTALSUPPLY267() exte... | inject NONSTANDARD NAMING | function FUNCTIONCALLWITHVALUE142(address target, bytes memory data, uint256 value) internal returns (bytes memory) { | 13,085,320 |
/*
* Havven Contract
*
* The collateral token of the Havven stablecoin system.
*
* version: nUSDa.1
* date: 29 Jun 2018
* url: https://github.com/Havven/havven/releases/tag/nUSDa.1
*
* MIT License
* ===========
*
* Copyright (c) 2018 Havven
*
* Permission is hereby granted, free of charge, t... | Set the issuanceRatio for issuance calculations. Only callable by the contract owner./ | function setIssuanceRatio(uint _issuanceRatio)
external
optionalProxy_onlyOwner
{
require(_issuanceRatio <= MAX_ISSUANCE_RATIO);
issuanceRatio = _issuanceRatio;
emitIssuanceRatioUpdated(_issuanceRatio);
}
| 6,482,334 |
./partial_match/1/0x075B36dE1Bd11cb361c5B3B1E80A9ab0e7aa8a60/sources/contracts/base/ApproveAndCall.sol | @inheritdoc IApproveAndCall | function approveMax(address token) external payable override {
TransferHelper.safeApprove(token, positionManager, type(uint256).max);
}
| 2,802,209 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import... | Modifiers Constructor init | function __ShogunStaking_init(
address ss,
uint256 _baseReward,
address admin
) public initializer {
__AccessControl_init();
__ReentrancyGuard_init();
baseReward = _baseReward;
SS = IShogunNFT(ss);
countMultipliers = [10000, 10100, 10300];
... | 1,127,047 |
./full_match/1/0xd5b8Ae7F5dD3C38E508d2cb98bB1890336aD0D7f/sources/contracts/PLAKAccessControl.sol | Make a bunch of token ID's legendary at once | function bulkMakeLegendary(uint256[] memory tids)
onlyOwner public
{
uint tidsLen = tids.length;
require(tidsLen > 1, "PLAKAccessControl: use `makeLegendary` instead");
require(tidsLen < 256, "PLAKAccessControl: cannot add more than 255 at once");
uint8 i;
for (i = 0; i < tidsLen; i++) {
if (!isLegenda... | 9,697,139 |
./partial_match/3/0x640E550F1Ed4b25f7902a79eA211D56b9223d0EE/sources/fMain.sol | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _aid, uint256 _pid) public {
PoolInfo storage pool = poolInfo[_aid][_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.lastRewardB... | 5,084,749 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.