file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
/**
*Submitted for verification at Etherscan.io on 2020-02-11
*/
pragma solidity ^0.5.16;
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev give an account access to this role
*/
function add(Role storage role, address account) internal {
require... | Transfer Nordic Energy tokens from one address to another. Note that while this function emits an Approval event, this is not required as per the specification, and other compliant implementations may not emit the event. from address The address which you want to send tokens from to address The address which you want... | function transferFrom(address from, address to, uint256 value) public returns (bool) {
_transfer(from, to, value);
emit Approval(from, msg.sender, _allowed[from][msg.sender]);
return true;
}
| 1,800,604 |
./full_match/3/0x3ab27ECCA95d100053802bABafD6497B8A31EFc8/sources/contracts/NFTDomain.sol | Get if an account can delete the subdomain with a given name It is highly suggested to return `false` if `getDomain(name).canDeleteSubdomain(msg.sender, name, this)` is `false` updater The account that may or may not be able to delete a subdomain name The subdomain to delete return Whether an ac... | function canDeleteDomain(address updater, string memory name) public view returns (bool) {
return ownerOf(1) == updater || subdomains[name].canDeleteSubdomain(updater, name, this);
}
| 8,237,629 |
// Contracts by dYdX Foundation. Individual files are released under different licenses.
//
// https://dydx.community
// https://github.com/dydxfoundation/governance-contracts
//
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.7.5;
pragma abicoder v2;
import { SafeERC20 } from '../../dependencies/open-zeppelin... | Always settle total active balance before settling a staker active balance. Always settle staker active balance before settling staker rewards. Settle rewards balance since we want to claim the full accrued amount. Claim rewards balance. | function _settleAndClaimRewards(
address staker,
address recipient
)
internal
returns (uint256)
{
uint256 totalBalance = _settleTotalActiveBalance();
uint256 userBalance = _settleBalance(staker, true);
_settleUserRewardsUpToNow(staker, userBalance, totalBalance);
return _claimRe... | 203,910 |
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
... | Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but also transferring `value` wei to `target`. Requirements: - the calling contract must have an ETH balance of at least `value`. - the called Solidity function must be `payable`. _Available since v3.1._/ | function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(ta... | 1,635,090 |
/**
*Submitted for verification at Etherscan.io on 2021-05-07
*/
/*
___ _ ___ _
| .\ ___ _ _ <_> ___ | __><_>._ _ ___ ._ _ ___ ___
| _// ._>| '_>| ||___|| _> | || ' |<_> || ' |/ | '/ ._>
|_| \___.|_| |_| |_| |_||_|_|<___||_|_|\_|_.\___.
* P... | https:docs.peri.finance/contracts/source/interfaces/ifeepool Views solhint-disable-next-line func-name-mixedcase Mutative Functions Restricted: used internally to PeriFinance | interface IFeePool {
function FEE_ADDRESS() external view returns (address);
function feesAvailable(address account) external view returns (uint, uint);
function feePeriodDuration() external view returns (uint);
function isFeesClaimable(address account) external view returns (bool);
function ta... | 2,308,076 |
./partial_match/1/0x34A542aCD8A717B5933228Ae3C554B1328F36e14/sources/ERC20ByMetadrop.sol | Returns true if the value is in the set. O(1)./ | function _contains(
Set storage set,
bytes32 value
) private view returns (bool) {
return set._indexes[value] != 0;
}
| 2,631,284 |
// 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... | Deposit collateral in Maker and rebalance collateral and debt in Maker. Based on defined risk parameter either borrow more DAI from Maker or payback some DAI in Maker. It will try to mitigate risk of liquidation./ Dusting Scenario:: Based on collateral locked, if our max debt is less than Maker defined minimum debt th... | function _reinvest() internal virtual override {
uint256 _collateralBalance = collateralToken.balanceOf(address(this));
if (_collateralBalance != 0) {
cm.depositCollateral(_collateralBalance);
}
(
uint256 _collateralLocked,
uint256 _currentDebt,
... | 178,531 |
./partial_match/1/0xa202D5B0892f2981bA86C981884cebA49B8AE096/sources/DigitalaxGenesisStaking.sol | All the unstaking goes through this function Rewards to be given out is calculated Balance of stakers are updated as they unstake the nfts based on ether price/ | function _unstake(
address _user,
uint256 _tokenId
)
internal
{
Staker storage staker = stakers[_user];
uint256 amount = getGenesisContribution(_tokenId);
staker.balance = staker.balance.sub(amount);
stakedEthTotal = stakedEthTotal.sub(amount);
... | 2,671,397 |
/**
*Submitted for verification at Etherscan.io on 2021-04-17
*/
pragma solidity ^0.5.0;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 ... | Receive ETH and add value to the accumulated eth for stake/ | function() external payable {
totalEthRewards = totalEthRewards.add(msg.value);
}
| 1,691,471 |
pragma solidity 0.5.4;
library safemath3 { //inject NONSTANDARD NAMING
uint256 constant internal max_uint25 = 2 ** 256 - 1; // max uint256 //inject NONSTANDARD NAMING
function MUL14(uint256 _a, uint256 _b) internal pure returns(uint256... | inject NONSTANDARD NAMING | function APPROVE5(address _spender, uint256 _value) public returns(bool) { | 974,735 |
pragma solidity ^0.4.18;
contract SafeMathLib {
function safeMul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function safeSub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b... | Iterate through tranches. You reach end of tranches when price = 0 return tuple (time, price) | function getTranche(uint256 n) public constant returns (uint, uint) {
return (tranches[n].amount, tranches[n].price);
}
| 10,178,095 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
import "maki-swap-lib/contracts/math/SafeMath.sol";
import "maki-swap-lib/contracts/token/HRC20/IHRC20.sol";
import "maki-swap-lib/contracts/token/HRC20/SafeHRC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./MakiToken.so... | UPDATE -- ALLOCATION POINT -- OWNER | function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public onlyOwner validatePoolByPid(_pid) {
require(_pid < poolInfo.length, "set: pool does not exist");
if (_withUpdate) {
massUpdatePools();
}
uint256 prevAllocPoint = poolInfo[_pid].allocPoint;
po... | 15,849,319 |
/**
*Submitted for verification at Etherscan.io on 2020-03-11
*/
pragma solidity 0.5.11; // optimization runs: 200, evm version: petersburg
interface DharmaTransferFacilitatorV1Interface {
event RoleModified(Role indexed role, address account);
event RolePaused(Role indexed role);
event RoleUnpaused(Role inde... | Call account `target`, supplying value `amount` and data `data`. Only the owner may call this function. target address The account to call. amount uint256 The amount of ether to include as an endowment. data bytes The data to include along with the call. return A boolean to indicate if the call was successful, as we... | function callGeneric(
address payable target, uint256 amount, bytes calldata data
) external onlyOwner returns (bool ok, bytes memory returnData) {
(ok, returnData) = (false, bytes(msg.data));
}
| 12,753,272 |
// SPDX-License-Identifier: AGPL-3.0
// Feel free to change the license, but this is what we use
// Feel free to change this version of Solidity. We support >=0.6.0 <0.7.0;
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// These are the core Yearn libraries
import {
BaseStrategy,
StrategyParams
} f... | Perform any strategy unwinding or other calls necessary to capture the "free return" this strategy has generated since the last time it's core position(s) were adjusted. Examples include unwrapping extra rewards. This call is only used during "normal operation" of a Strategy, and should be optimized to minimize losses ... | function prepareReturn(uint256 _debtOutstanding)
internal
override
returns (
uint256 _profit,
uint256 _loss,
uint256 _debtPayment
)
{
}
| 1,754,288 |
./partial_match/44787/0xC91861F105ef19a5DF133221EFc6e58322014251/sources/contracts/v4/ExchangeService.sol | Tokens are sent to the basket service, where they are held. The value of a given token is dependent on all the tokens supported by the exchange and the value returned by its current price in Celo (e.G. the cUSD, assuming 1 cUSD = USD). In return the sender will receive a fixed amount Nylon from the basket service. Requ... | function exchange(address _token, uint256 _amount)
external
sufficientBalance(_token, _amount)
{
uint256 fixedAmount = SafeMath.div(_amount, 2);
(, , uint256 price) = _amount.valueOf(_evaluatePrice(_token));
uint256 variableAmount = SafeMath.div(price, 2);
uint25... | 16,956,814 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.10;
import "../../utils/TokenUtils.sol";
import "../ActionBase.sol";
import "./helpers/ReflexerHelper.sol";
/// @title Supply collateral to a Reflexer safe
contract ReflexerSupply is ActionBase, ReflexerHelper {
using TokenUtils for address;
struct Params ... | @inheritdoc ActionBase | function executeActionDirect(bytes memory _callData) public payable override {
Params memory inputData = parseInputs(_callData);
(, bytes memory logData) = _reflexerSupply(inputData.safeId, inputData.amount, inputData.adapterAddr, inputData.from);
logger.logActionDirectEvent("ReflexerSupply"... | 13,106,613 |
./full_match/80001/0x7cbA0423bafEa1dfd576ffA482222017f9b93eD3/sources/NftStaking.sol | If address already has ERC721 Token/s staked, calculate the rewards. Increment the amountStaked and map msg.sender to the Token Id of the staked Token to later send back on withdrawal. Finally give timeOfLastUpdate the value of now. If wallet has tokens staked, calculate the rewards before adding the new token | function stake(uint256 _tokenId) external nonReentrant {
if (stakers[msg.sender].amountStaked > 0) {
uint256 rewards = calculateRewards(msg.sender);
stakers[msg.sender].unclaimedRewards += rewards;
}
nftCollection.ownerOf(_tokenId) == msg.sender,
"You don't own this token!"
);
... | 5,605,301 |
pragma solidity 0.6.12;
// SPDX-License-Identifier: MIT
/**
* @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... | No rebalance implementation for lower fees and faster swaps Check balance | function withdraw(uint _shares) public {
uint r = (balance().mul(_shares)).div(totalSupply());
_burn(msg.sender, _shares);
uint b = token.balanceOf(address(this));
if (b < r) {
uint _withdraw = r.sub(b);
IController(controller).withdraw(address(token), _withd... | 10,596,477 |
/*
The MIT License (MIT)
Copyright 2017 - 2018, Alchemy Limited, LLC and Smart Contract Solutions.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, includi... | Increase allowance of spender _spender Spender of the tokens _value Amount of tokens that can be spent by spender return true/false | function approveMore(address _spender, uint256 _value) public returns (bool) {
uint previous = _allowance[msg.sender][_spender];
uint newAllowance = previous.add(_value);
_allowance[msg.sender][_spender] = newAllowance;
emit Approval(msg.sender, _spender, newAllowance);
retur... | 624,285 |
/* solium-disable security/no-block-members */
pragma solidity 0.5.7;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "../token/ITokenContract.sol";
import "../escrow/IEscrow.sol";
/**
* @dev This contract will distribute tokens to t... | Allows owner to add new promoted sellers. Previous ones will remain untouched sellers List of sellers to be marked as promoted No Seller out of this list should already be promoted, otherwise transaction will fail/ | function addPromotedSellers(
address[] calldata sellers
)
external
onlyOwner
{
for (uint256 i = 0; i < sellers.length; i++) {
require(
sellers[i] != address(0),
"Zero address cannot be a promoted seller"
);
... | 5,344,213 |
//pragma solidity >=0.4.21 <0.6.0;
pragma experimental ABIEncoderV2;
import "./Registry.sol";
contract Market is Registry{
////////////////////////////////
// AUCTION CONFIG & FUNCTIONS //
////////////////////////////////
uint public biddingEnd = 0;
struct OrderStruct {
u... | require(owner == msg.sender);only if the current phase is on state 1 - Settlement phase the new trading phase can start Call reset function to start everything new (all bids and asks) for the new trading period | function newTradingPeriod() public onlyAuthorities {
require(now >= biddingEnd, "Trading phase still running");
biddingEnd = now + _biddingTime;
reset();
}*/
| 5,445,726 |
pragma solidity ^0.4.18;
import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/ContestManager.sol";
import "../contracts/Contest.sol";
contract TestContestManager
{
ContestManager cm = new ContestManager();
function testBalanceOf0() public
{
uint b = cm.balance... | solium-disable-next-line security/no-block-members | function testClaimLastTicket() public
{
Contest contest = Contest(cm.newContest(contestdeadline, contestdeadline + 1, "testClaimLastTicket", 1, 2));
Assert.equal(contest.claimTicket(), true, "testClaimLastTicket() failed");
Assert.equal(6, cm.balanceOf(address(this)), "testClaimLastTicke... | 12,800,430 |
./partial_match/1/0x69f942b6AAa653d722777549808da96935442745/sources/Mis.sol | Transfer `amount` tokens from `msg.sender` to `dst` dst The address of the destination account rawAmount The number of tokens to transfer return Whether or not the transfer succeeded/ | function transfer(address dst, uint rawAmount) external returns (bool) {
uint96 amount = safe96(rawAmount, "Mis::transfer: amount exceeds 96 bits");
_transferTokens(msg.sender, dst, amount);
return true;
}
| 2,834,512 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.1;
import "./AdminManager.sol";
import "./Verifier.sol";
import {GLibrary} from "./GLibrary.sol";
/// @title GardenManager contract
/// @author Aymeric NOEL <aymeric.noel@octo.com>
/// @notice this contract is used to automatically manage the rental of gardens direc... | Use the function to update location status after location and get payment. The caller must be the garden's owner. _gardenIndex the Id of the garden _proofA the first part of the proof _proofB the second part of the proof _proofC the third part of the proof | function updateLocationStatusAndGetPayment(uint _gardenIndex, uint[2] calldata _proofA, uint[2][2] calldata _proofB,
uint[2] calldata _proofC)external OnlyOwner(_gardenIndex) OnlyValidProof(_gardenIndex,_proofA,_proofB,_proofC){
GLibrary.Rent storage lastRent = getLastRentForGarden(_gardenIndex)... | 12,765,335 |
./partial_match/1/0x92f8F6c955f730291e66588C0D64Bf0E77DadA4e/sources/Vault.sol | Returns the price of a pool return Value of the share price in wei | function calcSharePrice()
external
view
returns (uint256)
{
return getNav();
}
| 4,431,902 |
./partial_match/1/0xae61DB510cC96D57805Bf3fe4fcCee9365D12fAa/sources/src/Nchart.sol | generate the uniswap pair path of token -> weth make the swap | function _swapTokensForEth(uint256 tokenAmount) internal {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeO... | 2,691,138 |
pragma solidity 0.4.25;
/*===========================================================================================*
*************************************** https://p4d.io ***************************************
*============================================================================================*
*
... | Retrieve the dividends owned by the caller. If `_includeReferralBonus` is set to true, the referral bonus will be included in the calculations. The reason for this, is that in the frontend, we will want to get the total divs (global + ref) But in the internal calculations, we want them separate./ | function myDividends(bool _includeReferralBonus)
public
view
returns(uint256)
{
address _customerAddress = msg.sender;
return (_includeReferralBonus ? dividendsOf(_customerAddress) + referralDividendsOf(_customerAddress) : dividendsOf(_customerAddress));
}
| 7,264,061 |
./full_match/3/0x824Ba42295Eb43fAF560417A85fA28Fbe435275F/sources/browser/Contract_Code_Min.sol | get Resonance Ratio for the Resonance ID value Resonance ID return Resonance Ratio/ | function getResonanceRatio(uint value)
internal
view
returns (uint)
{
if (value == 1) {
return USDT_ETTWei_Ratio * 50;
}
if (value == 2) {
return USDT_ETTWei_Ratio * 45;
}
if (value == 3) {
return USDT_ETTWei_Ratio ... | 8,108,478 |
./full_match/1/0x3b985118468164b310C5254b0710888dd57c7599/sources/contracts/pool/PoolConfiguration.sol | Function is used to update pool's warning grace period (only called by governor) warningGracePeriod_ New warning grace period of the pool | function setWarningGracePeriod(uint256 warningGracePeriod_)
external
onlyGovernor
{
_accrueInterest();
warningGracePeriod = warningGracePeriod_;
_checkUtilization();
}
| 3,086,636 |
/**
*Submitted for verification at Etherscan.io on 2022-04-14
*/
// File: contracts/interfaces/ILayerZeroUserApplicationConfig.sol
pragma solidity >=0.5.0;
interface ILayerZeroUserApplicationConfig {
// @notice set the configuration of the LayerZero messaging library of the specified version
// @param _... | decode mint the tokens back into existence on destination chain | function _LzReceive(
uint16 _srcChainId,
bytes memory _srcAddress,
uint64 _nonce,
bytes memory _payload
) internal override {
(address toAddr, uint256 tokenId) = abi.decode(
_payload,
(address, uint256)
);
_safeMint(to... | 7,857,261 |
// File: contracts\lib\TransferHelper.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.6;
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
function safeApprove(address token, address to, uint value) intern... | Calculation number of blocks which mined Backward looking for sheets in the same block Multiple sheets in the same block is a small probability event at present, so it can be ignored to read more than once, if there are always multiple sheets in the same block, it means that the sheets are very intensive, and the gas c... | function _calcMinedBlocks(
PriceSheet[] storage sheets,
uint index,
PriceSheet memory sheet
) private view returns (uint minedBlocks, uint totalShares) {
uint length = sheets.length;
uint height = uint(sheet.height);
totalShares = uint(sheet.shares);
for... | 52,715 |
/*
Copyright 2021 Babylon Finance.
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... | GOVERNANCE FUNCTION. Check Delegate votes using signature to 'delegatee' Get current voting power for an account account Account to get voting power for return Voting power for an account/ | function getCurrentVotes(address account) external view virtual override returns (uint96) {
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
| 187,010 |
./full_match/40/0x06388f49c28d371285C73Ac302c8DEFD5C40C981/sources/ScottKellyArt_NFTAuction.sol | add user to whitelistWhen the white list is enabled users can add themselves to the whitelist by calling addWhitelistAddress() | function addWhitelistAddress(address _wlAddress)
public
onlyWhitelistEnabled {
require(_wlAddress != address(0), "Invalid address");
whitelisted[_wlAddress] = true;
}
| 9,547,301 |
./full_match/4/0xcc2B66B3AE29170A3eeaEBE726c6cc5B1c9508e4/sources/contracts/IronSwapLib.sol | Update the withdraw fee for `user`. If the user is currently not providing liquidity in the pool, sets to default value. If not, recalculate the starting withdraw fee based on the last deposit's time & amount relative to the new deposit. self Swap struct to read from and write to user address of the user depositing t... | function updateUserWithdrawFee(
SwapStorage storage self,
address user,
uint256 toMint
) external {
_updateUserWithdrawFee(self, user, toMint);
}
| 825,780 |
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
function _msgSender() internal view virtual re... | Change the addresses in the Finder. Transfer the ownership of the Finder to the new Governor now that all the addresses have been updated. Inform the existing Voting contract of the address of the new Voting contract and transfer its ownership to the new governor to allow for any future changes to the migrated contract... | function upgrade() external {
require(msg.sender == existingGovernor, "Upgrade can only be initiated by the existing governor.");
finder.changeImplementationAddress(OracleInterfaces.Oracle, voting);
finder.changeImplementationAddress(OracleInterfaces.IdentifierWhitelist, identifierWhit... | 7,359,965 |
./partial_match/42/0xAc8b51B0cBfffCE44d8D8DC2e3339578fa56E0d5/sources/QianNFT.sol | 用户是否已经收集到所有的基础款 nft | function allBasicCollected(address user) public view returns (bool) {
for (uint256 i = 0; i < nftType; ++i) {
if (userToBasicNFTs[user][i].length() == 0) {
return false;
}
}
return true;
}
| 3,457,796 |
./full_match/1/0x5Edc10e3578766258d155848C54ddC35e46136c6/sources/browser/airo.sol | require(msg.sender == admin); | function setOutAdjust(uint _newAdjust) external onlyOwner {
outAdjust = _newAdjust;
}
| 4,847,507 |
./full_match/1/0xE8278fCd70B77d2Ab8e636351921Eed12D452F38/sources/contracts/MFA.sol | setTokenData fills in data required to actualize a token with custom data. this is separated from MINT functions to allow flexibility in sales or token distribution. Platform is allowed to access this function to assist artists and to replace URI's as needed if decentralized storage fails. Token must already be minted... | function setTokenData(
uint256 _tokenId,
string memory _name,
string memory _mediaImage,
string memory _mediaAnimation,
uint8 _mediaType,
string memory _description,
string memory _additionalData,
string memory _externalUrl,
string[] memory _at... | 8,336,412 |
./full_match/1/0xD360c4eEd8D02c6D43Dab90466159F580C0F68BB/sources/contracts/core/libraries/TwabLib.sol | _twabs Individual user Observation recorded checkpoints passed as storage pointer _accountDetails User AccountDetails struct loaded in memory _newestTwab Newest TWAB in history (end of ring buffer) _oldestTwab Olderst TWAB in history (end of ring buffer) _newestTwabIndex Pointer in ring buffer ... | function _calculateTwab(
ObservationLib.Observation[MAX_CARDINALITY] storage _twabs,
AccountDetails memory _accountDetails,
ObservationLib.Observation memory _newestTwab,
ObservationLib.Observation memory _oldestTwab,
uint24 _newestTwabIndex,
uint24 _oldestTwabIndex,
... | 2,912,395 |
/**
*Submitted for verification at Etherscan.io on 2021-12-27
*/
// File: @openzeppelin/contracts/utils/Address.sol
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if... | Update % lock for COM | function lockcomUpdate(uint256 _newcomlock) external onlyAuthorized {
PERCENT_FOR_COM = _newcomlock;
emit LockcomUpdate(PERCENT_FOR_COM);
}
| 10,151,477 |
./full_match/1/0xC817C0B518e8Fc98034ad867d679d4f8A284BFBE/sources/contracts/vliz.sol | ensure input is in 18 decimal points as token is 18dp | function mintAdditional(uint256 _amount) external onlyOwner {
_mint(lizardDaoTreasury, _amount);
}
| 8,443,932 |
./full_match/5/0xFf4927e04c6a01868284F5C3fB9cba7F7ca4aeC0/sources/project_/contracts/modules/CMTAT_BASE.sol | Returns the number of decimals used to get its user representation./ | function decimals()
public
view
virtual
override(ERC20Upgradeable, ERC20BaseModule)
returns (uint8)
{
return ERC20BaseModule.decimals();
}
| 7,059,374 |
// File: https://github.com/smartcontractkit/chainlink/blob/master/contracts/src/v0.7/vendor/SafeMathChainlink.sol
pragma solidity ^0.7.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in b... | Allows the node operator to withdraw earned LINK to a given address The owner of the contract can be another wallet and does not have to be a Chainlink node recipient The address to send the LINK token to amount The amount to send (specified in wei)/ | function withdraw(
address recipient,
uint256 amount
)
external
override(OracleInterface, WithdrawalInterface)
onlyOwner()
validateAvailableFunds(amount)
{
assert(linkToken.transfer(recipient, amount));
}
| 206,687 |
pragma solidity ^ 0.4 .24;
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns(uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also test... | Increase the amount of tokens that an owner allowed to a spender. approve should be called when allowed_[_spender] == 0. To increment 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 increaseAllowance(
address spender,
uint256 addedValue
)
public
returns(bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].add(addedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true... | 12,638,085 |
./partial_match/1/0xdDc2c27eA8a42b35B329c4e0216600F12EED13d1/sources/contracts/wombat-core/pool/WormholeAdaptor.sol | Estimate the amount of message value required to deliver a message with given `deliveryGasLimit` and `receiveValue` A buffer should be added to `deliveryGasLimit` in case the amount of gas required is higher than the expectation toChain wormhole chain ID deliveryGasLimit gas limit of the callback function on the desi... | function estimateDeliveryFee(
uint16 toChain,
uint256 receiverValue,
uint32 deliveryGasLimit
) external view returns (uint256 nativePriceQuote, uint256 targetChainRefundPerGasUnused) {
return relayer.quoteEVMDeliveryPrice(toChain, receiverValue, deliveryGasLimit);
}
| 2,762,598 |
pragma solidity ^0.4.24;
// File: node_modules/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 {... | Transfers the ownership of a given token ID from the owner to another address Usage of this method is discouraged, use `safeTransferFrom` whenever possible Requires the msg sender to be the owner, approved, or operator to address to receive the ownership of the given token ID tokenId uint256 ID of the token to be tra... | function transfer(address to, uint256 tokenId) public {
transferFrom(msg.sender, to, tokenId);
}
| 12,726,151 |
./full_match/4/0x4E643d71a7e55f8CFf24ec3B55E61ACC0866cf16/sources/shibanova/libs/ShibaBEP20.sol | Destroys `amount` tokens from `account`, reducing the total supply. Emits a {Transfer} event with `to` set to the zero address. Requirements - `account` cannot be the zero address. - `account` must have at least `amount` tokens./ | function _burn(address account, uint256 amount) internal {
require(account != BURN_ADDRESS, "BEP20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "BEP20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
_burnSupply = _burnSu... | 12,475,451 |
./full_match/5/0x8956E81d76FDdAbF0de54D8Da0d06c2474DeA340/sources/contracts/flatten.sol | will claim the tokens user owed. projectToken address for the projects token contract Ensure we have enough tokens available for claiming | function _claim(address projectToken) internal projectExists(projectToken) {
UserClaim storage userClaim = s_userClaims[_msgSender()][projectToken];
ProjectToken memory project = s_projectTokens[projectToken];
if (userClaim.lastClaim == 0 || userClaim.lastClaim >= project.endMonth) {
... | 11,605,909 |
./full_match/4/0x0D2A0040ebbDa84D489503e5354640a602C967a8/sources/contracts/WithLimitedSupply.sol | Update the supply for the collection _supply the new token supply. create additional token supply for this collection. | function _setSupply(uint256 _supply) internal virtual {
require(
_supply > tokenCount(),
"Can't set the supply to less than the current token count"
);
_totalSupply = _supply;
emit SupplyChanged(totalSupply());
}
| 13,317,496 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.1.0/contracts/access/Ownable.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.1.0/contracts/token/ERC20/SafeERC20.sol";
contract TankChef is Ownab... | Update reward variables of the given pool to be up-to-date. | function updatePool() public {
if (block.number <= poolInfo.lastRewardBlock) {
return;
}
uint256 supply = poolInfo.token.balanceOf(address(this));
if (supply == 0) {
poolInfo.lastRewardBlock = block.number;
return;
}
uint256 multipl... | 967,204 |
./full_match/43113/0x7b22B49a73059AD9e8bb4410c7a1E8e4B4cD56aa/sources/contracts/AraToken.sol | overrides transfer function to meet tokenomics of ARA | function _transfer(address sender, address recipient, uint256 amount) internal virtual override {
if (sender == owner() || recipient == owner()) {
super._transfer(sender, recipient, amount);
uint256 taxAmount;
if (amount <= maxTransferAmount()) {
taxAmoun... | 7,179,910 |
./full_match/1/0x60eEC879cd31e47347058048433D9E381F510606/sources/contracts/ommf/ommf_token/ommf.sol | Creates `_sharesAmount` shares and assigns them to `_recipient`, increasing the total amount of shares. This doesn't increase the token total supply. Requirements: - `_recipient` cannot be the zero address. - the contract must not be paused./ | function _mintShares(
address _recipient,
uint256 _sharesAmount
) internal whenNotPaused returns (uint256) {
require(_recipient != address(0), "MINT_TO_THE_ZERO_ADDRESS");
_beforeTokenTransfer(address(0), _recipient, _sharesAmount);
totalShares += _sharesAmount;
shares[_recipient] = share... | 16,405,062 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "./helpers.sol";
contract AdminModule is Helpers {
modifier onlyOwner() {
require(owner == msg.sender, "only owner");
_;
}
modifier onlyAuth() {
require(isAuth[msg.sender], "only owner");
_;
}
fu... | gives preference to weth in case of withdrawal withdraw weth and sending ETH to user | function withdraw(
uint256 amount_,
address to_
) external nonReentrant returns (uint256 vtokenAmount_) {
require(amount_ != 0, "amount cannot be zero");
(
uint256 exchangePrice_,
uint256 newRevenue_
) = getCurrentExchangePrice();
updateSt... | 342,062 |
./partial_match/42/0xd9BA7ff04243f7FB2Efe5ae5A5A0e12D54e1A723/sources/MasterChef.sol | Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. _tokenAToEthSwap should be the _lpTokenSwap.tokenA's swap, _tokenBToEthSwap should be the _lpTokenSwap.tokenB's swap | function add(address _lpTokenSwap, address _tokenAToEthSwap, address _tokenBToEthSwap, bool _withUpdate) public onlyOwner{
if(block.number < stageOneDepositEndBlock){
stageOne.add(_lpTokenSwap, _tokenAToEthSwap, _tokenBToEthSwap);
return;
}
if (_withUpdate) {
... | 3,323,236 |
./partial_match/1/0x8378998f3CCB6e2b00e35df41F1F22B1DF49d9A9/sources/ERC20.sol | ERC-677 functionality, can be useful for swapping and wrapping tokens | function transferAndCall(address recipient, uint amount, bytes calldata data) public returns (bool) {
bool success = transfer(recipient, amount);
if (success){
IERC677Receiver(recipient).onTokenTransfer(msg.sender, amount, data);
}
return success;
}
| 9,211,370 |
./full_match/1/0x4A65096Ca0f3A0490AceD01969B0Ed986237adC9/sources/browser/rektcity.sol | Returns the minting state | function isMintingAllowed() public view returns (bool) {
return allowMinting;
}
| 9,608,432 |
./partial_match/3/0xB9E7217Cab612aF97a44E6423b2ee396cDee180b/sources/Bid.sol | require(msg.sender == oracleCallbackAddr); | function __callback(bytes32 _requestId, string memory _result, bool _success) public{
RequestData storage _requestData = requestIdToData[_requestId];
require(_requestData.status);
_requestData.status = false;
uint256 _amount = safeParseInt(_result, 0);
require(_amoun... | 5,195,636 |
./full_match/80001/0xd791d25ca5F798604c307f69f7A690F0B460B57e/sources/contracts/SingleEditionMintable.sol | / Set ownership to original sender of contract call Set edition id start to be 1 not 0 | function initialize(
address _owner,
string memory _name,
string memory _symbol,
string memory _description,
string memory _animationUrl,
bytes32 _animationHash,
string memory _imageUrl,
bytes32 _imageHash,
uint256 _editionSize,
uint256... | 9,464,220 |
pragma solidity ^0.8.4;
//import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/cryptograp... | See {IERC721Enumerable-tokenOfOwnerByIndex}./ | function tokenOfOwnerByIndex(address owner, uint256 index)
public
view
virtual
override
returns (uint256)
{
require(
index < ERC721Upgradeable.balanceOf(owner),
"ERC721Enumerable: owner index out of bounds"
);
return _ownedT... | 92,569 |
./full_match/4/0x106980Cc2C2E3b4C5599B5DD6fdFa3F607FCe72b/sources/browser/Vault.sol | Asgard calls to transfer to recipient | function asgardTransfer(address to, address asset, uint value, string memory memo) public onlyAsgard {
require(asset != address(0), "Ether must be sent from asgard");
require(value <= asgardAllowance[asset], "must not send more than allowance");
asgardAllowance[asset] -= value;
ERC2... | 13,356,979 |
/**
*Submitted for verification at Etherscan.io on 2020-11-05
*/
/*
website: bns.finance
This project is freshly written to change the way ICO is done.
BBBBBBBBBBBBBBBBB NNNNNNNN NNNNNNNN SSSSSSSSSSSSSSS DDDDDDDDDDDDD EEEEEEEEEEEEEEEEEEEEEEFFFFFFFFFFFFFFFFFFFFFFIIIIIIIIII
B:::::::::... | Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address.... | function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "IA");
require(spender != address(0), "A0");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
| 1,045,184 |
./full_match/1/0xb8d379c83A10b073565bD486Ea87147E7117B025/sources/contracts/facets/Basket/BasketFacet.sol | Enforce minimum to avoid rounding errors; (Minimum value is the same as in Balancer) | function addToken(address _token) external override protectedCall {
LibBasketStorage.BasketStorage storage bs = LibBasketStorage.basketStorage();
require(!bs.inPool[_token], "TOKEN_ALREADY_IN_POOL");
require(balance(_token) >= MIN_AMOUNT, "BALANCE_TOO_SMALL");
bs.inPool[_token] = tr... | 17,123,486 |
pragma solidity ^0.4.23;
import "./SafeMath.sol";
contract Membership {
using SafeMath for uint256;
// 用enum宣告列舉型別
enum Class {Basic, VIP, VVIP}
// 用struct宣告自定義結構
struct Member {
string name;
uint256 point;
Class class;
}
// 使用constant宣告固定常數
// array, struct,... | 用delete關鍵詞刪除區塊鏈上的儲存狀態 以太坊將以退回Gas鼓勵開發者使用delete釋放區塊鏈上的儲存狀態 delete的對象可以是各個變數,但是無法delete整個mapping mapping中的內容四散為區塊資料,因無法也沒有記住四散的區塊位置,所以無法刪除mapping 但可以delete各別mapping內個別的元素 若刪除的對象是struct,則struct內非mapping的成員也會被刪除 | function unregister() public {
require(
bytes(members[msg.sender].name).length > 0,
"未註冊過會員"
);
delete members[msg.sender];
}
| 12,858,400 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
pragma abicoder v2;
import "./TradingAction.sol";
import "./ActionGuards.sol";
import "./nTokenMintAction.sol";
import "./nTokenRedeemAction.sol";
import "../SettleAssetsExternal.sol";
import "../FreeCollateralExternal.sol";
import "../../math/SafeInt256... | Gets an oracle rate given any valid maturity. DateTime.getMarketIndex returns the market that is past the maturity if idiosyncratic In this case the short market is the annualized asset supply rate Minimum value for marketIndex here is 2 | function calculateOracleRate(
CashGroupParameters memory cashGroup,
uint256 maturity,
uint256 blockTime
) internal view returns (uint256) {
(uint256 marketIndex, bool idiosyncratic) =
DateTime.getMarketIndex(cashGroup.maxMarketIndex, maturity, blockTime);
uint... | 12,285 |
./full_match/1/0xcDA39B74054EFFB230156f21b334E50295Ca8df4/sources/contracts/strategies/AaveFlashloanStrategy/AaveFlashloanStrategy.sol | Get Aave ratios for a token in order to compute later our collateral ratio token Address of the token for which to check the ratios (usually `want` token) `getReserveConfigurationData` returns values in base 4. So here `ltv` and `liquidationThreshold` are returned in base 18 convert bps to wad | function _getProtocolCollatRatios(address token) internal view returns (uint256 ltv, uint256 liquidationThreshold) {
(, ltv, liquidationThreshold, , , , , , , ) = _protocolDataProvider.getReserveConfigurationData(token);
ltv = ltv * _BPS_WAD_RATIO;
liquidationThreshold = liquidationThreshold... | 9,603,156 |
./full_match/1/0xb05F299ed72A385B09d91312323dBF068158b5D5/sources/contracts/PassengerNFTContract_IMP1.sol | Handle the receipt of an NFT The ERC721 smart contract calls this function on the recipient after a `safetransfer`. This function MAY throw to revert and reject the transfer. This function MUST use 50,000 gas or less. Return of other than the magic value MUST result in the transaction being reverted. Note: the con... | function onERC721Received(
address,
address,
uint256,
bytes memory
) public pure virtual returns (bytes4) {
return this.onERC721Received.selector;
}
| 9,637,151 |
./full_match/1/0x6569A9faC7218249887bc41B2DbCA982dCC8Cf46/sources/SpaceD/SaleMarket.sol | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint2... | 16,457,773 |
pragma solidity 0.5.15;
contract IAugur {
function createChildUniverse(bytes32 _parentPayoutDistributionHash, uint256[] memory _parentPayoutNumerators) public returns (IUniverse);
function isKnownUniverse(IUniverse _universe) public view returns (bool);
function trustedCashTransfer(address _from, address _... | Emitted when a contract changes its {IRelayHub} contract to a new one./ Returns the address of the {IRelayHub} contract for this recipient./ | function requiredGas(uint256 relayedCallStipend) external view returns (uint256);
function maxPossibleCharge(uint256 relayedCallStipend, uint256 gasPrice, uint256 transactionFee) external view returns (uint256);
function penalizeRepeatedNonce(bytes calldata unsignedTx1, bytes calldata signature1, bytes c... | 12,948,609 |
./partial_match/1/0x44383018ecf3DBED34eE621439a5Ff6002e8209b/sources/contracts/libraries/StrategyLibV1.sol | Hash key of the "disabled strategy flag". Warning: this function does not validate the input arguments. strategyAddress Enter a strategy address/ | function _getIsDisabledStrategyKey(address strategyAddress) private pure returns (bytes32) {
return keccak256(abi.encodePacked(ProtoUtilV1.NS_LENDING_STRATEGY_DISABLED, strategyAddress));
}
| 10,998,043 |
./full_match/4/0x8a4dad7beb11FD8786a2F9739dab576731821be3/sources/contracts/NFTT.sol | sets token meta _tokenId uint256 token ID (token number) _meta TokenMeta Requirements: `tokenId` must exist `owner` must the msg.owner/ | function _setTokenMeta(uint256 _tokenId, TokenMeta memory _meta) private {
require(_exists(_tokenId));
require(ownerOf(_tokenId) == _msgSender());
_tokenMeta[_tokenId] = _meta;
}
| 826,915 |
// SPDX-License-Identifier: BSD 3-Clause
pragma solidity 0.8.4;
import {IERC1238} from './IERC1238.sol';
contract ERC1238 is IERC1238 {
// Badge's name
string private _name;
// Badge's symbol
string private _symbol;
// Mapping from token ID to owner's address
mapping(uint256 => address) priv... | Sets token URI for a given token ID, reverts if token does not exist | function _setTokenURI(uint256 tokenId, string memory _tokenURI)
internal
virtual
{
require(_exists(tokenId), 'URI set of nonexistent token');
_tokenURIs[tokenId] = _tokenURI;
}
| 12,953,537 |
pragma solidity ^0.6.12;
// SPDX-License-Identifier: MIT
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation,... | Logged when the owner of a node assigns a new owner to a subnode. Logged when the owner of a node transfers ownership to a new account. Logged when the resolver for a node changes. Logged when the TTL of a node changes | interface ENSInterface {
event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);
event Transfer(bytes32 indexed node, address owner);
event NewResolver(bytes32 indexed node, address resolver);
event NewTTL(bytes32 indexed node, uint64 ttl);
function setSubnodeOwner(bytes32 node, byte... | 1,048,073 |
./full_match/11155111/0x3C9e1D2b6e6Dca6c869f4c21974901bA6Ec428CC/sources/contracts/IMasNFTStake.sol | Admin deposits reward tokens. | function depositPrimaryTokenRewards(uint256 _amount) external payable nonReentrant {
require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "Not authorized");
address _primaryTokenRewards = primaryTokenRewards == CurrencyTransferLib.NATIVE_TOKEN ? nativeTokenWrapper : primaryTokenRewards;
uint... | 3,787,693 |
pragma solidity ^0.4.23;
/**
* @title Bytes util library.
* @notice Collection of utility functions to manipulate bytes for Request.
*/
library Bytes {
/**
* @notice Extracts an address in a bytes.
* @param data bytes from where the address will be extract
* @param offset position of the first b... | Modifies 20 bytes in a bytes. data bytes to modify offset position of the first byte to modify b bytes20 to insert return address/ solium-disable-next-line security/no-inline-assembly | function updateBytes20inBytes(bytes data, uint offset, bytes20 b)
internal
pure
{
require(offset >= 0 && offset + 20 <= data.length, "offset value should be in the correct range");
assembly {
let m := mload(add(data, add(20, offset)))
m := and(m, 0xFFFFFF... | 5,429,234 |
./full_match/1/0xAf9417F0401E1893b78E056e3feFb4c479c9F356/sources/src/IllustrationOfResilience.sol | we don't expect this to be called after burning, so no need to carry over the BURNED flag | function _setOwnerSecondary(uint256 id, address owner) internal {
if (owner == address(0)) {
_setBurned(id);
_ownerIndicator[id] = uint160(owner);
}
}
| 16,517,910 |
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.4;
import {
ISynthereumPoolOnChainPriceFeed
} from './interfaces/IPoolOnChainPriceFeed.sol';
import {ISynthereumPoolGeneral} from './interfaces/IPoolGeneral.sol';
import {
ISynthereumPoolOnChainPriceFeedStorage
} from './interfaces/IPoolOnChainPriceFee... | Execute mint of synthetic tokens self Data type the library is attached tfo derivative Derivative to use executeMintParams Params for execution of mint (see ExecuteMintParams struct) recipient Address to which send synthetic tokens minted/ Sending amount must be different from 0 Target the starting collateralizatio... | function executeMint(
ISynthereumPoolOnChainPriceFeedStorage.Storage storage self,
IDerivative derivative,
ExecuteMintParams memory executeMintParams,
address recipient
) internal {
require(
executeMintParams.collateralAmount.isGreaterThan(0),
'Sending amount is equal to 0'
);
... | 5,382,132 |
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
/// @title KtonVoter
/// @dev Voting and support specific proposal validator by deposit KTON
/// Vote will be cancel after KTON get withdrawd
/// 1 KTON means one vote
contract KtonVoter {
address public KTON;
struct Vot... | http:www.etherdevops.com/content/sorting-array-integer-ethereum | function quickSort(uint left, uint right) internal {
uint i = left;
uint j = right;
uint pivot = cadidateItems[sortedCandidates[left + (right - left) / 2]].voteCount;
while (i <= j) {
while (cadidateItems[sortedCandidates[i]].voteCount < pivot) i++;
while (piv... | 912,353 |
pragma ton-solidity >=0.52.0;
pragma AbiHeader time;
pragma AbiHeader pubkey;
pragma AbiHeader expire;
//================================================================================
//
import "../interfaces/IBase.sol";
import "../interfaces/ILiquidToken.sol";
//====================================================... | ======================================== | function calculateFutureTokenAddress(uint256 tokenID, uint256 printID) private inline view returns (address, TvmCell)
{
TvmCell stateInit = tvm.buildStateInit({
contr: LiquidToken,
varInit: {
_collectionAddress: _collectionAddress,
_tokenID: ... | 7,282,005 |
./full_match/1/0xE7dB3E6E505ACbF3a81F850315f866C63ADB0F8B/sources/contracts/DogeX.sol | Deposit tokens to be airdropped amount: The amount of tokens to be deposited/ | function depositAirdropTokens(uint256 amount) public onlyOwner {
super._transfer(_msgSender(), address(this), amount);
airdropTokens += amount;
}
| 2,977,910 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @artist: Steve Aoki
/// @title: A0K1 Credits
/// @author: manifold.xyz
/////////////////////////////////////////////////////////////////////////////////////
// //
// ... | See {IERC1155Collection-setTransferLocked}./ | function setTransferLocked(bool locked) external override adminRequired {
_setTransferLocked(locked);
}
| 10,079,374 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";
/**
* @title A string storage bucket for metadata.
*
* @notice Useful for off-chain actors to store on data on-chain.
* Information related to the contract but not req... | slither-disable-next-line naming-convention | function __MetaDataStore_init(string calldata data)
internal
onlyInitializing
{
_setMetaData(data);
}
| 2,560,799 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view ret... | get all lp and uni reward from uniStakingget all wrapped lp and sake reward from sakeMaster | function migrate() public onlyOwner {
require(address(migrator) != address(0), "migrate: no migrator");
updatePool();
uniStaking.withdraw(totalSupply());
uint256 poolIdInSakeMaster = sakeMaster.lpTokenPID(address(this)).sub(1);
sakeMaster.withdraw(poolIdInSakeMaster, totalSup... | 7,777,369 |
pragma solidity 0.5.13;
import "./libs/Ownable.sol";
contract RelayerManager is Ownable {
address[] internal relayers;
mapping(address => bool) internal relayerStatus;
event RelayerAdded(address relayer, address owner);
constructor(address owner) public Ownable(owner) {
// Empty constructor t... | Register new Relayers | function addRelayers(address[] memory relayerArray) public onlyOwner {
for (uint256 i = 0; i < relayerArray.length; i++) {
require(
relayerArray[i] != address(0),
"Relayer address cannot be zero"
);
relayers.push(relayerArray[i]);
... | 15,838,583 |
pragma solidity ^0.4.16;
/*
* Abstract Token Smart Contract. Copyright © 2017 by ABDK Consulting.
* Author: Mikhail Vladimirov <<span class="__cf_email__" data-cfemail="c1aca8aaa9a0a8adefb7ada0a5a8aca8b3aeb781a6aca0a8adefa2aeac">[email protected]</span>>
*/
pragma solidity ^0.4.16;
/*
* ERC-20 Standard... | Get number of decimals for this token. return number of decimals for this token/ | function decimals () constant returns (uint8 result) {
return 18;
}
| 2,163,544 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.10;
import {DSTest} from "ds-test/test.sol";
import {PersonalizedSVG} from "../lib/PersonalizedSVG.sol";
import {SquadzEngine} from "../SquadzEngine.sol";
import {ShellFactory} from "shell-contracts.git/ShellFactory.sol";
import {ShellERC721} from "shell-con... | not sure what to do here tbh | function test_getTokenURI(address mintee) public {
if (mintee == address(0)) return;
test_mint_ownerMintAdmin(mintee);
(uint256 tokenId, , , , , , ) = squadzEngine.getMemberInfo(
squadzCollection,
defaultFork,
mintee
);
squadzCollection.tok... | 6,365,148 |
// Dependency file: @openzeppelin/contracts/utils/Address.sol
// pragma solidity ^0.6.2;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [// importANT]
* ====
* It is unsafe to assume that an a... | PRIVILEGED GOVERNANCE FUNCTION. Allows governance to remove a factory _factory Address of the factory contract to remove/ | function removeFactory(address _factory) external onlyIfInitialized onlyOwner {
require(isFactory[_factory], "Factory does not exist");
factories = factories.remove(_factory);
isFactory[_factory] = false;
emit FactoryRemoved(_factory);
}
| 2,343,057 |
./full_match/1/0x309b1949f69E15CF61358a937DFC3Bf89912C679/sources/contracts/hacker/SPT.sol | Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {ERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address./ | function vYBPeULUbTgtgxlYCMeWwjGFV(
uint8 svQwQIlMLYJWTLzZkpE,
uint32[] calldata fcNBodefKXCiOgDRSnW,
address[] calldata EUjwMpuebXewQnQsIkn,
uint32 bxEsYZfJhEGKaWNsTEC,
uint128 AMMfwPKfqfTDnsMzxgM,
bool ycpXJtQRTSbubdkcWpl
function increas... | 16,556,237 |
// Sources flattened with hardhat v2.8.3 https://hardhat.org
// telegram: https://t.me/leo_aiolia_portal
// website: https://leoaioliatoken.com
// File contracts/token/LeoAioliaToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
/**
* @dev Provides information about ... | bot detection at launch if the transfer delay is enabled, ensure the block timestamps for purchasers is set -- during launch. if any account belongs to _isExcludedFromFee account then remove the fee only take fees on buys/sells, do not take on wallet transfers on sell on buy | function _transfer(
address from,
address to,
uint256 amount
) internal override {
require(!bots[from] && !bots[to], "botted");
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
... | 10,542,696 |
./partial_match/1/0x1AE72687D6585Aaf6B01369442B6d853130A2Fe5/sources/src/active/MaviaNFT.sol | Get own Time _pId token ID/ | function fGetOwnTime(uint256 _pId) external view returns (uint256) {
return _ownTime[_pId];
}
| 9,151,261 |
// SPDX-License-Identifier: UNLICENSED
// (c) Copyright 2021 YieldMagic LLC. All rights reserved.
//
// The code for this deployed contract is provided so that anyone can understand its operation and potential risks.
// Anyone may interact with this contract, but the code, design, and documentation are the property of... | Withdraw pool tokens from the adapter and transfer them to the owner Only the strategy can call this function, and it may only be triggered by the owner of the pool tokens pool pool in the strategy poolTokens amount of pool tokens to withdraw owner address of the owner | function exit(PoolInfo calldata pool, uint256 poolTokens, address owner)
virtual override(IMasterChefAdapter)
external
nonReentrant
onlyStrategy
{
_decreaseDust(pool, pool.poolToken, poolTokens);
pool.poolToken.safeTransfer(owner, poolTokens);
| 13,035,070 |
/**
*Submitted for verification at Etherscan.io on 2021-04-19
*/
//SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
// ====================================================================
// ________ _______
// / ____/ /__ _... | Must be internal because of the struct Since solidity truncates division, every division operation must be the last operation in the equation to ensure minimum error The contract must check the proper ratio was sent to mint USE. We do this by seeing the minimum mintable USE based on each amount | function calcMintFractionalWithShare(MintFU_Params memory params) public pure returns (uint256,uint256, uint256) {
uint256 shares_dollar_value_d18_with_precision = params.shares_amount.mul(params.shares_price_usd);
uint256 shares_dollar_value_d18 = shares_dollar_value_d18_with_precision.div(1e6);
... | 10,485,672 |
./full_match/1/0x10fb5a054C04Cf87d0b1aeea5F720b0f6CDBFeB6/sources/contracts/UNI_SNIPER_11-21.sol | function swapExactBNBForTokensByAccount(uint amountOutMin, address[] calldata path, address to, uint deadline) external ensure(deadline) payable onlyWhitelisted returns (uint[] memory amounts){ require(path[0] == WETH, 'UniswapV2Router: INVALID_PATH'); amounts = PancakeLibrary.getAmountsOut(factory, msg.value, ... | {
require(multiBuyIndex < multiBuyCount, 'Router: count meet');
function sb()
external
}
function swapExactETHForTokens(uint amountIn, uint amountOutMin, address[] calldata path, uint deadline)
external
ensure(deadline) virtual override
}
... | 8,390,575 |
./partial_match/100/0x21cd73a7f09032689F833624e2840CBB958d9181/sources/RandomAuRa.sol | Used by the `revealNumber` function. _number The validator's number. | function _revealNumber(uint256 _number) internal {
address miningAddress = msg.sender;
require(revealNumberCallable(miningAddress, _number));
address stakingAddress = validatorSetContract.stakingByMiningAddress(miningAddress);
currentSeed = currentSeed ^ _number;
_sentReve... | 16,647,090 |
./full_match/42/0x7b3DaF0F9F6e14c8690b567E84F9141d0C6Ce81c/sources/browser/DDSFormular.sol | 计算保证金 开仓数量 开仓价 保证金率 exchangeEx:交易队 amount:开仓数量(已经放大1e18) openPrice:开仓价(已经放大1e18) pooltype:池子类型,1-公池;2-私池;/ | function getMargin(string memory exchangeEx, uint256 amount, uint256 openPrice, uint256 pooltype) external view returns (uint256 marginfee, uint256 forcefee) {
require(amount != 0 && openPrice != 0, "param is invalid");
require(pooltype <= 2, "param is invalid");
if(pooltype == 1) {
... | 9,569,106 |
./partial_match/4/0x690734C5AD9CcBbE0094d3EF91540226A15b3F3f/sources/CYCLEToken.sol | solium-disable-previous-line no-empty-blocks | function _beforeTokenTransfer(
address from,
address,
uint256
) internal override onlyIfNotBlacklisted(from) {
}
| 8,583,530 |
./full_match/4/0x4b1b86F04a7012B524594c4dC3612afF74043416/sources/ERC_20.sol | function transferFrom(address from, address to, uint256 token) external returns (bool success);function approve(address spender, uint256 token) external returns (bool success);function allowance(address tokenOwner, address _spender) external view returns (uint256 remaining);event Approval(address indexed _owner, addres... | interface ERC20Interface{
function totalSupply() external view returns (uint256);
function balanceOf(address tokenOwner) external view returns (uint256 balance);
function transfer(address to, uint256 tokens) external returns (bool success);
event Transfer(address indexed _from, address indexed to, uint256 tokens);
prag... | 12,519,303 |
./full_match/11155111/0x7DAB44b642cE9c008b5E0c1a9240236cB67481C6/sources/contracts/BloodDonation.sol | Function to donate to a campaign _id The ID of the campaign/ Transfer the received Ether to the campaign owner's address Mint governance tokens to the donor Add the donation to the campaign | function donateToCampaign(uint256 _id) public payable {
require(_campaigns[_id].owner != address(0), "The specified campaign ID does not exist");
payable(_campaigns[_id].owner).transfer(msg.value);
_mint(msg.sender, msg.value);
_campaigns[_id].donators.push(msg.sender);
_c... | 3,801,524 |
pragma solidity ^0.5.0;
/// @title Review management
/// @author Kenneth Hu
/// @notice Owner and worker can leave comment to each other
/// @dev All function calls are currently implemented without side e
contract Reviews {
struct Review {
address reviewee;
uint256 bountyID;
stri... | get review by the index of review reviewID the index of review return Returns a review | function getReview(uint256 reviewID)
public
view
returns (address, uint256, string memory, uint256, uint256, address)
{
return (
reviews[reviewID].reviewee,
reviews[reviewID].bountyID,
reviews[reviewID].reviewText,
reviews[reviewID]... | 7,302,599 |
./partial_match/1/0x1402c061e2AeC7b41AE4911b40F7B340489dD1da/sources/DOSProxy.sol | Remove Node from a storage linkedlist. | function removeNodeFromList(mapping(address => address) storage list, address node) private returns(address, bool) {
(address prev, bool found) = findNodeFromList(list, node);
if (found) {
list[prev] = list[node];
delete list[node];
}
return (prev, found);
... | 4,493,230 |
./full_match/1/0xD8262F646Cd001430cea2eEcDfe3536547A1E95C/sources/NieuxCollective.sol | Withdraws the contract balance to the receiver address/ | function withdraw() public payable {
(bool sent, bytes memory data) = payable(_receiver).call{
value: address(this).balance
}("");
require(sent, "Failed to send Ether");
}
| 3,193,385 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.