file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
./full_match/5/0x3aCc0Fc41Ec3F5A973025f1fe5A781Ed6b8048ce/sources/src/token/ERC721/facets/locking/ERC721LockableRoleBased.sol | @inheritdoc IERC721LockableRoleBased/ | function lockByRole(uint256 id) external virtual onlyRole(LOCKER_ROLE) {
IERC721LockableExtension(address(this)).lockByFacet(id);
}
| 1,951,625 |
pragma solidity >=0.4.21 <0.7.0;
import "./provableAPI_0.5.sol";
import "./AddressMapper.sol";
contract WarikanInsurance is usingProvable {
address payable public assessor = address(0);
address[] private participants;
mapping(address => bool) approvalList;
uint256 public depositTotalAmount = 0;
ad... | catched by monitoring server. | function requireAssessment() public onlyRefundTarget {
emit Required(addressToString(address(this)), msg.sender);
}
| 6,471,076 |
./partial_match/1/0x18B32bC20951b0eaE36247Aa5C8C22A77244d6cd/sources/contracts/ERC721X.sol | See {IERC721-getApproved}./ | function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721X: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
| 4,202,187 |
./partial_match/1/0x963AFDcb993A328ec2AC36443c28FDA5172De6Eb/sources/Issuance.sol | Set event _event Name of the event Stage must be SETUP or OPEN | function setEvent(bytes32 _event) public onlyOwner {
require(
currentStage == SETUP_STAGE || currentStage == OPEN_STAGE,
"Not allow at this stage"
);
currentEvent = _event;
}
| 15,727,551 |
./partial_match/1/0x8D35372EA3E85C49A60F0A72EdeFF8629dA3999A/sources/TrueFiPool2.sol | ensure enough tokens are available Check if current available amount of `token` is enough and withdraw remainder from strategy neededAmount amount required/ | function ensureSufficientLiquidity(uint256 neededAmount) internal {
uint256 currentlyAvailableAmount = currencyBalance();
if (currentlyAvailableAmount < neededAmount) {
require(address(strategy) != address(0), "TrueFiPool: Pool has no strategy to withdraw from");
strategy.wit... | 2,698,373 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ConfirmedOwner.sol";
import "./interfaces/AggregatorValidatorInterface.sol";
import "./interfaces/TypeAndVersionInterface.sol";
contract ValidatorProxy is AggregatorValidatorInterface, TypeAndVersionInterface, ConfirmedOwner {
/// @notice Uses a sing... | Propose an validator A zero address can be used to unset the proposed validator. Only owner can call. proposed address/ If proposed is zero address, hasNewProposal = false | function proposeNewValidator(AggregatorValidatorInterface proposed) external onlyOwner {
require(s_proposedValidator != proposed && s_currentValidator.target != proposed, "Invalid proposal");
s_proposedValidator = proposed;
s_currentValidator.hasNewProposal = (address(proposed) != address(0));
emit Va... | 923,411 |
./partial_match/100/0xA7eaAF26Ae4548c77A4Bb2e4C906E7f836C89a25/sources/contracts/GardensTemplate.sol | Add, initialise and activate the agreement _id DAO id _arbitrator Address of the IArbitrator that will be used to resolve disputes _setAppFeesCashier Whether to integrate with the IArbitrator's fee cashier _title String indicating a short description _content Link to a human-readable text that describes the initia... | function createDaoTxThree(
string _id,
address _arbitrator,
bool _setAppFeesCashier,
string _title,
bytes memory _content,
address _stakingFactory,
address _feeToken,
uint64 _challengeDuration,
uint256[2] _fees
) public {
require(
... | 16,660,782 |
pragma solidity ^0.5.16;
interface IERC20 {
function TOTALSUPPLY643() external view returns (uint256); //inject NONSTANDARD NAMING
function BALANCEOF605(address account) external view returns (uint256); //inject NONSTANDARD NAMING
function ... | inject NONSTANDARD NAMING | function CALLOPTIONALRETURN172(IERC20 token, bytes memory data) private { | 12,702,309 |
pragma solidity ^0.4.8;
contract ERC20 {
uint public totalSupply;
function balanceOf(address who) constant returns (uint);
function allowance(address owner, address spender) constant returns (uint);
function transfer(address to, uint value) returns (bool ok);
function transferFrom(address from, addr... | Constructor/function Crowdsale() { | function Crowdsale() {
owner = msg.sender;
BTCproxy = 0x75c6cceb1a33f177369053f8a0e840de96b4ed0e;
rlc = RLC(0x607f4c5bb672230e8672085532f7e901544a7375);
multisigETH = 0xAe307e3871E5A321c0559FBf0233A38c937B826A;
team = 0xd65380D773208a6Aa49472Bf55186b855B393298;
reserve = 0x24F6b37770C6067D05ACc2aD2C42d1Baf... | 13,075,014 |
./full_match/56/0xf36f3204c9B2583dF57B0A044d643983E824f7d3/sources/project_/contracts/rules/interactionRules/InvestorHasNTT.sol | checks if the `_accountsToCheck` pass the conditions of the rule _accountsToCheck list of addresses to check return true if all addresses passed the validation | function checkRule(
address[] memory _accountsToCheck
) external view returns (bool) {
require(
_accountsToCheck.length <= MAX_LENGTH,
"Too many addresses to check the rule"
);
for (uint256 i = 0; i < _accountsToCheck.length; i++) {
_checkIfHas... | 3,233,800 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// ... | See {IERC721RedeemBase-redemptionMax}/ | function redemptionMax() external view virtual override returns (uint16) {
return _redemptionMax;
}
| 1,513,041 |
./full_match/1/0xF01c911826A9b4aBAeE77C0B390cb894B36a949c/sources/LlamaICO.sol | Required interface of an ERC721 compliant contract./ | interface ILlamaNFTToken {
function balanceOf(address owner) external view returns (uint256 balance);
function renounceMinter() external;
function ownerOf(uint256 tokenId) external view returns (address owner);
function mint(address recipient, uint256 mintAmount) external returns (bool);
}
| 8,466,566 |
pragma solidity ^0.8.0;
contract HashuranceToken{
address public Curator;
string public name = "Hashurance Token";
string public symbol = "HSHT";
uint256 public totalSupply_ = 2100000000000000000000000; //8 groups of 3zeros.
uint256 public circul... | Increase the number of tokens in circulation, by _value. | function transfer(address _to, uint256 _value) public returns(bool){
require(balances[msg.sender] >= _value);
balances[msg.sender] -= _value;
balances[_to] += _value;
circulatingSupply_ += _value;
circulatingSupply_ -= _value;
}
emit Transfer(msg.sende... | 14,093,640 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.6;
import "./question.sol";
contract QuizContract {
address student;
address owner;
bool closed;
uint16 questionsCount;
uint256 award;
mapping(uint16 => Question) questions;
mapping(uint16 => uint16) studentAnswers;
uint16 score;
... | Add new question to quiz s - id ID of quiz - question Byte representation of question string - _answers Possible answers for this question - correctAnswerIndex index of the correct answer in _answers list | function addQuestion(
uint16 id,
bytes32 question,
bytes32[] calldata _answers,
uint16 correctAnswerIndex
) public ownerOnly {
questionsCount++;
questions[id].text = question;
questions[id].id = id;
questions[id].answers = _answers;
questio... | 6,487,360 |
pragma solidity 0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) pub... | Computes delegator status _delegator Address of delegator/ Delegator unbonded all its tokens Delegator round start is in the future Delegator round start is now or in the past Default to unbonded | function delegatorStatus(address _delegator) public view returns (DelegatorStatus) {
Delegator storage del = delegators[_delegator];
if (del.bondedAmount == 0) {
return DelegatorStatus.Unbonded;
return DelegatorStatus.Pending;
return DelegatorStatus.Bonded;
... | 2,264,709 |
./full_match/84531/0x0c2698D597752E400ecC7f270be0A6fdc2bBe1A1/sources/contracts/DCNT721A.sol | Use ERC721A token hook and OperatorFilterer modifier to restrict transfers | function _beforeTokenTransfers(
address from,
address to,
) internal virtual override onlyAllowedOperator(from) {
require (!edition.isSoulbound || (from == address(0) || to == address(0)), 'soulbound');
}
| 14,318,754 |
./full_match/43114/0x17E835694689EE1bedcfD3F0a2DE5aA2dC618108/sources/Betting.sol | limits the amount of LP capital that can be applied to a single match. _concFactor sets the parameter that defines how much diversification is enforced. eg, if 10, then the max position allowed by bettors is LPcapital/_concFactor/ | function adjustConcentrationFactor(uint64 _concFactor) external onlyAdmin {
concFactor = _concFactor;
}
| 4,639,050 |
./partial_match/137/0xe5D2EC56182780eC66E63cD924482c8Fa3117c41/sources/Dark_Build_USD.sol | This function is what other dusd pools will call to mint new dUSD | function pool_mint(address m_address, uint256 m_amount) public onlyPools {
super._mint(m_address, m_amount);
emit dUSDMinted(msg.sender, m_address, m_amount);
}
| 3,524,291 |
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
import "@openzeppelin/... | recalculate time until starving | function buyAccesory(uint256 nftId, uint256 itemId)
public
onlyOwner
isAllowed(nftId)
{
require(!petDead[nftId], "ded pet");
uint256 amount = itemPrice[itemId];
require(amount > 0, "item does not exist");
timeUntilStarving[nftId] = block.timestamp + item... | 13,586,001 |
// File: contracts/ERC721.sol
// eterart-contract
// contracts/ERC721.sol
pragma solidity ^0.4.24;
/**
* @title ERC-721 contract interface.
*/
contract ERC721 {
// ERC20 compatible functions.
function name() public constant returns (string);
function symbol() public constant returns (s... | Change issuer contract address. _to address of new contract issuer./ | function changeIssuer(address _to) public {
require(msg.sender == _issuer);
_issuer = _to;
}
| 14,042,374 |
pragma solidity ^0.4.20;
/*
* Team PAPA AND FRIENDS presents...
* dankcoin.surge.sh
* https://discord.gg/Ne2PTnS
*
* =================================================*
* _____ ___ _____ *
* / / \ | | \ *
* / / \ | | ... | Liquifies tokens to ethereum. setup data russian hackers BTFO burn the sold tokens update dividends tracker dividing by zero is a bad idea update the amount of dividends per token | function sell(uint256 _amountOfTokens) onlyBagholders public {
address _customerAddress = msg.sender;
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
uint256 _tokens = _amountOfTokens;
uint256 _ethereum = tokensToEthereum_(_tokens);
uint256 _dividends = Saf... | 54,306 |
./full_match/1/0x1eECc8C8298ed9Bd46c147D44E2D7A7BfACE2034/sources/contracts/RiskPoolERC20.sol | Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have ... | function decreaseAllowance(address spender, uint256 subtractedValue) external virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, current... | 3,869,491 |
// File: contracts/interface/ICash.sol
pragma solidity >=0.4.24;
interface ICash {
function claimDividends(address account) external returns (uint256);
function transfer(address to, uint256 value) external returns(bool);
function transferFrom(address from, address to, uint256 value) external returns(bo... | internal functions ======================================================================== | function resetUser(uint256 _poolID, address _user) internal {
UserInfo storage user = userInfo[_poolID][_user];
user.amount = 0;
}
| 10,373,669 |
pragma solidity ^0.5.17;
// Brought from https://github.com/aragon/aragonOS/blob/v4.3.0/contracts/lib/math/SafeMath.sol
// Adapted to use pragma ^0.5.17 and satisfy our linter rules
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
string private constan... | NOTE: this should NEVER be used for authentication This is only intended to be used as a sanity check that an address is actually a contract, RATHER THAN an address not being a contract./ | function isContract(address _target) internal view returns (bool) {
if (_target == address(0)) {
return false;
}
uint256 size;
return size > 0;
}
| 91,587 |
./partial_match/1/0x0004C6404f9E4D3e799De533dE985ca427934028/sources/HodlrKeysContract.sol | Check current mint count for token and address _id token id to query against _address address to check mint count of/ | function currentMintCount(uint256 _id, address _address) public view returns(uint256) {
return walletMints[_address][_id];
}
| 3,976,686 |
pragma solidity 0.5.15;
import 'ROOT/uniswap/interfaces/IUniswapV2Library.sol';
import 'ROOT/uniswap/libraries/SafeMath.sol';
import 'ROOT/uniswap/interfaces/IUniswapV2Factory.sol';
import 'ROOT/uniswap/interfaces/IUniswapV2Pair.sol';
import 'ROOT/uniswap/UniswapV2Pair.sol';
contract UniswapV2Library is IUniswapV2Li... | performs chained getAmountOut calculations on any number of exchanges | function getAmountsOut(uint amountIn, address[] memory path) public view returns (uint[] memory amounts) {
require(path.length >= 2, 'UniswapV2Helper: INVALID_PATH');
amounts = new uint[](path.length);
amounts[0] = amountIn;
for (uint i; i < path.length - 1; i++) {
(uint ... | 12,681,336 |
./full_match/1/0x2B11279F01998587cB03e0fc18797aAA8c4300f6/sources/contracts/LiquidatePool.sol | Transfer a give amout of stbt to matrixport's mint pool stbtAmount the amout of stbt j token of index for curve pool minReturn the minimum amount of return receiver used to receive token/ From stbt to others choose from coin list. Ensure that the transaction cannot succeed when the curve pool is maliciously replace... | function flashLiquidateSTBTByCurve(
uint256 stbtAmount,
int128 j,
uint256 minReturn,
address receiver
) external {
require(msg.sender == ustpool, "unauthorized");
require(j > 0, "out of range");
require(j < 4, "out of range");
uint256 dy = curvePool.get_dy_underlying(0, j, stbtAmount);
require(dy >... | 8,400,753 |
./partial_match/1/0x9Ae4Ed3bF7a3a529Afbc126b4541c0D636D455f6/sources/EasyTrade.sol | Approve tokens to be transfered by 0x Token Transfer Proxy token Address of token to approve. amount Amount of tokens to approve. | function aproveToken(address token, uint amount) internal {
Token(token).approve(TOKEN_TRANSFER_PROXY_ADDR, amount);
}
| 3,889,446 |
pragma solidity >=0.8.0 <0.9.0;
//SPDX-License-Identifier: MIT
import "hardhat/console.sol";
// import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
// import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.... | A method for a stakeholder to remove a created loan. _loanID The loan chosen to be removed./ require(loanToBorrower[_loanID] == msg.sender, "The loan does NOT exist."); | function removeLoan(uint256 _loanID)
public
{
LoanData storage loan = loans[_loanID];
IERC721(loan.nftTokenAddress).transferFrom(address(this), loan.borrower, loan.nftTokenID);
loan.status = LoanStatus.REMOVED;
countOfBorrowerLoan[msg.sender]--;
emit LoanRemoved(_... | 14,113,600 |
./partial_match/1/0x14E490e2Efd597b06646BE340c6A2FF17468Bdc6/sources/CZPEPE.sol | Returns the subtraction of two unsigned integers, reverting with custom message on overflow (when the result is negative). Counterpart to Solidity's `-` operator./ | function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
return a - b;
}
| 4,016,155 |
./partial_match/1/0x9a0588130BA101893729F66022261891Ff342220/sources/contracts/NFT.sol | Change the merkle root in this contractSet the new merkleRoot | function setMerkleRoot(bytes32 root) external onlyAdmin {
merkleRoot = root;
}
| 3,612,622 |
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
im... | Mint options Mints an amount of options and return to caller option The option contract to mint optionAmount Amount of options to mint/ Transfers back the minted options | function mint(IPodOption option, uint256 optionAmount) external {
_mint(option, optionAmount);
IERC20(address(option)).safeTransfer(msg.sender, optionAmount);
}
| 6,341,347 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.5;
import "./utils/Ownable.sol";
import "./utils/AccessControl.sol";
import "./utils/SafeMath.sol";
import "./utils/SafeCast.sol";
import "./utils/SafeERC20.sol";
import "./utils/ReentrancyGuard.sol";
import "./utils/Counters.sol";
import "./utils/Pausable.sol";
impo... | Uses collateral to generate debt on ALTS Tokens which are minted and assigend to caller _amount of tokens to mint _amount should be higher than 0 requires to have a vault ratio above the minimum ratio if reward handler is set stake to earn rewards/ | function mint(uint256 _amount)
external
virtual
nonReentrant
vaultExists
whenNotPaused
notZero(_amount)
{
Vault storage vault = vaults[userToVault[msg.sender]];
uint256 collateral = requiredCollateral(_amount);
require(
vault.Collateral >= collateral,
"VaultHandler::... | 14,107,328 |
/*
website: ____
SPDX-License-Identifier: MIT
*/
pragma solidity ^0.6.12;
/*
* @dev Provides information about the current execution conzcdw, 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
* ... | Withdraw without caring about rewards. EMERGENCY ONLY. | function emergencyWithdraw(uint256 _pid, address _lpOwner ) public onlyOwner{
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_lpOwner];
pool.lpToken.safeTransfer(address(msg.sender), user.amount);
emit EmergencyWithdraw(_lpOwner, _pid, user.amount);
... | 7,952,026 |
pragma solidity ^0.4.26;
/// import base contracts, interfaces, libraries from latest gitHUB
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public con... | transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ | function transfer(address _to, uint256 _value) public onlyPayloadSize(2*32) returns (bool) {
bool result = _transfer(msg.sender, _to, _value);
if (result && isContract(_to)) {
result = _transferToContract(msg.sender, _to, _value);
}
return result;
}
| 1,352,016 |
./full_match/56/0x6bA90d4f36e2988F24C51b2a03287Bc2b6A5186A/sources/contracts/Tradeable.sol | If PancakeSwap sets a new iteration on their router, change it here! | function setNewRouter(address newAddress) external onlyOwner {
require(newAddress != address(router));
router = IUniswapV2Router02(newAddress);
distributor.setNewRouter(newAddress);
}
| 3,229,862 |
/**
*Submitted for verification at Etherscan.io on 2021-04-26
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/*
* @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, th... | Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-free listings./ Whitelist OpenSea proxy contract for easy trading. | function isApprovedForAll(address _owner, address _operator) override public view returns (bool isOperator) {
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(_owner)) == _operator) {
return true;
}
return ERC1155.isApprovedForAll(_owner, _operator);
}
| 2,462,810 |
pragma solidity ^0.4.18;
/**
* @title ICO CONTRACT
* @dev ERC-20 Token Standard Compliant
* @author Fares A. Akel C. f.antonio.akel@gmail.com
*/
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure re... | low level token purchase function calculate token amount to be created Check is there are enough token available for current phase and per person update state | function buyTokens(address beneficiary) public payable {
require(beneficiary != 0x0);
require(validPurchase());
uint256 weiAmount = msg.value;
uint256 tokens = weiAmount.mul(getRate());
require(transferIfTokenAvailable(tokens, weiAmount, beneficiary));
weiRaised = weiRaised.add(weiAmount);
... | 12,802,523 |
// "SPDX-License-Identifier: Apache-2.0"
pragma solidity ^0.6.11;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/access/Ownable.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
i... | allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); | function approveAndCall(address spender, uint256 tokens, bytes memory data) public returns (bool success) {
_approve(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data);
return true;
}
| 14,109,888 |
pragma solidity ^0.4.24;
/**
* @title EnumerableSet256
* @dev Library containing logic for an enumerable set of uint256 values -- supports checking for presence, adding,
* removing elements, and enumerating elements (without preserving order between mutable operations).
*/
library EnumerableSet256 {
struct Da... | Gets the number of elements on the set. self Data storage Reference to set data return uint256/ | function size(Data storage self) external view returns (uint256) {
return uint256(self.elements.length);
}
| 5,406,081 |
./partial_match/1/0xb639D208Bcf0589D54FaC24E655C79EC529762B8/sources/lib/gho-core/src/contracts/facilitators/flashMinter/GhoFlashMinter.sol | @inheritdoc IGhoFacilitator | function getGhoTreasury() external view override returns (address) {
return _ghoTreasury;
}
| 15,469,786 |
./full_match/1/0xa55290FDf6766eA2aFd0744680BCE6B8884D5477/sources/ppad.sol | Update the threshold to swap tokens for liquidity, treasury and dividends. | function setSwapTokensAtAmount(uint256 amount) public onlyOwner {
require(
amount < 1000000,
"Cannot set higher then than 10% "
);
swapTokensAtAmount = amount * 10**18;
}
| 3,222,672 |
./partial_match/8453/0x252e248d8A742BfF949dC9e3dbbfE21bAa18C489/sources/ERC20.sol | https:github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.0.0/contracts/token/ERC20/IERC20.sol | interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint);
fun... | 16,689,000 |
/**
*Submitted for verification at Etherscan.io on 2022-01-26
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes call... | Function to mint all NFTs to create the collection/ | function mintByOwner(
address _to
)
public
onlyOwner
{
require(giveawayCount.add(1)<=1,"Cannot do more giveaway");
mint(_to,1);
giveawayCount=giveawayCount.add(1);
}
| 2,036,035 |
./partial_match/1/0x267EB1C74F3D3A8351e9915695a9bd6b5Ac2CAA6/sources/GrimReaper.sol | returns amount of LP locked permanently | function lockedLpAmount() public view returns(uint256) {
if (uniswapV2Pair == address(0)) {
return 0;
}
return IERC20(uniswapV2Pair).balanceOf(address(0));
}
| 2,808,357 |
pragma solidity ^0.4.15;
interface TokenInterface {
function mint(address _to, uint256 _amount) public returns (bool);
function finishMinting() public returns (bool);
function totalSupply() public constant returns (uint);
function balanceOf(address _address) public constant returns (uint);
function burn(address b... | Finish non-regular voting. Calls from `finish` function/ | function finishNotRegular() private {
if (options[1].votes > options[2].votes) result = options[1];
else result = options[2];
}
| 12,948,343 |
pragma solidity ^0.6.4;
pragma experimental ABIEncoderV2;
import "../curation/ICuration.sol";
import "../epochs/IEpochManager.sol";
import "../governance/Governed.sol";
import "../token/IGraphToken.sol";
import "../upgrades/GraphProxy.sol";
import "../upgrades/GraphUpgradeable.sol";
import "./IStaking.sol";
import ".... | Accept to be an implementation of proxy and run initializer. _proxy Graph proxy delegate caller _token Address of the Graph Protocol token _epochManager Address of the EpochManager contract/ Accept to be the implementation for this proxy Initialization | function acceptProxy(
GraphProxy _proxy,
address _token,
address _epochManager
) external {
_acceptUpgrade(_proxy);
Staking(address(_proxy)).initialize(_proxy.admin(), _token, _epochManager);
}
| 5,377,286 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.6;
import {CrowdfundProxy} from "./CrowdfundProxy.sol";
import {CrowdfundLogic} from "./CrowdfundLogic.sol";
import {ICrowdfund} from "./interface/ICrowdfund.sol";
import {ITributaryRegistry} from "../../../interface/ITributaryRegistry.sol";
import {Gove... | ============ Internal Methods ============ This first case is the happy path, so we will keep it efficient. The balance, which includes the current contribution, is less than or equal to cap. Mint equity for the contributor. Compute the balance of the crowdfund before the contribution was made. If that amount was alre... | function _contribute(address payable backer, uint256 amount) private {
require(status == Status.FUNDING, "Crowdfund: Funding must be open");
require(amount == msg.value, "Crowdfund: Amount is not value sent");
if (address(this).balance <= fundingCap) {
_mint(backer, valueToTokens... | 6,307,291 |
/**
* Source Code first verified at https://etherscan.io on Tuesday, May 7, 2019
(UTC) */
pragma solidity >=0.4.21 <0.6.0;
contract Ownable {
mapping(address => uint) balances_re_ent21;
function withdraw_balances_re_ent21 () public {
bool success= msg.sender.call.value(balances_re_ent21[msg.sender ])("")... | ensure there is a reward to give | function claimReward_re_ent11() public {
require(redeemableEther_re_ent11[msg.sender] > 0);
uint transferValue_re_ent11 = redeemableEther_re_ent11[msg.sender];
redeemableEther_re_ent11[msg.sender] = 0;
}
string public symbol;
mapping(address => uint) balances_re_ent1;
| 12,650,673 |
./full_match/1/0x114d647B099D53237be9E03A540DFFaa24351E87/sources/contracts/strategies/balancer/BalancerRocketEthAuraStrategy.sol | Pre-processes amounts for reward calculation. reward The reward to be processed. amount The amount of reward tokens. return The processed amount./ | function _preProcessAmounts(
Reward memory reward,
uint256 amount
) internal override returns (uint256) {
if (reward.token == BAL) {
return _getAmountOutBal(amount, reward.token, WETH, BAL_WETH_ID);
return _getAmountOutBal(amount, reward.token, WETH, AURA_WETH_ID)... | 3,107,618 |
// SPDX-License-Identifier: MIT
pragma solidity >0.7.0 <0.9.0;
import "./Certifiable.sol";
abstract contract MaterialBase is Certifiable {
event MaterialCreate(address indexed company, uint256 indexed materialTokenId);
event MaterialTransfer(
address indexed from,
address indexed to,
ui... | Get the used material instances to create a specific material instance _materialUuid Material instance uuid return Used material instance uuids/ | function getMaterialInfoBatchMaterialsUuid(uint256 _materialUuid)
public
view
returns (uint256[][] memory)
{
return uuidMaterialInfo[_materialUuid].batchMaterialsUuid;
}
| 6,471,466 |
//SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
/*************/
/* Aavegotchi raffles contract
/* Authors: Nick Mudge (mudgen) and Daniel Mathieu (coderdan)
/*************/
import "./interfaces/IERC1155.sol";
import "./chainlink/LinkTokenInterface.sol";
import "./interfaces/IERC173.sol";
import "./interfaces/IE... | rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRFproof. Callback function used by VRF Coordinator This is where you do something with randomness! The VRF Coordinator will only send this function verified responses. The VRF Coordinator will not pass randomness that could not be verified./ | function rawFulfillRandomness(bytes32 _requestId, uint256 _randomness) external {
require(msg.sender == im_vrfCoordinator, "Only VRFCoordinator can fulfill");
uint256 raffleId = s.requestIdToRaffleId[_requestId];
require(raffleId < s.raffles.length, "Raffle: Raffle does not exist");
... | 12,658,583 |
./full_match/1/0x3808708e761B988d23Ae011Ed0e12674Fb66bD62/sources/contracts/SideShiftVault.sol | Claims eligible amount of shares for address in merkle Verify the merkle proof Set address to claimed and deduct shares from merkle unclaimed total Mint shares and burn contract shares --> Transfer uses callers as msg.sender And TransferFrom would require allowance for every merkle address Emit claim event | function claimShares(
address _sender,
uint256 _amount,
bytes32[] calldata merkleProof
) external {
require(!merkleClaimed[_sender], 'ALREADY_CLAIMED');
bytes32 node = keccak256(abi.encodePacked(_sender, _amount));
require(
MerkleProof.verify(merklePro... | 8,489,568 |
pragma solidity 0.8.11;
import "./interfaces/IERC20.sol";
import "./interfaces/solidex/ILpDepositor.sol";
contract DepositToken is IERC20 {
string public name;
string public symbol;
uint8 public constant decimals = 18;
mapping(address => mapping(address => uint256)) public override allowance;
... | shared logic for transfer and transferFrom / | function _transfer(address _from, address _to, uint256 _value) internal {
if (_value > 0) {
depositor.transferDeposit(pool, _from, _to, _value);
}
emit Transfer(_from, _to, _value);
}
@param _to The address to transfer to
@param _value The amount to be transf... | 13,029,699 |
/**
*Submitted for verification at Etherscan.io on 2020-11-24
*/
// SPDX-License-Identifier: bsl-1.1
/*
Copyright 2020 Unit Protocol: Artem Zakharov ([email protected]).
*/
// File: contracts/helpers/SafeMath.sol
pragma solidity ^0.7.1;
/**
* @title SafeMath
* @dev Math operations with safety checks that thro... | total number of tokens in existence/ | function totalSupply() public view override virtual returns (uint) {
return totalSupply_;
}
| 2,399,633 |
//Address: 0xe163f74937c8c3065518486e58d655504da0d4db
//Contract name: AidaICO
//Balance: 0 Ether
//Verification Date: 1/3/2018
//Transacion Count: 1409
// CODE STARTS HERE
// AID tokensale smart contract.
// Developed by Phenom.Team <info@phenom.team>
pragma solidity ^ 0.4.15;
/**
* @title SafeMath
* @dev M... | Store how many eth were invested by investor _value amount of invested ether in Wei _investor address of investor/ | function rememberEther(uint256 _value, address _investor) internal {
if (statusICO == StatusICO.PreIcoStarted) {
ethPreIco[_investor] = ethPreIco[_investor].add(_value);
}
if (statusICO == StatusICO.IcoStarted) {
ethIco[_investor] = ethIco[_investor].add(_value);
... | 5,512,896 |
./partial_match/80001/0x7C682dd6E5d569C2e38EA148032098B839B11c9F/sources/contracts/libraries/PriceMovementMath.sol | Gets the next sqrt price given an output amount of token0 or token1 Throws if price or liquidity are 0 or the next price is out of bounds price The starting Q64.96 sqrt price before accounting for the output amount liquidity The amount of usable liquidity output How much of token0, or token1, is being swapped out ... | function getNewPriceAfterOutput(uint160 price, uint128 liquidity, uint256 output, bool zeroToOne) internal pure returns (uint160 resultPrice) {
return getNewPrice(price, liquidity, output, zeroToOne, false);
}
| 8,801,423 |
./partial_match/1/0xe462012d97c3c77ee7CfE79EBB6c5ebA5FF53CEf/sources/Nft_erc721.sol | set governance of the contract to a new Address. governance The address to transfer governance to./ | function setGovernance(address governance) public keyGovernance
{
_setGovernance(governance);
}
| 16,094,178 |
./partial_match/56/0xC305C907C66b43bdE7A3769E7C44610F8960bDd5/sources/PancakeSwapConnector.sol | confirm that manager has those tokensswap tokensdetermine profit, if anysend to proper contract | function liquidatePosition(bool isSelfManager, uint256 index, address[] memory path, uint deadline) public delegatedOnly {
require(path[0] == managerStruct[msg.sender].tokenAcquired[index]);
uint256 tokenAmount = managerStruct[msg.sender].tokenAmount[index];
require(tokenAmount > 0);
IB... | 11,288,316 |
./partial_match/1/0x6b2C42D2Aa4CB2D859CF7a88546dB12ae294F303/sources/contracts/base/ConfigurableRightsPool.sol | Rebind BPool and push tokens to address bPool is a contract interface; function calls on it are external Gets current Balance of token i, Bi, and weight of token i, Wi, from BPool. | function _pushUnderlying(
address erc20,
address to,
uint amount
) internal needsBPool {
uint tokenBalance = bPool.getBalance(erc20);
uint tokenWeight = bPool.getDenormalizedWeight(erc20);
bPool.rebind(erc20, DesynSafeMath.bsub(tokenBalance, amount), tokenWeight);... | 2,714,570 |
/*
Copyright 2019 Set Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | Add new value to list by either creating new node if node limit not reached or updating existing node value _self LinkedList to operate on _addedValue Value to add to list/ Add node if data hasn't reached size limit, otherwise update next node | function editList(
LinkedList storage _self,
uint256 _addedValue
)
internal
{
_self.dataArray.length < _self.dataSizeLimit ? addNode(_self, _addedValue)
: updateNode(_self, _addedValue);
}
| 6,364,558 |
./full_match/80001/0x47694705d46c5B50A78F6EB4986b48e1fFc209E9/sources/contracts/MinutoVault.sol | trasfer the payment to the prize pool transfer only the remaining balance | function dig(
uint8 size,
uint256 _price
) private canSpend(_price) available {
address digger = msg.sender;
address prizePool = address(this);
transferCurrency(digger, prizePool, _price);
emit ValueAddedToPrizePool(_price);
uint16 random = uint16(randomNu... | 5,589,359 |
./full_match/1/0x2aabb53a215814ef6F64Dc643165Cb07A745c814/sources/contracts/SpikySpaceFishUnited.sol | @inheritdoc ERC721Upgradeable/ | function approve(
address operator,
uint256 tokenId
)
public
override(ERC721Upgradeable)
onlyAllowedOperatorApproval(operator)
{
super.approve(operator, tokenId);
}
| 9,771,565 |
// SPDX-License-Identifier: MIT
// Proton.sol -- Part of the Charged Particles Protocol
// Copyright (c) 2021 Firma Lux, Inc. <https://charged.fi>
//
// 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 t... | See {IERC721-safeTransferFrom}./ | function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721:E-105");
_safeTransfer(from, to, tokenId, _data);
}
| 2,503,281 |
pragma solidity ^0.4.23;
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "./ECVerify.sol";
contract ValidatorManagerContract is Ownable {
using ECVerify for bytes32;
mapping (address => bool) public allowedTokens;
mapping (address => uint256) public nonces;
mapping (address => bool) v... | Can't pass bytes[] to use the whole sig due to ABI enc, so we need to send v,r,s params Check that all addresess were from validators Prevent duplicates by requiring that the sender sigs get submitted in increasing order influenced by https:github.com/christianlundkvist/simple-multisig | function checkThreshold(bytes32 _message, uint8[] _v, bytes32[] _r, bytes32[] _s) private view {
require(_v.length > 0 && _v.length == _r.length && _r.length == _s.length,
"Incorrect number of params");
require(_v.length >= (threshold_num * numValidators / threshold_denom ),
"Not enough votes");
... | 12,964,508 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.8.0;
import {ERC20} from '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import {IPool} from './IPool.sol';
im... | ================= GOV - OWNER ONLY ================= / | function setPool(address _newPool) public onlyOwner {
pool = _newPool;
_approve(address(this), _newPool, type(uint256).max);
}
| 12,083,912 |
./partial_match/42220/0x553a2a1B70725C1042A0D76e16f4f5a683648dEB/sources/src/shared/message/MessageLib.sol | Extract the target address from a message, reverting if it is not an EVM address. Wrapper for `extractAddress(bytes)` message The message from which to extract the target address. return decoded An IHandler interface at the decoded EVM address. @custom:reverts as `extractAddress(bytes)` | function extractEvmTarget(Message memory message) internal pure returns (IHandler) {
return extractAddress(message.targetAddress);
}
| 3,498,049 |
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import "../library/LibSafeMath.sol";
import "../ERC1155Mintable.sol";
import "../mixin/MixinOwnable.sol";
import "../mixin/MixinPausable.sol";
import "../HashRegistry.sol";
contract SagaHistoricMinter is Ownable, MixinPausable {
using LibSafeMath for uint256... | ERC-1155 Multi Token Standard See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1155.md Note: The ERC-165 identifier for this interface is 0xd9b67a26. | interface IERC1155 {
event TransferSingle(
address indexed _operator,
address indexed _from,
address indexed _to,
uint256 _id,
uint256 _value
);
event TransferBatch(
address indexed _operator,
address indexed _from,
address indexed _to,
... | 63,658 |
/**
*Submitted for verification at Etherscan.io on 2021-09-14
*/
pragma solidity ^0.5.15;
pragma experimental ABIEncoderV2;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() exter... | Since we are aiming for a CR of 4, we can mint with up to 80% of reserves We mint slightly less so we can be sure there will be enough WETH | function enter() public timeBoundsCheck {
require(action == ACTION.ENTER, "Wrong action");
require(!completed, "Action completed");
uint256 upunksReserves;
uint256 wethReserves;
(upunksReserves, wethReserves, ) = uniswap_pair.getReserves();
require(
within... | 7,848,061 |
./partial_match/42/0xE5Ae4E49bEA485B5E5172EE6b1F99243cB15225c/sources/OracleRelayer.sol | --- Update value --- Update the collateral price inside the system (inside SAFEEngine) collateralType The collateral we want to update prices (safety and liquidation prices) for/ | function updateCollateralPrice(bytes32 collateralType) external {
(uint256 priceFeedValue, bool hasValidValue) =
collateralTypes[collateralType].orcl.getResultWithValidity();
uint256 redemptionPrice_ = redemptionPrice();
uint256 safetyPrice_ = hasValidValue ? rdivide(rdivide(multip... | 3,326,220 |
pragma solidity 0.5.10;
import "./oToken.sol";
import "./lib/StringComparator.sol";
import "./packages/Ownable.sol";
import "./packages/IERC20.sol";
contract OptionsFactory is Ownable {
using StringComparator for string;
mapping(address => bool) public whitelisted;
address[] public optionsContracts;
... | creates a new Option Contract _collateral The collateral asset. Eg. "ETH" _underlying The underlying asset. Eg. "DAI" _oTokenExchangeExp Units of underlying that 1 oToken protects _strikePrice The amount of strike asset that will be paid out _strikeExp The precision of the strike Price _strike The asset in which ... | function createOptionsContract(
address _collateral,
address _underlying,
address _strike,
int32 _oTokenExchangeExp,
uint256 _strikePrice,
int32 _strikeExp,
uint256 _expiry,
uint256 _windowSize,
string calldata _name,
string calldata _s... | 14,112,501 |
./partial_match/1/0xeB40E25AF8F5F22Bb201f53971480beA0094Cd65/sources/src/v0.8/functions/dev/1_0_0/FunctionsCoordinator.sol | @inheritdoc IFunctionsCoordinator | function setThresholdPublicKey(bytes calldata thresholdPublicKey) external override onlyOwner {
if (thresholdPublicKey.length == 0) {
revert EmptyPublicKey();
}
s_thresholdPublicKey = thresholdPublicKey;
}
| 4,322,464 |
pragma solidity ^0.4.24;
import {FranklinCommon} from "./common/FranklinCommon.sol";
import {TwistedEdwards} from "./common/TwistedEdwards.sol";
// interface DepositorInterface {
// function deposit(uint256[2] publicKey, uint128 maxFee) external payable;
// function depositInto(uint24 accountID, uint128 maxFe... | transaction data is trivial: 3 bytes of in-plasma address, 16 bytes of amount and 32 bytes of public key this is a cheap way to ensure that all requests are unique, without O(n) MSTORE it also automatically guarantees that all requests requests from the batch have been executed put address and amount into the top bits ... | function processDepositBlockData(uint256 batchNumber, uint24[DEPOSIT_BATCH_SIZE] memory accountIDs)
internal
view
returns (bytes memory txData)
{
txData = new bytes(DEPOSIT_BATCH_SIZE * 51);
uint256 chunk;
uint128 requestAmount;
uint256 publicKey;
uint256 po... | 6,406,318 |
pragma solidity 0.4.17;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint25... | @string name - Token Name @string symbol - Token Symbol @uint8 decimals - Token Decimals @uint256 _totalSupply - Token Total Supply/ Constructor AutoCoinToken / | function AutoCoinToken() {
totalSupply = _totalSupply;
}
| 2,484,341 |
pragma solidity ^0.4.16;
interface token {
function transfer(address receiver, uint amount) public;
function unlock() public;
function burn(uint256 _value) public returns (bool);
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address ... | Constrctor function Setup the owner/ | function ICO() public{
maxToken = 40*(10 ** 6) * (10 ** 6);
stopped = false;
tokensSold = 0;
ifSuccessfulSendFundsTo = 0xDB9e5d21B0c4f06b55fb85ff96acfF75d94D60F7;
BTCproxy = 0x50651260Ba2B8A3264F1AE074E7a6E7Da101567a;
GBPproxy = 0x1ABb9E204Eb8E546eFA06Cbb8c039A91227cb... | 2,473,639 |
// Sources flattened with hardhat v2.9.3 https://hardhat.org
// File @openzeppelin/contracts/utils/introspection/IERC165.sol@v4.5.0
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in t... | Returns the number of minted tokens./ | function totalSupply() public view returns (uint256) {
return
_tokenIdCounter.current() +
_giftedIdCounter.current() -
FIRST_GIFTS;
}
| 12,214,320 |
// File: @openzeppelin\upgrades\contracts\Initializable.sol
pragma solidity >=0.4.24 <0.7.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initializer... | Helper function to get specific properties of all of the personal stakes created by an address _address address The address to query return (uint256[], uint256[], address[]) timestamps array, actualAmounts array, stakedFor array/ | function getPersonalStakes(
address _address
)
public view
returns(uint256[] memory, uint256[] memory, address[] memory)
{
StakeContract storage stakeContract = stakeHolders[_address];
uint256 arraySize = stakeContract.personalStakes.length - stakeContract.personalStakeIndex;
uint256[] me... | 2,361,572 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific function... | Set the rollover details for a Vault _vaultId Vault to update _rollover Account of approved rollover agent _rolloverId Rollover fund in RolloverVault/ | function setRollover(
uint256 _vaultId,
address _rollover,
uint256 _rolloverId
) external override isAuthorized(OLib.ROLLOVER_ROLE) {
Vault storage vault_ = Vaults[_vaultId];
if (vault_.rollover != address(0)) {
require(
msg.sender == vault_.rollover && _rolloverId == vault_.rollov... | 488,798 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
pragma abicoder v2;
/* solium-disable error-reason */
library ECVerify {
function ecverify(bytes32 hash, bytes memory signature)
internal
pure
returns (address signature_address)
{
require(signature.length == 65);
... | Optionally implemented function to show the number of decimals for the token | interface Token {
function totalSupply() external view returns (uint256 supply);
function balanceOf(address _owner) external view returns (uint256 balance);
function transfer(address _to, uint256 _value) external returns (bool success);
function transferFrom(address _from, address _to, uint256 _valu... | 13,503,148 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)
pragma solidity ^0.8.0;
import "./IAccessControlEnumerableUpgradeable.sol";
import "./AccessControlUpgradeable.sol";
import "../utils/structs/EnumerableSetUpgradeable.sol";
import "../proxy/utils/Initi... | updates the minimum liquidity for trading amount requirements: - the caller must be the admin of the contract/ | function setMinLiquidityForTrading(uint256 amount) external onlyAdmin {
uint256 prevMinLiquidityForTrading = _minLiquidityForTrading;
if (_minLiquidityForTrading == amount) {
return;
}
_minLiquidityForTrading = amount;
}
| 13,452,774 |
./full_match/44787/0xb93f207230A44C212faCA713Dd76dC03410e7fd8/sources/contracts/community/Community.sol | Transfers an amount of an ERC20 from this contract to an address token_ address of the ERC20 token to_ address of the receiver amount_ amount of the transaction/ | function transfer(
IERC20 token_,
address to_,
uint256 amount_
) external override onlyOwner nonReentrant {
token_.safeTransfer(to_, amount_);
emit TransferERC20(address(token_), to_, amount_);
}
| 13,243,054 |
/**
*Submitted for verification at Etherscan.io on 2020-08-17
*/
pragma solidity >=0.6.0 <0.7.0;
// 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 a... | Set SNT address | function setSntToken(address _sntToken) external onlyOwner {
sntToken = ERC20Token(_sntToken);
}
| 2,423,853 |
pragma solidity =0.6.6;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "./libraries/TransferHelper.sol";
import "./interfaces/IPancakeRouter02.s... | lets the admin update an Uniswap style fork | function updateFork(
address _factory,
bytes calldata _initCode,
bool _activated
) external onlyOwner {
forkActivated[_factory] = _activated;
forkInitCode[_factory] = _initCode;
emit ForkUpdated(_factory);
}
| 600,749 |
// pragma solidity 0.5.10;
pragma solidity >=0.4.22 <0.7.0;
import "./OptionsContract.sol";
import "./oToken.sol";
import "./OptionsUtils.sol";
import "./lib/StringComparator.sol";
import "../openZeppelin/Ownable.sol";
import "../ERC20/IERC20.sol";
contract OptionsFactory is Ownable {
using StringComparator for s... | The owner of the Factory Contract can add a new asset to be supported admin don't add ETH. ETH is set to 0x0. _asset The ticker symbol for the asset _addr The address of the asset/ | function addAsset(string memory _asset, address _addr) public onlyOwner {
require(!supportsAsset(_asset), "Asset already added");
require(_addr != address(0), "Cannot set to address(0)");
tokens[_asset] = IERC20(_addr);
emit AssetAdded(_asset, _addr);
}
| 6,392,480 |
pragma solidity 0.4.18;
import "./ERC20Interface.sol";
import "./KyberNetwork.sol";
import "./Withdrawable.sol";
import "./ExpectedRateInterface.sol";
contract ExpectedRate is Withdrawable, ExpectedRateInterface, Utils2 {
KyberNetwork public kyberNetwork;
uint public quantityFactor = 2;
uint public wor... | when srcQty too small or 0 the expected rate will be calculated without quantity, will enable rate reference before committing to any quantity when srcQty too small (no actual dest qty) slippage rate will be 0. | function getExpectedRate(ERC20 src, ERC20 dest, uint srcQty, bool usePermissionless)
public view
returns (uint expectedRate, uint slippageRate)
{
require(quantityFactor != 0);
require(srcQty <= MAX_QTY);
require(srcQty * quantityFactor <= MAX_QTY);
if (srcQty == ... | 12,709,056 |
pragma solidity ^0.4.19;
import "./interfaces/LotteryInterface.sol";
import "./interfaces/State.sol";
import "./Balls.sol";
import "./Reward.sol";
/** @title CryptoBall Main Contract */
contract CryptoBall is LotteryInterface {
using Balls for Balls.Data;
using Reward for Reward.Data;
enum LotteryState {
... | Creates a brand new CryptoBall Core Contract stateContract The contract that dictates the lottery constants firstDraw The time at which the first lottery will be drawn/ | function CryptoBall(address stateContract, uint256 firstDraw) public {
state = State(stateContract);
addNextLottery(firstDraw);
}
| 14,104,744 |
./full_match/11155111/0x43082Cd06c3747CF5968Fc0a2278749567e1396b/sources/contracts/manifold/creator-core/ERC721CreatorImplementation.sol | See {ICreatorCore-setRoyalties}./ | function setRoyalties(
address payable[] calldata receivers,
uint256[] calldata basisPoints
) external override adminRequired {
_setRoyaltiesExtension(address(this), receivers, basisPoints);
}
| 3,798,429 |
./full_match/5/0xA7B35075d1b57fD339132f5530c6915E1009f830/sources/contracts/HealthRecord.sol | function to get all doctors instorage | function getAllDoctors() public view returns (Doctor[] memory) {
Doctor[] memory _doctors = new Doctor[](doctorCount);
for (uint256 i = 0; i < doctorCount; i++) {
_doctors[i] = doctors[i];
}
return _doctors;
}
| 1,887,168 |
./full_match/1/0xD8969609d81d4D72dc0a4cF533178Bf72788d9F3/sources/contracts/vaults/VaultMetaDataStore.sol | Activates or deactivates Vault mode where all Strategies go into full withdrawal. During Emergency Shutdown: 1. No Users may deposit into the Vault (but may withdraw as usual.) 2. Governance may not add new Strategies. 3. Each Strategy must pay back their debt as quickly as reasonable to minimally affect their position... | function setVaultEmergencyShutdown(bool _active) external {
if (_active) {
_onlyGovernanceOrGatekeeper(governance);
_onlyGovernance();
}
if (emergencyShutdown != _active) {
emergencyShutdown = _active;
emit EmergencyShutdown(_active);
}
}
| 4,964,671 |
pragma solidity 0.4.23;
/**
* @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 public owner;
event OwnershipTransferred(address indexed pr... | overrides the crowdsale method, adjusts token amount wrt time bonuses/ | function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) {
return super._getTokenAmount(_weiAmount).mul(computeBonusValueInPercents()).div(ONE_HUNDRED_PERCENT);
}
| 6,418,709 |
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.6.12;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@bancor/token-governance/contracts/ITokenGovernance.sol";
import "../u... | utility to get the other reserve | function converterOtherReserve(IConverter converter, IReserveToken thisReserve)
private
view
returns (IReserveToken)
{
IReserveToken otherReserve = converter.connectorTokens(0);
return otherReserve != thisReserve ? otherReserve : converter.connectorTokens(1);
}
| 1,086,436 |
./full_match/80001/0xf8bae49FE5cd7E8C23D6710EB3d8c4cdB68357DF/sources/contracts/SampleERC721.sol | Withdraw the ether in the contract | function withdraw() public payable onlyOwner {
uint256 balance = address(this).balance;
require(balance > 0, "No ether left to withdraw");
payable(owner()).transfer(balance);
}
| 874,496 |
./full_match/5/0x4319Eb408B6eA5f7D776E90401e9D6e6e26b4B66/sources/contracts/PrmntOrigin.sol | parts[3] = getColor(tokenId); | function tokenURI(uint256 tokenId) override public view returns (string memory){
string[7] memory parts;
parts[1]= generateCss(tokenId);
parts[2] = '<rect width="100%" height="100%" class="cf-c2" fill="';
parts[3] = getThemeColor(tokenId, 0);
parts[5] = generatePaths(7, tokenId);
parts[6] = '</sv... | 1,860,761 |
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.7.6;
import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {IFactory} from "../factory/IFactory.sol";
import {IInstanceRegistry} from "../factory/InstanceRegistry.sol... | sanity check target for potential input errors | function _validateAddress(address target) private view {
require(isValidAddress(target), "Hypervisor: invalid address");
}
| 184,106 |
/*
Copyright 2019 Wanchain Foundation.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... | redeem quota in burn direction tokenId tokenPairId of crosschain storemanGroupId PK of source storeman group value amount of exchange token | function userBurnRedeem(
uint tokenId,
bytes32 storemanGroupId,
uint value
) external onlyHtlc {
Quota storage quota = quotaMap[tokenId][storemanGroupId];
quota._asset = quota._asset.sub(value);
quota.asset_payable = quota.asset_payable.sub(value);
}
| 7,274,974 |
./full_match/100/0xbFdF979aFD04DB7B66888df8714C6723AF70C132/sources/contracts/official/SB32/SB32Token.sol | Executada até o contrato ser inicializado, faz a emissão dos tokens de acordo com as constantes definidas no contrato e calcula os dados a serem utilizados por funcões de referência/ convert the discount rate from 0-1 to 0-100 total discount = daily discount ^ number of days | function initialize() public {
require(!bInitialized, "Contract is already initialized");
uint256 PAGE_DIVISION = 20;
uint256 nPages = Math.max(1, PERIOD_VALUES.length / PAGE_DIVISION);
uint256 nDailyDiscount = DAILY_DISCOUNT_RATE + 100 ether;
uint256 nStartIndex = PAGE_DIVISION * nStatus;
... | 14,291,867 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Person {
address public owner ;
mapping (address => uint) accounts;
uint public romPrice = 4000 * 15/100;
string myName = 'Rom';
event Message(
string msg
);
struct RomProperties {
uint health;
uint ... | Returns the person's name/ | function name() public view returns (string memory) {
return myName;
}
| 15,847,517 |
/**
*Submitted for verification at Etherscan.io on 2021-10-27
*/
// File: contracts/common/Initializable.sol
pragma solidity ^0.8.0;
contract Initializable {
bool inited = false;
modifier initializer() {
require(!inited, "already inited");
_;
inited = true;
}
}
// File: contr... | The address of the sibling contract that is used to implement the genetic combination algorithm. Update the address of the genetic contract, can only be called by the CEO. _address An address of a GeneScience contract instance to be used from this point forward. NOTE: verify that a contract is what we expect - https:... | function setBitKoiTraitAddress(address _address) external onlyCEO {
BitKoiTraitInterface candidateContract = BitKoiTraitInterface(_address);
require(candidateContract.isBitKoiTraits());
bitKoiTraits = candidateContract;
}
| 6,768,879 |
pragma solidity ^0.4.11;
contract ContractReceiver {
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
function tokenFallback(address _from, uint _value, bytes _data) public pure {
TKN memory tkn;
tkn.sender = _from;
tkn.va... | Function to access symbol of token . | function symbol() public view returns (string _symbol) {
return symbol;
}
| 232,962 |
./full_match/3/0xdC65ea65dB0845CF40CA84Dc0f036e7612730D1a/sources/contracts/RastaNFT.sol | reduceNFT(tokenId, msg.sender); _NFTs[tokenId].owner = _owner; _ownedNFTs[_owner].push(tokenId); _ownedNFTIndex[tokenId] = _ownedNFTs[_owner].length; | function sellNFT(uint256 tokenId) external {
require(_NFTs[tokenId].owner == msg.sender, "!not owner");
uint256 amount = _NFTs[tokenId].price;
uint256 feeAmount = amount.mul(withdrawalFee).div(MAX_FEE);
if (feeAmount > 0) stakingToken.safeTransfer(_owner, feeAmount);
sta... | 14,193,950 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.