file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/1001/0xCe12C887FAe83A5f94f6cF3C8d4C1ceE8B1C7786/sources/contracts/libraries/DexLibrary.sol | performs chained getAmountOut calculations on any number of pairs | function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) {
uint length = path.length;
require(length >= 2, 'DexLibrary: INVALID_PATH');
amounts = new uint[](length);
amounts[0] = amountIn;
for (uint i = 0; i <... | 16,364,050 |
./full_match/5/0x092ad95243c26E3D5b46497812B5F04F3b8b4294/sources/StakingContract.sol | Calculate rewards for the msg.sender, check if there are any rewards claim, set unclaimedRewards to 0 and transfer the ERC20 Reward token to the user. Calculate the amount of rewards the staker wants to claim Calculate the tax and the amount to be transferred to the staking vault Burn the tax amount Transfer the amount... | function claimRewards(uint256 _percentage) public {
require(
_percentage > 0 && _percentage <= 100,
"Invalid percentage!"
);
require(
stakers[msg.sender].unclaimedRewards > 0,
"You don't have any unclaimed rewards!"
);
uint256 c... | 1,877,729 |
pragma solidity ^0.6.0;
//import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
//import "@openzeppelin/contracts/utils/Pausable.sol";
//import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./interface/cToken.sol";
import "./Pausable.sol";
contract PFA... | Compound Token function to redeem underlying asset return bool/ Retrieve your asset based on an amount of the asset | function redeemCEth(
uint256 amount
) private returns (bool) {
require(c.redeemUnderlying(amount) == 0, "REDEEM_UNSUCCESSFULL");
}
| 921,434 |
./full_match/4/0x3b85837Ed9C20ee81265D3180486405309c3943D/sources/contracts/CryptoPoly.sol | Callback function used by VRF Coordinator/randomResult = randomness;find current position of the gambler set this to 0 so that they can play again now we need to move the player's position now find what kind of property this is. based on it, decide what to do if this is rent, then we need to pay the amount to the perso... | function fulfillRandomness(bytes32 requestId, uint256 randomness) internal override {
address player = requestId_mapping[requestId];
Game storage game = games[player];
uint current_position = current_positions[game.gambler];
uint256[] memory return_values = expand(randomness,3);
... | 691,706 |
./full_match/42220/0x199313b53dBb45AA41CE57347130B0C38C406EcD/sources/contracts/externalInterfaces/aave/IInitializableAToken.sol | IInitializableAToken Interface for the initialize function on AToken Aave/ | interface IInitializableAToken {
event Initialized(
address indexed underlyingAsset,
address indexed pool,
address treasury,
address incentivesController,
uint8 aTokenDecimals,
string aTokenName,
string aTokenSymbol,
bytes params
);
function initialize(
ILendingPool pool,
... | 16,324,065 |
contract BitSTDLogic {
function name()constant public returns(string) {}
function symbol()constant public returns(string) {}
function decimals()constant public returns(uint8) {}
function totalSupply()constant public returns(uint256) {}
function allowance(address add,address _add)constant public return... | Transfer tokens Send `_value` tokens to `_to` from your account _to The address of the recipient _value the amount to send/ | function transfer(address _to, uint256 _value) public {
logic.transfer(msg.sender,_to,_value);
emit Transfer(msg.sender, _to, _value);
}
| 971,336 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.6.12;
interface IStakingMilestones {
function getEpochId(uint timestamp) external view returns (uint); // get epoch id
function getEpochUserBalance(address user, address token, uint128 epoch) external view returns(uint);
function getEpochPoolSize(a... | checks for requested epoch | function harvest (uint128 epochId) external returns (uint){
require (_getEpochId() > epochId, "This epoch is in the future");
require (lastEpochIdHarvested[msg.sender].add(1) == epochId, "Harvest in order");
uint userReward = _harvest(epochId);
if (userReward > 0) {
SafeE... | 1,166,853 |
./full_match/80001/0x9Ce4727789e2e07dddC48d4466F9E6Ea4EB46969/sources/contracts/contract5.sol | Update total staked amount first Then, update the staker's balance Add the staker to the list of stakers if they are not already on it Update proportions for all stakers | function stake() public payable {
houseStake += msg.value;
stakes[msg.sender].balance += int256(msg.value);
if (!stakes[msg.sender].isStaker) {
stakes[msg.sender].isStaker = true;
stakers.push(msg.sender);
}
for (uint256 i = 0; i < stakers.length; i... | 5,567,964 |
/*
____ __ __ __ _
/ __/__ __ ___ / /_ / / ___ / /_ (_)__ __
_\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
/___/
* Synthetix: YAMIncentives.sol
*
* Docs: https://docs.synthetix.io/
*
*
* MIT License
* ===========
*
* Copyright (c) 2020 S... | First check most recent balance Next check implicit zero balance | function getPriorSupply(uint256 blockNumber)
public
view
returns (uint256)
{
if (numSupplyCheckpoints == 0) {
return 0;
}
if (totalSupplyCheckpoints[numSupplyCheckpoints - 1].fromBlock <= blockNumber) {
return totalSupplyCheckpoints[numSup... | 6,500,822 |
/*
website: bns.finance
This project was forked from SUSHI and YUNO projects with a twist of halving.
Unless those projects have severe vulnerabilities, this contract will be fine
BBBBBBBBBBBBBBBBB NNNNNNNN NNNNNNNN SSSSSSSSSSSSSSS DDDDDDDDDDDDD EEEEEEEEEEEEEEEEEEEEEEFFFFFFFFFFFFFFFFF... | reward prediction at specific block | function getRewardPerBlock(uint blockNumber) public view returns (uint256) {
if (blockNumber >= startBlock){
uint256 blockDaysPassed = (blockNumber.sub(startBlock)).div(perDayBlocks);
if(blockDaysPassed <= 0){
return bnsdPerBlock;
}
else if(... | 7,864,881 |
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,... | withdraw funds from sold item | function WithdrawBalance()
external
HasStoreAccount
returns (uint balance, uint withdrawn)
{
(bool exists, StoreAccount memory account) = _getAccount(msg.sender);
require(exists, "Store account does not exists - nothing to withdraw");
balance = account.Balance;
require(balance > 0, "Noth... | 15,781,451 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.7.0;
pragma experimental ABIEncoderV2;
import "@darwinia/contracts-utils/contracts/SafeMath.sol";
import "@darwinia/contracts-verify/contracts/MerkleProof.sol";
import "./interfaces/ILightClientBridge.sol";
import "./interfaces/ICrossChainFilter.sol";
/**
*... | Deliver and dispatch the messages messages All the messages in the source chain block of this channel which need be delivered chainCount Number of all chain chainMessagesProof The merkle proof required for validation of the messages in the `chain_messages_merkle_tree` channelMessagesRoot The merkle root of the chan... | function submit(
Message[] memory messages,
uint256 chainCount,
bytes32[] memory chainMessagesProof,
bytes32 channelMessagesRoot,
uint256 channelCount,
bytes32[] memory channelMessagesProof,
BeefyMMRLeaf memory beefyMMRLeaf,
uint256 beefyMMRLeafIndex,
... | 6,396,898 |
// Sources flattened with hardhat v2.4.1 https://hardhat.org
// File contracts/interfaces/IERC721.sol
pragma solidity 0.5.7;
/// @title ERC-721 Non-Fungible Token Standard
/// @dev See https://eips.ethereum.org/EIPS/eip-721
/// Note: the ERC-165 identifier for this interface is 0x80ac58cd
interface IERC721 {
/... | Allow the Lock owner to change the transfer fee./ | function updateTransferFee(
uint _transferFeeNumerator,
uint _transferFeeDenominator
)
external
onlyOwner
{
require(_transferFeeDenominator != 0, 'INVALID_RATE');
emit TransferFeeChanged(
transferFeeNumerator,
transferFeeDenominator,
_transferFeeNumerator,
_transfer... | 949,574 |
/**
*Submitted for verification at Etherscan.io on 2022-02-18
*/
// Sources flattened with hardhat v2.8.4 https://hardhat.org
// File @rari-capital/solmate/src/tokens/[emailΒ protected]
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.
///... | USDV Contract for Mint / Burn Operations | function usdv() external view returns (address) {
return VADERMINTER.usdv();
}
| 6,790,264 |
./full_match/100/0x097707143e01318734535676cfe2e5cF8b656ae8/sources/browser/HoprWrapperFlat.sol | ERC777 hook triggered when wxHOPR tokens are send to this contract. operator address operator requesting the transfer from address token holder address to address recipient address amount uint256 amount of tokens to transfer userData bytes extra information provided by the token holder (if any) operatorData bytes... | function tokensReceived(
address operator,
address from,
address to,
uint256 amount,
bytes calldata userData,
bytes calldata operatorData
) external override nonReentrant {
require(msg.sender == address(wxHOPR), "Sender must be wxHOPR");
require(to... | 14,285,937 |
./partial_match/97/0x19789b677F4464d8b96ffe2E7112Cf05A6822fD3/sources/AnimalFactory.sol | function to accept a mate offer by offering one of your own animals and paying ethers ofcourse/Adding Saving Animal Record | function mateAnimal(uint parent1Id, uint parent2Id, string animalName,string animalDesc) public payable
{
require (!isMatingPaused);
require (!isContractPaused);
require(msg.sender != 0x0);
if (msg.sender!=owner)
{
require(msg.value>=priceForSaleAdvertisement);
... | 11,491,946 |
./partial_match/42/0x4ffADC639B57e864150ff98a55D249fed53fa63B/sources/ZuniBadge.sol | Getter for the publicSwap field on the underlying pool viewLock, because setPublicSwap is lock bPool is a contract interface; function calls on it are external return Current value of isPublicSwap/ | function isPublicSwap()
external
virtual
view
viewlock
needsBPool
returns (bool)
{
return bPool.isPublicSwap();
}
| 3,449,011 |
// SPDX-License-Identifier: WTFPL
pragma solidity ^0.8.3;
/*
Split under 21 rule:
If either of the player's hand in a split beats dealer, the player wins bet on both hands automatically.
But if the player busts on either deck, the dealer wins bet on both decks. If the player's first hand has a standoff with
dealer, t... | BlackJack or bust If there might be a standoff Show dealer's second card Update dealer card total Choose winner Update balance Update balance: bet 2 If player was insured Show dealer's second card Update dealer card total Update balance | function hitWin(uint256 _cTotal) internal {
if(_cTotal == 21) {
if(_dCard1 >= 10) {
_dCard2 = RNG();
_dCardTotal = _dCard1 + _dCard2;
}
if(_dCardTotal == _cTotal) {
_dMsg = " --> StandOff!";
... | 12,896,124 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.4;
import "./PegStabilityModule.sol";
/// @notice ETH PSM that allows separate pausing of mint and redeem
/// by the guardian and governor
contract MintRedeemPausePSM is PegStabilityModule {
/// @notice boolean switch that indicates whether redemp... | function to buy FEI for an underlying asset We first transfer any contract-owned fei, then mint the remaining if necessary | function mint(
address to,
uint256 amountIn,
uint256 minAmountOut
) external virtual override nonReentrant whenNotPaused returns (uint256 amountFeiOut) {
amountFeiOut = _mint(to, amountIn, minAmountOut);
}
| 292,309 |
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "openzeppelin-eth/contracts/math/SafeMath.sol";
import "openzeppelin-eth/contracts/token/ERC20/ERC20.sol";
import { PropsRewardsLib } from "./PropsRewardsLib.sol";
/**
* @title Props Rewards
* @dev Contract allows to set approved apps and... | Allows the controller/owner to update rewards parameters _name ParameterName name of the parameter _value uint256 new value for the parameter _rewardsDay uint256 starting when should this parameter use the current value/ | function updateParameter(
PropsRewardsLib.ParameterName _name,
uint256 _value,
uint256 _rewardsDay
)
public
onlyController
{
PropsRewardsLib.updateParameter(rewardsLibData, _name, _value, _rewardsDay);
emit ParameterUpdated(
_name,
... | 6,412,778 |
./full_match/421613/0x3230d297dB852fdaab48CB4e2Add5B9757997cf2/sources/project:/contracts/boxes/Boxes.sol | Return a single uint256 in an array Instantiate an array, assign the value to the first element of the array & then return the array | function singletonUint256(uint256 _value)
internal
pure
returns (uint256[] memory)
{
uint256[] memory number = new uint256[](1);
number[0] = _value;
return number;
}
| 11,566,541 |
./full_match/3/0xc7D3ab2e81ba5bA12177A4E27d1d02A81c2ba8c9/sources/browser/Treasury.sol | "0x2AF142784eD8f0ED17101bb091D58519560825e3","0xbc47151388E2248C073aaCa2F26a3D33FddA734e","0x9Be2Bb1f46c3fE215F7359DCCa45F2dd2EA11a65","0xa2AAe53531752161D30E314ad7D25FBaaC3E6e27" | function mintOrBurnOly(address _token, uint256 _totalSupply) public {
uint TWAPWithZeros = lastTWAP.mul(1e18);
updateTWAP();
if (TWAPWithZeros > getIV(_token)) {
uint256 indicator = 0;
oly.updateTokenToSellForTheNext8Hrs(
amountToSellForTheNext8Hrs,
... | 14,181,387 |
pragma solidity ^0.6.6;
import "./SafeMath.sol";
import "./Roles.sol";
import "./Address.sol";
import "./BAC001Holder.sol";
contract IssuerRole {
using Roles for Roles.Role;
event IssuerAdded(address indexed account);
event IssuerRemoved(address indexed account);
Roles.Role private _issuers;
co... | Send assets from one address to another./add | function sendFrom(address from, address to, uint256 value, bytes memory data) public whenNotSuspended {
_send(from, to, value, data);
_approve(from, msg.sender, _allowed[from][msg.sender].sub(value));
require(_checkOnBAC001Received(from, to, value, data), "BAC001: send to non BAC001Receiver ... | 937,837 |
./full_match/42/0x1CbA6Ca5d1d2c0Da81856da12b1d3E52f72350Ab/sources/contracts/new_masterch.sol | require (_pid != 0, 'withdraw CAKE by unstaking'); safeCakeTransfer(msg.sender, pending); | function unstakingWrappedToken(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
uint treward = updatePool(_pid);
uint bal = IDefiERC20(a... | 16,234,066 |
pragma solidity ^0.4.15;
/**
* @title Queue
* @dev Data structure contract used in `Crowdsale.sol`
* Allows buyers to line up on a first-in-first-out basis
* See this example: http://interactivepython.org/courselib/static/pythonds/BasicDS/ImplementingaQueueinPython.html
*/
contract Queue {
/* State variables */... | Places `addr` in the first empty position in the queue / | function enqueue(address addr) {
if (isFull) {
revert();
}
addr2place[addr] = nextFree;
place2addr[nextFree] = addr;
lastFilled = nextFree;
nextFree = (lastFilled+1) % size;
numInside+=1;
if (nextFree >= first) {
isFull = true;
}
if (numInside == 1) {
timeAsFirst = now;
}
} ... | 1,801,941 |
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity 0.8.4;
import "./mixins/OZ/ERC721Upgradeable.sol";
import "./mixins/roles/MomentsAdminRole.sol";
import "./mixins/MarketNode.sol";
import "./mixins/NFT721Metadata.sol";
import "./mixins/NFT721Mint.sol";
import "@openzeppelin/contracts-upgradeable/access/Ac... | onlyAdmin is enforced by `grantRole`./ | function grantAdmin(address account) external {
grantRole(DEFAULT_ADMIN_ROLE, account);
}
| 12,250,129 |
pragma solidity ^0.5.3;
import "./FIFSRegistrarBase.sol";
import "./PricedContract.sol";
/// @title First-in first-served registrar.
/// @notice You can use this contract to register .rsk names in RNS.
/// @dev This contract has permission to register in RSK Owner.
contract FIFSRegistrar is FIFSRegistrarBase, PricedC... | Executes registration abstracted from payment method. name The name to register. nameOwner The owner of the name to regiter. secret The secret used to make the commitment. duration Time to register in years. return price Price of the name to register. | function executeRegistration (string memory name, address nameOwner, bytes32 secret, uint duration) private returns (uint) {
bytes32 label = keccak256(abi.encodePacked(name));
require(name.strlen() >= minLength, "Short names not available");
bytes32 commitment = makeCommitment(label, nameO... | 1,769,291 |
/**
*Submitted for verification at Etherscan.io on 2021-07-18
*/
// Sources flattened with hardhat v2.4.3 https://hardhat.org
// File contracts/solidity/interface/INFTXEligibility.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface INFTXEligibility {
// Read functions.
function name() ex... | Provide liquidity. Stake in LP rewards contract | function _addLiquidityAndLock(
uint256 vaultId,
address vault,
uint256 minTokenIn,
uint256 minWethIn,
uint256 wethIn
) internal returns (uint256, uint256, uint256) {
IERC20Upgradeable(vault).approve(address(sushiRouter), minTokenIn);
(uint256 amountToken, uint256 amountEth, uint256 l... | 7,828,190 |
/**
*Submitted for verification at Etherscan.io on 2022-03-10
*/
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10 >=0.8.10 >=0.8.0 <0.9.0;
pragma experimental ABIEncoderV2;
////// lib/openzeppelin-contracts/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.0 (utils/Context.sol)
/* pragma solidity ^0... | exclude from paying fees or having max transaction amount | constructor() ERC20("Hospital Inu", "HOSPITAL") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pai... | 10,760,939 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
// File: contracts/Ownable.sol
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the ... | toggles the public sale enables/disables public sale functions and disables pre sale functions/ | function togglePublicSale() external onlyOwner {
_onlyWhiteList = false;
_mintingEnabled = !_mintingEnabled;
}
| 14,388,512 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { AppStorageLib } from "../../../storage/app.sol";
import "../names.sol" as NAMES;
import {
RolesMods
} from "../../../contexts2/access-control/roles/RolesMods.sol";
import { ADMIN, AUTHORIZED } from "../../../shared/roles.sol";
import { RolesLib } fro... | It gets the current "RequiredSubmissionsPercentage" setting's value return value_ the current value./ | function getRequiredSubmissionsPercentageValue()
internal
view
returns (uint256 value_)
{
value_ = s(NAMES.REQUIRED_SUBMISSIONS_PERCENTAGE).value;
}
| 898,235 |
pragma solidity >=0.4.25;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
/********************************************************************************************/
/* DATA VARIAB... | Get list of flights and departures Can only be called from FlightSuretyApp contract/ | function getFlightAirline(uint256 flightIndex) external view requireIsOperational returns(address)
{
return flights[flightIndex].airline;
}
| 15,863,169 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "./Initializable.sol";
// Provides information about the current execution context, including the sender of the transaction and its data.
abstract contract Context is Initializable {
// Empty initializer, to prevent people from mistakenly d... | Empty internal initializer. | function __Context_init_unchained() internal initializer {
}
| 12,686,857 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
import "./Identity.sol";
/**
* @title Horizontal Federated Learning Task Contract
* @dev Horizontal Federated Learning Task Contract
*/
contract HFLContract {
IdentityContract public idContract;
address private owner;
enum RoundStatu... | called by client, upload secret sharing seed commitment taskId taskId round the task round sharee the sharee address seed the seed piece/ | function uploadSeed(
bytes32 taskId,
uint64 round,
address sharee,
bytes calldata seed
) public roundExists(taskId, round) {
require(
seed.length > 0 && seed.length <= maxSSComitmentLength,
"commitment length exceeds limit or it is empty"
)... | 988,008 |
./partial_match/1/0x93E85D3A268De9B4539e051388111Fd02F6960bF/sources/TokenTimelock.sol | Transfers tokens held by timelock to beneficiary./ solhint-disable-next-line not-rely-on-time | function release() public {
require(msg.sender == _beneficiary, "only the beneficiary can release the funds");
require(block.timestamp >= _releaseTime, "TokenTimelock: current time is before release time");
uint256 amount = _token.balanceOf(address(this));
require(amount > 0, "Token... | 4,478,520 |
// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually... | Claim Sparkle Loyalty reward/ Validate calling address (msg.sender) Validate caller has a timestamp and it has matured Obtain the current state of the callers timestamp Determine if the callers reward has matured Value not used but throw unused var warning (cleanup) Yes, then obtain a storage instance of callers accoun... | function claimLoyaltyReward()
public
whenNotPaused
nonReentrant
returns(bool)
{
require(ISparkleTimestamp(timestampAddress).hasTimestamp(msg.sender), 'No record');
require(ISparkleTimestamp(timestampAddress).isRewardReady(msg.sender), 'Not mature');
(uint256 timeRemaining, bool isReady, uint256... | 6,070,109 |
pragma solidity ^0.4.18;
//*** Owner ***//
contract owned {
address public owner;
//*** OwnershipTransferred ***//
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function owned() public {
owner = msg.sender;
}
//*** Change Owner ***//
functio... | Is ico closed | function isIco() constant public returns (bool closed) {
bool result=((icoStart+(35*24*60*60)) >= now);
if(enableIco){
return true;
}
else{
return result;
}
}
| 917,301 |
pragma solidity 0.5.10;
contract Context {
constructor () internal { }
function _MSGSENDER793() internal view returns (address payable) { //inject NONSTANDARD NAMING
return msg.sender;
}
function _MSGDATA330() ... | inject NONSTANDARD NAMING | function INTEREST523(bytes32 fund) public view returns (uint256) { | 1,784,273 |
./full_match/1/0x537eE18Ca78C42E1e7fB87FECFE9FC811c3d3575/sources/contracts/strategy/liquity/LiquityStrategy.sol | @inheritdoc IStrategy LQTY rewards of the strategy waiting to be claimed in the liquity stability pool are not included but the ETH rewards are included need to do this because the get_exchange_amount method reverts if ethBalance is zero | function investedAssets()
public
view
virtual
override(IStrategy)
returns (uint256)
{
uint256 ethBalance = address(this).balance +
stabilityPool.getDepositorETHGain(address(this));
if (ethBalance == 0) {
return stabilityPool.getCom... | 16,543,957 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.7.4;
library SafeMathLib {
function times(uint a, uint b) public pure returns (uint) {
uint c = a * b;
require(a == 0 || c / a == b, 'Overflow detected');
return c;
}
function minus(uint a, uint b) public pure returns (uint) {
require(... | most important function for users, allows them to start receiving rewards count the stakers assign id since this may be the first time set last updated block, this happens in updateSlot but that's the other branch check that we meet-or-exceed the linearly-decayed deposit and burn rates increment counter this must go a... | function claimSlot(uint poolId, uint slotId, uint newBurnRate, uint newDeposit) external {
Pool storage pool = pools[poolId];
PoolStats storage stats = poolStats[poolId];
require(slotId > 0, 'Slot id must be positive');
require(slotId <= pool.maxStakers, 'Slot id out of range');
... | 1,693,485 |
./partial_match/4/0x189D4a9487d429c17e366D934481b1e7d662B8C1/sources/InventarContract.sol | only access for contract owner (the airline) - get all inventorized flights | function searchFlights(uint month, uint day) public view isAirline()
returns(string memory) {
return (concatStrings(month, day));
}
| 8,646,887 |
// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually... | Extends the subscription of an existing virtual chain. may be called by anyone, not only the virtual chain owner assumes that the amount has been approved by the msg.sender prior to calling the function vcId is the virtual chain ID amount is the amount paid for the virtual chain subscription extension | function extendSubscription(uint256 vcId, uint256 amount) external {
require(amount > 0, "must include funds");
ISubscriptions subs = ISubscriptions(getSubscriptionsContract());
require(erc20.transferFrom(msg.sender, address(this), amount), "failed to transfer subscription fees from vc paye... | 173,693 |
/*
Copyright 2020 Set Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | Add an address to the whitelist _key Key type address to add to the whitelist _value Value type address to add to the whitelist under _key/ | function addPair(
address _key,
address _value
)
external
timeLockUpgrade
{
require(
whitelist[_key] == address(0),
"AddressToAddressWhiteList.addPair: Address pair already exists."
);
require(
_value != address(0),... | 6,367,170 |
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.11;
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "./LEGENDZ.sol";... | mints genesis heroes for the sender amount the amount of heroes to mint/ | function enrollGenesisHeroes(uint256 amount) external payable whenNotPaused {
uint256 totalSupply = _owners.length;
if (totalSupply >= MAX_GENESIS_TOKENS) revert NotEnoughTokens();
if (amount > MAX_TOKENS_PER_TX) revert TooMuchTokensPerTx();
if (msg.value < MINT_GENESIS_PRICE * amoun... | 1,206,736 |
//Address: 0x3f45d2d5feb6b4b000d2d3b84442eeddf54a735a
//Contract name: LiquidPledging
//Balance: 0 Ether
//Verification Date: 12/20/2017
//Transacion Count: 9
// CODE STARTS HERE
//File: contracts/ILiquidPledgingPlugin.sol
pragma solidity ^0.4.11;
/*
Copyright 2017, Jordi Baylina
Contributors: AdriΓ Massane... | Transfers amounts between pledges for internal accounting idSender Id of the Admin that is transferring the amount from Pledge to Pledge; this admin must have permissions to move the value idPledge Id of the pledge that's moving the value amount Quantity of ETH (in wei) that this pledge is transferring the authori... | function transfer(
uint64 idSender,
uint64 idPledge,
uint amount,
uint64 idReceiver
){
idPledge = normalizePledge(idPledge);
Pledge storage p = findPledge(idPledge);
PledgeAdmin storage receiver = findAdmin(idReceiver);
PledgeAdmin storage sende... | 12,923,184 |
pragma solidity 0.6.6;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high le... | Returns the current round of the ISO./ | function getCurrentRound() external view returns (uint8) {
uint8 round = _calculateCurrentRound();
if (round == 0 && !_hasEnded[0]) {
return 1;
}
if (round == 1 && !_hasEnded[1] && _hasEnded[0]) {
if (block.timestamp <= _startTimeR2) {
return 0;
... | 12,816,407 |
// SPDX-License-Identifier: GPL-3.0-or-later
// This program 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, either version 3 of the License, or
// (at your option) any later version.
// This program is dis... | Returns the scaling factor for one of the Pool's tokens. Reverts if `token` is not a token registered by the Pool./ | function _scalingFactor(bool token0) internal view returns (uint256) {
return token0 ? _scalingFactor0 : _scalingFactor1;
}
| 67,400 |
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.6;
import "@openzeppelin/contracts/access/Ownable.sol";
contract Storage is Ownable {
/// @dev Bytes storage.
mapping(bytes32 => bytes) private _bytes;
/// @dev Bool storage.
mapping(bytes32 => bool) private _bool;
/// @dev Uint storage.
mapp... | key The key for the record/ | function getUint(bytes32 key) external view returns (uint256) {
return _uint[key];
}
| 12,778,975 |
/**
*Submitted for verification at Etherscan.io on 2021-11-29
*/
/**
... | Calculate the taxed token amount | function _transferTaxed(address sender, address recipient, uint256 tAmount) private {
uint256 tTeam = _getTaxedValue(tAmount, sender);
uint256 transferAmount = tAmount - tTeam;
_balances[sender] = _balances[sender].sub(tAmount);
_balances[recipient] = _balances[recipient].add(trans... | 7,613,968 |
./full_match/1/0xFBB1d40a7B3E553c510008c9bef1889015aC4965/sources/contracts/lending/tokens/cErc20ModifiedDelegator.sol | Sender supplies assets into the market and receives cTokens in exchange Accrues interest whether or not the operation succeeds, unless reverted mintAmount The amount of the underlying asset to supply return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ | function mint(uint256 mintAmount) external returns (uint256) {
bytes memory data = delegateToImplementation(
abi.encodeWithSignature("mint(uint256)", mintAmount)
);
return abi.decode(data, (uint256));
}
| 17,168,773 |
pragma solidity >=0.7.0 <0.8.0;
import "../interface/IERC20.sol";
import "../interface/IFactory.sol";
import "../interface/IConfig.sol";
interface Dispute {
function addNewDispute() external returns ();
}
contract PrivateOrder {
string public ipfs_hash;
string service_provider_private;
string servic... | Client Private & Public / | function getClientRequirements() public view returns (string memory, string memory, string memory){
require(msg.sender == client, "Must be client");
return (client_private, client_public, service_provider_public);
}
| 913,865 |
/**
*Submitted for verification at Etherscan.io on 2021-04-01
*/
// File: contracts\modules\SafeMath.sol
pragma solidity =0.5.16;
// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)
library SafeMath {
function add(uint x, uint y) internal pure returns (uint ... | The foundation owner want to set the minimum collateral occupation rate. collateral collateral coin address colRate The thousandths of the minimum collateral occupation rate./ collateralRate = colRate; | function setCollateralRate(address collateral,uint256 colRate) public onlyOwner {
addWhiteList(collateral);
collateralRate[collateral] = colRate;
}
| 2,419,722 |
// SPDX-License-Identifier: GPLv2
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../DigitalaxAccessControls.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./interfaces/IDigitalaxRewards.sol";
import "../EIP2771/BaseRelayRecipient.sol";
import "@openzeppe... | Stake All MONA Tokens in your wallet and earn rewards./ | function stakeAll(uint256 _poolId)
external
{
uint256 balance = IERC20(monaToken).balanceOf(_msgSender());
_stake(_poolId, _msgSender(), balance);
}
| 12,801,898 |
pragma solidity >=0.4.22 <0.7.0;
import "./Group.sol";
contract TimeMachineChat is ITimeMachineChat{
//The indexed keyword will allow you to search these events using the indexed parameter as a filter
event Thanks(address indexed from, uint amount);
//New user signup
event Registered(bytes32 username);
/... | This function "delete" the contract.After calling closeContract, functions will no longer be callable.Since onlyOwner is present, only the owner of the contract can invoke this function.selfdestruct(owner) means: closing the contract, all funds received from the "TimeMachineChat" contract will be sent to owner. | function closeContract() external override onlyOwner{
selfdestruct(owner);
}
| 7,316,749 |
// File: contracts/SafeMath.sol
pragma solidity 0.5.17;
// Note: This file has been modified to include the sqrt function for quadratic voting
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint2... | only default token withdrawals allowed | function withdraw(uint256 amount, address withdrawAddress) external {
require(msg.sender == gov, "caller not gov");
require(balanceOf(defaultToken) >= amount, "insufficient funds");
defaultToken.safeTransfer(withdrawAddress, amount);
}
| 6,544,616 |
./full_match/9001/0x985711e9540d40ea02532E710301874384e1b5D8/sources/contracts/XStarToken.sol | returns quantity of "userAddress" pending redeems/ | function getUserRedeemsLength(address userAddress) external view returns (uint256) {
return userRedeems[userAddress].length;
}
| 11,535,003 |
./full_match/1/0x0000000304aAD016bA7a745da3cE64f6198B76B3/sources/src/Platform.sol | Close Bribe if there is remaining. bribeId ID of the bribe to close. Check if the currentPeriod is the last one. If not, we can increase the duration. | function closeBribe(uint256 bribeId) external nonReentrant onlyManager(bribeId) {
Bribe storage bribe = bribes[bribeId];
if (getCurrentPeriod() >= bribe.endTimestamp || isKilled) {
uint256 leftOver;
Upgrade memory upgradedBribe = upgradeBribeQueue[bribeId];
if (u... | 3,200,443 |
./full_match/1313161554/0xb01d35D469703c6dc5B369A1fDfD7D6009cA397F/sources/contracts/StakedAuroraVault.sol | Same as ERC-4626, but adding evaluation of min deposit amount. | function deposit(
uint256 _assets,
address _receiver
) public override onlyFullyOperational checkWhitelist returns (uint256) {
require(_assets >= minDepositAmount, "LESS_THAN_MIN_DEPOSIT_AMOUNT");
uint256 shares = previewDeposit(_assets);
_deposit(msg.sender, _receiver, ... | 13,234,374 |
./full_match/80001/0x8E1CD089582BA19edb2567E3B953080c2B472234/sources/project_/contracts/ERC1155Auction.sol | An NFT is up for sale if the buyNowPrice is set, but the minPrice is not set. Therefore the only way to conclude the NFT sale is to meet the buyNowPrice./ | function _isASale(
address _nftContractAddress,
uint256 _tokenId
) internal view returns (bool) {
return (auctions[_nftContractAddress][_tokenId].buyNowPrice > 0 &&
auctions[_nftContractAddress][_tokenId].minPrice == 0);
}
| 5,552,861 |
./partial_match/56/0x5fc73e30A9bE09C0d3873538a47689eB3b9FAA2E/sources/TokyoToken.sol | Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as... | function getPriorVotes(address account, uint blockNumber)
external
view
returns (uint256)
{
require(blockNumber < block.number, "TOKYO::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return... | 11,196,749 |
/* For HealthChainHack, Sep 2018
* Author: Xinghua Liang
* Copyright: BlockTEST LLC
*/
pragma solidity ^0.4.24;
import "./Owned.sol";
import "./SafeMath.sol";
contract LoyaltyToken is Owned {
using SafeMath for uint256;
/* Public variables of the token */
string public name;
string public symbo... | Allow another contract to spend some tokens in your behalf / | function approve(address _spender, uint256 _value)
public validToken returns (bool success) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| 5,354,300 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.6.12;
// File: RuneProtocolERC20.sol
pragma solidity =0.6.12;
// File: libraries/SafeMath.sol
pragma solidity =0.6.12;
// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)
library SafeMathRuneProtocol {
... | this low-level function should be called from a contract which performs important safety checks | function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock {
require(amount0Out > 0 || amount1Out > 0, 'RuneProtocol: INSUFFICIENT_OUTPUT_AMOUNT');
require(amount0Out < _reserve0 && amount1Out < _reserve1, 'RuneProtocol: INSUFFICIENT_LIQUIDITY');
uint bal... | 1,400,069 |
./full_match/1/0x894F99E775E350a6A5Ac0714D98C18F1826D9F83/sources/contracts/v2/openzeppelin/ERC1155.sol | function distribShares(address tokenOwner, uint256 tokenId, uint256 amount) internal {if(tokenCost[tokenId] > 0){if(nft[tokenId].outsideSell == false){uint256 tokenCost = 0;if(tokenOwner == creator){ tokenCost = nft[tokenId].cost;} else { tokenCost = _tokenData[tokenId][tokenOwner].cost;}if(tokenCost > 0){uint25... | function distribShares(address tokenOwner, uint256 tokenId) internal {
address creator = nft[tokenId].creator;
uint256[] memory _shares = calcShares(creator, tokenOwner, tokenId);
if(_shares[0] > 0){
require(payable(creator).send(_shares[0]),... | 17,105,172 |
pragma solidity ^0.4.18;
contract Ownable {
address public owner;
function Ownable() public{
owner = msg.sender;
}
modifier onlyOwner() {
if (msg.sender != owner) {
revert();
}
_;
}
function transferOwnership(address newOwner) onlyOwner public{
if (newOwner != address(0)) {
... | Return ZTKCheck information by supplying beneficiary adddress | function getZTKCheck(address _address) public view returns(string, string, string, string, uint256, string, string) {
return (ZTKChecks[_address].accountNumber,
ZTKChecks[_address].routingNumber,
ZTKChecks[_address].institution,
ZTKChecks[_address].fullNa... | 12,005,146 |
./full_match/4/0x29483D97104D7a389d2b6Ae1eFF30174F2ced690/sources/ZOKToken.sol | @inheritdoc IToken First check most recent balance Next check implicit zero balance | function getPriorVotes(address account, uint blockNumber)
external
view
override
returns (uint256)
{
require(blockNumber < block.number, "ME::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
... | 12,276,977 |
./full_match/11155111/0x99C543260fE60dB6615F6D1b87D5858464813b3c/sources/contracts/SubProfile/WhitelistRegistry.sol | This method relies on extcodesize, which returns 0 for contracts in construction, since the code is only stored at the end of the constructor execution. | function isContract(address account) public view returns (bool) {
uint size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
| 3,796,249 |
//Address: 0x9e0da7575f66f13714b75e106fc9b1cfe9662635
//Contract name: DadaPresaleFundCollector
//Balance: 0 Ether
//Verification Date: 10/31/2017
//Transacion Count: 49
// CODE STARTS HERE
pragma solidity ^0.4.15;
library SafeMathLib {
function times(uint a, uint b) internal returns (uint) {
uint c = a * b;... | Participate in the presale./ execution shoulf be turned ON the cap shouldn't be reached yet the final balance of the contract should not be greater than the etherCap Cannot invest anymore through crowdsale when moving has begun the investor is whitlisted the total balance of the user shouldn't be greater than the maxim... | function invest() public payable {
require(isExecutionAllowed);
require(!isCapReached);
uint currentBalance = this.balance;
require(currentBalance <= etherCap);
require(!moving);
address investor = msg.sender;
require(whitelist[investor]);
require((balances[investor].plus(msg.val... | 7,282,029 |
// SPDX-License-Identifier: BUSL-1.1
// For further clarification please see https://license.premia.legal
pragma solidity ^0.8.0;
import {OwnableStorage} from "@solidstate/contracts/access/OwnableStorage.sol";
import {ERC165Storage} from "@solidstate/contracts/introspection/ERC165Storage.sol";
import {Proxy} from "@... | query whether contract has registered support for given interface interfaceId interface id return bool whether interface is supported/ SPDX-License-Identifier: LGPL-3.0-or-later | interface IProxyManager {
function getPoolList() external view returns (address[] memory);
}
| 6,396,588 |
./full_match/1/0x28daD95Eb409027e40bf8D5b0f78613cb23923AC/sources/contracts/MichaelMyersCoin.sol | Changes bot flag. Only callable by owner. Can only add bots to list if disableBlockListAdd() not called and theBot is not a liquidity pair (prevents honeypot behaviour) theBot The address to change bot of. toSet The value to set. | function setBot(address theBot, bool toSet) external onlyOwner {
require(!mappedAddresses[theBot].isLPPair, "MM: Cannot manipulate blocklist status of a liquidity pair.");
if(toSet) {
require(!disableAddToBlocklist, "MM: Blocklist additions have been disabled.");
}
mapped... | 4,882,897 |
/**
*Submitted for verification at BscScan.com on 2021-09-27
*/
/**
*Submitted for verification at BscScan.com on 2021-09-25
*/
/**
*Submitted for verification at BscScan.com on 2021-09-12
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.5.17;
// Part: Babylonian
// computes square roots using the babylo... | Get the average price of 1 grv in the smallest BNB unit (18 decimals) | function getgrvBnbRate() public view returns (uint256, uint256, uint32, uint256) {
(uint price0Cumulative, uint price1Cumulative, uint32 _blockTimestamp) =
UniswapV2OracleLibrary.currentCumulativePrices(address(_grv_bnb));
require(_blockTimestamp != grvBnbBlockTimestampLast, "GRV Last a... | 15,854,862 |
pragma solidity ^0.6.4;
pragma experimental ABIEncoderV2;
import './public_coin.sol';
import './primefield.sol';
import './merkle.sol';
import './proof_types.sol';
import './utils.sol';
import './trace.sol';
import '@nomiclabs/buidler/console.sol';
contract Fri is Trace, MerkleVerifier {
using PublicCoin for Pu... | Returns the fri folded point and the inverse for the base layer, which is x_inv on the next layer Note: We are using inlined field operations for performance reasons. OPT: Could inline `fold`. OPT: Could use assembly to avoid bounds check on array. (if it's not optimized away) | function fold_coset(
uint256[] memory coset,
uint256 x_inv,
uint256 eval_point
) internal returns (uint256 result, uint256 next_x_inv) {
trace('fold_coset', true);
uint256 factor = mulmod(eval_point, x_inv, PrimeField.MODULUS);
if (coset.length == 8) {
... | 12,927,791 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
pragma abicoder v2;
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";... | Returns the amount of accrued holder tokens for the current user return pendingHolderTokens amount of accrued / claimable holder tokens return tranches amount of claimable trances (max 3)/ return 0 if tranches are not set or first tranche is still in the future fetch users data if user has no rewards assigned, return 0... | function getPendingHolderTokens()
public
view
returns (uint256 pendingHolderTokens, uint8 tranches)
{
if (_tranches[0] == 0 || _tranches[0] >= block.number) return (0, 0);
UserData storage user = _userData[_msgSender()];
if (_userData[_msgSender()].totalRewards =... | 355,099 |
./partial_match/1/0xF36399Bf8CB0f47e6e79B1F615385e3A94C8473a/sources/contracts/modules/credit/SpigotedLine.sol | see ISpigotedLine.releaseSpigot | function releaseSpigot(address to) external returns (bool) {
return SpigotedLineLib.releaseSpigot(address(spigot), _updateStatus(_healthcheck()), borrower, arbiter, to);
}
| 4,128,828 |
pragma solidity ^0.5.0;
library SafeMath {
function sub(uint a, uint b) internal pure returns (uint) {
require(b <= a);
return a - b;
}
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
require(c >= a);
return c;
}
/*function mul(uint a, uint b) inter... | Return ask orders optionally filtered by user _who Optional address of the user return An array of uint representing the (filtered) orders, 4 uints per order (id,price,amount,user)/ | function ordersSell(address _who) external view returns (uint[256] memory) {
uint[256] memory ret;
uint num=firstask;
uint id=0;
for(;asks[num].price>0 && id<64;num=uint(asks[num].next)){
if(_who!=address(0) && _who!=asks[num].who){
continue;
}
... | 907,049 |
pragma solidity 0.4.24;
import "./RewardableCanvas.sol";
/**
* @dev This contract takes care of initial bidding.
*/
contract BiddableCanvas is RewardableCanvas {
uint public constant BIDDING_DURATION = 48 hours;
mapping(uint32 => Bid) bids;
mapping(address => uint32) addressToCount;
uint public min... | Only for the owner of the contract. Sets minimum bid amount./ | function setMinimumBidAmount(uint _amount) external onlyOwner {
minimumBidAmount = _amount;
}
| 5,395,162 |
./full_match/1/0xBEbB92Ed09688e64DC38c240B600D0B1d504EE56/sources/lib/aera-contracts/contracts/v1/AeraVaultV1.sol | @inheritdoc IGuardianAPI slither-disable-next-line timestamp | function setSwapFee(uint256 newSwapFee)
external
override
nonReentrant
onlyGuardian
{
if (
block.timestamp < lastSwapFeeCheckpoint + SWAP_FEE_COOLDOWN_PERIOD
) {
revert Aera__CannotSetSwapFeeBeforeCooldown();
}
lastSwapFeeCh... | 3,080,218 |
./full_match/1/0x352aA679D505a0d7eC247E069fabF10Ee526FA7A/sources/contracts/wrapper/ENS3.sol | reclaim controller to Fracton DAO for resolving names if rent market not onboard | function safeWrap(string memory ENSName) external {
uint256 tokenId = ENSNametoId(ENSName);
IERC721(ENS_CONTRACT).transferFrom(_msgSender(),address(this),tokenId);
if(rent_market != address(0)){
ENS(ENS_CONTRACT).reclaim(tokenId, rent_market);
}
else{
... | 17,036,566 |
pragma solidity ^0.4.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Sol... | ------------------------------------------------------------------------ Owner can transfer out any accidentally sent ERC20 tokens ------------------------------------------------------------------------ | function transferAnyERC20Token(address _tokenAddress, uint _value) public onlyOwner returns (bool success) {
return ERC20Interface(_tokenAddress).transfer(owner, _value);
}
| 41,926 |
pragma solidity ^0.4.18;
/**
* @title PayableHandshake
* @author Autonomous
* @dev PayableHandshake allows payer to send funds for a handshake and payee withdraw funds if their deliver is accepted
*/
contract PayableHandshake {
enum S { Inited, Shaked, Accepted, Rejected, Done, Cancelled }
struct Payabl... | Payer reject the deliver | function reject(uint hid, bytes32 offchain) public onlyPayer(hid) {
require(pm[hid].state == S.Accepted);
pm[hid].state = S.Rejected;
emit __reject(hid, offchain);
}
| 12,709,216 |
./full_match/4/0x1a49A558557c9Fcd5073FB6641d2dc32233cb5D9/sources/ricardian.sol | ownership check ensures no underflow | function _burn(uint256 tokenId) internal virtual {
address owner = ownerOf[tokenId];
if (ownerOf[tokenId] == address(0)) revert NotMinted();
unchecked {
totalSupply--;
balanceOf[owner]--;
}
delete ownerOf[tokenId];
... | 796,173 |
/**
*Submitted for verification at Etherscan.io on 2022-03-19
*/
// SPDX-License-Identifier: MIT
//YODATAMA
//http://t.me/yodatama
//https://yodatama.io/
pragma solidity 0.8.11;
abs... | exclude from paying fees or having max transaction amount | constructor() ERC20("", "") payable {
uint256 _buyMarketingFee = 5;
uint256 _buyLiquidityFee = 5;
uint256 _buyBuyBackFee = 0;
uint256 _buyDevFee = 0;
uint256 _sellMarketingFee = 15;
uint256 _sellLiquidityFee = 5;
uint256 _sellBuyBackFee = 0;
... | 6,560,421 |
./full_match/43114/0x10CB737021eF8d287cD2e6e8986C985D56b7B2B4/sources/GlobalAvax.sol | Triggers an approval from owner to spender owner The address to approve from spender The address to be approved value The number of tokens that are approved (2^256-1 means infinite) deadline The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half o... | function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external {
require(deadline >= block.timestamp, "Yak::permit: signature expired");
bytes32 encodeData = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadl... | 4,645,134 |
/**
* βββββββββββββββββββββββββββββ
* βββββββββββββββββββββββββββββ
* βββββ¬βββ¬β€βββββββββββ¬ββΌβββΌββββ
* βββββ€ββββ€ββββββββββββββββββββ
* βββββΌβββ€βββββββββββββββββ€ββββ
* βββββββββ΄ββββββββ΄βββ΄βββββ΄ββββ
* βββββββββββββββββββββββββββββ
* βββββββββββββββββββββββββββββ
* @author: pickle_rick
*/
pragma solidity ^0.4.23;... | remove the contract address as a super user role have it here just in case _address A contract address/ | function removeContractAddress(address _address)
public
onlyOwner
returns (bool) {
uint256 codeLength;
assembly {
codeLength := extcodesize(_address)
}
if (codeLength == 0) {
return false;
}
adminContracts[_address] ... | 5,915,744 |
./full_match/4/0xCbd380E055A76940fa46bD3Ec85524EF09dE647D/sources/lexlocker.sol | Returns escrow milestone deposits per `value` array. registration The index of escrow deposit. | function getMilestones(uint256 registration) external view returns (uint256[] memory milestones) {
milestones = lockers[registration].value;
}
| 720,976 |
pragma solidity ^0.4.17;
import "../tokens/IToken.sol";
import "../common/Math.sol";
library InvestorLedger {
/// Events
// A state transition in the loan FSM occured.
event StateTransition(
address indexed loan,
State from,
State to
);
// A new investor has invested.
... | canWithdrawLoanToken performs processing to see if a given address can withdraw loan tokens in one of the final states (Paidback, Canceled, Defaulted) In Paidback, investors can withdraw investment with interest. If the loan was canceled before investment was finished, investors can get their investment back without in... | function canWithdrawLoanToken(Ledger storage ledger, address caller) processTimeouts(ledger) public returns (uint256 _amount) {
if (ledger.state == State.Paidback) {
uint256 invested = ledger.investorData[caller].amountInvested;
invested += calculateInterest(ledger, invested);
... | 15,857,873 |
//Address: 0x7E16eFB8B68e04075F368B5618EbC479F57c20E5
//Contract name: Cents
//Balance: 0 Ether
//Verification Date: 10/12/2017
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^ 0.4 .11;
/*
* @title String & slice utility library for Solidity contracts.
* @author Nick Johnson <arachnid@notdot.net>
*
*... | Returns true if the slice ends with `needle`. self The slice to operate on. needle The slice to search for. return True if the slice starts with the provided text, false otherwise./ | function endsWith(slice self, slice needle) internal returns (bool) {
if (self._len < needle._len) {
return false;
}
var selfptr = self._ptr + self._len - needle._len;
if (selfptr == needle._ptr) {
return true;
}
bool equal;
assembly... | 908,404 |
// 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 or decremented by one. This can be used e.g. to track the number
* of elements in a mapping, issu... | We cannot just use balanceOf to create the new tokenId because tokens can be burned (destroyed), so we need a separate counter. | function mint(address recipient, string memory metadataURI) public returns (uint256) {
require(hasRole(MINTER_ROLE, _msgSender()), "priv");
uint256 newItemId = _tokenIdTracker.current();
_mint(recipient, newItemId);
_setTokenURI(newItemId, metadataURI);
_tokenIdTracker.incr... | 11,873,465 |
/*
ERC20CompetitiveRewardModuleInfo
https://github.com/gysr-io/core
SPDX-License-Identifier: MIT
*/
pragma solidity 0.8.4;
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "../interfaces/IRewardModule.sol";
import "../ERC20CompetitiveRewardModule.sol";
import "../GysrUtils.sol";
... | preview estimated rewards module address of reward module addr account address of interest for preview shares number of shares that would be unstaked gysr number of GYSR tokens that would be applied return estimated reward return estimated time multiplier return estimated gysr multiplier/ get associated share secon... | function rewards(
address module,
address addr,
uint256 shares,
uint256 gysr
)
public
view
returns (
uint256,
uint256,
uint256
)
{
ERC20CompetitiveRewardModule m = ERC20CompetitiveRewardModule(module)... | 13,070,984 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC... | Get all token IDs of a token owner | function tokenIdsByOwner(address _owner)
public
view
returns (uint256[] memory)
{
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) return new uint256[](0);
else {
uint256 i = 0;
uint256[] memory result = new uint256[](tokenCou... | 5,535,461 |
pragma solidity ^0.4.18; // solhint-disable-line
/// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
contract ERC721 {
// Required methods
function approve(address _to, uint256 _tokenId) public;
function balanceOf(address _owner) public view returns (uint256 balance);
function ... | Allows someone to send ether and obtain the token Making sure token owner is not sending to self Safety check to prevent against an unexpected 0x0 default. Making sure sent amount is greater than or equal to the sellingPrice Payment is the amount going to the previous owner Pay previous tokenOwner if owner is not contr... | function purchase(uint256 _tokenId) public payable {
address oldOwner = stateIndexToOwner[_tokenId];
address newOwner = msg.sender;
uint256 sellingPrice = stateIndexToPrice[_tokenId];
require(oldOwner != newOwner);
require(_addressNotNull(newOwner));
require(msg.value >= sellingPrice);
... | 12,657,394 |
./partial_match/1/0x00000000000006c7676171937C444f6BDe3D6282/sources/contracts/helpers/PointerLibraries.sol | Reads the int208 at `cdPtr` in calldata. | function readInt208(
CalldataPointer cdPtr
) internal pure returns (int208 value) {
assembly {
value := calldataload(cdPtr)
}
}
| 4,300,326 |
./partial_match/1/0x9CeDB174BD547f9a0f99Dca63660710d59B75AD4/sources/Strategy.sol | Will attempt to free the '_amount' of 'asset'. Callback for the TokenizedStrategy to call during a withdraw or redeem to free the needed funds to service the withdraw. This can only be called after a 'withdraw' or 'redeem' delegateCall to the TokenizedStrategy so msg.sender == address(this). _amount The amount of 'as... | function freeFunds(uint256 _amount) external onlySelf {
_freeFunds(_amount);
}
| 4,079,850 |
pragma solidity ^0.4.24;
// File: Multiownable/contracts/Multiownable.sol
contract Multiownable {
// VARIABLES
uint256 public ownersGeneration;
uint256 public howManyOwnersDecide;
address[] public owners;
bytes32[] public allOperations;
address internal insideCallSender;
uin... | Withdraw tokens/ | function withdraw() external onlyParticipant canWithdraw {
for (uint i = 0; i < participants.length; i++) {
address token = tokenByParticipant[participants[i]];
SwapOffer storage offer = offerByToken[token];
if (offer.participant == msg.sender) {
continue... | 2,546,954 |
./full_match/80001/0x7dAa45baed51E14f27631916D79c45a0908EbAe7/sources/contracts/Main.sol | just check already registerd or not | function signIn(string memory _address) public view returns (UserInfo memory) {
return userNameToData[_address];
}
| 868,190 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.9;
// ____ _ _ ____ ____ __ ___ __ ____ ____ _ _
// (_ _)/ )( \( __) / ___) / \ / __)( )( __)(_ _)( \/ )
// )( ) __ ( ) _) \___ \( O )( (__ )( ) _) )( ) /
// (__) \_)(_/(____) (____/ \__/ \___)(__)(____) (__) (__/
/... | This hooks into transfers to track gold balances. We only do the extra bookkeeping when a gold token is being transferred. | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override {
if (tokenId > MAXIMUM_GOLD_MEMBER_COUNT) {
return;
}
if (from != address(0)) {
goldBalances[from] -= 1;
}
if (to != addre... | 13,492,012 |
./partial_match/3/0xA462A609A9dF2C09082C88569175F4fbAa42Ac65/sources/PCToken.sol | Exit a pool - redeem a specific number of pool tokens for an underlying asset Asset must be present in the pool, and will incur an EXIT_FEE (if set to non-zero) self - ConfigurableRightsPool instance calling the library bPool - Core BPool the CRP is wrapping tokenOut - which token the caller wants to receive... | function exitswapPoolAmountIn(
IConfigurableRightsPool self,
IBPool bPool,
address tokenOut,
uint poolAmountIn,
uint minAmountOut
)
external
view
returns (uint exitFee, uint tokenAmountOut)
{
require(bPool.isBound(tokenOut), "ERR_NOT_BO... | 5,268,441 |
/*
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 applicable ... | Return if an address has all the roles. who The address roleMask The required roles. | function hasAllRoles(
address who,
uint256 roleMask)
public
view
returns (bool)
{
require(roleMask != 0, "NO_ROLES");
return (operatorMap[who].roles & roleMask == roleMask);
}
| 13,084,498 |
./partial_match/1/0x82895fE2945A8B19c5E511E5AA90Da3Aa27331eA/sources/CCPCyborgs.sol | Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. WARNING: Only use if you are certain `pos` is lower than the array length./ We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr` following https:docs.soliditylang.org/en/v0.8.20/internals/lay... | function unsafeAccess(uint256[] storage arr, uint256 pos) internal pure returns (StorageSlot.Uint256Slot storage) {
bytes32 slot;
assembly {
mstore(0, arr.slot)
slot := add(keccak256(0, 0x20), pos)
}
return slot.getUint256Slot();
}
| 2,700,583 |
./full_match/1/0x05C1FDA8ccD7f392c0fe6555a9eE1214bf9BFb4a/sources/contracts/mystery-box/MysteryBox.sol | Function allows admin to turn on/off shards sale/ | function updateShardSaleStatus(bool _isActive) public onlyOwner {
shardSaleIsActive = _isActive;
}
| 8,355,802 |
./full_match/80001/0xD2E964d17322eF768d6370445E0aFba83E4af914/sources/@aave/core-v3/contracts/interfaces/IPriceOracleGetter.sol | IPriceOracleGetter Aave Interface for the Aave price oracle./ | interface IPriceOracleGetter {
function BASE_CURRENCY() external view returns (address);
function BASE_CURRENCY_UNIT() external view returns (uint256);
function getAssetPrice(address asset) external view returns (uint256);
pragma solidity ^0.8.0;
}
| 9,503,524 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.