file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./partial_match/3/0xbf400eD5ec1D707B3EfFb6554F18728880Aae52b/sources/YgfStaking.sol | To unstake token user will call this method user will get penalty if they unstack before 84 days user get daily rewards according to calulation sub from totalStackAmount what user stacke erlier so if there is no stacke it wil become zero for first 28 days we give 0.5 rewards per day after 29 day reward is 1% per day | function unStake() external returns (bool) {
require(stakedAmount[msg.sender] != 0, "ERR_NOT_STACKED");
uint256 lastStackTime = lastStack[msg.sender];
uint256 amount = stakedAmount[msg.sender];
uint256 _days = safeDiv(safeSub(block.timestamp, lastStackTime), 86400);
uint256 ... | 5,130,520 |
contract LockMyEther {
//Author: General_Illus
//Date: 3/6/2016
//Version: LockMyEther v1.0
address owner;
mapping (address => uint) fees;
struct User
{
uint balance; // user balance
uint expiration_block; // block ether is unlocked
bool trickle; // turn trickle on/off
... | Get expiration block | function getExpirationBlock() constant returns (uint ExpirationBlock) {
return user[msg.sender].expiration_block;
}
| 6,456,031 |
pragma solidity ^0.8.0;
// SPDX-License-Identifier: MIT
import "../../core/DaoConstants.sol";
import "../../core/DaoRegistry.sol";
import "../../guards/AdapterGuard.sol";
import "../IExtension.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "... | Registers a potential new NFT in the NFT extension. The caller must have the ACL Flag: REGISTER_NFT. Reverts if the token address is reserved. nftAddr The address of the new NFT./ | function registerPotentialNewNFT(address nftAddr)
public
isCreatorOrHasExtensionAccess(this, AclFlag.REGISTER_NFT)
{
require(
isNotReservedAddress(nftAddr) && nftAddr != SHARES,
"reservedToken"
);
if (!availableNFTs[nftAddr]) {
availab... | 12,768,460 |
./full_match/1/0x7fFd853A30A0Bf3f97F06301890B245f212a2de4/sources/contracts/MEDIFAKT.sol | Decreases the allowance of `spender` by `amount`./ | function decreaseAllowance(address spender, uint256 subtractedValue) public whenNotPaused returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "FAKT: decreased allowance below zero");
uncheck... | 16,438,636 |
pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
/**
* @title GoSwap 质押合约
*/
contract GoSwapStake is ERC20("GoSwap Stake", "sGOT"){
using SafeMath for uint256;
IERC20 pu... | 离开吧台,取回自己的GoSwap Token _share GOT数额/ Leave the bar. Claim back your GOT. 当前合约的总发行量 what数额 = 份额 当前合约在GoSwap Token的余额 / 当前合约的总发行量 为调用者销毁份额 将what数额的GoSwap Token发送到调用者账户 | function leave(uint256 _share) public {
uint256 totalShares = totalSupply();
uint256 what = _share.mul(GOT.balanceOf(address(this))).div(totalShares);
_burn(msg.sender, _share);
GOT.transfer(msg.sender, what);
}
| 7,273,240 |
pragma solidity >=0.4.0 <0.6.0;
import "./Book.sol";
import "./Publisher.sol";
contract Author {
string public name;
address[] public publishedBooks;
address[] public unpublishedBooks;
address myAddress;
struct Request {
address publisher;
string ipfsHash;
address... | Publisher publisher = Publisher(requests[index].publisher);TODO: check book exists, doest not have a publisher, publisher exists require(book.publisher == 0);publisher.requestApproved(requests[index].bookAddr); | function approveRequest(uint index) public {
Book book = Book(requests[index].bookAddr);
if(keccak256(abi.encodePacked(requests[index].ipfsHash)) == keccak256(abi.encodePacked(book.ipfsHash))) {
book.setPublisher(requests[index].publisher);
publishedBooks.push(requests[index... | 5,361,102 |
pragma solidity ^0.4.23;
/**
* Math operations with safety checks
*/
library SafeMath {
function safeMul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeDiv(uint a, uint b) internal pure returns (uint) {
assert(... | Transfer tokens from one address to another _from address The address which you want to send tokens from _to address The address which you want to transfer to _value uint256 the amount of tokens to be transferred/Before ICO finish, only own could transfer. | function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
checkValue(_from,_value);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_f... | 1,067,741 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
// Interfaces
import "@openzeppelin/contracts/governance/IGovernor.sol";
// Libraries
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/utils/math/SafeCast.sol";
import "@openzeppelin/contracts/utils/Timers.sol";
impo... | Version of the governor instance (used in building the ERC712 domain separator). Default: "1"/ | function governorVersion() public pure returns (string memory) {
return "1";
}
| 1,795,157 |
./full_match/1/0xDC14f5dba4eA0175ce8C5351396CE8406d21fb4b/sources/contracts/Auction.sol | Gets the current data of the auction. return data A struct containing the highest bidder and the highest bid amount of the auction. | function getData() external view returns (AuctionData memory) {
return auctionData;
}
| 2,933,179 |
/**
*Submitted for verification at Etherscan.io on 2021-06-27
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b)... | See {ERC20-_beforeTokenTransfer}. Requirements: - the contract must not be paused./ | function _beforeTokenTransfer(address, address, uint256) internal virtual {
require(!paused(), "ERC20Pausable: token transfer while paused");
}
| 6,643,251 |
/**
*Submitted for verification at Etherscan.io on 2021-09-17
*/
// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overf... | payable(typeToPredicate[tokenToType[ETHER_ADDRESS]]).transfer(msg.value); transfer doesn't work as expected when receiving contract is proxified so using call | function _depositEtherFor(address user) private {
bytes memory depositData = abi.encode(msg.value);
_depositFor(user, ETHER_ADDRESS, depositData);
if (!success) {
revert("RootChainManager: ETHER_TRANSFER_FAILED");
}
}
| 2,282,836 |
./full_match/1/0x3a32BecC41115b4Aa8bD8614301AeBB9bB11258b/sources/@lyrafinance/protocol/contracts/synthetix/SignedDecimalMath.sol | return The result of safely dividing x and y. The return value is as a rounded decimal in the precision unit specified in the parameter. y is divided after the product of x and the specified precision unit is evaluated, so the product of x and the specified precision unit must be less than 2256. The result is rounded ... | function _divideDecimalRound(
int x,
int y,
int precisionUnit
) private pure returns (int) {
int resultTimesTen = (x * (precisionUnit * 10)) / y;
return _roundDividingByTen(resultTimesTen);
}
| 9,671,999 |
// SPDX-License-Identifier: bsl-1.1
/*
Copyright 2020 Unit Protocol: Artem Zakharov (az@unit.xyz).
*/
pragma solidity 0.7.6;
import './BaseCDPManager.sol';
import '../interfaces/IOracleRegistry.sol';
import '../interfaces/IOracleUsd.sol';
import '../interfaces/IWETH.sol';
import '../interfaces/IVault.sol';
import... | Withdraws WETH and converts to ETH ethAmount ETH amount to withdraw usdpAmount The amount of USDP token to repay/ | function exit_Eth(uint ethAmount, uint usdpAmount) public returns (uint) {
usdpAmount = exit(WETH, ethAmount, usdpAmount);
require(IWETH(WETH).transferFrom(msg.sender, address(this), ethAmount), "Unit Protocol: WETH_TRANSFER_FROM_FAILED");
IWETH(WETH).withdraw(ethAmount);
require(suc... | 2,505,551 |
// ███████╗░█████╗░██████╗░██████╗░███████╗██████╗░░░░███████╗██╗
// ╚════██║██╔══██╗██╔══██╗██╔══██╗██╔════╝██╔══██╗░░░██╔════╝██║
// ░░███╔═╝███████║██████╔╝██████╔╝█████╗░░██████╔╝░░░█████╗░░██║
// ██╔══╝░░██╔══██║██╔═══╝░██╔═══╝░██╔══╝░░██╔══██╗░░░██╔══╝░░██║
// ███████╗██║░░██║██║░░░░░██║░░░░░███████╗██║░░██║██╗██... | Get LPT Approve UniUnZap Get pair addresses from UniV2Pair use ETH to ZapIn to Balancer | function PipeUniV2Balancer(
address _FromUniswapPoolAddress,
uint256 _IncomingLPT,
address _ToBalancerPoolAddress,
address _toWhomToIssue,
uint256 _minBPTokens
) public nonReentrant stopInEmergency returns (uint256) {
IERC20(_FromUniswapPoolAddress).safeTransferFr... | 12,044,775 |
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
contract BTRST {
/// @notice EIP-20 token name for this token
string public constant name = "BTRST";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "BTRST";
/// @notice EIP-20 token decimals for this token
... | 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, "BTRST::transfer: amount exceeds 96 bits");
_transferTokens(msg.sender, dst, amount);
return true;
}
| 6,694,442 |
// File: contracts/Dependencies/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
/*
* @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 an... | update the flash sale before starting NOTE: set 0 duration if you don't want an endTime 1. make sure that the flash sale doesn't start 2. check the validity of params to update 3. update flash sale | function updateFlashSale(
uint _saleID,
address[] memory _tokenAddresses,
uint[] memory _tokenIDs,
address _payTokenAddress,
uint _price,
address _receiver,
uint _purchaseLimitation,
uint _startTime,
uint _duration
) external nonReentrant o... | 6,053,693 |
./partial_match/42/0x1513554997d7A7E21B4c8a3b32d8AE95fEb63571/sources/HarvestBridgeStrategy.sol | Returns the total invested amount./ | function investedUnderlyingBalance(address strategy) view public returns (uint256) {
return IStrategy(strategy).investedUnderlyingBalance();
}
| 8,995,759 |
./partial_match/1/0xe80bF394d190851E215D5F67B67f8F5A52783F1E/sources/src/lib/DutchDecayLib.sol | returns a decayed output array using the given dutch spec and times outputs The output array to decay decayStartTime The time to start decaying decayEndTime The time to end decaying return result a decayed output array | function decay(DutchOutput[] memory outputs, uint256 decayStartTime, uint256 decayEndTime)
internal
view
returns (OutputToken[] memory result)
{
uint256 outputLength = outputs.length;
result = new OutputToken[](outputLength);
unchecked {
for (uint256 i... | 15,598,654 |
./partial_match/56/0x31974c8cC964E5D4506d97390DF2e9fF4548Fb4f/sources/MasterChef.sol | Destroys `amount` tokens from `account`.`amount` is then deducted from the caller's allowance. See {_burn} and {_approve}./ | function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].BAL(amount, 'BEP20: burn amount exceeds allowance'));
}
| 11,040,754 |
pragma solidity 0.4.26;
import "./LiquidityPoolV2Converter.sol";
import "./interfaces/IPoolTokensContainer.sol";
import "../../interfaces/ITypedConverterFactory.sol";
/*
LiquidityPoolV2Converter Factory
*/
contract LiquidityPoolV2ConverterFactory is ITypedConverterFactory {
/**
* @dev returns t... | returns the converter type the factory is associated with return converter type/ | function converterType() public pure returns (uint16) {
return 2;
}
| 1,081,549 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "../interfaces/IYearnVault.sol";
import "../libraries/Authorizable.sol";
import "../interfaces/IERC20.sol";
import "../interfaces/ITranche.sol";
contract ZapYearnShares is Authorizable {
// Store the accessibility state of the contract
bool... | This contract can hold yearn vault share allowances for addresses so if it is deprecated it should be removed so that users do not have to remove allowances. Note - onlyOwner is a stronger check than onlyAuthorized, many addresses can be authorized to freeze or unfreeze the contract but only the owner ad... | function deprecate() external onlyOwner {
selfdestruct(payable(msg.sender));
}
| 916,578 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./../interfaces/IEmiswap.sol";
library EmiswapLib {
using SafeMath for uint256;
function previewSwapExactTokenForToken(address facto... | get preview result of virtual swap by route of tokens/ | function previewSwapbyRoute(address factory, address[] memory path, uint256 ammountFrom)
internal
view
returns(uint256 ammountTo)
{
for (uint i=0; i < path.length - 1; i++) {
if (path.length >= 2) {
ammountTo = previewSwapExactTokenForToken(factory, path[i], path[i+1], ammountFrom);
... | 1,757,165 |
pragma solidity ^0.4.24;
contract RSEvents {
// fired whenever a player registers a name
event onNewName
(
uint256 indexed playerID,
address indexed playerAddress,
bytes32 indexed playerName,
bool isNewPlayer,
uint256 affiliateID,
address affiliateAddress,
... | gives square. multiplies x by x/ | function sq(uint256 x)
internal
pure
returns (uint256)
{
return (mul(x,x));
}
| 429,803 |
/*
* Just Price Protocol Smart Contract.
* Copyright © 2018 by ABDK Consulting.
* Author: Mikhail Vladimirov <<span class="__cf_email__" data-cfemail="d3bebab8bbb2babffda5bfb2b7babebaa1bca593b4beb2babffdb0bcbe">[email protected]</span>>
*/
pragma solidity ^0.4.20;
//import "./SafeMath.sol";
//import "./O... | Set new fee numerator. _fee new fee numerator./ | function setFee (uint256 _fee) public {
require (msg.sender == k1);
require (_fee >= MIN_FEE);
require (_fee <= MAX_FEE);
updateStage ();
require (stage == Stage.GROWTH || stage == Stage.LIFE);
require (currentTime () >= feeChangeEnableTime);
require (safeSub (_fee, 1) <= fee);
req... | 7,889,110 |
// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is dis... | Returns the EIP712 domain separator./ Returns the next nonce used by an address to sign messages./ SPDX-License-Identifier: GPL-3.0-or-later This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either ver... | interface ITemporarilyPausable {
event PausedStateChanged(bool paused);
function getPausedState()
external
view
returns (
bool paused,
uint256 pauseWindowEndTime,
uint256 bufferPeriodEndTime
);
}
| 140,654 |
./partial_match/1/0x4986d7BEe120DF657fcA29cc11BF0B04836118a2/sources/src/dependencies/openzeppelin/contracts/AccessControl.sol | Revert with a standard message if `account` is missing `role`. The format of the revert reason is given by the following regular expression: /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$// | function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
'AccessControl: account ',
Strings.toHexString(account),
... | 2,707,129 |
/**
*Submitted for verification at Etherscan.io on 2021-03-12
*/
pragma solidity 0.6.6;
// File: @openzeppelin/contracts/GSN/Context.sol
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.send... | Delete the pool settings./ | function deleteVsEthPool(bytes32 poolID) external {
require(
_vsEthPool[poolID].seller == msg.sender,
"not the owner of the pool ID"
);
_deleteVsEthPool(poolID);
}
| 6,770,812 |
./full_match/82/0xa4CDf8dD66232eD7C73CBC07a9324C9863401838/sources/project_/contracts/libs/Wc3Lib.sol | Recovers address from hash and signature. | function recoverAddr(bytes32 _hash, bytes memory _signature)
internal pure
returns (address)
{
if (_signature.length != 65) {
return (address(0));
}
bytes32 r;
bytes32 s;
uint8 v;
assembly {
r := mload(add(_signature, 0x20))... | 7,094,560 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.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 ... | unpause all coin transfer/ | function unpause() public onlyOwner whenPaused {
_unpause();
}
| 12,904 |
pragma solidity 0.8.4;
/// #invariant forall (uint i in a) a[i] > 10;
contract ForallSimple {
uint[] a;
function push(uint x) external {
a.push(x);
}
/// #if_succeeds forall (uint i in a) let z1 := x in let z2 := a[i] in z2 > z1;
function test1(uint[] memory a, uint x) public {
}
uint t = 0;
/// #if_succee... | if_succeeds forall (uint i in 1...5) i >= 1 && i < 5; | function test5() public {
}
| 5,359,883 |
/**
*Submitted for verification at Etherscan.io on 2021-10-01
*/
// Verified using https://dapp.tools
// hevm: flattened sources of src/OneFreeCoupon.sol
// SPDX-License-Identifier: MIT AND Unlicense
pragma solidity >=0.8.0 <0.9.0;
////// lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol
/* prag... | Encodes some bytes to the base64 representation multiply by 4/3 rounded up Add some extra buffer at the end | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
}
function encode(bytes memory data) internal pure returns (string memory) {
uint256 len = data.length;
if (len == 0) return "";
uint256 encodedLen = 4 * ((len + 2) / 3);
bytes me... | 6,504,716 |
pragma solidity >=0.5.0 <0.6.0;
import "../20200106/Behaviour20200106.sol";
/**
* @title Behaviour20200207 implementation
* @author AZTEC
* Note the behaviour contract version naming convention is based on the date on which the contract
* was created, in the format: YYYYMMDD
*
* Copyright 2020 Spilsbury Holdin... | Overwrite the accceptRelayedCall() method of Behaviour20200106.sol, to allow it to be used with an updated GSN signer address. Method used to ensure that only transactions with a trusted signature can be relayed through the GSN./ | function acceptRelayedCall(
address relay,
address from,
bytes calldata encodedFunction,
uint256 transactionFee,
uint256 gasPrice,
uint256 gasLimit,
uint256 nonce,
bytes calldata approvalData,
uint256
)
external
view
... | 1,758,079 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import "ds-test/src/test.sol";
import "openzeppelin-contracts/contracts/token/ERC721/utils/ERC721Holder.sol";
import "openzeppelin-contracts/contracts/token/ERC20/presets/ERC20PresetFixedSupply.sol";
import "./SphinxSociety.sol";
// hevm interface to modify tes... | ensure comparing arrays by hash actually works same size, same contents same size, different contents different size, same-ish contents same size, same contents, different order | function test_tokensOfOwner_arrayHashing() public {
bool test;
uint256[3] memory a1 = [uint256(1), 2, 3];
uint256[3] memory a2 = [uint256(1), 2, 3];
test = keccak256(abi.encodePacked(a1)) == keccak256(abi.encodePacked(a2));
assertTrue(test, "a1 should equal a2");
uin... | 6,415,129 |
./full_match/1/0x79f1A89b5E1168d4de4D3Fa62C7FE1852Fa82c58/sources/contracts/Token.sol | solhint-disable-next-line not-rely-on-time | function addLiquidity() public payable {
uint256 _liquidityAmount = balanceOf(address(this));
_approve(address(this), address(_router), _liquidityAmount);
address(this),
_liquidityAmount,
0,
0,
owner(),
block.timestamp
)... | 17,001,140 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./Mintor.sol";
import "./Forest.sol";
import "./Prey.sol";
import "./HunterHound.sol";
contract HunterGame is Mintor, Forest, Ownable {
// swtich to turn on/off the game
bool _paused = true;... | stake submitted tokens group and transfer to the staking contract/ transfer token | function _stake(address owner, uint256[][] calldata pairs, HunterHound hh) internal whenGambleRequested {
require(pairs.length > 0, "Tokens empty");
require(totalClaimed < TOTAL_PROFIT, "No profit");
uint totalHunter = 0;
uint totalHounds = 0;
(totalHunter, totalHounds) = _storeStake(owner,... | 13,018,159 |
/**
*Submitted for verification at Etherscan.io on 2022-03-17
*/
/**
*Submitted for verification at Etherscan.io on 2022-03-17
*/
/**
*Submitted for verification at Etherscan.io on 2022-03-08
*/
// SPDX-License-Identifier: MIT
// File: contracts/libs/Address.sol
pragma solidity ^0.8.0;
/**
* @dev Collection o... | Get paired season1 / season2 nfts/ | function viewPairedNfts(address __account)
external
view
returns (
uint256[] memory pairedSeason1Nfts,
uint256[] memory pairedSeason2Nfts
)
{
UserInfo storage user = _userInfo[__account];
uint256 pairCount = user._pairCount;
pairedS... | 6,499,354 |
./partial_match/1/0x93A20D8EbA6997ABB53aE94bd01727C8e74c8734/sources/TokenCore.sol | has role privilege low level access to role privilege ignores ALL_PRIVILEGES role/ | function rolePrivilege(bytes32 _role, bytes4 _privilege)
public view returns (bool)
{
return roles[_role].privileges[_privilege];
}
| 3,566,147 |
pragma solidity ^0.4.22;
// File: contracts/ERC223/ERC223_receiving_contract.sol
/**
* @title Contract that will work with ERC223 tokens.
*/
contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
... | transfer token for a specified address _to The address to transfer to. _value The amount to be transferred. _data Optional metadata./ | function transfer(address _to, uint _value, bytes _data) public returns (bool) {
super.transfer(_to, _value);
if (isContract(_to)) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, _data);
Transfer(msg.s... | 393,669 |
pragma solidity ^0.4.24;
contract CrabData {
modifier crabDataLength(uint256[] memory _crabData) {
require(_crabData.length == 8);
_;
}
struct CrabPartData {
uint256 hp;
uint256 dps;
uint256 blockRate;
uint256 resistanceBonus;
uint256 hpBonus;
uint256 dpsBonus;
uint256 blockB... | generate the bonus number and add it into the _bonuses array | function generateBonusForGene(uint256 _gene) external view returns (uint256[] _bonuses) {
_bonuses = new uint256[](4);
uint256[] memory _elements = extractElementsFromGene(_gene);
uint256[] memory _parts = extractPartsFromGene(_gene);
uint256[] memory _legendaryParts;
for(uint256 i = 0 ; i < ... | 10,814,619 |
pragma solidity ^0.5.16;
interface IERC20 {
function TOTALSUPPLY886() external view returns (uint); //inject NONSTANDARD NAMING
function BALANCEOF698(address account) external view returns (uint); //inject NONSTANDARD NAMING
function TRANSF... | inject NONSTANDARD NAMING | function BALANCEOF698(address account) external view returns (uint); | 7,321,012 |
./partial_match/1/0x054506459872524229240DE8094a19e80b3283d2/sources/ETHGOD.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("God Of Ethereum", "VITALIK") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2P... | 4,371,589 |
./full_match/10/0xC7c29E0bD443AFf2c5AE18e7a54B95487F09A1d8/sources/project:/contracts/UxuyProtocol.sol | handle token with supporting fee on transfer | function trade(
TradeParams calldata params
)
external
payable
whenNotPaused
noDelegateCall
nonReentrant
checkDeadline(params.deadline)
returns (uint256 amountOut, uint256 bridgeTxnID)
{
TradeState memory state;
if (params.swaps... | 3,782,549 |
/**
*Submitted for verification at Etherscan.io on 2022-01-14
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
// File @openzeppelin/contracts/utils/introspection/IERC165.sol@v4.3.0
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implem... | Standard functions to be overridden in ERC721Enumerable | function supportsInterface(
bytes4 _interfaceId
)
public
view
override (ERC721, ERC721Enumerable)
returns (bool)
{
return super.supportsInterface(_interfaceId);
}
| 6,091,984 |
./full_match/80001/0x3EEc09B5188E76ca7B2bFe12C8c53574a241aFFc/sources/contracts/CrowdFunding.sol | Geting the least of campaign | function getCampaigns() view public returns(Campaign[] memory) {
Campaign[] memory allCampaigns = new Campaign[](numberOfCampaigns);
for(uint i = 0; i<numberOfCampaigns; i++){
Campaign storage item = campaigns[i];
allCampaigns[i] = item;
}
return(all... | 9,537,977 |
/**
*Submitted for verification at Etherscan.io on 2021-02-07
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
/*
* @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, the... | Allows the owner to mint tokens for several recipients in one transaction. accounts an array of beneficiaries getting tokens amount the amount of tokens that each beneficiary gets/ | function batchMint(address[] calldata accounts, uint256 amount) external onlyOwner {
uint256 len = accounts.length;
for (uint256 c = 0; c < len; c++) {
_mint(accounts[c], amount);
}
}
| 2,075,202 |
pragma solidity ^ 0.4.25;
contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint ... | Retrieve the size of the code on target address, this needs assembly . | function isContract( address _to ) internal returns ( bool ){
uint codeLength = 0;
assembly {
codeLength := extcodesize(_to)
}
if(codeLength>0) {
return true;
}
return false;
}
| 1,808,501 |
// File: @openzeppelin\contracts-ethereum-package\contracts\math\SafeMath.sol
pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assum... | ------ Settings methods ------ | function initialize(address _pool) public initializer {
Module.initialize(_pool);
SavingsCap.initialize(_msgSender());
VaultOperatorRole.initialize(_msgSender());
}
| 1,117,601 |
./full_match/97/0x65d02A3481F3c25DE96671E30044fad2D060ae95/sources/project:/contracts/Exchange/exchange.sol | Include address in blacklist by UPDATER_ROLE. account. Emits {Blacklisted} event./ | function includeInBlacklist(address account) external onlyRole(UPDATER_ROLE) {
require(account != address(0), "Exchange: Cant be zero address");
require(!blacklisted[account], "Exchange: Account is already blacklisted");
blacklisted[account] = true;
emit Blacklisted(account);
}
| 3,276,170 |
./full_match/11155111/0xFB34DaDd5f3Aba55004C448AcFd24fAF5A4Ff83E/sources/contracts/history/History.sol | Get a specific claim regarding a specific DApp. There are several requirements for this function to be called successfully. `_proofContext` MUST be well-encoded. In Solidity, it can be constructed as `abi.encode(claimIndex)`, where `claimIndex` is the claim index (type `uint256`). `claimIndex` MUST be inside the in... | function getClaim(
address _dapp,
bytes calldata _proofContext
) external view override returns (bytes32, uint256, uint256) {
uint256 claimIndex = abi.decode(_proofContext, (uint256));
Claim memory claim = claims[_dapp][claimIndex];
return (claim.epochHash, claim.firstI... | 3,828,127 |
// SPDX-License-Identifier: Unlicense
/*
Glyph Pets inspires by WAGMIpet NFT by m1guelpf.eth, which was
inspired by dhof.eth's wagmipet contract (mainnet:0xecb504d39723b0be0e3a9aa33d646642d1051ee1)
*/
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts... | solhint-disable-next-line quotes | function tokenURI(uint256 tokenId)
public
view
override(ERC721)
returns (string memory)
{
require(_exists(tokenId), "pet does not exist");
string memory json = Base64.encode(
bytes(
string(
abi.encodePacked(
'{"name": "Glyph Pet #',
Strings.to... | 5,451,727 |
pragma solidity ^0.4.23;
// File: contracts/NokuPricingPlan.sol
/**
* @dev The NokuPricingPlan contract defines the responsibilities of a Noku pricing plan.
*/
contract NokuPricingPlan {
/**
* @dev Pay the fee for the service identified by the specified name.
* The fee amount shall already be ap... | Mint new locked tokens, which will unlock progressively. _to The address that will receieve the minted locked tokens. _amount The amount of tokens to mint. return A boolean that indicates if the operation was successful./ | function mintLocked(address _to, uint256 _amount) public onlyOwner canMint returns(bool minted) {
initiallyLockedBalanceOf[_to] = initiallyLockedBalanceOf[_to].add(_amount);
return mint(_to, _amount);
}
| 12,923,031 |
// File: @openzeppelin\contracts-ethereum-package\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 t... | Sets the value of the `cap`. This value is immutable, it can only be set once during construction./ | function __RajaToken_init(uint256 _cap) public initializer {
__Context_init_unchained();
__ERC20_init_unchained('RAJACOIN', 'RAJA');
__Ownable_init_unchained();
__StakingWallet_init_unchained();
__RajaToken_init_unchained(_cap);
}
| 10,199,129 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// Part: IBank
interface IBank {
/// The governor adds a new bank gets added to the system.
event AddBank(address token, address cToken);
/// The governor sets the address of the oracle smart contract.
event SetOracle... | Remove liquidity from Sushiswap pool tokenA Token A for the pair tokenB Token B for the pair amt Amounts of tokens to take out, withdraw, repay, and get. 2. Compute repay amount if MAX_INT is supplied (max debt) | function removeLiquidityInternal(
address tokenA,
address tokenB,
RepayAmounts calldata amt,
address lp
) internal {
require(whitelistedLpTokens[lp], 'lp token not whitelisted');
uint positionId = bank.POSITION_ID();
uint amtARepay = amt.amtARepay;
uint amtBRepay = amt.amtBRepay;
... | 6,085,275 |
./partial_match/1313161554/0xE17B0d13926F03C0a9C2d6185B505C253E7cDb1d/sources/_contracts/abstract/ReaperBaseStrategyv2.sol | updates the call fee, treasury fee, and strategist fee call Fee + treasury Fee must add up to PERCENT_DIVISOR strategist fee is expressed as % of the treasury fee and must be no more than STRATEGIST_MAX_FEE only DEFAULT_ADMIN_ROLE./ | function updateFees(
uint256 _callFee,
uint256 _treasuryFee,
uint256 _strategistFee
) external returns (bool) {
_atLeastRole(DEFAULT_ADMIN_ROLE);
require(_callFee + _treasuryFee == PERCENT_DIVISOR, 'sum != PERCENT_DIVISOR');
require(_strategistFee <= STRATEGIST_MA... | 16,912,196 |
pragma solidity ^0.6.6;
// SPDX-License-Identifier: MIT
/*
* @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 d... | Updates token max supply id_ uint256 ID of the token to update maxSupply_ uint256 max supply allowed/ | function updateTokenMaxSupply(uint256 id_, uint256 maxSupply_) external onlyWhitelistAdmin {
require(_exists(id_), "ERC1155Tradable#updateTokenMaxSupply: NONEXISTENT_TOKEN");
require(tokenSupply[id_] <= maxSupply_, "already minted > new maxSupply");
tokenMaxSupply[id_] = maxSupply_;
}
| 11,639,296 |
pragma solidity ^0.4.25;
import "browser/SafeMath.sol";
contract MiningShare {
using SafeMath for uint256;
address private owner = 0x0;
uint256 private closeBlock = 0;
mapping(address => uint256) private usersNTD;
mapping(address => uint256) private usersWithdraw;
uint256 private totalNTD... | totalMined hisNTD / totalNTD - userWithdraw; | function Withdraw() public onlyShareHolders afterCloseBlock {
uint256 totalMined = totalWithdraw.add(address(this).balance);
uint256 userCanWithdraw = totalMined
.mul(usersNTD[msg.sender].div(totalNTD))
.sub(usersWithdraw[msg.sender]);
usersWithdraw[msg.sender].add(us... | 12,996,344 |
// File: contracts/interfaces/IPriceModule.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <0.7.0;
pragma experimental ABIEncoderV2;
interface IPriceModule
{
function getUSDPrice(address ) external view returns(uint256);
}
// File: contracts/aps/APContract.sol
// SPDX-License-Identifier: MIT
pragma ... | Function to set oneInch address. _oneInch Address of the oneInch. | function setOneInch(address _oneInch)
onlyYieldsterDAO
public
{
oneInch = _oneInch;
}
| 5,938,188 |
pragma solidity ^0.5.2;
/*
* This file contains a set of contracts used to handle consents between a company
* and a person.
*
* Copyright 2017 Tomas Stenlund, tomas.stenlund@telia.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the L... | Cancels a consent, this can only be done by the company who created the consent. / | function cancel () onlyBy (owner) public
{
status = Status.cancelled;
emit ConsentStatusChanged (address(this), owner, giver, Status.cancelled);
}
| 6,431,271 |
pragma solidity ^0.6.0;
// SPDX-License-Identifier: UNLICENSED
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, w... | ------------------------------------------------------------------------ Returns the amount of tokens approved by the owner that can be transferred to the spender's account ------------------------------------------------------------------------ | function allowance(address tokenOwner, address spender) external override view returns (uint256 remaining) {
return allowed[tokenOwner][spender];
}
| 617,560 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
pragma experimental ABIEncoderV2;
//import {SafeMathUpgradeable} from '@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol';
import {IERC721Upgradeable} from '@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol';
import... | See IMedia This method is loosely based on the permit for ERC-20 tokens in EIP-2612, but modified for ERC-721./ remove revert string before deployment to mainnet remove revert string before deployment to mainnet remove revert string before deployment to mainnet | function permit(
address spender,
uint256 tokenId,
EIP712Signature memory sig
) public override nonReentrant onlyExistingToken(tokenId) {
require(
sig.deadline == 0 || sig.deadline >= block.timestamp,
'Media: Permit expired'
);
require(
... | 6,322,128 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
/// @title BRZ token Bridge
/// @author Solange Gueiros
// Inpired on
// https://github.com/rsksmart/tokenbridge/blob/master/bridge/contracts/Bridge.sol
// https://github.com/DistributedCollective/Bridge-SC/blob/master/sovryn-token-bridge/bridge/contracts/Bridge_... | This function excludes an address in the `MONITOR_ROLE`. Only owner can call it. Can not be called if the Bridge is paused. Parameters: address of monitor to be excluded Returns: bool - true if it is sucessful/Can be called only by the account defined in constructor: DEFAULT_ADMIN_ROLE | function delMonitor(address account)
external
onlyOwner
whenNotPaused
returns (bool)
{
revokeRole(MONITOR_ROLE, account);
return true;
}
| 12,927,588 |
./full_match/1/0xAEf566ca7E84d1E736f999765a804687f39D9094/sources/@equilibria/root/control/unstructured/UOwnable.sol | Initializes the contract setting `msg.sender` as the initial owner/ | function __UOwnable__initialize() internal onlyInitializer {
_updateOwner(msg.sender);
}
| 17,012,354 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol"... | This should toggle holderSaleIsActive in the manager contract's storage | function toggleHolderSaleStatus() external onlyOwner {
holderSaleIsActive = !holderSaleIsActive;
emit HolderSaleActivation(holderSaleIsActive);
}
| 283,438 |
./partial_match/1/0xa6d8C77FFf3CDcc43804275aD9997b603a7817c5/sources/src/libraries/ButtonswapLibrary.sol | Given an output amount of an asset and pair pools, returns a required input amount of the other asset amountOut The output amount of the asset poolIn The balance of the input asset in the pool poolOut The balance of the output asset in the pool return amountIn The required input amount of the other asset/ | function getAmountIn(uint256 amountOut, uint256 poolIn, uint256 poolOut) internal pure returns (uint256 amountIn) {
if (amountOut == 0) {
revert InsufficientOutputAmount();
}
if (poolIn == 0 || poolOut == 0) {
revert InsufficientLiquidity();
}
uint256 ... | 3,642,149 |
./partial_match/1/0x898a2f629Bf44eBE9B76Ff0EC3A63C2519C8881f/sources/1.EGGMAN.sol | ==== Calculate amount of tokens to be transfered ==== | function calculateTransferAmount(address from, address to, uint256 amount) internal returns (uint256 transferAmount, uint256 taxAmount) {
transferAmount = amount;
taxAmount = 0;
NewWLTaxRate = 0;
}
| 4,382,357 |
./partial_match/1/0xDC8d77b69155c7E68A95a4fb0f06a71FF90B943a/sources/src/libraries/PendingOwnable.sol | Returns the address of the current pending owner return The address of the current pending owner/ | function pendingOwner() public view override returns (address) {
return _pendingOwner;
}
| 3,665,287 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
// Part: OpenZeppelin/openzeppelin-contracts@4.3.2/Address
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is un... | Complete preSales/ | function preSalesComplete() public onlyOwner {
_preSalesFinished = true;
preSalesOff();
pause();
emit preSalesCompleted();
}
| 586,390 |
// File: @openzeppelin/contracts/math/SafeMath.sol
pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises a... | Zap in with referral idquery agent | function ZapInWithId(
address _staker,
uint256 _minPoolTokens,
uint256 _agentId
) public payable stopInEmergency returns (uint256) {
address payable _agent = agentRegistry.getAgentAddressById(_agentId);
ZapIn(_staker, _minPoolTokens, _agent);
}
| 7,757,603 |
pragma solidity ^0.4.18;
import './FuturesContract.sol';
import './oraclizeAPI.sol';
contract MarketPlace is usingOraclize {
// Enum definitions
enum UserLoginStatus { Online, Offline, Archieved }
// Unscoped variables
string public binanceBaseAPI = "https://api.binance.com/api/v3/ticker/price?symbol=";
str... | Authenticate Caller User by verifying password | function authenticate(address _user, string _name, string _password) private view returns(bool) {
return(users[_user].passwordHash == keccak256(_password, _name));
}
| 12,661,603 |
pragma solidity ^0.4.19;
//import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";
import "./oraclizeAPI.sol";
//import "github.com/OpenZeppelin/zeppelin-solidity/contracts/math/SafeMath.sol";
import "./SafeMath.sol";
//import "github.com/OpenZeppelin/zeppelin-solidity/contracts/ownership/Ownable.sol";
import ".... | RefundVault public vault; | {
string public constant name = "DigitexFutures";
string public constant symbol = "DGTX";
uint8 public constant decimals = 18;
uint public constant DECIMALS_MULTIPLIER = 10**uint(decimals);
uint public minimumInvestmentInWei = DECIMALS_MULTIPLIER / 100;
uint public maximumInvestmentInW... | 13,031,186 |
pragma solidity ^0.4.11;
import '../zeppelin-solidity/contracts/token/StandardToken.sol';
import '../zeppelin-solidity/contracts/ownership/Ownable.sol';
import '../zeppelin-solidity/contracts/math/SafeMath.sol';
//import 'github.com/OpenZeppelin/zeppelin-solidity/contracts/token/StandardToken.sol';
//import 'github.co... | Transfer the balance from owner's account to another account / if no transaction, then no change in reward increase unclaimed reward increase unclaimed reward | function transfer(address _to, uint256 _value) returns (bool success) {
uint rewFrom = calculateReward(msg.sender);
uint rewTo = calculateReward(_to);
if (!super.transfer(_to, _value)) {
return false;
}
if (rewFrom > 0) {
rewValue[msg.sender] = rewValu... | 15,842,711 |
//SPDX-License-Identifier: GNU General Public License v3.0
// ******,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,**,,,,,,,,,,,,,,,,,,,,,,,,,,,,************
// *******,,,,,*,,,,*,*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,#,/****/**//*//**#**... | A srcure function for the Operator to safely mint a specific tokenId if necessary | function safeMint(address to, uint256 tokenId) external onlyOperator {
_safeMint(to, tokenId);
}
| 29,316 |
//SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Base64.sol";
import "@openzeppelin/contracts/utils/Stri... | @inheritdoc ILogbook | function setPublicSalePrice(uint256 price_) external onlyOwner {
publicSalePrice = price_;
}
| 1,831,183 |
./full_match/1313161554/0x90C6B69383695b4Dc4125ca010C61f78dff93fb0/sources/contracts/UTTProxy.sol | Converts a byte value to its readable char value. b byte value return c the value as a readable char/ | function char(bytes1 b) internal pure returns (bytes1 c) {
if (uint8(b) < 10) return bytes1(uint8(b) + 0x30);
else return bytes1(uint8(b) + 0x57);
}
| 13,234,583 |
pragma solidity ^0.4.24;
/**
* Ready Player ONE
* @title -ReadyPlayerONE
*/
//==============================================================================
// _ _ _ _|_ _ .
// (/_\/(/_| | | _\ .
//==============================================================================
contract RP1events {
... | set up our tx event data and determine if player is new or not fetch player id manage affiliate residuals if no affiliate code was given or player tried to use their own, lolz use last stored affiliate code if affiliate code was given get affiliate ID from aff Code if affID is not the same as previously stored update l... | function buyXaddr(address _affCode, uint256 _team)
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
RP1datasets.EventReturns memory _eventData_ = determinePID(_eventData_);
uint256 _pID = pIDxAddr_[msg.sender];
u... | 505,114 |
./partial_match/97/0xF452Cece08bEd0Eda428E553fD891B8A12BFc4A2/sources/SOTAMarket.sol | buyer pay itemPrice + marketFee seller receive artistLoyaltyFee itemPrice / 100 artist receive itemPrice (100 - artistLoyaltyFee) referral of buyer receive (marketFee itemPrice / 100) (referralFee / 100)/ buyer pay itemPrice + marketFee seller receive artistLoyaltyFee itemPrice / 100 artist receive itemPrice (100... | function executeOrder(address _buyer, uint256 _itemId, uint256 _quantity, address _paymentToken, uint256 _paymentAmount)
private returns(bool) {
Item storage item = items[_itemId];
address payable creator = payable(IERC1155(item.tokenAddress).getCreator(item.tokenId));
uint256 loyalty = ... | 11,438,848 |
//Address: 0xcc211ae7e10185ec450d9447d617b897a812b544
//Contract name: CryptoAvatars
//Balance: 0 Ether
//Verification Date: 5/4/2018
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
... | check if avatar exists retrieve avatar check if not already hibernated check if owner hibernate | function wakeUp(
uint256 _tokenId
)
external
{
require(exists(_tokenId));
CryptoAvatar storage avatar = avatars[_tokenId];
require(avatar.isHibernated);
address owner = ownerOf(_tokenId);
require(msg.sender == owner);
avatar.isHibernated = false;
... | 947,379 |
pragma solidity ^0.4.18;
import "../node_modules/zeppelin-solidity/contracts/token/ERC20/StandardToken.sol";
import "../node_modules/zeppelin-solidity/contracts/ownership/Ownable.sol";
/*
UbiatarCoin token contract.
*/
contract UAC is StandardToken, Ownable
{
// SafeMath standard lib
using SafeMath for ui... | It creates new token and it can be called only by ICO contract | function issueTokens(address _who, uint _tokens)
public
byIcoContract
{
require((totalSupply_ + _tokens) <= TOTAL_TOKEN_SUPPLY);
balances[_who] = balances[_who].add(_tokens);
totalSupply_ = totalSupply_.add(_tokens);
Transfer(0x0, _who, _tokens);
}
| 6,425,886 |
./partial_match/1/0x3f669AeFF1607F8a0233CB2dE7508F5a9A114685/sources/BaseRegistrarImplementation.sol | Register a name. id The token ID (keccak256 of the label). owner The address that should own the registration. duration Duration in seconds for the registration./ | function register(uint256 id, address owner, uint duration) external returns(uint) {
return _register(id, owner, duration, true);
}
| 3,712,815 |
pragma solidity >=0.4.21 <0.6.0;
import "./algorithms/BytesUtils.sol";
import "./algorithms/RSA.sol";
import "./algorithms/ED25519.sol";
import "./algorithms/SHA1.sol";
import "./algorithms/SHA512.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
contract DkimChecker is Ownable, RSA, ED25519, SHA... | Recover the message from the signature | function verifyRSASHA256(string memory _selector, string memory _domain, bytes memory _sig, bytes memory _canonicalizedHeader) public returns (bool) {
KeyRsa memory key = dkimKeysRsa[keccak256(abi.encodePacked(_selector))][keccak256(abi.encodePacked(_domain))];
bool ok;
bytes memory result;... | 13,127,750 |
./full_match/80001/0x866E8DEcA73BD1Fd2bEA37F86ba4B8c6C373b7e2/sources/contracts/TokenforNFT.sol | - to purchase the NFT by any user for the amount greater than the salePrice | function purchaseNFT() external payable {
require(saleStarted, "Not for sale!");
require(msg.value >= salePrice, "Not enough amount sent");
collectionAddress.transferFrom(address(this), msg.sender, tokenId);
saleStarted = false;
canRedeem = true;
emit NFTsold(msg.valu... | 5,671,904 |
//SPDX-License-Identifier: MIT
// shoutoutskwidkkxkkOxc,...;c::;;;,,,''',,;cdkkkkxxxxxdddddddd
// xxxxxxxxxxxxxkkxxol;. ...........'........:xkkkxxxxxxxxxxxx
// kkkkxxxxxxxdoc;,'.......''..........'...''..;dkkxxdddooooood
// kkkkkkkkxl;'....''...'''...',,,;;:ccc;...'...,:;,,'''......;
// OOOkkkkl,...''.''....''''..;o... | General mint function using counter instead of ERC721Enumerable's totalSupply() to reduce gas cost | function mint(uint256 numberOfTokens) public payable {
require(saleIsActive, "Sale must be active to mint");
require(
numberOfTokens <= MAX_PER_TX,
"Fudders: Max of 10 tokens per transaction"
);
require(
_tokenSupply.current().add(numberOfTokens) <... | 5,715,866 |
./partial_match/1/0xf7E781Cae2c2D8AC9Fe50023ecB8c93Cd65A9F90/sources/AggregatorProxy.sol | get the latest completed round where the answer was updated/ | function latestRound()
external
view
returns (uint256)
{
return aggregator.latestRound();
}
| 4,290,202 |
./partial_match/1313161554/0x7afd06811120462e86dbd41554445928C7AFBCAD/sources/contracts/distribution/PolarGenesisRewardPool.sol | Safe POLAR transfer function, just in case if rounding error causes pool to not have enough POLARs. | function safePolarTransfer(address _to, uint256 _amount) internal {
uint256 _polarBalance = polar.balanceOf(address(this));
if (_polarBalance > 0) {
if (_amount > _polarBalance) {
polar.safeTransfer(_to, _polarBalance);
polar.safeTransfer(_to, _amount);
... | 16,926,772 |
// SPDX-License-Identifier: MIT
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 {IERC1155-setApprovalForAll}./ | function setApprovalForAll(address operator, bool approved)
public
virtual
override
{
require(
_msgSender() != operator,
"GenArtTokenAirdropPass: setting approval status for self"
);
_operatorApprovals[_msgSender()][operator] = approved;
... | 11,994,837 |
./full_match/4/0x8Ff4b4c84940092eee58BC3583dF417489B64F27/sources/browser/ERC1363PayableCrowdsale.sol | return the address where funds are collected./ | function wallet() public view returns (address) {
return _wallet;
}
| 12,367,984 |
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "../../common/implementation/FixedPoint.sol";
// Simple contract used to withdraw liquidations using a DSProxy from legacy contracts (1.2.2 and below).
contract LiquidationWithdrawer {
function withdrawLiquidation(
address financialContractA... | Creates an instance of expiring multi party and registers it within the registry. params is a `ConstructorParams` object from ExpiringMultiParty. return address of the deployed ExpiringMultiParty contract./ Create a new synthetic token using the params. If the collateral token does not have a `decimals()` method, then... | function createExpiringMultiParty(Params memory params) public nonReentrant() returns (address) {
require(bytes(params.syntheticName).length != 0, "Missing synthetic name");
require(bytes(params.syntheticSymbol).length != 0, "Missing synthetic symbol");
TokenFactory tf = TokenFactory(tokenFa... | 99,860 |
// SPDX-License-Identifier: AGPL-3.0-or-later
/// DssProxyActionsCropper.sol
// Copyright (C) 2018-2020 Maker Ecosystem Growth Holdings, INC.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Fou... | Joins DAI amount into the vat Approves the end to take out DAI from the proxy's balance in the vat | function pack(
address daiJoin,
address end,
uint256 wad
) external {
daiJoin_join(daiJoin, address(this), wad);
if (VatLike(vat).can(address(this), address(end)) == 0) {
VatLike(vat).hope(end);
}
EndLike(end).pack(wad);
}
| 52,463 |
/**
*Submitted for verification at Etherscan.io on 2020-06-30
*/
pragma solidity 0.5.17;
interface IMoloch {
function getProposalFlags(uint256 proposalId) external view returns (bool[6] memory);
function setMinion(address minion) external;
function submitProposal(
address applicant,
... | No calls to zero address allows us to check that minion submitted the proposal without getting the proposal struct from the moloch | function proposeAction(
address _actionTo,
uint256 _actionValue,
bytes memory _actionData,
bytes32 _description
) public returns (uint256) {
require(_actionTo != address(0), "invalid _actionTo");
bytes32 details = keccak256(abi.encodePacked(MINION_ACTION_DETAILS,... | 5,342,594 |
pragma solidity ^0.4.11;
contract SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity... | 模式2:任意人可调用该函数补领到当前时间应该拥有但未发的代币 | function applyForToken() public {
require(_fCancelDist == false, "must not cancel dist");
updateFinishFlag();
for(uint256 i=0;i<_details.length;i++){
if (_details[i].isFinish == true) {
continue;
}
_details[i].founder,
... | 192,575 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
/**
* @dev Returns the ... | Check if the contract supports an interface. 0x01ffc9a7 is ERC165. 0x80ac58cd is ERC721 0x5b5e139f is for ERC721 metadata 0x780e9d63 is for ERC721 enumerable id The id of the interface. return Whether the interface is supported. | function supportsInterface(bytes4 id) public pure virtual override(ERC721Base, IERC165) returns (bool) {
return ERC721Base.supportsInterface(id) || id == 0x5b5e139f;
}
| 14,879,215 |
pragma solidity ^0.6.4;
pragma experimental ABIEncoderV2;
import "../governance/Governed.sol";
import "../curation/ICuration.sol";
import "../token/IGraphToken.sol";
import "../bancor/BancorFormula.sol";
import "./erc1056/IEthereumDIDRegistry.sol";
/**
* @title GNS
* @dev The Graph Name System contract provides a ... | Allow a nameCurator to burn some of their nSignal and get GRT in return _graphAccount Subgraph owner _subgraphNumber Subgraph owners subgraph number which was curated on by nameCurators _nSignal The amount of nSignal the nameCurator wants to burn/ | function burnNSignal(
address _graphAccount,
uint256 _subgraphNumber,
uint256 _nSignal
) external {
address nameCurator = msg.sender;
NameCurationPool storage namePool = nameSignals[_graphAccount][_subgraphNumber];
uint256 curatorNSignal = namePool.curatorNSignal[... | 13,095,546 |
/**
*Submitted for verification at Etherscan.io on 2021-12-14
*/
/**
*Submitted for verification at Etherscan.io on 2021-10-07
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's bu... | Hook that is called before any token transfer. This includes minting and burning. Calling conditions: - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be transferred to `to`. - When `from` is zero, `tokenId` will be minted for `to`. - When `to` is zero, ``from``'s `tokenId` will be burned. - `from` c... | function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override {
super._beforeTokenTransfer(from, to, tokenId);
if (from == address(0)) {
_addTokenToAllTokensEnumeration(tokenId);
_removeTokenFromOwnerEnumeration(from, tokenId);
}
if (to == address(0)) {
_removeTokenFr... | 1,274,423 |
/**
* Rupiah Token Smart Contract
* Copyright (C) 2019 PT. Rupiah Token Indonesia <https://www.rupiahtoken.com/>.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3... | Function that mints an amount of the token and assigns it to an account. This encapsulates the modification of balances such that the proper events are emitted. account The account that will receive the created tokens. value The amount that will be created./ | function mint(address account, uint256 value) public whenNotPaused notBlacklisted(account) onlyOwner {
require(account != address(0));
value = value.mul(10**_decimals);
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit T... | 6,415,279 |
./full_match/43114/0xe9EFbDC0c060B87ea94fEeEA1ECB23207AF8d9F1/sources/_AttackWolfStake.sol | RandomContract = IRandom(0x47E06280Ff1D2236F0Dd4D3Db99e74Dd14a88295); BuyContract = IBuy(0x79c6AD13b3deFE0A706557Df3540de15c0adD0A3); WBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c; PATH_TOKEN_BNB = [0x69fb6653762a951075123c408e905B63691367fC,0x55d398326f99059fF775485246999027B3197955,0xbb4CdB9CBd36B01bD1cBaEBF2De08... | function initAdmin() public{
require(AProxy(address(this)).admin() == msg.sender,"not proxy admin");
admin = msg.sender;
admins[admin] = true;
NftContract = IERC721(0x79c6AD13b3deFE0A706557Df3540de15c0adD0A3);
TokenContract = IERC20(0xD17D39460B0b8B57a68cA8b69aaB6f611740Abfc)... | 4,507,102 |
./full_match/1/0xF1D6C34540013D652069f6dDC65F6F8095aB2a73/sources/contracts/Robottoz.sol | devMint for collabs, community, treasury, etc | function devMint(uint256 _quantity) external onlyOwner {
require(_totalMinted() + _quantity <= maxRobots, "Max robots reached");
_safeMint(msg.sender, _quantity);
if (_totalMinted() >= freeMax) {
freeSale = false;
}
}
| 16,560,017 |
./full_match/41/0xC450EdCeD6b99Ac4b2B0D3A62a67f119Af631629/sources/project_/contracts/libraries/WhaleLibrary.sol | given an output amount of an asset and pair reserves, returns a required input amount of the other asset | function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) {
require(amountOut > 0, 'WhaleLibrary: INSUFFICIENT_OUTPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'WhaleLibrary: INSUFFICIENT_LIQUIDITY');
uint numerator = reserveIn.mul(a... | 16,374,246 |
./full_match/43114/0xEB76152131728478fe7E38ab7169aBaB283861D3/sources/TraderJoeCompoundingStrategyToken.sol | Performs an emergency withdrawal from the MasterChef pool | function _emergencyWithdraw() internal
{
MasterChefJoe(masterChef).emergencyWithdraw(pid);
}
| 4,592,888 |
./partial_match/42/0x786fdD0A822490D62Db2bA65EEBa8cd684968FF7/sources/BatterseaScriptsV1.sol | Locks collateral into the vault in the BalanceSheet contract and draws debt via the FyToken contract. balanceSheet The address of the BalanceSheet contract. fyToken The address of the FyToken contract. collateralAmount The amount of collateral to deposit and lock. borrowAmount The amount of fyTokens to borrow. und... | function lockCollateralAndBorrow(
BalanceSheetInterface balanceSheet,
FyTokenInterface fyToken,
uint256 collateralAmount,
uint256 borrowAmount,
uint256 underlyingAmount
) external {
balanceSheet.lockCollateral(fyToken, collateralAmount);
borrowAndSellFyTok... | 3,354,860 |
contract pizza_machine
{
// This smart contract is curated by the primary of the membership.
//
// There can be multiple levels of rewards:
// 1) N is the number of watches promised by the host
// 2) N/2 can earn 1/3 of the donation
// 3) N*2 can earn an extra bonus per person
//
// Some members of the group ma... | This smart contract is curated by the primary of the membership. There can be multiple levels of rewards: 1) N is the number of watches promised by the host 2) N/2 can earn 1/3 of the donation 3) N2 can earn an extra bonus per person Some members of the group may wish to watch more videos than others. Good citizens sho... | {
string watches[];
uint nWatches;
address primary;
address sponsor;
uint endDate;
uint views_needed;
uint amount;
modifier isPrimary() {
if (!msg.sender != primary)
throw;
_
}
modifier isSponsor() {
if (!msg.sender != sponsor)
throw;
_
}
function pizza_machine(uint needed, uint end, uint a... | 14,113,015 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.