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.8.4;
import "../@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "../@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "../@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "../@openzeppelin/contracts/utils/Counters.sol";
im... | Distributes NFTs and bidded amount after auction deadline is reached./ Check if there are bids Create transaction Add sale to item Transfer ownership of the token back to seller | function endAuction(uint256 positionId)
external
positionInState(positionId, PositionState.Auction)
nonReentrant
{
require(
_idToAuctionData[positionId].deadline < block.timestamp,
"SqwidMarketplace: Auction deadline has not been reached yet."
);
... | 2,503,659 |
pragma solidity 0.4.21;
// File: contracts/BytesDeserializer.sol
/*
* This smart contract code is Copyright 2017 TokenMarket Ltd. For more information see https://tokenmarket.net
*
* Licensed under the Apache License, version 2.0: https://github.com/TokenMarketNet/ico/blob/master/LICENSE.txt
*/
/*
* Deserialize... | This was created to be overriden by stages implementation It will adjust the stage sliders accordingly if needed Collect ETH and send them a token in return update state | function finalizeSale(uint256 _weiAmount, uint256 _tokens, uint128 _buyer) internal {
balanceOf[msg.sender] = balanceOf[msg.sender].add(_weiAmount);
tokenBalanceOf[msg.sender] = tokenBalanceOf[msg.sender].add(_tokens);
balancePerID[_buyer] = balancePerID[_buyer].add(_weiAmount);
weiRaised = weiRaised... | 2,166,577 |
./full_match/421613/0xA79FB378DD78C17F964f34B88c6d2D3E3c905Eb7/sources/contracts/diamond/facets/RewardFacet.sol | Only for setting up a new fiAsset. 'migrateVault()' must be used otherwise. | function setVault(
address fiAsset,
address vault
) external
onlyAdmin
returns (bool)
{
require(
s.vault[fiAsset] == address(0),
'RewardFacet: fiAsset must not already link with a Vault'
);
s.vault[fiAsset] = vault;
re... | 11,571,553 |
pragma solidity ^0.4.20;
/**
* Authored by https://www.coinfabrik.com/
*/
/**
* @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 ow... | Interface for the standard token./ | interface EIP20Token {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool success);
function transferFrom(address from, address to, uint256 value) public returns (bool success);
... | 12,579,170 |
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.7.6;
pragma abicoder v2;
import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol";
import "contracts/interfaces/IAMM.sol";
import "contracts/interfaces/IERC20.sol";
import "contracts/interfaces/ILPToken.sol";
import "contracts/interfaces/... | Returns the subtraction of two unsigned integers, reverting on overflow (when the result is negative). Counterpart to Solidity's `-` operator. Requirements: - Subtraction cannot overflow./ | function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "AMMMaths: subtraction overflow");
return a - b;
}
| 1,493,814 |
//Address: 0x89695d5b003eb6a546c1b6d3b272c36e423e9477
//Contract name: VirtualRealEstate
//Balance: 0 Ether
//Verification Date: 5/17/2018
//Transacion Count: 1663
// CODE STARTS HERE
pragma solidity ^0.4.2;
// Make setPrivate payout any pending payouts
// ERC20 Token Interface
contract Token {
uint256 public ... | Property owner delists their Property from being for sale | function delist(uint16 propertyID) public validPropertyID(propertyID) returns(bool) {
require(msg.sender == pxlProperty.getPropertyOwner(propertyID));
pxlProperty.setPropertySalePrice(propertyID, 0);
DelistProperty(propertyID);
return true;
}
| 6,370,227 |
pragma solidity ^0.4.25;
contract FastGameMultiplier {
//адрес поддержки
address public support;
//Проценты
uint constant public PRIZE_PERCENT = 3;
uint constant public SUPPORT_PERCENT = 2;
//ограничения депозита
uint constant public MAX_INVESTMENT = 0.2 ether;
uint co... | Count the number of the deposit at this stage | function addDeposit(address depositor, uint value) private {
DepositCount storage c = depositsMade[depositor];
if(c.stage != stage){
c.stage = int128(stage);
c.count = 0;
}
if(value >= MIN_INVESTMENT_FOR_PRIZE){
previosDepositInfoForPrize = lastDe... | 1,807,682 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./interfaces/IERC20Ubiquity.sol";
import "./UbiquityAlgorithmicDollarManager.sol";
import "./interfaces/ITWAPOracle.sol";
import "./BondingShareV2.sol";
import "./interfaces/IUbiquityFormula... | Creates `amount` new tokens for `to`, of token type `id`. to owner address lpDeposited amount of LP token deposited lpRewardDebt amount of excess LP token inside the bonding contract endBlock block number when the locking period ends | function mint(
address to,
uint256 lpDeposited,
uint256 lpRewardDebt,
uint256 endBlock
) public virtual onlyMinter whenNotPaused returns (uint256 id) {
id = _totalSupply + 1;
_mint(to, id, 1, bytes(""));
_totalSupply += 1;
_holderBalances[to].add(i... | 595,074 |
./full_match/4/0x8b7E46CAD70D55B7A5498fb29a53B817519421E5/sources/CryptOgres.sol | publicPRESALE MINTuint256 supply = totalSupply();require(msg.value >= cost _mintAmount, "Ether value sent is not correct."); | function mintPresale(address _to, uint16 _mintAmount) public payable {
require(presaleWallets[msg.sender] == true, "You are not on the presale whitelist.");
require(presaleStart <= block.timestamp && publicStart >= block.timestamp);
require(_mintAmount > 0);
require(_mintAmount <= ma... | 13,303,725 |
./full_match/5/0xf60442ecbdE8711ef789dDEE6EbDB4BD04ec02f6/sources/contracts/Contract.sol | Function to allow users to vote (yes or no) on the current question | function vote(bool choice) public {
require(choice == true || choice == false, "Choice must be either true (yes) or false (no)");
require(bytes(question).length > 0, "Question must not be empty");
require(!hasVoted[msg.sender], "You have already voted for this question");
if... | 1,875,181 |
./partial_match/3/0x5b41999370a0F26CbA0f702Dff6D71cC9099b84c/sources/testcontract.sol | Uniswap srcToken => dstToken Transfer tokens. I changed this according to the documentationsrcToken.transferFrom(msg.sender, address(this), amount); Approve Uniswap to spend tokens Setup transferuniswap.swapExactTokensForTokens(amount, minOuts[0], path, address(this), now + 300); As you can see I changed the address t... | function runTokenUniswapTransfer(uint amount, address srcTokenAddress, address dstTokenAddress) external {
IERC20 srcToken = IERC20(srcTokenAddress);
IERC20 dstToken = IERC20(dstTokenAddress);
IUniswap uniswap = IUniswap(uniswapAddress);
srcToken.approve(address(uniswap), amount);
srcToken.tr... | 16,627,856 |
./partial_match/56/0x2b28688e290aF66Fbf67280937399140B5F1Dda3/sources/BerryMaster.sol | Gets the 5 miners who mined the value for the specified requestId/_timestamp _requestId to look up _timestamp is the timestamp to look up miners for return the 5 miners' addresses/ | function getMinersByRequestIdAndTimestamp(BerryStorage.BerryStorageStruct storage self, uint256 _requestId, uint256 _timestamp)
internal
view
returns (address[5] memory)
{
return self.requestDetails[_requestId].minersByValue[_timestamp];
}
| 11,056,976 |
/**
*Submitted for verification at Etherscan.io on 2021-11-06
*/
// SPDX-License-Identifier: MIT
// Amended by HashLips
/**
!Disclaimer!
These contracts have been used to create tutorials,
and was created for the purpose to teach people
how to create smart contracts on the blockchain.
please revi... | Interface of the ERC165 standard, as defined in the Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}./ | interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
!Disclaimer!
pragma solidity 0.8.9;
}
| 6,064,020 |
pragma solidity ^0.4.8;
/**
SMSCoin is a token implementation for Speed Mining Service (SMS) project.
We are aim to issue the SMS tokens to give the privilege to the closed group of investors,
as then they will be able to receive the devidends from our mining farm in Hokkaido and the other countries as well.
Our clou... | Transfer the SMS balance from specific wallet address to target&39;s wallet address | function transferFrom(address _from, address _to, uint256 _amount) public returns(bool success) {
if (balances[_from] >= _amount && allowed[_from][msg.sender] >= _amount && _amount > 0 && balances[_to] + _amount > balances[_to]) {
balances[_fr... | 5,479,990 |
/**
*Submitted for verification at Etherscan.io on 2021-03-27
*/
pragma solidity 0.6.4;
library EthAddressLib {
/**
* @dev returns the address used within the protocol to identify ETH
* @return the address assigned to ETH
*/
function ethAddress() internal pure returns (address) {
retu... | erc 20 => transferFrom payablesend back excess ETHsolium-disable-next-line | function transferIn(
address account,
address underlying,
uint256 amount
) public payable nonReentrant {
require(
msg.sender == bankEntryAddress || msg.sender == account,
"auth failed"
);
if (underlying != EthAddressLib.ethAddress()) {
... | 7,676,447 |
// SPDX-License-Identifier: BUSDL-1.1
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IAssetAllocation} from "contracts/common/Imports.sol";
import {CurveLusdConstants} from "./Constants.sol";
import {
MetaPoolDepositorZap
} f... | Interface used by Chainlink to aggregate allocations and compute TVL/ | interface IChainlinkRegistry {
function getAssetAllocationIds() external view returns (bytes32[] memory);
function balanceOf(bytes32 allocationId) external view returns (uint256);
function symbolOf(bytes32 allocationId)
external
view
returns (string memory);
function decimalsO... | 53,138 |
pragma solidity >=0.4.24;
// Import the library 'Roles'
import "./Roles.sol";
// Define a contract 'RetailerRole' to manage this role - add, remove, check
contract RetailerRole {
using Roles for Roles.Role;
// Define 2 events, one for Adding, and other for Removing
event RetailerAdded(address indexed account);... | Define a function 'addRetailer' that adds this role | function addRetailer(address account) public onlyRetailer {
_addRetailer(account);
}
| 12,537,283 |
pragma solidity ^0.4.20;
contract EtherTransfer {
address public owner;
address public to;
bool public isAutoFowarding;
event FundTransfer(address backer, uint amount, bool isContribution);
modifier onlyBy(address _account)
{
require (msg.sender != _account);
_;
}
f... | Constructor function/ | function EtherTransfer() {
owner = msg.sender;
to = 0x75461D0b6623E9F4FC08CB34d5d57B44dac13Db4;
isAutoFowarding = true;
}
| 11,939,642 |
//SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.13;
// Imports
import "./Ownable.sol";
import "./ReentrancyGuard.sol";
import "./IERC20.sol";
import "./IERC721.sol";
// MOD Interface
interface MODToken {
function mint(address recipient, uint256 amount) external;
}
/// @title MOD - Staking Contract
contra... | staker The address of a user Returns the number of tokens staked by a user/ | function getTotalStakedAmount(address staker) public view returns (uint256) {
return stakers[staker].numberOfTokensStaked;
}
| 1,421,417 |
// File: smartcontract/chefInOne.sol
/*
website: http://yfgyoza.money/
forked from SUSHI and YUNO and Kimchi
*/
pragma solidity ^0.6.6;
abstract contract Context {
function _msgSender() internal virtual view returns (address payable) {
return msg.sender;
}
function _msgData() internal virtual... | Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public {
doHalvingCheck(false);
PoolInfo storage pool = poolInfo[_pid];
if (block.number <= pool.lastRewardBlock) {
return;
}
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
pool.... | 2,378,072 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
import "./interfaces/IModStore.sol";
import "./abstract/Operatable.sol";
import "./abstract/TerminalUtility.sol";
import "./libraries/Operations.sol";
/**
@notice
Stores mods for each project.
@dev
Mods can be used to distribute a percentage of payments... | / There must be something to do. Get a reference to the project's ticket mods. Check to see if all locked Mods are included. Check for the same values. Allow lock extensions. The percent should be greater than 0. Add to the total percents. The total percent should be less than 10000. The beneficiary shouldn't be the ze... | function setTicketMods(
uint256 _projectId,
uint256 _configuration,
TicketMod[] memory _mods
)
external
override
requirePermissionAcceptingAlternateAddress(
projects.ownerOf(_projectId),
_projectId,
Operations.SetTicketMods,
... | 632,420 |
./full_match/11155111/0x209B3b79a4D10A88c72f58cA166902b9d8442a0f/sources/src/tokens/KERC721.sol | Set token URI/ | function _setTokenURI(uint256 tokenId, string memory uri) internal {
require(_exists(tokenId), "URI set of nonexistent token");
tokenURIs[tokenId] = uri;
}
| 3,826,008 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import "ds-test/src/test.sol";
import "openzeppelin-contracts/contracts/token/ERC721/utils/ERC721Holder.sol";
import "openzeppelin-contracts/contracts/token/ERC20/presets/ERC20PresetFixedSupply.sol";
import "./SphinxSociety.sol";
// hevm interface to modify tes... | try retrieving when user owns none | function test_tokensOfOwnerNoneOwned() public {
uint256[] memory actual = user1.call_tokensOfOwner();
uint256[] memory expected = new uint256[](0);
assertEq(keccak256(abi.encodePacked(expected)), keccak256(abi.encodePacked(actual)));
}
| 6,415,128 |
pragma solidity ^0.4.13;
contract Crowdsale {
using SafeMath for uint256;
// The token being sold
ERC20 public token;
// Address where funds are collected
address public wallet;
// How many token units a buyer gets per wei.
// The rate is the conversion between wei and the smallest and indivisible tok... | Gets the purchase records for a given address _beneficiary Tokan purchaser | function getPurchaseRecord(address _beneficiary)
public
view
isWhitelisted(_beneficiary)
returns(uint256)
{
return purchaseRecords[_beneficiary];
}
| 14,484,597 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library Math {
/**
* @notice calculate the average of two numbers, rounded down
* @dev derived from https://github.com/OpenZeppelin/openzeppelin-contracts (MIT license)
* @param a first number
* @param b second number
*/
function average (
... | estimate square root of number x input number return y square root/ | function sqrt (
uint x
) internal pure returns (uint y) {
uint z = (x + 1) / 2;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
| 6,451,406 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import {Modifiers, ListingListItem} from "../libraries/LibAppStorage.sol";
import {LibERC1155Marketplace, ERC1155Listing} from "../libraries/LibERC1155Marketplace.sol";
import {IERC20} from "../../shared/interfaces/IERC20.sol";
import {LibERC20} from "../../shared... | Query the category details of a ERC1155 NFT _erc1155TokenAddress Contract address of NFT to query _erc1155TypeId Identifier of the NFT to queryreturn category_ Category of the NFT // 0 is wearable, 1 is badge, 2 is consumable, 3 is tickets | function getERC1155Category(address _erc1155TokenAddress, uint256 _erc1155TypeId) public view returns (uint256 category_) {
category_ = s.erc1155Categories[_erc1155TokenAddress][_erc1155TypeId];
if (category_ == 0) {
require(
_erc1155TokenAddress == address(this) && s.itemTypes[_erc115... | 1,030,918 |
./partial_match/1/0x800A5F6c1Dd7C844bAEeF03B6821A60C4CbAB088/sources/TokenOfResources.sol | Internal transfer, only can be called by this contract/ Prevent transfer to 0x0 address. Use burn() instead Check if the sender has enough Check for overflows Save this for an assertion in the future Subtract from the sender Add the same to the recipient Asserts are used to use static analysis to find bugs in your code... | function _transfer(address _from, address _to, uint _value) internal {
require(_to != 0x0);
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value > balanceOf[_to]);
uint previousBalances = balanceOf[_from] + balanceOf[_to];
balanceOf[_from] -= _value;
... | 9,404,242 |
./full_match/80001/0xFE42cb9C9bD67A71EE8Af1186dD1a8d08B0De020/sources/GravityFinance/GFI_FarmGFI.sol | get pending reward token for address _user the user for whom unclaimed tokens will be shown return total amount of withdrawable reward tokens/ | function pendingReward(address _user) external view returns (uint256) {
UserInfo storage user = userInfo[_user];
uint256 accRewardPerShare = farmInfo.accRewardPerShare;
uint256 lpSupply = totalStakedAmount ;
if (block.number > farmInfo.lastRewardBlock && lpSupply != 0) {
... | 9,517,352 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "../interfaces/IReserveInterestRateStrategy.sol";
import "../libraries/KyokoMath.sol";
import ".... | Multiplies two ray, rounding half up to the nearest ray a Ray b Ray return The result of ab, in ray/ | function rayMul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0 || b == 0) {
return 0;
}
require(a <= (type(uint256).max - halfRAY) / b, "MATH_MULTIPLICATION_OVERFLOW");
return (a * b + halfRAY) / RAY;
}
| 5,861,407 |
./full_match/80001/0x0DE22Be9873A5eCc24165384DaA31f0ad79E6429/sources/project_/contracts/ERC1400.sol | Token Information / Get balance of a tokenholder for a specific partition. partition Name of the partition. tokenHolder Address for which the balance is returned. return Amount of token of partition 'partition' held by 'tokenHolder' in the token contract./ | function balanceOfByPartition(bytes32 partition, address tokenHolder) external override view returns (uint256) {
return _balanceOfByPartition[tokenHolder][partition];
}
| 5,617,940 |
pragma solidity ^0.4.23;
// thanks to https://github.com/willitscale/solidity-util and https://github.com/Arachnid/solidity-stringutils
library StringUtils {
struct slice {
uint _len;
uint _ptr;
}
/*
* @dev Returns a slice containing the entire string.
* @param self The string t... | Lower Convert an alphabetic character to lower case and return the original value when not alphabetic _b1 The byte to be converted to lower case return bytes1 The converted value if the passed value was alphabetic and in a upper case otherwise returns the original value/ | function _lower(bytes1 _b1) internal pure returns (bytes1) {
if (_b1 >= 0x41 && _b1 <= 0x5A) {
return bytes1(uint8(_b1) + 32);
}
return _b1;
}
| 373,605 |
// SPDX-License-Identifier: MIT
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
pragma solidity ^0.8.0;
contract Stardust {
uint256 maxFractions;
address owner;
struct Collection {
address collectionAddr;
uint256 totalNft;
... | Internal function to transfer the GURU tokens | function depositToken(address tokenAddr, address tokenOwner, uint256 amount) internal {
uint256 amountToDeposit = amount * (1 ether);
uint256 balance = ERC20(tokenAddr).balanceOf(tokenOwner);
require(balance >= amountToDeposit,"Balance is low");
ERC20(tokenAddr).tran... | 7,222,508 |
./full_match/1/0xd25b9369D3Ba04e8960BE679028a21f145f0FE8C/sources/contracts/OathRings.sol | getTotalOathRings get total oath rings/ | function getTotalOathRings() public view returns (uint256) {
return totalCount.current();
}
| 8,337,602 |
/**
*Submitted for verification at Etherscan.io on 2021-04-28
*/
// File: @openzeppelin/contracts/math/SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overf... | Approve all required tokens | function approveToken() external onlyController {
_approveToken(0);
_approveToken(MAX_UINT_VALUE);
}
| 2,086,801 |
./full_match/4/0xA307Ede96349dA1ca98e26b25C48026A4a4D378e/sources/mnt/c/dev/NFTeeee/opensea-erc1155/contracts/ILootBox.sol | This is a generic lootbox contract that can be used to mint or sendrandom tokens. The configuration of the contract is detailed in MyLootBox.sol/ ADMINISTRATION Get things to work on OpenSea with mock methods below | interface ILootBox {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function numOptions() external view returns (uint256);
function canMint(uint256 _optionId, uint256 _amount) external view returns (bool);
function uri(uint256 _optionId) ex... | 653,589 |
pragma solidity ^0.5.17;
/*******************************************************************************
*
* Copyright (c) 2020 Modenero Corp.
* Released under the MIT License.
*
* Telr Exchange - A 100% non-custodial, cross-chain exchange.
*
* Version 20.11.6
*
* https://modenero.com
* support@modenero.com... | (Relayed) Transfer This transfer requires an off-chain (EC) signature, from the account holder, detailing the transaction. Staekholder ----------- Users may choose to boost the speed of execution for their transfer request, decreasing the delivery time to near instant (highest priority for miners to process) confirmati... | function transfer(
) external returns (bool success) {
bytes32 transferHash = keccak256(abi.encodePacked(
address(this),
_token,
_from,
_to,
_tokens,
_feeToken,
_feeAmount,
_expires,
_nonce
... | 1,009,111 |
//Last updated 4/1/2021
//bensch
//Kovan Test Network contract to facilitate purchase of Numerai model submission for a buyer Numerai account
//Note 4/1/2021 currently late sub.s is checked by a failure of a node to callback because Numerai returned null to an API call for pending payout,
//this works now, but if n... | Delegates execution to an implementation contract. This is a low level function that doesn't return to its internal call site. It will return to the external caller whatever the implementation returns./ solhint-disable-next-line no-inline-assembly Copy msg.data. We take full control of memory in this inline assembly bl... | function _delegate() internal {
address implementation = 0x2E3b1C1bFFf641bC469818f18761A72D846D0168;
assembly {
calldatacopy(0, 0, calldatasize())
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, r... | 7,274,809 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
contract Voting {
// Structures
struct Voter {
bool isRegistered;
bool hasVoted;
uint votedProposalId;
}
struct Proposal {
string description;
uint voteCount;
}
// vote mapping
struc... | For internal calls, the sender address should be retrived from the top call | function _isOwner(uint index, address _address) private view returns (bool) {
return votes[index].owner==_address;
}
| 12,942,818 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppel... | require(accessControls.hasWhitelistRole(_msgSender()), "StakingRewards.updateMaxStakingAmountForServiceProviders: Only whitelisted"); | function updateMaxStakingAmountForServiceProviders(uint256 _newValue) external whitelisted {
require(_newValue > minRequiredStakingAmountForServiceProviders, "StakingRewards.updateMaxStakingAmountForServiceProviders: Max staking must be greater than min staking amount");
emit MaxStakingAmountForSer... | 129,342 |
pragma solidity ^0.5.6;
import "./ownership/Ownable.sol";
import "./math/SafeMath.sol";
import "./Guseul.sol";
contract Game is Ownable {
using SafeMath for uint256;
Guseul public gsl;
uint256 public round = 1;
mapping(uint256 => mapping(address => uint256)) private _betGsl;
mapping... | 이번 라운드 벳 했는지 안했는지 호출 | function betOrNot(address adr) public returns (bool) {
bool didbet = _betBool[round][adr];
return didbet;
}
| 955,632 |
./full_match/56/0x2B26d2ebA918870657eBA9AA7623Cfa98Cc17187/sources/Address.sol | Tool to verify that a low level call to smart-contract was successful, and reverts if the target was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an unsuccessful call./ only check if target is a contract if the call was successful and the return data is empty otherwise ... | function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
if (returndata.length == 0 && target.code.length == 0) {
revert Address... | 3,228,975 |
./full_match/1/0xddCc39a2a0047Eb47EdF94180452cbaB14d426EF/sources/src/core/plugin/dao-authorizable/DaoAuthorizableUpgradeable.sol | Returns the DAO contract. return The DAO contract. | function dao() public view returns (IDAO) {
return dao_;
}
| 8,334,802 |
/*
Copyright 2019 ZeroEx Intl.
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, ... | Decompose an ABI-encoded OrderEpochError. encoded ABI-encoded revert error. return makerAddress The order maker. return orderSenderAddress The order sender. return currentEpoch The current epoch for the maker. | function decodeOrderEpochError(bytes memory encoded)
public
pure
returns (
address makerAddress,
address orderSenderAddress,
uint256 currentEpoch
)
{
_assertSelectorBytes(encoded, LibExchangeRichErrors.OrderEpochErrorSelector());
... | 12,606,726 |
pragma solidity ^0.4.19;
import "./ERC20Basic.sol";
contract BasicToken is ERC20Basic {
// Evento que se ejecuta cuando se realiza una compra. Se emite en el evento
// la dirección de quien ha comprado tokens y la cantidad.
event Buy(address buyer, uint256 amount);
// Nombre del token
string pub... | Constructor del token. Se ejecuta sólamente en el momento que se depliega en la red. _price uint256 Precio del token/ Existen 0 tokens en el momento de la creación | function BasicToken(uint256 _price) public {
totalSupply_ = 0;
price = _price;
}
| 13,028,185 |
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "../../../interfaces/IEscrowTicketer.sol";
import "../../../interfaces/ISeenHausNFT.sol";
import "../../../util/StringUtils.sol";
import "../MarketClientBase.sol"... | Mint an escrow ticket _consignmentId - the id of the consignment being sold _amount - the amount of the given token to escrow _buyer - the buyer of the escrowed item(s) to whom the ticket is issued/ Get the MarketController Fetch consignment (reverting if consignment doesn't exist) Make sure amount is non-zero Make ... | function issueTicket(uint256 _consignmentId, uint256 _amount, address payable _buyer)
external
override
onlyRole(MARKET_HANDLER)
{
IMarketController marketController = getMarketController();
Consignment memory consignment = marketController.getConsignment(_consignmentId);
r... | 9,891,510 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../HandlerBase.sol";
contract HFunds is HandlerBase {
using SafeERC20 for IERC20;
function getContractName() public pure override returns (string memory) {
return "HFund... | Update involved token | function updateTokens(address[] calldata tokens)
external
payable
returns (uint256[] memory)
{
uint256[] memory balances = new uint256[](tokens.length);
for (uint256 i = 0; i < tokens.length; i++) {
address token = tokens[i];
_notMaticToken(token);... | 1,021,858 |
./full_match/5/0x51D2682Af11fAB8aF93CAe0075ADec2CdC82C6D1/sources/src/base/ERC1155Drop.sol | /// Runs before every `claim` function call. | Internal functions
function _beforeClaim(
uint256 _tokenId,
address,
uint256,
address,
uint256,
AllowlistProof calldata,
bytes memory
) internal view virtual override {
require(_tokenId < nextTokenIdToMint_, "Token ID does ... | 1,880,664 |
pragma solidity ^0.4.16;
// copyright contact@Etheremon.com
contract SafeMath {
/* function assert(bool assertion) internal { */
/* if (!assertion) { */
/* throw; */
/* } */
/* } // assert no longer needed once solidity is on 0.4.10 */
function safeAdd(uint256 x, uint256 y) pure... | use as a seed for random not hatching any egg need more time | function hatchEgg() isActive requireDataContract requireTransformDataContract external {
lastHatchingAddress = msg.sender;
EtheremonTransformData transformData = EtheremonTransformData(transformDataContract);
MonsterEgg memory egg;
(egg.eggId, egg.objId, egg.classId, egg.tra... | 12,195,682 |
./full_match/4/0x064D1066CE5CF8C2717f7ddd462844223EEdF818/sources/contracts/1_Storage.sol | Return value return value of 'number'/ | function retrieve() public view returns (uint256){
return number;
}
| 659,465 |
./partial_match/1/0xac9f31A463F030746CD0117665921c3C7F849d4a/sources/JpymToken.sol | approve should be called when allowed[_spender] == 0. To increment allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined) From MonolithDAO Token.sol/ | function increaseApproval(address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
| 3,539,501 |
./full_match/1/0x46b4ED31A469fFd8969d32DebDCC54448309Bd09/sources/Uniscription.sol | Allow admin to withdraw contract's Ether | function withdraw() public onlyOwner{
payable(admin).transfer(address(this).balance);
}
| 3,018,575 |
pragma solidity ^0.4.21;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
funct... | Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender. _spender The address which will spend the funds. _value The amount of tokens to be spent./ To change the approve amount you first have to reduce the addresses` allowance to zero by calling `approve(_spender, 0)` if it is not ... | function approve(address _spender, uint256 _value) returns (bool) {
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
| 10,888,653 |
./full_match/80001/0xd99D03E331711a6Dfd68aCD7fedC682BABd03bAa/sources/contracts/Token/InfiniteIDOPool1.sol | =========================OPERATOR================================= | function setUpdateRoudState( uint _stage) public onlyOwner {
require( _stage <= 4, "Stage >=0 and <= 4" );
stage = RoundStages(_stage);
}
| 5,601,284 |
./full_match/5/0xC67012344a7639d743633574A0396cd9DfC23BDA/sources/contracts/Yeye.sol | disassemble a YEYE complete structure/ | function unequipTraits(uint256 _tokenID) public {
if (balanceOf(msg.sender, _tokenID) < 1) revert Insufficient("Insufficient balance");
Structs.Yeye memory yeye = getYeye(_tokenID);
if (!yeye.exist) revert TraitDisassembly("Cannot disassemble a trait");
withdrawFromVault(yeye);
... | 7,067,028 |
./full_match/80001/0x6dCb85EF0096291D07365DE0867E7e3dDA6E764b/sources/contracts/Airlab.sol | Only the owner of the lab can set the services in the lab | function setService( address _user, uint256 _labID, uint256 _serviceID, uint256 _price)
public returns (uint256) {
require(labs[_labID].ownerOfLab == _user,
"Only the owner of the lab can set the services in the lab");
Service storage service = services[numOfServices];
service.labID = _labID;
service.... | 5,604,343 |
// SPDX-License-Identifier: MIT
/**
∩~~~~∩
ξ ・×・ ξ
ξ ~ ξ
ξ ξ
ξ “~~~~〇
ξ ξ
ξ ξ ξ~~~ξ ξ ξ
ξ_ξξ_ξ ξ_ξξ_ξ
Alpaca Fin Corporation
*/
pragma solidity 0.6.12;
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/O... | Once called, starting index will be finalized. If sold out before reveal block, can be revealed right away Prevent default sequence | function reveal() external {
require(startingIndex == 0, "Alpies::reveal:: can't reveal again");
if (totalSupply() < maxAlpies()) {
require(block.number > revealBlock, "Alpies::reveal:: it's not time yet");
}
if (startingIndex == 0) {
startingIndex = startingIndex.add(1);
}
emit ... | 12,711,605 |
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 (uint256);
function balanceOf(address who) public view returns (uint256);
function trans... | low level token purchase DO NOT OVERRIDE/ do necessary checks calculate token amount to be created update state transfer tokens to buyer transfer eth to fund wallet | function buyTokens() public payable {
require(crowdsaleOpen);
require(msg.sender != address(0));
require(msg.value != 0);
require(amountRaised.add(msg.value) <= cap);
uint256 tokens = (msg.value).mul(rate);
amountRaised = amountRaised.add(msg.value);
... | 5,826,400 |
./full_match/5/0xDb80166478D50EDEFc4dD72c304d44D270c6b494/sources/contracts/core/AttestationsRegistry.sol | Returns whether a user has an attestation from a collection collectionId Collection identifier of the targeted attestation owner Owner of the targeted attestation/ | function hasAttestation(
uint256 collectionId,
address owner
) external view override returns (bool) {
return _getAttestationValue(collectionId, owner) != 0;
}
| 1,931,108 |
pragma solidity ^0.4.24;
/*************************************************
* Title: ERC20 Token
* Author: https://github.com/willitscale
* Date: NA
* Code version: NA
* Availability: https://github.com/willitscale/learning-solidity/blob/master/tutorial-10/MyFirstToken.sol
*********************************************... | send `_value` token to `_to` from `msg.sender` _to The address of the recipient _value The amount of token to be transferred return Whether the transfer was successful or not | function transfer(address _to, uint256 _value) external isNotPaused returns (bool){
require(_balanceOf[msg.sender] >= _value);
require(_value > 0);
require(_value < MAX_LIMIT);
require(!isContract(_to));
require(_to != address(0));
require(_allowance[msg.sender][_to] >= _value);
... | 12,780,466 |
./partial_match/1/0x4b4a9706c9D275067f84c1521EFe37D1545cA913/sources/StakefishTransactionFeePool.sol | Collect accumulated commission fees, up to amountRequested. If amountRequested is unspecified, collect all fees. | function collectPoolCommission(address payable beneficiary, uint256 amountRequested)
external
override
nonReentrant
adminOnly
{
updateComputationCache();
if (amountRequested == 0 || cache.totalUncollectedCommission < amountRequested) {
uint256 payout = ... | 2,718,750 |
./partial_match/1/0x373ae78a14577682591E088F2E78EF1417612c68/sources/contracts/mock/MockUniswapV2Router02.sol | fetches and sorts the reserves for a pair | function getReserves(
address factory,
address tokenA,
address tokenB
) internal view returns (uint reserveA, uint reserveB) {
(address token0, ) = sortTokens(tokenA, tokenB);
(uint reserve0, uint reserve1, ) =
MockUniswapV2Router02IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserv... | 4,169,196 |
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.7.4;
pragma experimental ABIEncoderV2;
import "../interfaces/INiftyswapExchange20.sol";
import "../utils/ReentrancyGuard.sol";
import "@0xsequence/erc-1155/contracts/interfaces/IERC20.sol";
import "@0xsequence/erc-1155/contracts/interfaces/IERC165.sol";
import "@... | Return price for `Token _id => currency` trades with an exact token amount. _ids Array of IDs token sold. _tokensSold Array of amount of each Token sold. return Amount of currency that can be bought for Tokens in _ids for amounts in _tokensSold/ Load Token id reserve | function getPrice_tokenToCurrency(
uint256[] calldata _ids,
uint256[] calldata _tokensSold)
override external view returns (uint256[] memory)
{
uint256 nIds = _ids.length;
uint256[] memory prices = new uint256[](nIds);
for (uint256 i = 0; i < nIds; i++) {
uint256 tokenReserve = token.... | 1,793,729 |
/**
*Submitted for verification at Etherscan.io on 2020-09-04
*/
// Copyright (C) 2020 Maker Ecosystem Growth Holdings, INC.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either... | https:github.com/dapphub/ds-pause | interface DSPauseAbstract {
function setOwner(address) external;
function setAuthority(address) external;
function setDelay(uint256) external;
function plans(bytes32) external view returns (bool);
function proxy() external view returns (address);
function delay() external view returns (uint256);... | 5,535,256 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
interface IERC20 {
function TOTALSUPPLY267() exte... | average dollar value of vault share token inject NONSTANDARD NAMING | function GET_VIRTUAL_PRICE769() external view returns (uint); | 13,085,363 |
./partial_match/1/0xD1C833b46266CcF6060e90B69161FCEe9C66E826/sources/src/NightWatch.sol | Owner only function to set the default royalty. receiver Address of the royalty receiver. feeNumerator Numerator of the royalty fee. | function setDefaultRoyalty(
address receiver,
uint96 feeNumerator
) external onlyOwner {
_setDefaultRoyalty(receiver, feeNumerator);
}
CONTRACT ADDRESSES
| 15,944,846 |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.2;
/// @title: David Ariew X Tatler China
import "../ERC721ProjectUpgradeable.sol";
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////... | Mint token with no manager/ Track the manager that minted the token | function _adminMint(address to, string memory uri) internal virtual returns (uint256 tokenId) {
_tokenCount++;
tokenId = _tokenCount;
_tokensManager[tokenId] = address(this);
_safeMint(to, tokenId);
if (bytes(uri).length > 0) {
_tokenURIs[tokenId] = uri;
... | 12,006,224 |
pragma solidity ^0.4.24;
// ----------------------------------------------------------------------------
// 'DYF Token' Smart Contract
//
// OwnerAddress :
// Symbol :
// Name :
// Total Supply :
// Decimals : 18
// Copyrights of 'DYFToken' With 'DYF' Symbol October 25, 2020.
// The MIT Licence.
//... | ------------------------------------------------------------------------ function to stop the ICO ------------------------------------------------------------------------ | function stopPRESALE() onlyOwner public {
isStopped = true;
}
| 1,245,693 |
./full_match/5/0x0c3911b94b3e0c91f0042914a9268fBBec788AE1/sources/contracts/guild-core/GuildID.sol | Upgrades the avatar ID of the guild ID NFT owned by the given user. Only the guild contract is allowed to call this function. user The address of the user that owns the guild ID NFT. newAvatarID The ID of the new avatar to use./ | function upgradeAvatar(address user, uint32 newAvatarID) external onlyGuildContract {
uint256 tokenID = getID(user);
_data[tokenID].avatarID = newAvatarID;
}
SETTERS
| 1,881,664 |
pragma solidity ^0.5.0;
import 'openzeppelin-solidity/contracts/utils/Address.sol';
import 'openzeppelin-solidity/contracts/drafts/Counters.sol';
import 'openzeppelin-solidity/contracts/math/SafeMath.sol';
import 'openzeppelin-solidity/contracts/token/ERC721/IERC721Receiver.sol';
import "./Oraclize.sol";
contract O... | Private function to remove a token from this extension's ownership-tracking data structures. Note that while the token is not assigned a new owner, the _ownedTokensIndex mapping is _not_ updated: this allows for gas optimizations e.g. when performing a transfer operation (avoiding double writes). This has O(1) time com... | function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
uint256 lastTokenIndex = _ownedTokens[from].length.sub(1);
uint256 tokenIndex = _ownedTokensIndex[tokenId];
if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
}
| 1,847,867 |
./full_match/1/0x361384A0d755f972E5Eea26e4F4efBAf976B6461/sources/contracts/external/aave/incentives/base/DistributionManager.sol | ON MINT we will not assign any rewards because stakedByUser == 0 however if notification was not done, then on claim stakedByUser != 0 and we enter this place in code and we apply rewards for user who JUST stake | function _updateUserAssetInternal(
address user,
address asset,
uint256 totalStaked
if (userIndex != newIndex) {
if (stakedByUser != 0) {
accruedRewards = _getRewards(stakedByUser, newIndex, userIndex);
}
emit UserIndexUpdated(user... | 4,835,717 |
./full_match/42/0x7b3DaF0F9F6e14c8690b567E84F9141d0C6Ce81c/sources/browser/DDSPools1.sol | 接口参数getMargin(string memory exchangeEx, uint256 amount, uint256 openprice, uint256 pooltype) external view returns (uint256 marginfee, uint256 forcefee) | function getLockedAmount(uint256 amount,uint256 currentPrice,string memory exchangeType,uint256 poolType) public view returns(uint256 marginFee, uint256 forceFee){
}
| 9,569,179 |
./full_match/43113/0x19dc831e7586475d83650Ad11d757eA2058133F7/sources/LdpCommissions.sol | Gets the commission fees of a certain transaction type _txType transaction type key _index commissions index return flatFee/ | function getCBFlatFee(TxType _txType, uint _index) public view override returns(uint256) {
return (CB_Fees[_txType].commissions[_index].flatFee);
}
| 13,175,468 |
//
// File smart contract remix test class.
//
// @author Matthew Casey
//
// (c) University of Surrey 2019
//
pragma solidity ^0.5.3;
import "remix_tests.sol";
import "./file.sol";
//
// File contract tests.
//
contract FileTest {
//
// Test adding chunks.
//
function testAddChunk() public {
File file ... | Test getting chunks. | function testGetChunk() public {
File file = new File();
Assert.equal(file.getNumberOfChunks(), 0, "should have 0 chunks");
Assert.equal(file.addChunk("0123456789"), 1, "should add chunk 1");
Assert.equal(file.getChunk(0), "0123456789", "should get chunk 1");
Assert.equal(file.addChunk("0123456... | 12,899,283 |
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
/// @title MixDAO Alpha Pass
/// @author MilkyTaste @ Ao Collaboration Ltd.
/// https://mixdao.club
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "./Payable.sol";
contrac... | Update maximum number of tokens per wallet during the public sale. This parameter only affects the public sale. maxWallet The maximum number of tokens available per wallet for the public sale/ | function setMaxWallet(uint256 maxWallet) external onlyOwner {
maxWalletPlusOne = maxWallet + 1;
}
| 1,615,569 |
./full_match/80001/0x8D2C372317524a8Af5313883434411fd3DAE55d9/sources/contracts/lib/Executor.sol | Internal function to trigger a call to the conduit currently held by the accumulator if the accumulator contains item transfers (i.e. it is "armed"). accumulator An open-ended array that collects transfers to execute against a given conduit in a single call./ Exit if the accumulator is not... | function _triggerIfArmed(bytes memory accumulator) internal {
if (accumulator.length != AccumulatorArmed) {
return;
}
}
| 878,169 |
./full_match/5/0xDb80166478D50EDEFc4dD72c304d44D270c6b494/sources/contracts/core/interfaces/IAttestationsRegistry.sol | IAttestationsRegistry Sismo This is the interface of the AttestationRegistry/ | interface IAttestationsRegistry is IAttestationsRegistryConfigLogic {
error IssuerNotAuthorized(address issuer, uint256 collectionId);
error OwnersAndCollectionIdsLengthMismatch(address[] owners, uint256[] collectionIds);
event AttestationRecorded(Attestation attestation);
event AttestationDeleted(Attestation a... | 1,931,232 |
pragma solidity ^0.4.21;
// File: contracts/P4RTYRelay.sol
/*
* Visit: https://p4rty.io
* Discord: https://discord.gg/7y3DHYF
* Copyright Mako Labs LLC 2018 All Rights Reseerved
*/
interface P4RTYRelay {
/**
* @dev Will relay to internal implementation
* @param beneficiary Token purchaser... | Calculate Token price based on an amount of incoming ethereum It's an algorithm, hopefully we gave you the whitepaper with it in scientific notation; Some conversions occurred to prevent decimal errors or underflows / overflows in solidity code./ | function ethereumToTokens_(uint256 _ethereum) internal pure returns (uint256) {
return SafeMath.mul(_ethereum, tokenRatio_);
}
| 6,464,385 |
./full_match/80001/0xEc14c01136e0E1e815C9fBf369276397d0804fc3/sources/lib/prb-math/src/sd59x18/Math.sol | Calculates the binary logarithm of x. Based on the iterative approximation algorithm. https://en.wikipedia.org/wiki/Binary_logarithmIterative_approximation Requirements: - x must be greater than zero. Caveats: - The results are not perfectly accurate to the last decimal, due to the lossy precision of the iterative app... | function log2(SD59x18 x) pure returns (SD59x18 result) {
int256 xInt = unwrap(x);
if (xInt <= 0) {
revert PRBMath_SD59x18_Log_InputTooSmall(x);
}
unchecked {
int256 sign;
if (xInt >= uUNIT) {
sign = 1;
sign = -1;
xInt = 1e36 / xInt;
}
... | 9,493,552 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of... | Enable support for meta transactions | function enableMetaTxns() public onlyOperator {
require(!metaTxnsEnabled, "SoulVault: meta transactions are already enabled");
metaTxnsEnabled = true;
emit MetaTxnsEnabled(_msgSender());
}
| 12,558,992 |
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/// @title Dynamic Vesting Escrow
/// @author Curve Finance, Yearn Finance, vasa (@vasa-develop)
/// @notice A vesting escsrow for dynamic teams, based on Curve vesting escrow
/// @dev A vesting escsrow for dynamic teams, based on Curve vesting escrow
import "@... | Allows owner to transfer the ERC20 assets (other than token) to the "to" address in case of any emergency It is assumed that the "to" address is NOT malicious Only owner of the vesting escrow can invoke this function. Reverts if the asset address is a zero address or the token address. Reverts if the to... | function inCaseAssetGetStuck(address asset, address to)
external
onlyOwner
returns (uint256 rescued)
{
require(
asset != address(0),
"inCaseAssetGetStuck: asset cannot be 0 address"
);
require(asset != token, "inCaseAssetGetStuck: cannot wi... | 1,008,519 |
./full_match/1/0xC72bda59E382be10bb5D71aBd01Ecc65aa16fD83/sources/contracts/strategies/MorphoAaveStrategy.sol | Total value represented by decimal position of underlying token | function _checkBalance(address _asset)
internal
view
returns (uint256 balance)
{
address pToken = address(_getPTokenFor(_asset));
(, , balance) = ILens(LENS).getCurrentSupplyBalanceInOf(
pToken,
address(this)
);
}
| 9,785,678 |
./partial_match/1/0xE62aDCBae40bAe7F613Cb6D9630E8A60c6ca15C4/sources/BEPE.sol | Interface of the ERC20 standard as defined in the EIP./ | interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
... | 2,863,393 |
pragma solidity >=0.5.0 <0.7.0;
import "@aztec/protocol/contracts/interfaces/IAZTEC.sol";
import "@aztec/protocol/contracts/libs/NoteUtils.sol";
import "@aztec/protocol/contracts/ERC1724/ZkAsset.sol";
import "./ZKERC20/ZKERC20.sol";
import "./Loan.sol";
contract LoanDapp is IAZTEC {
using NoteUtils for bytes;
... | allows loan instance to spend the note | function approveLoanNotional(
bytes32 _noteHash,
bytes memory _signature,
address _loanId
) public {
Loan loanContract = Loan(_loanId);
loanContract.confidentialApprove(_noteHash, _loanId, true, _signature);
emit LoanApprovedForSettlement(_loanId);
}
| 1,070,323 |
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract SafleToken is ERC20, Ownable {
uint256 constant _totalSupply = 1000000000 * 10 **... | Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair/ | function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name())), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, del... | 12,743,357 |
/*
* Semaphore - Zero-knowledge signaling on Ethereum
* Copyright (C) 2020 Barry WhiteHat <barrywhitehat@protonmail.com>, Kobi
* Gurkan <kobigurk@gmail.com> and Koh Wei Jie (contact@kohweijie.com)
*
* This file is part of Semaphore.
*
* Semaphore is free software: you can redistribute it and/or modify
* it unde... | Deactivate an external nullifier. The external nullifier must already be active for this function to work. Only the owner can do this. _externalNullifier The new external nullifier to deactivate./ The external nullifier must already exist The external nullifier must already be active Deactivate the external nullifier.... | function deactivateExternalNullifier(uint232 _externalNullifier) public
onlyOwner {
require(
externalNullifierLinkedList[_externalNullifier].exists,
"Semaphore: external nullifier not found"
);
require(
externalNullifierLinkedList[_externalNullifier].... | 7,232,884 |
// SPDX-License-Identifier: MIT
pragma solidity =0.8.4;
import {SafeMath} from "@openzeppelin/contracts/utils/math/SafeMath.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {
SafeERC20
} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {GnosisAuction} from "... | Completes a scheduled withdrawal from a past round. Uses finalized pps for the round minETHOut is the min amount of `asset` to recieve for the swapped amount of steth in crv pool return amountETHOut the current withdrawal amount/ This checks if there is a withdrawal We leave the round number as non-zero to save on gas... | function _completeWithdraw(uint256 minETHOut) internal returns (uint256) {
Vault.Withdrawal storage withdrawal = withdrawals[msg.sender];
uint256 withdrawalShares = withdrawal.shares;
uint256 withdrawalRound = withdrawal.round;
require(withdrawalShares > 0, "Not initiated");
... | 13,498,189 |
./partial_match/56/0xB8B3776bB2688A3e9fe7A9B76C3F83afdCd6E7b9/sources/ICEChef.sol | Withdraw LP tokens from ICEChef. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.accICEPerShare... | 11,216,535 |
pragma solidity ^0.5.11;
// ----------------------------------------------------------------------------
// PEG Stable Coin
//
// Symbol : PEG
// Name : PEG Stable Coin
// Decimals : 18
//
// Ciarán Ó hAoláin, Phil Maguire 2019. Maynooth University 2019. The MIT License.
// -----------------------------... | ------------------------------------------------------------------------ Transfer `tokens` from the `from` account to the `to` account. Caller must be approved to spend these funds. Can't be to the PEG contract (for conversion). Transfer `tokens` from the `from` account to the `to` account. Caller must be approved to... | function transferFrom(address from, address to, uint256 tokens) public returns (bool success) {
require(to != address(0) && to != address(this));
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to... | 1,083,673 |
./full_match/4/0x83A3bDFf03E8512eD33B8a84B0751A52127F3DdF/sources/browser/MultiSigWallet.sol | Update the signature threshold to send a transaction. _newThreshold, the new threshold, must be greater or equal to 2 | function updatePerformTransactionSignatureThreshold(
uint _newThreshold
)
external
isUnbankOwner(msg.sender)
returns (bool)
{
require(_newThreshold >= 2);
performTransactionSignatureThreshold = _newThreshold;
emit EventPerformTransactionSignatureThresholdUpdated(t... | 770,043 |
/**
*Submitted for verification at Etherscan.io on 2022-01-31
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
/// @title Connect Four
/// @author Miguel Piedrafita
/// @notice An optimised connect four game implementation on Solidity
contract ConnectFour {
/// ERRORS ///
/// @notice Thrown when trying... | Perform a move on an active game gameId The ID of the game you want to perform your move on row The row on where you want to drop your piece | function makeMove(uint256 gameId, uint8 row) public payable {
Game storage game = getGame[gameId];
if (msg.sender != (game.moves & 1 == 0 ? game.player1 : game.player2)) revert Unauthorized();
if (game.finished) revert GameFinished();
emit MovePerformed(msg.sender, gameId, row);
game.board[game.moves & 1] ... | 6,756,748 |
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
contract GameLand is ERC721Holder {
address public testnft;
constructor(address _nftaddress) {
testnft = _nftaddress;
}
struct Nft {
//price represent in... | Get the borrower, repay_time, added by ting | function get_borrow_info(uint256 nft_id) public view returns (address, uint256) {
return (
borrow_status[nft_id].borrower,
borrow_status[nft_id].repay_time
);
}
| 7,212,180 |
./full_match/5/0x5F81EECFf9278306D48D328d4aaefCf3C8EAbE18/sources/h/gg.sol | ETH balances aren't saved into state | function withdraw(address token, uint256 amount) external {
Types.BankState memory cachedBankState = state;
totalDeposits[token] -= amount;
if (token == TOKEN_ETH) {
require(userEthBalances[msg.sender] >= amount);
userEthBalances[msg.sender] -= amount;
... | 1,877,192 |
// SPDX-License-Identifier: MIT
//
//
//
// -d`
// ... | List NFTs owned by address. As total amount of NFTs is low - ok to iterate thru all of them/ | function listNFTs(address _owner) external view returns(uint256[] memory) {
uint256[] memory balances = new uint256[](Nfts.length);
for (uint256 i = 0; i < Nfts.length; i++) {
balances[i] = balanceOf(_owner, i);
}
return balances;
}
| 13,809,540 |
./partial_match/4/0x86614235b3dFE0b96D3355EB0cF0e7830af465B0/sources/RoboController.sol | Set the airdrop contract (MerkleDistributor) address in order to be aware of participants to automatically receive rewards once enabled NOTE: only governance account can call (initial deployer) NOTE: can only be set once/ | function setAirdropContract(address _airdropContract) external onlyGovernance override {
require(airdropContract == address(0), "RoboController::setAirdropContract:: airdropContract already set");
require(_airdropContract != address(0), "RoboController::setAirdropContract:: param must not be 0 address");
... | 8,568,563 |
/*
file: Base.sol
ver: 0.2.1
updated:18-Nov-2016
author: Darryl Morris (o0ragman0o)
email: o0ragman0o AT gmail.com
An basic contract furnishing inheriting contracts with ownership, reentry
protection and safe sending functions.
This software is distributed in the hope that it will be useful,
but WITH... | Can be used before `insert` to build an ordered list `a` an existing node to search from, e.g. HEAD. `b` value to seek `r` first node beyond `b` in direction `d` | function seek(CLL storage self, uint a, uint b, bool d)
internal constant returns (uint r)
{
r = step(self, a, d);
while ((b!=r) && ((b < r) != d)) r = self.cll[r][d];
return;
}
| 1,055,308 |
// SPDX-License-Identifier: MIT
// Version: 0.1.0, 1/20/2021
pragma solidity >=0.6.2 <0.8.0;
import "../interface/IERC20.sol";
import "../interface/IPToken.sol";
import "../interface/ILToken.sol";
import "../interface/IOracle.sol";
import "../interface/ILiquidatorQualifier.sol";
import "../interface/IMigratablePool.... | Check price signature/ | function _checkPriceSignature(uint256 timestamp, uint256 price, uint8 v, bytes32 r, bytes32 s)
internal view
{
require(v == 27 || v == 28, "PerpetualPool: v not valid");
bytes32 message = keccak256(abi.encodePacked(_symbol, timestamp, price));
bytes32 hash = keccak256(abi.encodeP... | 582,155 |
/**
*Submitted for verification at Etherscan.io on 2020-08-03
*/
pragma solidity 0.5.16;
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in exist... | Withdraws given stake amount from the pool _amount Units of the staked token to withdraw/ | function withdraw(uint256 _amount)
public
updateReward(msg.sender)
{
require(_amount > 0, "Cannot withdraw 0");
_withdraw(_amount);
emit Withdrawn(msg.sender, _amount);
}
| 1,083,786 |
./full_match/1/0xacBD0767418b8C00ff70df1fF9D5c317F4349384/sources/src/arbi-fed/AuraFarmer.sol | Allows the guardian or governor to set the maximum loss for withdrawals in basis points. Guardian may only set the max loss up to the limit of maxLossSetableByGuardianBps newMaxLossWithdrawBps The new maximum loss for withdrawals in basis points./ | function setMaxLossWithdrawBps(uint newMaxLossWithdrawBps) onlyGuardian external {
if(msg.sender == l2Guardian && newMaxLossWithdrawBps > maxLossSetableByGuardianBps) revert MaxLossHigherThanSetableByGuardian();
if(newMaxLossWithdrawBps >= 10000) revert WithdrawMaxLossTooHigh();
maxLossWith... | 17,101,153 |
./full_match/314/0x83702C6356A1028A900F83d446D189a31646a16b/sources/contracts/modules/Payments.sol | Wrap an amount of stETH into wstETH recipient The recipient of the wstETH amount The amount of wstETH desired | function wrapSTETH(address recipient, uint256 amount) internal {
if (amount == Constants.CONTRACT_BALANCE) {
amount = STETH.balanceOf(address(this));
revert InsufficientSTETH();
}
if (amount > 0) {
if (STETH.allowance(address(this), address(WSTETH)) < amo... | 8,081,572 |
./partial_match/1/0xFC3e57B4FAD993813bD9A09951274102aC1F3Bd8/sources/contracts/UserIncentive.sol | If the reward amount is greater than balance, transfer entire balance | function quoteReward(uint256 _fERC20Burned) public view override returns (uint256) {
if (rewardRatio == 0) {
return 0;
}
uint256 rewardAmount = (_fERC20Burned * rewardRatio) / (10**18);
if (rewardAmount > rewardTokenBalance) {
rewardAmount = rewardTokenBalanc... | 16,136,250 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.