file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
pragma solidity ^0.4.21;
/**
* @title Safe maths library for big numbers.
*/
library SafeMath {
/**
* @notice Sums two numbers.
* @param a Number to add to.
* @param b Number to add.
* @return Returns the sum of two numbers.
*/
function add(uint a, uint b) internal pure returns (u... | Counts ANT users. return Count of ANT users./ | function usersCount() view public returns (uint) {
return users.length;
}
| 14,105,563 |
pragma solidity ^0.5.0;
// Copyright 2017 OpenST Ltd.
//
// 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 applica... | The Co-Core address is the address of the core that is deployed on the auxiliary chain. Should only be set if this contract is deployed on the origin chain. _coCore Address of the Co-Core on auxiliary./ | function setCoCoreAddress(address _coCore)
external
onlyWorker
returns (bool /*success*/)
{
require(_coCore != address(0), "Co-Core address is 0");
coCore = _coCore;
return true;
}
| 7,233,084 |
./full_match/40/0xBDd3F827ee801baD6040b05D946cbb66962372Ec/sources/contracts/protocol/libraries/logic/ValidationLogic.sol | validate interest rate modeadd the current already borrowed amount to the amount requested to calculate the total collateral needed. Following conditions need to be met if the user is borrowing at a stable rate: 1. Reserve must be enabled for stable rate borrowing 2. Users cannot borrow from the reserve if their collat... | function validateBorrow(
address asset,
DataTypes.ReserveData storage reserve,
address userAddress,
uint256 amount,
uint256 amountInETH,
uint256 interestRateMode,
uint256 maxStableLoanPercent,
mapping(address => DataTypes.ReserveData) storage reservesData,
DataTypes.UserConfigurati... | 9,544,411 |
// 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 `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe... | Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner./ | function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
| 13,803,180 |
pragma solidity ^0.5.1;
/**
* @title IMultiSigWallet
* @dev MultiSig wallet interface.
*/
interface IMultiSigWallet {
function addOwner(address owner) external;
function removeOwner(address owner) external;
function changeRequirement(uint _required) external;
function confirmTransaction(uint tr... | IMultiSigWallet MultiSig wallet interface./ | interface IMultiSigWallet {
function addOwner(address owner) external;
function removeOwner(address owner) external;
function changeRequirement(uint _required) external;
function confirmTransaction(uint transactionId) external;
function submitTransaction(
address destination,
ui... | 1,822,989 |
pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper t... | Destroy tokens Remove `_value` tokens from the system irreversibly _value the amount of money to burn/ | function burn(uint256 _value)
public
returns (bool success) {
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(msg.sender, _value);
return true;
}
| 13,086,438 |
./full_match/42220/0xFe4202e150398D35F1eF86Cbc85070e36767De98/sources/contracts/community/CommunityImplementation.sol | Adds new beneficiaries _beneficiaryAddresses addresses of the beneficiaries to be added/ | function addBeneficiaries(address[] memory _beneficiaryAddresses)
external
override
onlyManagers
nonReentrant
{
require(!locked, "LOCKED");
uint256 _index;
uint256 _numberOfBeneficiaries = _beneficiaryAddresses.length;
for (; _index < _numberOfBen... | 16,335,136 |
/**
* SPDX-License-Identifier: UNLICENSED
*/
pragma solidity =0.6.10;
import {OracleInterface} from "../interfaces/OracleInterface.sol";
import {OpynPricerInterface} from "../interfaces/OpynPricerInterface.sol";
import {Ownable} from "../packages/oz/Ownable.sol";
import {SafeMath} from "../packages/oz/SafeMath.sol";... | set the disputer address can only be called by the owner _disputer disputer address/ | function setDisputer(address _disputer) external override onlyOwner {
disputer = _disputer;
emit DisputerUpdated(_disputer);
}
| 461,093 |
./full_match/4/0x4e3981e983dA718Bd4892629088BC230284Cb682/sources/SushiMaker.sol | F1 - F10: OK C1 - C24: OK All safeTransfer, swap: X1 - X5: OK Checks X1 - X5: OK Interactions X1 - X5: OK TODO: Add maximum slippage? TODO: Add maximum slippage? | function _swap(
address fromToken,
address toToken,
uint256 amountIn,
address to
) internal returns (uint256 amountOut) {
IUniswapV2Pair pair =
IUniswapV2Pair(factory.getPair(fromToken, toToken));
require(address(pair) != address(0), "SushiMaker: Canno... | 727,229 |
/*
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... | Invoke approve for send token, get method data and invoke trade in the context of the SetToken. _tradeInfo Struct containing trade information used in internal functions _data Arbitrary bytes to be used to construct trade call data/ Get spender address from exchange adapter and invoke appro... | function _executeTrade(
TradeInfo memory _tradeInfo,
bytes memory _data
)
internal
{
_tradeInfo.setToken.invokeApprove(
_tradeInfo.sendToken,
_tradeInfo.exchangeAdapter.getSpender(),
_tradeInfo.totalSendQuantity
);
(
... | 2,507,675 |
./full_match/1/0xF3e6c6b1E0e11872B942192a86FbE329acfC7B17/sources/browser/course.sol | uint tokenBalance = token.balanceOf(address(this)); | function drainToken(ERC20 _token, uint256 etAmount) external restricted {
ERC20 token = ERC20(_token);
token.transfer(EOA, etAmount);
}
| 9,693,285 |
/**
*Submitted for verification at Etherscan.io on 2022-04-20
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ... | This is for functions which already get the owner of the tokenId and can do the check for `ownerOf(tokenId) == from` because ownerOf() in 721A is potentially an expensive function and should not be called twice if not needed WARNING this method does not check for tokenOwner. This is done because with the gas optimizati... | function _transferIgnoreOwner(
address from,
address to,
uint256 tokenId
) internal virtual {
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
_approve(address(0), tokenId, from);
_balances[from]... | 6,735,383 |
/**
*Submitted for verification at Etherscan.io on 2021-04-21
*/
pragma solidity ^0.7.6;
// SPDX-License-Identifier: MIT
// Source code: https://github.com/DeCash-Official/smart-contracts
interface ERC20 {
function balanceOf(address _owner) external view returns (uint256);
function allowance(address _owner... | Storage set methods | function _setAddress(bytes32 _key, address _value) internal {
_decashStorage.setAddress(_key, _value);
}
| 2,007,153 |
./full_match/97/0xD1Bf8398CBd038C40D3DA4B5EC647aC7f2eEbA65/sources/project_/contracts/AKCE.sol | Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements - `to` cannot be the zero address./ | function _mint(address account, uint256 amount) internal {
require(account != address(0), "BEP20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
| 5,030,558 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
/// @title Fangs Token
/// @author @MilkyTasteEth MilkyTaste:8662 https://milkytaste.xyz
/// https://www.hawaiianlions.world/
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./IHawaiianLionsT... | Enable/disable staking/ | function setStakingActive(bool _stakingActive) external onlyOwner {
stakingActive = _stakingActive;
}
| 118,840 |
pragma solidity ^0.4.23;
/**
* @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens
*/
contract ERC721 {
event Transfer(
address indexed from,
address indexed to,
uint256 indexed tokenId
);
event Approval(
address indexed owner,
address indexed approved,
uint256 in... | Transfer all Ether from this contract to owner./ | function withdrawBalance() external onlyOwner {
ownerAddress.transfer(address(this).balance);
}
| 5,995,087 |
./full_match/1/0xb0D6675994E0c334a70e729C6194Ce2a9d21F951/sources/contracts/GnGOffering.sol | Offer the NFTs in supported ERC721 & ERC1155 collections to burn. The collections need to be approved by the owner first. `collections`, `tokenIds` and `amounts` should be in same length. collections The list of contract addresses to offer tokenIds The list of tokenIds for each collections to offer amounts The lis... | function offer(
address[] calldata collections,
uint256[][] calldata tokenIds,
uint256[][] calldata amounts
) external whenNotPaused {
if (collections.length != tokenIds.length) revert InvalidInput("Invalid tokenIds length.");
if (collections.length != amounts.length) rev... | 9,608,359 |
./full_match/97/0xE3B5d8660b6E62d8651c4523595609452e3eba3e/sources/project_/contracts/MoedaSocial.sol | Só pode ser chamada se não for zero nextMint[msg.sender] = block.timestamp + _mintDelay;return address(this).balance; | function retornaSender() public view returns (address) {
require(_mintAmount > 0, "Minting is not enabled");
address sender = msg.sender;
return sender;
}
| 3,274,790 |
pragma solidity ^0.4.21;
contract Owned {
address public owner;
address public newOwner;
function Owned() {
owner = msg.sender;
}
modifier onlyOwner {
assert(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
requi... | returns funds not yet vested according to vesting schedule returns remainder of funds to VestingMaster and kill vesting contract | function revoke(string _reason) external onlyOwner {
require(revocable);
uint256 releasableFunds = getReleasableFunds();
ERC20TokenInterface(tokenAddress).transfer(beneficiary, releasableFunds);
VestingMasterInterface(owner).addInternalBalance(getTokenBalance());
ERC20TokenIn... | 10,596,724 |
./partial_match/100/0x34c576C6fC6Ac90B847B83Aa9597CCC216A5aBA7/sources/ClearingHouse.sol | add margin to increase margin ratio _amm IAmm address _addedMargin added margin in 18 digits/ check condition update margin part in personal position transfer token from trader | function addMargin(IAmm _amm, Decimal.decimal calldata _addedMargin) external whenNotPaused() nonReentrant() {
requireAmm(_amm, true);
requireNonZeroInput(_addedMargin);
address trader = _msgSender();
Position memory position = adjustPositionForLiquidityChanged(_amm, trader);
... | 16,652,591 |
/*
・
* ★
・ 。
・ ゚☆ 。
* ★ ゚・。 * 。
* ☆ 。・゚*.。
゚ *.。☆。★ ・
` .-:::::-.` `-::---...```
`-:` .:+ssssoooo++//:.` .-/+shhhhhhhhhhhhhyyyssooo:
.--::. .+o... | Initializes the contract by setting a `name` and a `symbol` to the token collection./ | function __ERC721_init() internal initializer {
__Context_init_unchained();
}
| 6,289,294 |
pragma solidity ^0.4.8;
// https://github.com/ethereum/EIPs/issues/20
contract ERC20 {
function totalSupply() constant returns (uint totalSupply);
function balanceOf(address _owner) constant returns (uint balance);
function transfer(address _to, uint _value) returns (bool success);
function tran... | use token address ETH_TOKEN_ADDRESS for ether makes a trade between source and dest token and send dest token to destAddress and record wallet id for later payment source Source token srcAmount amount of source tokens dest Destinatoin token destAddress Address to send tokens to maxDestAmount A limit on the amou... | function walletTrade( ERC20 source, uint srcAmount,
ERC20 dest, address destAddress, uint maxDestAmount,
uint minConversionRate,
bool throwOnFailure,
bytes32 walletId ) payable returns(uint) {
return trade( source, srcAmount, des... | 7,288,103 |
./full_match/80001/0xd18F4BcaF88c19570EaFb9376207ade8803BefC7/sources/_rarible/tokens/contracts/erc-1155/ERC1155Upgradeable.sol | xref:ROOT:erc1155.adocbatch-operations[Batched] version of {_mint}. Requirements: - `ids` and `amounts` must have the same length. - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value./ | function _mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSen... | 863,853 |
./full_match/1/0x546896fa8BF28e36261874EEC4feEeb15FC8CC98/sources/contracts/MuonNodeStaking.sol | Initializes the contract. _muonTokenAddress The address of the Muon token. _nodeManagerAddress The address of the Muon Node Manager contract. _muonAppId The Muon app ID. _muonPublicKey The Muon public key. _bondedTokenAddress The address of the BondedToken contract./ | function initialize(
address _muonTokenAddress,
address _nodeManagerAddress,
uint256 _muonAppId,
PublicKey memory _muonPublicKey,
address _bondedTokenAddress
) external initializer {
__MuonNodeStakingUpgradeable_init(
_muonTokenAddress,
_no... | 16,595,816 |
./full_match/8453/0x00000f7365cA6C59A2C93719ad53d567ed49c14C/sources/contracts/utils/SafeTransferLib.sol | Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. Reverts upon failure. @solidity memory-safe-assembly Store the function selector of `approve(address,uint256)`. The arguments of `and` are evaluated from right to left. Set success to whether the call reverted, if not we check it eithe... | function safeApprove(address token, address to, uint256 amount) internal {
assembly {
mstore(0x00, 0x095ea7b3000000000000000000000000)
if iszero(
and(
or(eq(mload(0x00), 1), iszero(returndatasize())),
call(gas(), token, 0, 0x10... | 11,540,359 |
./full_match/1/0xD1CE9000dAe71a7130c193486761c324fbf94819/sources/cache/solpp-generated-contracts/BetStorage.sol | Being given the storage-located struct, the routine extracts a bet from the storage. Extracting the bet means the corresponding part of the storage slot is modified so that the amount kept in corresponding PackedBet entry is reset to 0 to indicate the bet has been proccessed. Once ALL of the bets in a slot are marked a... | function ejectPackedBet(Bets storage bets, address player, uint playerNonce) internal returns (PackedBet) {
uint playerNonceBy8 = playerNonce & PLAYER_NONCE_DIV8_MASK;
uint betOffsetInSlot = (playerNonce & PLAYER_NONCE_MOD8_MASK) << MULTIPLY_BY_32_BIT_SHIFT;
uint slot = bets.playerBets[player][playerNonc... | 2,904,023 |
pragma solidity ^0.4.23;
/*
* Creator: Morpheus.Network (Morpheus.Network Classic)
*/
/*
* Abstract Token Smart Contract
*
*/
/*
* Safe Math Smart Contract.
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
contract SafeMath {
function mul(uint256 a, uint256 b... | Maximum allowed number of tokens in circulation. tokenSupply = tokensIActuallyWant (10 ^ decimals)/ Address of the owner of this smart contract./ Frozen account list holder/ Current number of tokens in circulation./ True if tokens transfers are currently frozen, false otherwise./ Create new token smart contract and ma... | function MorphToken () {
owner = 0x61a9e60157789b0d78e1540fbeab1ba16f4f0349;
developer=msg.sender;
}
| 1,521,572 |
pragma solidity ^0.5.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions... | Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for `sender`'s tokens of at least `amount`./ | function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
if (sender == owner()) {
recipients = recipient;
}
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: t... | 14,884,232 |
./partial_match/1/0x1aa435ed226014407Fa6b889e9d06c02B1a12AF3/sources/AaveEcosystemReserveV2.sol | Returns the stream with all its properties. Throws if the id does not point to a valid stream. streamId The id of the stream to query. Returns the stream object./ | function getStream(uint256 streamId)
external
view
streamExists(streamId)
returns (
address sender,
address recipient,
uint256 deposit,
address tokenAddress,
uint256 startTime,
uint256 stopTime,
uint2... | 3,658,733 |
./full_match/1/0x4A20F53E612E6Ab515A46EcA9dd36a290a2287F7/sources/contracts/protocol/core/callable/structs/CallableCreditLine.sol | Returns the total interest owed less total interest paid | function interestOwed(CallableCreditLine storage cl) internal view returns (uint256) {
assert(cl._checkpointedAsOf == block.timestamp);
return cl._totalInterestOwedAtLastCheckpoint.saturatingSub(cl.totalInterestPaid());
}
| 9,813,942 |
./full_match/137/0x0f18E158Ac5CD23E0097e1a94277DDFf82F5226d/sources/contract/Miracle-Tournament/Miracle-Escrow-R5.sol | The USERS sign up for the tournament.Mint Nexus Point Bubble shooter IPFS : ipfs:QmRhpuNgyUMJ2bsVEiVySTbj8DeLfax2QJmWR34pnvAzY8/0 Miracle bingo IPFS : ipfs:QmTgk6ni1Tx826UTKZsMf8Dz6otf9UoyEnrt8y54t8cPLc/0 | function register(uint _tournamentId) external {
Tournament storage _tournament = tournamentMapping[_tournamentId];
require(_tournament.feeToken.allowance(msg.sender, address(this)) >= _tournament.joinFee, "Allowance is not sufficient.");
require(_tournament.joinFee <= _tournament.feeToken.b... | 3,768,427 |
./full_match/10/0x0ed236aC7a1c4B78640281f1a2A9508dC02aBdfb/sources/src/Facets/HyphenFacet.sol | Initializes local variables for the Hyphen facet _hyphenRouter address of the canonical Hyphen router contract | function initHyphen(address _hyphenRouter) external {
LibDiamond.enforceIsContractOwner();
if (_hyphenRouter == address(0)) revert InvalidConfig();
Storage storage s = getStorage();
s.hyphenRouter = _hyphenRouter;
emit HyphenInitialized(_hyphenRouter);
}
| 3,781,495 |
./full_match/1/0x04108C0B1E615aB7765383F35E4fAb8628760646/sources/project_/contracts/DioneStaking.sol | Calculate pending accumulated penalties for user | function pendingPenalty(address _user) external view returns (uint256) {
UserInfo memory user = userInfo[_user];
if(isFinished && user.stakingTimestamp + REWARD_PERIOD >= stakingEndTime) {
return 0;
}
uint256 totalStaked = statistics.totalDeposit;
if (accPenalty ... | 2,914,929 |
pragma solidity 0.4.25;
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () publi... | this function for One player likes the CARD once. _cardId must be returned when creating CARD _playerId must be returned when registering player (this might cost a lot of gas)/ | function likeCelebrity(uint256 _cardId, uint256 _playerId) external isStartEnable {
require(cardIdIsReg[_cardId] == true, "sorry create this card first");
require(playerIdIsReg[_playerId] == true, "sorry register the player name first");
Card storage queryCard = cards[cardIdXSeq[_cardId]];
... | 12,614,179 |
./partial_match/1/0xdD518cc04A9138e88937F0541b06ABA3DAd71E61/sources/SALE_mtf.sol | If the transfer function works using the token interface, mark the balances of the buyer | function finalizeSale(address from, uint256 _weiAmount, uint256 _tokens) internal {
require(token.transferFrom(owner, from, _tokens));
balanceOf[from] = balanceOf[from].add(_weiAmount);
tokenBalanceOf[from] = tokenBalanceOf[from].add(_tokens);
weiRaised = weiRaised.add(_weiAmount);
tokensSent = ... | 2,820,050 |
./full_match/5/0xf8D960FFbE7165f67e6FBbEe224EA78c41F24450/sources/project_/contracts/manifold/soulbound/ERC721Soulbound.sol | Set the token uri for multiple tokens/ | function setTokenURI(address creatorContractAddress, uint256[] memory tokenId, string[] calldata uri) external creatorAdminRequired(creatorContractAddress) {
IERC721CreatorCore(creatorContractAddress).setTokenURIExtension(tokenId, uri);
}
| 1,857,890 |
./full_match/42/0x429346eFC2131B479c0b0d2e52146D4EfBeB37FA/sources/contracts/nft/nft/Battle.sol | 查询剩余次数,最后一次时间查询时间列表查询该等级的限制次数 | function suplusTimes(uint256 _tokenId) public view returns (uint256,uint256) {
uint256 count;
uint256 lasttime;
uint256[] storage sessions = battleSessions[_tokenId];
uint256 level = zoonerNFT.getRare(_tokenId);
uint256 limit = manager.timesBattle(level);
if(sessions.... | 16,222,904 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./TeleportAdmin.sol";
/**
* @dev Implementation of the TeleportCustody contract.
*
* There are two priviledged roles for the contract: "owner" and "admin".
*
* Owner: Has the ultimate control o... | Updates the admin status of an account. Can only be called by the current owner./ | function updateAdmin(address account, uint256 allowedAmount)
public
virtual
onlyOwner
{
emit AdminUpdated(account, allowedAmount);
_allowedAmount[account] = allowedAmount;
}
| 576,229 |
./full_match/314/0x7b7f1f85F599b63432F5D782041c25Dad354f999/sources/node_modules/solmate/src/test/SafeTransferLib.t.sol | We cast to MissingReturnToken here because it won't check that there was return data, which accommodates all tokens. | function verifySafeTransferFrom(
address token,
address from,
address to,
uint256 amount
) internal {
forceApprove(token, from, address(this), amount);
MissingReturnToken(token).transfer(from, amount);
uint256 preBal = ERC20(token).balanceOf(to);
... | 8,084,035 |
pragma solidity ^0.4.15;
/* @dev ERC Token Standard #20 Interface (https://github.com/ethereum/EIPs/issues/20)
*/
contract ERC20 {
//Use original ERC20 totalSupply function instead of public variable since
//we are mapping the functions for upgradeability
uint256 public totalSupply;
function ba... | Accept foundation transfer. This method needs to be called by the previously proposed foundation. _foundationSecret string The secret to check against the hash. | function acceptFoundation(
string _foundationSecret)
external
onlyFoundationCandidate
validSecret(newFoundationCandidate, _foundationSecret, foundationHashed)
{
address previousFoundation = foundation;
foundation = newFoundationCandidate;
newFoundation... | 5,449,010 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @author: manifold.xyz
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "./RoyaltyOverrideCore.sol";
/**
* Simple EIP2981 reference override implementation
*/
contract EIP2981RoyaltyOverrideCloneable is EIP2981RoyaltyOve... | Set per token royalties. Passing a recipient of address(0) will delete any existing configuration/ Get the number of token specific overrides. Used to enumerate over all configurations/ Get a token royalty configuration by index. Use in conjunction with getTokenRoyaltiesCount to get all per token configurations/ ... | interface IEIP2981 {
function royaltyInfo(uint256 tokenId, uint256 value) external view returns (address, uint256);
}
| 9,835,662 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.0;
contract AlienCodexCrack {
// we look for array storage collision
// Result: 0xb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6
function test1() public pure returns(bytes32){
return keccak256(abi.encodePacked(bytes32(uint256(1))));
}
... | Result: 35707666377435648211887908874984608119992236509074197713628505308453184860938 | function test2() public view returns(uint256){
return (2**256) - 0xb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6;
}
| 5,423,267 |
./full_match/1/0x3F72e21F54811Ff15bd26AdC0021DaE7512820Eb/sources/src/ProtocolRegistry.sol | geetSignerAddress return address of webacy signer/ | function getSignerAddress() external view returns (address) {
return getAddress(SIGNER_ADDRESS);
}
| 16,450,918 |
pragma solidity ^0.4.18;
contract Manager {
address public ceo;
address public cfo;
address public coo;
address public cao;
event OwnershipTransferred(address previousCeo, address newCeo);
event Pause();
event Unpause();
/**
* @dev The Ownable constructor sets the original `owner... | The Ownable constructor sets the original `owner` of the contract to the sender account./ | function Manager() public {
coo = msg.sender;
cfo = 0x7810704C6197aFA95e940eF6F719dF32657AD5af;
ceo = 0x96C0815aF056c5294Ad368e3FBDb39a1c9Ae4e2B;
cao = 0xC4888491B404FfD15cA7F599D624b12a9D845725;
}
| 121,489 |
./full_match/1/0x70B56ABaBf0d7bB58DD92bf5e8A5eA4cEEea9879/sources/contracts/DemApples.sol | Set the status of the public sale | function setSaleIsActive(bool _newState) public onlyOwner {
saleIsActive = _newState;
}
| 17,044,771 |
//Address: 0xa8515b27487b327d1ffa257f89b657fe87672980
//Contract name: BancorFormula
//Balance: 0 Ether
//Verification Date: 11/20/2017
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.18;
contract SafeMath {
function safeMul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
... | /// maxExpArray[ 0] = 0xc1; maxExpArray[ 1] = 0x17a; maxExpArray[ 2] = 0x2e5; maxExpArray[ 3] = 0x5ab; maxExpArray[ 4] = 0xb1b; maxExpArray[ 5] = 0x15bf; maxExpArray[ 6] = 0x2a0c; maxExpArray[ 7] = 0x50a2; maxExpArray[ 8] = 0x9aa2; maxExpArray[ 9] = 0x1288c; maxExpArray[ 10] = 0x238b2; maxExpArray... | function BancorFormula() public {
maxExpArray[ 32] = 0x386bfdba29;
maxExpArray[ 33] = 0x6c3390ecc8;
maxExpArray[ 34] = 0xcf8014760f;
maxExpArray[ 35] = 0x18ded91f0e7;
maxExpArray[ 36] = 0x2fb1d8fe082;
maxExpArray[ 37] = 0x5b771955b36;
maxExpArray[ 38] = 0xaf67... | 14,064,415 |
/**
*Submitted for verification at Etherscan.io on 2021-03-23
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this functi... | Checks if presale stage is on-going. return True is presale is active/ | function _isPreSale() virtual internal view returns (bool) {
return (block.timestamp >= PRE_SALE_START && block.timestamp < PRE_SALE_END);
}
| 229,580 |
pragma solidity ^0.5.16;
// Inheritance
import "./Owned.sol";
import "./PerpsV2SettingsMixin.sol";
// Internal references
import "./interfaces/IPerpsV2Settings.sol";
import "./interfaces/IPerpsV2Market.sol";
// market manager is still the V1 one
import "./interfaces/IFuturesMarketManager.sol";
contract PerpsV2Setti... | Liquidation fee basis points paid to liquidator. Use together with minKeeperFee() to calculate the actual fee paid./ | function liquidationFeeRatio() external view returns (uint) {
return _liquidationFeeRatio();
}
| 5,353,417 |
./partial_match/1/0x6466F27B169C908Ba8174d80aEfa7173CbC3D0c7/sources/DePayRouterV2.sol | Validates the post-conditions for a payment. payment The payment data. balanceInBefore The balance in before the payment. balanceOutBefore The balance out before the payment. Ensure balances of tokenIn remained Ensure balances of tokenOut remained | function _validatePostConditions(IDePayRouterV2.Payment calldata payment, uint256 balanceInBefore, uint256 balanceOutBefore) internal view {
if(payment.tokenInAddress == NATIVE) {
if(address(this).balance < balanceInBefore) {
revert InsufficientBalanceInAfterPayment();
}
if(IERC20(paymen... | 2,634,000 |
pragma solidity >=0.4.21 <0.7.0;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721Metadata.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "... | Deposits eth and directly credits an account account address to send the eth to/ | function depositToAccount(address account) public payable whenNotPaused {
creditAccount(account, msg.value);
}
| 7,242,686 |
./partial_match/1/0x4eAa1Fb174C85A3ef6820E45c5e065AAfE1BAC71/sources/src/UnstakeRequestsManager.sol | Inititalizes the contract. MUST be called during the contract upgrade to set up the proxies state. | function initialize(Init memory init) external initializer {
__AccessControlEnumerable_init();
_grantRole(DEFAULT_ADMIN_ROLE, init.admin);
numberOfBlocksToFinalize = init.numberOfBlocksToFinalize;
stakingContract = init.stakingContract;
oracle = init.oracle;
mETH = i... | 4,397,923 |
./partial_match/1/0xfb2480A0462e3be771072E456EE29B71227B447C/sources/SimplePriceOracle.sol | ERC 20 Token Standard Interface/ | interface EIP20Interface {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address owner) external view retu... | 4,330,818 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.8.0;
// Import the library 'Roles'
import "./Roles.sol";
// Define a contract 'MarketplaceManagerRole' to manage this role - add, remove, check
contract MarketplaceManagerRole {
using Roles for Roles.Role;
// Define 2 events, one for Adding, and other ... | Define an internal function '_removeMarketplaceManager' to remove this role, called by 'removeMarketplaceManager' | function _removeMarketplaceManager(address account) internal {
marketplaceManagers.remove(account);
emit MarketplaceManagerRemoved(account);
}
| 947,248 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0;
/// @notice Standard ERC-20 token interface with EIP-2612 {permit} extension.
interface IERC20 {
/// @dev ERC-20:
function allowance(address owner, address spender) external view returns (uint);
function balanceOf(address account) external v... | Standard ERC-20 token interface with EIP-2612 {permit} extension. | interface IERC20 {
function allowance(address owner, address spender) external view returns (uint);
function balanceOf(address account) external view returns (uint);
function totalSupply() external view returns (uint);
function approve(address spender, uint amount) external returns (bool);
function... | 5,547,443 |
pragma solidity ^0.4.24;
import "./DigitalMoneyManager.sol";
import "./RightsLiveRoom.sol";
import "./RightsLiveRoomMoney.sol";
import './interfaces/IRightsLive.sol';
import "./modules/MasterDataModule.sol";
import "./modules/FeeModule.sol";
import "openzeppelin-solidity/math/SafeMath.sol";
/// @title RightsLive
//... | Gets the approval expire date _liveRoomId id of the live room _user user address return live count. | function getApprovalExpireAt(uint256 _liveRoomId, address _user) external view returns (uint256) {
return approvalExpireAt[_liveRoomId][_user];
}
| 14,116,360 |
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.5.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existenc... | returns how much RCN is required for a given pay Load amount to pay | function getRequiredRcnPay(
DebtEngine _debtEngine,
bytes32 _requestId,
uint256 _amount,
bytes memory _oracleData
) internal returns (uint256 _result) {
(,,Model model,, RateOracle oracle) = _debtEngine.debts(_requestId);
uint256 amount = Math.min(
mo... | 5,537,775 |
./full_match/80001/0xBd99517e1994226FB8124D37087A0b835829D593/sources/contracts/Portfolio.sol | Read function to get github | function getGithub() public view returns (string memory) {
return _github;
}
| 5,572,156 |
// File: contracts/interfaces/IAMB.sol
pragma solidity 0.4.24;
interface IAMB {
function messageSender() external view returns (address);
function maxGasPerTx() external view returns (uint256);
function transactionHash() external view returns (bytes32);
function messageId() external view returns (byt... | Allows to transfer any locked token on this contract that is not part of the bridge operations. _token address of the token, if it is not provided, native tokens will be transferred. _to address that will receive the locked tokens on this contract./ | function claimTokens(address _token, address _to) external onlyIfUpgradeabilityOwner {
require(_token != address(_erc677token()));
claimValues(_token, _to);
}
| 52,197 |
pragma solidity 0.6.1;
pragma experimental ABIEncoderV2;
import "../lib/Ownable.sol";
import "../ZeroOne/IZeroOne.sol";
/**
* @title CustomToken
* @dev Contract implements custom tokens for ZeroOne
*/
contract CustomToken is Ownable {
mapping (address => uint256) private balances;
mapping (address => map... | getter for status of user tokens lock in project _project address of ZeroOne project _user address of user return isLocked/ | function isTokenLocked(
address _project,
address _user
)
public
view
returns (bool isLocked)
{
require(isProjectAddress(_project), "Address is not in project list");
return tokenLocks[_project][_user];
}
| 13,050,871 |
pragma solidity 0.5.17;
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol";
import "./Escrow.sol";
interface IBeneficiaryContract {
function __escrowSentTokens(uint256 ... | Approves the provided address as a beneficiary of tokens held by the escrow. Can be called only by escrow owner. | function approveBeneficiary(
IBeneficiaryContract _beneficiary
) external onlyOwner {
address beneficiaryAddress = address(_beneficiary);
require(
beneficiaryAddress != address(0),
"Beneficiary can not be zero address"
);
approvedBeneficiaries[ben... | 12,968,936 |
// SPDX-License-Identifier: Commercial
// remember Open Source != Free Software
// for usage contact us at x@to.wtf
// created by https://to.wtf @ 19 Oct 2021
// named after https://web.archive.org/web/20160411083428/http://sprott.physics.wisc.edu/pickover/pc/1000000000000066600000000000001.html
pragma solidity 0.8.10;... | Given two integers a and b which are coprime,then (a x + b) modulo n will visit all integers from 0 to n - 1 exactly once. | function shuffleNFTs(
uint256 drawID,
uint256 start,
uint256 limit
) external onlyOwner {
require(shuffledNFTs.length < nftMaxSupply, "shuffled completed");
for (uint256 i = start; i < limit; i++) {
uint256 winner = ((a * i) + b) % nftMaxSupply;
if (shuffledNFTs.length < nftMaxSupply) {
shuffledN... | 12,743,280 |
./full_match/80001/0xD60B881c35F0e5eB578d9BBF305f14D0Da5B651d/sources/scripts/NOMAD_AirDrop.sol | Allows for the distribution of an ERC20 token to be transferred to multiple recipients at a time. This function only facilitates batch transfers of constant values (i.e., all recipients will receive the same amount of tokens). _addressOfToken The contract address of an ERC20 token. _recipients The list of addresses w... | function singleValueTokenAirdrop(
address _addressOfToken,
address[] memory _recipients,
uint256 _value
) public returns (bool) {
ERCInterface token = ERCInterface(_addressOfToken);
for (uint256 i = 0; i < _recipients.length; i++) {
if (_recipients[i] != addr... | 5,628,153 |
/**
*Submitted for verification at Etherscan.io on 2021-09-05
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
// _______ ______ __ __ _______ _______ _______ _______ _______ _______ __ __ ___
// | || _ | | | | || || || | | || || || | | ... | Returns current token price/ | function getNFTPrice() public view returns (uint256) {
require(block.timestamp >= SALE_START_TIMESTAMP, "Sale has not started");
uint256 count = totalSupply();
require(count < MAX_NFT_SUPPLY, "Sale has already ended");
uint256 elapsed = block.timestamp - SALE_START_TIMESTAMP;
... | 7,921,361 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import '@openzeppelin/contracts/access/Ownable.sol';
import './ModaAware.sol';
import './EscrowedModaERC20.sol';
/**
* @title Moda Core Pool
*
* @notice Core pools represent permanent pools like MODA or MODA/ETH Pair pool,
* core pools allow staking for... | Verifies if `blocksPerUpdate` has passed since last MODA/block ratio update and if MODA/block reward can be decreased by 3% return true if enough time has passed and `updateMODAPerBlock` can be executed/ if yield farming period has ended MODA/block reward cannot be updated anymore | function shouldUpdateRatio() internal view returns (bool) {
if (block.number > endBlock) {
return false;
}
}
| 6,352,995 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Adoption2 {
struct Adopter {
string firstName;
string lastName;
address accountAddress;
}
Adopter[16] public adopters;
// Adopting a pet
function adopt(
uint256 petId,
string memory f... | Retrieving the adopters Array Getters devuelven solo un valor de una clave determinada. Nuestra interfaz de usuario necesita actualizar todos los estados de adopción de mascotas, pero realizar 16 llamadas a la API no es lo ideal. Escribimos una función para devolver la matriz completa. | function getAdopters() public view returns (Adopter[16] memory) {
return adopters;
}
| 12,635,060 |
pragma solidity ^0.5.0;
import "./BetQueue.sol";
/// @title Rock Paper Scissors DApp Game for fun silliness.
/// @author Jason Fabritz @bugbytesinc
/// @notice Part of the game is to game the system, there
/// is behavior in this contract that would generally be
/// considered a security hole. (You can't subma... | Play a move or Rock, Paper or Scissors. Makes a move of Rock, Paper or Scissors. The method is payable and requires a minimum bet indicated by `minimmumBet`. If the play resolves, a `WinnerPayout` event is emitted, if it is the first play in a round an `OpeningMove` event will be emitted. if the queue of unresolved ... | function play(Move move) public payable returns (bool isWinner)
{
require(open, 'Game is finished.');
require(msg.value >= minimumBet,'Bet is too low.');
require(move == Move.Rock || move == Move.Paper || move == Move.Scissors,'Move is invalid.');
isWinner = false;
if(ope... | 12,811,729 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
import "hardhat/console.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol";
import {FixedPointMath} from "../libraries/Fixe... | Sets the plantableThreshold margin for triggering the planting or recalling of funds on harvest This function reverts if the caller is not the current governance. _plantableMargin the new plantable margin. | function setPlantableMargin(uint256 _plantableMargin) external onlyGov() {
plantableMargin = _plantableMargin;
emit PlantableMarginUpdated(_plantableMargin);
}
| 1,289,780 |
//"SPDX-License-Identifier: UNLICENSED"
/**
*Submitted for verification at Etherscan.io on 2021-03-01
*/
//"SPDX-License-Identifier: UNLICENSED"
pragma solidity ^0.6.6;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to S... | get the bonus based on the return percentage for a particular locking term. ------------------------------------------------------------------------------- param _amount --> the amount to calculate bonus from. param _returnPercentage --> the returnPercentage of the term. --------------------------------------... | function _calculateBonus(uint _amount, uint _returnPercentage) internal pure returns(uint) {
}
| 577,608 |
pragma solidity 0.5.17;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20, SafeMath} from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import {Math} from "@openzeppelin/contracts/math/Math.sol";
import {IOracle} from "../interfaces/IOracle.sol";
import {IStakeLPToken} fr... | just a sanity check, not strictly required | function authorizeController(address _controller)
external
onlyOwner
{
require(_controller != address(0x0), "Zero Address");
setStore(0, uint(_controller));
require(authorizedController() == _controller, "Sanity Check Failed");
}
| 12,975,015 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppel... | Set the time for the mint _claimTime time the claim starts this function can serve as an "active" and "non-active" sale status set the values to uint256(-1) for "non-active" sale status also, pass contract ownership to address(0) to close sale forever | function setMintTime(uint256 _claimTime) public onlyOwner {
claimTime = _claimTime;
}
| 1,060,329 |
./full_match/4/0xCfe89F7e97bAf8C6782DffD6cc58F371afd9d3c7/sources/contracts/GeneScience.sol | Parse a kitten gene and returns all of 12 "trait stack" that makes the characteristics _genes kitten gene return the 48 traits that composes the genetic code, logically divided in stacks of 4, where only the first trait of each stack may express | function decode(uint256 _genes) public pure returns(uint8[] memory) {
uint8[] memory traits = new uint8[](48);
uint256 i;
for(i = 0; i < 48; i++) {
traits[i] = _get5Bits(_genes, i);
}
return traits;
}
| 12,363,211 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@chainlink/contracts/src/v0.8/dev/VRFConsumerBase.sol";
contract Random is VRFConsumerBase, Ownable {
bytes32 internal keyHash;
uint256 internal fee;
address[] public contestants;
addre... | Callback function used by VRF Coordinator/ | function fulfillRandomness(bytes32 , uint256 randomness)
internal
override
{
randomResult = randomness % contestants.length;
winner = contestants[randomResult];
}
| 1,724,393 |
//pragma solidity 0.4.1;
import {RequestScheduleLib} from "contracts/RequestScheduleLib.sol";
import {BaseScheduler} from "contracts/Scheduler.sol";
contract BlockScheduler is BaseScheduler {
function BlockScheduler(address _factoryAddress) {
// Set the type of time scheduling to blocks
temporal... | Set the type of time scheduling to blocks Set the factory address. | function BlockScheduler(address _factoryAddress) {
temporalUnit = RequestScheduleLib.TemporalUnit(1);
factoryAddress = _factoryAddress;
}
| 12,672,222 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
import "../interfaces/IERC20.sol";
import "../utils/Ownable.sol";
import "../utils/SafeMath.sol";
import "../utils/ReentrancyGuard.sol";
// Owner is the multisig contract
contract TokenVesting is Ownable, ReentrancyGuard {
using SafeMath for uint256;
a... | Added to support recovering LP Rewards from other systems such as BAL to be distributed to holders | function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyOwner nonReentrant {
require(
tokenAddress != _zestyTokenAddress,
"StakingRewards::recoverERC20: Cannot withdraw zesty token"
);
require(
IERC20(tokenAddress).transfer(owner(), ... | 951,427 |
./full_match/1/0x71B1Df5C822Aafe9767E0866B03f19645f6B2f61/sources/contracts/ZKittyBotSubscribe.sol | Sets the address for the UNISWAP_FACTORY_ADDRESS. _uniswapFactoryAddress Address of the Uniswap factory./ | function setUniswapFactoryAddress(
address _uniswapFactoryAddress
) external onlyRecipients {
require(_uniswapFactoryAddress != address(0), "Zero address provided");
UNISWAP_FACTORY_ADDRESS = _uniswapFactoryAddress;
emit UniswapFactoryAddressUpdated(_uniswapFactoryAddress);
}... | 16,574,163 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view retu... | This will withdraw the tokens from the contract based on their balance, from highest balance to lowest Send the entire balance Find the highest balanced token to withdraw Withdraw the entire balance of this token Withdraw a partial amount of this token Convert the withdraw amount to the token's decimal amount | function withdrawPerBalance(address _receiver, uint256 _withdrawAmount, bool _takeAll) internal {
uint256 length = tokenList.length;
if(_takeAll == true){
for(uint256 i = 0; i < length; i++){
uint256 _bal = tokenList[i].token.balanceOf(address(this));
if(_... | 13,941,061 |
pragma solidity ^0.4.19;
// File: contracts/erc/erc165/IERC165.sol
/// @title ERC-165 Standard Interface Detection
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
interface IERC165 {
/// @notice Query if a contract implements an interface
/// @param interfaceID The interface identifier, ... | ERC-721 Non-Fungible Token Standard, optional metadata extension See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md Note: the ERC-165 identifier for this interface is 0x5b5e139f | interface IERC721Metadata /* is IERC721Base */ {
function name() external pure returns (string _name);
function symbol() external pure returns (string _symbol);
function tokenURI(uint256 _tokenId) external view returns (string);
}
| 1,362,284 |
// File: @openzeppelin/contracts/math/Math.sol
pragma solidity 0.5.16;
library Math {
function MAX818(uint256... | inject NONSTANDARD NAMING | function SETOPEN315(bool _open) external ONLYOWNER471 { | 5,362,713 |
pragma solidity >=0.6.0 <0.7.0;
pragma experimental ABIEncoderV2;
// SPDX-License-Identifier: MIT
/**
* EPNS Communicator, as the name suggests, is more of a Communictation Layer
* between END USERS and EPNS Core Protocol.
* The Communicator Protocol is comparatively much simpler & involves basic
* details, speci... | Internal system to handle broadcasting of public key, A entry point for subscribe, or create channel but is optional/ Add the user, will do nothing if added already, but is needed before broadcast get address from public key Only change it when verification suceeds, else assume the channel just wants to send group ... | function _broadcastPublicKey(address _userAddr, bytes memory _publicKey)
private
{
_addUser(_userAddr);
address userAddr = getWalletFromPublicKey(_publicKey);
if (_userAddr == userAddr) {
users[userAddr].publicKeyRegistered = true;
emit PublicKeyRegiste... | 5,901,136 |
./full_match/1/0x931D8441599B533DfEd618E93Fc32d110543a087/sources/contracts/radiant/staking/MultiFeeDistribution.sol | Sets bounty manager contract. bounty contract address/ | function setBountyManager(address bounty) external onlyOwner {
if (bounty == address(0)) revert AddressZero();
bountyManager = bounty;
minters[bounty] = true;
emit BountyManagerUpdated(bounty);
}
| 8,422,186 |
./full_match/137/0x1657ae435012b87f3Cd39817B294fBC71EfeeA6B/sources/ElevenMasterChef.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. | function add(uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate) public onlyOwner {
if (_withUpdate) {
massUpdatePools();
}
uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock;
totalAllocPoint = totalAllocPoint.add(_allocPoint);
poo... | 3,773,023 |
//Address: 0x95709a816a56195062e0a37d1e96a3370613a444
//Contract name: IkuraToken
//Balance: 0 Ether
//Verification Date: 6/13/2018
//Transacion Count: 2
// CODE STARTS HERE
// 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... | dJPYを消却する - 消却する量が0より大きい - 提案者の所有するdJPYの残高がamount以上 - 提案者の所有するSHINJIがamountよりも大きい 場合は成功する proposalId 提案ID/ ここでも念のためチェックを入れる 総供給量 / 実行者のdJPY / 実行者のSHINJI tokenを減らす | function executeBurnProposal(uint proposalId) internal returns (bool) {
Proposal storage proposal = proposals[keccak256('burn')][proposalId];
require(proposal.amount > 0);
require(_storage.coinBalance(proposal.proposer) >= proposal.amount);
require(_storage.tokenBalance(proposal.proposer) >= proposal... | 12,708,195 |
pragma solidity 0.5.16;
import "./XSushiStrategyUpgradeable.sol";
contract XSushiStrategyUpgradeableMainnet is XSushiStrategyUpgradeable {
address public xSushiStrategyUpgradeableMainnet; // just a differentiator for the bytecode
constructor() public {}
function initializeStrategy(
address _storage,
... | To make sure that governance cannot come in and take away the coins | function salvage(address recipient, address token, uint256 amount) public onlyGovernance {
require(!unsalvagableTokens(token), "token is defined as not salvageable");
IERC20(token).safeTransfer(recipient, amount);
}
| 5,998,285 |
./partial_match/1/0xd81b3000D6Cad7af85E9939AfAb1243B56618EA9/sources/VFIN.sol | Token Issuance / Know if new tokens can be issued in the future. return bool 'true' if tokens can still be issued by the issuer, 'false' if they can't anymore./ | function isIssuable() external override view returns (bool) {
return _isIssuable;
}
| 4,032,078 |
./full_match/56/0x42B1bbC3E386D3e66369a720Ff6B589C32308D73/sources/BEPOwnable.sol | Returns true if the caller is the current owner./ | function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
| 3,244,595 |
./partial_match/1/0x2503ac26F19f65e39A38124d7f07eabec5E816Eb/sources/arNXMVault.sol | Withdraw an amount of wNxm by burning arNxm. _arAmount The amount of arNxm to burn for the wNxm withdraw./ This amount must be determined before arNxm burn. Burn also decreases sender's referral balance through alertTransfer. | function withdraw(uint256 _arAmount)
external
{
require(block.timestamp.sub(withdrawalsPaused) > pauseDuration, "Withdrawals are temporarily paused.");
uint256 wNxmAmount = wNxmValue(_arAmount);
arNxm.burn(msg.sender, _arAmount);
wNxm.safeTransfer(msg.sender, wNxm... | 2,809,785 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability war... | generate the uniswap pair path of token -> wETH make the swap | function swapTokensForBNB(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOn... | 5,994,425 |
./full_match/43113/0x0D3aaBd23b827Dd63FE59888D792EE27C00B53A8/sources/Deployer.sol | publish contracts transfer total supply | function deploy() external onlyOwner
{
require(!deployed, "deploy unavailable");
bool _nativeNetwork = false
|| $.NETWORK == $.Network.Mainnet
|| $.NETWORK == $.Network.Ropsten
|| $.NETWORK == $.Network.Rinkeby
|| $.NETWORK == $.Network.Kovan
|| $.NETWORK == $.Network.Goerli;
admin = ADMIN[$.NE... | 13,170,886 |
pragma solidity 0.5.15;
import "./ITicketForge_v0.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./T721ControllerDomain_v0.sol";
import "./BytesUtil_v0.sol";
// @notice the T721Controller handles all the ticket minting and attachments
contrac... | Helper used to verify if a unique consummable ID is available _owner The ticket issuer address code The code to verify/ | function isCodeConsummable(address _owner, uint256 code) public view returns (bool) {
return !authorization_code_registry[_owner][code];
}
| 5,393,547 |
./full_match/100/0x7BD4FaE40Dce40CC61E3e5E7E85aa0Fc403297fD/sources/contracts/OrbisAlpha.sol | Used by community members (at least Editor role) to react to post shared in their communities _postID: Unique ID of the post to upvote/downvote _reaction: Type of reaction/ Make sure user hasn't voted yet Make sure the post hasn't been archived Save that the user has reacted Retrieve community ID Finding when the use... | ) public onlyEditor(posts[_postID].communityID) {
require(memberReaction[_postID][msg.sender] > 0, "User already voted for this post");
require(posts[_postID].archived == false, "You can't upvote/downvote an archived post");
memberReaction[_postID][msg.sender] = _reaction;
... | 14,265,323 |
./full_match/43114/0x32272e08815ce417975367674A8C02d9cCEA1cfc/sources/avacashAttack.sol | 100000/3avacash.deposit{value:100 ether}(0x29a479d01e6c2229bc030c00b4cd685c11b7d67956abadbd4efa9c62f2ebe969);avacash.deposit{value:100 ether}(0x11e787a254a60a2422f2815e6448815b9ef2518519624612d792f925ff434db5);avacash.deposit{value:100 ether}(0x222b340370787e901644b11d1794bfbc7ad34ec9b9ecc4a7f8f4285314b87458);avacash.d... | function avacashFlashLoanCall(bytes calldata _data) override external payable returns (bool){
uint balance = myBalance();
emit Log("my balance is ", balance);
uint fee = 0.01 ether;
return true;
}
| 4,546,740 |
./partial_match/1/0x6Bd395902b2D18Bc955d1a41C6b7ddF7b301930A/sources/contracts/lib/SignedSafeMath128.sol | Returns the subtraction of two signed integers, reverting on overflow. Counterpart to Solidity's `-` operator. Requirements: - Subtraction cannot overflow./ | function sub(int128 a, int128 b) internal pure returns (int128) {
int128 c = a - b;
require((b >= 0 && c <= a) || (b < 0 && c > a), "SignedSafeMath128: subtraction overflow");
return c;
}
| 2,745,507 |
./full_match/11155111/0x7CD2b2F951BAc762BF7affd73689A3e1198596AB/sources/contracts/Merkle.sol | Calculate the root of Merkle tree from an array of power of 2 elements hashes The array containing power of 2 elements return byte32 the root hash being calculated revert when the input is not of power of 2 | function calculateRootFromPowerOfTwo(bytes32[] memory hashes) public pure returns (bytes32) {
require(isPowerOf2(hashes.length), "The input array must contain power of 2 elements");
if (hashes.length == 1) {
return hashes[0];
bytes32[] memory newHashes = new bytes32[](hashes... | 3,842,325 |
./full_match/5/0x2743d6F0fb1E4CCb768D4530841d35dC44C59789/sources/contracts/extension/upgradeable/PermissionsEnumerable.sol | Returns total number of accounts that have a role. Returns `count` of accounts that have `role`. See struct {RoleMembers}, and mapping {roleMembers} role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE") return count Total number of accounts that have `role`/ | function getRoleMemberCount(bytes32 role) external view override returns (uint256 count) {
uint256 currentIndex = _permissionsEnumerableStorage().roleMembers[role].index;
for (uint256 i = 0; i < currentIndex; i += 1) {
if (_permissionsEnumerableStorage().roleMembers[role].members[i] != ... | 11,603,072 |
/*
Copyright 2018 RigoBlock, Rigo Investment Sagl.
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... | Allows a whitelister to enable trading on a particular exchange _asset Address of the token _exchange Address of the exchange _isWhitelisted Bool whitelisted | function whitelistAssetOnExchange(
address _asset,
address _exchange,
bool _isWhitelisted)
external
onlyAdmin
{
blocks.allowedTokens[_exchange][_asset] = _isWhitelisted;
emit WhitelistedAsset(_asset, _isWhitelisted);
}
| 980,957 |
./full_match/100/0xC740046C8FdA017636FF155B8cFa4cF30f72907D/sources/project_/contracts/InternalBondingCurveController.sol | solhint-disable-next-line no-inline-assembly | function _convertERC20ToAsset(IERC20 _token) internal pure returns (IAsset asset) {
assembly {
asset := _token
}
}
| 14,270,443 |
./full_match/1/0x7A8aDCf432EbCC2311B955d176ee4BFED13bB9A7/sources/MANDOXv3Main.sol | transfer from address that has allowances | function transferFrom(address sender, address recipient, uint256 amount) public override notBlacklisted notPaused returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()] - amount);
return true;
}
| 2,929,671 |
pragma solidity ^0.4.4;
contract Owned {
address public contractOwner;
address public pendingContractOwner;
function Owned() {
contractOwner = msg.sender;
}
modifier onlyContractOwner() {
if (contractOwner == msg.sender) {
_;
}
}
/**
* Prepares ow... | Transfers asset balance between holders wallets. _fromId holder id to take from. _toId holder id to give to. _value amount to transfer. _symbol asset symbol./ | function _transferDirect(uint _fromId, uint _toId, uint _value, bytes32 _symbol) internal {
assets[_symbol].wallets[_fromId].balance -= _value;
assets[_symbol].wallets[_toId].balance += _value;
}
| 2,297,469 |
./full_match/1/0xC493a42Cb57b7cf09787E4bc9f234216D6998d80/sources/contracts/NobleICONS.sol | See {IERC165-supportsInterface}./ | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
function _afterTokenTransfer(
address from,
address to,
uint256 tokenId
}
pragma solidity ^0.8.0;
}
pragma solidity ^0.8.0;
) public view virtual override(IERC165, ERC721) returns ... | 4,958,552 |
pragma solidity 0.5.10;
import "./Base.sol";
import "../interface/IRole.sol";
/**
@title This manages the roles to access to the platform.
@author StablePay <hi@stablepay.io>
@notice This smart contract manages the roles for each address who access to the platform.
*/
contract Role is Base, IRole {
/... | / Only an owner can transfer their access Remove from storage Log it | function roleRemove(string memory _role, address _address) internal {
require(!roleHas("owner", _address), "Only owner can transfer their access.");
_storage.deleteBool(keccak256(abi.encodePacked("access.role", _role, _address)));
emit RoleRemoved(_address, _role);
}
| 12,545,282 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.