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/4/0xd7b82adF79e622BC06e310bb5d781AAF75985888/sources/browser/CryptoByte20.sol | Pauses the ability to buy token. See {ERC20Pausable} and {Pausable-_pause}. Requirements: - the caller must have the `MINTER_ROLE`./ | function pause() public virtual {
require(hasRole(MINTER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have minter role to pause");
_pause();
}
| 789,293 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
pragma experimental ABIEncoderV2;
uint256 constant SECONDS_IN_THE_YEAR = 365 * 24 * 60 * 60; // 365 days * 24 hours * 60 minutes * 60 seconds
uint256 constant MAX_INT = type(uint256).max;
uint256 constant DECIMALS = 10**18;
uint256 constant PRECISION = 10**25;
... | withdraws rewards of this NFT | function withdrawReward(address policyBookAddress, uint256 nftIndex)
external
override
onlyBMIDAIStaking
returns (uint256)
{
uint256 reward = _withdraw(policyBookAddress, nftIndex, true);
_stakes[nftIndex].averageOnStake = _policyBooksRewards[policyBookAddress].a... | 12,198,250 |
/*
✨✨ 💛 💜 BUU INU 💜 💛✨✨
The most lovable villain of the Dragon Ball Inu Tokens — here to complete all the functions of great past tokens perfecting these formulas that have made huge waves in the current space.
This may be the final boss, but in the end it will save us all.
🟣 Tokenomics
ETH Token | No Burn
To... | solhint-disable-next-line no-inline-assembly | The most lovable villain of the Dragon Ball Inu Tokens — here to complete all the functions of great past tokens perfecting these formulas that have made huge waves in the current space.
This may be the final boss, but in the end it will save us all.
🟣 Tokenomics
ETH Token | No Burn
Total Supply: 100,000,000,000 (10... | 1,481,240 |
pragma solidity 0.5.10;
import 'openzeppelin-solidity/contracts/token/ERC20/ERC20.sol';
import 'openzeppelin-solidity/contracts/math/SafeMath.sol';
import './Loans.sol';
import './ALCompound.sol';
/**
* @title Atomic Loans Funds Contract
* @author Atomic Loans
*/
contract Funds is DSMath, ALCompound {
Loans l... | Get minimum loan amount able to be requested by a 'borrower' fund The Id of a Loan Fund return The minimum amount of tokens that can be requested from a Loan Fund/ | function minLoanAmt(bytes32 fund) public view returns (uint256) {
}
| 5,528,111 |
// File contracts/libraries/SafeMath.sol
pragma solidity 0.7.5;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pur... | Set bond price and how many to be sold for each ID _ids Array of IDs that will be sold _prices PDT given to bond correspond ID in `_ids` _toBeSold Number of IDs looking to be acquired | function setIdDetails(uint[] calldata _ids, uint[] calldata _prices, uint _toBeSold) external onlyPolicy() {
require(_ids.length == _prices.length, "Lengths do not match");
for(uint i; i < _ids.length; i++) {
IdDetails memory idDetail = idDetails[_ids[i]];
idDetail.bondPrice ... | 5,382,475 |
./partial_match/1/0xdE2E7D8998Be58790DB51fed54A7e65C84106706/sources/FUCKPEPE.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("FUCK PEPE 2.0", "FKPEPE2.0") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2P... | 9,127,244 |
./full_match/5/0xcB18027573F0ce52B944c02C40a1605640BA0560/sources/contracts/CrowdFunding.sol | create function that you want to use to fund your contract or transfer that token | function transferOther(uint256 _amount) public {
IERC20 token = IERC20(tokens["USDC"]);
token.transferFrom(msg.sender, address(this), _amount);
}
| 1,864,446 |
/**
*Submitted for verification at Etherscan.io on 2021-12-14
*/
/**
*Submitted for verification at Etherscan.io on 2021-10-07
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's bu... | Approve `to` to operate on `tokenId` Emits a {Approval} event./ | function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
| 1,274,407 |
pragma solidity ^0.4.24;
// File: contracts/interfaces/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface ERC20 {
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address _who... | returns the index if the address is in the list, otherwise returns list length + 1 | function containsAddress(address[] _addressList, address _addr)
internal
pure
returns (uint8) {
for (uint8 i = 0; i < _addressList.length; i++){
if (_addressList[i] == _addr) return i;
}
return uint8(_addressList.length + 1);
}
| 1,773,044 |
pragma solidity 0.5.11;
/**
* @title Gods Unchained ERC-721 Token Raffle
* @author Unchained Games
*/
contract RaffleMarket {
// You can't win the raffle if you don't buy a ticket
// ==== EVENTS ==== //
/**
* @dev OnBuyRaffleTickets emits an event when raffle tickets are purchased
*
* @... | refundRaffleTickets allows a raffle host to refund raffle tickets in order to cancel a raffle raffleId - The Raffle ID quantity - Number of tickets to refund/ Reference the raffle Require raffle host to be the message sender Require at least one ticket to refund Require tickets in raffle to refund Number of tickets t... | function refundRaffleTickets(uint256 raffleId, uint256 quantity)
public
{
Raffle storage raffle = raffles[raffleId];
require(raffle.host == msg.sender, "must be raffle host");
require(quantity > 0, "must refund at least one ticket");
require(raffle.participants.length ... | 944,807 |
pragma solidity ^0.4.24;
// Import the library 'Roles'
import "./Roles.sol";
// Define a contract 'AirlineRole' to manage this role - add, remove, check
contract AirlineRole {
using Roles for Roles.Role;
// Define 2 events, one for Adding, and other for Removing
event AirlineAdded(address indexed account);
e... | Define an internal function '_removeAirline' to remove this role, called by 'removeAirline' | function _removeAirline(address account) internal {
airlines.remove(account);
emit AirlineRemoved(account);
}
| 6,409,642 |
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
mapping(address => uint256) public balances;
function totalSupply() public view returns (uint256);
function balanceOf(address who) ... | transfer token for a specified address _to The address to transfer to. _value The amount to be transferred./ SafeMath.sub will throw if there is not enough balance. | function transfer(address _to, uint256 _value) checkFreezing(msg.sender, _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
e... | 6,111,705 |
./full_match/137/0x6657d1F065b01187A55F2A70Bf04fD5c92a51F60/sources/src/oracles/ChainlinkOracle.sol | @inheritdoc IOracle | function hasOracle(address token) external view returns (bool) {
return address(pricesInfo[token].feed) != address(0);
}
| 3,741,905 |
./full_match/5/0x6865E469b60a74Acb1dEb17CA8098b10d0b43289/sources/contracts/token/EthixToken.sol | TODO: Set the initial address for minting | function initialize() public initializer {
__BaseTokenUpgradeable_init(
msg.sender,
100000000 * 10**18,
'Ethix',
'ETHIX',
'Ethix'
);
}
| 7,076,200 |
./full_match/42/0xdfc5FD6EE8b2607d73ecB1f138d46344AED2739d/sources/uniswap-solidity-example/flatten/Flattened.sol | return address(0x3694A96D70a66cCd6d04196688CcfB45a35ebdd9).balance; | function getBalance() public view returns (uint256 _val) {
address multiDaiKovan = 0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa;
return IERC20(0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa).balanceOf(0x3694A96D70a66cCd6d04196688CcfB45a35ebdd9);
}
| 9,571,296 |
pragma solidity ^0.5.12;
import "@openzeppelin/upgrades/contracts/Initializable.sol";
import "./CherryPool.sol";
/**
* @title CherrySwap Contract
* @notice Create, manage and store all interest rate swaps within the Cherryswap platform.
* Offers one side of a swap with the other taken by a liquidity pool. The off... | at any point a trader in a swap can rage quite. This will eject them from the position, free up liquidity and they walk away with some dai however there is a heavy penalty in doing this!/ | function rageQuitSwap(uint256 _swapId) external returns (uint256) {
return 0;
}
| 5,535,892 |
./full_match/80001/0xe61417653DC88b5Ec9AA582CD57aeCF2F0bB5B0b/sources/contracts/GoalsContract.sol | GET TOTAL NO OF GOALS OWNED BY AN ACCOUNT | function getNoOfGoals(address goalOwner) view public returns (uint)
{
uint quantity;
quantity = __ownedGoals[goalOwner].length;
return quantity;
}
| 858,719 |
pragma solidity ^0.5.10;
/**
* @title A Supply Chain prototype contract implementation.
* @author Brian Ludlam
* @notice All Supply Chain relevant data is stored on-chain, with all data erroneous
* to the system stored on IPFS. All information in the system, whether on-chain or on
* IPFS, is impossible to change... | Transaction removeSupplyNode - Remove Supply Node by ID. nodeId = Valid ID of a Supply Node return boolean transaction success must be owner of Supply Node, Supply Node must exist and be inactive./CheckEffectReflect | function removeSupplyNode (uint256 nodeId) public returns(bool) {
require (nodeId != 0, "Node doesn't exist.");
SupplyNode storage node = _supplyNode[nodeId];
require (node.owner == msg.sender, "Must be node owner.");
require (node.steps == 0, "Cannot remove node with active steps.")... | 15,838,688 |
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.12;
import '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import '@openzeppelin/contracts/math/SafeMath.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import "./uniswapv2/interfaces/IU... | Setup for the first time after deploy and renounce ownership immediately. Set Lord of coin Renounce ownership immediately after init | function init(address _controller) external onlyOwner {
controller = _controller;
renounceOwnership();
}
| 1,609,415 |
./partial_match/1/0x24276C57C033E4e25E0CdBC4a98e2e9B767c2A98/sources/contracts/protocol/libraries/logic/ConfiguratorLogic.sol | Creates a new proxy and initializes the implementation implementation The address of the implementation initParams The parameters that is passed to the implementation to initialize return The address of initialized proxy/ | function _initTokenWithProxy(
address implementation,
bytes memory initParams
) internal returns (address) {
InitializableImmutableAdminUpgradeabilityProxy proxy = new InitializableImmutableAdminUpgradeabilityProxy(
address(this)
);
proxy.initialize(i... | 4,266,873 |
//SPDX-LICENSE-IDENTIFIER: UNLICENSED
pragma solidity ^0.6.0;
import "./Owned.sol";
import "./LittleLink.sol";
import "./ERC20Interface.sol";
import "./SafeMath.sol";
contract farming is Owned{
using SafeMath for uint256;
uint256 public yieldCollectionFee = 0.05 ether;
uint256 public stakingPeri... | add new stake transfer tokens from user to the contract balance | function Stake(uint256 _amount) external validStake(_amount) {
_newDeposit(address(little), _amount);
require(little.transferFrom(msg.sender, address(this), _amount));
emit Staked(msg.sender, _amount);
}
| 7,011,777 |
pragma solidity ^0.4.19;
contract ERC20 {
// We want to be able to recover & donate any tokens sent to the contract.
function balanceOf(address _who) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
}
contract theCyberInterface {
// The utility contract ca... | Revoke a membership and immediately assign the membership to a new member. Revoke the membership (provided it has been inactive for long enough). Assign a new member to the membership (provided the new member is valid). | function revokeAndSetNewMember(uint8 _memberId, bytes32 _memberName, address _memberAddress) public membersOnly {
theCyber.revokeMembership(_memberId);
theCyber.newMember(_memberId, _memberName, _memberAddress);
}
| 5,455,432 |
./partial_match/1/0xFfbCdc170D6E3764826243DB3d865014EF63C89b/sources/BOOM.sol | BOOMically 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 {BEP20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have a... | function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "BOOM: decreased allowance below zero"));
return true;
}
| 15,590,416 |
./full_match/1/0x00000000000029F69177DcE0c57A81c9b73c02CE/sources/contracts/IOpenAvatar.sol | IOpenAvatarGeneration An interface for the OpenAvatar generation./ | interface IOpenAvatarGeneration {
function openAvatarGeneration() external view returns (uint);
}
}
| 17,121,007 |
pragma solidity ^0.6.0;
// "SPDX-License-Identifier: UNLICENSED"
// import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol";
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
... | Calculate fair share of ERCI tokens note - _totalDaiValue is always >= _addAmount | function getMintAmount(uint _addAmount, uint _totalDaiValue) public view returns(uint) {
uint previousDaiValue = _totalDaiValue - _addAmount;
if (previousDaiValue == 0) {
}
}
| 39,478 |
./full_match/1/0x30e0c3ee6cBe2B9bDACa9d620a274796E7eea71A/sources/contracts/CrowdPool/Meter/CrowdPool.sol | accepts msg.value for eth or _amount for ERC20 tokens return unused ETH | function userDeposit() public payable nonReentrant {
require(crowdpool_info.pool_min <= msg.value, "balance is insufficent");
require(crowdpool_info.pool_max >= msg.value, "balance is too much");
BuyerInfo storage buyer = buyers[msg.sender];
uint256 amount_in = msg.value;
u... | 8,384,605 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.11;
import "@openzeppelin/contracts/math/SafeMath.sol";
contract OracleV2 {
using SafeMath for uint;
event ExchangeRatePosted(
address operator,
uint prevExchangeRate,
uint newExchangeRate
);
address public admin;
addre... | Update the exchange rate by poster. It would have a cooldown period and a max swing limit. newExchangeRate The new exchange rate. | function updateExchangeRate(uint newExchangeRate) external {
require(msg.sender == poster, "!poster");
require(block.timestamp > lastUpdated.add(UPDATE_PERIOD), "cooldown");
if (currentExchangeRate > 0) {
uint maxDiff = currentExchangeRate.mul(MAX_SWING).div(1e18);
r... | 9,268 |
// SPDX-License-Identifier: MIT
... | ~7 days in blocks (assuming 15s blocks) inject NONSTANDARD NAMING | function VOTINGPERIOD297() public pure returns (uint) { return 40_320; } | 12,851,117 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, ... | Returns name of the NFT at index./ | function tokenNameByIndex(uint256 index) public view returns (string memory) {
return _tokenName[index];
}
| 495,474 |
./full_match/5/0xE5D3b6f8CC5D5D5dD2c7F0a0E4d04dF8A93DdA27/sources/src/subscription/abstracts/PaymentSystem.sol | @inheritdoc IPaymentSystem | function setPricePerSecond(address target, uint256 newPrice) external override onlyAdmin(target) {
pricePerSecond = newPrice;
emit PricePerSecondUpdated(newPrice);
}
| 11,604,364 |
./full_match/4/0x32237F5713a1C7A855BED2923E543a47788182Db/sources/CenturyNFT-1155.sol | See {IERC1155MetadataURI-uri}./ | function uri(uint256 tokenId) public view virtual override returns (string memory) {
}
| 12,463,494 |
./full_match/80001/0xA56a293dEeE87Ea514d83A370ff5866753f3206F/sources/browser/LinkKeyINO.sol | See {ERC721-approve}./ | function approve(address to, uint256 tokenId) public virtual override lockedPosition(tokenId) {
super.approve(to, tokenId);
}
| 5,586,149 |
pragma experimental ABIEncoderV2;
contract SimpleStorage {
string[] public data;
struct Ijazah{
string data;
string nik;
string nama;
bool berkas;
bool kaprodi;
bool dekan;
bool rektor;
bool warek;
string nomor;
}
Ijazah[] public list_ijazah;
struct dataUser{
bytes3... | 3 kaprodi4 dekan5 wakil rektor6 rektor | function signature(uint index, uint role) public{
if(role == 3){
list_ijazah[index].kaprodi = true;
}
else if(role == 4){
list_ijazah[index].dekan = true;
}
else if(role == 5){
list_ijazah[index].warek = true;
}
else if(role == 6){
list_ijazah[index].rektor = true;
... | 15,846,463 |
./full_match/3/0xf57cF3840863A3cDbba30859474A58B6114233D9/sources/browser/DenunciaStorage.sol | Almacena el hash de una nueva denuncia | function set_denuncia(string memory ipfsHashparam) public {
ipfsHash = ipfsHashparam;
}
| 8,085,828 |
./full_match/5/0x8956E81d76FDdAbF0de54D8Da0d06c2474DeA340/sources/contracts/flatten.sol | Interface of the Currency Permit extension allowing approvals to be made via signatures, as defined in Adds the {permit} method, which can be used to change an account's allowance by presenting a message signed by the account owner. By not relying on {IERC20-approve}, the token holder account doesn't need to send a tra... | interface ICurrencyPermit {
event CurrencyApproval(
address indexed currency,
address indexed spender,
uint256 value
);
function permit(
address currency,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
by... | 11,605,972 |
./partial_match/1/0x9246B771Ee83877c8D6Cba3780747F603754728D/sources/src/WERC721Factory.sol | Create a new WERC721 contract. collection address ERC721 collection contract address. return wrapper address Wrapped ERC721 contract address./ Each collection should only have one WERC721 contract to avoid confusion. Clone the implementation with `collection` stored as an immutable arg. | function create(address collection) external returns (address wrapper) {
if (wrappers[collection] != address(0)) revert WrapperAlreadyCreated();
wrapper = LibClone.clone(
address(implementation),
abi.encodePacked(collection)
);
wrappers[collection] = wrapper... | 3,555,176 |
./full_match/80001/0x2503695550390C0148E8CAbcd011373Eaa11D2a2/sources/src/Contract.sol | <------------------ Admin function -----------------> get total compliants | function TotalCompalints() public view OnlyOwner returns(uint256) {
return(count-1);
}
| 5,548,498 |
pragma solidity ^ 0.4 .0;
contract Ballot {
//Information about a voter
struct Voter {
uint weight; //weight is amount of vote the voter can have
bool voted; //true implies voter already voted
uint vote; //index of the voted candidate
}
//Candidate type for a single candidate
struct Candidate {
bytes3... | This function gets the number of vote count of each candidate on the basis of their index {uint} indexindex of the candidatereturn {uint} voteCountthe number of commited vote of each candidate/ | function getCandidateVoteCount(uint index) constant returns(uint voteCount) {
return candidates[index].voteCount;
}
| 12,559,662 |
// File: @openzeppelin/contracts/utils/Counters.sol
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
* of elem... | Set NFT Per Address Limit | function setNFTPerAddressLimit(uint256 _cost) public onlyOwner {
nftPerAddressLimit = _cost;
}
| 411,983 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which ... | Function to burn tokens to The address that tokens will burn. value The amount of tokens to burn. return A boolean that indicates if the operation was successful./ | function burn(address to, uint256 value) public onlyMinter returns (bool) {
_burn(to, value);
totalBurned = totalBurned.add(value);
return true;
}
| 2,208,235 |
./full_match/1/0x6eaCC32119e988d0C1d16A1Dc493D01319998F94/sources/@tetu_io/tetu-contracts/contracts/base/strategies/StrategyStorage.sol | Buyback numerator - reflects but does not guarantee that this percent of the profit will go to distribution | function _buyBackRatio() internal view returns (uint) {
return getUint256("buyBackRatio");
}
| 2,939,237 |
pragma solidity ^0.5.13;
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "./interfaces/IAccounts.sol";
import "../common/Initializable.sol";
import "../common/interfaces/ICeloVersionedContract.sol";
import "../common/Signatures.sol";
... | Whether or not the signer has been registered as a signer for role account The address of account that authorized signing. signer The address of the signer. role The role that has been authorized./ | function isSigner(address account, address signer, bytes32 role) public view returns (bool) {
return
isLegacySigner(account, signer, role) ||
(signerAuthorizations[account][role][signer].completed && authorizedBy[signer] == account);
}
| 1,012,292 |
pragma solidity ^0.5.1;
import "./math/SafeMath.sol";
import "./MultiSigSecured.sol";
import "./Pausable.sol";
/*
* @title LedgeriumIndexContract
* @author Vivek <https://github.com/bvivek777>
* The LedgeriumIndexContract Contract hold the details of the controller and the data contracts
* and allows various cont... | Function to create proposal to upgrade the contract. It checks validity of msg.sender with isStakeHolder modifier msg.sender address should be one of the active admin _newStakeHolder address, concerned stakeholder address _decision bool, flag to vote FOR or AGAINST return Emits event UpdateContractAddress() once the ... | function voteStakeHolder(address _newStakeHolder, bool _decision) public isContractActive isInitalised returns(bool res) {
require(exists[msg.sender]);
require(getMethodStatus("updateStakeHolder"));
string memory _temp = append("updateStakeHolder-", toString(_newStakeHolder));
require(isBallotActive(_temp), m... | 923,306 |
//SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable... | Returns `true` if `_account` has been Rejected. _account The address of the user./ | function isRejected(address _account) public view returns (bool) {
return _hasItem(_account, REJECTED_ID);
}
| 11,684,354 |
pragma solidity ^0.4.24;
// File: 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 public owne... | Multiply one real by another. Truncates overflows./ When multiplying fixed point in x.y and z.w formats we get (x+z).(y+w) format. So we just have to clip off the extra REAL_FBITS fractional bits. | function mul(int256 realA, int256 realB) internal pure returns (int256) {
return int256((int256(realA) * int256(realB)) >> REAL_FBITS);
}
| 1,299,138 |
./partial_match/1/0x21fC96B8C0d429820bcD03872083Bf8B1A0970eb/sources/TokenSale.sol | Set the address of the USDT token contract newUsdtTokenAddress The address of the USDT token contract/ | function setUsdtTokenAddress(address newUsdtTokenAddress) public onlyOwner {
require(newUsdtTokenAddress != address(0), "Invalid token address");
usdtTokenAddress = newUsdtTokenAddress;
}
| 9,408,754 |
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/GSN/Context.sol
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, they should not b... | Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. The call is not executed if the target address is not a contract. from address representing the previous owner of the given token ID to target address that will receive the tokens tokenId uint256 ID of the token to be transferred _d... | function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try
IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data)
returns (bytes4 retval) {
return retval == IER... | 613,883 |
./partial_match/1/0x56790e4A08eD17aa3b7b4B1b23A6a84D731Fd77e/sources/FraxUnifiedFarm_ERC20_Convex_frxETH.sol | File contracts/Misc_AMOs/convex/IConvexStakingWrapperFrax.sol function earned(address _account) external view returns (tuple[] memory claimable); | interface IConvexStakingWrapperFrax {
function addRewards() external;
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function balanceOf(address account) external view returns (uint256);
function col... | 2,787,863 |
./full_match/5/0x907599886DeBF90CCB1e9B446b31D52bDD25926D/sources/contracts/StandardToken.sol | Internal function to finalize token transfer | function finalizeTransfer(address sender, address recipient, uint256 finalAmount, uint256 amount) internal {
_balances[sender] = _balances[sender].sub(amount, "Insufficient balance");
_balances[recipient] = _balances[recipient].add(finalAmount);
emit Transfer(sender, recipient, finalAmount);... | 7,074,871 |
./partial_match/1/0xd81b3000D6Cad7af85E9939AfAb1243B56618EA9/sources/VFIN.sol | Get partitions index of a tokenholder. tokenHolder Address for which the partitions index are returned. return Array of partitions index of 'tokenHolder'./ | function partitionsOf(address tokenHolder) external override view returns (bytes32[] memory) {
return _partitionsOf[tokenHolder];
}
| 4,032,058 |
// SPDX-License-Identifier: None
// All rights reserved. @2022
/*
__ ___ _ _ _____ _ _
\ \ / / | (_) | / ____| | | | |
\ \ /\ / /| |__ _| |_ ___| | _ _| |__ ___| | ___ ___ ___
\ \/ \/ / | '_ \| | __/ ... | ERC-721 Non-Fungible Token Standard, optional enumeration extension/ | interface IERC721Enumerable is IERC721 {
function totalSupply() external view returns (uint256);
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
function tokenByIndex(uint256 index) external view returns (uint256);
}
}
| 6,085,748 |
./full_match/1313161554/0x6E682B51F8bb67294B522b75a1E79dDd4502cc94/sources/DonaswapRouter.sol | ADD LIQUIDITY create the pair if it doesn't exist yet | function _addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin
) internal virtual returns (uint amountA, uint amountB) {
if (IDonaswapFactory(factory).getPair(tokenA, tokenB) == address(0)... | 13,234,777 |
pragma solidity ^0.4.21;
contract KKToken {
//地址 -> 余额 的映射
mapping (address => uint256) balances;
//地址 -> 允许代币转移的地址及数量 的映射
mapping (address => mapping (address => uint256)) allowed;
//这4个状态变量会自动创建对应public函数
string public name = " Kunkun Token";
string public symbol = "KKT";
uint8 public decimals ... | 构造函数,只在合约创建时执行一次实际总供应量 = 代币数量10^精度把所有代币分配给合约创建者 | function KKToken(){
totalSupply = initialSupply * (10 ** uint256(decimals));
balances[msg.sender] = totalSupply;
}
| 215,778 |
pragma solidity^0.4.23;
import "./InvestableDAL.sol";
contract AffiliateDAL is InvestableDAL {
//...
}
mapping(address => uint) affiliate;
function getAffiliatePay() public {
//...
}
uint amount = affiliate[msg.sender];
require(amount > 0);
msg.senser.transfer(amount);
affiliate[msg.sender] = 0;
func... | Function to get affiliate payout/ | function play(uint _hash, address _affiliate)
}
uint ticketValue = msg.value;
}
pragma solidity^0.4.23;
import "./InvestableDAL.sol";
function getAffiliatePay() public {
uint amount = affiliate[msg.sender];
require(amount > 0);
msg.senser.transfer(amount);
affiliate[msg.se... | 1,757,265 |
pragma solidity ^0.5.0;
import "./NearProver.sol";
import "../nearbridge/Borsh.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20Detailed.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20Burnable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20Mintable.sol";
contract BridgedToken is ERC20Burnable,ER... | require(timestamp < block.timestamp && block.timestamp < timestamp + 1 days, "attack must be within a day"); | function onAttackEvent(bytes32 attacker, uint256 bullet, uint256 _difficult, uint256 timestamp, address beneficiary) private {
otherSideEvent();
require(otherDifficult != _difficult, "difficult can't equeal");
if(otherDifficult > _difficult) otherDifficult = _difficult;
uint256 attac... | 2,464,341 |
./partial_match/42/0xbAeeB5FF962a9005E1bbD9A3e06aB6A73b2310f9/sources/CoreBank.sol | balances[msg.sender] -= withdrawAmount; Transfer ether back to user, revert on falied. Broadcast user withdraw event. | function withdraw(uint256 withdrawAmount) public returns(uint256 remainingBalances) {
require(balances[msg.sender] >= withdrawAmount, "Money is not enough!");
balances[msg.sender] = balances[msg.sender].sub(withdrawAmount);
msg.sender.transfer(withdrawAmount);
... | 8,887,010 |
/**
*Submitted for verification at Etherscan.io on 2021-10-08
*/
pragma solidity ^0.8.9;
// SPDX-License-Identifier: Apache-2.0
// Isolde Payment Gateway V3.0
contract Isolde {
modifier onlyOwner {
require(msg.sender == _owner, "caller is not the owner");
_;
}
// tier struct
... | since who isn't msg.sender someone can possibly gift a subscribtion | function subscribe(address who, uint8 level) external payable { | 2,017,970 |
./full_match/1/0x7c5EE73C8547636a453f98A2E81Bd4BEE616E237/sources/contracts/Chrects.sol | Converts a `uint256` to its ASCII `string` decimal representation./ The maximum value of a uint256 contains 78 digits (1 byte per digit), but we allocate 128 bytes to keep the free memory pointer 32-byte word aliged. We will need 1 32-byte word to store the length, and 3 32-byte words to store a maximum of 78 digits. T... | function _toString(uint256 value) internal pure returns (string memory ptr) {
assembly {
ptr := add(mload(0x40), 128)
mstore(0x40, ptr)
let end := ptr
for {
let temp := value
ptr := sub(ptr, 1)
mstore8(ptr, add(48, mod... | 2,927,568 |
./full_match/4/0x394221E8310D3501c68Ad33699A8D833DC65DE69/sources/contracts/CloudsOnChains.sol | Allows an admin to mint the artist proofs, and send it to an address This can be run while the contract is paused | function adminMint(uint count, address recipient)
public
onlyRole(MANAGER_ROLE)
returns (uint256)
{
require(_tokenIds.current() + count < ARTIST_PROOF_COUNT, "Exceeded max proofs");
require(_tokenIds.current() + count < MAX_SUPPLY, "SOLD OUT");
for (uint i=0; i<count; i++) {
... | 12,288,391 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.... | provided for interface compliance, not usedanybody can transferFrom if price is paid | function getApproved(uint256 tokenId) external view override tokenExists(tokenId) returns (address ) {
return oneApprove[tokenId];
}
| 5,545,833 |
// solhint-disable-file
// SPDX-License-Identifier: BlueOak-1.0.0
pragma solidity ^0.5.8;
/**
* @title The standard ERC20 interface
* @dev see https://eips.ethereum.org/EIPS/eip-20
*/
interface IERC20 {
function transfer(address, uint256) external returns (bool);
function approve(address, uint256) externa... | The standard ERC20 interface/ | interface IERC20 {
function transfer(address, uint256) external returns (bool);
function approve(address, uint256) external returns (bool);
function transferFrom(
address,
address,
uint256
) external returns (bool);
function totalSupply() external view returns (uint256);
... | 2,417,622 |
//Address: 0xdaae09accd32ccdb5d1fe48244d1826f55670704
//Contract name: ParsecPresale
//Balance: 0 Ether
//Verification Date: 1/23/2018
//Transacion Count: 421
// CODE STARTS HERE
pragma solidity 0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/... | The participant will need to withdraw their Parsec credits if minimal pre-sale amount was reached and date between TOKEN_WITHDRAWAL_START_DATE and TOKEN_WITHDRAWAL_END_DATE Participant can withdraw Parsec credits only during token withdrawal period Participant cannot withdraw Parsec credits if the minimum fundi... | function participantClaimCredits() external {
require(now >= TOKEN_WITHDRAWAL_START_DATE);
require(now < TOKEN_WITHDRAWAL_END_DATE);
require(totalFunding >= PRESALE_MINIMUM_FUNDING);
require(creditBalanceOf[msg.sender] > 0);
var tokensToApprove = creditBalanceOf[msg.sender... | 13,063,836 |
pragma solidity ^0.4.18;
import "../node_modules/openzeppelin-solidity/contracts/payment/PullPayment.sol";
//function asyncTransfer(address dest, uint256 amount) internal;
//function withdrawPayments() public;
contract ConnectFour is PullPayment {
enum BoardPiece {NONE, RED, BLACK}
//Encapsulates total game lea... | Creates a game with a unique ID. Anyone can join this game. | function createNewGame() external payable {
uint gameId = createUniqueId();
createNewGameEntry(gameId);
}
| 15,871,308 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.6;
pragma experimental ABIEncoderV2;
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
import "../../src/vendor/IUniswapV3Pool.sol";
interface IUniswapV3PoolDeployer {
struct CreationParameters {
IERC20TokenV06 token0;
IERC2... | Always buy 100% of other token balance. Always buy 100% of other token balance. | function swap(
address recipient,
bool zeroForOne,
int256 amountSpecified,
uint160,
bytes calldata data
)
external
override
returns (int256 amount0, int256 amount1)
{
uint256 balance0Before = token0.balanceOf(address(this));
uin... | 14,059,003 |
./full_match/1/0xD953Eda57EAB69F2EB0103bffA9acc66eA98e0aB/sources/contracts/wallet/WalletState.sol | Get the stored 32 bytes word of a module key the key a module would like to get/ | function getState32(bytes32 key) public view returns (bytes32 out) {
assembly {
out := sload(key)
}
}
| 17,017,391 |
/*
file: depositoffer.sol
ver: 0.1.1
author: Chris Kwan
date: 28-OCT-2017/11-March-2018
email: ecorpnu AT gmail.com
A collated contract set for a token sale specific to the requirments of
Depositoffer (DOT) token product.
This software is distributed in the hope that it will be useful,
but WITHOUT ... | a divided by b No assert required as no overflows are posible. | function div(uint a, uint b) internal constant returns (uint c) {
c = a / b;
}
| 6,343,818 |
// SPDX-License-Identifier: MIT
// solhint-disable-next-line compiler-version
pragma solidity ^0.8.0;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contract can't have a constructor, it's common to move con... | See {IERC20Permit-nonces}./ Initializes the domain separator using the `name` parameter, and setting `version` to `"1"`. It's a good idea to use the same `name` that is defined as the ERC20 token name./ | function _initializePermit(string memory name_) internal {
_HASHED_NAME = keccak256(bytes(name_));
_CACHED_CHAIN_ID = block.chainid;
_CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(_EIP712_DOMAIN_TYPEHASH, _HASHED_NAME, _EIP712_VERSION);
}
| 166,321 |
./partial_match/1/0x74EA2438157d8Bb836cAD8419be38f7Bba799D30/sources/ERC223Token.sol | https:www.ethereum.org/token | interface tokenRecipient {
function receiveApproval( address from, uint256 value, bytes data ) public;
pragma solidity ^0.4.19;
}
| 2,587,172 |
./full_match/100/0x2c3DE641b0448FF29f917F9808ce63047A04d83c/sources/contracts/rari-fuse/src/core/CToken.sol | Gets balance of this contract in terms of the underlying This excludes the value of the current message, if any return The quantity of underlying owned by this contract/ Performs a transfer in, reverting upon failure. Returns the amount actually transferred to the protocol, in case of a fee. This may revert due to i... | function getCashPrior() internal view returns (uint256);
function doTransferIn(address from, uint256 amount)
internal
returns (uint256);
function doTransferOut(address payable to, uint256 amount) internal;
modifier nonReentrant(bool localOnly) {
_beforeNonReentrant(localOnly)... | 14,268,065 |
pragma solidity ^ 0.4.18;
/**
* @title Owned
* @dev The Owned contract has an owner address, and provides basic authorization control
*/
contract Owned {
address public owner;
/*Set owner of the contract*/
function Owned() public {
owner = msg.sender;
}
/*only owner ca... | send the rest of the tokens after the crowdsale end and send to contributors address | function finaliseICO() public onlyOwner whenNotPaused {
require(tokenSaleActive == true);
uint256 tokensLeft = icoTotalAmount.sub(totalSoldToken);
tokenSaleActive = false;
require(tokensLeft > 0);
balanceOf[contributorsAddress] = balanceOf[contributorsAddress].add(tok... | 1,770,874 |
// SPDX-License-Identifier: MIT
// _ ______________ ____________
// / | / / ____/_ __/__ / ____/ ____/_________ ____ ___
// / |/ / /_ / / / _ \/ / __/ / __ / ___/ __ \/ __ `__ \
// / /| / __/ / / / __/ /_/ / /_/ // /__/ /_/ / / / / / /
// /_/ |_/_/ /_/ \___/\____/\_... | See {IERC721Enumerable-tokenOfOwnerByIndex}./ | function tokenOfOwnerByIndex(address owner, uint256 index) external view override returns (uint256) {
return _holderTokens[owner].at(index);
}
| 1,094,368 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.8.0;
// Sources flattened with hardhat v2.8.4 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/IERC20.sol@v4.5.0
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)
/**
* @dev Interface of the ERC20 standard as de... | ========== VIEWS ========== / | function upcomingCPIParams() public view returns (
uint256 upcoming_year,
uint256 upcoming_month,
uint256 upcoming_timestamp
) {
if (stored_month == 12) {
upcoming_year = stored_year + 1;
upcoming_month = 1;
}
else {
upcoming_y... | 1,301,150 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4 <0.9.0;
/// @title Keep3rJobFundableCredits contract
/// @notice Handles the addition and withdrawal of credits from a job
interface IKeep3rJobFundableCredits {
// Events
/// @notice Emitted when Keep3rJobFundableCredits#addTokenCreditsToJob is called
/// ... | Confirms if the current keeper is registered Can be used for general (non critical) functions _keeper The keeper being investigated return _isKeeper Whether the address passed as a parameter is a keeper or not Confirms if the current keeper is registered and has a minimum bond of any asset. Should be used for prote... | interface IKeep3rJobOwnership {
event JobOwnershipChange(address indexed _job, address indexed _owner, address indexed _pendingOwner);
event JobOwnershipAssent(address indexed _job, address indexed _previousOwner, address indexed _newOwner);
error OnlyJobOwner();
error OnlyPendingJobOwner();
function j... | 2,562,397 |
pragma solidity ^0.6.0;
/**
* @title Primitive's Exchange Contract
* @notice A Decentralized Exchange to manage the buying and selling
of Prime Option tokens.
* @author Primitive
*/
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and i... | SET POOL ADDRESS / | function setPoolAddress(address poolAddress) external onlyOwner {
_poolAddress = poolAddress;
_poolInterface = IPool(poolAddress);
}
| 13,010,075 |
pragma solidity ^0.4.24;
/**
* @title ERC20 interface
*
*/
contract ERC20 {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
function allowance(address owner, address s... | Return address available allocation _recipient which address is applicable/Check if user have bought tokens | function checkAvailableTokens (address _recipient) public view returns (uint256) {
require(buyers[_recipient]);
return allocationsTotal[_recipient];
}
| 14,523,706 |
./partial_match/1/0xC41E4fB1d131c3ecCD9Fd67eaA175FebCe352d2F/sources/CHARNFT.sol | ------------ OpenSea Overrides --------------/ | function transferFrom(
address _from,
address _to,
uint256 _tokenId
)
public
payable
override(ERC721A, IERC721A)
onlyAllowedOperator(_from)
{
super.transferFrom(_from, _to, _tokenId);
}
| 4,410,358 |
./partial_match/1/0x2e41695761F17ad320152293c16329Aa5d6128F2/sources/FraxPool.sol | Will fail if fully collateralized or algorithmic Redeem FRAX for collateral and FXS. > 0% and < 100% collateral-backed Need to adjust for decimals of collateral Move all external functions to the end | function redeemFractionalFRAX(uint256 FRAX_amount, uint256 FXS_out_min, uint256 COLLATERAL_out_min) external notRedeemPaused {
(, uint256 fxs_price, , uint256 global_collateral_ratio, , , uint256 redemption_fee,) = FRAX.frax_info();
require(global_collateral_ratio < COLLATERAL_RATIO_MAX && global_co... | 4,150,777 |
pragma solidity ^0.4.23;
// File: contracts\abstract\Pool\IRoleModel.sol
contract IRoleModel {
/**
* @dev RL_DEFAULT is role of basic account for example: investor
*/
uint8 constant RL_DEFAULT = 0x00;
/**
* @dev RL_POOL_MANAGER is role of person who will initialize pooling contract by asking... | Allow to use functions of other contract from this contract _to address of contract to call _value amount of ETH in wei _data contract function call in bytes type return result of operation, true if success/ | function execute(address _to, uint _value, bytes _data) external returns (bool) {
require (getRole_()==RL_ADMIN);
require (getState_()==ST_FUND_DEPRECATED);
return _to.call.value(_value)(_data);
| 12,796,163 |
// SPDX-License-Identifier: MIT
// COPIED FROM https://github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/GovernorAlpha.sol
// Copyright 2020 Compound Labs, Inc.
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following con... | Deposit LP tokens to SSFV2LPT for SUSHI allocation. | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending =
user.amount.mul(pool.accSushiPerShare).div(1e12)... | 145,147 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import {Math} from "@openzeppelin/contracts/math/Math.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {SafeERC... | Attempts to withdraw part of a CDP's collateral. This function reverts if a deposit into the CDP was made in the same block. This is to prevent flash loan attacks on other internal or external systems. _amount the amount of collateral to withdraw. | function withdraw(uint256 _amount) external nonReentrant noContractAllowed expectInitialized returns (uint256, uint256) {
CDP.Data storage _cdp = _cdps[msg.sender];
require(block.number > _cdp.lastDeposit, "");
_cdp.update(_ctx);
(uint256 _withdrawnAmount, uint256 _decreasedValue) = _withdrawFundsTo... | 11,858,893 |
/**
*Submitted for verification at Etherscan.io on 2019-09-27
*/
pragma solidity >=0.4.21 < 0.6.0;
/**
* Copyright © 2017-2019 Ramp Network sp. z o.o. All rights reserved (MIT License).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentatio... | This adapter can receive eth payments, but no other use of the fallback function is allowed./ | function () external {
require(msg.data.length == 0);
if (msg.sender != swapsContract) {
emit ReceivedFunds(msg.sender, msg.value);
}
}
| 12,989,985 |
./partial_match/3/0xC8543af5736557994C47607dc3Df9a051F62DB72/sources/EternityVesting.sol | Get Release Time return {uint256} releaseTime/ | function getReleaseTime() public view returns (uint256) {
return releaseTime;
}
| 5,088,336 |
/*
Copyright 2017-2018 RigoBlock, Rigo Investment Sagl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | INTERNAL FUNCTIONS/ locks and unlocks account based on time range _address of msg.sender return bool of current lock status of addresscheck if first time address is requestingif not first time check the timeLock solium-disable-next-line security/no-block-members | function checkStatus(address _address)
internal
view
returns (bool)
{
if(status[_address] == 0) {
return false;
}
else {
if(block.timestamp >= status[_address]) {
return false;
}
else {
retu... | 2,508,827 |
./partial_match/1/0x409bf77A8E3Fe384497227eA508029B5364933DE/sources/contracts/governance/GovernorParameters.sol | Compute the required amount of voting power to create a proposal blockNumber The block number to get the proposal threshold at | function proposalThreshold(uint256 blockNumber)
public
view
returns (uint256)
{
return
(_getPastTotalSupply(blockNumber) * proposalThresholdNumerator) /
FRACTION_DENOMINATOR;
}
| 2,587,042 |
./partial_match/1/0x6da28Db16ecB33C2468FF934CD3A3447c588309A/sources/contracts/HegicOptionsNFT.sol | checks if this token is owned by this contract _tokenId ID of the token to be queried return whether or not it is owned by the contract/ | function isValidToken(uint _tokenId) external view returns (bool){
(, address holder, , , , , ,) = getUnderlyingOptionParams(_tokenId);
return holder == address(this);
}
| 2,726,554 |
./full_match/1/0x6c51041A91C91C86f3F08a72cB4D3F67f1208897/sources/src/base/Cellar.sol | Used to more efficiently simulate minting shares using a stored `totalAssets` value./ | function _previewMint(
uint256 shares,
uint256 _totalAssets,
uint256 _totalSupply
) internal pure returns (uint256 assets) {
assets = shares.mulDivUp(_totalAssets, _totalSupply);
}
| 5,008,871 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppel... | prevent negative numbers | function prices(uint256 _count) public view returns (uint256, uint256, uint256, uint256) {
uint256 cyberLootBalance = cyberLootContract.balanceOf(_msgSender()) - cyberDiscountsRedeemed[_msgSender()];
uint256 totalPartnerBalance = moreLootContract.balanceOf(_msgSender()) + gearContract.balanceOf(_msg... | 14,812,942 |
pragma solidity 0.4.24;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface ERC721Receiver {
/**
* @dev Magic value to be returned upon successful reception of an NFT
* Equals to `bytes4(keccak256("o... | Gets the balance of the specified address _owner address to query the balance of return uint representing the amount owned by the passed address/ | function balanceOf(address _owner) public view returns (uint) {
require(_owner != address(0));
uint balance;
if(tokenIsChamp){
(,balance,,) = core.addressInfo(_owner);
(,,balance,) = core.addressInfo(_owner);
}
return balance;
}
| 1,303,770 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.6;
import "@chainlink/contracts/src/v0.6/VRFConsumerBase.sol";
import "./ChainlinkConfiguration.sol";
import "./IStakingToken.sol";
contract WinnerPicker is VRFConsumerBase {
address public poolContractAddress;
ChainlinkConfiguration private configura... | Callback function used by VRF Coordinator/ | function fulfillRandomness(bytes32 requestId, uint256 randomness) internal override {
IStakingToken(poolContractAddress).distributePrizePool(randomness);
}
| 5,459,885 |
./partial_match/1313161554/0xd27c37c992f2BEe78064a52C80c782C1f6567A19/sources/contracts/apps/trisolarisStable/UnoAssetRouterTrisolarisStable.sol | return stakeLP - Total user stake(in LP tokens)./ | function userStake(address _address, address swap) external view returns (uint256 stakeLP) {
Farm farm = Farm(farmFactory.Farms(swap));
if (farm != Farm(address(0))) {
stakeLP = farm.userBalance(_address);
}
}
| 16,922,158 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
/// @title ERC20 token with fee per transfers
contract SMART is ERC20 {
/// @notice Address allowed to change fees and wallets to receive them.
address public manager;
/// @notice Contract that mak... | TransferFrom applying the fee. fee is adicional to the ´amount´ sended. | function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
uint256 _fee = (amount * fee) / 10000;
_transfer(sender, recipient, amount);
_transfer(sender, treasureWallet, _fee);
_transfer(sender, stru... | 1,010,824 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.0;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "./Members.sol";
import "./MemberHelpers... | called when data subscriber initiates subscription enterpriseAddress - address of the enterprise audits - type of audits this cohort is part of/ | function dataSubscriberPayment(address enterpriseAddress, uint256 audits) public {
require(enterpriseAddress != address(0), "DepositModifier:dataSubscriberPayment - Enterprise address can't be 0");
require(audits >=0 && audits <=5, "DepositModifier:dataSubscriberPayment - Audit type is not in the ... | 5,344,652 |
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC1155/IERC1155.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*
* _Available si... | Transfers `amount` tokens of token type `id` from `from` to `to`. Emits a {TransferSingle} event. Requirements: - `to` cannot be the zero address. - `from` must have a balance of tokens of type `id` of at least `amount`. - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and re... | function _safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonAr... | 220,162 |
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
// SPDX-License-Identifier: MIT
// IMPORT INTERFACE
import { Task } from './task.sol';
import { UserManager } from './user_manager.sol';
import { OracleManager } from './oracle_manager.sol';
import { TokenManager } from './token_manager.sol';
contract TaskMana... | COMPLETE A TASK IF THE TASK EXISTS EXTRACT TASK & ORACLE INFO IF THE DEVICE OWNER IS THE SENDER REMOVE FROM PENDING SAVE IN COMPLETED | function complete(address _task, string memory _data) public {
require(exists(_task), 'task does not exist');
Task task = fetch_task(_task);
string memory oracle = task.oracle();
address oracle_owner = oracle_manager.fetch_oracle(oracle).owner();
require(msg.sender == orac... | 12,680,441 |
pragma solidity ^0.6.10;
// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.4.16 <0.7.0;
library Output {
int128 private constant MIN_64x64 = - 0x80000000000000000000000000000000;
int128 private constant MAX_64x64 = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
function divuu(uint256 x, uint256 y) private pure... | We rely on overflow behavior here We rely on overflow behavior here We rely on overflow behavior here | function pow(int128 x, uint256 y) private pure returns (int128) {
uint256 absoluteResult;
bool negativeResult = false;
if (x >= 0) {
absoluteResult = powu(uint256(x) << 63, y);
absoluteResult = powu(uint256(uint128(- x)) << 63, y);
negativeResult = y & 1 >... | 1,061,322 |
./full_match/4/0xC2239DFE608D1EE319a3ad022c702674E2Cf3840/sources/HungryBunz.sol | TOKENURI OVERRIDE RELOCATED TO BE BELOW UTILITY FUNCTIONS | function tokenURI(uint256 tokenId) public view virtual override(ERC721) returns (string memory) {
require(_exists(tokenId), "Token Doesn't Exist");
string memory output;
if (_bypassAPI) {
output = produceJSON(tokenId);
output = string(abi.encodePacked(_appBas... | 12,388,794 |
// SPDX-License-Identifier: MIT
pragma solidity 0.7.4;
import "hardhat/console.sol";
import "../security/Context.sol";
contract ReentrancyAttack {
function callSender(bytes4 data) public {
// solhint-disable-next-line avoid-low-level-calls
(bool success,) = Context._msgSender().call(abi.encodeWith... | solhint-disable-next-line avoid-low-level-calls | function callSender(bytes4 data) public {
(bool success,) = Context._msgSender().call(abi.encodeWithSelector(data));
require(success, "ReentrancyAttack: failed call");
}
| 5,450,063 |
// SPDX-License-Identifier: BSD-4-Clause
pragma solidity 0.8.3;
import "./IDexManager.sol";
import "./ISwapUnderlyingAsset.sol";
import "../Option/IOddzAsset.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/... | Function to add the the exchange data data. _underlying Id of the underlying. _strike Id of the strike asset. _exchange Address of the exchange./ | function addExchange(
bytes32 _underlying,
bytes32 _strike,
ISwapUnderlyingAsset _exchange
) external onlyOwner(msg.sender) returns (bytes32 exHash) {
require(_underlying != _strike, "Invalid assets");
require(address(_exchange).isContract(), "Invalid exchange");
... | 2,557,658 |
/**
Telegram: https://t.me/pootokenerc
Website: https://pootoken.co
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
abstract contract Context {
function _msgSender() ... | generate the uniswap pair path of token -> weth make the swap | function swapTokensForEth(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeO... | 1,853 |
./full_match/43114/0x27271ECd985F1B666e51209B033d93ddC5a36076/sources/FarmersOnlyMasterChef.sol | Withdraw LP tokens from MasterChef. | function withdraw(uint256 _pid, uint256 _amount) external nonReentrant {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
payOrLockupPending(_pid);
uint... | 4,531,557 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.