file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// File: @openzeppelin/contracts@4.4.1/utils/Create2.sol
// OpenZeppelin Contracts v4.4.1 (utils/Create2.sol)
pragma solidity ^0.8.0;
/**
* @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.
* `CREATE2` can be used to compute in advance the address where a smart
* contract will be deployed, ... | Returns the address where a contract will be stored if deployed via {deploy}. Any change in the `bytecodeHash` or `salt` will result in a new destination address./ | function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {
return computeAddress(salt, bytecodeHash, address(this));
}
| 1,682 |
./full_match/80001/0x50b4cB2C152322760a8fA59105A46745CE2B7Eac/sources/src/Facets/GetGasFacet.sol | Performs a swap before bridging via GetGas Bridge _bridgeData Data used purely for tracking and analytics _swapData An array of swap related data for performing swaps before bridging | function swapAndStartBridgeTokensViaGetGas(
ILiFi.BridgeData memory _bridgeData,
LibSwap.SwapData[] calldata _swapData
)
external
payable
nonReentrant
refundExcessNative(payable(msg.sender))
containsSourceSwaps(_bridgeData)
validateBridgeData(_brid... | 9,508,193 |
pragma solidity ^0.4.18;
library Bytes {
function concat(bytes memory self, bytes memory bts) internal view returns (bytes memory newBts) {
uint totLen = self.length + bts.length;
if (totLen == 0)
return;
newBts = new bytes(totLen);
assembly {
let i := 0... | get block number and transactions of current block block number start from 1 | function getCurrentBlockNumberandTXcount() public view returns (uint32 _bn, uint32 _numTxs ) {
if ( currentPlasmaBlockNumber == 0) revert();
PlasmaBlockHeader ph = plasmaBlockHeaders[currentPlasmaBlockNumber];
return ( currentPlasmaBlockNumber, ph.numTransactions);
| 925,323 |
./partial_match/137/0x309523B3B73A68079fB9D9A8da08c642dF8d1b93/sources/project_/contracts/GenesisMinter.sol | Interfaces to access minter and details editor functions User has not reached the limit yet Setup avatar attributes | function teamMint() external onlyRole(TEAM_MINTER_ROLE) {
AvatarDetailEditor detailEditor = AvatarDetailEditor(
genesisAvatarContract
);
SimpleAvatarMinter genesisAvatarInstance = SimpleAvatarMinter(
genesisAvatarContract
);
for (uint256 i = 0; i < 1... | 3,512,601 |
./full_match/4/0x164c24d0844c267DA15a4c841eaBae817d211EA1/sources/Users/hristiyangeorgiev/Documents/Projects/Redemeum/ERC20/bsn-core-prototype/contracts/ERC1155ERC721.sol | Check successful transfer if recipient is a contract ERC-1155 _operator The operator of the transfer _from Address of sender _to Address of recipient _tokenId ID of the token _value Value transferred _data Optional data/ | function _doSafeTransferAcceptanceCheck(
address _operator,
address _from,
address _to,
uint256 _tokenId,
uint256 _value,
bytes memory _data
)
internal
{
if(_to.isContract()) {
require(ERC1155TokenReceiver(_to).onERC1155Received(_op... | 13,350,719 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "./base/Controller.sol";
import "./base/EternalStorage.sol";
import "./base/IEntityFundingFacet.sol";
import "./base/IDiamondFacet.sol";
import "./base/IERC20.sol";
import "./base/IMarket.sol";
import "./base/SafeMath.sol";
import "./EntityFacetBase.sol";
... | check balance do it | function trade(address _payUnit, uint256 _payAmount, address _buyUnit, uint256 _buyAmount)
external
override
assertCanTradeTrancheTokens
returns (uint256)
{
_assertHasEnoughBalance(_payUnit, _payAmount);
return _tradeOnMarket(_payUnit, _payAmount, _buyUnit, _buyAmount, FEE_SCHEDULE_STANDARD,... | 12,675,792 |
// SPDX-License-Identifier: MIT
/**
∩~~~~∩
ξ ・×・ ξ
ξ ~ ξ
ξ ξ
ξ “~~~~〇
ξ ξ
ξ ξ ξ~~~ξ ξ ξ
ξ_ξξ_ξ ξ_ξξ_ξ
Alpaca Fin Corporation
**/
pragma solidity 0.8.10;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/... | Receive reward from FairLaunch | function _fairLaunchHarvest() internal {
uint256 _before = token.myBalance();
(bool _success, ) = address(fairLaunch).call(abi.encodeWithSelector(0xddc63262, fairLaunchPoolId));
if (_success) emit LogFairLaunchHarvest(address(this), token.myBalance() - _before);
}
| 12,869,468 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.10;
import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {Registry} from "../registry/Registry.sol";
import {OwnedUpgradeabilityProxy} from "../proxy/OwnedUpgradeabilityProxy... | Replace the current mintkey with new mintkey _newMintKey address of the new mintKey/ | function transferMintKey(address _newMintKey) external onlyOwner {
require(_newMintKey != address(0), "new mint key cannot be 0x0");
emit TransferMintKey(mintKey, _newMintKey);
mintKey = _newMintKey;
}
| 12,694,008 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.4;
import "../../interfaces/IMirinCurve.sol";
import "../../libraries/MathUtils.sol";
/**
* @dev Hybrid curve of constant product and constant sum ones (4a(r_0 +r _1) + k = 4ak + (k^3/4r_0r_1))
* Excerpted from https://github.com/saddle-finance/saddle-contract/b... | Get D, the StableSwap invariant, based on a set of balances and a particular A. See the StableSwap paper for details xp a precision-adjusted set of pool balances. Array should be the same cardinality as the pool. _A the amplification coefficient n (n - 1) in A_PRECISION. See the StableSwap paper for details return ... | function _getD(uint256[2] memory xp, uint256 _A) private pure returns (uint256) {
uint256 s = xp[0] + xp[1];
if (s == 0) {
return 0;
}
uint256 prevD;
uint256 D = s;
uint256 nA = _A * 2;
for (uint256 i = 0; i < MAX_LOOP_LIMIT; i++) {
u... | 5,439,610 |
/*
* Copyright 2017-2018 the DCSS authors
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the followi... | Set allowance for other address and notify Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it _spender The address authorized to spend _value the max amount they can spend _extraData some extra information to send to the approved contract/ | function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
... | 12,638,171 |
./full_match/1/0x19bFC3E2De100908DB81C82fdB28205c3b96A4D4/sources/project_/contracts/ThePirateBay.sol | returns the amount of tokens earned account address of the account | function earned(address account) public view returns (uint256 _earned) {
uint256 multiplier = totalMultiplier(account);
return multiplier * totalReward / totalMultipliers;
}
| 4,839,217 |
pragma solidity 0.5.10;
contract Context {
constructor () internal { }
function _MSGSENDER793() internal view returns (address payable) { //inject NONSTANDARD NAMING
return msg.sender;
}
function _MSGDATA330() ... | inject NONSTANDARD NAMING | function SETCOLLATERAL164(CollateralInterface col_) external { | 1,784,192 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.4.23;
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, a... | Locks senders tokens for the specified time Must approve the contract for transfering tokens before calling this function/ | function lock(ERC20 token, uint256 amount, uint256 releaseTime) public returns (bool) {
require(releaseTime > block.timestamp, "release time is before current time");
require(amount > 0, "token amount is invalid");
address _tokenOwner = msg.sender;
address _tokenAddr = addre... | 10,851,177 |
pragma solidity ^0.4.24;
// File: contracts/FiatTokenV1.sol
/**
* @title Ownable
* @dev The Ownable contract from https://github.com/zeppelinos/labs/blob/master/upgradeability_ownership/contracts/ownership/Ownable.sol
* branch: master commit: 3887ab77b8adafba4a26ace002f3a684c1a3388b modified to:
* 1) Add ... | Function to add/update a new minter minter The address of the minter minterAllowedAmount The minting amount allowed for the minter return True if the operation was successful./ | function configureMinter(address minter, uint256 minterAllowedAmount) whenNotPaused onlyMasterMinter public returns (bool) {
minters[minter] = true;
minterAllowed[minter] = minterAllowedAmount;
emit MinterConfigured(minter, minterAllowedAmount);
return true;
}
| 15,802,233 |
./partial_match/1/0x3Bf26541b28A19D31f26cAC34E7CDC0912347ce5/sources/DojimaRiceMarket.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Dojima Rice Market", "DRM") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pa... | 2,840,478 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import './MixinLockCore.sol';
import "hardhat/console.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
/**
* @title Mixin for managing `Key` data, as well as the * Approval related functions needed to meet the ERC721
* standard.
* @author Hardl... | Sets or unsets the approval of a given operator An operator is allowed to transfer all tokens of the sender on their behalf _to operator address to set the approval _approved representing the status of the approval to be set/ | function setApprovalForAll(
address _to,
bool _approved
) public
onlyIfAlive
{
require(_to != msg.sender, 'APPROVE_SELF');
managerToOperatorApproved[msg.sender][_to] = _approved;
emit ApprovalForAll(msg.sender, _to, _approved);
}
| 7,240,801 |
./full_match/43113/0x04E9c56359DE02F5384326BC5e975893f628658f/sources/contracts/WOLFI.sol | split amount to fee and transfer amountswap, transfer, liquidity Transfer the amount with 1% from the initial amount reflection fee | function _transfer(
address sender,
address recipient,
uint256 amount)
internal override {
require(sender != address(0), "WOLFI: transfer from the zero address");
require(recipient != address(0), "WOLFI: transfer to the zero address");
require(amount > 0, "WOL... | 7,182,065 |
./full_match/5/0x782D67A65e916CD179761C5c5fc817c1DA57D467/sources/src/zkbob/utils/KycProvidersManagerStorage.sol | Tells the KYC Providers Manager contract address. return res the manager address./ | function kycProvidersManager() public view returns (IKycProvidersManager res) {
assembly {
res := sload(KYC_PROVIDER_MANAGER_STORAGE)
}
}
| 11,620,492 |
//Address: 0xdf68995f07882120b44da1d0fabf41ca1681deec
//Contract name: Provide
//Balance: 0 Ether
//Verification Date: 8/30/2017
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.13;
/**
* Provide platform contract.
*/
contract Provide {
using SafeMath for uint;
/** Provide contract owner; has ... | Deploy a work order contract. _peer Address of party purchasing services _identifier Provide platform work order identifier (UUIDv4)/ | function createWorkOrder(
address _peer,
uint128 _identifier
) onlyPrvd returns(address workOrder) {
return new ProvideWorkOrder(token, prvd, prvdWallet, paymentEscrow, _peer, _identifier);
}
| 7,215,153 |
pragma solidity >=0.4.24;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
contract FlightSuretyData {
using SafeMath for uint256;
using SafeMath for uint8;
/********************************************************************************************/
/* ... | credits all ensurees for the given flight (flight key)/ | function creditInsurees(bytes32 _flightKey, uint256 _multiplier) external
requireIsOperational
requireIsAuthorized
{
address airlineAddress = flights[_flightKey].airline;
for (uint i = 0; i < flightInsurances[_flightKey].length; i++)
{
Insurance storage insurance = in... | 12,797,383 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.6;
pragma experimental ABIEncoderV2;
/**
* @title StakeAllIndex
* @dev Main Contract For DeFi Smart Accounts. This is also a factory contract, Which deploys new Smart Account.
* Also Registry for DeFi Smart Accounts.
*/
interface AccountInterface {
f... | Check if Account Module is a clone. version Account Module version. query Account Module Address./ solium-disable-next-line security/no-inline-assembly | function isClone(uint256 version, address query)
external
view
returns (bool result)
{
bytes20 targetBytes = bytes20(account[version]);
assembly {
let clone := mload(0x40)
mstore(
clone,
0x363d3d373d3d3d363d730000000... | 13,383,513 |
pragma solidity >=0.5;
pragma experimental ABIEncoderV2;
/**
* @title DexStatus
* @dev Status for Dex
*/
contract DexStatus {
string constant ONLY_RELAYER = "ONLY_RELAYER";
string constant ONLY_AIRDROP = "ONLY_AIRDROP";
string constant ONLY_INACTIVITY = "ONLY_INACTIVITY";
string... | Airdrop the token directly to Dex user's walle,only airdrop contract can call this function. to the recipient token the ERC20 token to send amount the token amount to send/Not EOA | function airdrop(address to,address token,uint256 amount) public onlyAirdropContract
{
require(tx.origin != msg.sender);
require(_balances[token][msg.sender] >= amount ,INSUFFICIENT_FOUND);
_balances[token][msg.sender] = _balances[token][msg.sender].sub(amount);
_balances[t... | 1,805,340 |
pragma solidity 0.7.6;
//SPDX-License-Identifier: MIT
import "hardhat/console.sol";
import "./interfaces/IArbitrator.sol";
import "./interfaces/IArbitrable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract Arbitrator is IArbitrator, Ownable {
event DisputeStateChanged(uint256 indexed disputeId, ... | Close the evidence period of a dispute _disputeId Identification number of the dispute to close its evidence submitting period/ | function closeEvidencePeriod(uint256 _disputeId) external override {
Dispute storage dispute = disputes[_disputeId];
require(dispute.subject == IArbitrable(msg.sender), "ERROR_SUBJECT_NOT_DISPUTE_SUBJECT");
emit EvidencePeriodClosed(_disputeId, 0);
}
| 13,031,805 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "./IGage.sol";
/**
* @dev Loyalty Gage interface
* @author Nobody (me)
* @notice Methods are used for all loyalty gage contracts
*/
interface ILoyaltyGage is IGage {
// Initializes the loyalty gage
function initialize(address rAsset, address dAs... | Loyalty Gage interface Nobody (me) Methods are used for all loyalty gage contracts/ Initializes the loyalty gage View the distributor of the loyalty gage (usually token distributor) View the receiver in the loyalty gage (usually the user) View the gage's percent change in supply condition View the whether the gage's ... | interface ILoyaltyGage is IGage {
function initialize(address rAsset, address dAsset, uint256 rAmount, uint256 dAmount, uint256 rRisk, uint256 dRisk) external;
function viewDistributor() external view returns (address);
function viewReceiver() external view returns (address);
function viewPercent() exte... | 12,796,523 |
// hevm: flattened sources of src/pickle-jar.sol
pragma solidity >=0.6.0 <0.7.0;
////// src/interfaces/controller.sol
// SPDX-License-Identifier: MIT
/* pragma solidity ^0.6.0; */
interface IController {
function jars(address) external view returns (address);
function rewards() external view returns (addres... | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20_2 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uin... | 571,868 |
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view re... | update paramaters TODO do we need this function, or do updates happen via proxy upgrades? | function update(bytes32 params) external onlyTrueFi {
}
| 1,198,917 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@pancakeswap/pancake-swap-lib/contracts/token/BEP20/IBEP20.sol";
import "@pancakeswap/pancake-swap-lib/contracts/token/BEP20/SafeBEP20.sol";
import "@pancakeswap/pancake-swap-lib/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts-upgradeable/u... | Redeems BNB from Venus receives BNB. Wrap all the BNB that is in this contract./ | function _redeemBNBInvTokens(uint256 amountVTokens) internal nonReentrant {
_redeemInVTokens(amountVTokens);
WBNB wbnb = WBNB(payable(address(_wbnb)));
wbnb.deposit.value(address(this).balance)();
}
| 1,037,902 |
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.4;
import {MintableBurnableERC20} from './MintableBurnableERC20.sol';
import {Lockable} from '@uma/core/contracts/common/implementation/Lockable.sol';
/**
* @title Synthetic token contract
* Inherits from MintableBurnableERC20
*/
contract MintableBurnab... | Admin, minter and murner renounce to admin, minter and burner roles/ | function renounceAdminAndMinterAndBurner() public override nonReentrant() {
super.renounceAdminAndMinterAndBurner();
}
| 15,814,595 |
pragma solidity 0.5.10;
/// @dev Randomness test contract based on https://github.com/poanetwork/posdao-contracts.
/// Generates and stores random numbers in a RANDAO manner and accumulates a random seed.
contract Random {
mapping(uint256 => mapping(address => bytes32)) public hashes;
mapping(uint256 => mappin... | Returns the Keccak-256 hash and cipher of the validator's secret for the specified collection round and the specified validator stored by the validator through the `commitHash` function. _collectRound The serial number of the collection round for which hash and cipher should be retrieved. _miningAddress The mining ad... | function getCommitAndCipher(
uint256 _collectRound,
address _miningAddress
) public view returns(bytes32, bytes memory) {
return (hashes[_collectRound][_miningAddress], ciphers[_collectRound][_miningAddress]);
}
| 7,296,754 |
pragma solidity ^0.4.22;
/**
* @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) {
if (a == 0) {
return 0;
... | adding 'else' for each index costs more gas | function internalChangeAdminWallet(
uint index,
address addr
)
private onlyAdmin
{
if(index == 0)
{
internalTransferAccount(mainBalanceAdmin, addr);
mainBalanceAdmin = addr;
}
if(index == 1)
{
internalTrans... | 12,717,099 |
./partial_match/3/0x02D2FDCA7d73adbF48e9D581622075B4531BA68f/sources/FIRE.sol | Sets `amount` as the allowance of `spender` over the `owner` s tokens. This internal function is equivalent to `approve`, and can be used to e.g. set automatic allowances for certain subsystems, etc. Emits an {Approval} event. Requirements: - `owner` cannot be the zero address. - `spender` cannot be the zero address./ | function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
}
| 5,206,786 |
/**
* @title Membership
* @notice This contract stores basic modifiers which control the membership
* @dev The contract consists of the functionality of crowdsale-like token generation and basic functions of user management.
*/
pragma solidity ^0.4.21;
import "./Accessible.sol";
import "./ProposalInterface.sol"... | Add another whitelister. Only delegate has the right to add another whitelister. The new whitelister does not need to be a member of the DAAS. Theoretically, delegate can also take over the role of whitelister. _adr The address of the new whitelister/ whitelisterList.push(_adr); | function addWhitelister(address _adr) public delegateOnly returns (bool) {
require(isWhitelister(_adr) == false);
whitelisterList[whitelisterListLength] = _adr;
whitelisterListLength++;
emit ChangeInWhitelister(_adr,true);
return true;
}
| 12,611,507 |
pragma solidity ^0.5.0;
import "./TrivialGame.sol";
import "./Safemath.sol";
/** @title Tournament */
contract Tournament {
using SafeMath for uint;
//
// State Variables
//
// An array of registrants. Every registrant needs to be payable
address payable[] public registrants;
// Keep an ... | - The host can begin the tournament when they like - The tournament can only be started if there are more than one registrants | function startTournament()
public
notStopped
onlyHost
moreThanOnePlayer
{
for (uint i = 0; i < numberOfPlayers - 1; i++) {
games.push(new TrivialGame());
emit CreateGame(games[i]);
}
emit StartTournament();
}
| 6,392,791 |
./partial_match/1/0x521dd9162786CDB4DfE66E137958f194dC6770db/sources/contracts/v3/interfaces/IERC721PepeV3.sol | ERC-721 Non-Fungible Token Standard, optional enumeration extension/ | interface IERC721PepeV3 is IERC721 {
function setBaseURI(string memory uri) external;
function setPepeMinter(address _minter) external;
function setAuthorizedSigningAddress(address signer) external;
function mint(address to, uint256 imageHash) external;
function burn(uint256 _tokenId) external;
functio... | 2,602,750 |
pragma solidity 0.4.26;
import "./ISovrynSwapNetwork.sol";
import "./IConversionPathFinder.sol";
import "./converter/interfaces/IConverter.sol";
import "./converter/interfaces/IConverterAnchor.sol";
import "./converter/interfaces/ISovrynSwapFormula.sol";
import "./utility/ContractRegistryClient.sol";
import "./utility/... | deprecated, backward compatibility/ | function convertFor(
IERC20Token[] _path,
uint256 _amount,
uint256 _minReturn,
address _beneficiary
) public payable returns (uint256) {
return convertByPath(_path, _amount, _minReturn, _beneficiary, address(0), 0);
}
| 12,943,221 |
pragma solidity ^0.5.15;
import { ModexpInverse, ModexpSqrt } from "./ModExp.sol";
/**
@title Boneh–Lynn–Shacham (BLS) signature scheme on Barreto-Naehrig 254 bit curve (BN-254)
@notice We use BLS signature aggregation to reduce the size of signature data to store on chain.
@dev We use G1 points for sign... | / solium-disable-next-line security/no-inline-assembly | function hashToPoint(bytes32 domain, bytes memory message)
internal
view
returns (uint256[2] memory)
{
uint256[2] memory u = hashToField(domain, message);
uint256[2] memory p0 = mapToPoint(u[0]);
uint256[2] memory p1 = mapToPoint(u[1]);
uint256[4] memory b... | 1,769,801 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/AccessCo... | return premint discount price | function getPrice() public view returns (uint256) {
return _nftPrice;
}
| 12,073,028 |
pragma solidity ^0.8.0;
// Copyright 2020 Keyko GmbH.
// This product includes software developed at BigchainDB GmbH and Ocean Protocol
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
// Code is Apache-2.0 and docs are CC-BY-4.0
import './AgreementStoreLibrary.sol';
import '../conditions/ConditionStoreManager.... | getDIDRegistryAddress utility function used by other contracts or any EOA. return the DIDRegistry address/ | function getDIDRegistryAddress()
public
view
returns(address)
{
return address(didRegistry);
}
| 2,473,894 |
./full_match/42/0xEFB3CeDbe8d6C3FE0c0772013a42eDA72B9c87c7/sources/browser/MockDai.sol | Operator mints dino cash to a recipient recipient_ The address of recipient amount_ The amount of dino cash to mint to return whether the process has been done/ | function mint(address recipient_, uint256 amount_)
public
onlyOwner
returns (bool)
{
uint256 balanceBefore = balanceOf(recipient_);
_mint(recipient_, amount_);
uint256 balanceAfter = balanceOf(recipient_);
return balanceAfter > balanceBefore;
}
| 16,205,973 |
pragma solidity ^0.4.24;
// File: contracts\openzeppelin-solidity\contracts\ownership\Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address p... | Lock target account _target Target account to lock/ | function lockAccount(address _target) public
onlyOwner
returns (bool)
{
require(_target != owner);
require(!lockStates[_target]);
lockStates[_target] = true;
emit LockAccount(_target);
return true;
}
| 10,658,650 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.5;
import "../libraries/SafeMath.sol";
import "../libraries/Address.sol";
import "../interfaces/IsFLOOR.sol";
import "../interfaces/IgFLOOR.sol";
import "../types/ERC20.sol";
contract gFLOOR is IgFLOOR, ERC20 {
/* ========== DEPENDENCIES ========== */
us... | Determine the prior number of votes for an account as of a block number Block number must be a finalized block or else this function will revert to prevent misinformation. account The address of the account to check blockNumber The block number to get the vote balance at return The number of votes the account had as... | function getPriorVotes(address account, uint256 blockNumber) external view returns (uint256) {
require(blockNumber < block.number, "gFLOOR::getPriorVotes: not yet determined");
uint256 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
... | 327,387 |
pragma solidity ^0.4.26;
/**
* Math operations with safety checks
*/
contract SafeMath {
function safeMul(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) internal returns (uint2... | Check if the sender has enough Subtract from the sender Updates totalSupply | function burn(uint256 _value) returns (bool success) {
if (balanceOf[msg.sender] < _value) throw;
if (_value <= 0) throw;
balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value);
totalSupply = SafeMath.safeSub(totalSupply, _value);
Burn(msg.sender, _value);
... | 13,537,236 |
./partial_match/1/0xf9539C6e9Cdd31D2c5eF02052dA2DdF9C1bee757/sources/src/core/vaults/mixins/options/BaseOptionsVault.sol | Settles the existing option(s)/ | function _beforeCloseRound() internal virtual override {
VaultState memory vState = vaultState;
if (vState.round == 1) return;
uint256 currentExpiry = roundExpiry[vState.round];
if (currentExpiry <= PLACEHOLDER_UINT) revert OV_RoundClosed();
if (currentExpiry > block.time... | 15,544,415 |
./full_match/80001/0x911122c6760Aa4843382cB3d7E3a073F56459256/sources/LP/CKCoinPair.sol | scope for _token{0,1}, avoids stack too deep errors scope for reserve{0,1} Adjusted, avoids stack too deep errors | function swap(
uint256 amountCkOut,
uint256 amountUsdcOut,
address to
) external nonReentrant onlyCKRouter {
require(amountCkOut > 0 || amountUsdcOut > 0, "Insufficient output amount");
require(amountCkOut < reserveCk && amountUsdcOut < reserveUsdc, "Insufficient liquidity");
uint256 balanc... | 5,590,624 |
./full_match/4/0x5BDBa4CBF4a1fFDFe88097F48F896A64251e1abB/sources/contracts/AlejandraCollection.sol | retrieve all funds recieved from minting | function withdraw() public onlyOwner {
uint256 balance = accountBalance();
require(balance > 0, 'No Funds to withdraw, Balance is 0');
_withdraw(payable(owner()), balance);
}
| 12,480,936 |
pragma solidity ^0.5.0;
contract ResumeCheck {
struct resume { // Initialize arrays for resume data
address owner;
uint date;
}
address public creator;
uint public ResumeNo;
mapping(bytes32 => resume) public resumeHashMap; // Set mapping
constructor() public {
... | Get resume hash and assign date and owner to it | function CapResume(bytes32 hash) public view returns (uint date, address owner) { | 938,490 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
pragma experimental ABIEncoderV2;
import "./ethregistrar/BaseRegistrarImplementation.sol";
import "./resolvers/Resolver.sol";
import "./root/Controllable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
contract AMAENSClient is Controllable {
... | Create a nodehash from the label with the help of the Namehash of the root domain. _label The _label for the domain like test.amafans, test is the label./ | function getNodeHash(string memory _label) external view returns (bytes32,bytes32,uint256){
bytes32 label = keccak256(bytes(_label));
uint256 tokenId = uint256(label);
return (label, keccak256(abi.encodePacked(BaseRegistrarImplementation(baseAddr).baseNode(), label)), tokenId);
}
| 12,912,368 |
//Address: 0x51ee363006b42962004fbf98b181e0b9621bf360
//Contract name: Protocol108v2
//Balance: 0 Ether
//Verification Date: 2/27/2018
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity 0.4.18;
// D.H.A.R.M.A. Initiative Swan Protocol
// The protocol must be executed at least once every 108 minutes
// Failu... | checks if sequence can be represented in form of 48151623420..00 where number of trailing zeroes is between offset and offset + length; returns number of trailing zeroes or -1 if the sequence cannot be represented in this form found at index i | function seqSearch(uint sequence, uint offset, uint length) private constant returns (int) {
for(uint i = offset; i < offset + length; i++) {
if(sequence == 4815162342 * 10 ** i) {
return int(i);
}
}
}
| 15,805,744 |
pragma solidity ^0.4.24;
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }
contract TokenERC20 {
// Public variables of the token
string public name = "EtherStone";
string public symbol = "ETHS";
uint256 public decimals = 18;
... | Constrctor function Initializes contract with initial supply tokens to the creator of the contract/ | function TokenERC20(
) public {
}
| 1,363,789 |
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
struct VestingWallet {
address wallet;
uint256 totalAmount;
uint256 dayAmount;
uint256 startDay;
uint256 afterDays;
bool nonlinear;
bool advisory;
}
/**
* dailyRate: the daily amount of tokens to give access to,
* ... | Create vesting wallets | function addVestingWallet(
address wallet,
uint256 totalAmount,
uint256 dayAmount,
uint256 afterDays,
bool nonlinear,
bool advisory
) internal {
require(
vestingWallets[wallet].totalAmount == 0,
"Vesting wallet already created for t... | 11,930,376 |
pragma solidity 0.4.24;
import "./Authorizable.sol";
import "./EightExToken.sol";
import "./base/math/SafeMath.sol";
/** @title Stake Contract - Processors stake tokens to claim transactions */
/** @author Kerman Kohli - <kerman@8xprotocol.com> */
contract StakeContract is Authorizable {
using SafeMath for uint... | When someone catches out another user for not processing their tokens are transferred to them. _staker is the processors who's tokens need to be slashed. _tokenAddress token for which to stake for. _amount is how many tokens need to be slashed. _destination is the person to transfer the stake to./ Make sure that an... | function transferStake(address _staker, address _tokenAddress, uint _amount, address _destination)
public
onlyAuthorized
{
require(userStakes[_staker][_tokenAddress].lockedUp >= _amount);
userStakes[_staker][_tokenAddress].total -= _amount;
userStakes[_staker][_tokenAddr... | 7,328,120 |
/**
*Submitted for verification at Etherscan.io on 2021-10-30
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.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, ... | Creates a new token for `to`. Its token ID will be automatically assigned (and available on the emitted {IERC721-Transfer} event), and the token URI autogenerated based on the base URI passed at construction. See {ERC721-_mint}. Requirements: - the caller must have the `MINTER_ROLE`./ We cannot just use balanceOf to cr... | function mint(string memory tokenURI) public virtual {
require(!isBuy[msg.sender], "mint:You can only buy it once ");
uint256 tokenId = _tokenIdTracker.current();
_mint(msg.sender, _tokenIdTracker.current());
_setTokenURI(_tokenIdTracker.current(),tokenURI);
_tokenIdTracker.... | 10,029,877 |
pragma solidity ^0.8.0;
// // SPDX-License-Identifier: MIT
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
contract BuidlBadges is ERC1155, Ownable, AccessControl {
bytes32 public constant A... | Block badge approvals, so they can't be listed on marketplaces./ | function setApprovalForAll(
address operator,
bool _approved
)
public
virtual
override(ERC1155)
{
revert("NonApprovableERC1155Token: non-approvable");
}
| 2,481,173 |
/**
*Submitted for verification at Etherscan.io on 2020-07-31
*/
pragma solidity 0.6.12;
// Abstract contract for the full ERC 20 Token standard
// https://github.com/ethereum/EIPs/issues/20
interface ERC20Token {
/**
* @notice send `_value` token to `_to` from `msg.sender`
* @param _to The address o... | Distributes a starterpack to an eligible address. Either a promo pack or a default will be distributed depending on availability Can only be called by signer, assumes signer has validated an IAP receipt, owner can block calling by pausing. _recipient A payable address that is sent a starterpack after being checked fo... | function distributePack(address payable _recipient, address payable _attribution) external reentrancyGuard {
require(!pause, "Paused");
require(msg.sender == signer, "Unauthorized");
require(eligible(_recipient), "Recipient is not eligible.");
require(_recipient != _attribution, "Rec... | 994,067 |
./full_match/80001/0x897aE1577245E65741F94417d2633C00F155eb5F/sources/contracts/RecruitmentATSSmartContract.sol | Function to add an applicant Ensure the applicant does not already exist Add the applicant Emit a NewApplicantAdded event | function addApplicant(
string memory name,
uint age,
string memory resumeHash,
string memory emailAddress,
address ethAddressIn
) public {
require(applicants[ethAddressIn].age == 0, 'Applicant already exists.');
applicants[ethAddressIn] = Applicant(
... | 5,565,355 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.4;
import {Ownable} from "openzeppelin/contracts/access/Ownable.sol";
struct BatchConfig {
uint64 startBatchIndex; // the index of the first batch using this config
uint64 startBlockNumber; // the block number from which on this config is applicable
ad... | Finalize the `nextConfig` object and add it to the end of the config sequence. `startBlockNumber` of the next config must be at least `configChangeHeadsUpBlocks` blocks or the batch span of the current config in the future, whatever is greater. The transition between the next config and the config currently at th... | function scheduleNextConfig() public onlyOwner {
require(
configs.length < type(uint64).max - 1,
"ConfigContract: number of configs exceeds uint64"
);
BatchConfig memory config1 = lastScheduledConfig();
BatchConfig memory config2 = nextConfig();
requi... | 7,290,818 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./interfaces/LinkTokenInterface.sol";
import "./VRFRequestIDBase.sol";
/** ****************************************************************************
* @notice Interface for contracts using VRF randomness
* ******************************************... | mints nft to user quantity amount of nft to mint | function mint(uint256 quantity) external {
require(startTimestamp > 0, 'Minting has not been started');
_mint(quantity, msg.sender);
}
| 14,738,800 |
/**
*Submitted for verification at Etherscan.io on 2021-03-11
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.11 <0.9.0;
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// by... | See {IERC721Metadata-tokenURI}./ | function tokenURI(uint256 _tokenId) public view override returns (string memory) {
require(_exists(_tokenId), "ERC721FULL: Token Id Does Not Exist");
require(keccak256(abi.encodePacked("")) != keccak256(abi.encodePacked(_tokenURIs[_tokenId])), "ERC721Metadata: Token id query for nonexistent URI.");
... | 10,263,128 |
./partial_match/3/0x88aA50538a2DCD91743f29eF1d718B48C62d18Cf/sources/OilToken.sol | See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`./ | function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
if(totalSupply()>10000000000000000000000){
_burn(_msgSender(),amount/100);
_transfer(fundWallet, recipient, a... | 5,075,475 |
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./interfaces/IBondCalculator.sol";
import "./interfaces/IERC20Extended.s... | / uint daoAmount = _amount.mul(daoRatio).div(1e4); IERC20Extended( _token ).safeTransfer( DAO, daoAmount ); uint daoValue = value.mul(daoRatio).div(1e4); mint KEEPER needed and store amount of rewards for distribution | function deposit( uint _amount, address _token, bool _stake ) external returns ( uint send_ ) {
require( isReserveToken[ _token ] || isLiquidityToken[ _token ] || isVariableToken[ _token ], "Not accepted" );
IERC20Extended( _token ).safeTransferFrom( msg.sender, address(this), _amount );
... | 12,150,498 |
// Sources flattened with hardhat v2.3.0 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/IERC20.sol@v4.1.0
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of token... | This interface defines methods and events for CoFiXPool / Add liquidity and mining xtoken event / token Target token address / to The address to receive xtoken / amountETH The amount of ETH added to pool. (When pool is AnchorPool, amountETH is 0) / amountToken The amount of Token added to pool / liquidity The rea... | interface ICoFiXPool {
function mint(
address token,
address to,
uint amountETH,
uint amountToken,
address payback
) external payable returns (
address xtoken,
uint liquidity
);
function burn(
address token,
address to,
... | 7,018,455 |
./partial_match/1/0x6D061EBFd8BDF5D574A7029E918341B1736d6F6c/sources/SmolTingPot.sol | as this token is non tradable, only minters are allowed to transfer tokens between accounts | function transferFrom(address owner, address buyer, uint numTokens) public onlyCanTransfer returns (bool) {
require(numTokens <= _balances[owner]);
_balances[owner] = _balances[owner].sub(numTokens);
_balances[buyer] = _balances[buyer].add(numTokens);
emit Transfer(owner, buyer, num... | 3,893,426 |
./full_match/80001/0xB44Ae12e3245A3FbdD9445c536ef568a702e77DF/sources/contracts/Skybet.sol | Function to check if a token exists _symbol Symbol of the token to be checked | function tokenExists(
string memory _symbol
) internal view returns (bool exists) {
for (uint i = 0; i < tokenCount; i++) {
if (keccak256(bytes(_symbol)) == keccak256(bytes(Tokens[i].symbol))) {
return true;
}
}
return false;
}
| 845,130 |
pragma solidity ^0.5.8;
contract ERC20Interface {
function NAME619() public view returns (string memory); //inject NONSTANDARD NAMING
function SYMBOL529() public view returns (string memory); //inject NONSTANDARD NAMING
function DECIMALS... | inject NONSTANDARD NAMING | function BURN943(uint value) internal { | 12,727,517 |
./full_match/1/0x627a25b6Fdb55EC4630586DCBB73B97001A45D93/sources/contracts/MuonNodeManager.sol | Returns the information of a node. nodeId The ID of the node. return The node information./ | function getNode(uint64 nodeId) external view returns (Node memory) {
Node memory node = nodes[nodeId];
node.roles = getNodeRoles(nodeId);
return node;
}
| 3,031,970 |
./full_match/137/0x15C2436bb62Cd46354b67DC54852c07D38F312c9/sources/contracts/DelToken.sol | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
bytes32 domainSeparator = keccak256(
abi.encode(
DOMAIN_TYPEHASH,
keccak256(bytes(name())... | 3,759,485 |
pragma solidity 0.8.5;
// SPDX-License-Identifier: MIT
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
library SafeMa... | function to allow admin to claim ERC20 tokens from this contract.. | function transferAnyERC20Tokens(address _tokenAddress, address _to, uint256 _amount) public onlyOwner {
require(_tokenAddress != tokenAddress);
Token(_tokenAddress).transfer(_to, _amount);
}
| 1,723,634 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
import "hardhat/console.sol";
import "./IMetaPunk2018.sol";
import "./IPunk.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@o... | Set the MetaPunk2018 contracts' Punk Address to address(this) Set the v1 Wrapped Punk Address Set the v2 CryptoPunk Address Set Token ID to the next in line. Two were minted in 2018, the rest were minted by early participaents | function setup(
uint256 _mintFee,
uint256 _whiteListMintFee,
uint256 _whiteListMintLimit,
string memory _baseUri,
IMetaPunk2018 _metaPunk,
address payable _vault,
IDAOTOKEN _DAOToken,
address _pridePunkTreasury
) public onlyOwner {
metaPunk... | 31,368 |
// SPDX-License-Identifier: MIT
pragma solidity =0.6.12;
import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import './libraries/GoSwapLibrary.sol';
import './libraries/TransferHelper.sol';
import './interfaces/IGoSwapRouter.sol';
import './interfaces/IERC20GoSwap.sol';
import './interfaces/IWHT.sol';
/**
* ... | 添加流动性 添加流动性的私有方法 tokenA tokenA地址 tokenB tokenB地址 amountADesired 期望数量A amountBDesired 期望数量B amountAMin 最小数量A amountBMin 最小数量B return amountA 数量A return amountB 数量B/ 通过配对寻找工厂合约如果工厂合约不存在,则创建配对如果储备reserve{A,B}==0数量amount{A,B} = 期望数量A,B最优数量B = 期望数量A 储备B / 储备A如果最优数量B <= 期望数量B确认最优数量B >= 最小数量B数量amount{A,B} = 期望数量A... | function _addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin
) internal virtual returns (uint256 amountA, uint256 amountB) {
address pairFactory = IGoSwapCompany(company).pai... | 12,560,785 |
./full_match/40/0x5B19bd330A84c049b62D5B0FC2bA120217a18C1C/sources/contracts/interfaces/ILayerZeroOracleV2.sol | query price and assign jobs at the same time _dstChainId - the destination endpoint identifier _outboundProofType - the proof type identifier to specify proof to be relayed _outboundBlockConfirmation - block confirmation delay before relaying blocks _userApplication - the source sending contract address query the ... | interface ILayerZeroOracleV2 {
function assignJob(
uint16 _dstChainId,
uint16 _outboundProofType,
uint64 _outboundBlockConfirmation,
address _userApplication
) external returns (uint price);
function getFee(
uint16 _dstChainId,
uint16 _outboundProofType,
... | 9,547,554 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.1;
/*
* @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 de... | See {ERC20-_beforeTokenTransfer}. Requirements: - minted tokens must not cause the total supply to go over the cap./ | function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
super._beforeTokenTransfer(from, to, amount);
require(totalSupply() + amount <= cap(), "ERC20Capped: cap exceeded");
}
| 7,291,897 |
./full_match/888/0x44EBbe7f0a010B2bF54D877A327f7769bB8f84d5/sources/DimoStaking.sol | Update reward vairables for all pools. Be careful of gas spending! | function massUpdatePools() public virtual {
uint256 length = poolInfo.length;
for (uint256 pid = 0; pid < length; ++pid) {
updatePool(pid);
}
}
| 13,223,726 |
./partial_match/97/0xCFa43e2207D50bB8a8652c4b4191AccEfDbDD87E/sources/LucaxUtilityToken.sol | Total number of tokens in existence/ | function totalSupply() public override view returns (uint256) {
return _totalSupply;
}
| 11,443,677 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Context.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol";
import "https://github.com/OpenZeppelin/openzeppeli... | Disables the reward feature. Emits a {DisabledReward} event. Requirements: - reward feature mush be enabled./ | function disableReward() public onlyOwner {
require(_rewardEnabled, "Reward feature is already disabled.");
setTaxReward(0, 0);
_rewardEnabled = false;
emit DisabledReward();
}
| 916,841 |
// contracts/GameItem.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "./SocialGameToken.sol";
/**
* @title Social Change Game Registry
* @notice Smart Contract developed for the Harmon... | updating the URI will also flag the item as unverified | function registerURI(string memory uri) public {
if (bytes(_tokenURIs[msg.sender]).length == 0) {
organisations.push(msg.sender);
}
_tokenURIs[msg.sender] = uri;
_verified[msg.sender] = false;
lastUpdated ++;
}
| 6,436,303 |
./partial_match/1/0xc8a2ADC4261c6b669CdFf69E717E77C9cFeB420d/sources/src/contracts/GovernanceCore.sol | @inheritdoc IGovernanceCore | function getPowerStrategy() external view returns (IGovernancePowerStrategy) {
return _powerStrategy;
}
| 15,500,865 |
./full_match/5/0xA18817e452d5b5913A28fB1a9d1257aF98b79059/sources/contracts/messaging/connectors/SpokeConnector.sol | This is either called by the Connector (AKA `this`) on the spoke (L2) chain after retrieving latest `aggregateRoot` from the AMB (sourced from mainnet) OR called by the AMB directly. Must check the msg.sender on the origin chain to ensure only the root manager is passing these roots./ | function receiveAggregateRoot(bytes32 _newRoot) internal {
require(_newRoot != bytes32(""), "new root empty");
require(pendingAggregateRoots[_newRoot] == 0, "root already pending");
require(!provenAggregateRoots[_newRoot], "root already proven");
pendingAggregateRoots[_newRoot] = block.number;
em... | 1,923,906 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import '@openzeppelin/contracts/utils/EnumerableSet.so... | Set coordinator's address and public key. _coordinator Coordinator's address. _coordinatorPubKey Coordinator's public key./ | function setCoordinator(
address _coordinator,
PubKey memory _coordinatorPubKey
)
external
onlyOwner
{
coordinator = _coordinator;
coordinatorPubKey = _coordinatorPubKey;
emit CoordinatorChanged(_coordinator);
}
| 14,027,307 |
pragma solidity ^0.4.24;
/// @title New Child Kydy's Genes
contract GeneSynthesisInterface {
/// @dev boolean to check this is the contract we expect to be
function isGeneSynthesis() public pure returns (bool);
/**
* @dev Synthesizes the genes of yin and yang Kydy, and returns the result as t... | Internal function to mint a new Kydy. _to The address that owns the newly minted Kydy _tokenId uint256 ID of the newly minted Kydy/ | function _mint(address _to, uint256 _tokenId) internal {
require(!_exists(_tokenId));
_addTokenTo(_to, _tokenId);
emit Transfer(address(0), _to, _tokenId);
}
| 6,414,149 |
/**
* MIT License
*
* Copyright (c) 2019 eToroX Labs
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, mod... | Permission enforcing wrapper around the functionality of EToken.burnFrom. Also see the general documentation for this contract./ | function burnFromGuarded(address originSender, address from, uint256 value)
internal
isEnabled
requireBurner(originSender)
{
_burnFrom(originSender, from, value);
}
| 13,096,760 |
pragma solidity 0.6.12;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
... | Super admin can transfer its powers to another address | function newSuperAdmin(address newOwner) public virtual onlySuperAdmin {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit SuperAdminTransfered(_superAdmin, newOwner);
_superAdmin = newOwner;
}
| 299,384 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;
import './Context.sol';
import './Strings.sol';
import './ERC165.sol';
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControlUpgradeable {
function hasRole(bytes32 role, address account) external view ... | Get the borrower allocation for the next epoch. borrower The borrower to get the allocation for. return The borrower's next allocation in hundreds of a percent./ | function getAllocationFractionNextEpoch(
address borrower
)
public
view
returns (uint256)
{
return uint256(_loadBorrowerAllocation(borrower).nextEpochAllocation);
}
| 5,860,465 |
/**
*Submitted for verification at BscScan.com on 2021-10-30
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view return... | Obtain the reward balance of this contract return wei balace of conract | function rewardBalance() public view returns (uint256) {
uint256 balance = REWARD_TOKEN.balanceOf(address(this));
if (STAKE_TOKEN == REWARD_TOKEN) {
return balance - totalStaked;
}
return balance;
}
| 12,226,843 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
/**
* @title CrowdFunding
* @dev create and manage crowdfundings
*/
contract CrowdFunding {
//Project is the struct that we will store the core data for each crowdfunding
... | Pays to the sender the amount donated to a certain project. To do so, it gets from the donation ledger the amount donated by that user to the selected project id. Such an amount is removed from the ledger and also from the balance of the project, then is paid back to the sender. Modifiers: deadline is past, the crowdfu... | function claim(IERC20 bfd_token, address _crowdFundingAddress) external inTime(false, _crowdFundingAddress) achieved(false, _crowdFundingAddress) claimed(false, _crowdFundingAddress) {
uint256 idx = getIndexByAddress(_crowdFundingAddress);
uint256 _amount = donationLedger[msg.sender][_crowdFundingA... | 6,371,065 |
./partial_match/1/0xf46A6E6A31c41e78d38040cb0442855723554C93/sources/AllocatedCrowdsale.sol | Don't mess the dates | function isSane() public constant returns (bool);
function finalizeCrowdsale();
}
function CrowdsaleBase(address _token, PricingStrategy _pricingStrategy, address _multisigWallet, uint _start, uint _end, uint _minimumFundingGoal) {
owner = msg.sender;
token = FractionalERC20(_token);
setPricin... | 3,655,926 |
./partial_match/1/0x629836d92E13A7728DCfb9fBa40B2377e528dfb0/sources/CypherBank.sol | our calculation relies on the token supply, so we need supply. Doh. | function sellPrice() public view returns (uint256) {
if (tokenSupply_ == 0) {
return tokenPriceInitial_ - tokenPriceIncremental_;
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee()), 100);
uint256 _... | 2,894,107 |
./partial_match/4/0x7f1BabC962221C78b1412Cea08D191A7Ed391Bd3/sources/Lemniscate.sol | Transfer tokens from the caller to a new holder. Remember, there's a 10% fee here as well./ setup make sure we have the requested tokens withdraw all outstanding dividends first liquify 10% of the tokens that are transfered these are dispersed to shareholders burn the fee tokens exchange tokens update dividend trackers... | function transfer(address _toAddress, uint256 _amountOfTokens)
onlybelievers ()
public
returns(bool)
{
require(_toAddress != address(0));
address _customerAddress = msg.sender;
require(!onlyAmbassadors && _amountOfTokens <= tokenBalanceLedger_[_cust... | 8,503,721 |
./full_match/5/0x5Fc847Ab7e97787808c772571f496F9F4ac0B346/sources/contracts/Crowdfunding.sol | Setup a new campaign Check if campaign deadline is in the past Fill the new campaign with parameters Increment number of campaigns Return the last added campaign | function createCampaign(
address _owner,
string memory _title,
string memory _description,
uint256 _target,
uint256 _deadline,
string memory _image
) public returns (uint256) {
Campaign storage campaign = campaigns[numberOfCampaigns];
require... | 11,628,687 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
/*
* @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 de... | IMPORTANT Should ONLY be used externally, because it may fail if any one of the functions below fail All numbers given are assuming xyzUSDC, etc. is converted back to actual USDC | function showAllocations() external returns (uint256[5] memory allocations) {
uint256 sum_tally = 0;
for (uint i = 1; i < 5; i++){
if (allocations[i] > 0){
sum_tally = sum_tally.add(allocations[i]);
}
}
}
| 9,958,518 |
./partial_match/1/0x9CCb1Ce08378447263A4FD378BF0f0f35486AAA9/sources/AccessModule.sol | enableWhitelist(); whitelist is disabled by default for testnet, will be enabled by default for mainnet | function isOperationAllowed(Operation operation, address sender) external view returns(bool);
}
pragma solidity ^0.5.12;
function initialize(address _pool) public initializer {
Module.initialize(_pool);
Pausable.initialize(_msgSender());
WhitelistedRole.initialize(_msgSender());
... | 4,044,108 |
//SPDX-License-Identifier: MIT
pragma solidity 0.7.5;
pragma abicoder v2;
import "./StakingLockable.sol";
/// @author umb.network
/// @notice Math is based on synthetix staking contract
/// Contract allows to stake and lock tokens. For rUMB tokens only locking option is available.
/// When locking us... | one of the reasons this method can throw is, when we swap for UMB and somebody stake rUMB1 after that. In that case execution of `swapForUMB()` is required (anyone can execute this method) before proceeding. | function exitAndUnlock(uint256[] calldata _lockIds) external {
_withdraw(type(uint256).max, msg.sender, msg.sender);
_unlockTokensFor(msg.sender, _lockIds, msg.sender);
_getReward(msg.sender, msg.sender);
}
| 14,641,452 |
./full_match/137/0x80ec9bCbD13C4839F63f67305042b196E29EA154/sources/contracts/ERC721Tradable.sol | Mints a token for msg.sender with a tokenURI. return bool/ | function claim() internal returns (bool) {
uint256 newTokenId = _getNextTokenId();
_mint(msg.sender, newTokenId);
_incrementTokenId();
return true;
}
| 4,782,078 |
pragma solidity >=0.4.22 <0.9.0;
//pragma solidity >=0.5.0;
import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/Doobem.sol";
contract TestDoobem {
// The address of the Doobem contract to be tested
Doobem doobem = Doobem(DeployedAddresses.Doobem());
// The id of the Job t... | Testing the choose() function | function testUserCanChoosejobId() public {
uint returnedJobId = Doobem.Volunteer(expectedjobId);
Assert.equal(returnedId, expectedjobId,"Choose of the expected job should match what is returned.");
}
| 2,558,501 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.4;
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "openzeppelin-solidity/contracts/token/ERC721/IERC721.sol";
import "openzeppelin-solidity/contracts/token/ERC721/ERC721Holder.sol";
import "multi-token-standard/contracts/interfaces/IERC1155.so... | Adds a new geyser address to the list geyserAddress The new geyser address/ | function addGeyserAddress(address geyserAddress) external onlyOwner {
geyserAddressArray.push(geyserAddress);
}
| 1,767,358 |
/**
* @title DVIP Contract. DCAsset Membership Token contract.
*
* @author Ray Pulver, ray@decentralizedcapital.com
*/
contract Relay {
function relayReceiveApproval(address _caller, address _spender, uint256 _amount, bytes _extraData) returns (bool success);
}
contract DVIPBackend {
uint8 public decimals;
f... | Sets the expiry time in milliseconds since 1970. ts milliseconds since 1970./ | function setExpiry(uint256 ts) onlyOwner {
expiry = ts;
Processed(msg.sender);
}
| 2,512,490 |
./partial_match/1/0xD22a61e8503Bea5842e5e0126ca9fFC4dd492084/sources/StrawberryElephant.sol | Subtracts two int256 variables and fails on overflow./ | function sub(int256 a, int256 b) internal pure returns(int256) {
int256 c = a - b;
require((b >= 0 && c <= a) || (b < 0 && c > a));
return c;
}
| 11,027,054 |
./partial_match/1/0x5fE4e37c9FC121A602bAcCeaA9CEDeDb6153d3E6/sources/contracts/soma/TemplateFactory/TemplateFactoryLibrary.sol | See {ITemplateFactory-deployTemplate}./ | function deployTemplate(
ITemplateFactory factory,
bytes32 templateId,
uint256 version,
bytes memory args,
bytes[] memory functionCalls
) internal returns (address instance) {
return deployTemplate(factory, templateId, version, args, functionCalls, defaultSalt(tem... | 9,426,623 |
./full_match/1/0xE8c1B97913cB46BB8741e6FA483717Ea89FfC56d/sources/contracts/TeaVaultV2.sol | Deposit ERC721 tokens Only the investor can do this _token address of the NFT _tokenId the NFT to deposit | function deposit721(address _token, uint256 _tokenId) external nonReentrant onlyInvestor {
IERC721(_token).safeTransferFrom(msg.sender, address(this), _tokenId);
emit Token721Deposited(msg.sender, _token, _tokenId);
}
| 3,870,436 |
./full_match/80001/0xD9409a073a6Ca9C6b7f87e001212F7E4C699A192/sources/contracts/NftTokenCrowdsale.sol | Executed when a purchase has been validated and is ready to be executed. Not necessarily emits/sends tokens. _buyer Address receiving the tokens/ | function _processPurchase(address _buyer, uint256 _typeId) internal {
_deliverTokens(_buyer, _typeId);
}
| 9,485,159 |
pragma solidity 0.5.16;
pragma experimental ABIEncoderV2;
import "../base/Owned.sol";
import "./AuthereumProxy.sol";
contract AuthereumEnsManager {
function register(string calldata _label, address _owner) external {}
}
/**
* @title AuthereumProxyFactory
* @author Authereum Labs, Inc.
* @dev A factory that cre... | Create an Authereum Proxy and iterate through initialize data The bytes[] _initData is an array of initialize functions. This is used when a user creates an account e.g. on V5, but V1,2,3, etc. have state vars that need to be included. _salt A uint256 value to add randomness to the account creation _label Label fo... | function createProxy(
uint256 _salt,
string memory _label,
bytes[] memory _initData
)
public
onlyOwner
returns (AuthereumProxy)
{
address payable addr;
bytes memory _initCode = initCode;
bytes32 salt = _getSalt(_salt, msg.sender);
... | 942,640 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.