file_name stringlengths 71 779k | comments stringlengths 0 29.4k | code_string stringlengths 20 7.69M | __index_level_0__ int64 2 17.2M |
|---|---|---|---|
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the ... | Sets the strategist address _strategist The address of the strategist/ | function setStrategist(address _strategist) external {
require(msg.sender == governance, "!governance");
strategist = _strategist;
}
| 10,063,153 |
// File: node_modules\openzeppelin-solidity\contracts\token\ERC20\ERC20Basic.sol
pragma solidity ^0.4.21;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint... | Borrower gets collateral token back when contract cancelled/ | function borrowerCancel() public onlyBorrower atState(States.WaitingForFunds) {
uint amount = collateralToken.balanceOf(address(this));
collateralToken.transfer(borrowerAddress, amount);
currentState = States.Cancelled;
}
| 1,755,056 |
// Created for proof of concept examples.
pragma solidity ^0.4.21;
// Proof of Existence contract, modified
contract ProofOfExistenceZDF {
// store mapping of collected proofs
// a proof is a sha256 of a "document" (string) and the sender's address
mapping (bytes32 => bool) private proofs;
address public ow... | check if a document has been notarized | function checkDocument(string document) public view returns (bool) {
bytes32 proof = proofFor(document);
return hasProof(proof);
}
| 6,425,322 |
./full_match/1/0x2b4fA931ADc5D6b58674230208787A3dF0bD2121/sources/contracts/v1/interfaces/IERC721.sol | Required interface of an ERC721 compliant contract./ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); event ApprovalForAll(address indexed owner, address indexed operator, bool approved); function safeTransferFrom(address from, address to, uint256 tokenId) external; function app... | interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
function balanceOf(address owner) external view returns (uint256 balance);
function ownerOf(uint256 tokenId) external view returns (address owner);
function transferFrom(address from, ... | 3,096,287 |
./full_match/137/0x7d561bE86eBCB1d8353f98c21Bef7232343598a8/sources/WebaverseERC721.sol | Check if this address is a collaborator on a single issue token (like land) tokenId ID of the token a Address to check return Returns true if the address is a collaborator on the token/ | function isSingleCollaborator(uint256 tokenId, address a)
public
view
returns (bool)
{
for (uint256 i = 0; i < tokenIdToCollaborators[tokenId].length; i++) {
if (tokenIdToCollaborators[tokenId][i] == a) {
return true;
}
}
re... | 4,669,348 |
pragma solidity ^0.4.18;
/**
* @title Owned contract with safe ownership pass.
*
* Note: all the non constant functions return false instead of throwing in case if state change
* didn't happen yet.
*/
contract Owned {
/**
* Contract owner address
*/
address public contractOwner;
... | Sets asset spending allowance for a specified spender. Note: to revoke allowance, one needs to set allowance to 0. _spenderId holder id to set allowance for. _value amount to allow. _symbol asset symbol. _senderId approve initiator holder id. return success. Asset should exist. Should allow to another holder. Doubl... | function _approve(uint _spenderId, uint _value, bytes32 _symbol, uint _senderId) internal returns (uint) {
if (!isCreated(_symbol)) {
return _error(ATX_PLATFORM_ASSET_IS_NOT_ISSUED);
}
if (_senderId == _spenderId) {
return _error(ATX_PLATFORM_CANNOT_APPLY_TO_ONESELF);... | 5,370,236 |
pragma solidity 0.5.16;
import "./SafeMath.sol";
/**
* @dev banq audit is a decentralized audit platform for opensource (smart contract) audit projects
* anyone can submit audit request and anyone can submit a audit report. A successful agree results in
* increased loyalty points. A disagree results in l... | Auditor can close a report before reaction of the auditor./ | function CloseReport(uint256 _reportID) public returns (bool success) {
require(reports[_reportID].reportstatus == 1, "close report: report is closed");
require(reports[_reportID].owner == msg.sender, "close report: not the owner");
reports[_reportID].reportstatus = 3;
... | 13,034,441 |
./partial_match/1/0x3Bd7C671fa216406e8fed77FF2719fD3B6cD3432/sources/DCDPass.sol | Function to reserve NFTs for the team to address of the receiver quantity number of NFTs to reserve/ | function reserveTeamTokens(address to, uint256 quantity) external onlyOwner {
require(totalSupply() + quantity <= SUPPLY_MAX, "Exceeds max supply");
_safeMint(to, quantity);
}
| 9,163,803 |
//Address: 0xf28e28be834f0daaf295157246608284e0212688
//Contract name: NettingChannelLibrary
//Balance: 0 Ether
//Verification Date: 11/9/2017
//Transacion Count: 1
// CODE STARTS HERE
pragma solidity ^0.4.11;
interface Token {
/// @return total amount of tokens
function totalSupply() constant returns (u... | Lock format: [0:8] expiration [8:40] amount [40:72] hashlock | function decodeLock(bytes lock) internal returns (uint64 expiration, uint amount, bytes32 hashlock) {
require(lock.length == 72);
assembly {
expiration := mload(add(lock, 8))
amount := mload(add(lock, 40))
hashlock := mload(add(lock, 72))
}
}
| 1,761,901 |
pragma solidity ^0.5.0;
import "@openzeppelin/contracts/access/Roles.sol";
import "@openzeppelin/contracts/ownership/Ownable.sol";
contract RoleManagement is Ownable {
using Roles for Roles.Role;
mapping (string => Roles.Role) private roles;
string[] public UserRoles;
event RoleAdded(address indexed operator... | check if the role exists _role the name of the role return bool/ | function checkExistingRole(string memory _role) public view returns(bool){
uint8 i=0;
while(i<UserRoles.length){
if(keccak256(abi.encode(_role))==keccak256(abi.encode(UserRoles[i])))
return true;
i++;
}
return false;
}
| 12,584,439 |
pragma solidity ^0.4.20;
/*
*
* ==================================== *
* Hey guys its Trevon here, dont talk to me unless its about intangible Coins*
* PROOOOF OF TREVON JAMES DONT MISS OUT ITS GETTING BIG HERE *
* get your tokens here ... | Converts all incoming ethereum to tokens for the caller, and passes down the referral addy (if any)/ | function buy(address _referredBy)
public
payable
returns(uint256)
{
purchaseTokens(msg.value, _referredBy);
}
| 19,075 |
pragma solidity ^ 0.4.21;
pragma solidity ^0.4.10;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
asse... | Allows the current owner to transfer control of the contract to a newOwner. newOwner The address to transfer ownership to./ | function transferOwnership(address newOwner)public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
| 931,772 |
/**
*Submitted for verification at Etherscan.io on 2022-04-15
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external... | Sending the NFT to this contract _auctionStartTime=_auctionStartTime + block.timestamp; | function _createNewNftAuction(
address _nftContractAddress,
uint256 _tokenId,
address _erc20Token,
uint256 _ownerPercentage,
uint256 _minPrice,
uint256 _auctionStartTime
) internal{
IERC721(_nftContractAddress).transferFrom(
msg.sender,
... | 10,989,552 |
pragma solidity ^0.5.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be aplied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there... | Deposit ETH/ERC20 and mint Compound Tokens/ | function mintCEth(uint tokenAmt) internal {
CETHInterface cToken = CETHInterface(getCETHAddress());
cToken.mint.value(tokenAmt)();
emit LogMint(getAddressETH(),getCETHAddress(),tokenAmt, msg.sender);
}
| 5,428,381 |
// File: contracts/PollenParams.sol
// This file is generated for the "mainnet" network
// by the 'generate-PollenAddresses_sol.js' script.
// Do not edit it directly - updates will be lost.
// SPDX-License-Identifier: MIT
pragma solidity >=0.6 <0.7.0;
/// @dev Network-dependant params (i.e. addresses, block numbers... | IPollenDAO Interface - administration functions Only the contract owner may call/ | interface IPollenDaoAdmin is IPollenTypes {
function initialize() external;
function setOwner(address newOwner) external;
function addAsset(address asset) external;
function removeAsset(address asset) external;
function addVotingTerms(VotingTerms memory terms) external;
function switchVotin... | 302,600 |
pragma solidity ^0.4.21;
// File: contracts/Oracle/DSAuth.sol
contract DSAuthority {
function canCall(
address src, address dst, bytes4 sig
) public view returns (bool);
}
contract DSAuthEvents {
event LogSetAuthority (address indexed authority);
event LogSetOwner (address indexed owner);... | for quick overview of current sellerBalances for a user auctionSellTokens are the sellTokens defining an auctionPair auctionBuyTokens are the buyTokens defining an auctionPair user is the user who wants to his tokens | function getSellerBalancesOfCurrentAuctions(
address[] auctionSellTokens,
address[] auctionBuyTokens,
address user
)
external
view
returns (uint[])
{
uint length = auctionSellTokens.length;
uint length2 = auctionBuyTokens.length;
requir... | 7,683,290 |
./partial_match/1/0x0059A21dAc9730DE83A7d624921c66c05f102ca2/sources/PersonalCornerSale.sol | Duplicate Token name for cloneability Duplicate Token symbol for cloneability informational support for external sites that respected Ownable | {
event TokenMetadataChanged(uint256 tokenId);
event TokenRedeemed(uint256 tokenId, uint256 timestamp, string memo);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 pub... | 3,688,575 |
// SPDX-License-Identifier: None
pragma solidity 0.6.12;
import "../BoilerplateStrategy.sol";
import "../../interfaces/curvefi/IYERC20.sol";
import "../../interfaces/curvefi/ICurveFi_DepositY.sol";
import "../../interfaces/curvefi/ICurveFi_SwapY.sol";
import "../../interfaces/uniswap/IUniswapV2Router02.sol";
/**
* ... | Invests all underlying assets into our yCRV vault./ convert the entire balance not yet invested into yCRV first then deposit into the yCRV vault deposits the entire balance and also asks the vault to invest it (public function) | function deposit() public override {
yCurveFromUnderlying();
uint256 ycrvBalance = IERC20(ycrv).balanceOf(address(this));
if (ycrvBalance > 0) {
IERC20(ycrv).safeApprove(yycrv, 0);
IERC20(ycrv).safeApprove(yycrv, ycrvBalance);
IYERC20(yycrv).depos... | 12,085,148 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*import "Register.sol";
import "Agora.sol";
import "Loi.sol";
import "API_Register.sol";
import "Delegation.sol";
import "IDelegation.sol";
import "Citizens_Register.sol";
import "IVote.sol";
*/
import "contracts/Register.sol";
import "contracts/Agora.sol";
imp... | Removes a, address from a Register contract's {Register_Authorities} list. register Address of the register contract authority Address to remove from the {Register_Authorities} list./ | function Remove_Register_Authority(address register, address authority) external Register_Authorities_Only{
require(Registers_Address_List.contains(register), "Unknown Register");
Register res = Register(register);
res.Remove_Authority(authority);
}
| 12,741,920 |
//File: contracts\EthereumSign.sol
pragma solidity ^0.4.18;
contract EthereumSign {
//archive of digital certificates, every certificate combine signer
//address and arts guid
mapping(bytes32 => Version[]) digitalCertificateArchive;
struct Version {
uint8 version;
byte... | combine signer with guid of arts to create an archive managed by the signer | function GetSignVersion(string guid, address signer, uint version) public view returns(bytes32 sign, uint8 signedVersion,uint256 timestamp){
address _signer = signer;
string memory addressString = toString(_signer);
string memory concatenatedData = strConcat(addressString,guid);
byte... | 2,379,854 |
./full_match/1/0xeb1BD76F9f018A05D1FB1C28d8Af4e3E54b5773a/sources/contract.sol | Withdraw Balance to Address | function withdrawMoneyTo(address payable _to) public onlyOwner {
_to.transfer(getBalance());
}
| 4,959,165 |
// solium-disable linebreak-style
pragma solidity ^0.5.0;
import "./oraclizeAPI.sol";
/**
*
* @dev Interface with Oraclize in 5.0 fashion
* @dev Main purpose to set bool storage IsMarioPrez as to whether the current president's name starts with mario :)
*
* Example execution result
*
* [2019-02-22T01:21:16.... | Detects whether "maRio" in any small/caps combination is the first substring within the input parameter. Tolerates initial spaces e.g. " Mario" or " mario" or "mArio" fullName The returned oraclize name string to search for the given first name. Note as of this writing it looks like this: "Nicos Anastasiades" re... | function getIsMarioPrez(string memory fullName) public pure returns (bool) {
bytes memory fullNameBytes = bytes(fullName);
bytes memory soughtAfterCaps = bytes("MARIO");
bytes memory soughtAfterSmall = bytes("mario");
uint8 fni = 0;
uint8 spaces = 0;
bytes1 space = b... | 883,406 |
./full_match/1/0x0303C9298CEaf4D467ba80A37aE2b5Abc94D2566/sources/contracts/ThePaintedSatoshis.sol | Transfers `tokenId` from `from` to `to`. As opposed to {transferFrom}, this imposes no restrictions on msg.sender. Requirements: - `to` cannot be the zero address. - `tokenId` token must be owned by `from`. Emits a {Transfer} event./ Clear approvals from the previous owner | function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721S.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from... | 3,058,764 |
./partial_match/3/0xE2B9ab1C0E4426F753e20E85eBF5A14E79600DF2/sources/RetjehSwapPair.sol | update reserves and, on the first call per block, price accumulators never overflows, and + overflow is desired | function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private {
require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'RetjehSwap: OVERFLOW');
uint32 blockTimestamp = uint32(block.timestamp % 2**32);
if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0... | 5,297,572 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.6;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(addres... | update rolling datastore exchange rate and timestamp | function _dailyUpdate() internal {
if (timeSinceLastDailyUpdate() >= SECONDS_PER_DAY) {
emit DailyRewardsReceived(block.timestamp, rewardsReceived());
rollingStartTimestamp = block.timestamp;
rollingStartEvrtBalance = evrtBalance();
rollingStartTotalDeposits =... | 5,536,942 |
./partial_match/1/0x0fFce62A09a14344e2FA1306Ca34674f205dE259/sources/Shibrabbit.sol | exclude from paying fees or having max transaction amount | constructor() ERC20("Shiba Rabbit", "SHIBRABBIT") {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTransaction(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Fa... | 15,998,746 |
// File: contracts/zeppelin/SafeMath.sol
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a,... | Decreases the total supply by burning the specified number of tokens from the supply controller account. _value The number of tokens to remove. return A boolean that indicates if the operation was successful./ | function decreaseSupply(uint256 _value) public onlySupplyController returns (bool success) {
require(_value <= balances[supplyController], "not enough supply");
balances[supplyController] = balances[supplyController].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit SupplyDe... | 173,105 |
pragma solidity ^0.4.24;
interface PlayerBookReceiverInterface {
function receivePlayerInfo(uint256 _pID, address _addr, bytes32 _name, uint256 _laff) external;
function receivePlayerNameList(uint256 _pID, bytes32 _name) external;
}
contract PlayerBook {
using NameFilter for string;
using SafeMath fo... | ============================================================================== _ _ _|_ _ . _\(/_ | |_||_) .=============|================================================================ | function addGame(address _gameAddress, string _gameNameStr)
onlyAdmin()
public
{
require(gameIDs_[_gameAddress] == 0, "derp, that games already been registered");
gID_++;
bytes32 _name = _gameNameStr.nameFilter();
gameIDs_[_gameAddress] = gID_;
... | 2,041,585 |
./partial_match/1/0xEC221AE5c62029cB03D91EFf85611A378A1F8883/sources/Strategy.sol | Transfers an ERC20 stuck in the contract to designated address _token - token address (can not be staking token) _to - address to send token to _amount - amount to transfer | function rescueToken(
address _token,
address _to,
uint256 _amount
) external onlyOwner {
_rescueToken(_token, _to, _amount);
}
| 2,775,046 |
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.7.6;
pragma abicoder v2;
import '@uniswap/v3-core/contracts/libraries/SafeCast.sol';
import '@uniswap/v3-core/contracts/libraries/TickMath.sol';
import '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';
import '@uniswap/v3-core/contracts/interfac... | @inheritdoc IQuoter | function quoteExactInput(bytes memory path, uint256 amountIn) external override returns (uint256 amountOut) {
while (true) {
bool hasMultiplePools = path.hasMultiplePools();
(address tokenIn, address tokenOut, uint24 fee) = path.decodeFirstPool();
amountIn = quoteExactI... | 350,082 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
/* *\
* ,.-"""-., ... | Returns whether the contract is currently claimable./ | function isClaimable() private view returns (bool) {
return claimStartDate != 0 && block.timestamp >= claimStartDate;
}
| 9,945,750 |
pragma solidity 0.5.11;
pragma experimental "ABIEncoderV2";
import "../interfaces/CounterfactualApp.sol";
/// @title LibAppCaller
/// @author Liam Horne - <liam@l4v.io>
/// @notice A library for the ChallengeRegistry to make staticcalls to Apps
contract LibAppCaller {
/// @notice A helper method to check if the... | Execute the application's applyAction function to compute new state appDefinition An address of an app definition to call appState The ABI encoded version of some application state action The ABI encoded version of some application action return A bytes array of the ABI encoded newly computed application state | function applyAction(
address appDefinition,
bytes memory appState,
bytes memory action
)
internal
pure
returns (bytes memory)
{
return CounterfactualApp(appDefinition).applyAction(appState, action);
}
| 12,596,136 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
// Part: IERC20Wrapper
interface IERC20Wrapper {
/// @dev Return the underlying ERC-20 for the given ERC-1155 token id.
function getUnderlyingToken(uint id) external view returns (address);
/// @dev Return the conversion rate from ERC-1155 to ERC-20, m... | Burn ERC1155 token to redeem LP ERC20 token back plus SUSHI rewards. id Token id amount Token amount to burn return The pool id that that you will receive LP token back. | function burn(uint id, uint amount) external nonReentrant returns (uint) {
if (amount == uint(-1)) {
amount = balanceOf(msg.sender, id);
}
(uint pid, uint stSushiPerShare) = decodeId(id);
_burn(msg.sender, id, amount);
chef.withdraw(pid, amount);
(address lpToken, , , uint enSushiPerShar... | 12,035,131 |
./full_match/137/0x2b7f5C0ae63365eb033bbC2e67821d3a6650986f/sources/contracts/helpers/EnsoShortcutsHelpers.sol | Returns `input` bytes32 as uint256./ | function bytes32ToUint256(bytes32 input) external pure returns (uint256) {
return uint256(input);
}
| 3,756,129 |
./full_match/1/0xd9dF2211b576D430FAb3BD93f915a1345974D797/sources/contracts/v1/governance/PRTCLCoreERC721Votes.sol | Override regular delegation to disable it/ | function delegate(address /* delegatee */, uint256 /* collectionId */) public virtual override {
revert("PRTCLCoreERC721Votes: regular delegation disabled. Please use delegation with signature.");
}
| 8,408,837 |
./full_match/5/0x5c0CEcB41148E1528e7ec8d8a6a04CC2b3E0592c/sources/project_/contracts/examples/IncentivisedSlidingWindowOracle.sol | returns the observation from the oldest epoch (at the beginning of the window) relative to the current time no overflow issue. if observationIndex + 1 overflows, result is still zero. | function getFirstObservationInWindow(address pair) private view returns (Observation storage firstObservation) {
uint8 observationIndex = observationIndexOf(block.timestamp);
uint8 firstObservationIndex = (observationIndex + 1) % granularity;
firstObservation = pairObservations[pair][firstOb... | 1,949,549 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./Errors.sol";
import "./PaymentSplitter.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/ut... | Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the total shares and their previous withdrawals./ | function release(address account) public virtual {
require(_shares[account] > 0, "PaymentSplitter: account has no shares");
uint256 totalReceived = address(this).balance + totalReleased();
uint256 payment = _pendingPayment(account, totalReceived, released(account));
require(payment... | 5,839,753 |
/**
*Submitted for verification at Etherscan.io on 2020-12-18
*/
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Address.sol
pragma solidity ^0.6.2;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.... | Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}./ | function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "TransparentUpgradeableProxy: new admin is the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
| 2,453,199 |
./partial_match/4/0x3c3d4e051D347f1dfDebe1F235754b6e12E01ecf/sources/InstantSwap.sol | Shows interest to be paid/ calculate time difference Get number of weeks Get the left out days Get Interest amount based on user loan amount | function viewInterest(address token, uint256 loanId, uint256 period)
public
view
returns (uint256 value, uint256 leftoutDays) {
uint256 time = (loans[loanId].interestpaidOn > 0 ?
loans[loanId].interestpaidOn : loans[loanId].depositTime);
time ... | 8,620,924 |
pragma solidity ^0.4.15;
contract testAddress {
function f() {
address x = 0x123;
address myAddress = this;
if (x.balance < 10 && myAddress.balance >= 10) x.transfer(10);
}
function g() {
address nameReg = 0x72ba7d8e73fe8eb666ea66babc8116a41bfb10e2;
nameReg.call("re... | Since enum types are not part of the ABI, the signature of "getChoice" will automatically be changed to "getChoice() returns (uint8)" for all matters external to Solidity. The integer type used is just large enough to hold all enum values, i.e. if you have more values, `uint16` will be used and so on. | function getChoice() returns (ActionChoices) {
return choice;
}
| 6,347,261 |
pragma solidity ^0.4.11;
library SafeMath {
// function assert(bool assertion) internal {
// if (!assertion) {
// throw;
// }
// } // assert no longer needed once solidity is on 0.4.10 */
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint25... | Contructor that gives msg.sender all of existing tokens./ | function SmileToken() {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
| 15,354,664 |
./partial_match/1/0xBa31AEF54734A89D7b89aBa2e0C7bf2564F6657F/sources/BPool.sol | Absorb any tokens that have been sent to this contract into the pool | function gulp(address token)
external
_logs_
_lock_
{
require(_records[token].bound);
_records[token].balance = IERC20(token).balanceOf(address(this));
}
| 3,711,864 |
./full_match/4/0x663065Ff4b7A99c06e264F743e99Fd1cB520e7dA/sources/contracts/NFTCollection.sol | buy token/1. verify price and not address(0)2. calculate fee3. transfer fee and transfer money to seller4. transfer token from seller to buyerfire event to FE | function buy(uint256 _tokenId, uint256 amount)
public
payable
{
address payable seller = payable(address(ERC721.ownerOf(_tokenId)));
address buyer = msg.sender;
uint256 payAmount = msg.value;
require(payAmount >= amount, "Price issue");
uint256 fee = mar... | 646,369 |
pragma solidity ^0.4.11;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint25... | Get the overall success state of the ICO return bool whether the state is successful, or not/ | function isSuccessful () public constant returns (bool) {
return state == SaleState.Success;
}
| 6,380,356 |
./partial_match/1/0xC88DF5326FcCeD20Cb1a3a441DF4F955f4AA23AE/sources/ICOCycle.sol | INTERNALcounter +=1; | function executeVerdict(uint _disputeId, bool _verdictForInvestor) internal {
disputes[_disputeId].pending = false;
uint milestoneDispute = disputes[_disputeId].milestone;
ICOCycle icoRound = ICOCycle(disputes[_disputeId].icoRoundAddress);
icoRound.verdictExecuted(disputes[_disputeId... | 15,636,259 |
./full_match/1/0x51c537d5a4305281F6354369Af074f2301236b35/sources/presale_dep.sol | Instantly burns your Token and sends you proportional backing. | function liquifyForMain(uint256 amt) external{ | 8,419,013 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0;
import '@openzeppelin/contracts/math/SafeMath.sol';
import '../interfaces/IGoSwapPair.sol';
import '../interfaces/IGoSwapFactory.sol';
import '../interfaces/IGoSwapCompany.sol';
/**
* @title GoSwap库合约
*/
library GoSwapLibrary {
using SafeMath for uint256;... | 获取单个输出数额 给定一项资产的输出量和对储备,返回其他资产的所需输入量 amountOut 输出数额 reserveIn 储备量In reserveOut 储备量Out fee 手续费比例 return amountIn 输入数额/确认输出数额大于0确认储备量In和储备量Out大于0分子 = 储备量In 储备量Out 1000分母 = 储备量Out - 输出数额 (1000-fee)输入数额 = (分子 / 分母) + 1 | function getAmountIn(
uint256 amountOut,
uint256 reserveIn,
uint256 reserveOut,
uint8 fee
) internal pure returns (uint256 amountIn) {
require(amountOut > 0, 'GoSwapLibrary: INSUFFICIENT_OUTPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'GoSwapLibrary: INS... | 6,411,643 |
pragma solidity 0.4.23;
import "Ownable.sol";
import "ICOEngineInterface.sol";
import "KYCBase.sol";
import "./ORSToken.sol";
/// @title ORSTokenSale
/// @author Autogenerated from a Dia UML diagram
contract ORSTokenSale is Ownable, ICOEngineInterface, KYCBase {
uint public PRESALE_CAP = 222247844e18;
uint ... | Started return True or false | function started() public view returns (bool) {
require(IMPLEMENTATION);
}
| 994,659 |
// Dependency file: @openzeppelin/contracts-ethereum-package/contracts/math/Math.sol
// pragma solidity ^0.6.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure ... | Withdraw, forfietting all rewards | function emergencyWithdraw() external nonReentrant {
withdraw(_balances[msg.sender]);
}
| 12,238,106 |
./full_match/43113/0x1a47Bae8d88f91A30d8BEd041eCC6bB76709B69F/sources/contracts/TokenPaymaster.sol | solhint-disable-next-line reason-string | function _verifyPaymasterData(GsnTypes.RelayRequest calldata relayRequest) internal virtual override view {
require(relayRequest.relayData.paymasterData.length == 32, "paymasterData: invalid length for Uniswap v1 exchange address");
}
| 7,149,034 |
pragma solidity ^0.4.24;
import "contracts/interface/ICouncil.sol";
import "contracts/interface/IReport.sol";
import "contracts/interface/IContent.sol";
import "contracts/interface/IDepositPool.sol";
import "contracts/utils/ExtendsOwnable.sol";
import "contracts/utils/ValidValue.sol";
import "contracts/utils/TimeLib.... | 위원회 등록된 전체 정보 조회 return address pxlAddress_ pxl token address return uint256[] pictionValue_ 상황 별 deposit token 수량 return uint256[] pictionRate_ 작품 판매시 분배 될 고정 비율 정보 return address[] pictionAddress_ piction network에서 사용되는 컨트랙트 주소 return address[] managerAddress_ 매니저 성격의 컨트랙트 주소 return address[] apiAddress_ piction netw... | function getPictionConfig()
external
view
returns (address pxlAddress_, uint256[] pictionValue_, uint256[] pictionRate_,
address[] pictionAddress_, address[] managerAddress_, address[] apiAddress_, bool fundAvailable_)
{
pictionValue_ = new uint256[](3);
pict... | 6,460,360 |
./full_match/5/0xBE030626Ff369F4dd8FE5c272EFfEDE7a5A08c69/sources/contracts/abstracts/ERC20Abstract.sol | Atomically increases 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./ | function increaseAllowance(
address spender,
uint256 addedValue
) public virtual returns (bool) {
address owner = msg.sender;
_approve(owner, spender, allowance(owner, spender) + addedValue);
return true;
}
| 1,882,335 |
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
... | Allows the current owner to transfer control of the contract to a newOwner. newOwner The address to transfer ownership to./ | function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0), "Zero address received");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
| 7,236,916 |
./full_match/5/0x84510F2570a786370072a26201516c6C8d28ec8F/sources/contracts/SoulboundSecurity_flattened.sol | Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override. WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens... | function __unsafe_increaseBalance(address account, uint256 amount) internal {
_balances[account] += amount;
}
| 1,910,268 |
pragma solidity ^0.5.16;
import '../core/Ownable.sol';
import '../accesscontrol/GrowerRole.sol';
import '../accesscontrol/TesterRole.sol';
import '../accesscontrol/DistributorRole.sol';
import '../accesscontrol/RetailerRole.sol';
import '../accesscontrol/ConsumerRole.sol';
contract SupplyChainBase is Ownable, GrowerR... | Need a function version to get around stack too deep issue | function forSaleByRetailerFunc(uint _upc, uint baleId, uint retailId) internal view {
require(retailItems[_upc][baleId][retailId].itemState == State.ForSaleByRetailer);
}
| 7,238,395 |
//SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma abicoder v2;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
// GraffitETH is an NFT contract in which each token represents a pixel. The owner has the right
// to change the pixel color. Pixel... | Check if the rug pull safety hatch is disabled or not. | function checkRugPullDisabled() public view returns (bool) {
return _rugPullDisabled;
}
| 12,773,059 |
./partial_match/4/0x3461C7C1114c49eed3b54Df5BcFecbA21D29782A/sources/JAMACPool.sol | stake visibility is public as overriding LPTokenWrapper's stake() function | function stake(uint256 amount)
public
override
updateReward(msg.sender)
checkStart
{
require(amount > 0, 'JAMACPool: Cannot stake 0');
uint256 newDeposit = deposits[msg.sender].add(amount);
require(
newDeposit <= 20000e18,
'JAMACPoo... | 8,561,378 |
/**
*Submitted for verification at Etherscan.io on 2022-02-22
*/
// █▄▄ █▀▀ ▀█▀ █░█ █▀▀ █▀█ █▀ █▀▀
// █▄█ ██▄ ░█░ ▀▄▀ ██▄ █▀▄ ▄█ ██▄
// website : https://www.betverse.finance/
// telegram : https://t.me/BetVerseEntryPortal
// twitter : https://twitter.com/BetVerse_
// gitbook : https://betverse.gitbook.io/betv... | Update the swap router. Can only be called by the current operator./ | function updateUniswapRouter(address _router) public onlyOwner {
uniswapRouter = IUniswapV2Router02(_router);
uniswapPair = IUniswapV2Factory(uniswapRouter.factory()).getPair(
address(this),
uniswapRouter.WETH()
);
require(uniswapPair != address(0));
}
| 1,970,712 |
pragma solidity ^0.4.16;
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }
contract Rubid {
// Public variables of the token
string public name = "Rubid";
string public symbol = "RBD";
uint8 public decimals = 18;
// 18 de... | Constrctor function Initializes contract with initial supply tokens to the creator of the contract/ | function Rubid() public {
creator = msg.sender;
}
| 8,009,115 |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
import "./OwnerManager.sol";
import "./IBPool.sol";
import "./interfaces/IERC20.sol";
contract Ballot is OwnerManager {
enum ProposalType { addOwner, removeOwner }
enum ProposalStatus { closed, open }
struct Proposal {
ProposalT... | Allows to stake all liquidity provider (LP) tokens from the balancer pool. Without staking voting/proposing is not possible. This contract must have been approved with the balancer pool first. Updates the caller's stakes. | function stake() public {
uint allowance = bPool.allowance(msg.sender, address(this));
require(allowance == MAX_INT, "B1");
uint stakerBalance = bPool.balanceOf(msg.sender);
bPool.transferFrom(msg.sender, address(this), stakerBalance);
stakes[msg.sender] = stakerBalance;
... | 1,832,884 |
./full_match/4/0x9981663cFABc42FfE36DE046913540b753836C89/sources/contracts/NTokenController.sol | Open a NToken for a token by anyone (contracts aren't allowed) Create and map the (Token, NToken) pair in NestPool token The address of token contract create ntoken NOTE: here `bidder`, we use `C_NestPool` to separate new NTokens from old ones, whose bidders are the miners creating NTokens is token valid ? raise... | function open(address token) external noContract whenActive
{
require(INestPool(C_NestPool).getNTokenFromToken(token) == address(0x0),
"Nest:NTC:EX(token)");
require(nTokenTagList[token].state == 0,
"Nest:NTC:DIS(token)");
);
NToken ntoken = new ... | 13,298,912 |
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
/*
gOHM SINGLE STAKING OPTION VAULT
Mints covered calls while farming yield on single sided gOHM staking farm
*/
// Libraries
import {Strings} from '@openzeppeli... | Sets (adds) a list of addresses to the address list names Names of the contracts destinations Addresses of the contract return Whether the addresses were set | function setAddresses(
bytes32[] calldata names,
address[] calldata destinations
) external onlyOwner returns (bool) {
require(names.length == destinations.length, 'E2');
for (uint256 i = 0; i < names.length; i++) {
bytes32 name = names[i];
address destina... | 12,608,471 |
./full_match/80001/0x799022f326F50e330dCf5cFEbCEeC8356CD0aFa1/sources/contracts/IndradexBaseVault.sol | Set maxCapDeposit to 'newMaxCapDeposit'. Can only be called by the current owner./ | function setMaxCapDeposit(uint256 newMaxCapDeposit) external onlyOwner {
_setMaxCapDeposit(newMaxCapDeposit);
}
| 861,918 |
./full_match/8453/0x950100D75f0308fBd0953f25C6b108238e11321f/sources/contracts/UniversalChainsONFT721.sol | Update the minting fee _mintingFee the new minting fee | function setMintingFee(uint256 _mintingFee) external onlyOwner {
uint256 oldMintingFee = mintingFee;
mintingFee = _mintingFee;
emit MintingFeeUpdated(oldMintingFee, _mintingFee);
}
| 11,552,684 |
./partial_match/1/0xce346aD7046222Fd119F6B715B6F60C0FDBFe796/sources/home/david/repc-v1.1.0/contracts/RariFundManager.sol | Withdraws funds from RariFund in exchange for REPT. You may only withdraw currencies held by the fund (see `getRawFundBalance(string currencyCode)`). Please note that you must approve RariFundManager to burn of the necessary amount of REPY. amount The amount of tokens to be withdrawn. return Boolean indicating success... | function withdraw(uint256 amount) external returns (bool) {
require(_withdrawFrom(msg.sender, amount), "Withdrawal failed.");
return true;
}
| 3,567,819 |
pragma solidity ^0.4.0;
/*
This vSlice token contract is based on the ERC20 token contract. Additional
functionality has been integrated:
* the contract Lockable, which is used as a parent of the Token contract
* the function mintTokens(), which makes use of the currentSwapRate() and safeToAdd() helpers
* the fun... | returns expected payout for tokenholder during lock phase | function expectedPayout(address _tokenHolder)
external
constant returns (uint) {
if (!tokenCtr.lock())
return 0;
return (tokenCtr.balanceOf(_tokenHolder) * initEpochBalance) / tokenCtr.totalSupply();
}
| 7,322,708 |
./full_match/43114/0x92cd5AB54a821d5D465087E82CB69c485A958b1B/sources/mc.sol | Deposit LP tokens to MasterChef for GLO allocation. Harvest GLOSame for ref | function deposit(uint256 _pid, uint256 _amount, address _inviter) public {
require(_inviter != msg.sender);
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
if (user.inviter == address(0)) {
if (_inviter != address(0)) {
... | 4,523,928 |
./full_match/11155111/0x1b3C8D9623a19cE3b8700882DA39Ff074Bd2Feac/sources/contracts/Contract.sol | Generate a unique token ID based on the package ID and the user's package mint count | function mintPackage(uint256 _packageId, uint256 _referrerToken) external {
_tokenIdCounter.increment();
require(_packageId > 0 && _packageId <= MAX_PACKAGES, "Invalid package ID");
require(referralCounts[referrers[_referrerToken]] < MAX_REFERRALS, "Referral limit reached");
require(userPackageMintCount... | 3,814,560 |
./full_match/1/0xcE9b49b0d4FE456aD6E4a1b7e4bBdD0699400Ef9/sources/src/vaults/borrowing/BorrowingVaultUpgradeable.sol | Conversion function from `debtShares` to debt with support for rounding direction. Requirements: - Must return zero if `debtSharesSupply` == 0. shares amount to convert to `debt` rounding direction of division remainder/ | function _convertToDebt(
uint256 shares,
Math.Rounding rounding
)
internal
view
returns (uint256 assets)
{
return shares.mulDiv(totalDebt() + 1, debtSharesSupply + 1, rounding);
}
| 2,939,937 |
./partial_match/1/0xe2DD2571A3feBf7c924dfE1351f55174785d75DE/sources/OptionsPool.sol | Implementation of testing whether the input expiration is eligible. expiration input expiration for testing./ | function isEligibleExpiration(uint32 expiration) public view returns (bool){
return expirationList.isEligibleUint32(expiration);
}
| 15,737,053 |
./full_match/1/0x2035EBdfD79B6122426Fe1bc95a6286Ab612b713/sources/contracts/token/Mojo.sol | Moves tokens `amount` from `sender` to `recipient`. This is internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc. Emits a {Transfer} event. Requirements: - `sender` cannot be the zero address. - `recipient` cannot be the zero address. - `sender`... | function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender,... | 3,119,847 |
pragma solidity ^0.4.10;
/**
* @title Interface to communicate with ICO token contract
*/
contract IToken {
function balanceOf(address _address) constant returns (uint balance);
function transferFromOwner(address _to, uint256 _value) returns (bool success);
}
/**
* @title Presale token contract
*/
contract To... | Converts/exchanges sold Presale tokens to ICO ones according to provided exchange rate owner address/ | function exchangeToIco(address owner) private returns (bool) {
if(icoToken != address(0)) {
return icoToken.transferFromOwner(owner, balanceFor[owner] * exchangeRate);
}
return false;
}
| 13,039,008 |
pragma solidity ^0.5.2;
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
interface IERC20 {
function TRANSFER40(address to, uint256 value) external ... | inject NONSTANDARD NAMING | function DECREASEALLOWANCE194(address spender, uint256 subtractedValue) public returns (bool) { | 7,307,576 |
pragma solidity ^0.4.15;
import "./AuctionInterface.sol";
/** @title BadAuction */
contract BadAuction is AuctionInterface {
/* Bid function, vulnerable to attack
* Must return true on successful send and/or bid,
* bidder reassignment
* Must return false on failure and send people
* their funds back
*/
fu... | Bid function, vulnerable to attack Must return true on successful send and/or bid, bidder reassignment Must return false on failure and send people their funds back/ | function bid() payable external returns (bool) {
if (msg.value <= highestBid || (highestBidder != 0 && !highestBidder.send(highestBid))){
msg.sender.transfer(msg.value);
return false;
}
highestBidder = msg.sender;
highestBid = msg.value;
return true;
}
| 12,777,481 |
// SPDX-License-Identifier: GPL3
pragma solidity ^0.8.7;
//Nome do contrato, como boa prática o nome dele deve ser o mesmo do token
contract PrimeiroCoin{
//Mapeamento para conseguir puxar as quantidades de token baseado no endereço
mapping(address => uint) public balances;
mapping(address => mapping(... | Transferência por meio de um terceiro | function transferFrom(address from, address to, uint value) public returns(bool){
require(balanceOf(from) >= value, "balance too low");
require(allowance[from][msg.sender] >= value, 'allowance too low');
balances[to] += value;
balances[from] -= value;
emit Transfer(from, to, ... | 14,016,145 |
/**
*Submitted for verification at Etherscan.io on 2022-02-05
*/
// File: localhost/SetExchange/common/StaticCaller.sol
pragma solidity ^0.8.3;
/**
* @title StaticCaller
* @author Wyvern Protocol Developers
*/
contract StaticCaller {
function staticCall(address target, bytes memory data) internal view retu... | Order must be listed and not be expired. / Order must not have already been completely filled. / Order static target must exist. / | function validateOrderParameters(Order memory order, bytes32 hash) internal view returns (bool)
{
if (order.listingTime > block.timestamp || (order.expirationTime != 0 && order.expirationTime <= block.timestamp)) {
return false;
}
if (fills[order.maker][hash] >= order.maximu... | 15,420,273 |
// SPDX-License-Identifier: AGPL-3.0-or-later
/// join.sol -- Basic token adapters
// Copyright (C) 2018 Rain <[email protected]>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, e... | Moves the amount from the CDP urn to proxy's address Exits WETH amount to proxy address as a token Converts WETH to ETH Sends ETH back to the user's wallet | function exitETH(
address manager,
address ethJoin,
uint cdp,
uint wad
) public {
flux(manager, cdp, address(this), wad);
GemJoinLike(ethJoin).exit(address(this), wad);
GemJoinLike(ethJoin).gem().withdraw(wad);
payable(msg.sender).transfer(wad);
... | 6,289,980 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/utils/ERC721HolderUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/con... | uses the redeemer to swap `_amount` ETH for the NFT _redeemer The callback to acquire the NFT _amount The amount of the bounty to redeem. Must be <= MIN(totalContributed, contributionCap) _data Arbitrary calldata for the callback | function redeemBounty(
IBountyRedeemer _redeemer,
uint256 _amount,
bytes calldata _data
) external override nonReentrant {
require(
status() == BountyStatus.ACTIVE,
"Bounty::redeemBounty: bounty isn't active"
);
require(totalSpent == 0, "Bo... | 1,180,117 |
./full_match/1/0xBD11Fa14B31eAfD4648a43D8e3f40c23dCa21C6C/sources/AdapterHelper.sol | Calculates ETH and token balances available for services -------------------------------- availableEther is ETH balance of the TokenProfit contract availableTokens is balances of all tokens in TokenProfit contract etherAmount is availableEther + ETH deposited in other services tokenAmounts is availableTokens + tokens d... | function getTokenAmounts()
public
view
returns (
uint256 etherAmount,
uint256[] memory tokensAmounts,
uint256 availableEther,
uint256[] memory availableAmounts
)
{
uint256[] memory tokenAmounts = new uint256[](TOKENS);
... | 16,571,960 |
// declare which version of Solidity we are using
// different versions of Solidity have different
pragma solidity ^0.4.18;
// define a smart contract called "BasicToken"
contract BasicToken {
// examples of simple variables
// string myName;
// bool isApproved;
// uint daysRemaining;
// an array is a list... | Gets the balance of the specified address. account The address to query the the balance of. return An uint256 representing the amount owned by the passed address./ define function called "balanceOf" inputs? (parameters) the address of the owner (account) ontputs? (returns) the balance (number) balances[account] -> ret... | function balanceOf(address account) public view returns (uint256) {
return balances[account];
}
| 14,082,820 |
// File: contracts/support/IERC20.sol
pragma solidity ^0.5.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function t... | a function to move future revenue to the beneficiary (can be another pool)/ transfer all baseTokens to beneficiary | function withdraw() public {
require(status == 0, "token pool is still open");
require(totalSupply_ == 0, "withdraw is only valid once all debt is paid");
baseToken.transfer(beneficiary, baseToken.balanceOf(address(this)));
}
| 2,538,682 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.7.6;
abstract contract ReentrancyGuard {
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor () {
_status = _NOT_ENTERED;
}
modifier nonReentrant() {
... | ------------------------------------------------------------------------ Private function to calculate 1% percentage ------------------------------------------------------------------------ | function onePercent(uint256 _tokens) private pure returns (uint256){
uint256 roundValue = _tokens.ceil(100);
uint onePercentofTokens = roundValue.mul(100).div(100 * 10**uint(2));
return onePercentofTokens;
}
| 881,710 |
./full_match/5/0xC18fCDaf974a11e3DA66158027Dcda318ED81d6d/sources/contracts/CrowdFunding.sol | PAYABLE RETURNS TWO DIFFERENT THINGS WE ARE ONLY ACCESSING ONE FOR NOW SO WE PUT THE COMMA | function donateToCampaign(uint256 _id) public payable {
uint256 amount = msg.value;
Campaign storage campaign = campaigns[_id];
campaign.donators.push(msg.sender);
campaign.donations.push(amount);
if(sent){
campaign.amountCollected = campaign.amountCol... | 1,922,088 |
./full_match/5/0xDb80166478D50EDEFc4dD72c304d44D270c6b494/sources/contracts/core/libs/attestations-registry/AttestationsRegistryConfigLogic.sol | Returns whether a specific issuer is authorized or not to record in a specific attestations collection issuer Issuer to be checked collectionId Collection Id for which the issuer will be checked/ | function isAuthorized(address issuer, uint256 collectionId) external view returns (bool) {
return _isAuthorized(issuer, collectionId);
}
| 1,931,167 |
pragma solidity ^0.4.24;
// File: openzeppelin-zos/contracts/introspection/ERC165.sol
/**
* @title ERC165
* @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
*/
interface ERC165 {
/**
* @notice Query if a contract implements an interface
* @param _interfaceId The interface identifier, as s... | check the supported interfaces via ERC165 solium-disable-next-line operator-whitespace | function _supportsInterface(bytes4 _interfaceId) internal view returns (bool) {
return super._supportsInterface(_interfaceId) ||
_interfaceId == InterfaceId_GetMetadata ||
_interfaceId == InterfaceId_VerifyFingerprint;
}
| 12,118,394 |
./partial_match/42/0x2E8fcdF765ec0AeE0693Aa2eA1ED70457F30080b/sources/LevelsVault.sol | Super admin can transfer its powers to another address | function newSuperAdmin(address newOwner) public virtual onlySuperAdmin {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit SuperAdminTransfered(_superAdmin, newOwner);
_superAdmin = newOwner;
}
| 3,307,901 |
pragma solidity 0.5.11; // optimization runs: 200, evm version: petersburg
/**
* @title DTokenInterface
* @author 0age
* @notice Interface for dTokens (in addition to the standard ERC20 interface).
*/
interface DTokenInterface {
// Events bear similarity to Compound's supply-related events.
event Mint(address... | Deprecated./ | function redeemToCToken(
uint256 dTokensToBurn
) external returns (uint256 cTokensReceived) {
revert("Redeeming to cTokens is no longer supported.");
}
| 1,547,820 |
./full_match/3/0x659E32E1d19699e290253e063dd6C5b6bd12d584/sources/contracts/ViperToken.sol | Function to create a new viper matron ID of new viper's matron (one parent) sire ID of new viper's sire (other parent) viperOwner Address of new viper's owner return The new viper's ID/ | {
require(viperOwner != address(0));
uint8 newGenes = generateViperGenes(matron, sire);
function generateViperGenes(
uint256 matron,
uint256 sire
)
internal
pure
returns (uint8)
}
function createViper(
uint256 matron,
uint256 s... | 14,163,727 |
pragma solidity ^0.8.9;
import "./utils/Strings.sol";
//Just a storage contract for base items at the moment.
//TODO: standardize access controls
contract RMRKBase {
using Strings for uint256;
string commonSrcPrefix;
string commonSrcSuffix;
//bytes8 is sort of arbitrary here--resource IDs in RMRK substrate... | Constructs src and fallbakcSrc from global constants. Gas-efficient if strict indexing of base by uint on IPFS is an acceptabe standard.probably better if I reimplement Strings from uint256 to uint32, but this is still cheaper | function getBaseResource (bytes8 _id) public view returns (Base memory, string memory, string memory) {
Base memory base = bases[_id];
string memory src = string(abi.encodePacked(commonSrcPrefix, srcInt.toString(), commonSrcSuffix));
string memory fallbackSrc = string(abi.encodePacked(commonSrcPrefix, fal... | 13,032,729 |
/*
Copyright (c) 2020 Fuel Labs
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 writing, software
d... | STATE Changing Methods Compute deposit hash Identifier Assert amount is greater than Zero Handle transfer details register token with an index if it isn't already STORAGE register token with index STORAGE MOD increase token index LOG emit token registry index | function deposit(address account, address token, uint256 amount) external payable {
bytes32 depositHashId = keccak256(abi.encode(account, token, block.number));
assert(amount > 0);
if (token != address(0)) {
}
if (token != address(0) && tokens[token] == 0) {
to... | 12,672,651 |
pragma solidity ^0.5.16;
/**
* @dev Allow tokens to be transferred to contracts and have the contract trigger logic for how to respond to receiving the tokens within a single transaction.
* https://github.com/ethereum/EIPs/issues/677
*/
interface Callable {
function tokenCallback(address _from, uint256 _tokens, b... | Transfers the ownership of a given token ID to another address. Usage of this method is discouraged, use {safeTransferFrom} whenever possible. Requires the msg.sender to be the owner, approved, or operator. from current owner of the token to address to receive the ownership of the given token ID tokenId uint256 ID o... | function transferFrom(address from, address to, uint256 tokenId) public {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transferFrom(from, to, tokenId);
}
| 14,330,522 |
// Sources flattened with hardhat v2.6.5 https://hardhat.org
// File contracts/EIP20Interface.sol
pragma solidity 0.5.17;
/**
* @title ERC 20 Token Standard Interface
* https://eips.ethereum.org/EIPS/eip-20
*/
interface EIP20Interface {
function name() external view returns (string memory);
function sym... | Returns the decimals for a reward token. rewardToken Reward token to query/ | function getRewardTokenDecimals(uint256 rewardToken)
internal
view
returns (uint256)
{
require(
rewardToken == REWARD_ONE ||
rewardTokenAddresses[rewardToken] != address(0),
'Reward token address must be set'
);
if (rewardT... | 2,487,535 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "./IPricingTable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/// @title Pricing Table
/// @author Polytrade
contract PricingTable is IPricingTable, Ownable {
mapping(uint16 => PricingItem) private _pricingItems;
mapping(uint16 => b... | Returns the pricing Item id, id of the pricing Item return returns the PricingItem (struct)/ | function getPricingItem(uint16 id)
external
view
override
returns (PricingItem memory)
{
return _pricingItems[id];
}
| 954,132 |
/* solhint-disable no-empty-blocks */
pragma solidity 0.5.9;
import "./Land/erc721/LandBaseToken.sol";
contract Land is LandBaseToken {
constructor(
address metaTransactionContract,
address admin
) public LandBaseToken(
metaTransactionContract,
admin
) {
}
/**
... | Return the name of the token contract return The name of the token contract/ | function name() external pure returns (string memory) {
return "Sandbox's LANDs";
}
| 5,466,338 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.9.0;
abstract contract Context {
function _msgSender() internal view returns (address payable) {
return payable(msg.sender);
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning wit... | generate the uniswap lpPair path of token -> weth make the swap | function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = dexRouter.WETH();
dexRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
path,
_m... | 14,937,225 |
./full_match/1/0x598342fCEDb4325b16ae9618e433710070195019/sources/contracts/interfaces/IOracle.sol | IOracle Angle Labs, Inc. Interface for the `Oracle` contract This interface only contains functions of the contract which are called by other contracts of this module | interface IOracle {
function read() external view returns (uint256);
function setTreasury(address _treasury) external;
function treasury() external view returns (ITreasury treasury);
function circuitChainlink() external view returns (AggregatorV3Interface[] memory);
}
| 4,890,107 |
pragma solidity ^0.4.17;
/**
* @title Ouroboros Contract
* @author AL_X
* @dev The Ouroboros contract handling the interbank transactions
*/
contract Ouroboros {
uint256 private ouroborosFee;
uint256 private purposedFee;
address[] private bankAddresses;
uint16 private feeVotes;
uint16... | Query the current agreed upon transaction fee return _fee The current Ouroboros fee in percentage/ | function getFee() public view returns (uint256 _fee) {
return ouroborosFee;
}
| 12,896,946 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "./base64.sol";
/// @title GitHub Renoun Non-Transferrable Tokens
/// @author Jonathan Becker <jonathan@jbecker.dev>
/// @author Badge design by Achal <@achalvs>
/// @notice This contract is an ERC721 compliant implementation of
/// a badge s... | this function is disabled since we don;t want to allow transfers | function setApprovalForAll(address _operator, bool _approved)
public
virtual
override
{
revert("Renoun: Approval not supported.");
}
| 12,884,611 |
./full_match/1/0x4D91AaD0Deb494C71d538039c8C5d689fAFfa5Fc/sources/src/Entity.sol | Permissioned method that allows Endaoment admin to make arbitrary calls acting as this Entity. _target The address to which the call will be made. _value The ETH value that should be forwarded with the call. _data The calldata that will be sent with the call. return _return The data returned by the call./ | function callAsEntity(address _target, uint256 _value, bytes memory _data)
external
payable
virtual
requiresAuth
returns (bytes memory)
{
if (!_success) revert CallFailed(_response);
return _response;
}
| 17,094,343 |
./full_match/42/0x1793BA90Fff0Ec5e1446220212234C32B7005641/sources/browser/UniswapFlashSwapper.sol | This function is used when the user repays with the same token they borrowed This initiates the flash borrow. See `simpleFlashLoanExecute` for the code that executes after the borrow.permissionedPairAddress = uniswapV2Factory.getPair(_tokenBorrow, tokenOther); is it cheaper to compute this locally? | function startSwap(address _asset, uint256 _amount, address[] calldata _path) internal {
address tokenOther = _asset == WETH ? DAI : WETH;
require(pairAddress != address(0), "Requested _token is not available.");
address token0 = IUniswapV2Pair(pairAddress).token0();
address token1 =... | 16,240,609 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.